NL3D::ITransformable Class Reference

#include <transformable.h>

Inheritance diagram for NL3D::ITransformable:

NL3D::IAnimatable NL3D::CBone NL3D::CTransform NL3D::CCamera NL3D::CCluster NL3D::CLandscapeModel NL3D::CPointLightModel NL3D::CQuadGridClipManager NL3D::CRootModel NL3D::CTransformShape NL3D::CVegetableBlendLayerModel

Detailed Description

Something which can be transformed in 3D space / animated. By default Transformmode is RotQuat.
Author:
Lionel Berenguier

Nevrax France

Date:
2001

Definition at line 54 of file transformable.h.

Herited from IAnimatable

enum  TAnimValues {
  OwnerBit = IAnimatable::AnimValueLast, PosValue, RotEulerValue, RotQuatValue,
  ScaleValue, PivotValue, AnimValueLast
}
 Added values. More...

virtual ITrackgetDefaultTrack (uint valueId)=0
 From IAnimatable. Deriver must implement this.

virtual IAnimatedValuegetValue (uint valueId)
 From IAnimatable.

virtual const char * getValueName (uint valueId) const
 From IAnimatable.

virtual void registerToChannelMixer (CChannelMixer *chanMixer, const std::string &prefix)=0
 From IAnimatable. Deriver must implement this (channels may be detail-ed or not).


Public Types

enum  TTransformMode { DirectMatrix = 0, RotEuler, RotQuat, TransformModeCount }

Public Member Functions

bool compareMatrixDate (uint64 callerDate) const
const CMatrixgetMatrix () const
 Get the matrix, compute her if necessary (work in all modes).

uint64 getMatrixDate () const
 ITransformable ()
 Constructor. By default, RotQuat mode.

virtual ~ITransformable ()

Static Public Member Functions

const char * getPivotValueName ()
const char * getPosValueName ()
const char * getRotEulerValueName ()
const char * getRotQuatValueName ()
const char * getScaleValueName ()

Protected Member Functions

sint addValue (CChannelMixer *chanMixer, uint valueId, uint ownerValueId, const std::string &prefix, bool detail)
void clearFlag (uint valueId)
 This method clear a bit in the bitset.

void setFlag (uint valueId)
 This method set a bit in the bitset.


Private Member Functions

void clearTransformFlags () const
bool needCompute () const
 Tells if the matrix needs to be computed, ie, if data are modified.

void updateMatrix () const

Private Attributes

CMatrix _LocalMatrix
uint64 _LocalMatrixDate
TTransformMode _Mode
CAnimatedValueVector _Pivot
CAnimatedValueVector _Pos
CAnimatedValueVector _RotEuler
CMatrix::TRotOrder _RotOrder
CAnimatedValueQuat _RotQuat
CAnimatedValueVector _Scale


Member Enumeration Documentation

enum NL3D::ITransformable::TAnimValues
 

Added values.

Enumeration values:
OwnerBit 
PosValue 
RotEulerValue 
RotQuatValue 
ScaleValue 
PivotValue 
AnimValueLast 

Reimplemented from NL3D::IAnimatable.

Reimplemented in NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, and NL3D::CSkeletonModel.

Definition at line 280 of file transformable.h.

00281         {
00282                 OwnerBit= IAnimatable::AnimValueLast,
00283                 PosValue,
00284                 RotEulerValue,
00285                 RotQuatValue,
00286                 ScaleValue,
00287                 PivotValue,
00288                 AnimValueLast
00289         };

enum NL3D::ITransformable::TTransformMode
 

Enumeration values:
DirectMatrix 
RotEuler 
RotQuat 
TransformModeCount 

Definition at line 58 of file transformable.h.

Referenced by getTransformMode().

00059         {
00060                 DirectMatrix=0,         // DirectMatrixMode.
00061                 RotEuler,                       // Matrix is computed from sperated composantes, with euler rotation.
00062                 RotQuat,                        // Matrix is computed from sperated composantes, with quat rotation (default).
00063 
00064                 TransformModeCount
00065         };


Constructor & Destructor Documentation

NL3D::ITransformable::ITransformable  ) 
 

Constructor. By default, RotQuat mode.

Definition at line 37 of file transformable.cpp.

References _LocalMatrixDate, _Pivot, _RotEuler, _RotQuat, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

00038 {
00039         // Set number of animated values.
00040         IAnimatable::resize (AnimValueLast);
00041 
00042         // Deriver note: just copy this line in each ctor.
00043 
00044         // Init default values.
00045         _Mode= RotQuat;
00046         // matrix init to identity.
00047         _Pos.Value= CVector::Null;
00048         _RotEuler.Value= CVector::Null;
00049         _RotQuat.Value= CQuat::Identity;
00050         _Scale.Value= CVector(1,1,1);
00051         _Pivot.Value= CVector::Null;
00052 
00053         _LocalMatrixDate= 0;
00054 }

virtual NL3D::ITransformable::~ITransformable  )  [inline, virtual]
 

Definition at line 72 of file transformable.h.

00072 {}


Member Function Documentation

sint NL3D::IAnimatable::addValue CChannelMixer chanMixer,
uint  valueId,
uint  ownerValueId,
const std::string &  prefix,
bool  detail
[protected, inherited]
 

This is a tool function which add a given value to a channel.

Returns:
-1 if the track was not found in the animationSet, else it return the channelId as if returned by CAnimationSet::getChannelIdByName(channelName).

Definition at line 37 of file animatable.cpp.

References NL3D::CChannelMixer::addChannel(), NL3D::IAnimatable::getDefaultTrack(), NL3D::IAnimatable::getValue(), NL3D::IAnimatable::getValueName(), nlassert, sint, and uint.

Referenced by NL3D::CTransform::registerToChannelMixer(), NL3D::CParticleSystemModel::registerToChannelMixer(), NL3D::CCamera::registerToChannelMixer(), NL3D::CBone::registerToChannelMixer(), NL3D::CAnimatedMorph::registerToChannelMixer(), NL3D::CAnimatedMaterial::registerToChannelMixer(), and NL3D::CAnimatedLightmap::registerToChannelMixer().

00038 {
00039         nlassert(chanMixer);
00040         return chanMixer->addChannel(prefix+getValueName(valueId), this, getValue(valueId), getDefaultTrack(valueId), valueId, ownerValueId, detail);
00041 }

void NL3D::IAnimatable::clearFlag uint  valueId  )  [inline, protected, inherited]
 

This method clear a bit in the bitset.

Definition at line 233 of file animatable.h.

References NL3D::IAnimatable::_BitSet, and uint.

Referenced by clearTransformFlags(), NL3D::CParticleSystemModel::doAnimate(), and NL3D::CAnimatedMaterial::update().

00234         {
00235                 _BitSet&= ~(1<<valueId);
00236         }

void NL3D::ITransformable::clearTransformFlags  )  const [private]
 

Definition at line 124 of file transformable.cpp.

References NL3D::IAnimatable::clearFlag(), PivotValue, PosValue, RotEulerValue, RotQuatValue, and ScaleValue.

Referenced by updateMatrix().

00125 {
00126         ITransformable  *self= const_cast<ITransformable*>(this);
00127 
00128         // clear my falgs.
00129         self->clearFlag(PosValue);
00130         self->clearFlag(RotEulerValue); 
00131         self->clearFlag(RotQuatValue); 
00132         self->clearFlag(ScaleValue);
00133         self->clearFlag(PivotValue);
00134 
00135         // We are OK!
00136         self->clearFlag(OwnerBit);
00137 }

bool NL3D::ITransformable::compareMatrixDate uint64  callerDate  )  const [inline]
 

Tells if the LocalMatrix is newer than what caller except. This return true either if the matrix components (pos/rot etc...) are touched, or if matrix is newer than caller date.

Definition at line 82 of file transformable.h.

References _LocalMatrixDate, needCompute(), and uint64.

Referenced by NL3D::CWaterModel::updateDiffuseMapMatrix().

00083         {
00084                 return callerDate<_LocalMatrixDate || needCompute();
00085         }

virtual ITrack* NL3D::ITransformable::getDefaultTrack uint  valueId  )  [pure virtual]
 

From IAnimatable. Deriver must implement this.

Implements NL3D::IAnimatable.

Implemented in NL3D::CBone, NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, NL3D::CTransform, NL3D::CWaterModel, and NL3D::CWaveMakerModel.

const CMatrix& NL3D::ITransformable::getMatrix  )  const [inline]
 

Get the matrix, compute her if necessary (work in all modes).

Definition at line 76 of file transformable.h.

References updateMatrix().

Referenced by NL3D::CInstanceGroup::addToSceneWhenAllShapesLoaded(), NL3D::CCamera::buildCameraPyramid(), NL3D::CBone::compute(), NL3D::CWaterShape::createInstance(), NL3D::CWaterModel::getAttenuatedHeight(), NL3D::CTransformableUser::getMatrix(), NL3D::CCloudScape::render(), NL3D::CMeshMultiLod::renderCoarseMesh(), and NL3D::CTransform::update().

00076 {updateMatrix(); return _LocalMatrix;}

uint64 NL3D::ITransformable::getMatrixDate  )  const [inline]
 

return the last date of computed matrix. updateMatrix() if necessary.

Definition at line 90 of file transformable.h.

References _LocalMatrixDate, uint64, and updateMatrix().

Referenced by NL3D::CWaterModel::updateDiffuseMapMatrix().

00091         {
00092                 updateMatrix();
00093                 return _LocalMatrixDate;
00094         }

CVector NL3D::ITransformable::getPivot  )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 255 of file transformable.h.

References _Pivot, nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

00256         {
00257                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00258                 return _Pivot.Value;
00259         }

void NL3D::ITransformable::getPivot CVector pivot  )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 224 of file transformable.h.

References _Pivot, nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CTransformableUser::getPivot().

00225         {
00226                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00227                 pivot= _Pivot.Value;
00228         }

const char * NL3D::ITransformable::getPivotValueName  )  [static]
 

Definition at line 117 of file transformable.cpp.

Referenced by getValueName().

00118 {
00119         return "pivot";
00120 }

CVector NL3D::ITransformable::getPos void   )  [inline]
 

Work only in Rot* mode(nlassert).

Definition at line 231 of file transformable.h.

References nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CSkeletonModel::generateShadowMap(), NL3D::CWaterModel::getHeight(), NL3D::CSkeletonModel::renderIntoSkeletonShadowMap(), NL3D::CMeshInstance::renderIntoSkeletonShadowMap(), and NL3D::CPointLightModel::traverseLight().

00232         {
00233                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00234                 return _Pos.Value;
00235         }

void NL3D::ITransformable::getPos CVector pos  )  [inline]
 

Work only in Rot* mode(nlassert).

Definition at line 200 of file transformable.h.

References nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CTransformableUser::getPos(), NL3D::CInstanceGroup::getPos(), and NL3D::CPSLight::step().

00201         {
00202                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00203                 pos= _Pos.Value;
00204         }

const char * NL3D::ITransformable::getPosValueName  )  [static]
 

Definition at line 97 of file transformable.cpp.

Referenced by getValueName().

00098 {
00099         return "pos";
00100 }

CVector NL3D::ITransformable::getRotEuler  )  [inline]
 

Work only in RotEuler mode(nlassert).

Definition at line 237 of file transformable.h.

References _RotEuler, nlassert, RotEuler, and NL3D::CAnimatedValueBlendable< T >::Value.

00238         {
00239                 nlassert(_Mode==RotEuler);
00240                 return _RotEuler.Value;
00241         }

void NL3D::ITransformable::getRotEuler CVector rot  )  [inline]
 

Work only in RotEuler mode(nlassert).

Definition at line 206 of file transformable.h.

References _RotEuler, nlassert, RotEuler, and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CTransformableUser::getRotEuler().

00207         {
00208                 nlassert(_Mode==RotEuler);
00209                 rot= _RotEuler.Value;
00210         }

const char * NL3D::ITransformable::getRotEulerValueName  )  [static]
 

Definition at line 102 of file transformable.cpp.

Referenced by getValueName().

00103 {
00104         return "roteuler";
00105 }

CMatrix::TRotOrder NL3D::ITransformable::getRotOrder  )  [inline]
 

get the current rotorder (information vlaid only when RotEuler mode).

Definition at line 194 of file transformable.h.

References _RotOrder.

Referenced by NL3D::CTransformableUser::getRotOrder().

00195         {
00196                 return _RotOrder;
00197         }

CQuat NL3D::ITransformable::getRotQuat  )  [inline]
 

Work only in RotQuat mode (nlassert).

Definition at line 243 of file transformable.h.

References _RotQuat, nlassert, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

00244         {
00245                 nlassert(_Mode==RotQuat);
00246                 return _RotQuat.Value;
00247         }

void NL3D::ITransformable::getRotQuat CQuat quat  )  [inline]
 

Work only in RotQuat mode (nlassert).

Definition at line 212 of file transformable.h.

References _RotQuat, nlassert, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CTransformableUser::getRotQuat(), and NL3D::CInstanceGroup::getRotQuat().

00213         {
00214                 nlassert(_Mode==RotQuat);
00215                 quat= _RotQuat.Value;
00216         }

const char * NL3D::ITransformable::getRotQuatValueName  )  [static]
 

Definition at line 107 of file transformable.cpp.

Referenced by getValueName().

00108 {
00109         return "rotquat";
00110 }

CVector NL3D::ITransformable::getScale void   )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 249 of file transformable.h.

References nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

00250         {
00251                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00252                 return _Scale.Value;
00253         }

void NL3D::ITransformable::getScale CVector scale  )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 218 of file transformable.h.

References nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CBone::compute(), and NL3D::CTransformableUser::getScale().

00219         {
00220                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00221                 scale= _Scale.Value;
00222         }

const char * NL3D::ITransformable::getScaleValueName  )  [static]
 

Definition at line 112 of file transformable.cpp.

Referenced by getValueName().

00113 {
00114         return "scale";
00115 }

TTransformMode NL3D::ITransformable::getTransformMode  )  [inline]
 

get the current transform mode.

Definition at line 189 of file transformable.h.

References TTransformMode.

Referenced by NL3D::CTargetAnimCtrl::execute(), and NL3D::CTransformableUser::getTransformMode().

00190         {
00191                 return _Mode;
00192         }

IAnimatedValue * NL3D::ITransformable::getValue uint  valueId  )  [virtual]
 

From IAnimatable.

Implements NL3D::IAnimatable.

Reimplemented in NL3D::CCamera, and NL3D::CParticleSystemModel.

Definition at line 58 of file transformable.cpp.

References _Pivot, _RotEuler, _RotQuat, nlstop, PivotValue, PosValue, RotEulerValue, RotQuatValue, ScaleValue, and uint.

00059 {
00060         // what value ?
00061         switch (valueId)
00062         {
00063         case PosValue:                  return &_Pos;
00064         case RotEulerValue:             return &_RotEuler;
00065         case RotQuatValue:              return &_RotQuat;
00066         case ScaleValue:                return &_Scale;
00067         case PivotValue:                return &_Pivot;
00068         }
00069 
00070         // No, only ITrnasformable values!
00071         nlstop;
00072         // Deriver note: else call BaseClass::getValue(valueId);
00073 
00074         return NULL;
00075 }

const char * NL3D::ITransformable::getValueName uint  valueId  )  const [virtual]
 

From IAnimatable.

Implements NL3D::IAnimatable.

Reimplemented in NL3D::CCamera, and NL3D::CParticleSystemModel.

Definition at line 77 of file transformable.cpp.

References getPivotValueName(), getPosValueName(), getRotEulerValueName(), getRotQuatValueName(), getScaleValueName(), nlstop, PivotValue, PosValue, RotEulerValue, RotQuatValue, ScaleValue, and uint.

00078 {
00079         // what value ?
00080         switch (valueId)
00081         {
00082         case PosValue:                  return getPosValueName ();
00083         case RotEulerValue:             return getRotEulerValueName();
00084         case RotQuatValue:              return getRotQuatValueName();
00085         case ScaleValue:                return getScaleValueName();
00086         case PivotValue:                return getPivotValueName();
00087         }
00088 
00089         // No, only ITrnasformable values!
00090         nlstop;
00091         // Deriver note: else call BaseClass::getValueName(valueId);
00092 
00093         return "";
00094 }

uint32 NL3D::IAnimatable::isTouched uint  valueId  )  const [inline, inherited]
 

Return non 0 int if the value as been touched else 0.

Parameters:
valueId is the animated value ID in the object we want to test the touch flag. or it may be an OwnerBit.

Definition at line 184 of file animatable.h.

References NL3D::IAnimatable::_BitSet, uint, and uint32.

Referenced by NL3D::CParticleSystemModel::doAnimate(), needCompute(), NL3D::IAnimatable::propagateTouch(), and NL3D::CAnimatedMaterial::update().

00185         {
00186                 return _BitSet&(1<<valueId);
00187         }

void NL3D::ITransformable::lookAt const CVector eye,
const CVector target,
float  roll = 0.f
 

Setup Matrix by the lookAt method. Work only in DirectMatrix mode and RotQuat mode (not euler...).

Parameters:
eye is the coordinate of the object.
target is the point the object look at.
roll is the roll angle in radian along the object's Y axis.

Definition at line 169 of file transformable.cpp.

References DirectMatrix, NLMISC::CMatrix::getPos(), NLMISC::CMatrix::getRot(), NLMISC::CMatrix::identity(), nlassert, NLMISC::CVector::normalize(), NLMISC::CMatrix::rotateY(), RotQuat, setMatrix(), setPivot(), setPos(), NLMISC::CMatrix::setPos(), NLMISC::CMatrix::setRot(), setRotQuat(), and setScale().

Referenced by NL3D::CTransformableUser::lookAt(), and NL3D::CCamera::update().

00170 {
00171         nlassert(_Mode==RotQuat || _Mode==DirectMatrix);
00172 
00173         // Roll matrix
00174         CMatrix rollMT;
00175         rollMT.identity();
00176         if (roll!=0.f)
00177                 rollMT.rotateY (roll);
00178 
00179         // Make the target base
00180         CVector j=target;
00181         j-=eye;
00182         j.normalize();
00183         CVector i=j^CVector (0,0,1.f);
00184         CVector k=i^j;
00185         k.normalize();
00186         i=j^k;
00187         i.normalize();
00188 
00189         // Make the target matrix
00190         CMatrix targetMT;
00191         targetMT.identity();
00192         targetMT.setRot (i, j, k);
00193         targetMT.setPos (eye);
00194 
00195         // Compose matrix
00196         targetMT*=rollMT;
00197 
00198         // Set the matrix
00199         if(_Mode==DirectMatrix)
00200                 setMatrix (targetMT);
00201         else
00202         {
00203                 // transfrom to quaternion mode.
00204                 setScale(CVector(1,1,1));
00205                 setPivot(CVector::Null);
00206                 setPos(targetMT.getPos());
00207                 setRotQuat(targetMT.getRot());
00208         }
00209 }

bool NL3D::ITransformable::needCompute  )  const [inline, private]
 

Tells if the matrix needs to be computed, ie, if data are modified.

Definition at line 334 of file transformable.h.

References DirectMatrix, and NL3D::IAnimatable::isTouched().

Referenced by compareMatrixDate(), and updateMatrix().

00335         {
00336                 return  _Mode!=DirectMatrix && isTouched(OwnerBit);
00337         }

virtual void NL3D::ITransformable::registerToChannelMixer CChannelMixer chanMixer,
const std::string &  prefix
[pure virtual]
 

From IAnimatable. Deriver must implement this (channels may be detail-ed or not).

Implements NL3D::IAnimatable.

Implemented in NL3D::CBone, NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, NL3D::CSkeletonModel, and NL3D::CTransform.

void NL3D::IAnimatable::resize uint  count  )  [inline, inherited]
 

Change value count, bit are set to 0

Parameters:
count is the new value count.

Definition at line 195 of file animatable.h.

References count, nlassert, and uint.

00196         {
00197                 // with the "uint32 _BitSet" implementation, juste check the size is correct
00198                 nlassert(count<=32);
00199         }

void NL3D::IAnimatable::setFather IAnimatable father,
uint  fatherOwnerBit
[inline, inherited]
 

Say which (if any) IAnimatable owns this one. This is important for Touch propagation. By this system, Fathers and ancestors know if they must check their sons (isTouched() return true).

Parameters:
father the father we must inform of our update.
fatherOwnerBit What bit of father we must set when we are updated

Definition at line 153 of file animatable.h.

References NL3D::IAnimatable::_Father, NL3D::IAnimatable::_FatherOwnerBit, NL3D::IAnimatable::propagateTouch(), and uint.

Referenced by NL3D::CMeshBase::instanciateMeshBase(), and NL3D::CSegRemanence::setAnimatedMaterial().

00154         {
00155                 _Father= father; _FatherOwnerBit= fatherOwnerBit;
00156 
00157                 // propagate the touch to the fathers.
00158                 propagateTouch();
00159         }

void NL3D::IAnimatable::setFlag uint  valueId  )  [inline, protected, inherited]
 

This method set a bit in the bitset.

Definition at line 239 of file animatable.h.

References NL3D::IAnimatable::_BitSet, and uint.

Referenced by NL3D::IAnimatable::propagateTouch(), and NL3D::IAnimatable::touch().

00240         {
00241                 _BitSet|= (1<<valueId);
00242         }

void NL3D::ITransformable::setMatrix const CMatrix mat  )  [inline]
 

Work only in DirecTMatrix mode (nlassert).

Definition at line 174 of file transformable.h.

References _LocalMatrixDate, DirectMatrix, and nlassert.

Referenced by lookAt(), and NL3D::CTransformableUser::setMatrix().

00175         {
00176                 nlassert(_Mode==DirectMatrix);
00177                 _LocalMatrix= mat;
00178                 // The matrix has changed.
00179                 _LocalMatrixDate++;
00180         }

void NL3D::ITransformable::setPivot float  x,
float  y,
float  z
[inline]
 

Work only in Rot* mode (nlassert).

Definition at line 169 of file transformable.h.

References setPivot(), x, y, and z.

00170         {
00171                 setPivot(CVector(x, y, z));
00172         }

void NL3D::ITransformable::setPivot const CVector pivot  )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 162 of file transformable.h.

References _Pivot, nlassert, PivotValue, RotEuler, RotQuat, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by lookAt(), NL3D::CTransformableUser::setPivot(), and setPivot().

00163         {
00164                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00165                 _Pivot.Value= pivot;
00166                 touch(PivotValue, OwnerBit);
00167         }

void NL3D::ITransformable::setPos float  x,
float  y,
float  z
[inline]
 

Work only in Rot* mode(nlassert).

Definition at line 121 of file transformable.h.

References setPos(), x, y, and z.

00122         {
00123                 setPos(CVector(x,y,z));
00124         }

void NL3D::ITransformable::setPos const CVector pos  )  [inline]
 

Work only in Rot* mode(nlassert).

Definition at line 114 of file transformable.h.

References nlassert, PosValue, RotEuler, RotQuat, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CCamera::build(), lookAt(), NL3D::CTransformableUser::setPos(), setPos(), NL3D::CInstanceGroup::setPos(), and NL3D::CPSLight::step().

00115         {
00116                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00117                 _Pos.Value= pos;
00118                 touch(PosValue, OwnerBit);
00119         }

void NL3D::ITransformable::setRotEuler float  rotX,
float  rotY,
float  rotZ
[inline]
 

Work only in RotEuler mode(nlassert).

Definition at line 133 of file transformable.h.

References setRotEuler().

00134         {
00135                 setRotEuler(CVector(rotX, rotY, rotZ));
00136         }

void NL3D::ITransformable::setRotEuler const CVector rot  )  [inline]
 

Work only in RotEuler mode(nlassert).

Definition at line 126 of file transformable.h.

References _RotEuler, nlassert, RotEuler, RotEulerValue, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CTransformableUser::setRotEuler(), and setRotEuler().

00127         {
00128                 nlassert(_Mode==RotEuler);
00129                 _RotEuler.Value= rot;
00130                 touch(RotEulerValue, OwnerBit);
00131         }

void NL3D::ITransformable::setRotQuat const CQuat quat  )  [inline]
 

Work only in RotQuat mode (nlassert).

Definition at line 138 of file transformable.h.

References _RotQuat, nlassert, RotQuat, RotQuatValue, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by NL3D::CTargetAnimCtrl::execute(), lookAt(), NL3D::CTransformableUser::setRotQuat(), and NL3D::CInstanceGroup::setRotQuat().

00139         {
00140                 nlassert(_Mode==RotQuat);
00141                 _RotQuat.Value= quat;
00142                 touch(RotQuatValue, OwnerBit);
00143         }

void NL3D::ITransformable::setScale float  scale  )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 157 of file transformable.h.

References setScale().

00158         {
00159                 setScale(CVector(scale, scale, scale));
00160         }

void NL3D::ITransformable::setScale float  scaleX,
float  scaleY,
float  scaleZ
[inline]
 

Work only in Rot* mode (nlassert).

Definition at line 152 of file transformable.h.

References setScale().

00153         {
00154                 setScale(CVector(scaleX, scaleY, scaleZ));
00155         }

void NL3D::ITransformable::setScale const CVector scale  )  [inline]
 

Work only in Rot* mode (nlassert).

Definition at line 145 of file transformable.h.

References nlassert, RotEuler, RotQuat, ScaleValue, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by lookAt(), NL3D::CTransformableUser::setScale(), and setScale().

00146         {
00147                 nlassert(_Mode==RotEuler || _Mode==RotQuat);
00148                 _Scale.Value= scale;
00149                 touch(ScaleValue, OwnerBit);
00150         }

void NL3D::ITransformable::setTransformMode TTransformMode  mode,
CMatrix::TRotOrder  ro = CMatrix::ZXY
[inline]
 

Change the transform mode. Components or matrix are not reseted.

Definition at line 100 of file transformable.h.

References _RotOrder, PosValue, and NL3D::IAnimatable::touch().

Referenced by NL3D::CCamera::build(), NL3D::CCamera::enableTargetAnimation(), NL3D::CPSMesh::newElement(), NL3D::CTransformableUser::setTransformMode(), and NL3D::CPSMesh::updatePos().

00101         {
00102                 _Mode= mode;
00103                 _RotOrder= ro;
00104                 // just for information.
00105                 touch(PosValue, OwnerBit);
00106         }

void NL3D::IAnimatable::touch uint  valueId,
uint  ownerValueId
[inline, inherited]
 

Touch a value because it has been modified.

Parameters:
valueId is the animated value ID in the object we want to touch.
ownerValueId is the bit of the IAnimatable part which owns this animated value.

Definition at line 168 of file animatable.h.

References NL3D::IAnimatable::propagateTouch(), NL3D::IAnimatable::setFlag(), and uint.

Referenced by NL3D::CChannelMixer::eval(), NL3D::CChannelMixer::evalSingleChannel(), NL3D::CParticleSystemModel::reallocRsc(), NL3D::CChannelMixer::refreshList(), NL3D::CCamera::setFov(), setPivot(), setPos(), NL3D::CCamera::setRoll(), setRotEuler(), setRotQuat(), setScale(), NL3D::CCamera::setTargetPos(), setTransformMode(), and NL3D::CParticleSystemInstanceUser::setUserParam().

00169         {
00170                 // Set the bit
00171                 setFlag(valueId);
00172                 // Set the owner bit
00173                 setFlag(ownerValueId);
00174 
00175                 // propagate the touch to the fathers.
00176                 propagateTouch();
00177         }

void NL3D::ITransformable::updateMatrix  )  const [private]
 

Definition at line 141 of file transformable.cpp.

References _LocalMatrixDate, _Pivot, _RotEuler, _RotOrder, _RotQuat, clearTransformFlags(), NLMISC::CMatrix::identity(), needCompute(), NLMISC::CMatrix::rotate(), RotEuler, NLMISC::CMatrix::scale(), NLMISC::CMatrix::translate(), and NL3D::CAnimatedValueBlendable< T >::Value.

Referenced by getMatrix(), and getMatrixDate().

00142 {
00143         // should we update?
00144         if(needCompute())
00145         {
00146                 clearTransformFlags();
00147                 // update scale date (so sons are informed of change).
00148                 _LocalMatrixDate++;
00149 
00150                 // update the matrix.
00151                 _LocalMatrix.identity();
00152 
00153                 // father scale will be herited.
00154                 // T*P
00155                 _LocalMatrix.translate(_Pos.Value+_Pivot.Value);
00156 
00157                 // R*S*P-1.
00158                 if(_Mode==RotEuler)
00159                         _LocalMatrix.rotate(_RotEuler.Value, _RotOrder);
00160                 else
00161                         _LocalMatrix.rotate(_RotQuat.Value);
00162                 _LocalMatrix.scale(_Scale.Value);
00163                 _LocalMatrix.translate(-_Pivot.Value);
00164         }
00165 }


Field Documentation

CMatrix NL3D::ITransformable::_LocalMatrix [mutable, private]
 

Reimplemented in NL3D::CTransform.

Definition at line 315 of file transformable.h.

uint64 NL3D::ITransformable::_LocalMatrixDate [mutable, private]
 

Definition at line 318 of file transformable.h.

Referenced by compareMatrixDate(), getMatrixDate(), ITransformable(), setMatrix(), and updateMatrix().

TTransformMode NL3D::ITransformable::_Mode [private]
 

Definition at line 316 of file transformable.h.

CAnimatedValueVector NL3D::ITransformable::_Pivot [private]
 

Definition at line 325 of file transformable.h.

Referenced by getPivot(), getValue(), ITransformable(), setPivot(), and updateMatrix().

CAnimatedValueVector NL3D::ITransformable::_Pos [private]
 

Definition at line 321 of file transformable.h.

CAnimatedValueVector NL3D::ITransformable::_RotEuler [private]
 

Definition at line 322 of file transformable.h.

Referenced by getRotEuler(), getValue(), ITransformable(), setRotEuler(), and updateMatrix().

CMatrix::TRotOrder NL3D::ITransformable::_RotOrder [private]
 

Definition at line 317 of file transformable.h.

Referenced by getRotOrder(), setTransformMode(), and updateMatrix().

CAnimatedValueQuat NL3D::ITransformable::_RotQuat [private]
 

Definition at line 323 of file transformable.h.

Referenced by getRotQuat(), getValue(), ITransformable(), setRotQuat(), and updateMatrix().

CAnimatedValueVector NL3D::ITransformable::_Scale [private]
 

Definition at line 324 of file transformable.h.


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 08:41:17 2004 for NeL by doxygen 1.3.6