szdytom 0b245e0483
feat: Add dual noise terrain generation demo
- Introduced a new example `dual_noise_demo.cpp` to showcase the base and surface generation system.
- Updated biome properties to include ice thresholds and surface feature parameters.
- Enhanced chunk structure to support biomes for sub-chunks.
- Refactored terrain generation logic to separate base terrain and surface feature generation.
- Improved biome determination logic to include new biomes and their properties.
- Updated tile representation to use enums for base and surface tile types.
- Added detailed analysis of generated terrain and sample tile outputs in the demo.

Signed-off-by: szdytom <szdytom@qq.com>
2025-08-01 15:32:36 +08:00

46 lines
916 B
C++

#ifndef ISTD_TILEMAP_TILE_H
#define ISTD_TILEMAP_TILE_H
#include <cstdint>
#include <stdexcept> // For std::invalid_argument
namespace istd {
enum class BaseTileType : std::uint8_t {
Land,
Mountain,
Sand,
Water,
Ice,
_count
};
enum class SurfaceTileType : std::uint8_t {
Empty,
Wood,
Snow,
Structure, // Indicates this tile is occupied by a player-built structure,
// should never be natually generated.
_count
};
constexpr std::uint8_t base_tile_count
= static_cast<std::uint8_t>(BaseTileType::_count);
constexpr std::uint8_t surface_tile_count
= static_cast<std::uint8_t>(SurfaceTileType::_count);
static_assert(base_tile_count <= 16, "Base tile don't fit in 4 bits");
static_assert(surface_tile_count <= 16, "Surface tile don't fit in 4 bits");
struct Tile {
BaseTileType base : 4;
SurfaceTileType surface : 4;
};
static_assert(sizeof(Tile) == 1);
} // namespace istd
#endif