12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #include "OverworldDimension.h"
- #include "FastNoiseWrapper.h"
- #include "GrasslandBiom.h"
- #include "RandNoise.h"
- #include "WormCaveGenerator.h"
- OverworldDimension::OverworldDimension()
- : DimensionGenerator(
- DimensionEnum::OVERWORLD, new WormCaveGenerator(75, 150, 1, 6, 0.1f))
- {
- registerBiom(new GrasslandBiom(), 1.0);
- biomNoise = 0;
- structureNoise = 0;
- }
- OverworldDimension::~OverworldDimension()
- {
- if (biomNoise) biomNoise->release();
- if (structureNoise) structureNoise->release();
- }
- Noise* OverworldDimension::zBiomNoise()
- {
- 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()
- {
- if (structureNoise) return structureNoise;
- structureNoise = new RandNoise(seed);
- return structureNoise;
- }
|