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

NL3D::CPSRibbonBase Class Reference

Base class for ribbons. More...

#include <ps_ribbon_base.h>

Inheritance diagram for NL3D::CPSRibbonBase:

NL3D::CPSParticle NL3D::CPSTailParticle NL3D::CPSLocatedBindable NLMISC::IStreamable NLMISC::IClassable NL3D::CPSRibbon NL3D::CPSRibbonLookAt NL3D::CPSTailDot List of all members.

Public Types

enum  TRibbonMode { VariableSize = 0, FixedSize, RibbonModeLast }
enum  TInterpolationMode { Linear = 0, Hermitte, InterpModeLast }

Public Methods

void setLODDegradation (float percent)
 Allow degradation of ribbons with distance of the system (may not be suited when theit paths have wicked angles). More...

float getLODDegradation () const
Object
 CPSRibbonBase ()
virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serialisation. Derivers must override this, and call their parent version. More...

Behaviour
void setRibbonMode (TRibbonMode mode)
 NB : a fixed size isn't applied with parametric motion. More...

TRibbonMode getRibbonMode () const
void setInterpolationMode (TInterpolationMode mode)
TInterpolationMode getInterpolationMode () const
Geometry
void setTailNbSeg (uint32 nbSegs)
 set the number of segments used with this particle. In this case, it can't be lower than 2. More...

uint32 getTailNbSeg (void) const
 get the number of segments used with this particle. More...

void setSegDuration (TAnimationTime ellapsedTime)
 Set how many seconds need a seg to be traversed. More...

TAnimationTime getSegDuration (void) const
void setRibbonLength (float length)
 The the length in meter of the ribbon. More...

float getRibbonLength () const

Protected Methods

virtual void newElement (CPSLocated *emitterLocated, uint32 emitterIndex)
 inherited from CPSLocatedBindable. More...

virtual void deleteElement (uint32 index)
 inherited from CPSLocatedBindable. More...

virtual void resize (uint32 size)
 inherited from CPSLocatedBindable. More...

virtual void motionTypeChanged (bool parametric)
 called when the motion type has changed, this allow us to draw smoother ribbons when parametric anim is used. More...

void computeRibbon (uint index, NLMISC::CVector *dest, uint stride=sizeof(NLMISC::CVector))
 Get position of the i-th ribbon and store them in a table of vector. More...

void updateGlobals ()
 Called each time the time of the system change in order to update the ribbons positions. More...

void updateLOD ()
 must be called for the lod to apply (updates UsedNbSegs). More...

void initDateVect ()
void resetFromOwner ()

Protected Attributes

uint32 _NbSegs
TAnimationTime _SegDuration
bool _Parametric
uint32 _UsedNbSegs
 value to use after lod computation. More...

TAnimationTime _UsedSegDuration
float _UsedSegLength

Private Types

typedef std::vector< NLMISC::CVectorTPosVect
typedef std::vector< float > TFloatVect

Private Methods

void resetSingleRibbon (uint index, const NLMISC::CVector &pos)
void dupRibbon (uint dest, uint src)
 copy datas from one ribbon to another. More...

void computeLinearRibbon (uint index, NLMISC::CVector *dest, uint stride=sizeof(NLMISC::CVector))
 Compute the ribbon points using linear interpolation between each sampling point. More...

void computeLinearCstSizeRibbon (uint index, NLMISC::CVector *dest, uint stride=sizeof(NLMISC::CVector))
 The same as compute linear ribbon but try to make its length constant. More...

void computeHermitteRibbon (uint index, NLMISC::CVector *dest, uint stride=sizeof(NLMISC::CVector))
 Compute the ribbon points using hermitte splines between each sampling point. More...

void computeHermitteCstSizeRibbon (uint index, NLMISC::CVector *dest, uint stride=sizeof(NLMISC::CVector))
 Compute the ribbon points using hermitte splines between each sampling point, and make a rough approximation to get a constant lenght. More...


Private Attributes

TPosVect _Ribbons
TFloatVect _SamplingDate
uint _RibbonIndex
TAnimationTime _LastUpdateDate
TRibbonMode _RibbonMode
TInterpolationMode _InterpolationMode
float _RibbonLength
float _SegLength
float _LODDegradation

Detailed Description

Base class for ribbons.

If can be used to compute ribbons trajectory. It can perform lagrange or linear interpolation. to get the ribbon shape. It can also be used to have fixed size ribbons. NB : Ribbons that don't herit from this are deprecated but may be kept for compatibility.

Author:
Nicolas Vizerie , Nevrax France
Date:
2002

Definition at line 44 of file ps_ribbon_base.h.


Member Typedef Documentation

typedef std::vector<float> NL3D::CPSRibbonBase::TFloatVect [private]
 

Definition at line 133 of file ps_ribbon_base.h.

typedef std::vector<NLMISC::CVector> NL3D::CPSRibbonBase::TPosVect [private]
 

Definition at line 132 of file ps_ribbon_base.h.


Member Enumeration Documentation

enum NL3D::CPSRibbonBase::TInterpolationMode
 

Enumeration values:
Linear 
Hermitte 
InterpModeLast 

Definition at line 48 of file ps_ribbon_base.h.

Referenced by getInterpolationMode.

enum NL3D::CPSRibbonBase::TRibbonMode
 

Enumeration values:
VariableSize 
FixedSize 
RibbonModeLast 

Definition at line 47 of file ps_ribbon_base.h.

Referenced by getRibbonMode.


Constructor & Destructor Documentation

NL3D::CPSRibbonBase::CPSRibbonBase  
 

Definition at line 79 of file ps_ribbon_base.cpp.

References initDateVect.


Member Function Documentation

void NL3D::CPSRibbonBase::computeHermitteCstSizeRibbon uint    index,
NLMISC::CVector   dest,
uint    stride = sizeof(NLMISC::CVector)
[private]
 

Compute the ribbon points using hermitte splines between each sampling point, and make a rough approximation to get a constant lenght.

Definition at line 372 of file ps_ribbon_base.cpp.

References _NbSegs, _Parametric, _RibbonIndex, _Ribbons, _UsedNbSegs, _UsedSegLength, NL3D::BuildHermiteVector, NL3D::EndRibbonStorage, index, nlassert, and stride.

Referenced by computeRibbon.

void NL3D::CPSRibbonBase::computeHermitteRibbon uint    index,
NLMISC::CVector   dest,
uint    stride = sizeof(NLMISC::CVector)
[private]
 

Compute the ribbon points using hermitte splines between each sampling point.

Definition at line 175 of file ps_ribbon_base.cpp.

References _NbSegs, _Parametric, _RibbonIndex, _Ribbons, _SamplingDate, _UsedNbSegs, _UsedSegDuration, NL3D::BuildHermiteVector, NL3D::EndRibbonStorage, index, nlassert, and stride.

Referenced by computeRibbon.

void NL3D::CPSRibbonBase::computeLinearCstSizeRibbon uint    index,
NLMISC::CVector   dest,
uint    stride = sizeof(NLMISC::CVector)
[private]
 

The same as compute linear ribbon but try to make its length constant.

Definition at line 305 of file ps_ribbon_base.cpp.

References _NbSegs, _Parametric, _RibbonIndex, _Ribbons, _UsedNbSegs, _UsedSegLength, NL3D::BuildLinearVector, NL3D::EndRibbonStorage, index, nlassert, and stride.

Referenced by computeRibbon.

void NL3D::CPSRibbonBase::computeLinearRibbon uint    index,
NLMISC::CVector   dest,
uint    stride = sizeof(NLMISC::CVector)
[private]
 

Compute the ribbon points using linear interpolation between each sampling point.

Definition at line 240 of file ps_ribbon_base.cpp.

References _NbSegs, _Parametric, _RibbonIndex, _Ribbons, _SamplingDate, _UsedSegDuration, NL3D::BuildLinearVector, NL3D::EndRibbonStorage, index, nlassert, and stride.

Referenced by computeRibbon.

void NL3D::CPSRibbonBase::computeRibbon uint    index,
NLMISC::CVector   dest,
uint    stride = sizeof(NLMISC::CVector)
[protected]
 

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 445 of file ps_ribbon_base.cpp.

References _RibbonMode, computeHermitteCstSizeRibbon, computeHermitteRibbon, computeLinearCstSizeRibbon, computeLinearRibbon, Hermitte, index, Linear, nlassert, stride, and VariableSize.

Referenced by NL3D::CPSTailDot::displayRibbons, NL3D::CPSRibbonLookAt::displayRibbons, and NL3D::CPSRibbon::displayRibbons.

void NL3D::CPSRibbonBase::deleteElement uint32    index [protected, virtual]
 

inherited from CPSLocatedBindable.

Implements NL3D::CPSParticle.

Reimplemented in NL3D::CPSRibbon.

Definition at line 497 of file ps_ribbon_base.cpp.

References NL3D::CPSLocatedBindable::_Owner, dupRibbon, and index.

void NL3D::CPSRibbonBase::dupRibbon uint    dest,
uint    src
[private]
 

copy datas from one ribbon to another.

Definition at line 477 of file ps_ribbon_base.cpp.

References _NbSegs, NL3D::CPSLocatedBindable::_Owner, _Parametric, _Ribbons, NL3D::EndRibbonStorage, nlassert, and src.

Referenced by deleteElement.

TInterpolationMode NL3D::CPSRibbonBase::getInterpolationMode   const [inline]
 

Definition at line 63 of file ps_ribbon_base.h.

References _InterpolationMode, and TInterpolationMode.

float NL3D::CPSRibbonBase::getLODDegradation   const [inline]
 

Definition at line 94 of file ps_ribbon_base.h.

References _LODDegradation.

float NL3D::CPSRibbonBase::getRibbonLength   const [inline]
 

Definition at line 83 of file ps_ribbon_base.h.

References _RibbonLength.

TRibbonMode NL3D::CPSRibbonBase::getRibbonMode   const [inline]
 

Definition at line 61 of file ps_ribbon_base.h.

References _RibbonMode, and TRibbonMode.

TAnimationTime NL3D::CPSRibbonBase::getSegDuration void    const [inline]
 

Definition at line 76 of file ps_ribbon_base.h.

References _SegDuration, and NL3D::TAnimationTime.

uint32 NL3D::CPSRibbonBase::getTailNbSeg void    const [inline, virtual]
 

get the number of segments used with this particle.

Implements NL3D::CPSTailParticle.

Definition at line 71 of file ps_ribbon_base.h.

References _NbSegs.

void NL3D::CPSRibbonBase::initDateVect   [protected]
 

Definition at line 556 of file ps_ribbon_base.cpp.

References _NbSegs, _SamplingDate, and NL3D::EndRibbonStorage.

Referenced by CPSRibbonBase, motionTypeChanged, and setTailNbSeg.

void NL3D::CPSRibbonBase::motionTypeChanged bool    parametric [protected, virtual]
 

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 538 of file ps_ribbon_base.cpp.

References NL3D::CPSLocatedBindable::_Owner, _Parametric, _Ribbons, NLMISC::contReset, initDateVect, nlassert, resetFromOwner, and resize.

void NL3D::CPSRibbonBase::newElement CPSLocated   emitterLocated,
uint32    emitterIndex
[protected, virtual]
 

inherited from CPSLocatedBindable.

Implements NL3D::CPSParticle.

Reimplemented in NL3D::CPSRibbon.

Definition at line 487 of file ps_ribbon_base.cpp.

References NL3D::CPSLocatedBindable::_Owner, index, and resetSingleRibbon.

void NL3D::CPSRibbonBase::resetFromOwner   [protected]
 

Definition at line 526 of file ps_ribbon_base.cpp.

References NL3D::CPSLocatedBindable::_Owner, _Parametric, nlassert, and resetSingleRibbon.

Referenced by motionTypeChanged, and resize.

void NL3D::CPSRibbonBase::resetSingleRibbon uint    index,
const NLMISC::CVector   pos
[private]
 

Definition at line 516 of file ps_ribbon_base.cpp.

References _NbSegs, _Parametric, _Ribbons, NL3D::EndRibbonStorage, index, and nlassert.

Referenced by newElement, and resetFromOwner.

void NL3D::CPSRibbonBase::resize uint32    size [protected, virtual]
 

inherited from CPSLocatedBindable.

Implements NL3D::CPSParticle.

Reimplemented in NL3D::CPSRibbon.

Definition at line 506 of file ps_ribbon_base.cpp.

References _NbSegs, _Ribbons, NL3D::EndRibbonStorage, nlassert, and resetFromOwner.

Referenced by motionTypeChanged, and setTailNbSeg.

void NL3D::CPSRibbonBase::serial NLMISC::IStream   f throw (NLMISC::EStream) [virtual]
 

serialisation. Derivers must override this, and call their parent version.

Reimplemented from NL3D::CPSParticle.

Reimplemented in NL3D::CPSRibbon.

Definition at line 564 of file ps_ribbon_base.cpp.

void NL3D::CPSRibbonBase::setInterpolationMode TInterpolationMode    mode
 

Definition at line 111 of file ps_ribbon_base.cpp.

References _InterpolationMode, InterpModeLast, and nlassert.

Referenced by NL3D::CPSRibbon::CPSRibbon, and NL3D::CPSTailDot::CPSTailDot.

void NL3D::CPSRibbonBase::setLODDegradation float    percent [inline]
 

Allow degradation of ribbons with distance of the system (may not be suited when theit paths have wicked angles).

Parameters:
percent  1 mean no degradation, 0 mean nothing will be draw when the system is at its max dist. 1 is the default

Definition at line 89 of file ps_ribbon_base.h.

References _LODDegradation, and nlassert.

void NL3D::CPSRibbonBase::setRibbonLength float    length
 

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 _NbSegs, _RibbonLength, _SegLength, and nlassert.

void NL3D::CPSRibbonBase::setRibbonMode TRibbonMode    mode
 

NB : a fixed size isn't applied with parametric motion.

Definition at line 103 of file ps_ribbon_base.cpp.

References _RibbonMode, nlassert, and RibbonModeLast.

void NL3D::CPSRibbonBase::setSegDuration TAnimationTime    ellapsedTime
 

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 _SegDuration, and NL3D::TAnimationTime.

Referenced by NL3D::CPSRibbon::CPSRibbon, and NL3D::CPSTailDot::CPSTailDot.

void NL3D::CPSRibbonBase::setTailNbSeg uint32    nbSegs [virtual]
 

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 _NbSegs, NL3D::CPSLocatedBindable::_Owner, _RibbonIndex, initDateVect, nlassert, and resize.

void NL3D::CPSRibbonBase::updateGlobals   [protected]
 

Called each time the time of the system change in order to update the ribbons positions.

Definition at line 139 of file ps_ribbon_base.cpp.

References _LastUpdateDate, _NbSegs, NL3D::CPSLocatedBindable::_Owner, _Parametric, _RibbonIndex, _Ribbons, _SamplingDate, _SegDuration, NL3D::EndRibbonStorage, nlassert, and NL3D::TAnimationTime.

Referenced by NL3D::CPSTailDot::step, NL3D::CPSRibbonLookAt::step, and NL3D::CPSRibbon::step.

void NL3D::CPSRibbonBase::updateLOD   [protected]
 

must be called for the lod to apply (updates UsedNbSegs).

Definition at line 598 of file ps_ribbon_base.cpp.

References _LODDegradation, _NbSegs, NL3D::CPSLocatedBindable::_Owner, _SegDuration, _SegLength, _UsedNbSegs, _UsedSegDuration, _UsedSegLength, NLMISC::clamp, and nlassert.


Member Data Documentation

TInterpolationMode NL3D::CPSRibbonBase::_InterpolationMode [private]
 

Definition at line 140 of file ps_ribbon_base.h.

Referenced by getInterpolationMode, and setInterpolationMode.

TAnimationTime NL3D::CPSRibbonBase::_LastUpdateDate [private]
 

Definition at line 138 of file ps_ribbon_base.h.

Referenced by updateGlobals.

float NL3D::CPSRibbonBase::_LODDegradation [private]
 

Definition at line 143 of file ps_ribbon_base.h.

Referenced by getLODDegradation, setLODDegradation, and updateLOD.

uint32 NL3D::CPSRibbonBase::_NbSegs [protected]
 

Definition at line 97 of file ps_ribbon_base.h.

Referenced by computeHermitteCstSizeRibbon, computeHermitteRibbon, computeLinearCstSizeRibbon, computeLinearRibbon, dupRibbon, NL3D::CPSTailDot::getMaxNumFaces, NL3D::CPSRibbonLookAt::getMaxNumFaces, NL3D::CPSRibbon::getMaxNumFaces, getTailNbSeg, initDateVect, resetSingleRibbon, resize, setRibbonLength, setTailNbSeg, updateGlobals, and updateLOD.

bool NL3D::CPSRibbonBase::_Parametric [protected]
 

Definition at line 99 of file ps_ribbon_base.h.

Referenced by computeHermitteCstSizeRibbon, computeHermitteRibbon, computeLinearCstSizeRibbon, computeLinearRibbon, NL3D::CPSRibbonLookAt::displayRibbons, dupRibbon, motionTypeChanged, resetFromOwner, resetSingleRibbon, NL3D::CPSTailDot::step, NL3D::CPSRibbonLookAt::step, NL3D::CPSRibbon::step, and updateGlobals.

uint NL3D::CPSRibbonBase::_RibbonIndex [private]
 

Definition at line 137 of file ps_ribbon_base.h.

Referenced by computeHermitteCstSizeRibbon, computeHermitteRibbon, computeLinearCstSizeRibbon, computeLinearRibbon, setTailNbSeg, and updateGlobals.

float NL3D::CPSRibbonBase::_RibbonLength [private]
 

Definition at line 141 of file ps_ribbon_base.h.

Referenced by getRibbonLength, and setRibbonLength.

TRibbonMode NL3D::CPSRibbonBase::_RibbonMode [private]
 

Definition at line 139 of file ps_ribbon_base.h.

Referenced by computeRibbon, getRibbonMode, and setRibbonMode.

TPosVect NL3D::CPSRibbonBase::_Ribbons [private]
 

Definition at line 135 of file ps_ribbon_base.h.

Referenced by computeHermitteCstSizeRibbon, computeHermitteRibbon, computeLinearCstSizeRibbon, computeLinearRibbon, dupRibbon, motionTypeChanged, resetSingleRibbon, resize, and updateGlobals.

TFloatVect NL3D::CPSRibbonBase::_SamplingDate [private]
 

Definition at line 136 of file ps_ribbon_base.h.

Referenced by computeHermitteRibbon, computeLinearRibbon, initDateVect, and updateGlobals.

TAnimationTime NL3D::CPSRibbonBase::_SegDuration [protected]
 

Definition at line 98 of file ps_ribbon_base.h.

Referenced by getSegDuration, setSegDuration, updateGlobals, and updateLOD.

float NL3D::CPSRibbonBase::_SegLength [private]
 

Definition at line 142 of file ps_ribbon_base.h.

Referenced by setRibbonLength, and updateLOD.

uint32 NL3D::CPSRibbonBase::_UsedNbSegs [protected]
 

value to use after lod computation.

Definition at line 127 of file ps_ribbon_base.h.

Referenced by computeHermitteCstSizeRibbon, computeHermitteRibbon, computeLinearCstSizeRibbon, NL3D::CPSTailDot::displayRibbons, NL3D::CPSRibbonLookAt::displayRibbons, NL3D::CPSRibbon::displayRibbons, NL3D::CPSTailDot::getNumRibbonsInVB, NL3D::CPSRibbonLookAt::getNumRibbonsInVB, NL3D::CPSRibbon::getNumRibbonsInVB, NL3D::CPSTailDot::getVBnPB, NL3D::CPSRibbonLookAt::getVBnPB, NL3D::CPSRibbon::getVBnPB, and updateLOD.

TAnimationTime NL3D::CPSRibbonBase::_UsedSegDuration [protected]
 

Definition at line 128 of file ps_ribbon_base.h.

Referenced by computeHermitteRibbon, computeLinearRibbon, NL3D::CPSTailDot::displayRibbons, NL3D::CPSRibbonLookAt::displayRibbons, NL3D::CPSRibbon::displayRibbons, and updateLOD.

float NL3D::CPSRibbonBase::_UsedSegLength [protected]
 

Definition at line 129 of file ps_ribbon_base.h.

Referenced by computeHermitteCstSizeRibbon, computeLinearCstSizeRibbon, and updateLOD.


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