#include <noise.h>
Public Member Functions | |
Noise (const NoiseParams *np, s32 seed, u32 sx, u32 sy, u32 sz=1) | |
~Noise () | |
void | setSize (u32 sx, u32 sy, u32 sz=1) |
void | setSpreadFactor (v3f spread) |
void | setOctaves (int octaves) |
void | gradientMap2D (float x, float y, float step_x, float step_y, s32 seed) |
void | gradientMap3D (float x, float y, float z, float step_x, float step_y, float step_z, s32 seed) |
float * | perlinMap2D (float x, float y, float *persistence_map=NULL) |
float * | perlinMap3D (float x, float y, float z, float *persistence_map=NULL) |
float * | perlinMap2D_PO (float x, float xoff, float y, float yoff, float *persistence_map=NULL) |
float * | perlinMap3D_PO (float x, float xoff, float y, float yoff, float z, float zoff, float *persistence_map=NULL) |
Public Attributes | |
NoiseParams | np |
s32 | seed |
u32 | sx |
u32 | sy |
u32 | sz |
float * | noise_buf = nullptr |
float * | gradient_buf = nullptr |
float * | persist_buf = nullptr |
float * | result = nullptr |
Private Member Functions | |
void | allocBuffers () |
void | resizeNoiseBuf (bool is3d) |
void | updateResults (float g, float *gmap, const float *persistence_map, size_t bufsize) |
Noise::Noise | ( | const NoiseParams * | np, |
s32 | seed, | ||
u32 | sx, | ||
u32 | sy, | ||
u32 | sz = 1 ) |
Noise::~Noise | ( | ) |
References gradient_buf, noise_buf, persist_buf, and result.
|
private |
References gradient_buf, noise_buf, persist_buf, resizeNoiseBuf(), result, sx, sy, and sz.
Referenced by Noise(), and setSize().
void Noise::gradientMap2D | ( | float | x, |
float | y, | ||
float | step_x, | ||
float | step_y, | ||
s32 | seed ) |
References biLinearInterpolation(), NoiseParams::flags, gradient_buf, idx, noise2d(), noise_buf, NOISE_FLAG_DEFAULTS, NOISE_FLAG_EASED, np, seed, sx, and sy.
Referenced by perlinMap2D().
void Noise::gradientMap3D | ( | float | x, |
float | y, | ||
float | z, | ||
float | step_x, | ||
float | step_y, | ||
float | step_z, | ||
s32 | seed ) |
References NoiseParams::flags, gradient_buf, idx, noise3d(), noise_buf, NOISE_FLAG_EASED, np, seed, sx, sy, sz, and triLinearInterpolation().
Referenced by perlinMap3D().
float * Noise::perlinMap2D | ( | float | x, |
float | y, | ||
float * | persistence_map = NULL ) |
References gradientMap2D(), NoiseParams::lacunarity, np, NoiseParams::octaves, NoiseParams::offset, NoiseParams::persist, persist_buf, result, NoiseParams::scale, seed, NoiseParams::seed, NoiseParams::spread, sx, sy, and updateResults().
Referenced by BiomeGenOriginal::calcBiomeNoise(), OrePuff::generate(), OreSheet::generate(), OreStratum::generate(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), LuaPerlinNoiseMap::l_calc_2d_map(), LuaPerlinNoiseMap::l_get_2d_map(), LuaPerlinNoiseMap::l_get_2d_map_flat(), perlinMap2D_PO(), and TestNoise::testNoise2dBulk().
|
inline |
References np, perlinMap2D(), and NoiseParams::spread.
Referenced by MapgenV6::calculateNoise().
float * Noise::perlinMap3D | ( | float | x, |
float | y, | ||
float | z, | ||
float * | persistence_map = NULL ) |
References gradientMap3D(), NoiseParams::lacunarity, np, NoiseParams::octaves, NoiseParams::offset, NoiseParams::persist, persist_buf, result, NoiseParams::scale, seed, NoiseParams::seed, NoiseParams::spread, sx, sy, sz, and updateResults().
Referenced by OreBlob::generate(), OreVein::generate(), MapgenV5::generateBaseTerrain(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), MapgenCarpathian::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), LuaPerlinNoiseMap::l_calc_3d_map(), LuaPerlinNoiseMap::l_get_3d_map(), LuaPerlinNoiseMap::l_get_3d_map_flat(), perlinMap3D_PO(), TestNoise::testNoise3dBulk(), and TestNoise::testNoiseInvalidParams().
|
inline |
|
private |
References errorstream, NoiseParams::lacunarity, noise_buf, np, NoiseParams::octaves, NoiseParams::spread, sx, sy, and sz.
Referenced by allocBuffers(), setOctaves(), and setSpreadFactor().
void Noise::setOctaves | ( | int | octaves | ) |
References np, NoiseParams::octaves, resizeNoiseBuf(), and sz.
void Noise::setSize | ( | u32 | sx, |
u32 | sy, | ||
u32 | sz = 1 ) |
void Noise::setSpreadFactor | ( | v3f | spread | ) |
References np, resizeNoiseBuf(), NoiseParams::spread, and sz.
|
private |
References NoiseParams::flags, gradient_buf, NOISE_FLAG_ABSVALUE, np, and result.
Referenced by perlinMap2D(), and perlinMap3D().
float* Noise::gradient_buf = nullptr |
Referenced by ~Noise(), allocBuffers(), gradientMap2D(), gradientMap3D(), and updateResults().
float* Noise::noise_buf = nullptr |
Referenced by ~Noise(), allocBuffers(), gradientMap2D(), gradientMap3D(), and resizeNoiseBuf().
NoiseParams Noise::np |
Referenced by Noise(), MapgenV7::baseTerrainLevelAtPoint(), MapgenV6::baseTerrainLevelFromNoise(), MapgenV7::getMountainTerrainAtPoint(), MapgenCarpathian::getSpawnLevelAtPoint(), MapgenFlat::getSpawnLevelAtPoint(), MapgenFractal::getSpawnLevelAtPoint(), MapgenV5::getSpawnLevelAtPoint(), MapgenV7::getSpawnLevelAtPoint(), MapgenValleys::getSpawnLevelAtPoint(), gradientMap2D(), gradientMap3D(), LuaPerlinNoiseMap::packIn(), perlinMap2D(), perlinMap2D_PO(), perlinMap3D(), perlinMap3D_PO(), resizeNoiseBuf(), setOctaves(), setSpreadFactor(), and updateResults().
float* Noise::persist_buf = nullptr |
Referenced by ~Noise(), allocBuffers(), perlinMap2D(), and perlinMap3D().
float* Noise::result = nullptr |
Referenced by BiomeGenOriginal::BiomeGenOriginal(), ~Noise(), allocBuffers(), MapgenV6::baseTerrainLevelFromMap(), MapgenV7::baseTerrainLevelFromMap(), BiomeGenOriginal::calcBiomeNoise(), OreBlob::generate(), OrePuff::generate(), OreSheet::generate(), OreStratum::generate(), OreVein::generate(), MapgenV5::generateBaseTerrain(), MapgenBasic::generateBiomes(), CavernsNoise::generateCaverns(), CavesNoiseIntersection::generateCaves(), MapgenCarpathian::generateTerrain(), MapgenFlat::generateTerrain(), MapgenFractal::generateTerrain(), MapgenV7::generateTerrain(), MapgenValleys::generateTerrain(), MapgenV6::getBiome(), BiomeGenOriginal::getBiomeAtIndex(), BiomeGenOriginal::getBiomes(), MapgenV7::getFloatlandTerrainFromMap(), MapgenV6::getHaveBeach(), MapgenV6::getHumidity(), MapgenV7::getMountainTerrainFromMap(), MapgenV6::getMudAmount(), MapgenV7::getRiverChannelFromMap(), LuaPerlinNoiseMap::l_get_2d_map(), LuaPerlinNoiseMap::l_get_2d_map_flat(), LuaPerlinNoiseMap::l_get_3d_map(), LuaPerlinNoiseMap::l_get_3d_map_flat(), LuaPerlinNoiseMap::l_get_map_slice(), perlinMap2D(), perlinMap3D(), and updateResults().
s32 Noise::seed |
u32 Noise::sx |
Referenced by Noise(), allocBuffers(), gradientMap2D(), gradientMap3D(), LuaPerlinNoiseMap::l_get_2d_map(), LuaPerlinNoiseMap::l_get_2d_map_flat(), LuaPerlinNoiseMap::l_get_3d_map(), LuaPerlinNoiseMap::l_get_3d_map_flat(), LuaPerlinNoiseMap::l_get_map_slice(), LuaPerlinNoiseMap::packIn(), perlinMap2D(), perlinMap3D(), resizeNoiseBuf(), and setSize().
u32 Noise::sy |
Referenced by Noise(), allocBuffers(), gradientMap2D(), gradientMap3D(), LuaPerlinNoiseMap::l_get_2d_map(), LuaPerlinNoiseMap::l_get_2d_map_flat(), LuaPerlinNoiseMap::l_get_3d_map(), LuaPerlinNoiseMap::l_get_3d_map_flat(), LuaPerlinNoiseMap::l_get_map_slice(), LuaPerlinNoiseMap::packIn(), perlinMap2D(), perlinMap3D(), resizeNoiseBuf(), and setSize().
u32 Noise::sz |
Referenced by Noise(), allocBuffers(), gradientMap3D(), LuaPerlinNoiseMap::is3D(), LuaPerlinNoiseMap::l_get_3d_map(), LuaPerlinNoiseMap::l_get_3d_map_flat(), LuaPerlinNoiseMap::l_get_map_slice(), LuaPerlinNoiseMap::packIn(), perlinMap3D(), resizeNoiseBuf(), setOctaves(), setSize(), and setSpreadFactor().