mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-06-17 16:17:02 +08:00
fix: y is too height
This commit is contained in:
@@ -249,8 +249,13 @@ void Chunk::resolve_blocks() {
|
|||||||
float temp = PerlinNoise::noise(world_x * BIOME_NOISE_FREQUENCY, 0.0f, world_z * BIOME_NOISE_FREQUENCY);
|
float temp = PerlinNoise::noise(world_x * BIOME_NOISE_FREQUENCY, 0.0f, world_z * BIOME_NOISE_FREQUENCY);
|
||||||
float humid = PerlinNoise::noise(world_x * BIOME_NOISE_FREQUENCY, 1.0f, world_z * BIOME_NOISE_FREQUENCY);
|
float humid = PerlinNoise::noise(world_x * BIOME_NOISE_FREQUENCY, 1.0f, world_z * BIOME_NOISE_FREQUENCY);
|
||||||
int height = get_interpolated_height(world_x, world_z, temp, humid);
|
int height = get_interpolated_height(world_x, world_z, temp, humid);
|
||||||
heights[x][z] = height;
|
|
||||||
auto biome = get_biome_from_noise(temp, humid);
|
auto biome = get_biome_from_noise(temp, humid);
|
||||||
|
if (height >= SIZE_Y) {
|
||||||
|
Logger::warn("height: {} is exceed max_height", height);
|
||||||
|
height = SIZE_Y - 1;
|
||||||
|
}
|
||||||
|
heights[x][z] = height;
|
||||||
for (int y = 5; y < height - 5; y++) {
|
for (int y = 5; y < height - 5; y++) {
|
||||||
m_blocks[get_index(x, y, z)] = 3;
|
m_blocks[get_index(x, y, z)] = 3;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user