#include <ps_ribbon.h>
Inheritance diagram for NL3D::CPSRibbon:
Definition at line 45 of file ps_ribbon.h.
Vertex buffers & their corresponding index buffers. We keep a map of pretextured vertex buffer (with or without colors). | |
Vb for ribbons that have the same size are shared. | |
typedef std::hash_map< uint, CVBnPB > | TVBMap |
uint | getNumRibbonsInVB () const |
get the number of ribbons contained in a vb for a given length. (e.g the number of ribbons that can be batched) | |
CVBnPB & | getVBnPB () |
get a vertex buffer and a primitive suited for the current ribbon | |
TVBMap | _ColoredVBMap |
TVBMap | _FadedColoredVBMap |
TVBMap | _FadedVBMap |
TVBMap | _TexColoredVBMap |
TVBMap | _TexFadedColoredVBMap |
TVBMap | _TexFadedVBMap |
TVBMap | _TexVBMap |
textured ribbons | |
TVBMap | _VBMap |
untextured ribbons | |
Public Types | |
enum | TBlendingMode { add, modulate, alphaBlend, alphaTest } |
this enum summarize the useful modes for blending to the framebuffer More... | |
enum | TInterpolationMode { Linear = 0, Hermitte, InterpModeLast } |
enum | TRibbonMode { VariableSize = 0, FixedSize, RibbonModeLast } |
Public Member Functions | |
virtual void | basisChanged (TPSMatrixMode systemBasis) |
virtual bool | completeBBox (NLMISC::CAABBox &box) const |
NLMISC::CVector | computeI (void) const |
NLMISC::CVector | computeJ (void) const |
NLMISC::CVector | computeK (void) const |
void | disableAutoLOD (bool disable=true) |
Force the Auto-LOD to be disbaled. When set to false, the default behaviour set in the system is used. | |
virtual bool | doesProduceBBox (void) const |
virtual void | draw (bool opaque) |
derivers draw the particles here | |
void | enableGlobalColorLighting (bool enabled) |
void | enableZTest (bool enabled) |
=================================================================================== | |
virtual void | enumTexs (std::vector< NLMISC::CSmartPtr< ITexture > > &dest, IDriver &drv) |
================================================================================================================== | |
void | forceModulateConstantColor (bool force, const NLMISC::CRGBA &col=NLMISC::CRGBA::White) |
=================================================================================== | |
void | forceTexturedMaterialStages (uint numStages) |
=================================================================================== | |
CPSMaterial::TBlendingMode | getBlendingMode (void) const |
=================================================================================== | |
virtual std::string | getClassName ()=0 |
NLMISC::CRGBA | getColor (void) const |
Get the color. | |
const CPSAttribMaker< CRGBA > * | getColorScheme (void) const |
get the color scheme (NULL if none) const version | |
CPSAttribMaker< CRGBA > * | getColorScheme (void) |
get the color scheme (NULL if none) | |
IDriver * | getDriver () const |
shortcut to get an instance of the driver | |
uint32 | getExternID (void) const |
get the extern ID of this located bindable | |
const CFontGenerator * | getFontGenerator (void) const |
Shortcut to get the font generator if one was set (const version). | |
CFontGenerator * | getFontGenerator (void) |
Shortcut to get the font generator if one was set. | |
const CFontManager * | getFontManager (void) const |
Shortcut to get the font manager if one was set (const version). | |
CFontManager * | getFontManager (void) |
*************************************************************************************** | |
const NLMISC::CMatrix & | getInvertedSysMat (void) const |
shortcut to get the inverted matrix of the system | |
const NLMISC::CMatrix & | getInvertedViewMat (void) const |
shortcut to get the inverted view matrix | |
const NLMISC::CMatrix & | getLocalToWorldMatrix () const |
Shortcut to get the local to world matrix. | |
TPSLod | getLOD (void) const |
get the valid lods for that object | |
float | getLODDegradation () const |
virtual uint32 | getMaxNumFaces (void) const |
return the max number of faces needed for display. This is needed for LOD balancing | |
std::string | getName (void) const |
get the located bindable name (edition purpose) | |
uint32 | getNbVerticesInShape (void) const |
get the number of vertice in the shape used for ribbons | |
const CPSLocated * | getOwner (void) const |
get the located that owns this bindable (const version) | |
CPSLocated * | getOwner (void) |
get the located that owns this bindable | |
virtual uint32 | getPriority (void) const |
return priority | |
void | getShape (NLMISC::CVector *shape) const |
================================================================================================================== | |
float | getSize (void) const |
get the constant size | |
const CPSAttribMaker< float > * | getSizeScheme (void) const |
get the size scheme (NULL if none) const version | |
CPSAttribMaker< float > * | getSizeScheme (void) |
get the size scheme (NULL if none) | |
const NLMISC::CMatrix & | getSysMat (void) const |
*************************************************************************************** | |
const ITexture * | getTexture (void) const |
ITexture * | getTexture (void) |
get the texture used | |
uint32 | getType (void) const |
return this bindable type | |
float | getUFactor (void) const |
virtual bool | getUserMatrixUsageCount () const |
float | getVFactor (void) const |
const NLMISC::CMatrix & | getViewMat (void) const |
shortcut to get the view matrix | |
virtual bool | hasEmitters (void) const |
tells wether there are alive emitters | |
virtual bool | hasLightableFaces () |
from CPSParticle : return true if there are lightable faces in the object | |
virtual bool | hasOpaqueFaces (void) |
return true if there are Opaque faces in the object | |
virtual bool | hasParticles (void) const |
return true if this located bindable derived class holds alive particles | |
virtual bool | hasTransparentFaces (void) |
return true if there are transparent faces in the object | |
bool | isActive () const |
bool | isAutoLODDisabled () const |
Test wether Auto-LOD is disabled. | |
bool | isZTestEnabled () const |
=================================================================================== | |
virtual void | notifyTargetRemoved (CPSLocated *ptr) |
*************************************************************************************** | |
virtual void | releaseAllRef () |
*************************************************************************************** | |
virtual void | releaseRefTo (const CParticleSystemProcess *other) |
void | serialColorScheme (NLMISC::IStream &f) throw (NLMISC::EStream) |
serialization. | |
void | serialMaterial (NLMISC::IStream &f) throw (NLMISC::EStream) |
=================================================================================== | |
void | serialSizeScheme (NLMISC::IStream &f) throw (NLMISC::EStream) |
serialization. We choose a different name because of multiple-inheritance | |
void | setActive (bool active) |
Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method. | |
void | setBlendingMode (CPSMaterial::TBlendingMode mode) |
=================================================================================== | |
void | setColor (NLMISC::CRGBA col) |
Set a constant color for the particles. remove any previous scheme. | |
void | setColorScheme (CPSAttribMaker< CRGBA > *col) |
void | setExternID (uint32 id) |
*************************************************************************************** | |
void | setLOD (TPSLod lod) |
void | setLODDegradation (float percent) |
void | setName (const std::string &name) |
set the located bindable name (edition purpose) | |
void | setShape (const NLMISC::CVector *shape, uint32 nbPointsInShape) |
================================================================================================================== | |
void | setSize (float size) |
Set a constant size for the particles. | |
void | setSizeScheme (CPSAttribMaker< float > *size) |
void | setTexFactor (float uFactor=1.f, float vFactor=1.f) |
Set texture factors. | |
void | setTexture (NLMISC::CSmartPtr< ITexture > tex) |
set a texture | |
void | setupDriverModelMatrix (void) |
shortcut to setup the model matrix (system basis or world basis) | |
virtual void | setZBias (float value) |
virtual void | showTool () |
draw the particles for edition mode. The default behaviour just draw a wireframe model | |
virtual void | step (TPSProcessPass pass, TAnimationTime ellapsedTime, TAnimationTime realEt) |
inherited from CPSParticle | |
virtual bool | supportGlobalColorLighting () const |
bool | usesGlobalColorLighting () |
Object | |
CPSRibbon () | |
NLMISC_DECLARE_CLASS (CPSRibbon) | |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
================================================================================================================== | |
~CPSRibbon () | |
dtor | |
Behaviour | |
virtual bool | getColorFading (void) const |
virtual bool | isInSystemBasis (void) const |
return true if the tails are in the system basis | |
virtual void | setColorFading (bool onOff=true) |
virtual void | setSystemBasis (bool yes) |
Static Public Attributes | |
Predefined shapes | |
const NLMISC::CVector | HeightSides [] |
Predefined shape : height sides. | |
const NLMISC::CVector | Losange [] |
Predefined shape : a regular losange shape. | |
const uint | NbVerticesInHeightSide = sizeof(CPSRibbon::HeightSides) / sizeof(CVector) |
number of vertices in the height side (must be 8 ... :) ) | |
const uint | NbVerticesInLosange = sizeof(Losange) / sizeof(CVector) |
number of vertices in the losange | |
const uint | NbVerticesInPentagram = sizeof(CPSRibbon::Pentagram) / sizeof(CVector) |
Predefined shape : height sides. | |
const uint | NbVerticesInTriangle = sizeof(CPSRibbon::Triangle) / sizeof(CVector) |
Predefined shape : height sides. | |
const NLMISC::CVector | Pentagram [] |
Predifined shape : pentagram. | |
const NLMISC::CVector | Triangle [] |
Predifined shape : triangle. | |
Protected Types | |
typedef CPSVector< float >::V | TFloatVect |
typedef CPSVector< NLMISC::CVector >::V | TPosVect |
Protected Member Functions | |
virtual void | bounceOccured (uint32 index) |
void | computeRibbon (uint index, NLMISC::CVector *dest, uint stride=sizeof(NLMISC::CVector)) |
void | computeSrcStep (uint32 &step, uint &numToProcess) |
void | deleteColorElement (uint32 index) |
virtual void | deleteElement (uint32 index) |
inherited from CPSLocatedBindable | |
void | deleteSizeElement (uint32 index) |
void | displayIcon2d (const NLMISC::CVector tab[], uint nbSegs, float scale) |
*************************************************************************************** | |
virtual CPSLocated * | getColorOwner (void) |
From CPSColoredParticle. | |
uint32 | getRibbonIndex () const |
const TFloatVect & | getSamplingDate () const |
virtual CPSLocated * | getSizeOwner (void) |
From CPSSizedParticle. | |
void | initDateVect () |
virtual void | motionTypeChanged (bool parametric) |
called when the motion type has changed, this allow us to draw smoother ribbons when parametric anim is used | |
void | newColorElement (CPSLocated *emitterLocated, uint32 emitterIndex) |
virtual void | newElement (CPSLocated *emitterLocated, uint32 emitterIndex) |
inherited from CPSLocatedBindable | |
void | newSizeElement (CPSLocated *emitterLocated, uint32 emitterIndex) |
void | notifyOwnerMaxNumFacesChanged (void) const |
void | resetFromOwner () |
virtual void | resize (uint32 size) |
inherited from CPSLocatedBindable | |
void | resizeColor (uint32 size) |
void | resizeSize (uint32 size) |
virtual void | setOwner (CPSLocated *psl) |
*************************************************************************************** | |
void | updateGlobals (float realET) |
Called each time the time of the system change in order to update the ribbons positions. | |
void | updateLOD () |
must be called for the lod to apply (updates UsedNbSegs) | |
Protected Attributes | |
bool | _Active |
CRGBA | _Color |
CPSAttribMaker< CRGBA > * | _ColorScheme |
uint32 | _ExternID |
TPSLod | _LOD |
tells when this object must be dealt with | |
CMaterial | _Mat |
std::string | _Name |
uint32 | _NbSegs |
CPSLocated * | _Owner |
bool | _Parametric |
float | _ParticleSize |
TAnimationTime | _SegDuration |
CPSAttribMaker< float > * | _SizeScheme |
uint32 | _UsedNbSegs |
value to use after lod computation | |
TAnimationTime | _UsedSegDuration |
float | _UsedSegLength |
Private Member Functions | |
void | displayRibbons (uint32 nbRibbons, uint32 srcStep) |
display a set of ribbons | |
uint | getNumVerticesInSlice () const |
Get the number of vertices in each slices (depends on wether the ribbon is textured or not). | |
void | setupGlobalColor () |
void | setupTexturedGlobalColor () |
void | setupTextureMatrix () |
void | setupUntexturedGlobalColor () |
void | touch () |
virtual void | updateMatAndVbForColor (void) |
update the material and the vb so that they match the color scheme. Inherited from CPSColoredParticle | |
void | updateMaterial () |
void | updateTexturedMaterial () |
void | updateUntexturedMaterial () |
Private Attributes | |
bool | _ColorFading: 1 |
bool | _ForceLighted: 1 |
bool | _GlobalColor: 1 |
bool | _Lighted: 1 |
CPSVector< NLMISC::CVector >::V | _Shape |
CSmartPtr< ITexture > | _Tex |
bool | _Touch: 1 |
float | _UFactor |
float | _VFactor |
Friends | |
class | CPSLocated |
|
Definition at line 99 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::getSamplingDate(). |
|
Definition at line 98 of file ps_ribbon_base.h. |
|
Definition at line 228 of file ps_ribbon.h. |
|
this enum summarize the useful modes for blending to the framebuffer
Definition at line 809 of file ps_particle_basic.h.
00809 { add, modulate, alphaBlend, alphaTest }; |
|
Definition at line 49 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::getInterpolationMode().
00049 { Linear = 0, Hermitte, InterpModeLast }; |
|
Definition at line 48 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::getRibbonMode().
00048 { VariableSize = 0, FixedSize, RibbonModeLast }; |
|
ctor.
Definition at line 233 of file ps_ribbon.cpp. References NbVerticesInTriangle, NL3D::CMaterial::setDoubleSided(), NL3D::CPSRibbonBase::setInterpolationMode(), NL3D::CPSRibbonBase::setSegDuration(), and setShape().
00233 : _UFactor(1.f), 00234 _VFactor(1.f), 00235 _ColorFading(true), 00236 _GlobalColor(false), 00237 _Touch(true), 00238 _Lighted(false), 00239 _ForceLighted(false) 00240 { 00241 setInterpolationMode(Linear); 00242 setSegDuration(0.06f); 00243 if (CParticleSystem::getSerializeIdentifierFlag()) _Name = std::string("Ribbon"); 00244 setShape(Triangle, NbVerticesInTriangle); 00245 _Mat.setDoubleSided(true); 00246 } |
|
dtor
Definition at line 250 of file ps_ribbon.cpp.
00251 { 00252 } |
|
Called when the basis of the owner changed. the default behaviour does nothing
Reimplemented in NL3D::CPSForce. Definition at line 968 of file ps_located.h.
00968 {} |
|
a bounce occured, so some action could be done. The default behaviour does nothing
Reimplemented in NL3D::CPSEmitter. Definition at line 1011 of file ps_located.h.
01011 {} |
|
Reimplemented in NL3D::CPSFanLight, NL3D::CPSQuad, and NL3D::CPSShockWave. Definition at line 884 of file ps_located.h.
00884 { return false ;} |
|
Compute a vector that will map to (1 0 0) after view and model transform. This allow to have object that always faces the user, whatever basis they are in Definition at line 931 of file ps_located.h. References NL3D::CPSLocated::computeI(). Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSGravity::show(), and NL3D::CPSEmitter::showTool().
00931 { return _Owner->computeI(); } |
|
Compute a vector that will map to (0 1 0) after view and model transform. This allow to have object that always faces the user, whatever basis they are in Definition at line 936 of file ps_located.h. References NL3D::CPSLocated::computeJ(). Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt().
00936 { return _Owner->computeJ(); } |
|
Compute a vector that will map to (0 0 1) after view and model transform. This allow to have object that always faces the user, whatever basis they are in Definition at line 940 of file ps_located.h. References NL3D::CPSLocated::computeK(). Referenced by NL3D::CPSLocatedBindable::displayIcon2d(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), and NL3D::CPSEmitter::showTool().
00940 { return _Owner->computeK(); } |
|
Get position of the i-th ribbon and store them in a table of vector. It uses the interpolation setting of this object. The dest tab must have at least nbSegs + 1 entries. Definition at line 455 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_InterpolationMode, NL3D::CPSRibbonBase::_RibbonMode, NL3D::CPSRibbonBase::computeHermitteCstSizeRibbon(), NL3D::CPSRibbonBase::computeHermitteRibbon(), NL3D::CPSRibbonBase::computeLinearCstSizeRibbon(), NL3D::CPSRibbonBase::computeLinearRibbon(), NL3D::CPSRibbonBase::Hermitte, index, NL3D::CPSRibbonBase::Linear, nlassert, stride, uint, and NL3D::CPSRibbonBase::VariableSize. Referenced by NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), and displayRibbons().
00456 { 00457 switch (_InterpolationMode) 00458 { 00459 case Linear: 00460 if (_RibbonMode == VariableSize) 00461 { 00462 computeLinearRibbon(index, dest, stride); 00463 } 00464 else 00465 { 00466 computeLinearCstSizeRibbon(index, dest, stride); 00467 } 00468 break; 00469 case Hermitte: 00470 if (_RibbonMode == VariableSize) 00471 { 00472 computeHermitteRibbon(index, dest, stride); 00473 00474 } 00475 else 00476 { 00477 computeHermitteCstSizeRibbon(index, dest, stride); 00478 } 00479 break; 00480 default: 00481 nlassert(0); 00482 break; 00483 } 00484 00485 } |
|
System may have hand-tuned LOD, or auto LOD. This compute the number of particles that must really be displayed, and the src step that allow to go through the whole collection. The step in the source is in a fixed point 16:16 format Definition at line 82 of file ps_particle_basic.cpp. References NL3D::CPSParticle::_DisableAutoLOD, NLMISC::clamp(), NL3D::CParticleSystem::getAutoLODDegradationExponent(), NL3D::CParticleSystem::getAutoLODMode(), NL3D::CParticleSystem::getAutoLODStartDistPercent(), NL3D::CParticleSystem::getOneMinusCurrentLODRatio(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::isAutoLODEnabled(), NL3D::CParticleSystem::isSharingEnabled(), nlassert, r, uint, and uint32. Referenced by NL3D::CPSShockWave::draw(), NL3D::CPSConstraintMesh::draw(), NL3D::CPSFanLight::draw(), NL3D::CPSFaceLookAt::draw(), NL3D::CPSDot::draw(), NL3D::CPSTailDot::step(), NL3D::CPSRibbonLookAt::step(), step(), and NL3D::CPSFace::step().
00083 { 00084 nlassert(_Owner && _Owner->getOwner()); 00085 const CParticleSystem &ps = *(_Owner->getOwner()); 00086 if (_DisableAutoLOD || !ps.isAutoLODEnabled() || !ps.isSharingEnabled() || _Owner->getSize() == 0) // Should Auto-LOD be used ? 00087 { 00088 step = (1 << 16); 00089 numToProcess = _Owner->getSize(); 00090 } 00091 else 00092 { 00093 float oneMinusLODRatio = ps.getOneMinusCurrentLODRatio(); 00094 float LODRatio = 1.f - oneMinusLODRatio; 00095 if (LODRatio > ps.getAutoLODStartDistPercent()) 00096 { 00097 float factor = (LODRatio - 1.f) / (ps.getAutoLODStartDistPercent() - 1.f); 00098 NLMISC::clamp(factor, 0.f, 1.f); 00099 float r = factor; 00100 for (uint k = 1; k < ps.getAutoLODDegradationExponent(); ++k) 00101 { 00102 r *= factor; 00103 } 00104 numToProcess = (uint) (_Owner->getSize() * r); 00105 if (numToProcess < 1) { numToProcess = 1; } 00106 00107 step = ps.getAutoLODMode() ? // skip or limit number, depending on the mode 00108 (_Owner->getSize() << 16) / numToProcess : // skip particles 00109 (1 << 16); // just display less particles 00110 } 00111 else 00112 { 00113 step = (1 << 16); 00114 numToProcess = _Owner->getSize(); 00115 } 00116 } 00117 00118 } |
|
Definition at line 237 of file ps_particle_basic.h. References NL3D::CPSAttribMaker< CRGBA >::deleteElement(), NL3D::CPSAttribMaker< CRGBA >::hasMemory(), index, and uint32. Referenced by NL3D::CPSTailDot::deleteElement(), NL3D::CPSShockWave::deleteElement(), NL3D::CPSRibbonLookAt::deleteElement(), deleteElement(), NL3D::CPSQuad::deleteElement(), NL3D::CPSConstraintMesh::deleteElement(), NL3D::CPSFanLight::deleteElement(), and NL3D::CPSDot::deleteElement().
00238 { 00239 if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->deleteElement(index); 00240 } |
|
inherited from CPSLocatedBindable
Reimplemented from NL3D::CPSRibbonBase. Definition at line 322 of file ps_ribbon.cpp. References NL3D::CPSColoredParticle::deleteColorElement(), NL3D::CPSSizedParticle::deleteSizeElement(), index, and uint32.
00323 { 00324 CPSRibbonBase::deleteElement(index); 00325 deleteColorElement(index); 00326 deleteSizeElement(index); 00327 } |
|
Definition at line 295 of file ps_particle_basic.h. References NL3D::CPSSizedParticle::_SizeScheme, NL3D::CPSAttribMaker< float >::deleteElement(), NL3D::CPSAttribMaker< float >::hasMemory(), index, and uint32. Referenced by NL3D::CPSShockWave::deleteElement(), NL3D::CPSRibbonLookAt::deleteElement(), deleteElement(), NL3D::CPSQuad::deleteElement(), NL3D::CPSConstraintMesh::deleteElement(), NL3D::CPSMesh::deleteElement(), and NL3D::CPSFanLight::deleteElement().
00296 { 00297 if (_SizeScheme && _SizeScheme->hasMemory()) _SizeScheme->deleteElement(index); 00298 } |
|
Force the Auto-LOD to be disbaled. When set to false, the default behaviour set in the system is used.
Definition at line 137 of file ps_particle_basic.h. References NL3D::CPSParticle::_DisableAutoLOD.
00137 { _DisableAutoLOD = disable; } |
|
*************************************************************************************** show an drawing to represent the object, and in red if it is selected
Definition at line 2038 of file ps_located.cpp. References NL3D::CPSLocatedBindable::computeI(), NL3D::CPSLocatedBindable::computeK(), NL3D::CParticleSystem::getCurrentEditedElement(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSize(), index, NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), NL3D::CMaterial::setColor(), NL3D::CMaterial::setLighting(), NL3D::CPSLocatedBindable::setupDriverModelMatrix(), NL3D::CMaterial::setZFunc(), NL3D::CMaterial::setZWrite(), size, uint, uint32, NLMISC::CLine::V0, NLMISC::CLine::V1, NLMISC::CVector::x, and NLMISC::CVector::y. Referenced by NL3D::CPSSpring::show(), NL3D::CPSCentralGravity::show(), and NL3D::CPSParticle::showTool().
02039 { 02040 uint32 size = _Owner->getSize(); 02041 if (!size) return; 02042 setupDriverModelMatrix(); 02043 02044 const CVector I = computeI(); 02045 const CVector K = computeK(); 02046 02047 static std::vector<NLMISC::CLine> lines; 02048 02049 lines.clear(); 02050 02051 // ugly slow code, but not for runtime 02052 for (uint k = 0; k < size; ++k) 02053 { 02054 // center of the current particle 02055 const CVector p = _Owner->getPos()[k]; 02056 02057 02058 02059 for (uint l = 0; l < nbSegs; ++l) 02060 { 02061 NLMISC::CLine li; 02062 li.V0 = p + scale * (tab[l << 1].x * I + tab[l << 1].y * K); 02063 li.V1 = p + scale * (tab[(l << 1) + 1].x * I + tab[(l << 1) + 1].y * K); 02064 lines.push_back(li); 02065 } 02066 02067 CMaterial mat; 02068 02069 mat.setBlendFunc(CMaterial::one, CMaterial::one); 02070 mat.setZWrite(false); 02071 mat.setLighting(false); 02072 mat.setBlend(true); 02073 mat.setZFunc(CMaterial::less); 02074 02075 02076 02077 CPSLocated *loc; 02078 uint32 index; 02079 CPSLocatedBindable *lb; 02080 _Owner->getOwner()->getCurrentEditedElement(loc, index, lb); 02081 02082 mat.setColor((lb == NULL || this == lb) && loc == _Owner && index == k ? CRGBA::Red : CRGBA(127, 127, 127)); 02083 02084 02085 CDRU::drawLinesUnlit(lines, mat, *getDriver() ); 02086 } 02087 02088 } |
|
display a set of ribbons setup sizes compute colors Definition at line 471 of file ps_ribbon.cpp. References _ForceLighted, _Lighted, NL3D::IDriver::activeVertexBuffer(), NL3D::CPSRibbonBase::computeRibbon(), NL3D::ComputeTexturedRibbonMesh(), NL3D::ComputeUntexturedRibbonMesh(), NL3D::CParticleSystem::getColorAttenuationScheme(), NL3D::CVertexBuffer::getColorOff(), NL3D::CPSLocatedBindable::getDriver(), NL3D::CParticleSystem::getForceGlobalColorLightingFlag(), getNumRibbonsInVB(), getNumVerticesInSlice(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getSystemDate(), getVBnPB(), NL3D::CVertexBuffer::getVertexCoordPointer(), NL3D::CVertexBuffer::getVertexSize(), NL3D::CPSLocated::incrementNbDrawnParticles(), NL3D::CPSLocated::integrateSingle(), NL3D::CParticleSystem::isUserColorUsed(), NL3D::CPSAttribMaker< float >::make(), NL3D::CPSAttribMaker< CRGBA >::makeN(), min, nlassert, NL3D::CPSRibbon::CVBnPB::PB, NL3D::IDriver::render(), NL3D::CPrimitiveBlock::setNumTri(), NL3D::CPSLocatedBindable::setupDriverModelMatrix(), setupGlobalColor(), touch(), uint, uint32, uint8, updateMaterial(), NL3D::CPSParticle::usesGlobalColorLighting(), and NL3D::CPSRibbon::CVBnPB::VB. Referenced by step().
00472 { 00473 if (!nbRibbons) return; 00474 nlassert(_Owner); 00475 CPSRibbonBase::updateLOD(); 00476 if (_UsedNbSegs < 2) return; 00477 const float date = _Owner->getOwner()->getSystemDate(); 00478 uint8 *currVert; 00479 CVBnPB &VBnPB = getVBnPB(); // get the appropriate vb (built it if needed) 00480 CVertexBuffer &VB = VBnPB.VB; 00481 CPrimitiveBlock &PB = VBnPB.PB; 00482 const uint32 vertexSize = VB.getVertexSize(); 00483 uint colorOffset=0; 00484 00485 IDriver *drv = this->getDriver(); 00486 setupDriverModelMatrix(); 00487 drv->activeVertexBuffer(VB); 00488 _Owner->incrementNbDrawnParticles(nbRibbons); // for benchmark purpose 00489 const uint numRibbonBatch = getNumRibbonsInVB(); // number of ribons to process at once 00490 if (_UsedNbSegs == 0) return; 00492 // Material setup // 00494 CParticleSystem &ps = *(_Owner->getOwner()); 00495 bool useGlobalColor = ps.getColorAttenuationScheme() != NULL || ps.isUserColorUsed(); 00496 if (useGlobalColor != _GlobalColor) 00497 { 00498 _GlobalColor = useGlobalColor; 00499 touch(); 00500 } 00501 if (usesGlobalColorLighting() != _Lighted) 00502 { 00503 _Lighted = usesGlobalColorLighting(); 00504 touch(); 00505 } 00506 if (ps.getForceGlobalColorLightingFlag() != _ForceLighted) 00507 { 00508 _ForceLighted = ps.getForceGlobalColorLightingFlag(); 00509 touch(); 00510 } 00511 updateMaterial(); 00512 setupGlobalColor(); 00513 // 00514 if (_ColorScheme) 00515 { 00516 colorOffset = VB.getColorOff(); 00517 } 00519 // Compute ribbons // 00521 const uint numVerticesInSlice = getNumVerticesInSlice(); 00522 const uint numVerticesInShape = _Shape.size(); 00523 // 00524 static std::vector<float> sizes; 00525 static std::vector<NLMISC::CVector> ribbonPos; // this is where the position of each ribbon slice center i stored 00526 ribbonPos.resize(_UsedNbSegs + 1); // make sure we have enough room 00527 sizes.resize(numRibbonBatch); 00528 00529 // 00530 uint toProcess; 00531 uint ribbonIndex = 0; // index of the first ribbon in the batch being processed 00532 uint32 fpRibbonIndex = 0; // fixed point index in source 00533 do 00534 { 00535 toProcess = std::min((uint) (nbRibbons - ribbonIndex) , numRibbonBatch); 00536 currVert = (uint8 *) VB.getVertexCoordPointer(); 00537 00539 const float *ptCurrSize; 00540 uint32 ptCurrSizeIncrement; 00541 if (_SizeScheme) 00542 { 00543 ptCurrSize = (float *) _SizeScheme->make(this->_Owner, ribbonIndex, &sizes[0], sizeof(float), toProcess, true, srcStep); 00544 ptCurrSizeIncrement = 1; 00545 } 00546 else 00547 { 00548 ptCurrSize = &_ParticleSize; 00549 ptCurrSizeIncrement = 0; 00550 } 00551 00553 if (_ColorScheme) 00554 { 00555 _ColorScheme->makeN(this->_Owner, ribbonIndex, currVert + colorOffset, vertexSize, toProcess, numVerticesInSlice * (_UsedNbSegs + 1), srcStep); 00556 } 00557 uint k = toProcess; 00559 // interpolate and project points the result is directly setup in the vertex buffer // 00561 if (!_Parametric) 00562 { 00564 // INCREMENTAL CASE // 00566 if (_Tex != NULL) // textured case 00567 { 00568 do 00569 { 00570 const float ribbonSizeIncrement = *ptCurrSize / (float) _UsedNbSegs; 00571 ptCurrSize += ptCurrSizeIncrement; 00572 // the parent class has a method to get the ribbons positions 00573 computeRibbon((uint) (fpRibbonIndex >> 16), &ribbonPos[0], sizeof(NLMISC::CVector)); 00574 currVert = ComputeTexturedRibbonMesh(currVert, 00575 vertexSize, 00576 &ribbonPos[0], 00577 &_Shape[0], 00578 _UsedNbSegs, 00579 numVerticesInShape, 00580 ribbonSizeIncrement, 00581 *ptCurrSize 00582 ); 00583 fpRibbonIndex += srcStep; 00584 } 00585 while (--k); 00586 } 00587 else // untextured case 00588 { 00589 do 00590 { 00591 const float ribbonSizeIncrement = *ptCurrSize / (float) _UsedNbSegs; 00592 ptCurrSize += ptCurrSizeIncrement; 00593 // the parent class has a method to get the ribbons positions 00594 computeRibbon((uint) (fpRibbonIndex >> 16), &ribbonPos[0], sizeof(NLMISC::CVector)); 00595 currVert = ComputeUntexturedRibbonMesh(currVert, 00596 vertexSize, 00597 &ribbonPos[0], 00598 &_Shape[0], 00599 _UsedNbSegs, 00600 numVerticesInShape, 00601 ribbonSizeIncrement, 00602 *ptCurrSize 00603 ); 00604 fpRibbonIndex += srcStep; 00605 } 00606 while (--k); 00607 } 00608 } 00609 else 00610 { 00612 // PARAMETRIC CASE // 00614 if (_Tex != NULL) // textured case 00615 { 00616 do 00617 { 00618 const float ribbonSizeIncrement = *ptCurrSize / (float) _UsedNbSegs; 00619 ptCurrSize += ptCurrSizeIncrement; 00620 _Owner->integrateSingle(date - _UsedSegDuration * (_UsedNbSegs + 1), 00621 _UsedSegDuration, 00622 _UsedNbSegs + 1, 00623 (uint) (fpRibbonIndex >> 16), 00624 &ribbonPos[0]); 00625 00626 currVert = ComputeTexturedRibbonMesh(currVert, 00627 vertexSize, 00628 &ribbonPos[0], 00629 &_Shape[0], 00630 _UsedNbSegs, 00631 numVerticesInShape, 00632 ribbonSizeIncrement, 00633 *ptCurrSize 00634 ); 00635 fpRibbonIndex += srcStep; 00636 } 00637 while (--k); 00638 } 00639 else // untextured case 00640 { 00641 do 00642 { 00643 const float ribbonSizeIncrement = *ptCurrSize / (float) _UsedNbSegs; 00644 ptCurrSize += ptCurrSizeIncrement; 00645 _Owner->integrateSingle(date - _UsedSegDuration * (_UsedNbSegs + 1), 00646 _UsedSegDuration, 00647 _UsedNbSegs + 1, 00648 (uint) (fpRibbonIndex >> 16), 00649 &ribbonPos[0]); 00650 00651 currVert = ComputeUntexturedRibbonMesh(currVert, 00652 vertexSize, 00653 &ribbonPos[0], 00654 &_Shape[0], 00655 _UsedNbSegs, 00656 numVerticesInShape, 00657 ribbonSizeIncrement, 00658 *ptCurrSize 00659 ); 00660 fpRibbonIndex += srcStep; 00661 } 00662 while (--k); 00663 } 00664 } 00665 // display the result 00666 PB.setNumTri((numVerticesInShape * _UsedNbSegs * toProcess) << 1); 00667 drv->render(PB, _Mat); 00668 ribbonIndex += toProcess; 00669 } 00670 while (ribbonIndex != nbRibbons); 00671 00672 } |
|
Reimplemented in NL3D::CPSForce. Definition at line 888 of file ps_located.h.
00888 { return true; } |
|
derivers draw the particles here
Reimplemented in NL3D::CPSDot, NL3D::CPSFaceLookAt, NL3D::CPSFanLight, and NL3D::CPSShockWave. Definition at line 110 of file ps_particle_basic.h. Referenced by NL3D::CPSParticle::step().
00110 {} |
|
Definition at line 105 of file ps_particle_basic.h. References NL3D::CPSParticle::_UsesGlobalColorLighting.
00105 { _UsesGlobalColorLighting = enabled; } |
|
===================================================================================
Definition at line 508 of file ps_particle_basic.cpp. References NL3D::CMaterial::setZFunc().
00509 { 00510 _Mat.setZFunc(enabled ? CMaterial::less : CMaterial::always); 00511 } |
|
==================================================================================================================
Reimplemented from NL3D::CPSLocatedBindable. Definition at line 1143 of file ps_ribbon.cpp.
01144 { 01145 if (_Tex) 01146 { 01147 dest.push_back(_Tex); 01148 } 01149 } |
|
*************************************************************************************** this should be called before to delete any bindable inserted in a system, but this is done by the system, so you should never need calling it. This has been introduced because calls in dtor are not polymorphic to derived class (which are already destroyed anyway), and some infos are needed in some dtor. The default behaviour does nothing Reimplemented in NL3D::CPSTargetLocatedBindable. Definition at line 1975 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocatedBindable::getUserMatrixUsageCount(), and NL3D::CParticleSystem::releaseRefForUserSysCoordInfo().
01976 { 01977 if (_Owner && _Owner->getOwner()) 01978 { 01979 _Owner->getOwner()->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount()); 01980 } 01981 } |
|
=================================================================================== Force the material to have one texture that is modulated by diffuse, and a constant color and its diffuse color. This is not compatible with multitextureing, however.
Definition at line 573 of file ps_particle_basic.cpp. References NL3D::CPSMaterial::forceTexturedMaterialStages(), NL3D::CMaterial::getTexture(), NL3D::CMaterial::setTexture(), NL3D::CMaterial::texConstantColor(), NL3D::CMaterial::texEnvArg0Alpha(), NL3D::CMaterial::texEnvArg0RGB(), NL3D::CMaterial::texEnvArg1Alpha(), NL3D::CMaterial::texEnvArg1RGB(), NL3D::CMaterial::texEnvOpAlpha(), and NL3D::CMaterial::texEnvOpRGB(). Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSShockWave::draw(), and NL3D::CPSQuad::updateMatBeforeRendering().
00574 { 00575 if (force) 00576 { 00578 _Mat.texConstantColor(1, col); 00579 _Mat.texEnvOpRGB(1, CMaterial::Modulate); 00580 _Mat.texEnvOpAlpha(1, CMaterial::Modulate); 00581 _Mat.texEnvArg0RGB(1, CMaterial::Previous, CMaterial::SrcColor); 00582 _Mat.texEnvArg1RGB(1, CMaterial::Constant, CMaterial::SrcColor); 00583 _Mat.texEnvArg0Alpha(1, CMaterial::Previous, CMaterial::SrcAlpha); 00584 _Mat.texEnvArg1Alpha(1, CMaterial::Constant, CMaterial::SrcAlpha); 00585 forceTexturedMaterialStages(2); 00586 } 00587 else 00588 { 00589 if (_Mat.getTexture(1) != NULL) 00590 { 00591 _Mat.setTexture(1, NULL); 00592 } 00593 } 00594 } |
|
=================================================================================== This setup n stage of a material with at least texture.
Definition at line 598 of file ps_particle_basic.cpp. References NL3D::CMaterial::getTexture(), NL3D::IDRV_MAT_MAXTEXTURES, NL3D::CMaterial::setTexture(), and uint. Referenced by NL3D::CPSDot::draw(), NL3D::CPSMaterial::forceModulateConstantColor(), and NL3D::CPSFanLight::setupMaterial().
00599 { 00600 ITexture *blankTex = NULL; 00601 uint k; 00602 for (k = 0; k < numStages; ++k) 00603 { 00604 if (_Mat.getTexture(k) == NULL) 00605 { 00606 if (!blankTex) 00607 { 00608 blankTex = CTextureMem::Create1x1WhiteTex(); 00609 } 00610 _Mat.setTexture(k, blankTex); 00611 } 00612 } 00613 for (; k < IDRV_MAT_MAXTEXTURES; ++k) 00614 { 00615 if (_Mat.getTexture(k) != NULL) 00616 { 00617 _Mat.setTexture(k, NULL); 00618 } 00619 } 00620 } |
|
===================================================================================
Definition at line 551 of file ps_particle_basic.cpp. References NL3D::CPSMaterial::alphaBlend, NL3D::CPSMaterial::alphaTest, NL3D::CMaterial::getBlend(), NL3D::CMaterial::getDstBlend(), NL3D::CMaterial::getSrcBlend(), and nlassert. Referenced by NL3D::CPSTailDot::hasTransparentFaces(), NL3D::CPSShockWave::hasTransparentFaces(), NL3D::CPSRibbonLookAt::hasTransparentFaces(), hasTransparentFaces(), NL3D::CPSQuad::hasTransparentFaces(), NL3D::CPSFanLight::hasTransparentFaces(), and NL3D::CPSDot::hasTransparentFaces().
00552 { 00553 if (_Mat.getBlend()) 00554 { 00555 CMaterial::TBlend srcBlend = _Mat.getSrcBlend(); 00556 CMaterial::TBlend destBlend = _Mat.getDstBlend(); 00557 00558 if (srcBlend == CMaterial::one && destBlend == CMaterial::one) return add; 00559 if (srcBlend == CMaterial::zero && destBlend == CMaterial::srccolor) return modulate; 00560 if (srcBlend == CMaterial::srcalpha && destBlend == CMaterial::invsrcalpha) return alphaBlend; 00561 00562 // unrecognized mode 00563 nlassert(0); 00564 return alphaTest; // to avoid a warning only ... 00565 } 00566 else 00567 { 00568 return alphaTest; 00569 } 00570 } |
|
Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize(). |
|
Get the color.
Definition at line 211 of file ps_particle_basic.h.
00211 { return _Color; } |
|
Test wether color fading is activated. Implements NL3D::CPSTailParticle. Definition at line 84 of file ps_ribbon.h. References _ColorFading.
00085 { 00086 return _ColorFading; 00087 } |
|
From CPSColoredParticle.
Implements NL3D::CPSColoredParticle. Definition at line 201 of file ps_ribbon.h.
00201 { return _Owner; } |
|
get the color scheme (NULL if none) const version
Definition at line 205 of file ps_particle_basic.h.
00205 { return _ColorScheme; } |
|
get the color scheme (NULL if none)
Definition at line 202 of file ps_particle_basic.h.
00202 { return _ColorScheme; } |
|
|
get the extern ID of this located bindable
Definition at line 964 of file ps_located.h. References NL3D::CPSLocatedBindable::_ExternID, and uint32. Referenced by NL3D::CPSLocated::bind(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
00964 { return _ExternID; } |
|
Shortcut to get the font generator if one was set (const version).
Definition at line 904 of file ps_located.h. References NL3D::CParticleSystemProcess::getFontGenerator(), and nlassert.
|
|
Shortcut to get the font generator if one was set.
Definition at line 897 of file ps_located.h. References NL3D::CParticleSystemProcess::getFontGenerator(), and nlassert. Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), and NL3D::CPSEmitterRectangle::showTool().
|
|
Shortcut to get the font manager if one was set (const version).
Definition at line 2099 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getFontManager(), and nlassert.
|
|
***************************************************************************************
Definition at line 2091 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getFontManager(), and nlassert. Referenced by NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSCylindricVortex::show(), NL3D::CPSGravity::show(), and NL3D::CPSEmitterRectangle::showTool().
|
|
Definition at line 64 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_InterpolationMode, and NL3D::CPSRibbonBase::TInterpolationMode.
00064 { return _InterpolationMode; }
|
|
shortcut to get the inverted matrix of the system
Definition at line 2116 of file ps_located.cpp. References NL3D::CParticleSystem::getInvertedSysMat(), NL3D::CParticleSystemProcess::getOwner(), and nlassert.
|
|
shortcut to get the inverted view matrix
Definition at line 2134 of file ps_located.cpp. References NL3D::CParticleSystem::getInvertedViewMat(), NL3D::CParticleSystemProcess::getOwner(), and nlassert.
|
|
Shortcut to get the local to world matrix.
Definition at line 1144 of file ps_located.h. References NL3D::CPSLocated::getLocalToWorldMatrix(), and nlassert. Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), NL3D::CPSSound::newElement(), NL3D::CPSZoneRectangle::show(), NL3D::CPSZoneCylinder::show(), NL3D::CPSZoneDisc::show(), NL3D::CPSZonePlane::show(), NL3D::CPSLight::show(), NL3D::CPSGravity::show(), NL3D::CPSEmitterRectangle::showTool(), NL3D::CPSLight::step(), and NL3D::CPSMesh::updatePos().
|
|
get the valid lods for that object
Definition at line 954 of file ps_located.h. References NL3D::CPSLocatedBindable::_LOD, and NL3D::TPSLod.
00954 { return _LOD; } |
|
Definition at line 95 of file ps_ribbon_base.h.
00095 { return _LODDegradation; }
|
|
return the max number of faces needed for display. This is needed for LOD balancing
Implements NL3D::CPSParticle. Definition at line 688 of file ps_ribbon.cpp. References NL3D::CPSLocated::getMaxSize(), nlassert, and uint32.
|
|
get the located bindable name (edition purpose)
Definition at line 948 of file ps_located.h.
00948 { return _Name; } |
|
get the number of vertice in the shape used for ribbons
Definition at line 146 of file ps_ribbon.h. References uint32.
00146 { return _Shape.size(); } |
|
get the number of ribbons contained in a vb for a given length. (e.g the number of ribbons that can be batched) 1 vertex added for textured ribbon (to avoid texture stretching) Definition at line 815 of file ps_ribbon.cpp. References getNumVerticesInSlice(), and uint. Referenced by displayRibbons(), and getVBnPB().
00816 { 00817 const uint numVerticesInSlice = getNumVerticesInSlice(); 00818 const uint vertexInVB = 512; 00819 return std::max(1u, (uint) (vertexInVB / (numVerticesInSlice * (_UsedNbSegs + 1)))); 00820 } |
|
Get the number of vertices in each slices (depends on wether the ribbon is textured or not).
Definition at line 256 of file ps_ribbon.cpp. References uint. Referenced by displayRibbons(), getNumRibbonsInVB(), and getVBnPB().
|
|
get the located that owns this bindable (const version)
Definition at line 944 of file ps_located.h.
00944 { return _Owner; } |
|
get the located that owns this bindable
Definition at line 942 of file ps_located.h. Referenced by NL3D::CPSLocated::deleteElement(), NL3D::CParticleSystemInstanceUser::emit(), NL3D::CPSFaceLookAt::CSecondSize::getSizeOwner(), NL3D::CPSSound::newElement(), NL3D::CPSLocated::registerIntegrableForce(), NL3D::CParticleSystem::registerLocatedBindableExternID(), NL3D::CParticleSystemInstanceUser::removeByID(), NL3D::CPSSound::resize(), NL3D::CPSLight::resize(), NL3D::CPSSound::step(), NL3D::CPSLocated::unregisterIntegrableForce(), and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
00942 { return _Owner; } |
|
return priority
Implements NL3D::CPSLocatedBindable. Definition at line 66 of file ps_particle_basic.h. References uint32.
00066 { return 1000; }
|
|
Definition at line 131 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_RibbonIndex, and uint32.
00131 { return _RibbonIndex; }
|
|
Definition at line 84 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_RibbonLength.
00084 { return _RibbonLength; }
|
|
Definition at line 62 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_RibbonMode, and NL3D::CPSRibbonBase::TRibbonMode.
00062 { return _RibbonMode; }
|
|
Definition at line 133 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_SamplingDate, and NL3D::CPSRibbonBase::TFloatVect.
00133 { return _SamplingDate; }
|
|
Definition at line 77 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_SegDuration, and NL3D::TAnimationTime.
00077 { return _SegDuration; } |
|
================================================================================================================== Get a copy of the shape used for ribbon
Definition at line 1137 of file ps_ribbon.cpp.
|
|
get the constant size
Definition at line 274 of file ps_particle_basic.h. References NL3D::CPSSizedParticle::_ParticleSize. Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt(), NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(), NL3D::CPSSizedParticle::resizeSize(), and NL3D::CPSSizedParticle::setSizeScheme().
00274 { return _ParticleSize; } |
|
From CPSSizedParticle.
Implements NL3D::CPSSizedParticle. Definition at line 199 of file ps_ribbon.h.
00199 { return _Owner; } |
|
get the size scheme (NULL if none) const version
Definition at line 268 of file ps_particle_basic.h. References NL3D::CPSSizedParticle::_SizeScheme.
00268 { return _SizeScheme; } |
|
get the size scheme (NULL if none)
Definition at line 265 of file ps_particle_basic.h. References NL3D::CPSSizedParticle::_SizeScheme. Referenced by NL3D::CPSFaceLookAtHelper::drawLookAt(), and NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion().
00265 { return _SizeScheme; } |
|
***************************************************************************************
Definition at line 2108 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getSysMat(), and nlassert.
|
|
get the number of segments used with this particle
Implements NL3D::CPSTailParticle. Definition at line 72 of file ps_ribbon_base.h. References NL3D::CPSRibbonBase::_NbSegs, and uint32.
00072 { return _NbSegs; } |
|
Implements NL3D::CPSTexturedParticleNoAnim. Definition at line 134 of file ps_ribbon.h.
00134 { return _Tex; } |
|
get the texture used
Implements NL3D::CPSTexturedParticleNoAnim. Definition at line 133 of file ps_ribbon.h.
00133 { return _Tex; } |
|
return this bindable type
Implements NL3D::CPSLocatedBindable. Definition at line 63 of file ps_particle_basic.h. References NL3D::PSParticle, and uint32.
00063 { return PSParticle; } |
|
Definition at line 129 of file ps_ribbon.h. References _UFactor.
00129 { return _UFactor; } |
|
Reimplemented in NL3D::CPSEmitter. Definition at line 974 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::finalize(), and NL3D::CPSLocatedBindable::setOwner().
00974 { return 0; }
|
|
get a vertex buffer and a primitive suited for the current ribbon untextured cases textured cases choose the right vb by building an index for lookup into 'vbMaps' defined above 1 vertex added for textured ribbon (to avoid texture stretching) Setup the pb and vb parts. Not very fast but executed only once setup primitive block there are alway one more slice than segments in the ribbon... deals with each ribbon vertices the last 2 index don't loop if there's a texture setup vb deals with each ribbon vertices setup texture (if any) setup gradient set the vb format & size In the case of a ribbon with color and fading, we encode the fading in a texture If the ribbon has fading, but only a global color, we encode it in the primary color Definition at line 695 of file ps_ribbon.cpp. References _ColorFading, _FadedColoredVBMap, _FadedVBMap, _TexColoredVBMap, _TexFadedColoredVBMap, _TexFadedVBMap, getNumRibbonsInVB(), NL3D::CVertexBuffer::getNumVertices(), getNumVerticesInSlice(), nlassert, NL3D::CPSRibbon::CVBnPB::PB, NL3D::CVertexBuffer::setColor(), NL3D::CPrimitiveBlock::setNumTri(), NL3D::CVertexBuffer::setNumVertices(), NL3D::CVertexBuffer::setTexCoord(), NL3D::CPrimitiveBlock::setTri(), NL3D::CVertexBuffer::setVertexFormat(), uint, uint8, and NL3D::CPSRibbon::CVBnPB::VB. Referenced by displayRibbons().
00696 { 00697 static TVBMap * const vbMaps[] = 00698 { 00700 &_VBMap, 00701 &_FadedVBMap, 00702 &_ColoredVBMap, 00703 &_FadedColoredVBMap, 00705 &_TexVBMap, 00706 &_TexFadedVBMap, 00707 &_TexColoredVBMap, 00708 &_TexFadedColoredVBMap 00709 }; 00710 00712 TVBMap &map = *vbMaps[ (_Tex != NULL ? (1 << 2) : 0) | // set bit 2 if textured 00713 (_ColorScheme != NULL ? (1 << 1) : 0) | // set bit 1 if per ribbon color 00714 (_ColorFading ? 1 : 0) // set bit 0 if color fading 00715 ]; 00716 00717 const uint numVerticesInSlice = getNumVerticesInSlice(); 00718 const uint numVerticesInShape = _Shape.size(); 00719 00720 00721 // The number of slice is encoded in the upper word of the vb index 00722 // The number of vertices per slices is encoded in the lower word 00723 uint VBnPDIndex = ((_UsedNbSegs + 1) << 16) | numVerticesInSlice; 00724 TVBMap::iterator it = map.find(VBnPDIndex); 00725 if (it != map.end()) 00726 { 00727 return it->second; 00728 } 00729 else // must create this vb, with few different size, it is still interseting, though they are only destroyed at exit 00730 { 00731 const uint numRibbonInVB = getNumRibbonsInVB(); 00732 CVBnPB &VBnPB = map[VBnPDIndex]; // make an entry 00733 00737 CVertexBuffer &vb = VBnPB.VB; 00738 vb.setVertexFormat(CVertexBuffer::PositionFlag | /* alway need position */ 00739 (_ColorScheme || _ColorFading ? CVertexBuffer::PrimaryColorFlag : 0) | /* need a color ? */ 00740 ((_ColorScheme && _ColorFading) || _Tex != NULL ? CVertexBuffer::TexCoord0Flag : 0) | /* need texture coordinates ? */ 00741 (_Tex != NULL && _ColorScheme && _ColorFading ? CVertexBuffer::TexCoord1Flag : 0) /* need 2nd texture coordinates ? */ 00742 ); 00743 vb.setNumVertices((_UsedNbSegs + 1) * numRibbonInVB * numVerticesInSlice); // 1 seg = 1 line + terminal vertices 00744 00745 // set the primitive block size 00746 CPrimitiveBlock &pb = VBnPB.PB; 00747 pb.setNumTri((_UsedNbSegs * numRibbonInVB * _Shape.size()) << 1); 00749 uint vbIndex = 0; 00750 uint pbIndex = 0; 00751 uint i, k, l; 00752 for (i = 0; i < numRibbonInVB; ++i) 00753 { 00754 for (k = 0; k < (_UsedNbSegs + 1); ++k) 00755 { 00756 00758 if (k != _UsedNbSegs) 00759 { 00760 uint vIndex = vbIndex; 00761 for (l = 0; l < (numVerticesInShape - 1); ++l) 00762 { 00763 pb.setTri(pbIndex ++, vIndex, vIndex + numVerticesInSlice, vIndex + numVerticesInSlice + 1); 00764 pb.setTri(pbIndex ++, vIndex, vIndex + numVerticesInSlice + 1, vIndex + 1); 00765 ++ vIndex; 00766 } 00767 00769 uint nextVertexIndex = (numVerticesInShape == numVerticesInSlice) ? vIndex + 1 - numVerticesInShape // no texture -> we loop 00770 : vIndex + 1; // a texture is used : use onemore vertex 00771 pb.setTri(pbIndex ++, vIndex, vIndex + numVerticesInSlice, nextVertexIndex + numVerticesInSlice); 00772 pb.setTri(pbIndex ++, vIndex, nextVertexIndex + numVerticesInSlice, nextVertexIndex); 00773 00774 } 00775 00777 for (l = 0; l < numVerticesInSlice; ++l) 00778 { 00779 nlassert(vbIndex < vb.getNumVertices()); 00781 if (_Tex != NULL) 00782 { 00783 vb.setTexCoord(vbIndex, 00784 _ColorScheme && _ColorFading ? 1 : 0, // must we use the second texture coord ? (when 1st one used by the gradient texture : we can't encode it in the diffuse as it encodes each ribbon color) 00785 (float) k / _UsedNbSegs, // u 00786 1.f - (l / (float) numVerticesInShape) // v 00787 ); 00788 } 00789 00791 if (_ColorFading) 00792 { 00793 // If not per ribbon color, we can encode it in the diffuse 00794 if (_ColorScheme == NULL) 00795 { 00796 uint8 intensity = (uint8) (255 * (1.f - ((float) k / _UsedNbSegs))); 00797 NLMISC::CRGBA col(intensity, intensity, intensity, intensity); 00798 vb.setColor(vbIndex, col); 00799 } 00800 else // encode it in the first texture 00801 { 00802 vb.setTexCoord(vbIndex, 0, 0.5f - 0.5f * ((float) k / _UsedNbSegs), 0); 00803 } 00804 } 00805 ++ vbIndex; 00806 } 00807 00808 } 00809 } 00810 return VBnPB; 00811 } 00812 } |
|
Definition at line 131 of file ps_ribbon.h. References _VFactor.
00131 { return _VFactor; } |
|
shortcut to get the view matrix
Definition at line 2125 of file ps_located.cpp. References NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::getViewMat(), and nlassert. Referenced by NL3D::CPSRibbonLookAt::displayRibbons(), and NL3D::CPSFaceLookAtHelper::drawLookAt().
|
|
tells wether there are alive emitters
Definition at line 958 of file ps_located.h.
00958 { return false; } |
|
from CPSParticle : return true if there are lightable faces in the object
Implements NL3D::CPSParticle. Definition at line 173 of file ps_ribbon.h.
00173 { return false; } |
|
return true if there are Opaque faces in the object
Implements NL3D::CPSParticle. Definition at line 682 of file ps_ribbon.cpp. References hasTransparentFaces(). Referenced by step().
00683 { 00684 return !hasTransparentFaces(); 00685 } |
|
return true if this located bindable derived class holds alive particles
Reimplemented from NL3D::CPSLocatedBindable. Definition at line 69 of file ps_particle_basic.h. References NL3D::CPSLocated::getSize(), and nlassert.
|
|
return true if there are transparent faces in the object
Implements NL3D::CPSParticle. Definition at line 675 of file ps_ribbon.cpp. References NL3D::CPSMaterial::getBlendingMode(). Referenced by hasOpaqueFaces(), and step().
00676 { 00677 return getBlendingMode() != CPSMaterial::alphaTest ; 00678 } |
|
Definition at line 568 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_NbSegs, NL3D::CPSRibbonBase::_SamplingDate, and NL3D::EndRibbonStorage. Referenced by NL3D::CPSRibbonBase::CPSRibbonBase(), NL3D::CPSRibbonBase::motionTypeChanged(), and NL3D::CPSRibbonBase::setTailNbSeg().
00569 { 00570 _SamplingDate.resize( _NbSegs + 1 + EndRibbonStorage); 00571 std::fill(_SamplingDate.begin(), _SamplingDate.begin() + (_NbSegs + 1 + EndRibbonStorage), 0.f); 00572 } |
|
Definition at line 844 of file ps_located.h. References NL3D::CPSLocatedBindable::_Active. Referenced by NL3D::CParticleSystem::hasActiveEmitters().
00844 { return _Active; } |
|
Test wether Auto-LOD is disabled.
Definition at line 140 of file ps_particle_basic.h. References NL3D::CPSParticle::_DisableAutoLOD.
00140 { return _DisableAutoLOD; }
|
|
return true if the tails are in the system basis
Implements NL3D::CPSTailParticle. Definition at line 96 of file ps_ribbon.h.
00096 { return true; } |
|
===================================================================================
Definition at line 514 of file ps_particle_basic.cpp. References NL3D::CMaterial::getZFunc().
00515 { 00516 return _Mat.getZFunc() != CMaterial::always; 00517 } |
|
called when the motion type has changed, this allow us to draw smoother ribbons when parametric anim is used
Reimplemented from NL3D::CPSLocatedBindable. Definition at line 550 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_Parametric, NL3D::CPSRibbonBase::_Ribbons, NLMISC::contReset(), NL3D::CPSLocated::getMaxSize(), NL3D::CPSRibbonBase::initDateVect(), nlassert, NL3D::CPSRibbonBase::resetFromOwner(), and NL3D::CPSRibbonBase::resize().
00551 { 00552 _Parametric = parametric; 00553 if (parametric) 00554 { 00555 NLMISC::contReset(_Ribbons); // kill the vector 00556 } 00557 else 00558 { 00559 nlassert(_Owner); 00560 resize(_Owner->getMaxSize()); 00561 initDateVect(); 00562 resetFromOwner(); 00563 } 00564 } |
|
Definition at line 233 of file ps_particle_basic.h. References NL3D::CPSAttribMaker< CRGBA >::hasMemory(), NL3D::CPSAttribMaker< CRGBA >::newElement(), and uint32. Referenced by NL3D::CPSTailDot::newElement(), NL3D::CPSShockWave::newElement(), NL3D::CPSRibbonLookAt::newElement(), newElement(), NL3D::CPSQuad::newElement(), NL3D::CPSConstraintMesh::newElement(), NL3D::CPSFanLight::newElement(), and NL3D::CPSDot::newElement().
00234 { 00235 if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->newElement(emitterLocated, emitterIndex); 00236 } |
|
inherited from CPSLocatedBindable
Reimplemented from NL3D::CPSRibbonBase. Definition at line 313 of file ps_ribbon.cpp. References NL3D::CPSColoredParticle::newColorElement(), NL3D::CPSSizedParticle::newSizeElement(), and uint32.
00314 { 00315 CPSRibbonBase::newElement(emitterLocated, emitterIndex); 00316 newColorElement(emitterLocated, emitterIndex); 00317 newSizeElement(emitterLocated, emitterIndex); 00318 } |
|
Definition at line 291 of file ps_particle_basic.h. References NL3D::CPSSizedParticle::_SizeScheme, NL3D::CPSAttribMaker< float >::hasMemory(), NL3D::CPSAttribMaker< float >::newElement(), and uint32. Referenced by NL3D::CPSShockWave::newElement(), NL3D::CPSRibbonLookAt::newElement(), newElement(), NL3D::CPSQuad::newElement(), NL3D::CPSConstraintMesh::newElement(), NL3D::CPSMesh::newElement(), and NL3D::CPSFanLight::newElement().
00292 { 00293 if (_SizeScheme && _SizeScheme->hasMemory()) _SizeScheme->newElement(emitterLocated, emitterIndex); 00294 } |
|
ctor.
|
|
Shortcut to notify that the max number of faces has changed This must be called when a geometric property of the particle has been modified This needn't to be called during CPSParticle::resize overrides Definition at line 151 of file ps_particle_basic.h. References NL3D::CPSLocated::notifyMaxNumFacesChanged(). Referenced by NL3D::CPSFanLight::setNbFans(), NL3D::CPSShockWave::setNbSegs(), and NL3D::CPSConstraintMesh::update().
|
|
*************************************************************************************** Can be used by located bindable that have located as targets (emitter, collision zone, forces) to be notified that one of their target has been removed. To do this : The object that focus the target must call registerDTorObserver on the target, with himself as a parameter When the target is removed, this target will call this method for all registered CPSLocated The default behaviour remove this object as an observer
Reimplemented in NL3D::CPSEmitter, and NL3D::CPSTargetLocatedBindable. Definition at line 1996 of file ps_located.cpp. References NL3D::CPSLocated::unregisterDtorObserver(). Referenced by NL3D::CPSLocated::releaseRefTo().
01997 {
01998 ptr->unregisterDtorObserver(this);
01999 }
|
|
*************************************************************************************** Release any reference this obj may have to other process of the system For example, this is used when detaching a located bindable from a system. Reimplemented in NL3D::CPSEmitter, NL3D::CPSLight, NL3D::CPSTargetLocatedBindable, and NL3D::CPSMesh. Definition at line 2170 of file ps_located.cpp. Referenced by NL3D::CPSLocatedBindable::setOwner().
02171 { 02172 } |
|
Release any reference this obj may have on the given process. For example, this is used when detaching a located bindable from a system. Reimplemented in NL3D::CPSEmitter, and NL3D::CPSTargetLocatedBindable. Definition at line 871 of file ps_located.h.
00871 {} |
|
Definition at line 538 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_Parametric, NL3D::CPSAttrib< T >::begin(), NL3D::CPSAttrib< T >::end(), NL3D::CPSLocated::getPos(), nlassert, NL3D::CPSRibbonBase::resetSingleRibbon(), and uint. Referenced by NL3D::CPSRibbonBase::motionTypeChanged(), and NL3D::CPSRibbonBase::resize().
00539 { 00540 nlassert(!_Parametric); 00541 TPSAttribVector::iterator posIt = _Owner->getPos().begin(); 00542 TPSAttribVector::iterator endPosIt = _Owner->getPos().end(); 00543 for (uint k = 0; posIt != endPosIt; ++posIt, ++k) 00544 { 00545 resetSingleRibbon(k, *posIt); 00546 } 00547 } |
|
inherited from CPSLocatedBindable
Reimplemented from NL3D::CPSRibbonBase. Definition at line 331 of file ps_ribbon.cpp. References nlassert, NL3D::CPSColoredParticle::resizeColor(), NL3D::CPSSizedParticle::resizeSize(), size, and uint32.
00332 { 00333 nlassert(size < (1 << 16)); 00334 CPSRibbonBase::resize(size); 00335 resizeColor(size); 00336 resizeSize(size); 00337 } |
|
Definition at line 241 of file ps_particle_basic.h. References NL3D::CPSColoredParticle::getColorOwner(), NL3D::CPSAttribMaker< CRGBA >::hasMemory(), nlassert, NL3D::CPSAttribMaker< CRGBA >::resize(), size, and uint32. Referenced by NL3D::CPSTailDot::resize(), NL3D::CPSShockWave::resize(), NL3D::CPSRibbonLookAt::resize(), resize(), NL3D::CPSQuad::resize(), NL3D::CPSConstraintMesh::resize(), NL3D::CPSFanLight::resize(), and NL3D::CPSDot::resize().
00242 { 00243 nlassert(size < (1 << 16)); 00244 if (_ColorScheme && _ColorScheme->hasMemory()) _ColorScheme->resize(size, getColorOwner()->getSize()); 00245 } |
|
Definition at line 299 of file ps_particle_basic.h. References NL3D::CPSSizedParticle::_SizeScheme, NL3D::CPSSizedParticle::getSize(), NL3D::CPSSizedParticle::getSizeOwner(), NL3D::CPSAttribMaker< float >::hasMemory(), nlassert, NL3D::CPSAttribMaker< float >::resize(), size, and uint32. Referenced by NL3D::CPSShockWave::resize(), NL3D::CPSRibbonLookAt::resize(), resize(), NL3D::CPSQuad::resize(), NL3D::CPSConstraintMesh::resize(), NL3D::CPSMesh::resize(), and NL3D::CPSFanLight::resize().
00300 { 00301 nlassert(size < (1 << 16)); 00302 if (_SizeScheme && _SizeScheme->hasMemory()) _SizeScheme->resize(size, getSizeOwner()->getSize()); 00303 } |
|
==================================================================================================================
we had CPSParticle::serial(f), but this is not the base class anymore, so we emulate this... version 2 : auto-lod saved Reimplemented from NL3D::CPSRibbonBase. Definition at line 121 of file ps_ribbon.cpp. References nlassert, NL3D::ITexture::serial(), NL3D::CPSRotated2DParticle::serialAngle2DScheme(), sint, and uint32.
00122 { 00123 sint ver = f.serialVersion(2); 00124 if (ver == 1) 00125 { 00126 nlassert(f.isReading()); 00127 00130 sint ver2 = f.serialVersion(2); 00131 00132 // here is CPSLocatedBindable::serial(f) 00133 sint ver3 = f.serialVersion(4); 00134 f.serialPtr(_Owner); 00135 if (ver3 > 1) f.serialEnum(_LOD); 00136 if (ver3 > 2) f.serial(_Name); 00137 if (ver3 > 3) 00138 { 00139 if (f.isReading()) 00140 { 00141 uint32 id; 00142 f.serial(id); 00143 setExternID(id); 00144 } 00145 else 00146 { 00147 f.serial(_ExternID); 00148 } 00149 } 00150 00151 if (ver2 >= 2) 00152 { 00153 bool bDisableAutoLOD; 00154 f.serial(bDisableAutoLOD); 00155 disableAutoLOD(bDisableAutoLOD); 00156 } 00157 00158 uint32 tailNbSegs; 00159 bool colorFading; 00160 bool systemBasisEnabled; 00161 bool drEnabled; // dying ribbons, not supported in this version 00162 00163 CPSColoredParticle::serialColorScheme(f); 00164 CPSSizedParticle::serialSizeScheme(f); 00165 00166 // we dont use the 2d angle anymore...serial a dummy one 00167 { 00168 CDummy2DAngle _Dummy2DAngle; 00169 _Dummy2DAngle.serialAngle2DScheme(f); 00170 } 00171 00172 f.serial(colorFading, systemBasisEnabled); 00173 serialMaterial(f); 00174 00175 f.serial(drEnabled); 00176 f.serial(tailNbSegs); 00177 ITexture *tex; 00178 f.serialPolyPtr(tex); 00179 _Tex = tex; 00180 if (_Tex != NULL) 00181 { 00182 f.serial(_UFactor, _VFactor) ; 00183 } 00184 00185 // shape serialization 00186 f.serialCont(_Shape); 00187 00188 00189 _NbSegs = tailNbSegs >> 1; 00190 if (_NbSegs < 1) _NbSegs = 2; 00191 setInterpolationMode(Linear); 00192 00193 nlassert(_Owner); 00194 resize(_Owner->getMaxSize()); 00195 initDateVect(); 00196 resetFromOwner(); 00197 } 00198 00199 00200 if (ver >= 2) 00201 { 00202 CPSRibbonBase::serial(f); 00203 CPSColoredParticle::serialColorScheme(f); 00204 CPSSizedParticle::serialSizeScheme(f); 00205 CPSMaterial::serialMaterial(f); 00206 f.serialCont(_Shape); 00207 bool colorFading = _ColorFading; 00208 f.serial(colorFading); 00209 _ColorFading = colorFading; 00210 uint32 tailNbSegs = _NbSegs; 00211 f.serial(tailNbSegs); 00212 if (f.isReading()) 00213 { 00214 setTailNbSeg(_NbSegs); 00215 touch(); 00216 } 00217 ITexture *tex = _Tex; 00218 f.serialPolyPtr(tex); 00219 _Tex = tex; 00220 if (_Tex != NULL) 00221 { 00222 f.serial(_UFactor, _VFactor) ; 00223 } 00224 } 00225 if (f.isReading()) 00226 { 00227 touch(); 00228 } 00229 } |
|
serialization.
Definition at line 155 of file ps_particle_basic.cpp.
00156 { 00157 f.serialVersion(1); 00158 if (f.isReading()) 00159 { 00160 if (_ColorScheme) 00161 { 00162 delete _ColorScheme; 00163 _ColorScheme = NULL; 00164 } 00165 } 00166 bool useColorScheme = _ColorScheme != NULL; 00167 f.serial(useColorScheme); 00168 if (useColorScheme) 00169 { 00170 f.serialPolyPtr(_ColorScheme); 00171 } 00172 else 00173 { 00174 f.serial(_Color); 00175 } 00176 } |
|
===================================================================================
Definition at line 493 of file ps_particle_basic.cpp. References sint.
00494 { 00495 sint ver = f.serialVersion(2); 00496 TBlendingMode m = getBlendingMode(); 00497 f.serialEnum(m); 00498 setBlendingMode(m); 00499 if (ver >= 2) 00500 { 00501 bool zTest = isZTestEnabled(); 00502 f.serial(zTest); 00503 enableZTest(zTest); 00504 } 00505 } |
|
serialization. We choose a different name because of multiple-inheritance
Definition at line 211 of file ps_particle_basic.cpp.
00212 { 00213 f.serialVersion(1); 00214 if (f.isReading()) 00215 { 00216 if (_SizeScheme) 00217 { 00218 delete _SizeScheme; 00219 _SizeScheme = NULL; 00220 } 00221 } 00222 bool useSizeScheme = _SizeScheme != NULL; 00223 f.serial(useSizeScheme); 00224 if (useSizeScheme) 00225 { 00226 f.serialPolyPtr(_SizeScheme); 00227 } 00228 else 00229 { 00230 f.serial(_ParticleSize); 00231 } 00232 }; |
|
Activate / Deactivate this object. When not active, the owning system won't try to call the 'step' method.
Definition at line 843 of file ps_located.h. References NL3D::CPSLocatedBindable::_Active. Referenced by NL3D::CParticleSystem::activateEmitters(), and NL3D::CParticleSystemInstanceUser::setActive().
00843 { _Active = active; } |
|
===================================================================================
Definition at line 520 of file ps_particle_basic.cpp. References NL3D::CPSMaterial::alphaBlend, NL3D::CPSMaterial::alphaTest, NL3D::CMaterial::setAlphaTest(), NL3D::CMaterial::setBlend(), NL3D::CMaterial::setBlendFunc(), and NL3D::CMaterial::setZWrite().
00521 { 00522 switch (mode) 00523 { 00524 case add: 00525 _Mat.setBlend(true); 00526 _Mat.setBlendFunc(CMaterial::one, CMaterial::one); 00527 _Mat.setZWrite(false); 00528 _Mat.setAlphaTest(false); 00529 break; 00530 case modulate: 00531 _Mat.setBlend(true); 00532 _Mat.setBlendFunc(CMaterial::zero, CMaterial::srccolor); 00533 _Mat.setZWrite(false); 00534 _Mat.setAlphaTest(false); 00535 break; 00536 case alphaBlend: 00537 _Mat.setBlend(true); 00538 _Mat.setBlendFunc(CMaterial::srcalpha, CMaterial::invsrcalpha); 00539 _Mat.setZWrite(false); 00540 _Mat.setAlphaTest(false); 00541 break; 00542 case alphaTest: 00543 _Mat.setBlend(false); 00544 _Mat.setZWrite(true); 00545 _Mat.setAlphaTest(true); 00546 break; 00547 } 00548 } |
|
Set a constant color for the particles. remove any previous scheme.
Definition at line 135 of file ps_particle_basic.cpp. References NL3D::CPSColoredParticle::updateMatAndVbForColor().
00136 { 00137 delete _ColorScheme; 00138 _ColorScheme = NULL; 00139 _Color = col; 00140 updateMatAndVbForColor(); 00141 } |
|
(de)activate color fading when its done, colors fades to black along the ribbon. Implements NL3D::CPSTailParticle. Definition at line 76 of file ps_ribbon.h. References _ColorFading, and touch().
00077 { 00078 _ColorFading = onOff; 00079 touch(); 00080 } |
|
Set an attribute maker that produce a color It must have been allocated by new It will be deleted by this object Definition at line 125 of file ps_particle_basic.cpp. References NL3D::CPSColoredParticle::getColorOwner(), nlassert, NL3D::CPSAttribMaker< T >::resize(), and NL3D::CPSColoredParticle::updateMatAndVbForColor().
00126 { 00127 nlassert(col); 00128 delete _ColorScheme; 00129 _ColorScheme = col; 00130 if (getColorOwner() && col->hasMemory()) col->resize(getColorOwner()->getMaxSize(), getColorOwner()->getSize()); 00131 updateMatAndVbForColor(); 00132 } |
|
*************************************************************************************** set the extern ID of this located bindable. 0 means no extern access. The map of ID-locatedBindable. Is in th particle system, so this located bindable must have been attached to a particle system, otherwise an assertion is raised Definition at line 2149 of file ps_located.cpp. References NL3D::CPSLocatedBindable::_ExternID, NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::registerLocatedBindableExternID(), uint32, and NL3D::CParticleSystem::unregisterLocatedBindableExternID().
02150 { 02151 if (id == _ExternID) return; 02152 CParticleSystem *ps = NULL; 02153 if (_Owner && _Owner->getOwner()) 02154 { 02155 ps = _Owner->getOwner(); 02156 } 02157 if (ps) 02158 { 02159 ps->unregisterLocatedBindableExternID(this); 02160 _ExternID = 0; 02161 } 02162 if (id != 0) 02163 { 02164 if (ps) ps->registerLocatedBindableExternID(id, this); 02165 _ExternID = id; 02166 } 02167 } |
|
Definition at line 111 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_InterpolationMode, NL3D::CPSRibbonBase::InterpModeLast, and nlassert. Referenced by CPSRibbon(), and NL3D::CPSTailDot::CPSTailDot().
00112 { 00113 nlassert(mode < InterpModeLast); 00114 _InterpolationMode = mode; 00115 } |
|
set the LODs that apply to that object (warning : it is based on the position of the system, and don't act on a per instance basis ...) To have per instance precision, you must use an attribute maker that has LOD as its input Definition at line 952 of file ps_located.h. References NL3D::CPSLocatedBindable::_LOD.
00952 { _LOD = lod; } |
|
Allow degradation of ribbons with distance of the system (may not be suited when theit paths have wicked angles)
Definition at line 90 of file ps_ribbon_base.h. References nlassert.
00091 { 00092 nlassert(percent >= 0 && percent <= 1); 00093 _LODDegradation = percent; 00094 } |
|
set the located bindable name (edition purpose)
Definition at line 946 of file ps_located.h.
00946 { _Name = name; } |
|
***************************************************************************************
Reimplemented in NL3D::CPSEmitter. Definition at line 1948 of file ps_located.cpp. References NL3D::CParticleSystem::addRefForUserSysCoordInfo(), NL3D::CPSLocatedBindable::deleteElement(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getSize(), NL3D::CPSLocatedBindable::getUserMatrixUsageCount(), NL3D::CPSLocatedBindable::releaseAllRef(), NL3D::CParticleSystem::releaseRefForUserSysCoordInfo(), and uint. Referenced by NL3D::CPSLocated::bind(), and NL3D::CPSLocated::unbind().
01949 { 01950 if (psl == _Owner) return; 01951 if (psl == NULL) 01952 { 01953 releaseAllRef(); 01954 if (_Owner) 01955 { 01956 // empty this located bindable. Need to be empty if it must be rebound to another located. 01957 for (uint k = 0; k < _Owner->getSize(); ++k) 01958 { 01959 deleteElement(0); 01960 } 01961 } 01962 } 01963 if (_Owner && _Owner->getOwner()) 01964 { 01965 _Owner->getOwner()->releaseRefForUserSysCoordInfo(getUserMatrixUsageCount()); 01966 } 01967 _Owner = psl; 01968 if (_Owner && _Owner->getOwner()) 01969 { 01970 _Owner->getOwner()->addRefForUserSysCoordInfo(getUserMatrixUsageCount()); 01971 } 01972 } |
|
The the length in meter of the ribbon. This is used only if the ribbon mode is set to FixedSize. These kind of ribbon are usually slower than variable size ribbons. The default is one metter. Definition at line 95 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_NbSegs, NL3D::CPSRibbonBase::_RibbonLength, NL3D::CPSRibbonBase::_SegLength, and nlassert.
|
|
NB : a fixed size isn't applied with parametric motion.
Definition at line 103 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_RibbonMode, nlassert, and NL3D::CPSRibbonBase::RibbonModeLast.
00104 { 00105 nlassert(mode < RibbonModeLast); 00106 _RibbonMode = mode; 00107 } |
|
Set how many seconds need a seg to be traversed. Long times will create longer ribbons. Default is 0.02. It gives the sampling rate for each type of ribbon Definition at line 132 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_SegDuration, and NL3D::TAnimationTime. Referenced by CPSRibbon(), and NL3D::CPSTailDot::CPSTailDot().
00133 { 00134 _SegDuration = ellapsedTime; 00135 00136 } |
|
================================================================================================================== set a new shape for the ribbon If the number of vertices in the shape has changed, the previous ribbon will be desroyed In fact, their radius will be 0 all along the tail
Definition at line 1129 of file ps_ribbon.cpp. References nlassert, and uint32. Referenced by CPSRibbon().
|
|
Set a constant size for the particles.
Definition at line 192 of file ps_particle_basic.cpp. References NL3D::CPSSizedParticle::_ParticleSize, NL3D::CPSSizedParticle::_SizeScheme, and size.
00193 { 00194 delete _SizeScheme; 00195 _SizeScheme = NULL; 00196 _ParticleSize = size; 00197 } |
|
Set an attribute maker that produce a size It must have been allocated by new It will be deleted by this object Definition at line 183 of file ps_particle_basic.cpp. References NL3D::CPSSizedParticle::_SizeScheme, NL3D::CPSSizedParticle::getSize(), NL3D::CPSSizedParticle::getSizeOwner(), nlassert, and size.
00184 { 00185 nlassert(size != NULL); 00186 delete _SizeScheme; 00187 _SizeScheme = size; 00188 if (getSizeOwner() && size->hasMemory()) size->resize(getSizeOwner()->getMaxSize(), getSizeOwner()->getSize()); 00189 } |
|
tells in which basis is the tail It requires one transform per particle if it is not the same as the located that hold that particle The default is false. With that you can control if a rotation of the system will rotate the tail Implements NL3D::CPSTailParticle. Definition at line 93 of file ps_ribbon.h.
00093 {} |
|
set the number of segments used with this particle. In this case, it can't be lower than 2
Implements NL3D::CPSTailParticle. Definition at line 118 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_NbSegs, NL3D::CPSRibbonBase::_RibbonIndex, NL3D::CPSLocated::getMaxSize(), NL3D::CPSRibbonBase::initDateVect(), nlassert, NL3D::CPSRibbonBase::resize(), and uint32.
|
|
Set texture factors.
Definition at line 122 of file ps_ribbon.h. References _UFactor, _VFactor, and touch().
|
|
set a texture
Implements NL3D::CPSTexturedParticleNoAnim. Definition at line 120 of file ps_ribbon.h. References touch().
|
|
|
Definition at line 1100 of file ps_ribbon.cpp. References setupTexturedGlobalColor(), and setupUntexturedGlobalColor(). Referenced by displayRibbons().
01101 { 01102 if (_Tex != NULL) setupTexturedGlobalColor(); 01103 else setupUntexturedGlobalColor(); 01104 } |
|
setup the global color if it is used Definition at line 1026 of file ps_ribbon.cpp. References _ColorFading, NL3D::CParticleSystem::getColorAttenuationScheme(), NL3D::CParticleSystem::getForceGlobalColorLightingFlag(), NL3D::CParticleSystem::getGlobalColor(), NL3D::CParticleSystem::getGlobalColorLighted(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::isUserColorUsed(), NLMISC::CRGBA::modulateFromColor(), NL3D::CMaterial::setColor(), NL3D::CMaterial::texConstantColor(), and NL3D::CPSParticle::usesGlobalColorLighting(). Referenced by setupGlobalColor().
01027 { 01029 CParticleSystem &ps = *(_Owner->getOwner()); 01030 if (_ColorScheme) 01031 { 01032 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting()) 01033 { 01034 if (_ColorFading) 01035 { 01036 _Mat.texConstantColor(2, ps.getGlobalColorLighted()); 01037 } 01038 else 01039 { 01040 _Mat.texConstantColor(1, ps.getGlobalColorLighted()); 01041 } 01042 } 01043 else 01044 { 01045 if (_ColorFading) 01046 { 01047 _Mat.texConstantColor(2, ps.getGlobalColor()); 01048 } 01049 else 01050 { 01051 _Mat.texConstantColor(1, ps.getGlobalColor()); 01052 } 01053 } 01054 } 01055 else // GLOBAL COLOR with / without fading 01056 { 01057 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting()) 01058 { 01059 NLMISC::CRGBA col; 01060 col.modulateFromColor(ps.getGlobalColorLighted(), _Color); 01061 if (_ColorFading) 01062 { 01063 _Mat.texConstantColor(1, col); 01064 } 01065 else // color attenuation, no fading : 01066 { 01067 _Mat.setColor(col); 01068 } 01069 } 01070 else 01071 if (ps.getColorAttenuationScheme() || ps.isUserColorUsed()) 01072 { 01073 NLMISC::CRGBA col; 01074 col.modulateFromColor(ps.getGlobalColor(), _Color); 01075 if (_ColorFading) 01076 { 01077 _Mat.texConstantColor(1, col); 01078 } 01079 else // color attenuation, no fading : 01080 { 01081 _Mat.setColor(col); 01082 } 01083 } 01084 else 01085 { 01086 if (_ColorFading) 01087 { 01088 _Mat.texConstantColor(1, _Color); 01089 } 01090 else // constant color 01091 { 01092 _Mat.setColor(_Color); 01093 } 01094 } 01095 } 01096 } |
|
Definition at line 1107 of file ps_ribbon.cpp. References _ColorFading, _UFactor, _VFactor, NL3D::CMaterial::enableUserTexMat(), NLMISC::CMatrix::setRot(), NL3D::CMaterial::setUserTexMat(), and uint. Referenced by updateMaterial().
01108 { 01109 uint stage = (_ColorScheme != NULL && _ColorFading == true) ? 1 : 0; 01110 if (_UFactor != 1.f || _VFactor != 1.f) 01111 { 01112 _Mat.enableUserTexMat(stage); 01113 CMatrix texMat; 01114 texMat.setRot(_UFactor * NLMISC::CVector::I, 01115 _VFactor * NLMISC::CVector::J, 01116 NLMISC::CVector::K 01117 ); 01118 _Mat.setUserTexMat(stage, texMat); 01119 } 01120 else 01121 { 01122 _Mat.enableUserTexMat(stage, false); 01123 } 01124 _Mat.enableUserTexMat(1 - stage, false); 01125 } |
|
setup the global color if it is used Definition at line 984 of file ps_ribbon.cpp. References _ColorFading, NL3D::CParticleSystem::getColorAttenuationScheme(), NL3D::CParticleSystem::getForceGlobalColorLightingFlag(), NL3D::CParticleSystem::getGlobalColor(), NL3D::CParticleSystem::getGlobalColorLighted(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::isUserColorUsed(), NLMISC::CRGBA::modulateFromColor(), NL3D::CMaterial::setColor(), NL3D::CMaterial::texConstantColor(), and NL3D::CPSParticle::usesGlobalColorLighting(). Referenced by setupGlobalColor().
00985 { 00987 CParticleSystem &ps = *(_Owner->getOwner()); 00988 if (_ColorScheme) 00989 { 00990 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting()) 00991 { 00992 _Mat.texConstantColor(0, ps.getGlobalColorLighted()); 00993 } 00994 else 00995 { 00996 _Mat.texConstantColor(0, ps.getGlobalColor()); 00997 } 00998 } 00999 else // GLOBAL COLOR with / without fading 01000 { 01001 NLMISC::CRGBA col; 01002 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting()) 01003 { 01004 col.modulateFromColor(ps.getGlobalColorLighted(), _Color); 01005 } 01006 else if (ps.getColorAttenuationScheme() || ps.isUserColorUsed()) 01007 { 01008 col.modulateFromColor(ps.getGlobalColor(), _Color); 01009 } 01010 else 01011 { 01012 col = _Color; 01013 } 01014 if (_ColorFading) 01015 { 01016 _Mat.texConstantColor(0, col); 01017 } 01018 else // color attenuation, no fading : 01019 { 01020 _Mat.setColor(col); 01021 } 01022 } 01023 } |
|
Reimplemented from NL3D::CPSMaterial. Definition at line 182 of file ps_ribbon.h. References value.
00182 { CPSMaterial::setZBias(value); } |
|
draw the particles for edition mode. The default behaviour just draw a wireframe model
Definition at line 55 of file ps_particle_basic.cpp. References NL3D::CPSLocatedBindable::displayIcon2d(), PARTICLES_CHECK_MEM, and uint. Referenced by NL3D::CPSParticle::step(), NL3D::CPSConstraintMesh::step(), NL3D::CPSMesh::step(), and NL3D::CPSFace::step().
00056 { 00057 PARTICLES_CHECK_MEM; 00058 00059 CVector I = CVector::I; 00060 CVector J = CVector::J; 00061 00062 const CVector tab[] = { 2 * J, I + J 00063 , I + J, 2 * I + J 00064 , 2 * I + J, I 00065 , I, 2 * I - J 00066 , 2 * I - J, - .5f * J 00067 , - .5f * J, -2 * I - J 00068 , -2 * I - J, - I 00069 , - I, -2 * I + J 00070 , -2 * I + J, - I + J 00071 , - I + J, 2 * J 00072 }; 00073 const uint tabSize = sizeof(tab) / (2 * sizeof(CVector)); 00074 00075 const float sSize = 0.1f; 00076 displayIcon2d(tab, tabSize, sSize); 00077 00078 PARTICLES_CHECK_MEM; 00079 } |
|
inherited from CPSParticle return true if the ribbon light persist after death
We support Auto-LOD for ribbons, although there is a built-in LOD (that change the geometry rather than the number of ribbons) that gives better result (both can be used simultaneously) Reimplemented from NL3D::CPSParticle. Definition at line 266 of file ps_ribbon.cpp. References NL3D::CPSParticle::computeSrcStep(), displayRibbons(), NL3D::CParticleSystem::getForceGlobalColorLightingFlag(), NL3D::CParticleSystem::getGlobalColor(), NL3D::CParticleSystem::getGlobalColorLighted(), NL3D::CParticleSystemProcess::getOwner(), hasOpaqueFaces(), hasTransparentFaces(), NL3D::PSBlendRender, NL3D::PSMotion, NL3D::PSSolidRender, NL3D::PSToolRender, NL3D::CMaterial::setColor(), NL3D::TAnimationTime, uint, uint32, NL3D::CPSRibbonBase::updateGlobals(), and NL3D::CPSParticle::usesGlobalColorLighting().
00267 { 00268 if (pass == PSMotion) 00269 { 00270 if (!_Parametric) 00271 { 00272 updateGlobals(realET); 00273 } 00274 } 00275 else 00276 if ( 00277 (pass == PSBlendRender && hasTransparentFaces()) 00278 || (pass == PSSolidRender && hasOpaqueFaces()) 00279 ) 00280 { 00281 uint32 step; 00282 uint numToProcess; 00283 computeSrcStep(step, numToProcess); 00284 if (!numToProcess) return; 00285 00287 CParticleSystem &ps = *(_Owner->getOwner()); 00288 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting()) 00289 { 00290 _Mat.setColor(ps.getGlobalColorLighted()); 00291 } 00292 else 00293 { 00294 _Mat.setColor(ps.getGlobalColor()); 00295 } 00296 00301 displayRibbons(numToProcess, step); 00302 00303 } 00304 else 00305 if (pass == PSToolRender) // edition mode only 00306 { 00307 //showTool(); 00308 } 00309 } |
|
Implements NL3D::CPSParticle. Definition at line 176 of file ps_ribbon.h.
00176 { return true; } |
|
Definition at line 260 of file ps_ribbon.h. References _Touch. Referenced by displayRibbons(), setColorFading(), setTexFactor(), setTexture(), and updateMatAndVbForColor().
00260 { _Touch = true; } |
|
Called each time the time of the system change in order to update the ribbons positions. decal date save current date updating ribbons positions Definition at line 139 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_NbSegs, NL3D::CPSRibbonBase::_Parametric, NL3D::CPSRibbonBase::_RibbonIndex, NL3D::CPSRibbonBase::_Ribbons, NL3D::CPSRibbonBase::_SamplingDate, NL3D::CPSRibbonBase::_SegDuration, NL3D::CPSAttrib< T >::begin(), NL3D::EndRibbonStorage, NL3D::CParticleSystemProcess::getOwner(), NL3D::CPSLocated::getPos(), NL3D::CPSLocated::getSize(), NL3D::CParticleSystem::getSystemDate(), nlassert, size, NL3D::TAnimationTime, and uint. Referenced by NL3D::CPSTailDot::step(), NL3D::CPSRibbonLookAt::step(), and step().
00140 { 00141 nlassert(!_Parametric); 00142 nlassert(_Owner); 00143 const uint size = _Owner->getSize(); 00144 if (!size) return; 00145 const TAnimationTime currDate = _Owner->getOwner()->getSystemDate() + realET; 00146 if (currDate - _LastUpdateDate >= _SegDuration) 00147 { 00148 if (_RibbonIndex == 0) _RibbonIndex = _NbSegs + EndRibbonStorage; 00149 else --_RibbonIndex; 00150 00152 ::memmove(&_SamplingDate[1], &_SamplingDate[0], sizeof(float) * (_NbSegs + EndRibbonStorage)); 00153 _LastUpdateDate = currDate; 00154 } 00155 00157 _SamplingDate[0] = currDate; 00158 00160 TPSAttribVector::iterator posIt = _Owner->getPos().begin(); 00161 NLMISC::CVector *currIt = &_Ribbons[_RibbonIndex]; 00162 uint k = size; 00163 for (;;) 00164 { 00165 *currIt = *posIt; 00166 --k; 00167 if (!k) break; 00168 ++posIt; 00169 currIt += (_NbSegs + 1 + EndRibbonStorage); 00170 } 00171 } |
|
must be called for the lod to apply (updates UsedNbSegs)
Definition at line 610 of file ps_ribbon_base.cpp. References NL3D::CPSRibbonBase::_NbSegs, NL3D::CPSRibbonBase::_SegDuration, NL3D::CPSRibbonBase::_SegLength, NL3D::CPSRibbonBase::_UsedNbSegs, NL3D::CPSRibbonBase::_UsedSegDuration, NL3D::CPSRibbonBase::_UsedSegLength, NLMISC::clamp(), NL3D::CParticleSystem::getOneMinusCurrentLODRatio(), NL3D::CParticleSystemProcess::getOwner(), nlassert, and uint.
00611 { 00612 nlassert(_Owner); 00613 float ratio = _Owner->getOwner()->getOneMinusCurrentLODRatio(); 00614 float squaredRatio = ratio * ratio; 00615 float lodRatio = _LODDegradation + (1.f - _LODDegradation ) * squaredRatio * squaredRatio * squaredRatio; 00616 00617 _UsedNbSegs = (uint) (_NbSegs * lodRatio); 00618 NLMISC::clamp(_UsedNbSegs, 0u, _NbSegs); 00619 const float epsilon = 10E-4f; 00620 _UsedSegDuration = _SegDuration / std::max(epsilon, lodRatio); 00621 _UsedSegLength = _SegLength / std::max(epsilon, lodRatio); 00622 00623 } |
|
update the material and the vb so that they match the color scheme. Inherited from CPSColoredParticle
Implements NL3D::CPSColoredParticle. Definition at line 340 of file ps_ribbon.cpp. References touch().
00341 { 00342 touch(); 00343 } |
|
Definition at line 967 of file ps_ribbon.cpp. References _Touch, setupTextureMatrix(), updateTexturedMaterial(), and updateUntexturedMaterial(). Referenced by displayRibbons().
00968 { 00969 if (!_Touch) return; 00970 if (_Tex != NULL) 00971 { 00972 updateTexturedMaterial(); 00973 setupTextureMatrix(); 00974 } 00975 else 00976 { 00977 updateUntexturedMaterial(); 00978 } 00979 } |
|
fading is stored in last stage (work only with 3 stages...) Definition at line 890 of file ps_ribbon.cpp. References _ColorFading, _Touch, NL3D::CreateGradientTexture(), NL3D::CParticleSystem::getColorAttenuationScheme(), NL3D::CParticleSystem::getForceGlobalColorLightingFlag(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::isUserColorUsed(), NL3D::CMaterial::setTexture(), NL3D::SetupModulatedStage(), and NL3D::CPSParticle::usesGlobalColorLighting(). Referenced by updateMaterial().
00891 { 00893 // TEXTURED RIBBON // 00895 00896 static NLMISC::CRefPtr<ITexture> ptGradTexture; 00897 CParticleSystem &ps = *(_Owner->getOwner()); 00898 if (_ColorScheme) 00899 { // PER RIBBON COLOR 00900 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting() || ps.getColorAttenuationScheme() || ps.isUserColorUsed()) 00901 { 00902 if (_ColorFading) // global color + fading + per ribbon color 00903 { 00904 if (ptGradTexture == NULL) // have we got a gradient texture ? 00905 { 00906 ptGradTexture = CreateGradientTexture(); // create it 00907 } 00909 _Mat.setTexture(0, ptGradTexture); 00910 _Mat.setTexture(1, _Tex); 00911 CPSMaterial::forceTexturedMaterialStages(3); // use constant color 0 * diffuse, 1 stage needed 00912 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); 00913 SetupModulatedStage(_Mat, 1, CMaterial::Texture, CMaterial::Previous); 00914 SetupModulatedStage(_Mat, 2, CMaterial::Previous, CMaterial::Constant); 00915 } 00916 else // per ribbon color with global color 00917 { 00918 _Mat.setTexture(0, _Tex); 00919 CPSMaterial::forceTexturedMaterialStages(2); // use constant color 0 * diffuse, 1 stage needed 00920 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); 00921 SetupModulatedStage(_Mat, 1, CMaterial::Previous, CMaterial::Constant); 00922 } 00923 } 00924 else 00925 { 00926 if (_ColorFading) // per ribbon color, fading : 2 textures needed 00927 { 00928 if (ptGradTexture == NULL) // have we got a gradient texture ? 00929 { 00930 ptGradTexture = CreateGradientTexture(); // create it 00931 } 00932 _Mat.setTexture(0, ptGradTexture); 00933 _Mat.setTexture(1, _Tex); 00934 CPSMaterial::forceTexturedMaterialStages(2); 00935 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); // texture * ribbon color 00936 SetupModulatedStage(_Mat, 1, CMaterial::Texture, CMaterial::Previous); // * gradient 00937 } 00938 else // per color ribbon with no fading, and no global color 00939 { 00940 _Mat.setTexture(0, _Tex); 00941 CPSMaterial::forceTexturedMaterialStages(1); // no texture use constant diffuse only 00942 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); 00943 } 00944 } 00945 } 00946 else // GLOBAL COLOR 00947 { 00948 00949 if (_ColorFading) // gradient is encoded in diffuse 00950 { 00951 _Mat.setTexture(0, _Tex); 00952 CPSMaterial::forceTexturedMaterialStages(2); // use constant color 0 * diffuse, 1 stage needed 00953 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); 00954 SetupModulatedStage(_Mat, 1, CMaterial::Previous, CMaterial::Constant); 00955 } 00956 else // constant color 00957 { 00958 _Mat.setTexture(0, _Tex); 00959 CPSMaterial::forceTexturedMaterialStages(1); // no texture use constant diffuse only 00960 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); 00961 } 00962 } 00963 _Touch = false; 00964 } |
|
Definition at line 824 of file ps_ribbon.cpp. References _ColorFading, _Touch, NL3D::CreateGradientTexture(), NL3D::CParticleSystem::getColorAttenuationScheme(), NL3D::CParticleSystem::getForceGlobalColorLightingFlag(), NL3D::CParticleSystemProcess::getOwner(), NL3D::CParticleSystem::isUserColorUsed(), NL3D::CMaterial::setTexture(), NL3D::SetupModulatedStage(), and NL3D::CPSParticle::usesGlobalColorLighting(). Referenced by updateMaterial().
00825 { 00827 // UNTEXTURED RIBBON // 00829 00830 static NLMISC::CRefPtr<ITexture> ptGradTexture; 00831 00832 CParticleSystem &ps = *(_Owner->getOwner()); 00833 if (_ColorScheme) 00834 { // PER RIBBON COLOR 00835 if (ps.getForceGlobalColorLightingFlag() || usesGlobalColorLighting() || ps.getColorAttenuationScheme() || ps.isUserColorUsed()) 00836 { 00837 if (_ColorFading) // global color + fading + per ribbon color 00838 { 00839 // the first stage is used to get fading * global color 00840 // the second stage multiply the result by the diffuse colot 00841 if (ptGradTexture == NULL) // have we got a gradient texture ? 00842 { 00843 ptGradTexture = CreateGradientTexture(); 00844 } 00845 _Mat.setTexture(0, ptGradTexture); 00846 CPSMaterial::forceTexturedMaterialStages(2); // use constant color 0 * diffuse, 1 stage needed 00847 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Constant); 00848 SetupModulatedStage(_Mat, 1, CMaterial::Previous, CMaterial::Diffuse); 00849 } 00850 else // per ribbon color with global color 00851 { 00852 CPSMaterial::forceTexturedMaterialStages(1); // use constant color 0 * diffuse, 1 stage needed 00853 SetupModulatedStage(_Mat, 0, CMaterial::Diffuse, CMaterial::Constant); 00854 } 00855 } 00856 else 00857 { 00858 if (_ColorFading) // per ribbon color, no fading 00859 { 00860 if (ptGradTexture == NULL) // have we got a gradient texture ? 00861 { 00862 ptGradTexture = CreateGradientTexture(); 00863 } 00864 _Mat.setTexture(0, ptGradTexture); 00865 CPSMaterial::forceTexturedMaterialStages(1); 00866 SetupModulatedStage(_Mat, 0, CMaterial::Texture, CMaterial::Diffuse); 00867 } 00868 else // per color ribbon with no fading, and no global color 00869 { 00870 CPSMaterial::forceTexturedMaterialStages(0); // no texture use constant diffuse only 00871 } 00872 } 00873 } 00874 else // GLOBAL COLOR 00875 { 00876 if (_ColorFading) 00877 { 00878 CPSMaterial::forceTexturedMaterialStages(1); // use constant color 0 * diffuse, 1 stage needed 00879 SetupModulatedStage(_Mat, 0, CMaterial::Diffuse, CMaterial::Constant); 00880 } 00881 else // color attenuation, no fading : 00882 { 00883 CPSMaterial::forceTexturedMaterialStages(0); // no texture use constant diffuse only 00884 } 00885 } 00886 _Touch = false; 00887 } |
|
Returns true if the object can use global lighting color. (example : 'lookat' particle do not have normals, so they use global lighting color instead Definition at line 103 of file ps_particle_basic.h. References NL3D::CPSParticle::_UsesGlobalColorLighting. Referenced by NL3D::CPSTailDot::displayRibbons(), NL3D::CPSRibbonLookAt::displayRibbons(), displayRibbons(), NL3D::CPSShockWave::draw(), NL3D::CPSDot::draw(), NL3D::CPSTailDot::setupGlobalColor(), NL3D::CPSFanLight::setupMaterial(), setupTexturedGlobalColor(), setupUntexturedGlobalColor(), NL3D::CPSTailDot::step(), NL3D::CPSRibbonLookAt::step(), step(), NL3D::CPSQuad::updateMatBeforeRendering(), NL3D::CPSTailDot::updateMaterial(), updateTexturedMaterial(), and updateUntexturedMaterial().
00103 { return _UsesGlobalColorLighting; }
|
|
Reimplemented in NL3D::CPSForce. Definition at line 986 of file ps_located.h. |
|
Definition at line 1033 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::isActive(), and NL3D::CPSLocatedBindable::setActive(). |
|
Definition at line 226 of file ps_particle_basic.h. |
|
Definition at line 106 of file ps_ribbon.cpp. |
|
Definition at line 254 of file ps_ribbon.h. Referenced by getColorFading(), getVBnPB(), setColorFading(), setupTexturedGlobalColor(), setupTextureMatrix(), setupUntexturedGlobalColor(), updateTexturedMaterial(), and updateUntexturedMaterial(). |
|
Definition at line 228 of file ps_particle_basic.h. Referenced by NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSConstraintMeshHelper::drawMeshs(), and NL3D::CPSConstraintMeshHelper::drawPrerotatedMeshs(). |
|
Definition at line 1027 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getExternID(), NL3D::CPSLocatedBindable::setExternID(), and NL3D::CPSLocatedBindable::~CPSLocatedBindable(). |
|
Definition at line 107 of file ps_ribbon.cpp. Referenced by getVBnPB(). |
|
Definition at line 105 of file ps_ribbon.cpp. Referenced by getVBnPB(). |
|
Definition at line 257 of file ps_ribbon.h. Referenced by displayRibbons(). |
|
Definition at line 255 of file ps_ribbon.h. |
|
Definition at line 256 of file ps_ribbon.h. Referenced by displayRibbons(). |
|
tells when this object must be dealt with
Definition at line 1029 of file ps_located.h. Referenced by NL3D::CPSLocatedBindable::getLOD(), and NL3D::CPSLocatedBindable::setLOD(). |
|
Definition at line 844 of file ps_particle_basic.h. Referenced by NL3D::CPSFaceHelper::drawFaces(), NL3D::CPSFanLightHelper::drawFanLight(), NL3D::CPSFaceLookAtHelper::drawLookAt(), and NL3D::CPSFaceLookAtHelper::drawLookAtAlignOnMotion(). |
|
Definition at line 1031 of file ps_located.h. |
|
|
|
|
|
Definition at line 102 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::getSegDuration(), NL3D::CPSRibbonBase::setSegDuration(), NL3D::CPSRibbonBase::updateGlobals(), and NL3D::CPSRibbonBase::updateLOD(). |
|
Definition at line 250 of file ps_ribbon.h. |
|
|
Definition at line 249 of file ps_ribbon.h. |
|
Definition at line 111 of file ps_ribbon.cpp. Referenced by getVBnPB(). |
|
Definition at line 112 of file ps_ribbon.cpp. Referenced by getVBnPB(). |
|
Definition at line 110 of file ps_ribbon.cpp. Referenced by getVBnPB(). |
|
textured ribbons
Definition at line 109 of file ps_ribbon.cpp. |
|
Definition at line 258 of file ps_ribbon.h. Referenced by touch(), updateMaterial(), updateTexturedMaterial(), and updateUntexturedMaterial(). |
|
Definition at line 251 of file ps_ribbon.h. Referenced by getUFactor(), setTexFactor(), and setupTextureMatrix(). |
|
value to use after lod computation
Definition at line 136 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::computeHermitteCstSizeRibbon(), NL3D::CPSRibbonBase::computeHermitteRibbon(), NL3D::CPSRibbonBase::computeLinearCstSizeRibbon(), NL3D::CPSRibbonBase::computeLinearRibbon(), and NL3D::CPSRibbonBase::updateLOD(). |
|
Definition at line 137 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::computeHermitteRibbon(), NL3D::CPSRibbonBase::computeLinearRibbon(), and NL3D::CPSRibbonBase::updateLOD(). |
|
Definition at line 138 of file ps_ribbon_base.h. Referenced by NL3D::CPSRibbonBase::computeHermitteCstSizeRibbon(), NL3D::CPSRibbonBase::computeLinearCstSizeRibbon(), and NL3D::CPSRibbonBase::updateLOD(). |
|
untextured ribbons
Definition at line 104 of file ps_ribbon.cpp. |
|
Definition at line 251 of file ps_ribbon.h. Referenced by getVFactor(), setTexFactor(), and setupTextureMatrix(). |
|
Initial value: { NLMISC::CVector(-0.5f, 1, 0), NLMISC::CVector(0.5f, 1, 0), NLMISC::CVector(1, 0.5f, 0), NLMISC::CVector(1, -0.5f, 0), NLMISC::CVector(0.5f, -1, 0), NLMISC::CVector(-0.5f, -1, 0), NLMISC::CVector(-1, -0.5f, 0), NLMISC::CVector(-1, 0.5f, 0) }
Definition at line 76 of file ps_ribbon.cpp. |
|
Initial value: { NLMISC::CVector(0, 1.f, 0), NLMISC::CVector(1.f, 0, 0), NLMISC::CVector(0, -1.f, 0), NLMISC::CVector(-1.f, 0, 0) }
Definition at line 68 of file ps_ribbon.cpp. |
|
number of vertices in the height side (must be 8 ... :) )
Definition at line 100 of file ps_ribbon.cpp. |
|
number of vertices in the losange
Definition at line 99 of file ps_ribbon.cpp. |
|
Predefined shape : height sides.
Definition at line 101 of file ps_ribbon.cpp. |
|
Predefined shape : height sides.
Definition at line 98 of file ps_ribbon.cpp. Referenced by CPSRibbon(). |
|
Initial value: { NLMISC::CVector(0, 1, 0), NLMISC::CVector(1, -1, 0), NLMISC::CVector(-1, 0, 0), NLMISC::CVector(1, 0, 0), NLMISC::CVector(-1, -1, 0) }
Definition at line 89 of file ps_ribbon.cpp. |
|
Initial value: { NLMISC::CVector(0, 1, 0), NLMISC::CVector(1, -1, 0), NLMISC::CVector(-1, -1, 0), }
Definition at line 61 of file ps_ribbon.cpp. |