Cuberite
A lightweight, fast and extensible game server for Minecraft
Public Member Functions | Protected Types | Protected Attributes | List of all members
cInterpolCell3D< T > Class Template Reference

Holds a cache of the last calculated integral noise values and interpolates between them en masse. More...

#include <InterpolNoise.h>

Collaboration diagram for cInterpolCell3D< T >:
Collaboration graph
[legend]

Public Member Functions

 cInterpolCell3D (const cNoise &a_Noise, NOISE_DATATYPE *a_Array, int a_SizeX, int a_SizeY, int a_SizeZ, const NOISE_DATATYPE *a_FracX, const NOISE_DATATYPE *a_FracY, const NOISE_DATATYPE *a_FracZ)
 
void Generate (int a_FromX, int a_ToX, int a_FromY, int a_ToY, int a_FromZ, int a_ToZ)
 Generates part of the output array using current m_WorkRnds[]. More...
 
void InitWorkRnds (int a_FloorX, int a_FloorY, int a_FloorZ)
 Initializes m_WorkRnds[] with the specified Floor values. More...
 
void Move (int a_NewFloorX, int a_NewFloorY, int a_NewFloorZ)
 Updates m_WorkRnds[] for the new Floor values. More...
 

Protected Types

typedef NOISE_DATATYPE Workspace[2][2][2]
 

Protected Attributes

NOISE_DATATYPEm_Array
 The output array where the noise is calculated. More...
 
int m_CurFloorX
 The integral coords of the currently calculated WorkRnds[]. More...
 
int m_CurFloorY
 
int m_CurFloorZ
 
const NOISE_DATATYPEm_FracX
 Arrays holding the fractional values of the coords in each direction. More...
 
const NOISE_DATATYPEm_FracY
 
const NOISE_DATATYPEm_FracZ
 
const cNoisem_Noise
 The noise used for generating the values at integral coords. More...
 
int m_SizeX
 Dimensions of the output array. More...
 
int m_SizeY
 
int m_SizeZ
 
Workspacem_WorkRnds
 The current random values; points to either m_Workspace1 or m_Workspace2 (doublebuffering) More...
 
Workspace m_Workspace1
 Buffer 1 for workspace doublebuffering, used in Move() More...
 
Workspace m_Workspace2
 Buffer 2 for workspace doublebuffering, used in Move() More...
 

Detailed Description

template<typename T>
class cInterpolCell3D< T >

Holds a cache of the last calculated integral noise values and interpolates between them en masse.

Provides a massive optimization for cInterpolNoise. Works by calculating multiple noise values (that have the same integral noise coords) at once. The underlying noise values needn't be recalculated for these values, only the interpolation is done within the unit cube.

Definition at line 156 of file InterpolNoise.h.

Member Typedef Documentation

◆ Workspace

template<typename T >
typedef NOISE_DATATYPE cInterpolCell3D< T >::Workspace[2][2][2]
protected

Definition at line 279 of file InterpolNoise.h.

Constructor & Destructor Documentation

◆ cInterpolCell3D()

template<typename T >
cInterpolCell3D< T >::cInterpolCell3D ( const cNoise a_Noise,
NOISE_DATATYPE a_Array,
int  a_SizeX,
int  a_SizeY,
int  a_SizeZ,
const NOISE_DATATYPE a_FracX,
const NOISE_DATATYPE a_FracY,
const NOISE_DATATYPE a_FracZ 
)
inline
Parameters
a_NoiseNoise to use for generating the random values
a_ArrayArray to generate into [x + a_SizeX * y]
a_SizeZCount of the array, in each direction
a_FracXPointer to the array that stores the X fractional values
a_FracYPointer to the attay that stores the Y fractional values
a_FracZPointer to the array that stores the Z fractional values

Definition at line 159 of file InterpolNoise.h.

Member Function Documentation

◆ Generate()

template<typename T >
void cInterpolCell3D< T >::Generate ( int  a_FromX,
int  a_ToX,
int  a_FromY,
int  a_ToY,
int  a_FromZ,
int  a_ToZ 
)
inline

Generates part of the output array using current m_WorkRnds[].

Definition at line 184 of file InterpolNoise.h.

◆ InitWorkRnds()

template<typename T >
void cInterpolCell3D< T >::InitWorkRnds ( int  a_FloorX,
int  a_FloorY,
int  a_FloorZ 
)
inline

Initializes m_WorkRnds[] with the specified Floor values.

Definition at line 219 of file InterpolNoise.h.

◆ Move()

template<typename T >
void cInterpolCell3D< T >::Move ( int  a_NewFloorX,
int  a_NewFloorY,
int  a_NewFloorZ 
)
inline

Updates m_WorkRnds[] for the new Floor values.

Definition at line 236 of file InterpolNoise.h.

Member Data Documentation

◆ m_Array

template<typename T >
NOISE_DATATYPE* cInterpolCell3D< T >::m_Array
protected

The output array where the noise is calculated.

Definition at line 297 of file InterpolNoise.h.

◆ m_CurFloorX

template<typename T >
int cInterpolCell3D< T >::m_CurFloorX
protected

The integral coords of the currently calculated WorkRnds[].

Definition at line 294 of file InterpolNoise.h.

◆ m_CurFloorY

template<typename T >
int cInterpolCell3D< T >::m_CurFloorY
protected

Definition at line 294 of file InterpolNoise.h.

◆ m_CurFloorZ

template<typename T >
int cInterpolCell3D< T >::m_CurFloorZ
protected

Definition at line 294 of file InterpolNoise.h.

◆ m_FracX

template<typename T >
const NOISE_DATATYPE* cInterpolCell3D< T >::m_FracX
protected

Arrays holding the fractional values of the coords in each direction.

Definition at line 303 of file InterpolNoise.h.

◆ m_FracY

template<typename T >
const NOISE_DATATYPE* cInterpolCell3D< T >::m_FracY
protected

Definition at line 304 of file InterpolNoise.h.

◆ m_FracZ

template<typename T >
const NOISE_DATATYPE* cInterpolCell3D< T >::m_FracZ
protected

Definition at line 305 of file InterpolNoise.h.

◆ m_Noise

template<typename T >
const cNoise& cInterpolCell3D< T >::m_Noise
protected

The noise used for generating the values at integral coords.

Definition at line 282 of file InterpolNoise.h.

◆ m_SizeX

template<typename T >
int cInterpolCell3D< T >::m_SizeX
protected

Dimensions of the output array.

Definition at line 300 of file InterpolNoise.h.

◆ m_SizeY

template<typename T >
int cInterpolCell3D< T >::m_SizeY
protected

Definition at line 300 of file InterpolNoise.h.

◆ m_SizeZ

template<typename T >
int cInterpolCell3D< T >::m_SizeZ
protected

Definition at line 300 of file InterpolNoise.h.

◆ m_WorkRnds

template<typename T >
Workspace* cInterpolCell3D< T >::m_WorkRnds
protected

The current random values; points to either m_Workspace1 or m_Workspace2 (doublebuffering)

Definition at line 285 of file InterpolNoise.h.

◆ m_Workspace1

template<typename T >
Workspace cInterpolCell3D< T >::m_Workspace1
protected

Buffer 1 for workspace doublebuffering, used in Move()

Definition at line 288 of file InterpolNoise.h.

◆ m_Workspace2

template<typename T >
Workspace cInterpolCell3D< T >::m_Workspace2
protected

Buffer 2 for workspace doublebuffering, used in Move()

Definition at line 291 of file InterpolNoise.h.


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