NL3D::CPSUtil Struct Reference

This struct contains utility functions used by the particle system. More...

#include <ps_util.h>

List of all members.

Static Public Member Functions

static void registerSerialParticleSystem (void)
 Register the classes of the system. Must be called when serializing.
static void displayBBox (NL3D::IDriver *driver, const NLMISC::CAABBox &box, NLMISC::CRGBA col=NLMISC::CRGBA::White)
 Draw a bounding box.
static void displaySphere (NL3D::IDriver &driver, float radius, const NLMISC::CVector &center, uint nbSubdiv=4, NLMISC::CRGBA color=NLMISC::CRGBA::White)
 Draw a sphere.
static void displayDisc (NL3D::IDriver &driver, float radius, const NLMISC::CVector &center, const NLMISC::CMatrix &mat, uint nbSubdiv=32, NLMISC::CRGBA color=NLMISC::CRGBA::White)
 Draw a disc (not filled).
static void displayCylinder (NL3D::IDriver &driver, const NLMISC::CVector &center, const NLMISC::CMatrix &mat, const NLMISC::CVector &dim, uint nbSubdiv=32, NLMISC::CRGBA color=NLMISC::CRGBA::White)
 draw a cylinder (not filled)
static void display3DQuad (NL3D::IDriver &driver, const NLMISC::CVector &c1, const NLMISC::CVector &c2, const NLMISC::CVector &c3, const NLMISC::CVector &c4, NLMISC::CRGBA color=NLMISC::CRGBA::White)
 display a 3d quad in wireline, by using the 4 gicen corners
static void addRadiusToAABBox (NLMISC::CAABBox &box, float radius)
 enlarge a bounding box by the specified radius
static void displayBasis (NL3D::IDriver *driver, const NLMISC::CMatrix &modelMat, const NLMISC::CMatrix &m, float size, CFontGenerator &fg, CFontManager &fm)
 display a basis using the given matrix. The model matrix must be restored after this call
static void displayArrow (NL3D::IDriver *driver, const NLMISC::CVector &start, const NLMISC::CVector &v, float size, NLMISC::CRGBA col1, NLMISC::CRGBA col2)
 display an arrow (the same that is used with displayBasis) The user must setup the model matrix himself
static void print (NL3D::IDriver *driver, const std::string &text, CFontGenerator &fg, CFontManager &fm, const NLMISC::CVector &pos, float size, NLMISC::CRGBA col=NLMISC::CRGBA::White)
 display a string at the given world position. The The model matrix must be restored after this call
static void buildSchmidtBasis (const NLMISC::CVector &v, NLMISC::CMatrix &dest)
 build a basis from a vector using Schmidt orthogonalization method
static float getCos (sint32 angle)
 get a cosine from the fast cosine table (which must be have initialised with initFastCosNSinTable).
static float getSin (sint32 angle)
 get a cosine from the fast cosine table (which must be have initialised with initFastCosNSinTable).
static void initFastCosNSinTable (void)
 Init the table for cosine and sinus lookup.
static float buildPerlinNoise (NLMISC::CVector &pos, uint nbOctaves)
 compute a perlin noise value, that will range from [0 to 1] The first octave has the unit size
static void initPerlinNoiseTable (void)
 init the table used by perlin noise.

Static Private Member Functions

static void registerForces ()
static void registerParticles ()
static void registerEmitters ()
static void registerZones ()
static void registerAttribs ()
static float getInterpolatedNoise (const NLMISC::CVector &pos)
static float getPerlinNoise (uint x, uint y, uint z)

Static Private Attributes

static bool _CosTableInitialized = false
static bool _PerlinNoiseTableInitialized = false
static float _CosTable [256]
static float _SinTable [256]
static float _PerlinNoiseTab [1024]

Detailed Description

This struct contains utility functions used by the particle system.

Author:
Nicolas Vizerie
Nevrax France
Date:
2001

Definition at line 55 of file ps_util.h.


Member Function Documentation

void NL3D::CPSUtil::addRadiusToAABBox ( NLMISC::CAABBox box,
float  radius 
) [inline, static]

enlarge a bounding box by the specified radius

Definition at line 175 of file ps_util.h.

References NLMISC::CAABBox::getHalfSize(), and NLMISC::CAABBox::setHalfSize().

Referenced by NL3D::CPSQuad::completeBBox().

float NL3D::CPSUtil::buildPerlinNoise ( NLMISC::CVector pos,
uint  nbOctaves 
) [inline, static]

compute a perlin noise value, that will range from [0 to 1] The first octave has the unit size

See also:
initPerlinNoiseTable()

Definition at line 234 of file ps_util.h.

References _PerlinNoiseTableInitialized, getInterpolatedNoise(), and nlassert.

void NL3D::CPSUtil::buildSchmidtBasis ( const NLMISC::CVector v,
NLMISC::CMatrix dest 
) [static]
void NL3D::CPSUtil::display3DQuad ( NL3D::IDriver driver,
const NLMISC::CVector c1,
const NLMISC::CVector c2,
const NLMISC::CVector c3,
const NLMISC::CVector c4,
NLMISC::CRGBA  color = NLMISC::CRGBA::White 
) [static]

display a 3d quad in wireline, by using the 4 gicen corners

Definition at line 429 of file ps_util.cpp.

References NLMISC::drawLine(), and NL_PS_FUNC.

Referenced by NL3D::CPSZoneRectangle::show(), and NL3D::CPSEmitterRectangle::showTool().

void NL3D::CPSUtil::displayArrow ( NL3D::IDriver driver,
const NLMISC::CVector start,
const NLMISC::CVector v,
float  size,
NLMISC::CRGBA  col1,
NLMISC::CRGBA  col2 
) [static]
void NL3D::CPSUtil::displayBasis ( NL3D::IDriver driver,
const NLMISC::CMatrix modelMat,
const NLMISC::CMatrix m,
float  size,
CFontGenerator fg,
CFontManager fm 
) [static]
void NL3D::CPSUtil::displayBBox ( NL3D::IDriver driver,
const NLMISC::CAABBox box,
NLMISC::CRGBA  col = NLMISC::CRGBA::White 
) [static]
void NL3D::CPSUtil::displayCylinder ( NL3D::IDriver driver,
const NLMISC::CVector center,
const NLMISC::CMatrix mat,
const NLMISC::CVector dim,
uint  nbSubdiv = 32,
NLMISC::CRGBA  color = NLMISC::CRGBA::White 
) [static]

draw a cylinder (not filled)

Parameters:
dim dimension of the cylinder along each axis, packed in a vector

Definition at line 396 of file ps_util.cpp.

References NLMISC::drawLine(), NLMISC::CMatrix::getI(), NLMISC::CMatrix::getJ(), NLMISC::CMatrix::getK(), I, NL_PS_FUNC, NLMISC::Pi, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

Referenced by NL3D::CPSZoneCylinder::show().

void NL3D::CPSUtil::displayDisc ( NL3D::IDriver driver,
float  radius,
const NLMISC::CVector center,
const NLMISC::CMatrix mat,
uint  nbSubdiv = 32,
NLMISC::CRGBA  color = NLMISC::CRGBA::White 
) [static]

Draw a disc (not filled).

Parameters:
mat : a matrix, whose K vector is normal to the plane containing the disc

Definition at line 376 of file ps_util.cpp.

References NLMISC::drawLine(), NLMISC::CMatrix::getI(), NLMISC::CMatrix::getJ(), I, NL_PS_FUNC, and NLMISC::Pi.

Referenced by NL3D::CPSZoneDisc::show(), NL3D::CPSLight::show(), and NL3D::CPSCylindricVortex::show().

void NL3D::CPSUtil::displaySphere ( NL3D::IDriver driver,
float  radius,
const NLMISC::CVector center,
uint  nbSubdiv = 4,
NLMISC::CRGBA  color = NLMISC::CRGBA::White 
) [static]
static float NL3D::CPSUtil::getCos ( sint32  angle  )  [inline, static]

get a cosine from the fast cosine table (which must be have initialised with initFastCosNSinTable).

256 <=> 2 Pi

Definition at line 118 of file ps_util.h.

References _CosTable, _CosTableInitialized, and nlassert.

Referenced by NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSShockWaveHelper::drawShockWave(), and NL3D::CPSMesh::updatePos().

float NL3D::CPSUtil::getInterpolatedNoise ( const NLMISC::CVector pos  )  [inline, static, private]

Definition at line 188 of file ps_util.h.

References getPerlinNoise(), NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.

Referenced by buildPerlinNoise().

float NL3D::CPSUtil::getPerlinNoise ( uint  x,
uint  y,
uint  z 
) [inline, static, private]

Definition at line 182 of file ps_util.h.

References _PerlinNoiseTab.

Referenced by getInterpolatedNoise().

static float NL3D::CPSUtil::getSin ( sint32  angle  )  [inline, static]

get a cosine from the fast cosine table (which must be have initialised with initFastCosNSinTable).

256 <=> 2 Pi

Definition at line 127 of file ps_util.h.

References _CosTableInitialized, _SinTable, and nlassert.

Referenced by NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSShockWaveHelper::drawShockWave(), and NL3D::CPSMesh::updatePos().

void NL3D::CPSUtil::initFastCosNSinTable ( void   )  [static]

Init the table for cosine and sinus lookup.

See also:
getCos(), getSin()

Definition at line 82 of file ps_util.cpp.

References _CosTable, _CosTableInitialized, _SinTable, NL_PS_FUNC, and NLMISC::Pi.

Referenced by registerSerialParticleSystem().

void NL3D::CPSUtil::initPerlinNoiseTable ( void   )  [static]

init the table used by perlin noise.

This must be used before any call to buildPerlinNoise

Definition at line 69 of file ps_util.cpp.

References _PerlinNoiseTab, _PerlinNoiseTableInitialized, and NL_PS_FUNC.

Referenced by registerSerialParticleSystem().

void NL3D::CPSUtil::print ( NL3D::IDriver driver,
const std::string &  text,
CFontGenerator fg,
CFontManager fm,
const NLMISC::CVector pos,
float  size,
NLMISC::CRGBA  col = NLMISC::CRGBA::White 
) [static]
void NL3D::CPSUtil::registerAttribs (  )  [static, private]
void NL3D::CPSUtil::registerEmitters (  )  [static, private]

Definition at line 33 of file ps_register_emitters.cpp.

References NL_PS_FUNC, and NLMISC_REGISTER_CLASS.

Referenced by registerSerialParticleSystem().

void NL3D::CPSUtil::registerForces (  )  [static, private]
void NL3D::CPSUtil::registerParticles (  )  [static, private]
void NL3D::CPSUtil::registerSerialParticleSystem ( void   )  [static]

Register the classes of the system. Must be called when serializing.

Definition at line 97 of file ps_util.cpp.

References initFastCosNSinTable(), initPerlinNoiseTable(), NL_PS_FUNC, NLMISC_REGISTER_CLASS, registerAttribs(), registerEmitters(), registerForces(), registerParticles(), and registerZones().

Referenced by NL3D::registerSerial3d().

void NL3D::CPSUtil::registerZones (  )  [static, private]

Definition at line 33 of file ps_register_zones.cpp.

References NLMISC_REGISTER_CLASS.

Referenced by registerSerialParticleSystem().


Member Data Documentation

float NL3D::CPSUtil::_CosTable [static, private]

Definition at line 161 of file ps_util.h.

Referenced by getCos(), and initFastCosNSinTable().

bool NL3D::CPSUtil::_CosTableInitialized = false [static, private]

Definition at line 158 of file ps_util.h.

Referenced by getCos(), getSin(), and initFastCosNSinTable().

Definition at line 164 of file ps_util.h.

Referenced by getPerlinNoise(), and initPerlinNoiseTable().

Definition at line 159 of file ps_util.h.

Referenced by buildPerlinNoise(), and initPerlinNoiseTable().

float NL3D::CPSUtil::_SinTable [static, private]

Definition at line 163 of file ps_util.h.

Referenced by getSin(), and initFastCosNSinTable().


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

Generated on Thu Jan 7 08:30:10 2010 for NeL by  doxygen 1.6.1