Luanti 5.10.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 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)
 

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 ( )

Member Function Documentation

◆ allocBuffers()

void Noise::allocBuffers ( )
private

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

Referenced by Noise(), and setSize().

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

◆ gradientMap2D()

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().

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

◆ gradientMap3D()

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().

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

◆ perlinMap2D()

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

◆ perlinMap2D_PO()

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

References np, perlinMap2D(), and NoiseParams::spread.

Referenced by MapgenV6::calculateNoise().

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

◆ perlinMap3D()

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

◆ perlinMap3D_PO()

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

References np, perlinMap3D(), and NoiseParams::spread.

+ 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, gradient_buf, NOISE_FLAG_ABSVALUE, np, and result.

Referenced by perlinMap2D(), and perlinMap3D().

+ Here is the caller graph for this function:

Member Data Documentation

◆ gradient_buf

float* Noise::gradient_buf = nullptr

◆ noise_buf

float* Noise::noise_buf = nullptr

◆ np

◆ persist_buf

float* Noise::persist_buf = nullptr

◆ result

◆ seed

◆ sx

◆ sy

◆ sz


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