# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

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 Methods

void registerSerialParticleSystem (void)
 register the classes of the system mus be called when serializing. More...

void displayBBox (NL3D::IDriver *driver, const NLMISC::CAABBox &box, NLMISC::CRGBA col=NLMISC::CRGBA::White)
 this draw a bounding box. More...

void displaySphere (NL3D::IDriver &driver, float radius, const NLMISC::CVector &center, uint nbSubdiv=4, NLMISC::CRGBA color=NLMISC::CRGBA::White)
 draw a sphere. More...

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

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

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. More...

void addRadiusToAABBox (NLMISC::CAABBox &box, float radius)
 enlarge a bounding box by the specified radius. More...

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. More...

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. More...

void print (NL3D::IDriver *driver, const std::string &text, CFontGenerator &fg, CFontManager &fm, const NLMISC::CVector &pos, float size)
 display a string at the given position. The model matrix must be restored after this call. More...

void buildSchmidtBasis (const NLMISC::CVector &v, NLMISC::CMatrix &dest)
 build a basis from a vector using Schmidt orthogonalization method. More...

float getCos (sint32 angle)
 get a cosine from the fast cosine table (which must be have initialised with initFastCosNSinTable). More...

float getSin (sint32 angle)
 get a cosine from the fast cosine table (which must be have initialised with initFastCosNSinTable). More...

void initFastCosNSinTable (void)
 Init the table for cosine and sinus lookup. More...

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. More...

void initPerlinNoiseTable (void)
 init the table used by perlin noise. More...


Static Private Methods

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

Static Private Attributes

bool _CosTableInitialized = false
bool _PerlinNoiseTableInitialized = false
float _CosTable [256]
float _SinTable [256]
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 57 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 178 of file ps_util.h.

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

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 237 of file ps_util.h.

References _PerlinNoiseTableInitialized, getInterpolatedNoise, and nlassert.

void NL3D::CPSUtil::buildSchmidtBasis const NLMISC::CVector   v,
NLMISC::CMatrix   dest
[static]
 

build a basis from a vector using Schmidt orthogonalization method.

Parameters:
v  K axis in the resulting basis
dest  The matrix containing the result. Only the rotation part is modified

Definition at line 254 of file ps_util.cpp.

References NLMISC::CMatrix::setRot.

Referenced by displayArrow.

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 380 of file ps_util.cpp.

void NL3D::CPSUtil::displayArrow NL3D::IDriver   driver,
const NLMISC::CVector   start,
const NLMISC::CVector   v,
float    size,
NLMISC::CRGBA    col1,
NLMISC::CRGBA    col2
[static]
 

display an arrow (the same that is used with displayBasis) The user must setup the model matrix himself.

Parameters:
driver  the driver used for rendering
start  start point of the arrow
v  direction of the arrow
size  size of the arrow (will be drawn as size * v)
col1  color of the arrow start
col2  color of the arrow end

Definition at line 166 of file ps_util.cpp.

References buildSchmidtBasis, and v.

Referenced by displayBasis.

void NL3D::CPSUtil::displayBasis NL3D::IDriver   driver,
const NLMISC::CMatrix   modelMat,
const NLMISC::CMatrix   m,
float    size,
CFontGenerator   fg,
CFontManager   fm
[static]
 

display a basis using the given matrix. The model matrix must be restored after this call.

Definition at line 209 of file ps_util.cpp.

References displayArrow, NLMISC::CMatrix::getI, NLMISC::CMatrix::getJ, NLMISC::CMatrix::getK, and NLMISC::CMatrix::getPos.

void NL3D::CPSUtil::displayBBox NL3D::IDriver   driver,
const NLMISC::CAABBox   box,
NLMISC::CRGBA    col = NLMISC::CRGBA::White
[static]
 

this draw a bounding box.

Definition at line 115 of file ps_util.cpp.

References NL3D::IDriver::activeVertexBuffer, NLMISC::CAABBox::getMax, NLMISC::CAABBox::getMin, min, and NL3D::IDriver::render.

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 348 of file ps_util.cpp.

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 329 of file ps_util.cpp.

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

draw a sphere.

Definition at line 283 of file ps_util.cpp.

References x, and y.

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 121 of file ps_util.h.

References nlassert.

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

Definition at line 191 of file ps_util.h.

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

Referenced by buildPerlinNoise.

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

Definition at line 185 of file ps_util.h.

References _PerlinNoiseTab, x, y, and z.

Referenced by getInterpolatedNoise.

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 130 of file ps_util.h.

References nlassert.

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

Init the table for cosine and sinus lookup.

See also:
getCos(), getSin()

Definition at line 81 of file ps_util.cpp.

References _CosTable, _CosTableInitialized, and _SinTable.

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, and _PerlinNoiseTableInitialized.

Referenced by registerSerialParticleSystem.

void NL3D::CPSUtil::print NL3D::IDriver   driver,
const std::string &    text,
CFontGenerator   fg,
CFontManager   fm,
const NLMISC::CVector   pos,
float    size
[static]
 

display a string at the given position. The model matrix must be restored after this call.

Definition at line 232 of file ps_util.cpp.

References nlassert.

void NL3D::CPSUtil::registerAttribs   [static, private]
 

Definition at line 40 of file ps_register_attribs.cpp.

References NL3D::PSRegisterColorAttribs, NL3D::PSRegisterFloatAttribs, NL3D::PSRegisterIntAttribs, and NL3D::PSRegisterPlaneBasisAttribs.

Referenced by registerSerialParticleSystem.

void NL3D::CPSUtil::registerEmitters   [static, private]
 

Definition at line 35 of file ps_register_emitters.cpp.

References NLMISC_REGISTER_CLASS.

Referenced by registerSerialParticleSystem.

void NL3D::CPSUtil::registerForces   [static, private]
 

Definition at line 35 of file ps_register_forces.cpp.

References NLMISC_REGISTER_CLASS.

Referenced by registerSerialParticleSystem.

void NL3D::CPSUtil::registerParticles   [static, private]
 

Definition at line 36 of file ps_register_particles.cpp.

References NLMISC_REGISTER_CLASS.

Referenced by registerSerialParticleSystem.

void NL3D::CPSUtil::registerSerialParticleSystem void    [static]
 

register the classes of the system mus be called when serializing.

Definition at line 95 of file ps_util.cpp.

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

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

Definition at line 35 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 61 of file ps_util.cpp.

Referenced by initFastCosNSinTable.

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

Definition at line 57 of file ps_util.cpp.

Referenced by initFastCosNSinTable.

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

Definition at line 63 of file ps_util.cpp.

Referenced by getPerlinNoise, and initPerlinNoiseTable.

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

Definition at line 58 of file ps_util.cpp.

Referenced by buildPerlinNoise, and initPerlinNoiseTable.

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

Definition at line 62 of file ps_util.cpp.

Referenced by initFastCosNSinTable.


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