1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include "OverworldDimension.h"
- #include "GrasslandBiom.h"
- #include "FastNoiseWrapper.h"
- #include "RandNoise.h"
- OverworldDimension::OverworldDimension()
- : DimensionGenerator(ID)
- {
- registerBiom(new GrasslandBiom(), 1.0);
- biomNoise = 0;
- structureNoise = 0;
- }
- OverworldDimension::~OverworldDimension()
- {
- if (biomNoise)
- biomNoise->release();
- if (structureNoise)
- structureNoise->release();
- }
- Noise* OverworldDimension::zBiomNoise(int seed)
- {
- if (biomNoise)
- return biomNoise;
- FastNoiseLite* noise = new FastNoiseLite(seed);
- noise->SetNoiseType(FastNoiseLite::NoiseType::NoiseType_Cellular);
- noise->SetRotationType3D(FastNoiseLite::RotationType3D::RotationType3D_None);
- noise->SetFrequency(0.015f);
- noise->SetFractalType(FastNoiseLite::FractalType::FractalType_None);
- noise->SetCellularDistanceFunction(FastNoiseLite::CellularDistanceFunction::CellularDistanceFunction_Hybrid);
- noise->SetCellularReturnType(FastNoiseLite::CellularReturnType::CellularReturnType_CellValue);
- noise->SetCellularJitter(1.f);
- noise->SetDomainWarpType(FastNoiseLite::DomainWarpType::DomainWarpType_OpenSimplex2Reduced);
- noise->SetDomainWarpAmp(30.f);
- biomNoise = new FastNoiseWrapper(noise, seed);
- return biomNoise;
- }
- Noise* OverworldDimension::zStructureNoise(int seed)
- {
- if (structureNoise)
- return structureNoise;
- structureNoise = new RandNoise(seed);
- return structureNoise;
- }
|