This struct contains utility functions used by the particle system. More...
#include <ps_util.h>
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 ¢er, uint nbSubdiv=4, NLMISC::CRGBA color=NLMISC::CRGBA::White) |
| Draw a sphere. | |
| static void | displayDisc (NL3D::IDriver &driver, float radius, const NLMISC::CVector ¢er, 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 ¢er, 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] |
This struct contains utility functions used by the particle system.
Definition at line 55 of file ps_util.h.
| 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
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] |
build a basis from a vector using Schmidt orthogonalization method
| v | K axis in the resulting basis | |
| dest | The matrix containing the result. Only the rotation part is modified |
Definition at line 301 of file ps_util.cpp.
References NLMISC::CVector::I, NLMISC::CVector::J, NLMISC::CVector::K, NL_PS_FUNC, NLMISC::CVector::normalize(), and NLMISC::CMatrix::setRot().
Referenced by NL3D::CPSZonePlane::buildBasis(), NL3D::ComputeRibbonSliceFollowPath(), NL3D::CPlaneBasis::CPlaneBasis(), displayArrow(), NL3D::CPSZoneDisc::getMatrix(), NL3D::CPSCylindricVortex::getMatrix(), NL3D::CPSEmitter::processEmit(), NL3D::CPSEmitter::processEmitConsistent(), NL3D::CPSEmitter::processEmitOutsideSimLoop(), NL3D::CPSZoneDisc::show(), NL3D::CPSCylindricVortex::show(), and NL3D::CSpinnerFunctor::updateSamples().
| 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] |
display an arrow (the same that is used with displayBasis) The user must setup the model matrix himself
| 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 181 of file ps_util.cpp.
References NL3D::IDriver::activeIndexBuffer(), NL3D::IDriver::activeVertexBuffer(), buildSchmidtBasis(), NLMISC::drawLine(), NL3D::CIndexBuffer::getNumIndexes(), NL3D::CIndexBufferReadWrite::getPtr(), NL3D::CVertexBuffer::lock(), NL3D::CIndexBuffer::lock(), NL_DEFAULT_INDEX_BUFFER_FORMAT, NL_PS_FUNC, NL3D::CMaterial::one, NL3D::CVertexBuffer::PositionFlag, NL3D::IDriver::renderTriangles(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setDoubleSided(), NL3D::CIndexBuffer::setFormat(), NL3D::CMaterial::setLighting(), NL3D::CIndexBuffer::setNumIndexes(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBufferReadWrite::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), NL3D::CMaterial::setZWrite(), and sizeofarray.
Referenced by displayBasis(), NL3D::CPSCylindricVortex::show(), and NL3D::CPSDirectionnalForce::show().
| 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 248 of file ps_util.cpp.
References displayArrow(), NLMISC::CMatrix::getI(), NLMISC::CMatrix::getJ(), NLMISC::CMatrix::getK(), NLMISC::CMatrix::getPos(), NL_PS_FUNC, print(), and NL3D::IDriver::setupModelMatrix().
Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), and NL3D::CPSEmitterRectangle::showTool().
| void NL3D::CPSUtil::displayBBox | ( | NL3D::IDriver * | driver, | |
| const NLMISC::CAABBox & | box, | |||
| NLMISC::CRGBA | col = NLMISC::CRGBA::White | |||
| ) | [static] |
Draw a bounding box.
Definition at line 119 of file ps_util.cpp.
References NL3D::IDriver::activeIndexBuffer(), NL3D::IDriver::activeVertexBuffer(), NLMISC::CAABBox::getMax(), NLMISC::CAABBox::getMin(), NL3D::CIndexBuffer::getNumIndexes(), NL3D::CIndexBuffer::lock(), NL3D::CVertexBuffer::lock(), min, NL_DEFAULT_INDEX_BUFFER_FORMAT, NL_PS_FUNC, NL3D::CMaterial::one, NL3D::CVertexBuffer::PositionFlag, NL3D::IDriver::renderLines(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CIndexBuffer::setFormat(), NL3D::CMaterial::setLighting(), NL3D::CIndexBufferReadWrite::setLine(), NL3D::CIndexBuffer::setNumIndexes(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBufferReadWrite::setVertexCoord(), NL3D::CVertexBuffer::setVertexFormat(), NL3D::CMaterial::setZWrite(), NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.
Referenced by NL3D::CParticleSystem::step().
| 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)
| 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).
| 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] |
Draw a sphere.
Definition at line 329 of file ps_util.cpp.
References NLMISC::drawLine(), I, NLMISC::CVector::I, NLMISC::CVector::J, NLMISC::CVector::K, NL_PS_FUNC, and NLMISC::CVector::normalize().
Referenced by NL3D::CPSZoneSphere::show(), and NL3D::CPSSphericalEmitter::showTool().
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().
Definition at line 182 of file ps_util.h.
References _PerlinNoiseTab.
Referenced by getInterpolatedNoise().
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.
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] |
display a string at the given world position. The The model matrix must be restored after this call
Definition at line 278 of file ps_util.cpp.
References NL3D::CFontManager::computeString(), NL3D::IDriver::getViewMatrix(), NL_PS_FUNC, nlassert, NLMISC::CVector::Null, NL3D::CComputedString::render3D(), NLMISC::CMatrix::scale(), NLMISC::CMatrix::setPos(), and NLMISC::CMatrix::transpose().
Referenced by displayBasis(), NL3D::CPSCylindricVortex::show(), and NL3D::CPSGravity::show().
| void NL3D::CPSUtil::registerAttribs | ( | ) | [static, private] |
Definition at line 38 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 33 of file ps_register_emitters.cpp.
References NL_PS_FUNC, and NLMISC_REGISTER_CLASS.
Referenced by registerSerialParticleSystem().
| void NL3D::CPSUtil::registerForces | ( | ) | [static, private] |
Definition at line 30 of file ps_register_forces.cpp.
References NL3D::CPSBrownianForce::initPrecalc(), and NLMISC_REGISTER_CLASS.
Referenced by registerSerialParticleSystem().
| void NL3D::CPSUtil::registerParticles | ( | ) | [static, private] |
Definition at line 34 of file ps_register_particles.cpp.
References NL3D::CPSFanLight::initFanLightPrecalc(), NL3D::CPSConstraintMesh::initPrerotVB(), NL3D::CPSRotated2DParticle::initRotTable(), NL3D::CPSQuad::initVertexBuffers(), NL3D::CPSDot::initVertexBuffers(), NL_PS_FUNC, and NLMISC_REGISTER_CLASS.
Referenced by registerSerialParticleSystem().
| 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().
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().
float NL3D::CPSUtil::_PerlinNoiseTab [static, private] |
Definition at line 164 of file ps_util.h.
Referenced by getPerlinNoise(), and initPerlinNoiseTable().
bool NL3D::CPSUtil::_PerlinNoiseTableInitialized = false [static, private] |
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().
1.6.1