#include <transformable.h>
Inheritance diagram for NL3D::ITransformable:
Nevrax France
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 ITrack * | getDefaultTrack (uint valueId)=0 |
From IAnimatable. Deriver must implement this. | |
virtual IAnimatedValue * | getValue (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 CMatrix & | getMatrix () 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 |
|
Added values.
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 }; |
|
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. 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 } |
|
Definition at line 72 of file transformable.h.
00072 {} |
|
This is a tool function which add a given value to a channel.
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 } |
|
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 } |
|
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 } |
|
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 } |
|
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. |
|
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;} |
|
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 } |
|
Work only in Rot* mode (nlassert).
Definition at line 255 of file transformable.h. References _Pivot, nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.
|
|
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().
|
|
Definition at line 117 of file transformable.cpp. Referenced by getValueName().
00118 { 00119 return "pivot"; 00120 } |
|
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().
|
|
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().
|
|
Definition at line 97 of file transformable.cpp. Referenced by getValueName().
00098 { 00099 return "pos"; 00100 } |
|
Work only in RotEuler mode(nlassert).
Definition at line 237 of file transformable.h. References _RotEuler, nlassert, RotEuler, and NL3D::CAnimatedValueBlendable< T >::Value.
|
|
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().
|
|
Definition at line 102 of file transformable.cpp. Referenced by getValueName().
00103 { 00104 return "roteuler"; 00105 } |
|
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 } |
|
Work only in RotQuat mode (nlassert).
Definition at line 243 of file transformable.h. References _RotQuat, nlassert, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.
|
|
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().
|
|
Definition at line 107 of file transformable.cpp. Referenced by getValueName().
00108 { 00109 return "rotquat"; 00110 } |
|
Work only in Rot* mode (nlassert).
Definition at line 249 of file transformable.h. References nlassert, RotEuler, RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.
|
|
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().
|
|
Definition at line 112 of file transformable.cpp. Referenced by getValueName().
00113 { 00114 return "scale"; 00115 } |
|
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 } |
|
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 } |
|
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 } |
|
Return non 0 int if the value as been touched else 0.
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 }
|
|
Setup Matrix by the lookAt method. Work only in DirectMatrix mode and RotQuat mode (not euler...).
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 } |
|
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 } |
|
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. |
|
Change value count, bit are set to 0
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 } |
|
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).
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 } |
|
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 } |
|
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 } |
|
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 } |
|
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().
|
|
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 } |
|
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().
|
|
Work only in RotEuler mode(nlassert).
Definition at line 133 of file transformable.h. References setRotEuler().
00134 { 00135 setRotEuler(CVector(rotX, rotY, rotZ)); 00136 } |
|
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().
|
|
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().
|
|
Work only in Rot* mode (nlassert).
Definition at line 157 of file transformable.h. References setScale().
00158 { 00159 setScale(CVector(scale, scale, scale)); 00160 } |
|
Work only in Rot* mode (nlassert).
Definition at line 152 of file transformable.h. References setScale().
00153 { 00154 setScale(CVector(scaleX, scaleY, scaleZ)); 00155 } |
|
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().
|
|
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().
|
|
Touch a value because it has been modified.
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 } |
|
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 } |
|
Reimplemented in NL3D::CTransform. Definition at line 315 of file transformable.h. |
|
Definition at line 318 of file transformable.h. Referenced by compareMatrixDate(), getMatrixDate(), ITransformable(), setMatrix(), and updateMatrix(). |
|
Definition at line 316 of file transformable.h. |
|
Definition at line 325 of file transformable.h. Referenced by getPivot(), getValue(), ITransformable(), setPivot(), and updateMatrix(). |
|
Definition at line 321 of file transformable.h. |
|
Definition at line 322 of file transformable.h. Referenced by getRotEuler(), getValue(), ITransformable(), setRotEuler(), and updateMatrix(). |
|
Definition at line 317 of file transformable.h. Referenced by getRotOrder(), setTransformMode(), and updateMatrix(). |
|
Definition at line 323 of file transformable.h. Referenced by getRotQuat(), getValue(), ITransformable(), setRotQuat(), and updateMatrix(). |
|
Definition at line 324 of file transformable.h. |