Luanti 5.15.0-dev
 
Loading...
Searching...
No Matches
Noise Class Reference

#include <noise.h>

+ Collaboration diagram for Noise:

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 valueMap2D (float x, float y, float step_x, float step_y, s32 seed)
 
void valueMap3D (float x, float y, float z, float step_x, float step_y, float step_z, s32 seed)
 
float * noiseMap2D (float x, float y, float *persistence_map=NULL)
 
float * noiseMap3D (float x, float y, float z, float *persistence_map=NULL)
 
float * noiseMap2D_PO (float x, float xoff, float y, float yoff, float *persistence_map=NULL)
 
float * noiseMap3D_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 * value_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)
 

Constructor & Destructor Documentation

◆ Noise()

Noise::Noise ( const NoiseParams * np,
s32 seed,
u32 sx,
u32 sy,
u32 sz = 1 )

References allocBuffers(), np, seed, sx, sy, and sz.

+ Here is the call graph for this function:

◆ ~Noise()

Noise::~Noise ( )

References noise_buf, persist_buf, result, and value_buf.

Member Function Documentation

◆ allocBuffers()

void Noise::allocBuffers ( )
private

References noise_buf, persist_buf, resizeNoiseBuf(), result, sx, sy, sz, and value_buf.

Referenced by Noise(), and setSize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noiseMap2D()

float * Noise::noiseMap2D ( float x,
float y,
float * persistence_map = NULL )

◆ noiseMap2D_PO()

float * Noise::noiseMap2D_PO ( float x,
float xoff,
float y,
float yoff,
float * persistence_map = NULL )
inline

References noiseMap2D(), np, NoiseParams::spread, x, and y.

Referenced by MapgenV6::calculateNoise().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ noiseMap3D()

float * Noise::noiseMap3D ( float x,
float y,
float z,
float * persistence_map = NULL )

◆ noiseMap3D_PO()

float * Noise::noiseMap3D_PO ( float x,
float xoff,
float y,
float yoff,
float z,
float zoff,
float * persistence_map = NULL )
inline

References noiseMap3D(), np, NoiseParams::spread, x, y, and z.

+ Here is the call graph for this function:

◆ resizeNoiseBuf()

void Noise::resizeNoiseBuf ( bool is3d)
private

References errorstream, NoiseParams::lacunarity, noise_buf, np, NoiseParams::octaves, NoiseParams::spread, sx, sy, and sz.

Referenced by allocBuffers(), setOctaves(), and setSpreadFactor().

+ Here is the caller graph for this function:

◆ setOctaves()

void Noise::setOctaves ( int octaves)

References np, NoiseParams::octaves, resizeNoiseBuf(), and sz.

+ Here is the call graph for this function:

◆ setSize()

void Noise::setSize ( u32 sx,
u32 sy,
u32 sz = 1 )

References allocBuffers(), sx, sy, and sz.

+ Here is the call graph for this function:

◆ setSpreadFactor()

void Noise::setSpreadFactor ( v3f spread)

References np, resizeNoiseBuf(), NoiseParams::spread, and sz.

+ Here is the call graph for this function:

◆ updateResults()

void Noise::updateResults ( float g,
float * gmap,
const float * persistence_map,
size_t bufsize )
private

References NoiseParams::flags, NOISE_FLAG_ABSVALUE, np, result, and value_buf.

Referenced by noiseMap2D(), and noiseMap3D().

+ Here is the caller graph for this function:

◆ valueMap2D()

void Noise::valueMap2D ( float x,
float y,
float step_x,
float step_y,
s32 seed )

References biLinearInterpolation(), NoiseParams::flags, idx, noise2d(), noise_buf, NOISE_FLAG_DEFAULTS, NOISE_FLAG_EASED, np, seed, sx, sy, value_buf, x, and y.

Referenced by noiseMap2D().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ valueMap3D()

void Noise::valueMap3D ( float x,
float y,
float z,
float step_x,
float step_y,
float step_z,
s32 seed )

References NoiseParams::flags, idx, noise3d(), noise_buf, NOISE_FLAG_EASED, np, seed, sx, sy, sz, triLinearInterpolation(), value_buf, x, y, and z.

Referenced by noiseMap3D().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ noise_buf

float* Noise::noise_buf = nullptr

◆ np

◆ persist_buf

float* Noise::persist_buf = nullptr

◆ result

◆ seed

◆ sx

◆ sy

◆ sz

◆ value_buf

float* Noise::value_buf = nullptr

The documentation for this class was generated from the following files: