@@ -37,19 +37,16 @@ std::unique_ptr<Chunk> Generator::generate(ivec3 cpos) const {
3737}
3838
3939Block::unique_ptr_t Generator::computeSurfaceBlock (ivec3 const & pos, Biome const & biome, int const & blockHeight) const {
40- if (abs (pos.y ) < 3 && biome.type == BiomeType::SEA) return Block::create_static<Sand_Block>();
41- if (abs (pos.y ) < 2 ) return Block::create_static<Sand_Block>();
42- if (pos.y <= 0 ) return AllBlocks::create_static (biome.underWaterBlock );
43- if (pos.y > 35 + valueNoise.sample1D (ivec2 (pos.x , pos.z ) + ivec2 (67 , 102 )) % 5 && biome.surface != BlockType::Ice) return Block::create_static<Snow_Block>();
44- if (pos.y > 8 + valueNoise.sample1D (ivec2 (pos.x , pos.z ) + ivec2 (-12 , 0 )) % 2 && biome.surface == BlockType::Sand) return Block::create_static<Snow_Block>();
40+ if (abs (pos.y ) < 3 . f && biome.type == BiomeType::SEA) return Block::create_static<Sand_Block>();
41+ if (abs (pos.y ) < 2 . f ) return Block::create_static<Sand_Block>();
42+ if (pos.y <= 0 . f ) return AllBlocks::create_static (biome.underWaterBlock );
43+ if (pos.y > 35 . f + valueNoise.sample1D (ivec2 (pos.x , pos.z ) + ivec2 (67 , 102 )) % 5 && biome.surface != BlockType::Ice) return Block::create_static<Snow_Block>();
44+ if (pos.y > 8 . f + valueNoise.sample1D (ivec2 (pos.x , pos.z ) + ivec2 (-12 , 0 )) % 2 && biome.surface == BlockType::Sand) return Block::create_static<Snow_Block>();
4545 if (pos.y != blockHeight && biome.surface == BlockType::Grass)return Block::create_static<Dirt_Block>();
4646
4747 return AllBlocks::create_static (biome.surface );
4848}
4949
50-
51-
52-
5350Block::unique_ptr_t Generator::createBlock (ivec3 pos, Biome const & biome) const {
5451 Block::unique_ptr_t block;
5552 float height = noise.fractal2 (ivec2 (pos.x , pos.z ), biome.frequencies );
@@ -65,13 +62,13 @@ Block::unique_ptr_t Generator::createBlock(ivec3 pos, Biome const& biome) const
6562 return Block::create_static<Air_Block>();
6663 }
6764 }
68- if (pos.y >= blockHeight - (valueNoise.sample1D (ivec2 (pos.x , pos.z ) + ivec2 (-91 , 859 )) % 3 ))
65+ if (pos.y >= blockHeight - (int )( valueNoise.sample1D (ivec2 (pos.x , pos.z ) + ivec2 (-91 , 859 )) % 3 ))
6966 return computeSurfaceBlock (pos, biome, blockHeight);
70-
71- if (pos.y >= blockHeight - (2 + valueNoise.sample1D (ivec2 (pos.x ,pos.z ) + ivec2 (2 ,-59 )) % 3 ))
67+
68+ if (pos.y >= blockHeight - (int )( 2 + valueNoise.sample1D (ivec2 (pos.x ,pos.z ) + ivec2 (2 ,-59 )) % 3 ))
7269 block = AllBlocks::create_static (biome.underLayers );
73-
74-
70+
71+
7572 return Block::create_static<Stone_Block>();
7673}
7774
0 commit comments