1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #include "GrasslandBiom.h"
- #include "BlockType.h"
- #include "BasicBlocks.h"
- #include "FastNoiseLite.h"
- #include "FastNoiseWrapper.h"
- #include "TreeTemplate.h"
- GrasslandBiom::GrasslandBiom()
- : BiomGenerator()
- {
- addTemplateGenerator( new TreeTemplate( 0.02f, BirchBlockType::INSTANCE, LeavesBlockType::INSTANCE, 8, 15 ) );
- addTemplateGenerator( new TreeTemplate( 0.01f, BeechBlockType::INSTANCE, LeavesBlockType::INSTANCE, 8, 13 ) );
- addTemplateGenerator( new TreeTemplate( 0.005f, OakBlockType::INSTANCE, LeavesBlockType::INSTANCE, 10, 15 ) );
- heightNoise = 0;
- }
- GrasslandBiom::~GrasslandBiom()
- {
- if( heightNoise )
- heightNoise->release();
- }
- Framework::Either<Block*, int> GrasslandBiom::generateSurfaceBlock( int x, int y, int z )
- {
- return DirtBlockType::ID;
- }
- Framework::Either<Block*, int> GrasslandBiom::generateBelowSurfaceBlock( int x, int y, int z )
- {
- return StoneBlockType::ID;
- }
- Noise* GrasslandBiom::zHeightMapNoise( int seed )
- {
- if( heightNoise )
- return heightNoise;
- FastNoiseLite* noise = new FastNoiseLite( seed );
- noise->SetNoiseType( FastNoiseLite::NoiseType::NoiseType_ValueCubic );
- FastNoiseWrapper* wrapper = new FastNoiseWrapper( noise, seed );
- wrapper->setMultiplier( 0.2f );
- heightNoise = wrapper;
- return heightNoise;
- }
|