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

39 lines
812 B
C++

#ifndef ISTD_TILEMAP_CHUNK_H
#define ISTD_TILEMAP_CHUNK_H
#include "tile.h"
#include <cstdint>
namespace istd {
// Forward declaration
enum class BiomeType : std::uint8_t;
// Represents the position of a tile in the map, using chunk and local
// coordinates
struct TilePos {
uint8_t chunk_x;
uint8_t chunk_y;
uint8_t local_x;
uint8_t local_y;
};
struct Chunk {
// Size of a chunk in tiles (64 x 64)
static constexpr uint8_t size = 64;
// Each sub-chunk is 16x16 tiles
static constexpr uint8_t subchunk_size = 16;
// Number of sub-chunks in each dimension
static constexpr uint8_t subchunk_count = size / subchunk_size;
// 64x64 array of tile types
Tile tiles[size][size];
// 4x4 array of biomes for sub-chunks
BiomeType biome[subchunk_count][subchunk_count];
};
} // namespace istd
#endif