#include <skeleton_model.h>
Inheritance diagram for NL3D::CSkeletonModel:
Skeletons sons are added with bindSkin(), stickObject(). They are removed auto at dtor.
Nevrax France
Definition at line 84 of file skeleton_model.h.
IAnimatable Interface (registering only IAnimatable sons (bones)). | |
enum | TAnimValues { OwnerBit = CTransformShape::AnimValueLast, AnimValueLast } |
Added values. More... | |
virtual void | registerToChannelMixer (CChannelMixer *chanMixer, const std::string &prefix) |
Skin/BoneUsage Accessor. Called by CMeshInstance only. | |
enum | TBoneUsageType { UsageNormal, UsageForced, UsageCLodForced } |
void | decBoneUsage (uint i, TBoneUsageType boneUsageType) |
decrement the refCount of the ith bone. set forced to the same param passed when incBoneUsage() | |
void | flagBoneAndParents (uint32 boneId, std::vector< bool > &boneUsage) const |
void | incBoneUsage (uint i, TBoneUsageType boneUsageType) |
Skinning Behavior. | |
virtual const std::vector< NLMISC::CBSphere > * | getSkinBoneSphere () const |
virtual const std::vector< sint32 > * | getSkinBoneUsage () const |
virtual bool | isSkinnable () const |
Deriver must change this method if the model can be skinned. called rarely. | |
virtual sint | renderShadowSkinGeom (uint remainingVertices, uint8 *vbDest) |
virtual void | renderShadowSkinPrimitives (CMaterial &castMat, IDriver *drv, uint baseVertex) |
virtual void | renderSkin (float alphaMRM) |
virtual sint | renderSkinGroupGeom (float alphaMRM, uint remainingVertices, uint8 *dest) |
virtual void | renderSkinGroupPrimitives (uint baseVertex, std::vector< CSkinSpecularRdrPass > &specularRdrPasses, uint skinIndex) |
virtual void | renderSkinGroupSpecularRdrPass (uint rdrPass) |
Render a specific specular renderPass returned by renderSkinGroupPrimitives. | |
virtual void | setApplySkin (bool state) |
virtual bool | supportShadowSkinGrouping () const |
Special Skinning For ShadowMapping. | |
virtual bool | supportSkinGrouping () const |
uint | _FatherBoneId |
CSkeletonModel * | _FatherSkeletonModel |
[NOHEADER] | |
uint32 | isNeedUpdateFrozenStaticLightSetup () const |
non-zero if the object has a FrozenStaticLightSetup not correclty updated. | |
uint32 | isNeedUpdateLighting () const |
non-zero if the object needs to updatelighting. | |
CLightContribution | _LightContribution |
The contribution of all lights. This enlarge the struct only of approx 15%. | |
CLightingManager::CQGItLightedModel | _LightedModelIt |
each transform may be in a quadGird of lighted models (see CLightingManager) | |
Hrc Traversal | |
void | updateClipTravForAncestorSkeleton () |
void | updateWorld () |
Update the world state according to the parent world state and the local states. | |
CSkeletonModel * | _AncestorSkeletonModel |
bool | _ClipLinkedInSonsOfAncestorSkeletonModelGroup |
bool | _DontUnfreezeChildren |
bool | _Frozen |
sint64 | _LocalDate |
CMatrix | _LocalMatrix |
Hrc IN variables. | |
CHrcTrav::TVisibility | _LocalVis |
sint64 | _WorldDate |
CMatrix | _WorldMatrix |
Hrc OUT variables. | |
bool | _WorldVis |
CLod / Character Lod | |
void | computeCLodVertexAlpha (CLodCharacterManager *mngr) |
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty | |
void | dirtLodVertexAlpha () |
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty | |
const CLightContribution & | getSkeletonLightContribution () |
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty | |
CLodCharacterInstance | _CLodInstance |
The Lod instance. -1 by default. | |
bool | _CLodVertexAlphaDirty |
bool | _DisplayedAsLodCharacter |
float | _LodCharacterDistance |
see setLodCharacterDistance | |
float | _OOLodCharacterDistance |
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty | |
Bone Usage. | |
void | decForcedBoneUsageAndParents (uint i, bool forceCLod) |
increment the refCount of the ith bone and its parents. for stickObjects. | |
void | incForcedBoneUsageAndParents (uint i, bool forceCLod) |
increment the refCount of the ith bone and its parents. for stickObjects. | |
void | initBoneUsages () |
called by CSkeletonShape::createInstance(). init the vector. | |
void | updateBoneToCompute () |
According to Usage, ForedUsage and current skeleton Lod, update MustCompute and ValidBoneSkinMatrix. | |
std::vector< CBoneCompute > | _BoneToCompute |
List of bones to compute. | |
bool | _BoneToComputeDirty |
Flag set if the MRSkeleton lod change, or if a new bone Usage change (only if was 0 or become 0). | |
std::vector< CBoneUsage > | _BoneUsage |
The list of BoneUsage. Updated by Meshes, stickObject(), and lod changes. | |
uint | _CurLod |
The current lod activated for this skeleton. | |
float | _CurLodInterp |
The current lod Interpolation Value for this skeleton. | |
float | _LodInterpMultiplier |
For lod interpolation. Inverse of distance. If 0, disable interpolation. | |
Public Types | |
enum | { MaxNumBones = 256 } |
max number of bones supported in skeleton More... | |
enum | TTransformMode { DirectMatrix = 0, RotEuler, RotQuat, TransformModeCount } |
Public Member Functions | |
virtual bool | canStartStop () |
Test if there is a start/stop caps in the objects (some fxs such as remanence). | |
bool | compareMatrixDate (uint64 callerDate) const |
void | freeze () |
void | freezeHRC () |
virtual void | getAABBox (NLMISC::CAABBox &bbox) const |
CSkeletonModel * | getAncestorSkeletonModel () const |
bool | getChannelMixerOwnerShip () const |
CInstanceGroup * | getClusterSystem () |
float | getDistMax () const |
bool | getForceClipRoot () const |
CLightContribution & | getLightContribution () |
virtual void | getLightHotSpotInWorld (CVector &modelPos, float &modelRadius) const |
virtual CMaterial * | getMaterial (uint materialId) |
virtual const CMaterial * | getMaterial (uint materialId) const |
const CMatrix & | getMatrix () const |
Get the matrix, compute her if necessary (work in all modes). | |
uint64 | getMatrixDate () const |
virtual uint | getNumMaterial () const |
uint | getOrderingLayer () const |
Get the ordering layer. | |
CScene * | getOwnerScene () const |
get the scene which has created us | |
const sint & | getRefCount () const |
CSkeletonModel * | getSkeletonModel () const |
Get the skeleton model. Returnr NULL in normal mode. | |
bool | getUserClipping () const |
Return the user clipping state. | |
CHrcTrav::TVisibility | getVisibility () |
Get the local visibility state. | |
const CMatrix & | getWorldMatrix () const |
void | heritVisibility () |
herit the visibility from his father. (default behavior). | |
void | hide () |
Hide the object and his sons. | |
bool | isClipVisible () const |
bool | isHrcVisible () const |
bool | isLinkToQuadCluster () const |
true if the model is linked to a quadCluster | |
uint32 | isOpaque () |
uint32 | isQuadGridClipEnabled () const |
virtual bool | isStarted () const |
uint32 | isTransparent () |
void | setChannelMixerOwnerShip (bool enable=true) |
void | setClusterSystem (CInstanceGroup *pCS) |
void | setDistMax (float distMax) |
void | setDontUnfreezeChildren (bool val) |
void | setForceClipRoot (bool forceClipRoot) |
void | setLogicInfo (ILogicInfo *logicInfo) |
void | setOpacity (bool v) |
void | setOrderingLayer (uint layer) |
void | setTransparency (bool v) |
void | setUserClipping (bool enable) |
void | setWorldMatrix (const CMatrix &mat) |
void | show () |
Show the objet and his sons. | |
virtual void | start () |
virtual void | stop () |
void | unfreezeHRC () |
void | updateSkinRenderLists () |
Skin operation. | |
bool | bindSkin (CTransform *mi) |
void | detachSkeletonSon (CTransform *mi) |
void | dirtSkinRenderLists () |
void | stickObject (CTransform *mi, uint boneId) |
void | stickObjectEx (CTransform *mi, uint boneId, bool forceCLod) |
Load balancing methods | |
void | changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest) |
virtual float | getNumTriangles (float distance) |
Special version for skins. | |
void | resetDefaultMRMDistanceSetup () |
Reset the Default MRM setup: follow MAX skin setup (ie the finer). | |
Misc. | |
void | computeAllBones (const CMatrix &modelWorldMatrix) |
bool | computeCurrentBBox (NLMISC::CAABBox &bbox, bool forceCompute=false, bool computeInWorld=false) |
bool | computeRenderedBBox (NLMISC::CAABBox &bbox, bool computeInWorld=false) |
bool | forceComputeBone (uint boneId) |
const NLMISC::CMatrix & | getActiveBoneSkinMatrix (uint boneId) const |
sint32 | getBoneIdByName (const std::string &name) const |
return, from skeleton shape, the BoneIdByName. -1 if not here. | |
float | getInterpolationDistance () const |
see setInterpolationDistance() | |
uint | getNumBoneComputed () const |
return the number of bones currently animated/computed (because of bindSkin()/stickObject() / Lod system). | |
bool | isBoneComputed (uint boneId) const |
Tell if a bone has been computed in the last frame or not. false if boneId is invalid. | |
void | setInterpolationDistance (float dist) |
CLod / Character Lod | |
float | computeDisplayLodCharacterPriority () const |
void | computeLodTexture () |
uint | getLodCharacterAnimId () const |
TGlobalAnimationTime | getLodCharacterAnimTime () const |
float | getLodCharacterDistance () const |
see setLodCharacterDistance. 0 if disabled | |
sint | getLodCharacterShape () const |
see setLodCharacterShape | |
bool | getLodCharacterWrapMode () const |
bool | isDisplayedAsLodCharacter () const |
void | setDisplayLodCharacterFlag (bool displayCLod) |
void | setLodCharacterAnimId (uint animId) |
Change/get the Character Lod anim setup. | |
void | setLodCharacterAnimTime (TGlobalAnimationTime time) |
void | setLodCharacterDistance (float dist) |
void | setLodCharacterShape (sint shapeId) |
Change the Character Lod shape Id. set -1 if want to disable the feature (default). | |
void | setLodCharacterWrapMode (bool wrapMode) |
tells if the animation must loop or clamp. | |
ShadowMap CTransform Implementation | |
virtual bool | computeWorldBBoxForShadow (NLMISC::CAABBox &worldBB) |
virtual void | generateShadowMap (const CVector &lightDir) |
virtual CShadowMap * | getShadowMap () |
virtual void | renderIntoSkeletonShadowMap (CSkeletonModel *rootSkeleton, CMaterial &castMat) |
AnimCtrl (IK...) | |
IAnimCtrl * | getBoneAnimCtrl (uint boneId) const |
void | setBoneAnimCtrl (uint boneId, IAnimCtrl *ctrl) |
CTransform traverse specialisation | |
virtual void | traverseAnimDetail () |
virtual void | traverseRender () |
Static Public Member Functions | |
const char * | getPivotValueName () |
const char * | getPosValueName () |
const char * | getRotEulerValueName () |
const char * | getRotQuatValueName () |
const char * | getScaleValueName () |
void | registerBasic () |
Call at the begining of the program, to register the model. | |
Data Fields | |
std::vector< CBone > | Bones |
sint | crefs |
CPtrInfo * | pinfo |
CSmartPtr< IShape > | Shape |
The shape, the object instancied. | |
Static Public Attributes | |
CPtrInfo | NullPtrInfo |
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. | |
virtual void | createShadowMap () |
CSkeletonModel () | |
Constructor. | |
virtual void | deleteShadowMap () |
To implement for ShadowCaster support. typically free the shadowMap. | |
void | forceCompute () |
CChannelMixer * | getChannelMixer () const |
bool | getShowWhenLODSticked () const |
Test if obj must be displayed when sticked to an object displayed as a LOD (example: sword in hand of a character displayed as a LOD state). | |
virtual void | initModel () |
Build link to traversals. | |
void | setFlag (uint valueId) |
This method set a bit in the bitset. | |
void | setupCurrentLightContribution (CLightContribution *lightContrib, bool useLocalAtt) |
virtual void | unlinkFromQuadCluster () |
special feature for CQuadGridClipManager. remove from it. | |
virtual | ~CSkeletonModel () |
Destructor. | |
Protected Attributes | |
uint32 | _RenderFilterType |
Private Types | |
typedef TTransformSet::iterator | ItTransformSet |
typedef NLMISC::CObjectVector< CTransform *, false > | TTransformArray |
typedef std::set< CTransform * > | TTransformSet |
skins/sticked objects | |
Private Member Functions | |
void | buildDefaultLevelDetail () |
void | renderShadowSkins (CMaterial &castMat) |
void | updateShadowMap (IDriver *driver) |
Rendering | |
void | renderCLod () |
void | renderSkinList (NLMISC::CObjectVector< CTransform *, false > &skinList, float alphaMRM) |
void | renderSkins () |
Static Private Member Functions | |
CTransform * | creator () |
Private Attributes | |
TTransformArray | _AnimDetailSkins |
bool | _DefaultMRMSetup |
std::list< CSkeletonModel * >::iterator | _ItSkeletonInScene |
CMRMLevelDetail | _LevelDetail |
TTransformArray | _OpaqueSkins |
CShadowMap * | _ShadowMap |
TTransformSet | _Skins |
The skins. | |
bool | _SkinToRenderDirty |
TTransformSet | _StickedObjects |
The StickedObjects. | |
TTransformArray | _TransparentSkins |
AnimCtrl (IK...) | |
sint | _AnimCtrlUsage |
Friends | |
struct | CPtrInfo |
class | CSkeletonShape |
|
Definition at line 371 of file skeleton_model.h. Referenced by computeCLodVertexAlpha(), computeLodTexture(), computeWorldBBoxForShadow(), renderIntoSkeletonShadowMap(), and updateSkinRenderLists(). |
|
Definition at line 382 of file skeleton_model.h. |
|
skins/sticked objects
Definition at line 370 of file skeleton_model.h. |
|
max number of bones supported in skeleton
Definition at line 88 of file skeleton_model.h.
00088 { MaxNumBones = 256 }; |
|
Added values.
Reimplemented from NL3D::ITransformable. Definition at line 103 of file skeleton_model.h.
00104 { 00105 OwnerBit= CTransformShape::AnimValueLast, 00106 00107 AnimValueLast, 00108 }; |
|
Definition at line 158 of file skeleton_model.h.
00158 {UsageNormal, UsageForced, UsageCLodForced} TBoneUsageType; |
|
Definition at line 58 of file transformable.h. Referenced by NL3D::ITransformable::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.
Definition at line 75 of file skeleton_model.cpp. References _AnimCtrlUsage, _CLodVertexAlphaDirty, _DefaultMRMSetup, _DisplayedAsLodCharacter, _LodCharacterDistance, _OOLodCharacterDistance, _SkinToRenderDirty, buildDefaultLevelDetail(), NL3D::CTransform::setOpacity(), and NL3D::CTransform::setTransparency().
00076 { 00077 IAnimatable::resize(AnimValueLast); 00078 _DisplayedAsLodCharacter= false; 00079 _LodCharacterDistance= 0; 00080 _OOLodCharacterDistance= 0; 00081 00082 _DefaultMRMSetup= true; 00083 00084 _SkinToRenderDirty= false; 00085 00086 _CLodVertexAlphaDirty= true; 00087 00088 // Inform the transform that I am a skeleton 00089 CTransform::setIsSkeleton(true); 00090 00091 // By default, no skins, hence, impossible to have transparent pass. But opaque pass is always possible 00092 // because of CLod rendering 00093 setOpacity(true); 00094 setTransparency(false); 00095 00096 // AnimDetail behavior: Must be traversed in AnimDetail, even if no channel mixer registered 00097 CTransform::setIsForceAnimDetail(true); 00098 00099 // LoadBalancing behavior. true because directly act on skins to draw all their MRM level 00100 CTransform::setIsLoadbalancable(true); 00101 00102 // Lighting behavior. Lightable because skins/stickedObjects may surely need its LightContribution 00103 CTransform::setIsLightable(true); 00104 00105 // Render behavior. Always renderable, because either render the skeleton as a CLod, or render skins 00106 CTransform::setIsRenderable(true); 00107 00108 // build a bug-free level detail 00109 buildDefaultLevelDetail(); 00110 00111 // RenderFilter: We are a skeleton 00112 _RenderFilterType= UScene::FilterSkeleton; 00113 00114 _AnimCtrlUsage= 0; 00115 00116 // ShadowMap 00117 CTransform::setIsShadowMapCaster(true); 00118 _ShadowMap= NULL; 00119 } |
|
Destructor.
Definition at line 123 of file skeleton_model.cpp. References _ItSkeletonInScene, _Skins, _StickedObjects, deleteShadowMap(), detachSkeletonSon(), NL3D::CScene::eraseSkeletonModelToList(), NL3D::CTransform::getOwnerScene(), and setLodCharacterShape().
00124 { 00125 // if initModel() called 00126 if(getOwnerScene()) 00127 { 00128 // remove from scene 00129 getOwnerScene()->eraseSkeletonModelToList(_ItSkeletonInScene); 00130 } 00131 00132 00133 // detach skeleton sons from skins. 00134 while(_Skins.begin()!=_Skins.end()) 00135 { 00136 detachSkeletonSon(*_Skins.begin()); 00137 } 00138 00139 // detach skeleton sons from sticked objects. 00140 while(_StickedObjects.begin()!=_StickedObjects.end()) 00141 { 00142 detachSkeletonSon(*_StickedObjects.begin()); 00143 } 00144 00145 // Free Lod instance 00146 setLodCharacterShape(-1); 00147 00148 // delete the shadowMap 00149 deleteShadowMap(); 00150 } |
|
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 } |
|
bind a skin to the skeleton. NB: ~CTransform() calls detachSkeletonSon(). NB: nlassert() if there is too many skins/sticked objects on this skeleton (more than 255). NB: an object can't be skinned and sticked at same time :) NB: replaced if already here. NB: when a skin is binded, the command hide(), show(), ... have no effect on it, until it is detachSkeletonSon()-ed NB: For Skins, all Hrc/Clip/UpdateList link is done here
Definition at line 497 of file skeleton_model.cpp. References NL3D::CTransform::_ClipLinkedInSonsOfAncestorSkeletonModelGroup, NL3D::CTransform::_FatherSkeletonModel, _Skins, NL3D::CTransform::clipUnlinkFromAll(), detachSkeletonSon(), dirtLodVertexAlpha(), dirtSkinRenderLists(), NL3D::CTransform::hrcUnlink(), NL3D::CTransform::isSkinnable(), nlassert, NL3D::CTransform::setApplySkin(), NL3D::CTransform::unfreezeHRC(), and NL3D::CTransform::unlinkFromUpdateList(). Referenced by NL3D::CSkeletonUser::bindSkin().
00498 { 00499 nlassert(mi); 00500 if( !mi->isSkinnable() ) 00501 return false; 00502 00503 // try to detach this object from any skeleton first (possibly me). 00504 if(mi->_FatherSkeletonModel) 00505 mi->_FatherSkeletonModel->detachSkeletonSon(mi); 00506 00507 // Then Add me. 00508 _Skins.insert(mi); 00509 00510 // advert skin transform it is skinned. 00511 mi->_FatherSkeletonModel= this; 00512 // setApplySkin() use _FatherSkeletonModel to computeBonesId() and to update current skeleton bone usage. 00513 mi->setApplySkin(true); 00514 00515 00516 // Unlink the Skin from Hrc and clip, because SkeletonModel now does the job for him. 00517 // First ensure that the transform is not frozen (unlink from some quadGrids etc...) 00518 mi->unfreezeHRC(); 00519 // then never re-parse in validateList/Hrc/Clip 00520 mi->unlinkFromUpdateList(); 00521 mi->hrcUnlink(); 00522 // ClipTrav is a graph, so must unlink from ALL olds models. 00523 mi->clipUnlinkFromAll(); 00524 // Ensure flag is correct 00525 mi->_ClipLinkedInSonsOfAncestorSkeletonModelGroup= false; 00526 00527 00528 // must recompute lod vertex alpha when LodCharacter used 00529 dirtLodVertexAlpha(); 00530 // must recompute list of skins. 00531 dirtSkinRenderLists(); 00532 00533 // Ok, skinned 00534 return true; 00535 } |
|
Definition at line 1282 of file skeleton_model.cpp. References NL3D::CMRMLevelDetail::compileDistanceSetup(), NL3D::CMRMLevelDetail::DistanceCoarsest, NL3D::CMRMLevelDetail::DistanceFinest, NL3D::CMRMLevelDetail::DistanceMiddle, NL3D::CMRMLevelDetail::MaxFaceUsed, and NL3D::CMRMLevelDetail::MinFaceUsed. Referenced by CSkeletonModel(), and updateSkinRenderLists().
01283 { 01284 // Avoid divide by zero. 01285 _LevelDetail.MinFaceUsed= 0; 01286 _LevelDetail.MaxFaceUsed= 0; 01287 _LevelDetail.DistanceFinest= 1; 01288 _LevelDetail.DistanceMiddle= 2; 01289 _LevelDetail.DistanceCoarsest= 3; 01290 _LevelDetail.compileDistanceSetup(); 01291 } |
|
true if the instance cast shadow. By default false
Definition at line 470 of file transform.h. References NL3D::CTransform::getStateFlag(), and NL3D::CTransform::IsFinalShadowMapCaster. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), NL3D::CTransform::enableCastShadowMap(), NL3D::CTransform::setGeneratingShadowMap(), and NL3D::CMeshInstance::traverseRender().
00470 {return getStateFlag(IsFinalShadowMapCaster)!=0;} |
|
true if the instance receive shadow. By default false
Definition at line 477 of file transform.h. References NL3D::CTransform::getStateFlag(), and NL3D::CTransform::IsFinalShadowMapReceiver. Referenced by NL3D::CLandscapeUser::canReceiveShadowMap(), and NL3D::CLandscapeModel::traverseRender().
00477 {return getStateFlag(IsFinalShadowMapReceiver)!=0;} |
|
Test if there is a start/stop caps in the objects (some fxs such as remanence).
Reimplemented in NL3D::CSegRemanence. Definition at line 126 of file transform_shape.h. Referenced by NL3D::CInstanceUser::canStartStop().
00126 { return false; } |
|
setup lighting for this instance into driver. The traverseRender().
Definition at line 105 of file transform_shape.cpp. References NL3D::CTransformShape::_CurrentLightContribution, NL3D::CTransformShape::_CurrentUseLocalAttenuation, and NL3D::CRenderTrav::changeLightSetup(). Referenced by NL3D::CMeshMRMGeom::activeInstance(), NL3D::CMeshGeom::activeInstance(), renderSkins(), and NL3D::CTransformShape::traverseRender().
00106 {
00107 // setup the instance lighting.
00108 rdrTrav->changeLightSetup(_CurrentLightContribution, _CurrentUseLocalAttenuation);
00109 }
|
|
Special version for skins. NB: skins never follow their original MRM distance setup, but follow this skeleton MRM setup. Default is to follow the MAX of all skins binded (ie the finer). NB: Unlike CMeshBaseInstance::changeMRMDistanceSetup(), this setup applies to the SkeletonModel, not the shape. NB: no-op if distanceFinest<0, distanceMiddle<=distanceFinest or if distanceCoarsest<=distanceMiddle.
Definition at line 1589 of file skeleton_model.cpp. References _DefaultMRMSetup, NL3D::CMRMLevelDetail::compileDistanceSetup(), NL3D::CMRMLevelDetail::DistanceCoarsest, NL3D::CMRMLevelDetail::DistanceFinest, and NL3D::CMRMLevelDetail::DistanceMiddle. Referenced by NL3D::CSkeletonUser::changeMRMDistanceSetup().
01590 { 01591 // check input. 01592 if(distanceFinest<0) return; 01593 if(distanceMiddle<=distanceFinest) return; 01594 if(distanceCoarsest<=distanceMiddle) return; 01595 01596 // Change. 01597 _LevelDetail.DistanceFinest= distanceFinest; 01598 _LevelDetail.DistanceMiddle= distanceMiddle; 01599 _LevelDetail.DistanceCoarsest= distanceCoarsest; 01600 01601 // compile 01602 _LevelDetail.compileDistanceSetup(); 01603 01604 // Never more use MAX skin setup. 01605 _DefaultMRMSetup= false; 01606 } |
|
This method clear a bit in the bitset.
Definition at line 233 of file animatable.h. References NL3D::IAnimatable::_BitSet, and uint. Referenced by NL3D::ITransformable::clearTransformFlags(), NL3D::CParticleSystemModel::doAnimate(), and NL3D::CAnimatedMaterial::update().
00234 { 00235 _BitSet&= ~(1<<valueId); 00236 } |
|
clip method called by traverseClip(). deafult is always visible
Reimplemented from NL3D::CTransform. Reimplemented in NL3D::CParticleSystemModel, and NL3D::CWaterModel. Definition at line 141 of file transform_shape.cpp. References NL3D::CTravCameraScene::CamPos, NL3D::CClipTrav::ForceNoFrustumClip, NL3D::CScene::getClipTrav(), NL3D::CTransformShape::getDistMax(), NL3D::CTransform::getOwnerScene(), NLMISC::CMatrix::getPos(), NL3D::CTransform::getWorldMatrix(), H_AUTO, NL3D::CTransformShape::Shape, and NL3D::CClipTrav::WorldPyramid.
00142 { 00143 H_AUTO( NL3D_TrShape_Clip ); 00144 00145 CClipTrav &clipTrav= getOwnerScene()->getClipTrav(); 00146 00147 if(Shape) 00148 { 00149 // first test DistMax (faster). 00150 float maxDist = getDistMax(); 00151 // if DistMax test enabled 00152 if(maxDist!=-1) 00153 { 00154 // Calc the distance 00155 float sqrDist = (clipTrav.CamPos - getWorldMatrix().getPos()).sqrnorm (); 00156 maxDist*=maxDist; 00157 00158 // if dist > maxDist, skip 00159 if (sqrDist > maxDist) 00160 { 00161 // Ok, not shown 00162 return false; 00163 } 00164 } 00165 00166 // Else finer clip with pyramid, only if needed 00167 if(clipTrav.ForceNoFrustumClip) 00168 return true; 00169 else 00170 return Shape->clip(clipTrav.WorldPyramid, getWorldMatrix()); 00171 } 00172 else 00173 return false; 00174 } |
|
Definition at line 1217 of file transform.cpp. References NL3D::CTransform::_ClipParents, NL3D::CTransform::_ClipSons, NL3D::CTransform::clipHasParent(), NL3D::CTransform::CClipNode::ClipNode, NL3D::CFastPtrList< CTransform >::insert(), and NL3D::CTransform::CClipNode::Parent. Referenced by NL3D::CScene::createModel(), detachSkeletonSon(), NL3D::CLandscapeModel::initModel(), NL3D::CScene::initQuadGridClipManager(), NL3D::CQuadGridClipClusterListDist::resetSons(), NL3D::CClipTrav::traverse(), and NL3D::CTransform::updateClipTravForAncestorSkeleton().
01218 { 01219 if(!son) 01220 return; 01221 01222 // if already linked, no-op. 01223 if(son->clipHasParent(this)) 01224 return; 01225 01226 // add a new parent entry for our son. 01227 CClipNode *clipNode= new CClipNode; 01228 son->_ClipParents.push_back(clipNode); 01229 01230 // link the son to us 01231 clipNode->Parent= this; 01232 01233 // link us to the son 01234 _ClipSons.insert(son, &clipNode->ClipNode); 01235 } |
|
Definition at line 1238 of file transform.cpp. References NL3D::CTransform::clipDelFromParent(). Referenced by NL3D::CScene::initDefaultRoots(), NL3D::CLandscapeModel::initModel(), NL3D::CClipTrav::traverse(), and NL3D::CTransform::~CTransform().
01239 { 01240 if(!son) 01241 return; 01242 01243 // try to remove from me from my parent 01244 son->clipDelFromParent(this); 01245 } |
|
Definition at line 1265 of file transform.cpp. References NL3D::CTransform::_ClipSons, index, nlassert, NL3D::CFastPtrList< CTransform >::size(), and uint. Referenced by NL3D::CCluster::recursTraverseClip(), NL3D::CTransform::traverseClip(), NL3D::CRootModel::traverseClip(), NL3D::CParticleSystemModel::traverseClip(), and NL3D::CTransform::~CTransform().
|
|
Definition at line 237 of file transform.h. References NL3D::CTransform::_ClipSons, NL3D::CFastPtrList< CTransform >::size(), and uint. Referenced by NL3D::CCluster::recursTraverseClip(), NL3D::CTransform::traverseClip(), NL3D::CRootModel::traverseClip(), NL3D::CParticleSystemModel::traverseClip(), and NL3D::CTransform::~CTransform().
00237 {return _ClipSons.size();}
|
|
Definition at line 234 of file transform.h. References NL3D::CTransform::_ClipParents, and uint. Referenced by NL3D::CTransform::clipUnlinkFromAll(), NL3D::CClipTrav::traverse(), and NL3D::CTransform::updateClipTravForAncestorSkeleton().
00234 {return _ClipParents.size();}
|
|
Definition at line 1258 of file transform.cpp. References NL3D::CTransform::_ClipParents, index, nlassert, and uint. Referenced by NL3D::CTransform::clipUnlinkFromAll(), NL3D::CClipTrav::traverse(), and NL3D::CTransform::updateClipTravForAncestorSkeleton().
|
|
Definition at line 1248 of file transform.cpp. References NL3D::CTransform::clipDelFromParent(), NL3D::CTransform::clipGetNumParents(), and NL3D::CTransform::clipGetParent(). Referenced by bindSkin(), NL3D::CScene::initQuadGridClipManager(), NL3D::CTransform::updateClipTravForAncestorSkeleton(), and NL3D::CTransform::~CTransform().
01249 { 01250 // unlink from all parent clip 01251 while( clipGetNumParents() ) 01252 { 01253 clipDelFromParent( clipGetParent(0) ); 01254 } 01255 } |
|
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 NL3D::ITransformable::_LocalMatrixDate, NL3D::ITransformable::needCompute(), and uint64. Referenced by NL3D::CWaterModel::updateDiffuseMapMatrix().
00083 { 00084 return callerDate<_LocalMatrixDate || needCompute(); 00085 } |
|
Tool function, especially for animation bake. It updates all bones (independent of bone usage, and lod interpolation), and take a user skeleton worldMatrix as input. NB: no detail animation is performed here, just the compute of bone hierarchy. NB: also, no special AnimCtrl (IK etc....) is performed here Definition at line 807 of file skeleton_model.cpp. References Bones, sint, and uint. Referenced by NL3D::CLodCharacterBuilder::addAnim(), and computeCurrentBBox().
00808 { 00809 // must test / update the hierarchy of Bones. 00810 // Since they are orderd in depth-first order, we are sure that parent are computed before sons. 00811 for(uint i=0;i<Bones.size();i++) 00812 { 00813 sint fatherId= Bones[i].getFatherId(); 00814 // if a root bone... 00815 if(fatherId==-1) 00816 // Compute root bone worldMatrix. Do not allow special AnimCtrl 00817 Bones[i].compute( NULL, modelWorldMatrix, NULL); 00818 else 00819 // Compute bone worldMatrix. Do not allow special AnimCtrl 00820 Bones[i].compute( &Bones[fatherId], modelWorldMatrix, NULL); 00821 } 00822 00823 } |
|
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty
Definition at line 1043 of file skeleton_model.cpp. References _CLodInstance, NL3D::CTransform::_FatherBoneId, _Skins, _StickedObjects, NL3D::CLodCharacterShape::addBoneAlpha(), Bones, NL3D::CLodCharacterShape::getBoneIdByName(), NL3D::CLodCharacterManager::getShape(), NL3D::CTransform::getSkinBoneUsage(), ItTransformSet, NL3D::CLodCharacterInstance::ShapeId, sint, NL3D::CLodCharacterShape::startBoneAlpha(), uint, and NL3D::CLodCharacterInstance::VertexAlphas. Referenced by renderCLod().
01044 { 01045 // if shape id set. 01046 if(_CLodInstance.ShapeId<0) 01047 return; 01048 // get the lod shape,a nd check exist in the manager 01049 const CLodCharacterShape *lodShape= mngr->getShape(_CLodInstance.ShapeId); 01050 if(lodShape) 01051 { 01052 // start process. 01053 //----------------- 01054 lodShape->startBoneAlpha(_CLodInstance.VertexAlphas); 01055 01056 // build an Id map, from Skeleton Ids to the lodShapes ids. (because may be differents) 01057 static vector<sint> boneMap; 01058 // reset to -1 (ie not found) 01059 boneMap.clear(); 01060 boneMap.resize(Bones.size(), -1); 01061 uint i; 01062 // for all skeletons bones. 01063 for(i=0; i<boneMap.size(); i++) 01064 { 01065 boneMap[i]= lodShape->getBoneIdByName(Bones[i].getBoneName());; 01066 } 01067 01068 // Parse all skins 01069 //----------------- 01070 ItTransformSet it; 01071 for(it= _Skins.begin(); it!=_Skins.end(); it++) 01072 { 01073 CTransform *skin= *it; 01074 01075 // get array of bone used for this skin. 01076 const vector<sint32> *skinUsage= skin->getSkinBoneUsage(); 01077 // check correct skin 01078 if(skinUsage) 01079 { 01080 // For all bones used 01081 for(uint i=0; i<skinUsage->size(); i++) 01082 { 01083 // the id in the vector point to a bone in the skeleton. Hence use the boneMap to translate it 01084 // in the lodShape ids. 01085 sint idInLod= boneMap[(*skinUsage)[i]]; 01086 // only if id found in the lod shape 01087 if(idInLod>=0) 01088 // add color to this bone. 01089 lodShape->addBoneAlpha(idInLod, _CLodInstance.VertexAlphas); 01090 } 01091 01092 } 01093 } 01094 01095 // Parse all sticked objects 01096 //----------------- 01097 for(it= _StickedObjects.begin(); it!=_StickedObjects.end(); it++) 01098 { 01099 CTransform *object= *it; 01100 01101 // get on which bone this object is linked. 01102 // use the boneMap to translate id to lodShape id. 01103 sint idInLod= boneMap[object->_FatherBoneId]; 01104 01105 // only if id found in the lod shape 01106 if(idInLod>=0) 01107 // add color to this bone. 01108 lodShape->addBoneAlpha(idInLod, _CLodInstance.VertexAlphas); 01109 } 01110 01111 } 01112 01113 } |
|
same as computeRenderedBBox() but force animation and compute of all bones => don't need render(), but slower. for all used bones, extend the bbox with their pos NB: AnimCtrl are not evaluated by this method (since computed with 0 pos).
Definition at line 1665 of file skeleton_model.cpp. References _BoneUsage, Bones, computeAllBones(), NL3D::CChannelMixer::eval(), NLMISC::CAABBox::extend(), NL3D::CTransform::getChannelMixer(), NL3D::CChannelMixer::resetEvalDetailDate(), NLMISC::CAABBox::setCenter(), NLMISC::CAABBox::setHalfSize(), uint, and uint8. Referenced by NL3D::CSkeletonUser::computeCurrentBBox().
01666 { 01667 // animate all bones channels (detail only channels). don't bother cur lod state. 01668 CChannelMixer *chanmix= getChannelMixer(); 01669 if (chanmix) 01670 { 01671 // Force detail evaluation. 01672 chanmix->resetEvalDetailDate(); 01673 chanmix->eval(true, 0); 01674 chanmix->resetEvalDetailDate(); 01675 } 01676 // compute all skeleton bones 01677 computeAllBones(CMatrix::Identity); 01678 01679 // reset bbox 01680 CAABBox tmpBBox; 01681 tmpBBox.setCenter(CVector::Null); 01682 tmpBBox.setHalfSize(CVector::Null); 01683 bool empty= true; 01684 01685 // For all bones 01686 uint i; 01687 for(i=0;i<Bones.size();i++) 01688 { 01689 // Is the bone used ?? (whatever bone lod, or CLod state) 01690 uint8 mustCompute = forceCompute ? 1 : _BoneUsage[i].Usage | _BoneUsage[i].ForcedUsage | _BoneUsage[i].CLodForcedUsage; 01691 01692 // If the bone is used. 01693 if(mustCompute) 01694 { 01695 CVector pos; 01696 if(computeInWorld) 01697 pos= Bones[i].getWorldMatrix().getPos(); 01698 else 01699 pos= Bones[i].getLocalSkeletonMatrix().getPos(); 01700 if(empty) 01701 { 01702 empty= false; 01703 tmpBBox.setCenter(pos); 01704 } 01705 else 01706 tmpBBox.extend(pos); 01707 } 01708 } 01709 01710 // End! 01711 if(!empty) 01712 { 01713 bbox= tmpBBox; 01714 return true; 01715 } 01716 else 01717 return false; 01718 } |
|
Called in ClipTrav pass. Used to update the flag _DisplayedAsLodCharacter. return 0 if CLod not enabled. Else return a priority>0 computed from curDistance/LodCharacterDistance return 0 too if the skeleton is not visible or if his ancestorSkeletonModel is not visible. If priority is >1 then the skeleton must be displayed in CLod form Definition at line 972 of file skeleton_model.cpp. References _CLodInstance, _LodCharacterDistance, _OOLodCharacterDistance, NL3D::CTravCameraScene::CamPos, NL3D::CScene::getClipTrav(), NL3D::CTransform::getOwnerScene(), NLMISC::CMatrix::getPos(), NL3D::CTransform::getWorldMatrix(), NL3D::CTransform::isClipVisible(), and NL3D::CLodCharacterInstance::ShapeId. Referenced by NL3D::CClipTrav::loadBalanceSkeletonCLod().
00973 { 00974 // if enabled 00975 if(_LodCharacterDistance>0 && _CLodInstance.ShapeId>=0) 00976 { 00977 CVector globalPos; 00978 /* \todo yoyo: bad test of visibility. If the skeleton is hidden but has a _AncestorSkeletonModel 00979 wich is visible, then it is supposed to be visible (in this test), but only for The CLod LoadBalancing 00980 (priority not 0). Not so important... 00981 */ 00982 00983 // Get object position, test visibility; 00984 // If has a skeleton ancestor, take his world position instead, because ours is invalid. 00985 if( _AncestorSkeletonModel != NULL) 00986 { 00987 // if the ancestore is clipped, quit 00988 if( !_AncestorSkeletonModel->isClipVisible() ) 00989 return 0; 00990 // take ancestor world position 00991 globalPos= _AncestorSkeletonModel->getWorldMatrix().getPos(); 00992 } 00993 else 00994 { 00995 // if the skeleton is clipped, quit 00996 if( !isClipVisible() ) 00997 return 0; 00998 // take our world position 00999 globalPos= getWorldMatrix().getPos(); 01000 } 01001 01002 // compute distance from camera. 01003 float dist= (getOwnerScene()->getClipTrav().CamPos - globalPos).norm(); 01004 01005 // compute priority 01006 return dist*_OOLodCharacterDistance; 01007 } 01008 else 01009 return 0; 01010 } |
|
Call it when you want the system to recompute the Lod texture NB: Lod texturing is possible only in conjunction with AsyncTextureManager. Hence, instances skinned to the skeleton should be in AsyncTextureMode. For best result, you should wait that each of these instances are isAsyncTextureReady() (texture loaded) Definition at line 866 of file skeleton_model.cpp. References _CLodInstance, _Skins, NL3D::CLodCharacterManager::addTextureCompute(), NL3D::CLodCharacterTmpBitmap::build(), NL3D::CLodCharacterManager::endTextureCompute(), NL3D::CMeshBaseInstance::getAsyncTextureId(), NL3D::CScene::getAsyncTextureManager(), NL3D::CMeshBaseInstance::getAsyncTextureMode(), NL3D::CAsyncTextureManager::getCoarseBitmap(), NL3D::CScene::getLodCharacterManager(), NL3D::CMeshBase::getLodCharacterTexture(), NL3D::CTransform::getOwnerScene(), NL3D::CLodCharacterManager::getTmpBitmap(), ItTransformSet, NL3D::CMeshBaseInstance::Materials, min, nlassert, NL3D::CTransformShape::Shape, NL3D::CLodCharacterInstance::ShapeId, sint, NL3D::CLodCharacterManager::startTextureCompute(), and uint. Referenced by NL3D::CSkeletonUser::computeLodTexture().
00867 { 00868 // is lod setuped 00869 if(_CLodInstance.ShapeId<0) 00870 return; 00871 00872 // get a ptr on the scene which owns us, and so on the lodManager. 00873 CScene *scene= getOwnerScene(); 00874 CLodCharacterManager *mngr= scene->getLodCharacterManager(); 00875 // mngr must be setuped since shape Id is >-1 00876 nlassert(mngr); 00877 /* Get the asyncTextureManager. This is a Hack. We use the AsyncTextureManager to store very low version of Textures 00878 (kept in DXTC1 format for minimum memory overhead). 00879 HENCE Lod Texture can work only with Async Textured instances!! 00880 */ 00881 CAsyncTextureManager *asyncMngr= scene->getAsyncTextureManager(); 00882 // if not setuped, cancel 00883 if(!asyncMngr) 00884 return; 00885 00886 00887 // **** start process. If cannot (TextureId==no more texture space), just quit. 00888 if(!mngr->startTextureCompute(_CLodInstance)) 00889 return; 00890 uint maxNumBmpToReset= 0; 00891 00892 // **** For all skins which have a LodTexture setuped 00893 ItTransformSet it= _Skins.begin(); 00894 for(;it!=_Skins.end();it++) 00895 { 00896 // the skin should be a meshBaseInstance setuped to asyncTexturing 00897 CMeshBaseInstance *mbi= dynamic_cast<CMeshBaseInstance*>(*it); 00898 if(mbi && mbi->getAsyncTextureMode() && mbi->Shape) 00899 { 00900 CMeshBase *mb= (CMeshBase*)(IShape*)(mbi->Shape); 00901 // get the LodTexture info of this shape. 00902 const CLodCharacterTexture *lodText= mb->getLodCharacterTexture(); 00903 // if setuped 00904 if(lodText) 00905 { 00906 // Ok, compute influence of this instance on the Lod. 00907 00908 // ---- Build all bmps of the instance with help of the asyncTextureManager 00909 uint numMats= mbi->Materials.size(); 00910 // 256 materials possibles for the lod Manager 00911 numMats= min(numMats, 256U); 00912 // for endTexturecompute 00913 maxNumBmpToReset= max(maxNumBmpToReset, numMats); 00914 // process each materials 00915 for(uint i=0;i<numMats;i++) 00916 { 00917 // get the manager bitmap to write to 00918 CLodCharacterTmpBitmap &dstBmp= mngr->getTmpBitmap(i); 00919 00920 // if the material stage 0 is not textured, or has not a valid async id, build the bitmap with a color. 00921 sint asyncTextId= mbi->getAsyncTextureId(i,0); 00922 const CBitmap *coarseBitmap= NULL; 00923 if(asyncTextId!=-1) 00924 { 00925 // get it from async manager 00926 coarseBitmap= asyncMngr->getCoarseBitmap(asyncTextId); 00927 } 00928 00929 // So if we have no bmp here, build with material color, else build a texture 00930 if(!coarseBitmap) 00931 { 00932 dstBmp.build(mbi->Materials[i].getDiffuse()); 00933 } 00934 else 00935 { 00936 dstBmp.build(*coarseBitmap); 00937 } 00938 } 00939 00940 // ---- add the lodTextureInfo to the current texture computed 00941 mngr->addTextureCompute(_CLodInstance, *lodText); 00942 } 00943 } 00944 } 00945 00946 // **** compile the process 00947 mngr->endTextureCompute(_CLodInstance, maxNumBmpToReset); 00948 00949 } |
|
Retrieve the current approx BBox around the skeleton, computed in the last CSene::render(). for all computed bones, extend the bbox with their pos
Definition at line 1620 of file skeleton_model.cpp. References Bones, NLMISC::CAABBox::extend(), isBoneComputed(), NL3D::CTransform::isClipVisible(), NLMISC::CAABBox::setCenter(), NLMISC::CAABBox::setHalfSize(), and uint. Referenced by NL3D::CSkeletonUser::computeRenderedBBox().
01621 { 01622 // reset bbox 01623 CAABBox tmpBBox; 01624 tmpBBox.setCenter(CVector::Null); 01625 tmpBBox.setHalfSize(CVector::Null); 01626 bool empty= true; 01627 01628 // Not visible => empty bbox 01629 if(!isClipVisible()) 01630 return false; 01631 01632 // For all bones 01633 uint i; 01634 for(i=0;i<Bones.size();i++) 01635 { 01636 if(isBoneComputed(i)) 01637 { 01638 CVector pos; 01639 if(computeInWorld) 01640 pos= Bones[i].getWorldMatrix().getPos(); 01641 else 01642 pos= Bones[i].getLocalSkeletonMatrix().getPos(); 01643 if(empty) 01644 { 01645 empty= false; 01646 tmpBBox.setCenter(pos); 01647 } 01648 else 01649 tmpBBox.extend(pos); 01650 } 01651 } 01652 01653 // End! 01654 if(!empty) 01655 { 01656 bbox= tmpBBox; 01657 return true; 01658 } 01659 else 01660 return false; 01661 } |
|
Special For Skeleton Caster. When Skeletons cast shadows, they first compute the WorldBBox. The model should compute its bbox in World (best fit).
Reimplemented from NL3D::CTransform. Definition at line 1987 of file skeleton_model.cpp. References _BoneToCompute, NL3D::CBone::_MaxSphere, _StickedObjects, NLMISC::CBSphere::applyTransform(), NLMISC::CBSphere::Center, NLMISC::CAABBox::computeAABBoxUnion(), NL3D::CTransform::computeWorldBBoxForShadow(), NL3D::CBone::getWorldMatrix(), NL3D::CTransform::isHrcVisible(), ItTransformSet, NLMISC::CVector::maxof(), NLMISC::CVector::minof(), r, NLMISC::CBSphere::Radius, NLMISC::CAABBox::setMinMax(), uint, NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z. Referenced by generateShadowMap().
01988 { 01989 uint i; 01990 01991 // If even not visible, no-op 01992 if(!isHrcVisible() || !Shape) 01993 return false; 01994 01995 // **** Compute The BBox with Bones of the skeleton 01996 CVector minBB, maxBB; 01997 for(i=0;i<_BoneToCompute.size();i++) 01998 { 01999 CBone *bone= _BoneToCompute[i].Bone; 02000 // compute the world sphere 02001 const CMatrix &worldMat= bone->getWorldMatrix(); 02002 CBSphere worldSphere; 02003 bone->_MaxSphere.applyTransform(worldMat, worldSphere); 02004 // compute bone min max bounding cube. 02005 CVector minBone, maxBone; 02006 minBone= maxBone= worldSphere.Center; 02007 float r= worldSphere.Radius; 02008 minBone.x-= r; 02009 minBone.y-= r; 02010 minBone.z-= r; 02011 maxBone.x+= r; 02012 maxBone.y+= r; 02013 maxBone.z+= r; 02014 // set or extend 02015 if(i==0) 02016 { 02017 minBB= minBone; 02018 maxBB= maxBone; 02019 } 02020 else 02021 { 02022 minBB.minof(minBB, minBone); 02023 maxBB.maxof(maxBB, maxBone); 02024 } 02025 } 02026 // build the bbox 02027 worldBB.setMinMax(minBB, maxBB); 02028 /* 02029 // Fake Version. Faster (-0.2 ms for 8 compute each frame) but false. 02030 for(i=0;i<_BoneToCompute.size();i++) 02031 { 02032 CBone *bone= _BoneToCompute[i].Bone; 02033 const CMatrix &worldMat= bone->getWorldMatrix(); 02034 if(i==0) 02035 worldBB.setCenter(worldMat.getPos()); 02036 else 02037 worldBB.extend(worldMat.getPos()); 02038 } 02039 worldBB.setHalfSize(worldBB.getHalfSize() *1.5f); 02040 */ 02041 02042 02043 // **** Add to this bbox the ones of the Sticked objects. 02044 ItTransformSet it; 02045 for(it= _StickedObjects.begin();it!=_StickedObjects.end();it++) 02046 { 02047 CTransform *stickModel= *it; 02048 // Do the same for this son (NB: recurs, may be a skeleton too!!) 02049 CAABBox stickBB; 02050 if(stickModel->computeWorldBBoxForShadow(stickBB)) 02051 { 02052 // Make union of the 2 02053 worldBB= CAABBox::computeAABBoxUnion(worldBB, stickBB); 02054 } 02055 } 02056 02057 // Done! 02058 return true; 02059 } |
|
To implement for ShadowCaster support. typically allocate a CShadowMap and store NB: the texture doesn't have to be inited at this time. Update it each frame in generateShadowMap() Reimplemented from NL3D::CTransform. Definition at line 1852 of file skeleton_model.cpp. References NL3D::CTransform::getOwnerScene().
01853 { 01854 // create the shadowMap 01855 if(!_ShadowMap) 01856 { 01857 _ShadowMap= new CShadowMap(&getOwnerScene()->getRenderTrav().getShadowMapManager()); 01858 } 01859 } |
|
Reimplemented from NL3D::CTransformShape. Definition at line 356 of file skeleton_model.h.
00356 {return new CSkeletonModel;} |
|
decrement the refCount of the ith bone. set forced to the same param passed when incBoneUsage()
Definition at line 213 of file skeleton_model.cpp. References _BoneToComputeDirty, _BoneUsage, nlassert, uint, uint8, UsageForced, and UsageNormal. Referenced by decForcedBoneUsageAndParents(), NL3D::CMeshMRMSkinnedGeom::updateSkeletonUsage(), NL3D::CMeshMRMGeom::updateSkeletonUsage(), and NL3D::CMeshGeom::updateSkeletonUsage().
00214 { 00215 nlassert(i<_BoneUsage.size()); 00216 00217 // Get ptr on according refCount 00218 uint8 *usagePtr; 00219 if(boneUsageType == UsageNormal) 00220 usagePtr= &_BoneUsage[i].Usage; 00221 else if(boneUsageType == UsageForced) 00222 usagePtr= &_BoneUsage[i].ForcedUsage; 00223 else 00224 usagePtr= &_BoneUsage[i].CLodForcedUsage; 00225 00226 // If the bone was used before (and now won't be more), must update MustCompute. 00227 if(*usagePtr==1) 00228 _BoneToComputeDirty= true; 00229 00230 // Inc the refCount of the bone. 00231 nlassert(*usagePtr>0); 00232 (*usagePtr)--; 00233 } |
|
increment the refCount of the ith bone and its parents. for stickObjects.
Definition at line 266 of file skeleton_model.cpp. References Bones, decBoneUsage(), sint, and uint. Referenced by detachSkeletonSon().
00267 { 00268 // dec forced 00269 decBoneUsage(i, forceCLod?UsageCLodForced:UsageForced); 00270 00271 // recurs to father 00272 sint fatherId= Bones[i].getFatherId(); 00273 // if not a root bone... 00274 if(fatherId>=0) 00275 decForcedBoneUsageAndParents(fatherId, forceCLod); 00276 } |
|
To implement for ShadowCaster support. typically free the shadowMap.
Reimplemented from NL3D::CTransform. Definition at line 1862 of file skeleton_model.cpp. Referenced by ~CSkeletonModel().
01863 { 01864 if(_ShadowMap) 01865 { 01866 delete _ShadowMap; 01867 _ShadowMap= NULL; 01868 } 01869 } |
|
unparent a CTransform from a bone of the skeleton, or unbind a skin. No-op if not a son of this skeleton NB: mi is made son of Root in Traversals Hrc, and change are made at render() for ClipTrav. NB: For Skins, all Hrc/Clip/UpdateList link is done here Definition at line 573 of file skeleton_model.cpp. References NL3D::CTransform::_FatherBoneId, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_ForceCLodSticked, _Skins, _StickedObjects, NL3D::CTransform::clipAddChild(), decForcedBoneUsageAndParents(), dirtLodVertexAlpha(), dirtSkinRenderLists(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRoot(), NL3D::CTransform::hrcLinkSon(), NL3D::CTransform::isSkinned(), NL3D::CTransform::linkToUpdateList(), nlassert, and NL3D::CTransform::setApplySkin(). Referenced by bindSkin(), NL3D::CSkeletonUser::detachSkeletonSon(), stickObjectEx(), NL3D::CMeshInstance::~CMeshInstance(), NL3D::CMeshMRMInstance::~CMeshMRMInstance(), NL3D::CMeshMRMSkinnedInstance::~CMeshMRMSkinnedInstance(), NL3D::CParticleSystemModel::~CParticleSystemModel(), NL3D::CSegRemanence::~CSegRemanence(), ~CSkeletonModel(), and NL3D::CTransform::~CTransform().
00574 { 00575 nlassert(tr); 00576 00577 // If the instance is not binded/sticked to the skeleton, exit. 00578 if(tr->_FatherSkeletonModel!=this) 00579 return; 00580 00581 // try to erase from StickObject. 00582 _StickedObjects.erase(tr); 00583 // try to erase from Skins. 00584 _Skins.erase(tr); 00585 00586 // If the instance is not skinned, then it is sticked 00587 bool wasSkinned= tr->isSkinned()!=0; 00588 if( !wasSkinned ) 00589 { 00590 // Then decrement Bone Usage RefCount. Decrement from CLodForcedUsage if was sticked with forceCLod==true 00591 decForcedBoneUsageAndParents(tr->_FatherBoneId, tr->_ForceCLodSticked); 00592 } 00593 else 00594 { 00595 // it is skinned, advert the skinning is no more OK. 00596 // setApplySkin() use _FatherSkeletonModel to update current skeleton bone usage. 00597 tr->setApplySkin(false); 00598 } 00599 00600 // advert transform it is no more sticked/skinned. 00601 tr->_FatherSkeletonModel= NULL; 00602 tr->_ForceCLodSticked= false; 00603 00604 // link correctly Hrc / Clip / UpdateList... 00605 getOwnerScene()->getRoot()->hrcLinkSon( tr ); 00606 if( !wasSkinned ) 00607 { 00608 // No-op. ClipTrav graph/UpdateList updated in Hrc traversal. 00609 } 00610 else 00611 { 00612 // Skin case: must do the Job here. 00613 // Update ClipTrav here. 00614 getOwnerScene()->getRoot()->clipAddChild(tr); 00615 // Must re-add to the update list. 00616 tr->linkToUpdateList(); 00617 } 00618 00619 00620 // must recompute lod vertex alpha when LodCharacter used 00621 dirtLodVertexAlpha(); 00622 // must recompute list of skins if was skinned 00623 if( wasSkinned ) 00624 dirtSkinRenderLists(); 00625 } |
|
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty
Definition at line 476 of file skeleton_model.h. References _CLodVertexAlphaDirty. Referenced by bindSkin(), detachSkeletonSon(), and stickObjectEx().
00476 {_CLodVertexAlphaDirty= true;} |
|
Force the skeletonModel to recompute at next render which skins to render, at wich pass. If you call setOpacity()/setTransparency() on one of the skins binded to the skeleton, you should call this method, else strange result may occurs. NB: this is automatically called by bindSkin()/detachSkeletonSon() Definition at line 151 of file skeleton_model.h. References _SkinToRenderDirty. Referenced by bindSkin(), detachSkeletonSon(), NL3D::CTransform::heritVisibility(), NL3D::CTransform::hide(), NL3D::CTransform::registerToChannelMixer(), resetDefaultMRMDistanceSetup(), NL3D::CTransform::setIsForceAnimDetail(), NL3D::CTransform::setOpacity(), NL3D::CTransform::setTransparency(), and NL3D::CTransform::show().
00151 {_SkinToRenderDirty= true;} |
|
By default, map shadow casting is disabled. This enabled shadow for this model. Fails if the model don't support dynamic Map Shadow Casting (eg landscape) Dervier note: createShadowMap() and deleteShadowMap() is called here. Definition at line 1335 of file transform.cpp. References NL3D::CTransform::canCastShadowMap(), NL3D::CTransform::createShadowMap(), NL3D::CTransform::deleteShadowMap(), NL3D::CTransform::getShadowMap(), NL3D::CTransform::IsFinalShadowMapCaster, NL3D::CTransform::modelCanCastShadowMap(), nlassert, and NL3D::CTransform::setStateFlag().
01336 { 01337 bool precState= canCastShadowMap(); 01338 01339 if(modelCanCastShadowMap()) 01340 setStateFlag(IsFinalShadowMapCaster, state); 01341 else 01342 setStateFlag(IsFinalShadowMapCaster, false); 01343 01344 // if just enabled, create the shadowMap 01345 if(canCastShadowMap() && !precState) 01346 { 01347 createShadowMap(); 01348 // The user must have created it. 01349 nlassert(getShadowMap()); 01350 } 01351 // if just disabled, free ressource 01352 else if(!canCastShadowMap() && precState) 01353 { 01354 deleteShadowMap(); 01355 } 01356 } |
|
By default, map shadow receiving is disabled. This enabled shadow for this model. Fails if the model don't support dynamic Map Shadow Receiving (eg Particle system) Definition at line 475 of file transform.h. References NL3D::CTransform::IsFinalShadowMapReceiver, NL3D::CTransform::modelCanReceiveShadowMap(), and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CLandscapeUser::enableReceiveShadowMap().
00475 {if(modelCanReceiveShadowMap()) setStateFlag(IsFinalShadowMapReceiver, state);} |
|
This method update boneUsage (must be of size of Bones). It's flag boneUsage[boneId] to true, and all parents of boneId. Definition at line 237 of file skeleton_model.cpp. References Bones, nlassert, sint, and uint32. Referenced by NL3D::CMeshMRMSkinnedGeom::computeBonesId(), NL3D::CMeshMRMGeom::computeBonesId(), and NL3D::CMeshGeom::computeBonesId().
00238 { 00239 nlassert( boneUsage.size()==Bones.size() ); 00240 nlassert( boneId<Bones.size() ); 00241 00242 // Flag this bone. 00243 boneUsage[boneId]= true; 00244 00245 // if has father, flag it (recurs). 00246 sint fatherId= Bones[boneId].getFatherId(); 00247 if(fatherId>=0) 00248 flagBoneAndParents(fatherId, boneUsage); 00249 } |
|
Definition at line 1359 of file transform.cpp. References NL3D::CTransform::_FatherBoneId, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_HrcParent, forceComputeBone(), NL3D::CTransform::update(), and NL3D::CTransform::updateWorldMatrixFromFather(). Referenced by NL3D::CParticleSystemManager::processAnimate().
01360 { 01361 // if father is a skeleton, force to compute the bone we are sticked to 01362 if (_FatherSkeletonModel) 01363 { 01364 _FatherSkeletonModel->forceComputeBone(_FatherBoneId); 01365 } 01366 else 01367 { 01368 // force to compûte the father 01369 if (_HrcParent) 01370 { 01371 _HrcParent->forceCompute(); 01372 } 01373 } 01374 // compute 01375 update(); 01376 updateWorldMatrixFromFather(); 01377 } |
|
Force to compute a bone right now (useful if the skeleton is not visible and the bone position is needed) no-op is bone not present or already computed
Definition at line 391 of file skeleton_model.cpp. References _BoneUsage, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_HrcParent, Bones, NL3D::CBone::compute(), NL3D::CBone::getFatherId(), NL3D::CBone::getWorldMatrix(), NL3D::CTransform::isSkeleton(), MaxNumBones, nlassert, sint, NL3D::CForceComputeBoneInfo::StickBoneID, NL3D::CForceComputeBoneInfo::Transform, and uint. Referenced by NL3D::CTransform::forceCompute(), and NL3D::CSkeletonUser::forceComputeBone().
00392 { 00393 if(boneId >= _BoneUsage.size()) return false; 00394 // build list of ancestor, then must build 00395 std::vector<CForceComputeBoneInfo> ancestors; 00396 // count the number of ancestors (to avoid unwanted alloc with vector) 00397 uint numAncestors = 1; 00398 CTransform *currTransform = this; 00399 for(;;) 00400 { 00401 currTransform = currTransform->_HrcParent ? currTransform->_HrcParent : currTransform->_FatherSkeletonModel; // find father transform (maybe a skeleton or a std transform) 00402 if (!currTransform) break; // root reached ? 00403 ++ numAncestors; 00404 } 00405 ancestors.reserve(numAncestors); 00406 // build list of ancestor 00407 currTransform = this; 00408 uint currStickBone = boneId; 00409 for(;;) 00410 { 00411 // if curr transform is a skeleton, animate all bone from stick bone to the root bone 00412 if (currTransform->isSkeleton()) 00413 { 00414 if (_ChannelMixer) 00415 { 00416 CSkeletonModel *skel = static_cast<CSkeletonModel *>(currTransform); 00417 nlassert(boneId < skel->_BoneUsage.size()); 00418 nlassert(currStickBone < skel->Bones.size()); 00419 sint currBoneIndex = currStickBone; 00420 // force channel mixer to eval for that bone 00421 while (currBoneIndex != -1) 00422 { 00423 nlassert((uint) currBoneIndex < skel->Bones.size()); 00424 skel->Bones[currBoneIndex].forceAnimate(*_ChannelMixer); 00425 currBoneIndex = skel->Bones[currBoneIndex].getFatherId(); 00426 } 00427 } 00428 } 00429 else 00430 { 00431 // update stickBone ID (if father is a skeleton) 00432 currStickBone = _FatherBoneId; 00433 } 00434 CForceComputeBoneInfo fcbi; 00435 fcbi.StickBoneID = currStickBone; 00436 fcbi.Transform = currTransform; 00437 ancestors.push_back(fcbi); 00438 currTransform = currTransform->_HrcParent ? currTransform->_HrcParent : currTransform->_FatherSkeletonModel; // find father transform (maybe a skeleton or a std transform) 00439 if (!currTransform) break; // root reached ? 00440 } 00441 // bones must be recomputed from father bone to sons, so must traverse bones until root is reached to retrieve correct ordering 00442 CBone *OrderedBone[MaxNumBones]; 00443 // 00444 const CMatrix *parentWorldMatrix = &CMatrix::Identity; 00445 for(std::vector<CForceComputeBoneInfo>::reverse_iterator it = ancestors.rbegin(); it != ancestors.rend(); ++it) 00446 { 00447 // update world matrix (NB : the call to getmatrix will update the local matrix) 00448 it->Transform->setWorldMatrix(*parentWorldMatrix * it->Transform->getMatrix()); 00449 if (it->Transform->isSkeleton()) 00450 { 00451 CSkeletonModel *skel = static_cast<CSkeletonModel *>(it->Transform); 00452 // reorder bones 00453 uint numBones = 0; 00454 nlassert(it->StickBoneID < skel->Bones.size()); 00455 sint currBoneIndex = it->StickBoneID; 00456 nlassert(currBoneIndex != -1); 00457 do 00458 { 00459 nlassert(numBones < MaxNumBones); 00460 nlassert((uint) currBoneIndex < skel->Bones.size()); 00461 OrderedBone[numBones] = &skel->Bones[currBoneIndex]; 00462 currBoneIndex = OrderedBone[numBones]->getFatherId(); 00463 ++ numBones; 00464 } 00465 while (currBoneIndex != -1); 00466 const CMatrix &modelWorldMatrix = it->Transform->getWorldMatrix(); 00467 // recompute bones 00468 CBone *fatherBone = NULL; 00469 while (numBones--) 00470 { 00471 OrderedBone[numBones]->compute(fatherBone, modelWorldMatrix, NULL); 00472 fatherBone = OrderedBone[numBones]; 00473 } 00474 parentWorldMatrix = &(OrderedBone[0]->getWorldMatrix()); 00475 } 00476 else 00477 { 00478 parentWorldMatrix = &it->Transform->getWorldMatrix(); 00479 } 00480 } 00481 return true; 00482 } |
|
freeze the preceding position of the model. Do not use, special code for cluster. This inform the scene that preceding position setuped by user is "frozen". ie at next render(), this object won't be added to the "object moving list" (usefull for cluster mgt). The "frozen" state is disabled (at render() time) if:
Definition at line 367 of file transform.cpp. References NL3D::CTransform::_Frozen, and NL3D::CTransform::update(). Referenced by NL3D::CInstanceGroup::addToSceneWhenAllShapesLoaded(), and NL3D::CScene::initDefaultRoots().
|
|
freeze the HRC so the WorldMatrix computed at next render() will be kept for long, and the model won't either be tested in HRC (which is still expensive, even if the worldmatrix doesn't need to be recomputed). The model won't either be validated. It is suposed to not change at all. Also, if it is not a son of a CCluster, it may be accelerated during Cliping (with CQuadGridClipManager). NB: the model won't be tested in HRC anymore. calling freezeHRC() on a model in a hierarchy without calling it to the root of the hierarchy will result in that the model won't be validated nor be HRC traversed. To be simplier, you should freezeHRC() all the models of a hierarchy, from base root to leaves. NB: if the hierarchy of this object must change, or if the object must moves, you must call unfreezeHRC() first, and you should do this for all the parents of this model. Definition at line 385 of file transform.cpp. References NL3D::CTransform::_FreezeHRCState, NL3D::CTransform::_Frozen, NL3D::CTransform::_TransformDirty, NL3D::CTransform::FreezeHRCStateDisabled, NL3D::CTransform::FreezeHRCStateRequest, NL3D::CTransform::QuadGridClipEnabled, and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CInstanceGroup::freezeHRC().
00386 { 00387 // if disabled, say we are ready to validate our worldMatrix for long. 00388 if(_FreezeHRCState==FreezeHRCStateDisabled) 00389 { 00390 _FreezeHRCState= FreezeHRCStateRequest; 00391 setStateFlag(QuadGridClipEnabled, true); 00392 00393 /* If the transform is not frozen (ie staticaly inserted in a cluster), 00394 We must be sure it will be tested against QuadGridClipManager at next ClipTrav pass. 00395 => must make this object a "moving object" at next render=> dirt _LocalMatrixDate. 00396 */ 00397 if(!_Frozen) 00398 { 00399 _TransformDirty= true; 00400 } 00401 } 00402 } |
|
Freeze and set the Static Light Setup. Called by CInstanceGroup::addToScene() NB: it calls resetLighting() first. NB: nlassert(numPointLights<=NL3D_MAX_LIGHT_CONTRIBUTION) Definition at line 1028 of file transform.cpp. References NL3D::CTransform::_LightContribution, NL3D::CLightContribution::Factor, NL3D::CLightContribution::FrozenAmbientLight, NL3D::CLightContribution::FrozenStaticLightSetup, NL3D::CTransform::IsNeedUpdateFrozenStaticLightSetup, NL3D_MAX_LIGHT_CONTRIBUTION, nlassert, NL3D::CLightContribution::NumFrozenStaticLight, NL3D::CLightContribution::PointLight, NL3D::CTransform::resetLighting(), NL3D::CTransform::setStateFlag(), NL3D::CLightContribution::SunContribution, uint, and uint8.
01030 { 01031 nlassert(numPointLights <= NL3D_MAX_LIGHT_CONTRIBUTION); 01032 01033 // resetLighting() first. 01034 resetLighting(); 01035 01036 // Enable StaticLightSetup. 01037 _LightContribution.FrozenStaticLightSetup= true; 01038 _LightContribution.NumFrozenStaticLight= numPointLights; 01039 _LightContribution.SunContribution= sunContribution; 01040 // setup the FrozenAmbientLight 01041 _LightContribution.FrozenAmbientLight= frozenAmbientlight; 01042 // Setup other pointLights 01043 uint i; 01044 for(i=0;i<numPointLights;i++) 01045 { 01046 // set the light 01047 _LightContribution.PointLight[i]= pointLight[i]; 01048 // Enable at max. 01049 _LightContribution.Factor[i]= 255; 01050 // Compute static AttFactor Later because don't have WorlPosition of the model here!! 01051 setStateFlag(IsNeedUpdateFrozenStaticLightSetup, true); 01052 01053 // Do NOT set the iterator, because it is a staticLight. 01054 } 01055 // End the list 01056 if(i<NL3D_MAX_LIGHT_CONTRIBUTION) 01057 _LightContribution.PointLight[i]= NULL; 01058 } |
|
For Casters. Display the Shadow to the "Auxiliary Driver". This method should only write to AlphaBuffer (since RGB may be the current rendered scene!), with Alpha==1 when pixel is shadowed. The ShadowMapManager has already cleared the AlphaBuffer to black, and has already enabled alpha write only. The ShadowMapManager has already setuped Viewport/Scissor as its convenience. The extra blurring is a work of the ShadowMapManager (which blurs multiple shadows in a same pass) NB: you can overwrite the current driver frustum/ViewMatrix/modelMatrix without backuping it (ShadowMapManager work) Reimplemented from NL3D::CTransform. Definition at line 1781 of file skeleton_model.cpp. References NL3D::CShadowMap::buildCasterCameraMatrix(), NL3D::CShadowMap::buildProjectionInfos(), computeWorldBBoxForShadow(), NL3D::CRenderTrav::getAuxDriver(), NL3D::CShadowMapManager::getCasterShadowMaterial(), NLMISC::CAABBox::getCenter(), NLMISC::CAABBox::getHalfSize(), NL3D::CTransform::getOwnerScene(), NLMISC::CMatrix::getPos(), NL3D::ITransformable::getPos(), NL3D::CScene::getRenderTrav(), NL3D::CRenderTrav::getShadowMapManager(), NL3D::CTransform::getWorldMatrix(), H_AUTO, NLMISC::CMatrix::inverted(), NLMISC::CVector::normalize(), renderIntoSkeletonShadowMap(), NL3D::IDriver::setFrustum(), NLMISC::CMatrix::setPos(), NL3D::IDriver::setupViewMatrix(), updateShadowMap(), NLMISC::CVector::x, NLMISC::CVector::y, and NLMISC::CVector::z.
01782 { 01783 H_AUTO( NL3D_Skeleton_GenerateShadow ); 01784 01785 // get the driver for Texture Render 01786 CScene *scene= getOwnerScene(); 01787 CRenderTrav &renderTrav= scene->getRenderTrav(); 01788 IDriver *driver= renderTrav.getAuxDriver(); 01789 01790 if(!Shape) 01791 return; 01792 01793 // update ShadowMap data if needed. 01794 // **** 01795 updateShadowMap(driver); 01796 01797 // compute the ProjectionMatrix. 01798 // **** 01799 01800 // Compute the BBox in World, with bounding Box of Bones, and with BoundingBox of sticked Objects 01801 CAABBox bbWorld; 01802 computeWorldBBoxForShadow(bbWorld); 01803 01804 01805 // Here the bbox is defined in world, hence must remove the World Pos. 01806 CMatrix localPosMatrix; 01807 localPosMatrix.setPos(-getWorldMatrix().getPos()); 01808 01809 // setup cameraMatrix with BBox and Enlarge For 1 pixel 01810 CMatrix cameraMatrix; 01811 _ShadowMap->buildCasterCameraMatrix(lightDir, localPosMatrix, bbWorld, cameraMatrix); 01812 01813 01814 // Render. 01815 // **** 01816 // setup the orhtogonal frustum and viewMatrix to include all the object. 01817 driver->setFrustum(0,1,0,1,0,1,false); 01818 driver->setupViewMatrix(cameraMatrix.inverted()); 01819 01820 // render the Skinned meshs, and also the Sticked Objects/Skeletons 01821 CMaterial &castMat= renderTrav.getShadowMapManager().getCasterShadowMaterial(); 01822 renderIntoSkeletonShadowMap(this, castMat); 01823 01824 // Infos. 01825 // **** 01826 01827 // Compute the BackPoint: the first point to be shadowed. 01828 CVector backPoint= bbWorld.getCenter(); 01829 // get the 3/4 bottom of the shape 01830 backPoint.z-= bbWorld.getHalfSize().z/2; 01831 // Use the 3/4 bottom of the BBox minus the light direction in XY. 01832 CVector ldir= lightDir; 01833 ldir.z= 0; 01834 ldir.normalize(); 01835 // NB: This way seems to works quite well, even if the worldBBox is changing every frame. 01836 float lenXY= (CVector(bbWorld.getHalfSize().x, bbWorld.getHalfSize().y, 0)).norm(); 01837 backPoint-= ldir*lenXY; 01838 // localPos. 01839 backPoint-= getWorldMatrix().getPos(); 01840 01841 // Compute LocalProjectionMatrix and other infos from cameraMatrix and backPoint? 01842 _ShadowMap->buildProjectionInfos(cameraMatrix, backPoint, scene); 01843 } |
|
Get the untransformed AABBox of the mesh. NULL (gtSize()==0) if no mesh. Reimplemented from NL3D::CTransform. Reimplemented in NL3D::CParticleSystemModel. Definition at line 83 of file transform_shape.cpp. References NLMISC::CAABBox::setCenter(), NLMISC::CAABBox::setHalfSize(), and NL3D::CTransformShape::Shape. Referenced by NL3D::CTransformShape::getLightHotSpotInWorld(), NL3D::CInstanceUser::getShapeAABBox(), NL3D::CQuadGridClipManager::linkModel(), and NL3D::CClipTrav::traverse().
00084 { 00085 if(Shape) 00086 { 00087 Shape->getAABBox(bbox); 00088 } 00089 else 00090 { 00091 bbox.setCenter(CVector::Null); 00092 bbox.setHalfSize(CVector::Null); 00093 } 00094 } |
|
if Bones[boneId] is "Computed" (usage/lod), return Bones[boneId].getBoneSkinMatrix() else return parent ones (recurs, but precomputed) Definition at line 487 of file skeleton_model.cpp. References _BoneUsage, Bones, and uint. Referenced by NL3D::computeBoneMatrixes3x4(), and NL3D::CMeshGeom::computeSkinMatrixes().
00488 { 00489 // Get me or first father with MustCompute==true. 00490 uint validBoneId= _BoneUsage[boneId].ValidBoneSkinMatrix; 00491 // return his WorldMatrix. 00492 return Bones[validBoneId].getBoneSkinMatrix(); 00493 } |
|
Definition at line 207 of file transform.h. References NL3D::CTransform::_AncestorSkeletonModel. Referenced by NL3D::CParticleSystemManager::processAnimate().
00207 { return _AncestorSkeletonModel; } |
|
Definition at line 1764 of file skeleton_model.cpp. Referenced by NL3D::CSkeletonUser::getBoneAnimCtrl().
|
|
return, from skeleton shape, the BoneIdByName. -1 if not here.
Definition at line 629 of file skeleton_model.cpp. References NL3D::CSkeletonShape::getBoneIdByName(), and sint32. Referenced by NL3D::CMeshMRMSkinnedGeom::computeBonesId(), NL3D::CMeshMRMGeom::computeBonesId(), NL3D::CMeshGeom::computeBonesId(), and NL3D::CSkeletonUser::getBoneIdByName().
00630 { 00631 CSkeletonShape *shp= safe_cast<CSkeletonShape*>((IShape*)Shape); 00632 return shp->getBoneIdByName(name); 00633 } |
|
get the channelMixer owned by the transform. return result of a refPtr => may be NULL. Definition at line 641 of file transform.h. Referenced by computeCurrentBBox(), NL3D::CMeshBaseInstance::traverseHrc(), and updateBoneToCompute().
00641 {return _ChannelMixer;}
|
|
Definition at line 257 of file transform.h. References NL3D::CTransform::getStateFlag(), and NL3D::CTransform::IsDeleteChannelMixer. Referenced by NL3D::CTransform::registerToChannelMixer(), and NL3D::CTransform::~CTransform().
00257 { return getStateFlag(IsDeleteChannelMixer)!=0; } |
|
Definition at line 320 of file transform.h. References NL3D::CTransform::_ClusterSystem. Referenced by NL3D::CScene::findCameraClusterSystemFromRay(), and NL3D::CClipTrav::traverse().
00320 { return _ClusterSystem; }
|
|
Default Track Values are identity (pos,pivot= 0, scale= 1, rots=0).
Implements NL3D::ITransformable. Reimplemented in NL3D::CCamera, NL3D::CMeshBaseInstance, NL3D::CParticleSystemModel, NL3D::CSegRemanence, NL3D::CWaterModel, and NL3D::CWaveMakerModel. Definition at line 311 of file transform.cpp.
00312 { 00313 // Cyril: prefer do it here in CTransform, because of CCamera, CLight etc... (which may not need a default value too!!) 00314 00315 // what value ? 00316 switch (valueId) 00317 { 00318 case PosValue: return &DefaultPos; 00319 case RotEulerValue: return &DefaultRotEuler; 00320 case RotQuatValue: return &DefaultRotQuat; 00321 case ScaleValue: return &DefaultScale; 00322 case PivotValue: return &DefaultPivot; 00323 } 00324 00325 // No, only ITrnasformable values! 00326 nlstop; 00327 // Deriver note: else call BaseClass::getDefaultTrack(valueId); 00328 00329 return NULL; 00330 00331 } |
|
Definition at line 135 of file transform_shape.h. Referenced by NL3D::CQuadGridClipCluster::addModel(), NL3D::CTransformShape::clip(), and NL3D::CInstanceUser::getDistMax().
00135 { return _DistMax; }
|
|
Definition at line 538 of file transform.h. References NL3D::CTransform::ForceClipRoot, and NL3D::CTransform::getStateFlag(). Referenced by NL3D::CTransformUser::getForceClipRoot().
00538 { return getStateFlag(ForceClipRoot) != 0; } |
|
see setInterpolationDistance()
Definition at line 648 of file skeleton_model.cpp. References _LodInterpMultiplier. Referenced by NL3D::CSkeletonUser::getInterpolationDistance().
00649 { 00650 if(_LodInterpMultiplier==0) 00651 return 0.f; 00652 else 00653 return 1.f / _LodInterpMultiplier; 00654 } |
|
Return the current light contribution of this model Definition at line 373 of file transform.h. References NL3D::CTransform::_LightContribution. Referenced by NL3D::CShadowMapManager::computeShadowColors(), and NL3D::CShadowMapManager::computeShadowDirection().
00373 { return _LightContribution; } |
|
Reimplemented in NL3D::CMeshMultiLodInstance. Definition at line 155 of file transform_shape.h. Referenced by NL3D::CTransformShape::traverseRender(), and NL3D::CParticleSystemModel::traverseRender().
00155 { return _LightContribution;} |
|
get the HotSpot of the model for Light computation. For models with global attenuation, this is the point taken for attenuation computes. NB: should return the current world position. NB: return also the modelRadius (only for bigLightable) Default to NULL. Reimplemented from NL3D::CTransformShape. Definition at line 1722 of file skeleton_model.cpp. References Bones, NLMISC::CMatrix::getPos(), and isBoneComputed().
01723 { 01724 // If the bone 0 is computed (pelvis), then return its worldMatrix 01725 if(isBoneComputed(0)) 01726 { 01727 modelPos= Bones[0].getWorldMatrix().getPos(); 01728 } 01729 else 01730 { 01731 /* Else return the skeleton pos. NB: this seems unusefull since bone 0 not computed means no Skins. 01732 But lighting computation is still done and may use a VisualCollisionEntity. 01733 This system cache some infos according to position. This is why we must return a position 01734 near the skeleton (else cache crash each frame => slowdown...) 01735 */ 01736 modelPos= _WorldMatrix.getPos(); 01737 } 01738 01739 // Consider Skeletons as not big lightable 01740 modelRadius= 0; 01741 } |
|
Get the load Balancing group of a model. see setLoadBalancingGroup(). Definition at line 532 of file transform.cpp. References NL3D::CTransform::_LoadBalancingGroup, and NL3D::CLoadBalancingGroup::Name.
00533 { 00534 // get the group name 00535 return _LoadBalancingGroup->Name; 00536 } |
|
Called in ClipTrav pass. Used to update the flag _DisplayedAsLodCharacter. return 0 if CLod not enabled. Else return a priority>0 computed from curDistance/LodCharacterDistance return 0 too if the skeleton is not visible or if his ancestorSkeletonModel is not visible. If priority is >1 then the skeleton must be displayed in CLod form Definition at line 247 of file skeleton_model.h. References _CLodInstance, NL3D::CLodCharacterInstance::AnimId, and uint. Referenced by NL3D::CSkeletonUser::getLodCharacterAnimId().
00247 {return _CLodInstance.AnimId;} |
|
Called in ClipTrav pass. Used to update the flag _DisplayedAsLodCharacter. return 0 if CLod not enabled. Else return a priority>0 computed from curDistance/LodCharacterDistance return 0 too if the skeleton is not visible or if his ancestorSkeletonModel is not visible. If priority is >1 then the skeleton must be displayed in CLod form Definition at line 249 of file skeleton_model.h. References _CLodInstance, NL3D::CLodCharacterInstance::AnimTime, and NL3D::TGlobalAnimationTime. Referenced by NL3D::CSkeletonUser::getLodCharacterAnimTime().
00249 {return _CLodInstance.AnimTime;} |
|
see setLodCharacterDistance. 0 if disabled
Definition at line 267 of file skeleton_model.h. References _LodCharacterDistance. Referenced by NL3D::CSkeletonUser::getLodCharacterDistance().
00267 {return _LodCharacterDistance;} |
|
see setLodCharacterShape
Definition at line 243 of file skeleton_model.h. References _CLodInstance, NL3D::CLodCharacterInstance::ShapeId, and sint. Referenced by NL3D::CSkeletonUser::getLodCharacterShape().
00243 {return _CLodInstance.ShapeId;} |
|
Called in ClipTrav pass. Used to update the flag _DisplayedAsLodCharacter. return 0 if CLod not enabled. Else return a priority>0 computed from curDistance/LodCharacterDistance return 0 too if the skeleton is not visible or if his ancestorSkeletonModel is not visible. If priority is >1 then the skeleton must be displayed in CLod form Definition at line 253 of file skeleton_model.h. References _CLodInstance, and NL3D::CLodCharacterInstance::WrapMode. Referenced by NL3D::CSkeletonUser::getLodCharacterWrapMode().
00253 {return _CLodInstance.WrapMode;} |
|
Get a material of the transform shape Reimplemented in NL3D::CMeshBaseInstance. Definition at line 127 of file transform_shape.cpp. References uint.
00128 {
00129 return NULL;
00130 }
|
|
Get a material of the transform shape Reimplemented in NL3D::CMeshBaseInstance. Definition at line 120 of file transform_shape.cpp. References uint.
00121 {
00122 return NULL;
00123 }
|
|
Get the matrix, compute her if necessary (work in all modes).
Definition at line 76 of file transformable.h. References NL3D::ITransformable::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 NL3D::ITransformable::_LocalMatrixDate, uint64, and NL3D::ITransformable::updateMatrix(). Referenced by NL3D::CWaterModel::updateDiffuseMapMatrix().
00091 { 00092 updateMatrix(); 00093 return _LocalMatrixDate; 00094 } |
|
see setMeanColor()
Definition at line 437 of file transform.h. References NL3D::CTransform::_MeanColor.
00437 {return _MeanColor;}
|
|
If the model support MRM, return the level detail setup. default is return NULL.
Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 114 of file transform_shape.h. Referenced by updateSkinRenderLists().
00114 {return NULL;}
|
|
return the number of bones currently animated/computed (because of bindSkin()/stickObject() / Lod system).
Definition at line 191 of file skeleton_model.h. References _BoneToCompute, and uint.
00191 {return _BoneToCompute.size();} |
|
Get the count of material in this transform shape Reimplemented in NL3D::CMeshBaseInstance. Definition at line 113 of file transform_shape.cpp. References uint.
00114 {
00115 return 0;
00116 }
|
|
Special version for skins.
Reimplemented from NL3D::CTransformShape. Definition at line 1578 of file skeleton_model.cpp. References NL3D::CMRMLevelDetail::getNumTriangles(), and isDisplayedAsLodCharacter().
01579 { 01580 // If the skeleton is displayed as a CLod suppose 0 triangles. 01581 if( isDisplayedAsLodCharacter() ) 01582 return 0; 01583 else 01584 // NB: this is an approximation, but this is continious. 01585 return _LevelDetail.getNumTriangles(distance); 01586 } |
|
get an approximation of the number of triangles this instance should render. This method is valid only for IShape classes (in render()), after LoadBalancing traversal is performed. NB: It is not guaranted that this instance will render those number of triangles. Definition at line 111 of file transform_shape.h. References NL3D::CTransformShape::_NumTrianglesAfterLoadBalancing. Referenced by NL3D::CParticleSystemModel::doAnimate(), NL3D::CMeshMRMSkinned::profileSceneRender(), NL3D::CMeshMRM::profileSceneRender(), NL3D::CMeshMRMSkinned::render(), NL3D::CMeshMRM::render(), renderSkins(), NL3D::CMeshMRM::supportMeshBlockRendering(), and NL3D::CMeshMultiLodInstance::traverseLoadBalancing().
00111 {return _NumTrianglesAfterLoadBalancing;}
|
|
Get the ordering layer.
Definition at line 187 of file transform.h. References NL3D::CTransform::_OrderingLayer, and uint. Referenced by NL3D::CTransformUser::getOrderingLayer(), and NL3D::CRenderTrav::traverse().
00187 { return _OrderingLayer; }
|
|
|
Work only in Rot* mode (nlassert).
Definition at line 255 of file transformable.h. References NL3D::ITransformable::_Pivot, nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.
00256 { 00257 nlassert(_Mode==RotEuler || _Mode==RotQuat); 00258 return _Pivot.Value; 00259 } |
|
Work only in Rot* mode (nlassert).
Definition at line 224 of file transformable.h. References NL3D::ITransformable::_Pivot, nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::CTransformableUser::getPivot().
00225 { 00226 nlassert(_Mode==RotEuler || _Mode==RotQuat); 00227 pivot= _Pivot.Value; 00228 } |
|
Definition at line 117 of file transformable.cpp. Referenced by NL3D::ITransformable::getValueName().
00118 { 00119 return "pivot"; 00120 } |
|
Work only in Rot* mode(nlassert).
Definition at line 231 of file transformable.h. References nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by generateShadowMap(), NL3D::CWaterModel::getHeight(), renderIntoSkeletonShadowMap(), NL3D::CMeshInstance::renderIntoSkeletonShadowMap(), and NL3D::CPointLightModel::traverseLight().
00232 { 00233 nlassert(_Mode==RotEuler || _Mode==RotQuat); 00234 return _Pos.Value; 00235 } |
|
Work only in Rot* mode(nlassert).
Definition at line 200 of file transformable.h. References nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::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 } |
|
Definition at line 97 of file transformable.cpp. Referenced by NL3D::ITransformable::getValueName().
00098 { 00099 return "pos"; 00100 } |
|
For receivers. get the World Instance bbox that includes the receiver. Reimplemented in NL3D::CLandscapeModel. Definition at line 1328 of file transform.cpp. References NLMISC::CAABBox::setCenter(), and NLMISC::CAABBox::setHalfSize(). Referenced by NL3D::CShadowMapManager::addShadowReceiver().
01329 { 01330 bbox.setCenter(CVector::Null); 01331 bbox.setHalfSize(CVector::Null); 01332 } |
|
For receivers. Retrieve the WorldMatrix of the model used for IDriver::render(). By default it returns getWorldMatrix(). The exception is the Landscape and his "ZBuffer Problem" management. Reimplemented in NL3D::CLandscapeModel. Definition at line 511 of file transform.h. References NL3D::CTransform::getWorldMatrix(). Referenced by NL3D::CShadowMapManager::renderProject().
00511 {return getWorldMatrix();} |
|
Definition at line 70 of file smart_ptr.h. References NLMISC::CRefCount::crefs, and sint.
00071 { 00072 return crefs; 00073 } |
|
Work only in RotEuler mode(nlassert).
Definition at line 237 of file transformable.h. References NL3D::ITransformable::_RotEuler, nlassert, NL3D::ITransformable::RotEuler, and NL3D::CAnimatedValueBlendable< T >::Value.
00238 { 00239 nlassert(_Mode==RotEuler); 00240 return _RotEuler.Value; 00241 } |
|
Work only in RotEuler mode(nlassert).
Definition at line 206 of file transformable.h. References NL3D::ITransformable::_RotEuler, nlassert, NL3D::ITransformable::RotEuler, and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::CTransformableUser::getRotEuler().
00207 { 00208 nlassert(_Mode==RotEuler); 00209 rot= _RotEuler.Value; 00210 } |
|
Definition at line 102 of file transformable.cpp. Referenced by NL3D::ITransformable::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 NL3D::ITransformable::_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 NL3D::ITransformable::_RotQuat, nlassert, NL3D::ITransformable::RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.
00244 { 00245 nlassert(_Mode==RotQuat); 00246 return _RotQuat.Value; 00247 } |
|
Work only in RotQuat mode (nlassert).
Definition at line 212 of file transformable.h. References NL3D::ITransformable::_RotQuat, nlassert, NL3D::ITransformable::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 } |
|
Definition at line 107 of file transformable.cpp. Referenced by NL3D::ITransformable::getValueName().
00108 { 00109 return "rotquat"; 00110 } |
|
Work only in Rot* mode (nlassert).
Definition at line 249 of file transformable.h. References nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, and NL3D::CAnimatedValueBlendable< T >::Value.
00250 { 00251 nlassert(_Mode==RotEuler || _Mode==RotQuat); 00252 return _Scale.Value; 00253 } |
|
Work only in Rot* mode (nlassert).
Definition at line 218 of file transformable.h. References nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::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 } |
|
Definition at line 112 of file transformable.cpp. Referenced by NL3D::ITransformable::getValueName().
00113 { 00114 return "scale"; 00115 } |
|
get The shadow Map result for receveing. If NULL, nothing is displayed. Reimplemented from NL3D::CTransform. Definition at line 1846 of file skeleton_model.cpp. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps().
01847 { 01848 return _ShadowMap; 01849 } |
|
Test if obj must be displayed when sticked to an object displayed as a LOD (example: sword in hand of a character displayed as a LOD state).
Definition at line 680 of file transform.h. References NL3D::CTransform::_ForceCLodSticked. Referenced by NL3D::CParticleSystemModel::traverseClip().
00680 { return _ForceCLodSticked; }
|
|
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty
Definition at line 458 of file skeleton_model.h. Referenced by renderCLod().
00458 {return _LightContribution;} |
|
Get the skeleton model. Returnr NULL in normal mode.
Definition at line 205 of file transform.h. References NL3D::CTransform::_FatherSkeletonModel. Referenced by NL3D::CMeshMRMSkinnedGeom::render(), NL3D::CMeshMRMGeom::render(), NL3D::CMeshGeom::render(), NL3D::CMeshMRMSkinnedGeom::renderShadowSkinGeom(), NL3D::CMeshMRMGeom::renderShadowSkinGeom(), NL3D::CMeshMRMGeom::renderSkin(), NL3D::CMeshGeom::renderSkin(), NL3D::CMeshMRMSkinnedGeom::renderSkinGroupGeom(), NL3D::CMeshMRMGeom::renderSkinGroupGeom(), and NL3D::CTransformShape::traverseLoadBalancingPass0().
00205 {return _FatherSkeletonModel;} |
|
Deriver must change this method if isSkinnable(). It return a list of sphere relative to each bone of the father skeleton. Use with getSkinBoneUsage() to know to wich bone this sphere apply NB: if a sphere radius is -1, it means that the bone is not used (for any reason...) default is to return NULL. Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 584 of file transform.h. Referenced by updateSkinRenderLists().
00584 {return NULL;}
|
|
Deriver must change this method if isSkinnable(). It return the list of bone (correct skeleton index) used by the skins (NB: without the parents of the bone). NB: if an index is -1, it means that the skin bone has not been found in the skeleton (skip it) default is to return NULL. Reimplemented in NL3D::CMeshInstance, NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 578 of file transform.h. Referenced by computeCLodVertexAlpha(), and updateSkinRenderLists().
00578 {return NULL;}
|
|
get the current transform mode.
Definition at line 189 of file transformable.h. References NL3D::ITransformable::TTransformMode. Referenced by NL3D::CTargetAnimCtrl::execute(), and NL3D::CTransformableUser::getTransformMode().
00190 {
00191 return _Mode;
00192 }
|
|
Return the user clipping state.
Definition at line 1316 of file transform.cpp. References NL3D::CTransform::getStateFlag(), and NL3D::CTransform::UserClipping. Referenced by NL3D::CTransformUser::getUserClipping().
01317 { 01318 return getStateFlag(UserClipping) != 0; 01319 } |
|
Get the UserLightable flag. Definition at line 347 of file transform.h. References NL3D::CTransform::getStateFlag(), and NL3D::CTransform::IsUserLightable. Referenced by NL3D::CTransformUser::getUserLightable().
00347 {return getStateFlag(IsUserLightable)!=0;} |
|
From IAnimatable.
Implements NL3D::IAnimatable. Reimplemented in NL3D::CCamera, and NL3D::CParticleSystemModel. Definition at line 58 of file transformable.cpp. References NL3D::ITransformable::_Pivot, NL3D::ITransformable::_RotEuler, NL3D::ITransformable::_RotQuat, nlstop, NL3D::ITransformable::PivotValue, NL3D::ITransformable::PosValue, NL3D::ITransformable::RotEulerValue, NL3D::ITransformable::RotQuatValue, NL3D::ITransformable::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 } |
|
|
Get the local visibility state.
Definition at line 203 of file transform.h. References NL3D::CTransform::Visibility. Referenced by NL3D::CTransformUser::getVisibility(), NL3D::CParticleSystemManager::processAnimate(), NL3D::CMeshMRMSkinnedInstance::renderSkin(), NL3D::CMeshMRMInstance::renderSkin(), NL3D::CMeshInstance::renderSkin(), NL3D::CParticleSystemModel::traverseAnimDetail(), and updateSkinRenderLists().
00203 {return Visibility;}
|
|
|
herit the visibility from his father. (default behavior).
Definition at line 287 of file transform.cpp. References NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_TransformDirty, dirtSkinRenderLists(), NL3D::CTransform::isSkinned(), nlassert, and NL3D::CTransform::Visibility. Referenced by NL3D::CTransformUser::heritVisibility().
00288 { 00289 // Optim: do nothing if already set 00290 if(Visibility!= CHrcTrav::Herit) 00291 { 00292 _TransformDirty= true; 00293 Visibility= CHrcTrav::Herit; 00294 // If skinned, then must inform skeleton parent that it must recompute skin render/animDetail lists 00295 if(isSkinned()) 00296 { 00297 nlassert(_FatherSkeletonModel); 00298 _FatherSkeletonModel->dirtSkinRenderLists(); 00299 } 00300 } 00301 } |
|
Hide the object and his sons.
Definition at line 223 of file transform.cpp. References NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_TransformDirty, dirtSkinRenderLists(), NL3D::CTransform::isSkinned(), nlassert, and NL3D::CTransform::Visibility. Referenced by NL3D::CTransformUser::hide(), NL3D::CLandscapeUser::hide(), NL3D::CPSMesh::newElement(), and NL3D::CPSMesh::updatePos().
00224 { 00225 // Optim: do nothing if already set 00226 if(Visibility!= CHrcTrav::Hide) 00227 { 00228 _TransformDirty= true; 00229 Visibility= CHrcTrav::Hide; 00230 // If skinned, then must inform skeleton parent that it must recompute skin render/animDetail lists 00231 if(isSkinned()) 00232 { 00233 nlassert(_FatherSkeletonModel); 00234 _FatherSkeletonModel->dirtSkinRenderLists(); 00235 } 00236 } 00237 } |
|
Definition at line 1202 of file transform.cpp. References NL3D::CTransform::_HrcSons, index, nlassert, NL3D::CFastPtrList< CTransform >::size(), and uint. Referenced by NL3D::CTransform::traverseHrc(), NL3D::CRootModel::traverseHrc(), NL3D::CAnimDetailTrav::traverseHrcRecurs(), and NL3D::CTransform::~CTransform().
|
|
Definition at line 220 of file transform.h. References NL3D::CTransform::_HrcSons, NL3D::CFastPtrList< CTransform >::size(), and uint. Referenced by NL3D::CTransform::traverseHrc(), NL3D::CRootModel::traverseHrc(), NL3D::CAnimDetailTrav::traverseHrcRecurs(), and NL3D::CTransform::~CTransform().
00220 {return _HrcSons.size();}
|
|
Definition at line 218 of file transform.h. References NL3D::CTransform::_HrcParent. Referenced by NL3D::CMeshBaseInstance::traverseHrc(), and NL3D::CTransform::updateWorldMatrixFromFather().
00218 {return _HrcParent;}
|
|
link son to this in Hierarchy traversal NB: link does nothing if the son node is HRC frozen Definition at line 1151 of file transform.cpp. References NL3D::CTransform::_FreezeHRCState, NL3D::CTransform::_HrcNode, NL3D::CTransform::_HrcParent, NL3D::CTransform::_HrcParentUnfreeze, NL3D::CTransform::_HrcSons, NL3D::CTransform::_WorldDate, NL3D::CTransform::hrcUnlink(), and NL3D::CFastPtrList< CTransform >::insert(). Referenced by NL3D::CInstanceGroup::addToSceneWhenAllShapesLoaded(), NL3D::CScene::createModel(), detachSkeletonSon(), NL3D::CInstanceGroup::linkRoot(), NL3D::CTransform::setForceClipRoot(), stickObjectEx(), and NL3D::CTransform::unfreezeHRC().
01152 { 01153 if(!son) 01154 return; 01155 01156 // If not unfrozen, can't link 01157 if (son->_FreezeHRCState != CTransform::FreezeHRCStateDisabled) 01158 return; 01159 01160 // no-op if already me. 01161 if(son->_HrcParent==this) 01162 return; 01163 01164 // unlink from anyone 01165 son->hrcUnlink(); 01166 01167 // link son to me 01168 _HrcSons.insert(son, &son->_HrcNode); 01169 01170 // link me to son 01171 son->_HrcParent= this; 01172 01173 // Backup parent 01174 son->_HrcParentUnfreeze= this; 01175 01176 // my son should recompute his worldMatrix! 01177 son->_WorldDate= -1; 01178 } |
|
unlink this from any Father in Hrc. No-op if no parent NB: unlink does nothing if the node is HRC frozen Definition at line 1181 of file transform.cpp. References NL3D::CTransform::_HrcNode, NL3D::CTransform::_HrcParent, NL3D::CTransform::_HrcParentUnfreeze, NL3D::CTransform::_WorldDate, NL3D::CTransform::ForceClipRoot, NL3D::CTransform::getStateFlag(), nlassert, and NL3D::CFastPtrListNode::unlink(). Referenced by bindSkin(), NL3D::CTransform::hrcLinkSon(), NL3D::CScene::initDefaultRoots(), NL3D::CScene::initQuadGridClipManager(), NL3D::CTransform::setForceClipRoot(), NL3D::CTransform::update(), and NL3D::CTransform::~CTransform().
01182 { 01183 // no-op if already NULL 01184 if(_HrcParent==NULL) 01185 return; 01186 01187 // if ForceClipRoot flag is set, then the fx can't be linked elsewhere in the hierarchy 01188 nlassert(!getStateFlag(ForceClipRoot)); 01189 01190 // unlink my parent from me. 01191 _HrcNode.unlink(); 01192 01193 // unlink me from parent 01194 _HrcParent= NULL; 01195 _HrcParentUnfreeze= NULL; 01196 01197 // I should recompute my worldMatrix (well not usefull since not linked, but still do it...) 01198 _WorldDate= -1; 01199 } |
|
increment the refCount of the ith bone. set boneUsageType to UsageNormal if enable Skeleton Bone degradation (skins) Forced usage are for Sticked objects Definition at line 189 of file skeleton_model.cpp. References _BoneToComputeDirty, _BoneUsage, nlassert, uint, uint8, UsageForced, and UsageNormal. Referenced by incForcedBoneUsageAndParents(), NL3D::CMeshMRMSkinnedGeom::updateSkeletonUsage(), NL3D::CMeshMRMGeom::updateSkeletonUsage(), and NL3D::CMeshGeom::updateSkeletonUsage().
00190 { 00191 nlassert(i<_BoneUsage.size()); 00192 00193 // Get ptr on according refCount 00194 uint8 *usagePtr; 00195 if(boneUsageType == UsageNormal) 00196 usagePtr= &_BoneUsage[i].Usage; 00197 else if(boneUsageType == UsageForced) 00198 usagePtr= &_BoneUsage[i].ForcedUsage; 00199 else 00200 usagePtr= &_BoneUsage[i].CLodForcedUsage; 00201 00202 // If the bone was not used before, must update MustCompute. 00203 if(*usagePtr==0) 00204 _BoneToComputeDirty= true; 00205 00206 // Inc the refCount of the bone. 00207 nlassert(*usagePtr<255); 00208 (*usagePtr)++; 00209 } |
|
increment the refCount of the ith bone and its parents. for stickObjects.
Definition at line 253 of file skeleton_model.cpp. References Bones, incBoneUsage(), sint, and uint. Referenced by stickObjectEx().
00254 { 00255 // inc forced. 00256 incBoneUsage(i, forceCLod?UsageCLodForced:UsageForced ); 00257 00258 // recurs to father 00259 sint fatherId= Bones[i].getFatherId(); 00260 // if not a root bone... 00261 if(fatherId>=0) 00262 incForcedBoneUsageAndParents(fatherId, forceCLod); 00263 } |
|
called by CSkeletonShape::createInstance(). init the vector.
Definition at line 165 of file skeleton_model.cpp. References _BoneToCompute, _BoneToComputeDirty, _BoneUsage, _CurLod, _CurLodInterp, _LodInterpMultiplier, Bones, and uint. Referenced by NL3D::CSkeletonShape::createInstance().
00166 { 00167 // reset all to 0. 00168 _BoneUsage.resize(Bones.size()); 00169 for(uint i=0; i<_BoneUsage.size(); i++) 00170 { 00171 _BoneUsage[i].Usage= 0; 00172 _BoneUsage[i].ForcedUsage= 0; 00173 _BoneUsage[i].CLodForcedUsage= 0; 00174 _BoneUsage[i].MustCompute= 0; 00175 _BoneUsage[i].ValidBoneSkinMatrix= 0; 00176 } 00177 // reserve space for bone to compute 00178 _BoneToCompute.reserve(Bones.size()); 00179 00180 _BoneToComputeDirty= false; 00181 _CurLod= 0; 00182 _CurLodInterp= 1.f; 00183 // Default is 0.5 meters. 00184 _LodInterpMultiplier= 1.f / 0.5f; 00185 } |
|
Build link to traversals.
Reimplemented from NL3D::CTransform. Definition at line 154 of file skeleton_model.cpp. References _ItSkeletonInScene, NL3D::CScene::appendSkeletonModelToList(), and NL3D::CTransform::getOwnerScene().
00155 { 00156 // Link this skeleton to the CScene. 00157 _ItSkeletonInScene= getOwnerScene()->appendSkeletonModelToList(this); 00158 00159 // Call base class 00160 CTransformShape::initModel(); 00161 } |
|
non-zero if the model is animDetailable (ie added to the animDetail list if visible)
Definition at line 440 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsAnimDetailable, and uint32. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), NL3D::CTransform::traverseClip(), and updateSkinRenderLists().
00440 {return getStateFlag(IsAnimDetailable);} |
|
non-zero if the lighting Manager must take into account the bbox of the transform. Default behavior is false. Deriver must call setIsBigLightable() at initialisation to change it. Definition at line 365 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsBigLightable, and uint32. Referenced by NL3D::CTransformShape::getLightHotSpotInWorld().
00365 {return getStateFlag(IsBigLightable);} |
|
Tell if a bone has been computed in the last frame or not. false if boneId is invalid.
Definition at line 374 of file skeleton_model.cpp. References _BoneUsage, NL3D::CTransform::isClipVisible(), and uint. Referenced by computeRenderedBBox(), getLightHotSpotInWorld(), and NL3D::CSkeletonUser::isBoneComputed().
00375 { 00376 if(boneId>=_BoneUsage.size()) 00377 return false; 00378 else 00379 return _BoneUsage[boneId].MustCompute!=0 && isClipVisible(); 00380 } |
|
tells if the transform has been clipped in the clip traversal. Definition at line 313 of file transform.h. References NL3D::CTransform::_Visible. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), computeDisplayLodCharacterPriority(), computeRenderedBBox(), NL3D::CTransformUser::getLastClippedState(), isBoneComputed(), NL3D::CParticleSystemManager::processAnimate(), NL3D::CTransform::traverseClip(), NL3D::CParticleSystemModel::traverseClip(), and NL3D::CPointLightModel::traverseLight().
00314 { 00315 return _Visible; 00316 } |
|
non-zero if the CTransform can be casted to a CCluster
Definition at line 451 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsCluster, and uint32. Referenced by NL3D::CClipTrav::traverse().
00451 {return getStateFlag(IsCluster);} |
|
True if the skeleton model and his skins are to be displayed with a CLodCharacterShape, instead of the std way This state is modified early during the HRC Traversal. Because Clip traversal need this result. Definition at line 259 of file skeleton_model.h. References _DisplayedAsLodCharacter. Referenced by getNumTriangles(), NL3D::CSkeletonUser::isDisplayedAsLodCharacter(), traverseAnimDetail(), NL3D::CTransform::traverseClip(), NL3D::CParticleSystemModel::traverseClip(), traverseRender(), and updateBoneToCompute().
00259 {return _DisplayedAsLodCharacter;} |
|
true if the instance cast shadow. By default false
Definition at line 515 of file transform.h. References NL3D::CTransform::getStateFlag(), and NL3D::CTransform::IsGeneratingShadowMap. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), and traverseAnimDetail().
00515 {return getStateFlag(IsGeneratingShadowMap)!=0;} |
|
tells if the transform has been determined as visible in the hrc traversal Reimplemented in NL3D::CPointLightModel. Definition at line 306 of file transform.h. References NL3D::CTransform::_WorldVis. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), computeWorldBBoxForShadow(), NL3D::CMeshInstance::computeWorldBBoxForShadow(), NL3D::CTransformUser::getLastWorldVisState(), renderIntoSkeletonShadowMap(), NL3D::CMeshInstance::renderIntoSkeletonShadowMap(), and traverseAnimDetail().
00307 { 00308 return _WorldVis; 00309 } |
|
true if the model can be lighted (such as CMeshBaseInstance) Default behavior is false. Deriver must use setIsLightable(true) method if the instance can be lighted.
Definition at line 337 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsFinalLightable, and uint32. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), NL3D::CTransform::traverseClip(), NL3D::CTransformShape::traverseRender(), NL3D::CTransform::unfreezeHRC(), NL3D::CTransform::update(), and NL3D::CTransform::updateWorld().
00337 {return getStateFlag(IsFinalLightable);} |
|
true if the model is linked to a quadCluster
Definition at line 141 of file transform_shape.h. References NL3D::CTransformShape::_QuadClusterListNode, and NL3D::CFastPtrListNode::isLinked().
00141 {return _QuadClusterListNode.isLinked();}
|
|
non-zero if the model is loadBalancable (ie added to the loadBalancing list if visible)
Definition at line 442 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsLoadBalancable, and uint32. Referenced by NL3D::CTransform::traverseClip().
00442 {return getStateFlag(IsLoadBalancable);} |
|
non-zero if the CTransform can be casted to a CMeshBaseInstance
Definition at line 447 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsMeshBaseInstance, and uint32. Referenced by NL3D::CInstanceUser::enableAsyncTextureMode(), NL3D::CInstanceUser::getAsyncTextureDistance(), NL3D::CInstanceUser::getAsyncTextureMode(), NL3D::CInstanceUser::isAsyncTextureDirty(), NL3D::CInstanceUser::isAsyncTextureReady(), NL3D::CInstanceUser::setAsyncTextureDirty(), NL3D::CInstanceUser::setAsyncTextureDistance(), and NL3D::CInstanceUser::startAsyncTextureLoading().
00447 {return getStateFlag(IsMeshBaseInstance);} |
|
non-zero if the object has a FrozenStaticLightSetup not correclty updated.
Definition at line 631 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsNeedUpdateFrozenStaticLightSetup, and uint32. Referenced by NL3D::CTransform::traverseLight().
00631 {return getStateFlag(IsNeedUpdateFrozenStaticLightSetup);} |
|
non-zero if the object needs to updatelighting.
Definition at line 629 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsNeedUpdateLighting, and uint32. Referenced by NL3D::CTransform::resetLighting(), and NL3D::CTransform::traverseLight().
00629 {return getStateFlag(IsNeedUpdateLighting);} |
|
Definition at line 173 of file transform.h. References NL3D::CTransform::getStateFlag(), and uint32. Referenced by NL3D::CTransformUser::isOpaque(), NL3D::CRenderTrav::traverse(), and updateSkinRenderLists().
00173 { return getStateFlag(IsOpaque); } |
|
special feature for CQuadGridClipManager. return a non-zero value if true Definition at line 294 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::QuadGridClipEnabled, and uint32. Referenced by NL3D::CClipTrav::traverse().
00294 {return getStateFlag(QuadGridClipEnabled);} |
|
non-zero if the model is renderable (ie something may appear on screen)
Definition at line 444 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsRenderable, and uint32. Referenced by NL3D::CTransform::traverseClip().
00444 {return getStateFlag(IsRenderable);} |
|
return non-zero if I am a skeleton. if yes, static_cast<CSkeletonModel*> may be used
Definition at line 421 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsSkeleton, and uint32. Referenced by forceComputeBone(), and NL3D::CAnimDetailTrav::traverse().
00421 {return getStateFlag(IsSkeleton);} |
|
Deriver must change this method if the model can be skinned. called rarely.
Reimplemented in NL3D::CMeshInstance, NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 567 of file transform.h. Referenced by bindSkin().
00567 {return false;} |
|
non-zero if the model is skinned onto a skeleton.
Definition at line 423 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsSkinned, and uint32. Referenced by detachSkeletonSon(), NL3D::CTransform::heritVisibility(), NL3D::CTransform::hide(), NL3D::CTransform::registerToChannelMixer(), NL3D::CMeshMRMSkinnedGeom::render(), NL3D::CMeshMRMGeom::render(), NL3D::CMeshGeom::render(), NL3D::CMeshMRMGeom::renderSkin(), NL3D::CMeshGeom::renderSkin(), NL3D::CMeshMRMSkinnedGeom::renderSkinGroupGeom(), NL3D::CMeshMRMGeom::renderSkinGroupGeom(), NL3D::CTransform::setIsForceAnimDetail(), NL3D::CTransform::setOpacity(), NL3D::CTransform::setTransparency(), NL3D::CTransform::show(), NL3D::CTransform::updateWorldMatrixFromFather(), and NL3D::CTransform::~CTransform().
00423 {return getStateFlag(IsSkinned);} |
|
Reimplemented in NL3D::CSegRemanence. Definition at line 132 of file transform_shape.h. Referenced by NL3D::CInstanceUser::isStarted().
00132 { return false; } |
|
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(), NL3D::ITransformable::needCompute(), NL3D::IAnimatable::propagateTouch(), and NL3D::CAnimatedMaterial::update().
00185 {
00186 return _BitSet&(1<<valueId);
00187 }
|
|
non-zero if the CTransform can be casted to a CTransformShape
Definition at line 449 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsTransformShape, and uint32. Referenced by NL3D::CTransform::updateWorld().
00449 {return getStateFlag(IsTransformShape);} |
|
Definition at line 174 of file transform.h. References NL3D::CTransform::getStateFlag(), and uint32. Referenced by NL3D::CTransformUser::isTransparent(), NL3D::CRenderTrav::traverse(), and updateSkinRenderLists().
00174 { return getStateFlag(IsTransparent); } |
|
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 NL3D::ITransformable::DirectMatrix, NLMISC::CMatrix::getPos(), NLMISC::CMatrix::getRot(), NLMISC::CMatrix::identity(), nlassert, NLMISC::CVector::normalize(), NLMISC::CMatrix::rotateY(), NL3D::ITransformable::RotQuat, NL3D::ITransformable::setMatrix(), NL3D::ITransformable::setPivot(), NL3D::ITransformable::setPos(), NLMISC::CMatrix::setPos(), NLMISC::CMatrix::setRot(), NL3D::ITransformable::setRotQuat(), and NL3D::ITransformable::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 } |
|
true if the model provide a method to support shadowMap generation
Definition at line 480 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsShadowMapCaster, and uint32. Referenced by NL3D::CTransform::enableCastShadowMap().
00480 {return getStateFlag(IsShadowMapCaster);} |
|
true if the model provide a method to support shadowMap receiving
Definition at line 482 of file transform.h. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsShadowMapReceiver, and uint32. Referenced by NL3D::CTransform::enableReceiveShadowMap().
00482 {return getStateFlag(IsShadowMapReceiver);} |
|
Called at RenderTrav to profile current render. no-op per default.
Reimplemented from NL3D::CTransform. Definition at line 248 of file transform_shape.cpp. References NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRenderTrav(), NL3D::CRenderTrav::isCurrentPassOpaque(), and NL3D::CTransformShape::Shape.
00249 { 00250 // profile the shape. 00251 if(Shape) 00252 { 00253 CRenderTrav &rdrTrav= getOwnerScene()->getRenderTrav(); 00254 bool currentPassOpaque= rdrTrav.isCurrentPassOpaque(); 00255 00256 Shape->profileSceneRender( &rdrTrav, this, currentPassOpaque ); 00257 } 00258 } |
|
For receivers. Modulate the Object with a ShadowMap. The model shoud render in the scene driver a version of its geometry simplified, and modulate the background with shadowColor.
Reimplemented in NL3D::CLandscapeModel. Definition at line 506 of file transform.h. Referenced by NL3D::CShadowMapManager::renderProject().
00506 {} |
|
Call at the begining of the program, to register the model.
Reimplemented from NL3D::CTransformShape. Definition at line 54 of file skeleton_model.cpp. References NL3D::SkeletonModelId, and NL3D::TransformShapeId.
00055 { 00056 CScene::registerModel(SkeletonModelId, TransformShapeId, CSkeletonModel::creator); 00057 } |
|
register transform channels (in global anim mode).
Reimplemented from NL3D::CTransform. Definition at line 61 of file skeleton_model.cpp. Referenced by NL3D::CLodCharacterBuilder::addAnim().
|
|
render the skeleton as a CLod.
Definition at line 1295 of file skeleton_model.cpp. References _CLodInstance, _CLodVertexAlphaDirty, NL3D::CLodCharacterManager::addRenderCharacterKey(), NL3D::CLightContribution::AttFactor, NLMISC::CRGBA::B, NL3D::CLodCharacterManager::beginRender(), NL3D::CTravCameraScene::CamPos, computeCLodVertexAlpha(), NL3D::CLodCharacterManager::endRender(), NLMISC::CRGBA::G, NL3D::CPointLight::getDiffuse(), NL3D::CRenderTrav::getDriver(), NL3D::CScene::getLodCharacterManager(), NL3D::CTransform::getOwnerScene(), NLMISC::CMatrix::getPos(), NL3D::CPointLight::getPosition(), NL3D::CScene::getRenderTrav(), getSkeletonLightContribution(), NL3D::CScene::getSunAmbient(), NL3D::CScene::getSunDiffuse(), NL3D::CScene::getSunDirection(), NL3D::CTransform::getWorldMatrix(), NL3D::CRenderTrav::isCurrentPassOpaque(), NL3D::CLodCharacterManager::isRendering(), NLMISC::CRGBA::modulateFromuiRGBOnly(), nlassert, NLMISC::CVector::normalize(), NL3D::CLightContribution::PointLight, NLMISC::CRGBA::R, NL3D::CLightContribution::SunContribution, and uint. Referenced by traverseRender().
01296 { 01297 CRenderTrav &renderTrav= getOwnerScene()->getRenderTrav(); 01298 IDriver *drv= renderTrav.getDriver(); 01299 CScene *scene= getOwnerScene(); 01300 01301 // Transparent pass? quit 01302 if(!renderTrav.isCurrentPassOpaque()) 01303 return; 01304 01305 // the lod manager. no op if not here 01306 CLodCharacterManager *mngr= scene->getLodCharacterManager(); 01307 if(!mngr) 01308 return; 01309 01310 // Get global lighting on the instance. Suppose SunAmbient only. 01311 //================= 01312 const CLightContribution *lightContrib; 01313 01314 // the std case is to take my model lightContribution 01315 if(_AncestorSkeletonModel==NULL) 01316 lightContrib= &getSkeletonLightContribution(); 01317 // but if skinned/sticked (directly or not) to a skeleton, take its. 01318 else 01319 lightContrib= &_AncestorSkeletonModel->getSkeletonLightContribution(); 01320 01321 // compute his main light contribution result. Try first with sun 01322 CRGBA mainAmbient= scene->getSunAmbient(); 01323 CRGBA mainDiffuse= scene->getSunDiffuse(); 01324 // modulate sun contribution 01325 mainDiffuse.modulateFromuiRGBOnly(mainDiffuse, lightContrib->SunContribution ); 01326 CVector mainLightDir= scene->getSunDirection(); 01327 01328 01329 /* During night, and in the buildings, it may be better to use one of the other Points lights 01330 Test only with the first pointLight, for faster compute, even if It may fail in some cases. 01331 */ 01332 CPointLight *mainPL= lightContrib->PointLight[0]; 01333 if(mainPL) 01334 { 01335 CRGBA plDiffuse; 01336 // get the diffuse of the pointLight, attenuated from distance and importance. 01337 plDiffuse.modulateFromuiRGBOnly(mainPL->getDiffuse(), lightContrib->AttFactor[0]); 01338 // compare the 2 diffuse 01339 uint d0= mainDiffuse.R + mainDiffuse.G + mainDiffuse.B; 01340 uint d1= plDiffuse.R + plDiffuse.G + plDiffuse.B; 01341 // if the pointLight is lighter, take it. 01342 if(d1>d0) 01343 { 01344 // leave ambient, but take diffuse and pointLight fake Direction 01345 mainDiffuse= plDiffuse; 01346 mainLightDir= getWorldMatrix().getPos() - mainPL->getPosition(); 01347 mainLightDir.normalize(); 01348 } 01349 } 01350 01351 01352 // compute colors of the lods. 01353 //================= 01354 // NB: even if texturing is sufficient, still important for AlphaTest. 01355 01356 // If must recompute alpha because of change of skin added/deleted 01357 if(_CLodVertexAlphaDirty) 01358 { 01359 // recompute vertex alpha 01360 computeCLodVertexAlpha(mngr); 01361 // set _CLodVertexAlphaDirty to false. 01362 _CLodVertexAlphaDirty= false; 01363 } 01364 01365 // render the Lod in the LodManager. 01366 //================= 01367 // render must have been intialized 01368 nlassert(mngr->isRendering()); 01369 01370 01371 // add the instance to the manager. 01372 if(!mngr->addRenderCharacterKey(_CLodInstance, getWorldMatrix(), 01373 mainAmbient, mainDiffuse, mainLightDir) ) 01374 { 01375 // If failed to add it because no more vertex space in the manager, retry. 01376 01377 // close vertexBlock, compile render 01378 mngr->endRender(); 01379 // and restart. 01380 mngr->beginRender(drv, renderTrav.CamPos); 01381 01382 // retry. but no-op if refail. 01383 mngr->addRenderCharacterKey(_CLodInstance, getWorldMatrix(), 01384 mainAmbient, mainDiffuse, mainLightDir); 01385 } 01386 } |
|
Special For Skeleton Caster. Render into the AuxDriver the mesh, within the current setuped Frustum/ViewMatrix. no-op by default, or if hidden in HRC!!
Reimplemented from NL3D::CTransform. Definition at line 2062 of file skeleton_model.cpp. References _StickedObjects, NL3D::CRenderTrav::getAuxDriver(), NL3D::CTransform::getOwnerScene(), NLMISC::CMatrix::getPos(), NL3D::ITransformable::getPos(), NL3D::CScene::getRenderTrav(), NL3D::CTransform::getWorldMatrix(), NL3D::CTransform::isHrcVisible(), ItTransformSet, NL3D::CTransform::renderIntoSkeletonShadowMap(), renderShadowSkins(), NLMISC::CMatrix::setPos(), NLMISC::CMatrix::setRot(), and NL3D::IDriver::setupModelMatrix(). Referenced by generateShadowMap().
02063 { 02064 // If even not visible, no-op 02065 if(!isHrcVisible() || !Shape) 02066 return; 02067 02068 // render into aux Driver 02069 IDriver *driver= getOwnerScene()->getRenderTrav().getAuxDriver(); 02070 02071 // **** Render the Skeleton Skins 02072 // The model Matrix is special here. It must be the Skeleton World Matrix, minus The Root Skeleton pos. 02073 CMatrix localPosMatrix; 02074 localPosMatrix.setRot( getWorldMatrix() ); 02075 // NB: if this==rootSkeleton, then the final pos will be CVector::Null 02076 localPosMatrix.setPos( getWorldMatrix().getPos() - rootSkeleton->getWorldMatrix().getPos() ); 02077 driver->setupModelMatrix(localPosMatrix); 02078 02079 // render the skins. 02080 renderShadowSkins(castMat); 02081 02082 // **** Render The Sticked Objects. 02083 ItTransformSet it; 02084 for(it= _StickedObjects.begin();it!=_StickedObjects.end();it++) 02085 { 02086 CTransform *stickModel= *it; 02087 stickModel->renderIntoSkeletonShadowMap(rootSkeleton, castMat); 02088 } 02089 } |
|
Deriver must change this method if isSkinnable(). It return a list of sphere relative to each bone of the father skeleton. Use with getSkinBoneUsage() to know to wich bone this sphere apply NB: if a sphere radius is -1, it means that the bone is not used (for any reason...) default is to return NULL. Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 612 of file transform.h. References sint, uint, and uint8.
00612 {return 0;}
|
|
Deriver must change this method if isSkinnable(). It return a list of sphere relative to each bone of the father skeleton. Use with getSkinBoneUsage() to know to wich bone this sphere apply NB: if a sphere radius is -1, it means that the bone is not used (for any reason...) default is to return NULL. Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 613 of file transform.h. References uint.
00613 {} |
|
Definition at line 1885 of file skeleton_model.cpp. References _OpaqueSkins, _TransparentSkins, NL3D::CVertexStreamManager::activate(), NL3D::CRenderTrav::getAuxDriver(), NL3D::CVertexStreamManager::getMaxVertices(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRenderTrav(), NL3D::CRenderTrav::getShadowMeshSkinManager(), NL3D::CVertexStreamManager::getVertexSize(), H_AUTO, NL3D::CVertexStreamManager::lock(), sint, NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), NL3D::CVertexStreamManager::swapVBHard(), uint, uint8, and NL3D::CVertexStreamManager::unlock(). Referenced by renderIntoSkeletonShadowMap().
01886 { 01887 H_AUTO( NL3D_Skin_RenderShadow ); 01888 01889 CRenderTrav &rdrTrav= getOwnerScene()->getRenderTrav(); 01890 // Render Shadow in auxiliary driver. 01891 IDriver *driver= rdrTrav.getAuxDriver(); 01892 01893 // if the SkinManager is not possible at all, just rendered the std way 01894 if( !rdrTrav.getShadowMeshSkinManager() ) 01895 { 01896 // can occurs????? 01897 // ABORT!! ... avoid Mesh Shadowing (free shadowMap)? Replace with a dummy Shadow? 01898 // For now, no-op... 01899 } 01900 else 01901 { 01902 uint i; 01903 01904 // get the meshSkinManager 01905 CVertexStreamManager &meshSkinManager= *rdrTrav.getShadowMeshSkinManager(); 01906 01907 // array (rarely allocated) of skins with grouping support 01908 static std::vector<CTransform*> skinsToGroup; 01909 static std::vector<uint> baseVertices; 01910 skinsToGroup.clear(); 01911 baseVertices.clear(); 01912 01913 // get the maxVertices the manager support 01914 uint maxVertices= meshSkinManager.getMaxVertices(); 01915 uint vertexSize= meshSkinManager.getVertexSize(); 01916 01917 // fill array of skins to group (suppose all support else won't be rendered) 01918 for(i=0;i<_OpaqueSkins.size();i++) 01919 { 01920 if(_OpaqueSkins[i]->supportShadowSkinGrouping()) 01921 skinsToGroup.push_back(_OpaqueSkins[i]); 01922 } 01923 for(i=0;i<_TransparentSkins.size();i++) 01924 { 01925 if(_TransparentSkins[i]->supportShadowSkinGrouping()) 01926 skinsToGroup.push_back(_TransparentSkins[i]); 01927 } 01928 01929 // For each skin, have an index which gives the decal of the vertices in the buffer 01930 baseVertices.resize(skinsToGroup.size()); 01931 01932 // while there is skin to render in group 01933 uint skinId= 0; 01934 while(skinId<skinsToGroup.size()) 01935 { 01936 // space left in the manager 01937 uint remainingVertices= maxVertices; 01938 uint currentBaseVertex= 0; 01939 01940 // First pass, fill The VB. 01941 //------------ 01942 // lock buffer 01943 uint8 *vbDest= meshSkinManager.lock(); 01944 01945 // For all skins until the buffer is full 01946 uint startSkinId= skinId; 01947 while(skinId<skinsToGroup.size()) 01948 { 01949 // if success to fill the AGP 01950 sint numVerticesAdded= skinsToGroup[skinId]->renderShadowSkinGeom(remainingVertices, 01951 vbDest + vertexSize*currentBaseVertex ); 01952 // -1 means that this skin can't render because no space left for her. Then stop for this block 01953 if(numVerticesAdded==-1) 01954 break; 01955 // Else ok, get the currentBaseVertex for this skin 01956 baseVertices[skinId]= currentBaseVertex; 01957 // and jump to the next place 01958 currentBaseVertex+= numVerticesAdded; 01959 remainingVertices-= numVerticesAdded; 01960 01961 // go to the next skin 01962 skinId++; 01963 } 01964 01965 // release buffer. ATI: release only vertices used. 01966 meshSkinManager.unlock(currentBaseVertex); 01967 01968 // Second pass, render the primitives. 01969 //------------ 01970 meshSkinManager.activate(); 01971 01972 // Render any primitives 01973 for(uint i=startSkinId;i<skinId;i++) 01974 { 01975 // render the skin in the current buffer 01976 skinsToGroup[i]->renderShadowSkinPrimitives(castMat, driver, baseVertices[i]); 01977 } 01978 01979 // End of this block, swap to the next buffer 01980 meshSkinManager.swapVBHard(); 01981 } 01982 } 01983 } |
|
Deriver must change this method if isSkinnable(). It renders the skin with current ctx of the skeletonModel SkeletonModel has already setuped the Light and the modelMatrix in the driver. If the skin is a MRM, it is the skeleton which drives the MRM level with alphaMRM: [0,1] default is nop Reimplemented in NL3D::CMeshInstance, NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 590 of file transform.h.
00590 {} |
|
if supportSkinGrouping(), called to transform the VBuffer, and store it into dest.
Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 601 of file transform.h. References sint, uint, and uint8.
00601 {return 0;}
|
|
if supportSkinGrouping(), called to render the primitives of the already skinned vertices (VB activated in the driver) Optionnaly, fill specRdrPasses with specular rdrPass to sort (used for specular grouping).
Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 606 of file transform.h. References uint.
00606 {} |
|
Render a specific specular renderPass returned by renderSkinGroupPrimitives.
Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 608 of file transform.h. References uint.
00608 {} |
|
render a list of skin, no lighting setup etc..., but use where possible a CVertexStreamManager Definition at line 1449 of file skeleton_model.cpp. References NL3D::CVertexStreamManager::activate(), NL3D::IDriver::endSpecularBatch(), NL3D::CRenderTrav::getDriver(), NL3D::CVertexStreamManager::getMaxVertices(), NL3D::CRenderTrav::getMeshSkinManager(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRenderTrav(), NL3D::CVertexStreamManager::getVertexSize(), H_AUTO, NL3D::CVertexStreamManager::lock(), NL3D::CSkinSpecularRdrPass::RdrPassIndex, sint, NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), NL3D::CSkinSpecularRdrPass::SkinIndex, NL3D::IDriver::startSpecularBatch(), NL3D::CVertexStreamManager::swapVBHard(), uint, uint8, and NL3D::CVertexStreamManager::unlock(). Referenced by renderSkins().
01450 { 01451 CRenderTrav &rdrTrav= getOwnerScene()->getRenderTrav(); 01452 01453 // if the SkinManager is not possible at all, just rendered the std way. 01454 if( !rdrTrav.getMeshSkinManager() ) 01455 { 01456 for(uint i=0;i<skinList.size();i++) 01457 { 01458 skinList[i]->renderSkin(alphaMRM); 01459 } 01460 } 01461 else 01462 { 01463 // get the meshSkinManager 01464 CVertexStreamManager &meshSkinManager= *rdrTrav.getMeshSkinManager(); 01465 01466 // array (rarely allocated) of skins with grouping support 01467 static std::vector<CTransform*> skinsToGroup; 01468 static std::vector<uint> baseVertices; 01469 skinsToGroup.clear(); 01470 baseVertices.clear(); 01471 01472 // get the maxVertices the manager support 01473 uint maxVertices= meshSkinManager.getMaxVertices(); 01474 uint vertexSize= meshSkinManager.getVertexSize(); 01475 01476 // render any skins which do not support SkinGrouping, and fill array of skins to group 01477 for(uint i=0;i<skinList.size();i++) 01478 { 01479 // If don't support, or if too big to fit in the manager, just renderSkin() 01480 if(!skinList[i]->supportSkinGrouping()) 01481 { 01482 H_AUTO( NL3D_Skin_NotGrouped ); 01483 skinList[i]->renderSkin(alphaMRM); 01484 } 01485 else 01486 { 01487 skinsToGroup.push_back(skinList[i]); 01488 } 01489 } 01490 01491 H_AUTO( NL3D_Skin_Grouped ); 01492 01493 // For each skin, have an index which gives the decal of the vertices in the buffer 01494 baseVertices.resize(skinsToGroup.size()); 01495 01496 // while there is skin to render in group 01497 uint skinId= 0; 01498 while(skinId<skinsToGroup.size()) 01499 { 01500 // space left in the manager 01501 uint remainingVertices= maxVertices; 01502 uint currentBaseVertex= 0; 01503 01504 01505 // First pass, fill The VB. 01506 //------------ 01507 // lock buffer 01508 uint8 *vbDest= meshSkinManager.lock(); 01509 01510 // For all skins until the buffer is full 01511 uint startSkinId= skinId; 01512 while(skinId<skinsToGroup.size()) 01513 { 01514 // if success to fill the AGP 01515 sint numVerticesAdded= skinsToGroup[skinId]->renderSkinGroupGeom(alphaMRM, remainingVertices, 01516 vbDest + vertexSize*currentBaseVertex ); 01517 // -1 means that this skin can't render because no space left for her. Then stop for this block 01518 if(numVerticesAdded==-1) 01519 break; 01520 // Else ok, get the currentBaseVertex for this skin 01521 baseVertices[skinId]= currentBaseVertex; 01522 // and jump to the next place 01523 currentBaseVertex+= numVerticesAdded; 01524 remainingVertices-= numVerticesAdded; 01525 01526 // go to the next skin 01527 skinId++; 01528 } 01529 01530 // release buffer. ATI: release only vertices used. 01531 meshSkinManager.unlock(currentBaseVertex); 01532 01533 // Second pass, render the primitives. 01534 //------------ 01535 meshSkinManager.activate(); 01536 01537 /* Render any primitives that are not specular. Group specular ones into specularRdrPasses. 01538 NB: this speed a lot (specular setup is heavy)! 01539 */ 01540 static std::vector<CSkinSpecularRdrPass> specularRdrPasses; 01541 specularRdrPasses.clear(); 01542 for(uint i=startSkinId;i<skinId;i++) 01543 { 01544 // render the skin in the current buffer 01545 skinsToGroup[i]->renderSkinGroupPrimitives(baseVertices[i], specularRdrPasses, i); 01546 } 01547 01548 // If any skin Specular rdrPass to render 01549 if(!specularRdrPasses.empty()) 01550 { 01551 // Sort by Specular Map. HTimerInfo: take 0.0% time 01552 sort(specularRdrPasses.begin(), specularRdrPasses.end()); 01553 01554 // Batch Specular! HTimerInfo: take 0.2% 01555 rdrTrav.getDriver()->startSpecularBatch(); 01556 01557 // Render all of them 01558 for(uint i=0;i<specularRdrPasses.size();i++) 01559 { 01560 CSkinSpecularRdrPass &specRdrPass= specularRdrPasses[i]; 01561 // render the associated skin in the current buffer 01562 skinsToGroup[specRdrPass.SkinIndex]->renderSkinGroupSpecularRdrPass(specRdrPass.RdrPassIndex); 01563 } 01564 01565 // End Batch Specular! HTimerInfo: take 0.0% 01566 rdrTrav.getDriver()->endSpecularBatch(); 01567 } 01568 01569 01570 // End of this block, swap to the next buffer. HTimerInfo: take 0.0% 01571 meshSkinManager.swapVBHard(); 01572 } 01573 } 01574 } |
|
render the skins of the skeleton
Definition at line 1390 of file skeleton_model.cpp. References NL3D::CTransform::_LightContribution, _OpaqueSkins, _TransparentSkins, NL3D::CTransformShape::changeLightSetup(), NL3D::IDriver::forceNormalize(), NL3D::CRenderTrav::getDriver(), NL3D::CMRMLevelDetail::getLevelDetailFromPolyCount(), NL3D::CTransformShape::getNumTrianglesAfterLoadBalancing(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRenderTrav(), NL3D::CTransform::getWorldMatrix(), NL3D::CRenderTrav::isCurrentPassOpaque(), NL3D::IDriver::isForceNormalize(), nlassert, renderSkinList(), NL3D::CTransformShape::setupCurrentLightContribution(), and NL3D::IDriver::setupModelMatrix(). Referenced by traverseRender().
01391 { 01392 // Render skins according to the pass. 01393 CRenderTrav &rdrTrav= getOwnerScene()->getRenderTrav(); 01394 // get a ptr on the driver 01395 IDriver *drv= rdrTrav.getDriver(); 01396 nlassert(drv); 01397 01398 01399 // Compute the levelOfDetail 01400 float alphaMRM= _LevelDetail.getLevelDetailFromPolyCount(getNumTrianglesAfterLoadBalancing()); 01401 01402 // force normalisation of normals.. 01403 bool bkupNorm= drv->isForceNormalize(); 01404 drv->forceNormalize(true); 01405 01406 01407 // rdr good pass 01408 if(rdrTrav.isCurrentPassOpaque()) 01409 { 01410 // Compute in Pass Opaque only the light contribution. 01411 // Easier for skeleton: suppose lightable, no local attenuation 01412 01413 // the std case is to take my model lightContribution 01414 if(_AncestorSkeletonModel==NULL) 01415 setupCurrentLightContribution(&_LightContribution, false); 01416 // but if sticked (directly or not) to a skeleton, take its. 01417 else 01418 setupCurrentLightContribution(&_AncestorSkeletonModel->_LightContribution, false); 01419 01420 01421 // Activate Driver setup: light and modelMatrix 01422 changeLightSetup( &rdrTrav ); 01423 rdrTrav.getDriver()->setupModelMatrix(getWorldMatrix()); 01424 01425 01426 // Render all totaly opaque skins. 01427 renderSkinList(_OpaqueSkins, alphaMRM); 01428 } 01429 else 01430 { 01431 // NB: must have some transparent skins, since thee skeletonModel is traversed in the transparent pass. 01432 01433 // Activate Driver setup: light and modelMatrix 01434 changeLightSetup( &rdrTrav ); 01435 rdrTrav.getDriver()->setupModelMatrix(getWorldMatrix()); 01436 01437 01438 // render all opaque/transparent skins 01439 renderSkinList(_TransparentSkins, alphaMRM); 01440 } 01441 01442 01443 // bkup force normalisation. 01444 drv->forceNormalize(bkupNorm); 01445 } |
|
Reset the Default MRM setup: follow MAX skin setup (ie the finer).
Definition at line 1610 of file skeleton_model.cpp. References _DefaultMRMSetup, and dirtSkinRenderLists().
01611 { 01612 _DefaultMRMSetup= true; 01613 01614 // Must use Skins linked to know the MRM setup. 01615 dirtSkinRenderLists(); 01616 } |
|
reset lights which influence this models. NB: the model is removed from all lights's list (except FrozenStaticLightSetup). Called by light rendering. NB: the model is NOT removed from LightingManager (with eraseStaticLightedModel()). Definition at line 988 of file transform.cpp. References NL3D::CTransform::_LightContribution, NL3D::CLightContribution::FrozenStaticLightSetup, NL3D::CTransform::IsNeedUpdateLighting, NL3D::CTransform::isNeedUpdateLighting(), NL3D_MAX_LIGHT_CONTRIBUTION, NL3D::CLightContribution::NumFrozenStaticLight, NL3D::CLightContribution::PointLight, NL3D::CPointLight::removeLightedModel(), NL3D::CTransform::setStateFlag(), NL3D::CLightContribution::TransformIterator, and uint. Referenced by NL3D::CLightingManager::addDynamicLight(), NL3D::CTransform::freezeStaticLightSetup(), NL3D::CPointLight::resetLightedModels(), NL3D::CTransform::unfreezeStaticLightSetup(), NL3D::CTransform::updateWorld(), and NL3D::CTransform::~CTransform().
00989 { 00990 // if the model is already isNeedUpdateLighting, his light setup is reseted. 00991 // so no need to reset again 00992 if(isNeedUpdateLighting()) 00993 return; 00994 00995 00996 // For all light not in FrozenStaticLightSetup, remove me from their list 00997 uint startLight= 0; 00998 if(_LightContribution.FrozenStaticLightSetup) 00999 { 01000 startLight= _LightContribution.NumFrozenStaticLight; 01001 } 01002 01003 // for all light in the list, remove me from their list. 01004 for(uint i=startLight; i<NL3D_MAX_LIGHT_CONTRIBUTION; i++) 01005 { 01006 CPointLight *pl= _LightContribution.PointLight[i]; 01007 // if end of list, break. 01008 if(!pl) 01009 break; 01010 else 01011 { 01012 // remove me from this light. 01013 pl->removeLightedModel(_LightContribution.TransformIterator[i]); 01014 } 01015 } 01016 // empty the list. 01017 if(startLight<NL3D_MAX_LIGHT_CONTRIBUTION) 01018 _LightContribution.PointLight[startLight]= NULL; 01019 01020 01021 // the model needs to update his lighting. 01022 setStateFlag(IsNeedUpdateLighting, true); 01023 01024 } |
|
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 } |
|
Deriver must change this method if isSkinnable(). called by CSkeletonModel::bindSkin() NB: _FatherSkeletonModel is valid when setApplySkin() is called The default behavior must be called: it sets the flag so isSkinned() return the good thing Reimplemented in NL3D::CMeshInstance, NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 584 of file transform.cpp. References NL3D::CTransform::IsSkinned, and NL3D::CTransform::setStateFlag(). Referenced by bindSkin(), and detachSkeletonSon().
00585 { 00586 setStateFlag(IsSkinned, state); 00587 } |
|
Set a special ctrl on a bone. see IAnimCtrl. NB: once an animCtrl is set to a bone in a skeleton, his bones are always computed each frame. set to NULL if you want to reset this bone AnimCtrl. Definition at line 1745 of file skeleton_model.cpp. References NL3D::CBone::_AnimCtrl, _AnimCtrlUsage, Bones, and uint. Referenced by NL3D::CSkeletonUser::setBoneAnimCtrl().
01746 { 01747 if(boneId>=Bones.size()) 01748 return; 01749 01750 CBone &bone= Bones[boneId]; 01751 01752 // Update refCount 01753 if(ctrl && !bone._AnimCtrl) 01754 _AnimCtrlUsage++; 01755 else if(!ctrl && bone._AnimCtrl) 01756 _AnimCtrlUsage--; 01757 01758 // set 01759 bone._AnimCtrl= ctrl; 01760 } |
|
This force gives this object ownership of the channel mixer it is registered to, so it will delete it when the dtor is called. It should be called AFTER this object has been registered to a channel mixer, because a new registration will broke the ownership. This is useful for automatic animations, when there's no owner of the channel mixer that could delete it. Definition at line 256 of file transform.h. References NL3D::CTransform::IsDeleteChannelMixer, and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CScene::createInstance(), and NL3D::CTransform::registerToChannelMixer().
00256 { setStateFlag(IsDeleteChannelMixer, enable); } |
|
Definition at line 912 of file transform.h. References NL3D::CTransform::_ClusterSystem, NL3D::CTransform::ForceClipRoot, NL3D::CTransform::getStateFlag(), and nlassert. Referenced by NL3D::CScene::findCameraClusterSystemFromRay(), and NL3D::CTransform::setForceClipRoot().
00913 { 00914 if (pCS != NULL) 00915 { 00916 nlassert(!getStateFlag(ForceClipRoot)); // the transform must be linked to the root, and have not cluster system when this flag is set 00917 } 00918 _ClusterSystem = pCS; 00919 } |
|
Called in ClipTrav pass. setup the flag. Definition at line 1014 of file skeleton_model.cpp. References _BoneToComputeDirty, _CLodInstance, _DisplayedAsLodCharacter, _LodCharacterDistance, and NL3D::CLodCharacterInstance::ShapeId. Referenced by NL3D::CClipTrav::loadBalanceSkeletonCLod(), and traverseAnimDetail().
01015 { 01016 // if enabled 01017 if(_LodCharacterDistance>0 && _CLodInstance.ShapeId>=0) 01018 { 01019 // If the flag has changed since last frame, must recompute bone Usage. 01020 if(_DisplayedAsLodCharacter != displayCLod) 01021 _BoneToComputeDirty= true; 01022 01023 // set new state 01024 _DisplayedAsLodCharacter= displayCLod; 01025 } 01026 } |
|
Definition at line 137 of file transform_shape.h. Referenced by NL3D::CScene::createInstance(), and NL3D::CInstanceUser::setDistMax().
00137 { _DistMax = distMax; } |
|
Definition at line 378 of file transform.cpp. References NL3D::CTransform::_DontUnfreezeChildren. Referenced by NL3D::CInstanceGroup::createRoot().
00379 { 00380 _DontUnfreezeChildren = val; 00381 } |
|
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 } |
|
Force the transform to always be attached to the root As a consequence, it can't be inserted into a cluster system (even the root cluster) and is thus always visible when in the frustum (not clusterized) NB : any call to setClusterSystem will cause an assertion when the flag is set NB : any call to hrcUnlink will cause an assertion when the flag is set (must remain linked to the root) Definition at line 1380 of file transform.cpp. References NL3D::CTransform::_OwnerScene, NL3D::CTransform::ForceClipRoot, NL3D::CScene::getRoot(), NL3D::CTransform::getStateFlag(), NL3D::CTransform::hrcLinkSon(), NL3D::CTransform::hrcUnlink(), NL3D::CTransform::setClusterSystem(), and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CTransformUser::setForceClipRoot().
01381 { 01382 if (forceClipRoot == (getStateFlag(ForceClipRoot) != 0)) return; 01383 if (forceClipRoot) 01384 { 01385 // unlink from previous father and link to the root 01386 hrcUnlink(); 01387 if (_OwnerScene) 01388 { 01389 _OwnerScene->getRoot()->hrcLinkSon(this); 01390 } 01391 setClusterSystem(NULL); 01392 } 01393 setStateFlag(ForceClipRoot, forceClipRoot); 01394 } |
|
For ShadowMapManager. true if the model is rendering its ShadowMap this frame.
Definition at line 514 of file transform.h. References NL3D::CTransform::canCastShadowMap(), NL3D::CTransform::IsGeneratingShadowMap, and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CShadowMapManager::addShadowCasterGenerate().
00514 {if(canCastShadowMap()) setStateFlag(IsGeneratingShadowMap, state);} |
|
change the Lod Bone interpolation distance (in meters). If 0, interpolation is disabled. The smaller this value is, the more Lod skeleton system will "pop". Default is 0.5 meters. Definition at line 637 of file skeleton_model.cpp. References _LodInterpMultiplier. Referenced by NL3D::CSkeletonUser::setInterpolationDistance().
00638 { 00639 dist= std::max(0.f, dist); 00640 // disable interpolation? 00641 if(dist==0) 00642 _LodInterpMultiplier= 0.f; 00643 else 00644 _LodInterpMultiplier= 1.f / dist; 00645 } |
|
Deriver must use this method with true to indicate the model is a big lightable.
Definition at line 574 of file transform.cpp. References NL3D::CTransform::IsBigLightable, and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CMeshBase::instanciateMeshBase().
00575 { 00576 setStateFlag(IsBigLightable, val); 00577 } |
|
For CCluster only.
Definition at line 671 of file transform.h. References NL3D::CTransform::IsCluster, and NL3D::CTransform::setStateFlag().
00671 {setStateFlag(IsCluster, val);} |
|
Deriver must use this method with true if the model must be AnimDetail-ed whatever registerToChannelMixer() has been called or not Definition at line 590 of file transform.cpp. References NL3D::CTransform::_FatherSkeletonModel, dirtSkinRenderLists(), NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsAnimDetailable, NL3D::CTransform::IsForceAnimDetail, NL3D::CTransform::isSkinned(), nlassert, and NL3D::CTransform::setStateFlag().
00591 { 00592 setStateFlag(IsForceAnimDetail, val ); 00593 00594 // Update flag, if we must be inserted in AnimDetail 00595 setStateFlag(IsAnimDetailable, _ChannelMixer || getStateFlag(IsForceAnimDetail) ); 00596 00597 // If skinned, then must inform skeleton parent that it must recompute skin render/animDetail lists 00598 if(isSkinned()) 00599 { 00600 nlassert(_FatherSkeletonModel); 00601 _FatherSkeletonModel->dirtSkinRenderLists(); 00602 } 00603 } |
|
Deriver must use this method with true to indicate the model support lighting.
Definition at line 552 of file transform.cpp. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsFinalLightable, NL3D::CTransform::IsLightable, NL3D::CTransform::IsUserLightable, and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CMeshBase::instanciateMeshBase().
00553 { 00554 setStateFlag(IsLightable, val); 00555 // update IsFinalLightable 00556 setStateFlag(IsFinalLightable, (getStateFlag(IsLightable) && getStateFlag(IsUserLightable)) ); 00557 } |
|
Deriver must use this method with true to indicate the model support loadBalancing.
Definition at line 605 of file transform.cpp. References NL3D::CTransform::IsLoadBalancable, and NL3D::CTransform::setStateFlag().
00606 { 00607 setStateFlag(IsLoadBalancable, val ); 00608 } |
|
For CMeshBaseInstance only.
Definition at line 667 of file transform.h. References NL3D::CTransform::IsMeshBaseInstance, and NL3D::CTransform::setStateFlag().
00667 {setStateFlag(IsMeshBaseInstance, val);} |
|
Deriver must use this method with true to indicate the model can be rendered. "can be rendered" means if object has to be inserted in RenderTrav list. eg: a mesh must be inserted in a render list, but not a light, or a NULL transform. The default is false. Definition at line 568 of file transform.cpp. References NL3D::CTransform::IsRenderable, and NL3D::CTransform::setStateFlag().
00569 { 00570 setStateFlag(IsRenderable, val); 00571 } |
|
ShadowMap.
Definition at line 674 of file transform.h. References NL3D::CTransform::IsShadowMapCaster, and NL3D::CTransform::setStateFlag().
00674 {setStateFlag(IsShadowMapCaster, val);} |
|
Deriver must use this method with true to indicate the model is a big lightable.
Definition at line 675 of file transform.h. References NL3D::CTransform::IsShadowMapReceiver, and NL3D::CTransform::setStateFlag().
00675 {setStateFlag(IsShadowMapReceiver, val);} |
|
For CSkeletonModel only.
Definition at line 579 of file transform.cpp. References NL3D::CTransform::IsSkeleton, and NL3D::CTransform::setStateFlag().
00580 { 00581 setStateFlag(IsSkeleton, val); 00582 } |
|
For CTransformShape only.
Definition at line 669 of file transform.h. References NL3D::CTransform::IsTransformShape, and NL3D::CTransform::setStateFlag().
00669 {setStateFlag(IsTransformShape, val);} |
|
Change the load Balancing group of a model. Every models are in a special LoadBalancingGroup. NB: the group is created if did not exist. NB: if models are skinned, it is their Skeleton which drive the group By default, models lies in the "Default" group, but Skeletons for skinning and ParticlesSystems which are in "Skin" and "Fx" group respectively. The "Default" group is special because it is not balanced (ie models are only degraded from their distance to camera) Definition at line 522 of file transform.cpp. References NL3D::CTransform::_LoadBalancingGroup, NL3D::CScene::getLoadBalancingTrav(), NL3D::CLoadBalancingTrav::getOrCreateGroup(), and NL3D::CTransform::getOwnerScene(). Referenced by NL3D::CSkeletonShape::createInstance(), NL3D::CSegRemanenceShape::createInstance(), and NL3D::CParticleSystemShape::createInstance().
00523 { 00524 // Get the traversal. 00525 CLoadBalancingTrav &trav= getOwnerScene()->getLoadBalancingTrav(); 00526 // get the group from trav (create if needed), and set it. 00527 _LoadBalancingGroup= trav.getOrCreateGroup(group); 00528 } |
|
Change/get the Character Lod anim setup.
Definition at line 953 of file skeleton_model.cpp. References _CLodInstance, NL3D::CLodCharacterInstance::AnimId, and uint. Referenced by NL3D::CSkeletonUser::setLodCharacterAnimId().
00954 { 00955 _CLodInstance.AnimId= animId; 00956 } |
|
Called in ClipTrav pass. Used to update the flag _DisplayedAsLodCharacter. return 0 if CLod not enabled. Else return a priority>0 computed from curDistance/LodCharacterDistance return 0 too if the skeleton is not visible or if his ancestorSkeletonModel is not visible. If priority is >1 then the skeleton must be displayed in CLod form Definition at line 959 of file skeleton_model.cpp. References _CLodInstance, NL3D::CLodCharacterInstance::AnimTime, and NL3D::TGlobalAnimationTime. Referenced by NL3D::CSkeletonUser::setLodCharacterAnimTime().
00960 { 00961 _CLodInstance.AnimTime= time; 00962 } |
|
This is the distance at which the skeleton use a CLodCharacterShape to display himself if 0, never display the skeleton as a CLodCharacterShape Definition at line 827 of file skeleton_model.cpp. References _LodCharacterDistance, and _OOLodCharacterDistance. Referenced by NL3D::CSkeletonUser::setLodCharacterDistance().
00828 { 00829 _LodCharacterDistance= max(dist, 0.f); 00830 if(_LodCharacterDistance>0) 00831 _OOLodCharacterDistance= 1.0f/_LodCharacterDistance; 00832 else 00833 _OOLodCharacterDistance= 0; 00834 } |
|
Change the Character Lod shape Id. set -1 if want to disable the feature (default).
Definition at line 837 of file skeleton_model.cpp. References _CLodInstance, NL3D::CScene::getLodCharacterManager(), NL3D::CTransform::getOwnerScene(), NL3D::CLodCharacterManager::initInstance(), NL3D::CLodCharacterManager::releaseInstance(), NL3D::CLodCharacterInstance::ShapeId, and sint. Referenced by NL3D::CSkeletonUser::setLodCharacterShape(), and ~CSkeletonModel().
00838 { 00839 // get a ptr on the scene which owns us, and so on the lodManager. 00840 CScene *scene= getOwnerScene(); 00841 CLodCharacterManager *mngr= scene->getLodCharacterManager(); 00842 00843 // if mngr not setuped, noop (lod not possible). 00844 if(!mngr) 00845 return; 00846 00847 // If a shape was setup, free the instance 00848 if(_CLodInstance.ShapeId>=0) 00849 { 00850 mngr->releaseInstance(_CLodInstance); 00851 _CLodInstance.ShapeId= -1; 00852 } 00853 00854 // assign 00855 _CLodInstance.ShapeId= shapeId; 00856 00857 // if a real shape is setuped, alloc an instance 00858 if(_CLodInstance.ShapeId>=0) 00859 { 00860 mngr->initInstance(_CLodInstance); 00861 } 00862 } |
|
tells if the animation must loop or clamp.
Definition at line 965 of file skeleton_model.cpp. References _CLodInstance, and NL3D::CLodCharacterInstance::WrapMode. Referenced by NL3D::CSkeletonUser::setLodCharacterWrapMode().
00966 { 00967 _CLodInstance.WrapMode= wrapMode; 00968 } |
|
Set the LogicInfo for this transfrom, eg to retrieve statc light information, see ILogicInfo. Ptr is kept in CTransfrom, so should call setLogicInfo(NULL) before to clean up. Definition at line 389 of file transform.h. References NL3D::CTransform::_LogicInfo. Referenced by NL3D::CTransformUser::setLogicInfo().
00389 {_LogicInfo= logicInfo;} |
|
Work only in DirecTMatrix mode (nlassert).
Definition at line 174 of file transformable.h. References NL3D::ITransformable::_LocalMatrixDate, NL3D::ITransformable::DirectMatrix, and nlassert. Referenced by NL3D::ITransformable::lookAt(), and NL3D::CTransformableUser::setMatrix().
00175 { 00176 nlassert(_Mode==DirectMatrix); 00177 _LocalMatrix= mat; 00178 // The matrix has changed. 00179 _LocalMatrixDate++; 00180 } |
|
set the Mean color of the transform. The mean color can be used for many purpose, such as drawing objects if the textures are not loaded. It is used also for Lod Character. Default color is (255,255,255) Definition at line 540 of file transform.cpp. References NL3D::CTransform::_MeanColor.
00541 { 00542 // if the color is different from prec 00543 if(color!=_MeanColor) 00544 { 00545 // change it. 00546 _MeanColor= color; 00547 } 00548 } |
|
Definition at line 255 of file transform.cpp. References NL3D::CTransform::_FatherSkeletonModel, dirtSkinRenderLists(), NL3D::CTransform::getStateFlag(), NL3D::CTransform::isSkinned(), nlassert, NL3D::CTransform::setStateFlag(), and v. Referenced by NL3D::CFlareModel::CFlareModel(), NL3D::CParticleSystemModel::CParticleSystemModel(), CSkeletonModel(), NL3D::CVegetableBlendLayerModel::CVegetableBlendLayerModel(), NL3D::CWaterModel::CWaterModel(), NL3D::CMeshBase::instanciateMeshBase(), NL3D::CTransformUser::setOpacity(), NL3D::CMeshMultiLodInstance::traverseLoadBalancing(), NL3D::CSegRemanence::updateOpacityFromShape(), and NL3D::CParticleSystemModel::updateOpacityInfos().
00256 { 00257 bool bTmp = getStateFlag(IsOpaque) == 0 ? false : true; 00258 if (bTmp != v) 00259 { 00260 setStateFlag(IsOpaque, v); 00261 if(isSkinned()) 00262 { 00263 nlassert(_FatherSkeletonModel); 00264 _FatherSkeletonModel->dirtSkinRenderLists(); 00265 } 00266 } 00267 } |
|
Set the current layer for this transform. Typically, this is used to sort transparent objects. Isn't used with solid objects. For now : Layer 0 is for underwater Layer 1 is for water surfaces Layer 2 is for object above water Definition at line 184 of file transform.h. References NL3D::CTransform::_OrderingLayer, and uint. Referenced by NL3D::CWaterModel::CWaterModel(), and NL3D::CTransformUser::setOrderingLayer().
00184 { _OrderingLayer = layer; } |
|
Work only in Rot* mode (nlassert).
Definition at line 169 of file transformable.h. References NL3D::ITransformable::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 NL3D::ITransformable::_Pivot, nlassert, NL3D::ITransformable::PivotValue, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::ITransformable::lookAt(), NL3D::CTransformableUser::setPivot(), and NL3D::ITransformable::setPivot().
|
|
Work only in Rot* mode(nlassert).
Definition at line 121 of file transformable.h. References NL3D::ITransformable::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, NL3D::ITransformable::PosValue, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::CCamera::build(), NL3D::ITransformable::lookAt(), NL3D::CTransformableUser::setPos(), NL3D::ITransformable::setPos(), NL3D::CInstanceGroup::setPos(), and NL3D::CPSLight::step().
|
|
Work only in RotEuler mode(nlassert).
Definition at line 133 of file transformable.h. References NL3D::ITransformable::setRotEuler().
00134 { 00135 setRotEuler(CVector(rotX, rotY, rotZ)); 00136 } |
|
Work only in RotEuler mode(nlassert).
Definition at line 126 of file transformable.h. References NL3D::ITransformable::_RotEuler, nlassert, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotEulerValue, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::CTransformableUser::setRotEuler(), and NL3D::ITransformable::setRotEuler().
|
|
Work only in RotQuat mode (nlassert).
Definition at line 138 of file transformable.h. References NL3D::ITransformable::_RotQuat, nlassert, NL3D::ITransformable::RotQuat, NL3D::ITransformable::RotQuatValue, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::CTargetAnimCtrl::execute(), NL3D::ITransformable::lookAt(), NL3D::CTransformableUser::setRotQuat(), and NL3D::CInstanceGroup::setRotQuat().
|
|
Work only in Rot* mode (nlassert).
Definition at line 157 of file transformable.h. References NL3D::ITransformable::setScale().
00158 { 00159 setScale(CVector(scale, scale, scale)); 00160 } |
|
Work only in Rot* mode (nlassert).
Definition at line 152 of file transformable.h. References NL3D::ITransformable::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, NL3D::ITransformable::RotEuler, NL3D::ITransformable::RotQuat, NL3D::ITransformable::ScaleValue, NL3D::IAnimatable::touch(), and NL3D::CAnimatedValueBlendable< T >::Value. Referenced by NL3D::ITransformable::lookAt(), NL3D::CTransformableUser::setScale(), and NL3D::ITransformable::setScale().
|
|
Change the transform mode. Components or matrix are not reseted.
Definition at line 100 of file transformable.h. References NL3D::ITransformable::_RotOrder, NL3D::ITransformable::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 } |
|
|
For deriver who wants to setup their own current lightContribution setup (as skeleton). Must call changeLightSetup() so change are effectively made in driver Definition at line 98 of file transform_shape.cpp. References NL3D::CTransformShape::_CurrentLightContribution, and NL3D::CTransformShape::_CurrentUseLocalAttenuation. Referenced by renderSkins().
00099 { 00100 _CurrentLightContribution= lightContrib; 00101 _CurrentUseLocalAttenuation= useLocalAtt; 00102 } |
|
Definition at line 1310 of file transform.cpp. References NL3D::CTransform::setStateFlag(), and NL3D::CTransform::UserClipping. Referenced by NL3D::CTransformUser::setUserClipping().
01311 { 01312 setStateFlag (UserClipping, enable); 01313 } |
|
Set the UserLightable flag. if false, isLightable() will always return false. Doing this, user can disable lighting on a model which may be interesting for speed. Default behavior is UserLightable==true. Definition at line 559 of file transform.cpp. References NL3D::CTransform::getStateFlag(), NL3D::CTransform::IsFinalLightable, NL3D::CTransform::IsLightable, NL3D::CTransform::IsUserLightable, and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CTransformUser::setUserLightable().
00560 { 00561 setStateFlag(IsUserLightable, enable); 00562 // update IsFinalLightable 00563 setStateFlag(IsFinalLightable, (getStateFlag(IsLightable) && getStateFlag(IsUserLightable)) ); 00564 } |
|
Definition at line 302 of file transform.h. Referenced by NL3D::CParticleSystemManager::processAnimate().
00302 { _WorldMatrix = mat;} |
|
Show the objet and his sons.
Definition at line 271 of file transform.cpp. References NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_TransformDirty, dirtSkinRenderLists(), NL3D::CTransform::isSkinned(), nlassert, and NL3D::CTransform::Visibility. Referenced by NL3D::CTransformUser::show(), and NL3D::CLandscapeUser::show().
00272 { 00273 // Optim: do nothing if already set 00274 if(Visibility!= CHrcTrav::Show) 00275 { 00276 _TransformDirty= true; 00277 Visibility= CHrcTrav::Show; 00278 // If skinned, then must inform skeleton parent that it must recompute skin render/animDetail lists 00279 if(isSkinned()) 00280 { 00281 nlassert(_FatherSkeletonModel); 00282 _FatherSkeletonModel->dirtSkinRenderLists(); 00283 } 00284 } 00285 } |
|
Reimplemented in NL3D::CSegRemanence. Definition at line 128 of file transform_shape.h. Referenced by NL3D::CInstanceUser::start().
00128 {}; |
|
parent a CTransform to a bone of the skeleton. NB: ~CTransform() calls detachSkeletonSon(). NB: nlassert() if there is too many skins/sticked objects on this skeleton (more than 255). NB: an object can't be skinned and sticked at same time :) NB: replaced if already here. NB: mi is made son of skeleton model in Traversals Hrc, and change are made at render() for ClipTrav. Definition at line 537 of file skeleton_model.cpp. References stickObjectEx(), and uint. Referenced by NL3D::CSkeletonUser::stickObject().
00538 { 00539 // by default don't force display of "mi" if the skeleton become in CLod state 00540 stickObjectEx(mi, boneId, false); 00541 } |
|
same method as stickObject(), but if you set forceCLod as true, then this object will be visible even if the skeleton father is in CLod state (ie displayed with a CLodCharacterShape) NB: if "mi" is a skeleton model, forceCLod is considerer true, whatever the value passed in. Definition at line 543 of file skeleton_model.cpp. References NL3D::CTransform::_FatherBoneId, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_ForceCLodSticked, _StickedObjects, detachSkeletonSon(), dirtLodVertexAlpha(), NL3D::CTransform::hrcLinkSon(), incForcedBoneUsageAndParents(), nlassert, and uint. Referenced by stickObject(), and NL3D::CSkeletonUser::stickObjectEx().
00544 { 00545 nlassert(mi); 00546 00547 // if "mi" is a skeleton, forceCLod must be true, for correct animation purpose 00548 if(dynamic_cast<CSkeletonModel*>(mi)) 00549 forceCLod= true; 00550 00551 // try to detach this object from any skeleton first (possibly me). 00552 if(mi->_FatherSkeletonModel) 00553 mi->_FatherSkeletonModel->detachSkeletonSon(mi); 00554 00555 // Then Add me. 00556 _StickedObjects.insert(mi); 00557 // increment the refCount usage of the bone 00558 incForcedBoneUsageAndParents(boneId, forceCLod); 00559 00560 // advert transform of its sticked state. 00561 mi->_FatherSkeletonModel= this; 00562 mi->_FatherBoneId= boneId; 00563 // advert him if it is "ForceCLod" sticked 00564 mi->_ForceCLodSticked= forceCLod; 00565 00566 // link correctly Hrc only. ClipTrav grah updated in Hrc traversal. 00567 hrcLinkSon( mi ); 00568 00569 // must recompute lod vertex alpha when LodCharacter used 00570 dirtLodVertexAlpha(); 00571 } |
|
Reimplemented in NL3D::CSegRemanence. Definition at line 130 of file transform_shape.h. Referenced by NL3D::CInstanceUser::stop().
00130 {}; |
|
Special Skinning For ShadowMapping.
Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 611 of file transform.h.
00611 {return false;} |
|
Deriver may support SkinGrouping if isSkinnable(). It renders the skin with current ctx of the skeletonModel, but torn in 2 pass: fillVB,a nd renderPrimitives Deriver may check NL3D_MESH_SKIN_MANAGER_VERTEXFORMAT and NL3D_MESH_SKIN_MANAGER_MAXVERTICES Reimplemented in NL3D::CMeshMRMInstance, and NL3D::CMeshMRMSkinnedInstance. Definition at line 597 of file transform.h.
00597 {return false;} |
|
|
this do :
Reimplemented from NL3D::CTransform. Definition at line 658 of file skeleton_model.cpp. References _AnimCtrlUsage, _AnimDetailSkins, _BoneToCompute, _BoneToComputeDirty, _CurLod, _CurLodInterp, _LodInterpMultiplier, NL3D::CSkeletonModel::CBoneCompute::Bone, NL3D::CTravCameraScene::CamPos, NLMISC::clamp(), NL3D::CBone::compute(), NL3D::CSkeletonShape::CLod::Distance, NL3D::CSkeletonModel::CBoneCompute::Father, NL3D::CBone::getBoneSkinMatrix(), NL3D::CScene::getClipTrav(), NL3D::CSkeletonShape::getLod(), NL3D::CSkeletonShape::getLodForDistance(), NL3D::CSkeletonShape::getNumLods(), NL3D::CTransform::getOwnerScene(), NLMISC::CMatrix::getPos(), NL3D::CTransform::getWorldMatrix(), NL3D::CBone::interpolateBoneSkinMatrix(), isDisplayedAsLodCharacter(), NL3D::CTransform::isGeneratingShadowMap(), NL3D::CTransform::isHrcVisible(), NL3D::CSkeletonModel::CBoneCompute::MustInterpolate, setDisplayLodCharacterFlag(), NLMISC::CObjectVector< T, EnableObjectBehavior >::size(), uint, and updateBoneToCompute().
00659 { 00660 CSkeletonShape *skeShape= ((CSkeletonShape*)(IShape*)Shape); 00661 00662 /* NB: If "this" skeleton has an AncestorSkeletonModel displayed but "this" skeleton is clipped, 00663 it will be still animDetailed. 00664 So its possible sticked sons will be displayed with correct WorldMatrix (if not themselves clipped). 00665 */ 00666 00667 /* If the Root Skeleton Model (ie me or my AncestorSM) is asked to render a ShadowMap, BUT I am 00668 in CLod Form (and visible in HRC else won't be rendered in shadowMap...), then temporarly 00669 Avoid CLod!! To really compute the bones for this frame only. 00670 */ 00671 bool tempAvoidCLod= false; 00672 bool genShadow; 00673 if(_AncestorSkeletonModel) 00674 genShadow= _AncestorSkeletonModel->isGeneratingShadowMap(); 00675 else 00676 genShadow= isGeneratingShadowMap(); 00677 // do the test. 00678 if(genShadow && isDisplayedAsLodCharacter() && isHrcVisible() ) 00679 { 00680 tempAvoidCLod= true; 00681 // Disable it just the time of this AnimDetail 00682 setDisplayLodCharacterFlag(false); 00683 } 00684 00685 00686 // Update Lod, and animate. 00687 //=============== 00688 00689 /* 00690 CTransformShape::traverseAnimDetail() is torn in 2 here because 00691 channels may be enabled/disabled by updateBoneToCompute() 00692 */ 00693 00694 // First update Skeleton WorldMatrix (case where the skeleton is sticked). 00695 CTransform::updateWorldMatrixFromFather(); 00696 // get dist from camera. 00697 float dist= (getWorldMatrix().getPos() - getOwnerScene()->getClipTrav().CamPos).norm(); 00698 // Use dist to get current lod to use for this skeleton 00699 uint newLod= skeShape->getLodForDistance( dist ); 00700 if(newLod != _CurLod) 00701 { 00702 // set new lod to use. 00703 _CurLod= newLod; 00704 // dirt the skeleton. 00705 _BoneToComputeDirty= true; 00706 } 00707 00708 // If needed, let's know which bone has to be computed, and enable / disable (lod) channels in channelMixer. 00709 bool forceUpdate= _BoneToComputeDirty; 00710 updateBoneToCompute(); 00711 00712 // Animate skeleton. 00713 CTransformShape::traverseAnimDetailWithoutUpdateWorldMatrix(); 00714 00715 00716 // Prepare Lod Bone interpolation. 00717 //=============== 00718 00719 float lodBoneInterp; 00720 const CSkeletonShape::CLod *lodNext= NULL; 00721 // if a lod exist after current lod, and if lod interpolation enabled 00722 if( _CurLod < skeShape->getNumLods()-1 && _LodInterpMultiplier>0 ) 00723 { 00724 // get next lod. 00725 lodNext= &skeShape->getLod(_CurLod+1); 00726 // get interp value to next. 00727 lodBoneInterp= (lodNext->Distance - dist) * _LodInterpMultiplier; 00728 NLMISC::clamp(lodBoneInterp, 0.f, 1.f); 00729 // if still 1, keep cur matrix => disable interpolation 00730 if(lodBoneInterp==1.f) 00731 lodNext=NULL; 00732 } 00733 // else, no interpolation 00734 else 00735 { 00736 lodBoneInterp=1.f; 00737 } 00738 // If the interpolation value is different from last one, must update. 00739 if(lodBoneInterp != _CurLodInterp) 00740 { 00741 // set new one. 00742 _CurLodInterp= lodBoneInterp; 00743 // must update bone compute. 00744 forceUpdate= true; 00745 } 00746 00747 00748 00749 // Compute bones 00750 //=============== 00751 00752 // If User AnimCtrl, then must update 00753 if(_AnimCtrlUsage>0) 00754 forceUpdate= true; 00755 00756 // test if bones must be updated. either if animation change or if BoneUsage change. 00757 if(IAnimatable::isTouched(CSkeletonModel::OwnerBit) || forceUpdate) 00758 { 00759 // Retrieve the WorldMatrix of the current CTransformShape. 00760 const CMatrix &modelWorldMatrix= getWorldMatrix(); 00761 00762 // must test / update the hierarchy of Bones. 00763 // Since they are orderd in depth-first order, we are sure that parent are computed before sons. 00764 uint numBoneToCompute= _BoneToCompute.size(); 00765 CSkeletonModel::CBoneCompute *pBoneCompute= numBoneToCompute? &_BoneToCompute[0] : NULL; 00766 // traverse only bones which need to be computed 00767 for(;numBoneToCompute>0;numBoneToCompute--, pBoneCompute++) 00768 { 00769 // compute the bone with his father, if any 00770 pBoneCompute->Bone->compute( pBoneCompute->Father, modelWorldMatrix, this); 00771 00772 // Lod interpolation on this bone .. only if interp is enabled now, and if bone wants it 00773 if(lodNext && pBoneCompute->MustInterpolate) 00774 { 00775 // interpolate with my father matrix. 00776 const CMatrix &fatherMatrix= pBoneCompute->Father->getBoneSkinMatrix(); 00777 pBoneCompute->Bone->interpolateBoneSkinMatrix(fatherMatrix, lodBoneInterp); 00778 } 00779 } 00780 00781 IAnimatable::clearFlag(CSkeletonModel::OwnerBit); 00782 } 00783 00784 // Sticked Objects: 00785 // they will update their WorldMatrix after, because of the AnimDetail traverse scheme: 00786 // traverse visible Clip models, and if skeleton, traverse Hrc sons. 00787 00788 00789 // Restore the Initial CLod flag if needed (see above) 00790 if(tempAvoidCLod) 00791 { 00792 setDisplayLodCharacterFlag(true); 00793 } 00794 00795 00796 // Update Animated Skins. 00797 //=============== 00798 for(uint i=0;i<_AnimDetailSkins.size();i++) 00799 { 00800 // traverse it. NB: updateWorldMatrixFromFather() is called but no-op because isSkinned() 00801 _AnimDetailSkins[i]->traverseAnimDetail(); 00802 } 00803 } |
|
traverse without updatin WorldMatrixFromFather:
Definition at line 938 of file transform.cpp. References NL3D::CChannelMixer::eval(), and NL3D::CTransform::getOwnerScene(). Referenced by NL3D::CTransform::traverseAnimDetail().
00939 { 00940 // AnimDetail behavior: animate only if not clipped. 00941 // NB: no need to test because of VisibilityList use. 00942 00943 // test if the refptr is NULL or not (RefPtr). 00944 CChannelMixer *chanmix= _ChannelMixer; 00945 if(chanmix) 00946 { 00947 // eval detail!! 00948 chanmix->eval(true, getOwnerScene()->getAnimDetailTrav().CurrentDate); 00949 } 00950 } |
|
The base traverseClip method. The behavior is to:
Reimplemented in NL3D::CCluster, NL3D::CLandscapeModel, NL3D::CParticleSystemModel, NL3D::CQuadGridClipManager, and NL3D::CRootModel. Definition at line 806 of file transform.cpp. References NL3D::CTransform::_AncestorSkeletonModel, NL3D::CTransform::_ClipDate, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_ForceCLodSticked, NL3D::CTransform::_RenderFilterType, NL3D::CTransform::_StateFlags, NL3D::CTransform::_Visible, NL3D::CTransform::_WorldVis, NL3D::CLightTrav::addLightedModel(), NL3D::CRenderTrav::addRenderModel(), NL3D::CLoadBalancingTrav::addVisibleModel(), NL3D::CAnimDetailTrav::addVisibleModel(), NL3D::CClipTrav::addVisibleModel(), NL3D::CTransform::clip(), NL3D::CTransform::clipGetChild(), NL3D::CTransform::clipGetNumChildren(), NL3D::CClipTrav::CurrentDate, NL3D::CScene::getAnimDetailTrav(), NL3D::CScene::getClipTrav(), NL3D::CScene::getFilterRenderFlags(), NL3D::CScene::getLightTrav(), NL3D::CScene::getLoadBalancingTrav(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRenderTrav(), NL3D::CTransform::isAnimDetailable(), NL3D::CTransform::isClipVisible(), isDisplayedAsLodCharacter(), NL3D::CTransform::isLightable(), NL3D::CTransform::isLoadBalancable(), NL3D::CTransform::isRenderable(), num, uint, and NL3D::CTransform::UserClipping. Referenced by NL3D::CCluster::recursTraverseClip(), NL3D::CClipTrav::traverse(), NL3D::CRootModel::traverseClip(), and NL3D::CParticleSystemModel::traverseClip().
00807 { 00808 // disable H_AUTO, because slowdown when lot of models (eg 1000-2000 tested in forest) 00809 //H_AUTO( NL3D_TransformClip ); 00810 00811 CScene *scene= getOwnerScene(); 00812 CClipTrav &clipTrav= scene->getClipTrav(); 00813 00814 if ((_ClipDate == clipTrav.CurrentDate) && _Visible) 00815 return; 00816 _ClipDate = clipTrav.CurrentDate; 00817 00818 // clip: update Visible flag. 00819 _Visible= false; 00820 // if at least visible. 00821 if(_WorldVis) 00822 { 00823 // If linked to a SkeletonModel anywhere in the hierarchy, don't clip, and use skeleton model clip result. 00824 // This works because we are sons of a special node which is not in the clip traversal, and 00825 // which is traversed at end of the traversal. 00826 if( _AncestorSkeletonModel!=NULL ) 00827 { 00828 _Visible= _AncestorSkeletonModel->isClipVisible(); 00829 // Special test: if we are sticked to a skeletonModel, and if we are still visible, maybe we don't have to 00830 if(_Visible && _FatherSkeletonModel) 00831 { 00832 // if our skeletonModel father is displayed with a Lod, maybe we are not to be displayed 00833 if(_FatherSkeletonModel->isDisplayedAsLodCharacter()) 00834 { 00835 // We are visible only if we where sticked to the skeleton with forceCLod==true. 00836 // This is also true if we are actually a skeletonModel 00837 if(!_ForceCLodSticked) 00838 // otherWise we are not visible. eg: this is the case of skins and some sticked object 00839 _Visible= false; 00840 } 00841 } 00842 } 00843 // else, clip. 00844 else 00845 { 00846 // If the instance is not filtered 00847 if(scene->getFilterRenderFlags() & _RenderFilterType) 00848 { 00849 // User cliping enabled ? 00850 if (_StateFlags & UserClipping) 00851 _Visible= true; 00852 else 00853 _Visible= clip(); 00854 } 00855 } 00856 } 00857 00858 // if visible, add to list. 00859 if(_Visible) 00860 { 00861 // add this model to the visibility list. 00862 clipTrav.addVisibleModel(this); 00863 00864 // Has not an ancestor skeleton model? 00865 if( _AncestorSkeletonModel==NULL ) 00866 { 00867 // If needed, insert the model in the lighted list. 00868 // don't insert if has an ancestorSkeletonModel, because in this case, result is driven by 00869 // the _LightContribution of the _AncestorSkeletonModel. 00870 if( isLightable() ) 00871 scene->getLightTrav().addLightedModel(this); 00872 00873 // If needed, insert the model in the animDetail list. 00874 // don't insert if has an ancestoreSkeletonModel, because in this case, this ancestore will 00875 // animDetail through the hierarchy... 00876 if( isAnimDetailable() ) 00877 scene->getAnimDetailTrav().addVisibleModel(this); 00878 } 00879 00880 // If needed, Add it to the loadBalancing trav 00881 if( isLoadBalancable() ) 00882 scene->getLoadBalancingTrav().addVisibleModel(this); 00883 00884 // If needed, insert the model in the render list. 00885 if( isRenderable() ) 00886 scene->getRenderTrav().addRenderModel(this); 00887 } 00888 00889 // Traverse the Clip sons. 00890 uint num= clipGetNumChildren(); 00891 for(uint i=0;i<num;i++) 00892 clipGetChild(i)->traverseClip(); 00893 } |
|
Each method is called in its associated traversal.
Reimplemented in NL3D::CCluster, NL3D::CLandscapeModel, NL3D::CMeshBaseInstance, NL3D::CQuadGridClipManager, and NL3D::CRootModel. Definition at line 786 of file transform.cpp. References NL3D::CTransform::hrcGetChild(), NL3D::CTransform::hrcGetNumChildren(), num, uint, and NL3D::CTransform::updateWorld(). Referenced by NL3D::CHrcTrav::traverse(), and NL3D::CRootModel::traverseHrc().
00787 { 00788 // Recompute the matrix, according to _HrcParent matrix mode, and local matrix. 00789 updateWorld(); 00790 00791 // Traverse the Hrc sons. 00792 uint num= hrcGetNumChildren(); 00793 for(uint i=0;i<num;i++) 00794 hrcGetChild(i)->traverseHrc(); 00795 } |
|
traverse the lightedModel per default: recompute LightContribution is isLightable()
Reimplemented in NL3D::CPointLightModel, NL3D::CQuadGridClipManager, and NL3D::CRootModel. Definition at line 1080 of file transform.cpp. References NL3D::CTransform::_LightContribution, NL3D::CTransform::_LogicInfo, NL3D::CLightContribution::AttFactor, NL3D::CPointLight::computeLinearAttenuation(), NL3D::CLightingManager::computeModelLightContributions(), NL3D::CTransform::getAABBox(), NLMISC::CAABBox::getCenter(), NL3D::CScene::getLightTrav(), NL3D::CTransform::getOwnerScene(), NL3D::CPointLight::getPosition(), NL3D::CTransform::getWorldMatrix(), NL3D::CTransform::isNeedUpdateFrozenStaticLightSetup(), NL3D::CTransform::isNeedUpdateLighting(), NL3D::CLightTrav::LightingManager, NL3D::CLightContribution::NumFrozenStaticLight, NLMISC::OptFastFloor(), NL3D::CLightContribution::PointLight, NL3D::CTransform::setStateFlag(), sint, uint, and uint8.
01081 { 01082 // if the model do not need to update his lighting, just skip. 01083 if(!isNeedUpdateLighting()) 01084 return; 01085 01086 01087 // If a freezeStaticLightSetup() has been called on this model recently. 01088 if(isNeedUpdateFrozenStaticLightSetup()) 01089 { 01090 // Now, the correct matrix is computed. 01091 // get the untransformed bbox from the model. 01092 CAABBox bbox; 01093 getAABBox(bbox); 01094 // get transformed center pos of bbox 01095 CVector worldModelPos= getWorldMatrix() * bbox.getCenter(); 01096 01097 // So we can compute AttFactor for each static light influencing this static object 01098 uint numPointLights= _LightContribution.NumFrozenStaticLight; 01099 for(uint i=0;i<numPointLights;i++) 01100 { 01101 const CPointLight *pl= _LightContribution.PointLight[i]; 01102 // don't worry about the precision of floor, because of *255. 01103 float distToModel= (pl->getPosition() - worldModelPos).norm(); 01104 sint attFactor= NLMISC::OptFastFloor( 255 * pl->computeLinearAttenuation(worldModelPos, distToModel) ); 01105 _LightContribution.AttFactor[i]= (uint8)attFactor; 01106 } 01107 01108 // clean. 01109 setStateFlag(CTransform::IsNeedUpdateFrozenStaticLightSetup, false); 01110 } 01111 01112 01113 // see CTransform::clip(), here I am Lightable(), and I have no _AncestorSkeletonModel 01114 // So I am sure that I really need to recompute my ModelLightContributions. 01115 getOwnerScene()->getLightTrav().LightingManager.computeModelLightContributions(this, 01116 _LightContribution, _LogicInfo); 01117 01118 // done! 01119 setStateFlag(CTransform::IsNeedUpdateLighting, false); 01120 } |
|
no-op by default
Reimplemented from NL3D::CTransform. Reimplemented in NL3D::CMeshMultiLodInstance. Definition at line 262 of file transform_shape.cpp. References NL3D::CScene::getLoadBalancingTrav(), NL3D::CLoadBalancingTrav::getLoadPass(), NL3D::CTransform::getOwnerScene(), NL3D::CTransformShape::traverseLoadBalancingPass0(), and NL3D::CTransformShape::traverseLoadBalancingPass1().
00263 { 00264 CLoadBalancingTrav &loadTrav= getOwnerScene()->getLoadBalancingTrav(); 00265 if(loadTrav.getLoadPass()==0) 00266 traverseLoadBalancingPass0(); 00267 else 00268 traverseLoadBalancingPass1(); 00269 } |
|
If displayed as a CLod, render it, else render the skins binded to this skeleton Reimplemented from NL3D::CTransformShape. Definition at line 1030 of file skeleton_model.cpp. References H_AUTO, isDisplayedAsLodCharacter(), renderCLod(), and renderSkins().
01031 { 01032 H_AUTO( NL3D_Skeleton_Render ); 01033 01034 // render as CLod, or render Skins. 01035 if(isDisplayedAsLodCharacter()) 01036 renderCLod(); 01037 else 01038 renderSkins(); 01039 } |
|
see freezeHRC(). Definition at line 406 of file transform.cpp. References NL3D::CTransform::_FreezeHRCState, NL3D::CTransform::_HrcParent, NL3D::CTransform::_HrcParentUnfreeze, NL3D::CTransform::_LightedModelIt, NL3D::CLightingManager::eraseStaticLightedModel(), NL3D::CTransform::FreezeHRCStateDisabled, NL3D::CScene::getLightTrav(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRoot(), NL3D::CTransform::hrcLinkSon(), NL3D::CTransform::isLightable(), NL3D::CLightTrav::LightingManager, NL3D::CTransform::linkToUpdateList(), nlassert, NL3D::CTransform::QuadGridClipEnabled, NL3D::CTransform::setStateFlag(), and NL3D::CTransform::unlinkFromQuadCluster(). Referenced by bindSkin(), NL3D::CMeshBaseInstance::traverseHrc(), and NL3D::CInstanceGroup::unfreezeHRC().
00407 { 00408 // if this model is no HRC frozen disabled 00409 if(_FreezeHRCState!=FreezeHRCStateDisabled) 00410 { 00411 // if model correctly frozen. 00412 if(_FreezeHRCState == CTransform::FreezeHRCStateEnabled ) 00413 { 00414 // Should not be linked : can't link after a freezeHRC 00415 nlassert (_HrcParent == NULL); 00416 00417 // Set as unfreeze else, hrcLinkSon doesn't work 00418 _FreezeHRCState= FreezeHRCStateDisabled; 00419 00420 // Link this model to the previous HRC parent. 00421 if (_HrcParentUnfreeze) 00422 _HrcParentUnfreeze->hrcLinkSon( this ); 00423 else 00424 getOwnerScene()->getRoot()->hrcLinkSon( this ); 00425 00426 // Link this object to the validateList. 00427 linkToUpdateList(); 00428 00429 // if lightable() 00430 if( isLightable() ) 00431 { 00432 CLightTrav &lightTrav= getOwnerScene()->getLightTrav(); 00433 // Lighting: must remove the object from the quadGrid. 00434 // NB: works if _LightedModelIt==NULL. result is that _LightedModelIt= NULL. 00435 _LightedModelIt= lightTrav.LightingManager.eraseStaticLightedModel(_LightedModelIt); 00436 } 00437 00438 } 00439 else 00440 _FreezeHRCState= FreezeHRCStateDisabled; 00441 00442 // unlink me from any QuadCluster, and disable QuadCluster 00443 unlinkFromQuadCluster(); 00444 setStateFlag(QuadGridClipEnabled, false); 00445 } 00446 } |
|
unFreeze the Static Light Setup. Must be called if static pointLights are deleted. NB: it calls resetLighting() first. NB: do not need to call it if pointLights and this transform are deleted at same time. Definition at line 1061 of file transform.cpp. References NL3D::CTransform::_LightContribution, NL3D::CLightContribution::FrozenAmbientLight, NL3D::CLightContribution::FrozenStaticLightSetup, NL3D::CTransform::IsNeedUpdateFrozenStaticLightSetup, NL3D::CLightContribution::NumFrozenStaticLight, NL3D::CLightContribution::PointLight, NL3D::CTransform::resetLighting(), and NL3D::CTransform::setStateFlag(). Referenced by NL3D::CInstanceGroup::removeFromScene().
01062 { 01063 // resetLighting() first. 01064 resetLighting(); 01065 01066 // Disable StaticLightSetup. 01067 _LightContribution.FrozenStaticLightSetup= false; 01068 _LightContribution.NumFrozenStaticLight= 0; 01069 // End the list 01070 _LightContribution.PointLight[0]= NULL; 01071 // No more FrozenAmbientLight 01072 _LightContribution.FrozenAmbientLight= NULL; 01073 01074 // Don't need to update StaticLightSetup since no more exist. 01075 setStateFlag(IsNeedUpdateFrozenStaticLightSetup, false); 01076 } |
|
special feature for CQuadGridClipManager. remove from it.
Reimplemented from NL3D::CTransform. Definition at line 133 of file transform_shape.cpp. References NL3D::CTransformShape::_QuadClusterListNode, and NL3D::CFastPtrListNode::unlink().
00134 {
00135 // if linked to a quadGridClipCluster, unlink it
00136 _QuadClusterListNode.unlink();
00137 }
|
|
This function update the model (called by CScene::updateModels()) Deriver Must :
The default behavior is to update transform Matrix etc... Reimplemented in NL3D::CCamera. Definition at line 450 of file transform.cpp. References NL3D::CTransform::_FreezeHRCState, NL3D::CTransform::_Frozen, NL3D::CTransform::_LastTransformableMatrixDate, NL3D::CTransform::_LightedModelIt, NL3D::CTransform::_LocalDate, NL3D::CTransform::_LocalMatrix, NL3D::CTransform::_LocalVis, NL3D::CTransform::_TransformDirty, NL3D::CHrcTrav::CurrentDate, NL3D::CLightingManager::eraseStaticLightedModel(), NL3D::CScene::getHrcTrav(), NL3D::CScene::getLightTrav(), NL3D::ITransformable::getMatrix(), NL3D::CTransform::getOwnerScene(), NL3D::CTransform::hrcUnlink(), NL3D::CLightingManager::insertStaticLightedModel(), NL3D::CTransform::isLightable(), NL3D::CLightTrav::LightingManager, NL3D::CTransform::unlinkFromUpdateList(), and NL3D::CTransform::Visibility. Referenced by NL3D::CTransform::forceCompute(), NL3D::CTransform::freeze(), and NL3D::CScene::updateModels().
00451 { 00452 // test if the matrix has been changed in ITransformable. 00453 if(ITransformable::compareMatrixDate(_LastTransformableMatrixDate)) 00454 { 00455 _LastTransformableMatrixDate= ITransformable::getMatrixDate(); 00456 _TransformDirty= true; 00457 } 00458 00459 // update the freezeHRC state. 00460 if(_FreezeHRCState != CTransform::FreezeHRCStateDisabled) 00461 { 00462 // if the model request to be frozen in HRC 00463 if(_FreezeHRCState == CTransform::FreezeHRCStateRequest ) 00464 { 00465 // Wait for next Hrc traversal to compute good _WorldMatrix for this model and his sons. 00466 // Also, next Hrc traversal will insert the model in the LightingManager quadGrid (if lightable) 00467 _FreezeHRCState = CTransform::FreezeHRCStateReady; 00468 } 00469 // if the model is ready to be frozen in HRC, then do it!! 00470 else if( _FreezeHRCState == CTransform::FreezeHRCStateReady ) 00471 { 00472 // Unlink this model. 00473 hrcUnlink(); 00474 00475 // unLink this object from the validateList. NB: the list will still be correclty parsed. 00476 unlinkFromUpdateList(); 00477 00478 // if lightable, the model is inserted in a quadgrid to update his lighting only when 00479 // dynamicLights touch him (since himself is static). 00480 if( isLightable() ) 00481 { 00482 CLightTrav &lightTrav= getOwnerScene()->getLightTrav(); 00483 // Lighting: must reinsert the object from the quadGrid. 00484 // NB: works if _LightedModelIt==NULL. result is that _LightedModelIt= NULL. 00485 _LightedModelIt= lightTrav.LightingManager.eraseStaticLightedModel(_LightedModelIt); 00486 // insert in the quadgrid. 00487 _LightedModelIt= lightTrav.LightingManager.insertStaticLightedModel(this); 00488 } 00489 00490 // Now this model won't be tested for validation nor for worldMatrix update. End!! 00491 _FreezeHRCState = CTransform::FreezeHRCStateEnabled; 00492 } 00493 } 00494 00495 // update _LocalMatrix 00496 if(_TransformDirty) 00497 { 00498 // update the local matrix. 00499 _LocalMatrix= getMatrix(); 00500 _LocalVis= Visibility; 00501 // update the date of the local matrix. 00502 _LocalDate= getOwnerScene()->getHrcTrav().CurrentDate; 00503 00504 // The transform has been modified. Hence, it is no more frozen. 00505 _Frozen= false; 00506 00507 // ok! 00508 _TransformDirty= false; 00509 } 00510 } |
|
According to Usage, ForedUsage and current skeleton Lod, update MustCompute and ValidBoneSkinMatrix.
Definition at line 280 of file skeleton_model.cpp. References _BoneToCompute, _BoneToComputeDirty, _BoneUsage, _CurLod, _LodInterpMultiplier, NL3D::CSkeletonShape::CLod::ActiveBones, NL3D::CSkeletonModel::CBoneCompute::Bone, Bones, NL3D::CSkeletonModel::CBoneCompute::Father, NL3D::CTransform::getChannelMixer(), NL3D::CSkeletonShape::getLod(), NL3D::CSkeletonShape::getNumLods(), isDisplayedAsLodCharacter(), NL3D::CSkeletonModel::CBoneCompute::MustInterpolate, sint, and uint. Referenced by traverseAnimDetail().
00281 { 00282 // If already computed, skip 00283 if(!_BoneToComputeDirty) 00284 return; 00285 00286 // get the channelMixer owned by CTransform. 00287 CChannelMixer *chanMixer= getChannelMixer(); 00288 00289 // Get Lod infos from skeletonShape 00290 CSkeletonShape *skeShape= (CSkeletonShape*)(IShape*)Shape; 00291 const CSkeletonShape::CLod &lod= skeShape->getLod(_CurLod); 00292 00293 // reset _BoneToCompute 00294 _BoneToCompute.clear(); 00295 00296 // For all bones 00297 for(uint i=0; i<_BoneUsage.size(); i++) 00298 { 00299 // If we are in CLod mode 00300 if(isDisplayedAsLodCharacter()) 00301 // don't compute the bone 00302 _BoneUsage[i].MustCompute= 0; 00303 else 00304 { 00305 // set MustCompute to non 0 if (Usage && Lod) || ForcedUsage; 00306 _BoneUsage[i].MustCompute= (_BoneUsage[i].Usage & lod.ActiveBones[i]) | _BoneUsage[i].ForcedUsage; 00307 } 00308 // if CLodForcedUsage for the bone, it must be computed, whatever _DisplayedAsLodCharacter state 00309 _BoneUsage[i].MustCompute|= _BoneUsage[i].CLodForcedUsage; 00310 00311 // If the bone must be computed (if !0) 00312 if(_BoneUsage[i].MustCompute) 00313 { 00314 // lodEnable the channels of this bone 00315 if(chanMixer) 00316 Bones[i].lodEnableChannels(chanMixer, true); 00317 00318 // This bone is computed => take his valid boneSkinMatrix. 00319 _BoneUsage[i].ValidBoneSkinMatrix= i; 00320 00321 // Append to the list to compute. 00322 //------- 00323 CBoneCompute bc; 00324 bc.Bone= &Bones[i]; 00325 sint fatherId= Bones[i].getFatherId(); 00326 // if a root bone... 00327 if(fatherId==-1) 00328 bc.Father= NULL; 00329 else 00330 bc.Father= &Bones[fatherId]; 00331 // MustInterpolate?? 00332 bc.MustInterpolate= false; 00333 const CSkeletonShape::CLod *lodNext= NULL; 00334 // if a lod exist after current lod, and if lod interpolation enabled 00335 if( _CurLod < skeShape->getNumLods()-1 && _LodInterpMultiplier>0 ) 00336 { 00337 // get next lod. 00338 lodNext= &skeShape->getLod(_CurLod+1); 00339 // Lod interpolation on this bone ?? only if at next lod, the bone is disabled. 00340 // And only if it is not enabed because of a "Forced reason" 00341 // Must also have a father, esle can't interpolate. 00342 if(lodNext->ActiveBones[i]==0 && _BoneUsage[i].ForcedUsage==0 && _BoneUsage[i].CLodForcedUsage==0 00343 && bc.Father) 00344 bc.MustInterpolate= true; 00345 } 00346 // append 00347 _BoneToCompute.push_back(bc); 00348 } 00349 else 00350 { 00351 // lodDisable the channels of this bone 00352 if(chanMixer) 00353 Bones[i].lodEnableChannels(chanMixer, false); 00354 00355 // This bone is not computed => take the valid boneSkinMatrix of his father 00356 sint fatherId= Bones[i].getFatherId(); 00357 if(fatherId<0) 00358 // just take me, even if not computed. 00359 _BoneUsage[i].ValidBoneSkinMatrix= i; 00360 else 00361 // NB: father ValidBoneSkinMatrix already computed because of the hierarchy order of Bones array. 00362 _BoneUsage[i].ValidBoneSkinMatrix= _BoneUsage[fatherId].ValidBoneSkinMatrix; 00363 } 00364 } 00365 00366 // For 00367 00368 // computed 00369 _BoneToComputeDirty= false; 00370 } |
|
Definition at line 748 of file transform.cpp. References NL3D::CTransform::_AncestorSkeletonModel, NL3D::CTransform::_ClipLinkedInSonsOfAncestorSkeletonModelGroup, NL3D::CTransform::clipAddChild(), NL3D::CTransform::clipGetNumParents(), NL3D::CTransform::clipGetParent(), NL3D::CTransform::clipUnlinkFromAll(), NL3D::CScene::getClipTrav(), NL3D::CTransform::getOwnerScene(), NL3D::CScene::getRoot(), and NL3D::CScene::SonsOfAncestorSkeletonModelGroup. Referenced by NL3D::CTransform::updateWorld().
00749 { 00750 CClipTrav &clipTrav= getOwnerScene()->getClipTrav(); 00751 00752 // If I have an ancestor Skeleton Model, I must be binded in ClipTrav to the SonsOfAncestorSkeletonModelGroup 00753 if(_AncestorSkeletonModel && !_ClipLinkedInSonsOfAncestorSkeletonModelGroup) 00754 { 00755 // must unlink from ALL olds models. 00756 clipUnlinkFromAll(); 00757 00758 // And link to SonsOfAncestorSkeletonModelGroup. 00759 getOwnerScene()->SonsOfAncestorSkeletonModelGroup->clipAddChild(this); 00760 00761 // update the flag. 00762 _ClipLinkedInSonsOfAncestorSkeletonModelGroup= true; 00763 } 00764 00765 00766 // else I must be binded to the standard Root. 00767 if(!_AncestorSkeletonModel && _ClipLinkedInSonsOfAncestorSkeletonModelGroup) 00768 { 00769 // verify first I am really still linked to the SonsOfAncestorSkeletonModelGroup. 00770 // This test is important, because link may have changed for any reason (portals, clipManager....). 00771 if( clipGetNumParents() == 1 && clipGetParent(0)==getOwnerScene()->SonsOfAncestorSkeletonModelGroup ) 00772 { 00773 // must unlink from ALL olds models. 00774 clipUnlinkFromAll(); 00775 // and now, link to std root. 00776 getOwnerScene()->getRoot()->clipAddChild(this); 00777 } 00778 00779 // update the flag 00780 _ClipLinkedInSonsOfAncestorSkeletonModelGroup= false; 00781 } 00782 } |
|
Definition at line 1872 of file skeleton_model.cpp. References NL3D::CTransform::getOwnerScene(), NL3D::CScene::getShadowMapTextureSize(), NL3D::CShadowMap::getTextureSize(), NL3D::CShadowMap::initTexture(), and nlassert. Referenced by generateShadowMap().
01873 { 01874 nlassert(_ShadowMap); 01875 01876 // create/update texture 01877 if(_ShadowMap->getTextureSize()!=getOwnerScene()->getShadowMapTextureSize()) 01878 { 01879 _ShadowMap->initTexture(getOwnerScene()->getShadowMapTextureSize()); 01880 } 01881 } |
|
Definition at line 1117 of file skeleton_model.cpp. References _AnimDetailSkins, _DefaultMRMSetup, _OpaqueSkins, _Skins, _SkinToRenderDirty, _TransparentSkins, Bones, buildDefaultLevelDetail(), NLMISC::CObjectVector< T, EnableObjectBehavior >::clear(), NL3D::CMRMLevelDetail::compileDistanceSetup(), NL3D::CMRMLevelDetail::DistanceCoarsest, NL3D::CMRMLevelDetail::DistanceFinest, NL3D::CMRMLevelDetail::DistanceMiddle, NL3D::CTransformShape::getMRMLevelDetail(), NL3D::CTransform::getSkinBoneSphere(), NL3D::CTransform::getSkinBoneUsage(), NL3D::CTransform::getVisibility(), NL3D::CTransform::isAnimDetailable(), NL3D::CTransform::isOpaque(), NL3D::CTransform::isTransparent(), ItTransformSet, NL3D::CMRMLevelDetail::MaxFaceUsed, NL3D::CMRMLevelDetail::MinFaceUsed, nlassert, NLMISC::CBSphere::Radius, NLMISC::CObjectVector< T, EnableObjectBehavior >::resize(), NL3D::CTransform::setTransparency(), sint, and uint. Referenced by NL3D::CClipTrav::traverse().
01118 { 01119 // If need to update array of skins to compute 01120 if(_SkinToRenderDirty) 01121 { 01122 uint i; 01123 01124 _SkinToRenderDirty= false; 01125 01126 // Reset the LevelDetail. 01127 _LevelDetail.MinFaceUsed= 0; 01128 _LevelDetail.MaxFaceUsed= 0; 01129 // If must follow default MRM setup from skins. 01130 if(_DefaultMRMSetup) 01131 { 01132 _LevelDetail.DistanceCoarsest= 0; 01133 _LevelDetail.DistanceMiddle= 0; 01134 _LevelDetail.DistanceFinest= 0; 01135 } 01136 01137 // reset Bone Sphere of skeleton. 01138 static std::vector<bool> sphereEmpty; 01139 sphereEmpty.clear(); 01140 sphereEmpty.resize(Bones.size(), true); 01141 for(i=0;i<Bones.size();i++) 01142 { 01143 // Default sphere is centered on the bone pos, and has 0 radius. 01144 Bones[i]._MaxSphere.Center= CVector::Null; 01145 Bones[i]._MaxSphere.Radius= 0; 01146 } 01147 01148 // Parse to count new size of the arrays, and to build MRM info, and bone Max sphere 01149 uint opaqueSize= 0; 01150 uint transparentSize= 0; 01151 uint animDetailSize= 0; 01152 ItTransformSet it; 01153 for(it= _Skins.begin();it!=_Skins.end();it++) 01154 { 01155 CTransform *skin= *it; 01156 01157 // If the skin is hidden, don't add it to any list! 01158 if(skin->getVisibility()==CHrcTrav::Hide) 01159 continue; 01160 01161 // if transparent, then must fill in transparent list. 01162 if(skin->isTransparent()) 01163 transparentSize++; 01164 // else may fill in opaquelist. NB: for optimisation, don't add in opaqueList 01165 // if added to the transperent list (all materials are rendered) 01166 else if(skin->isOpaque()) 01167 opaqueSize++; 01168 01169 // if animDetailable, then must fill list 01170 if(skin->isAnimDetailable()) 01171 animDetailSize++; 01172 01173 // if the skin support MRM, then must update levelDetal number of faces 01174 CTransformShape *trShape= dynamic_cast<CTransformShape*>(skin); 01175 if(trShape) 01176 { 01177 const CMRMLevelDetail *skinLevelDetail= trShape->getMRMLevelDetail(); 01178 if(skinLevelDetail) 01179 { 01180 // Add Faces to the Skeleton level detail 01181 _LevelDetail.MinFaceUsed+= skinLevelDetail->MinFaceUsed; 01182 _LevelDetail.MaxFaceUsed+= skinLevelDetail->MaxFaceUsed; 01183 // MRM Max skin setup. 01184 if(_DefaultMRMSetup) 01185 { 01186 // Get the maximum distance setup (ie the one which degrades the less) 01187 _LevelDetail.DistanceCoarsest= max(_LevelDetail.DistanceCoarsest, skinLevelDetail->DistanceCoarsest); 01188 _LevelDetail.DistanceMiddle= max(_LevelDetail.DistanceMiddle, skinLevelDetail->DistanceMiddle); 01189 _LevelDetail.DistanceFinest= max(_LevelDetail.DistanceFinest, skinLevelDetail->DistanceFinest); 01190 } 01191 } 01192 } 01193 01194 // Enlarge Bone BBox 01195 const std::vector<sint32> *boneUsage= skin->getSkinBoneUsage(); 01196 const std::vector<NLMISC::CBSphere> *boneSphere= skin->getSkinBoneSphere(); 01197 if(boneUsage && boneSphere) 01198 { 01199 nlassert(boneUsage->size()==boneSphere->size()); 01200 for(i=0;i<boneUsage->size();i++) 01201 { 01202 const CBSphere &sphere= (*boneSphere)[i]; 01203 sint boneId= (*boneUsage)[i]; 01204 nlassert(boneId<(sint)Bones.size()); 01205 // if valid boneId, and sphere not empty (ie not -1 radius) 01206 if(boneId>-1 && sphere.Radius>=0) 01207 { 01208 if(sphereEmpty[boneId]) 01209 { 01210 sphereEmpty[boneId]= false; 01211 Bones[boneId]._MaxSphere= sphere; 01212 } 01213 else 01214 { 01215 Bones[boneId]._MaxSphere.setUnion(Bones[boneId]._MaxSphere, sphere); 01216 } 01217 } 01218 } 01219 } 01220 } 01221 01222 // MRM Max skin setup. 01223 if(_DefaultMRMSetup) 01224 { 01225 // compile LevelDetail. 01226 if(_LevelDetail.MaxFaceUsed==0) 01227 // build a bug-free level detail 01228 buildDefaultLevelDetail(); 01229 else 01230 _LevelDetail.compileDistanceSetup(); 01231 } 01232 01233 // alloc array. 01234 _OpaqueSkins.clear(); 01235 _TransparentSkins.clear(); 01236 _AnimDetailSkins.clear(); 01237 _OpaqueSkins.resize(opaqueSize); 01238 _TransparentSkins.resize(transparentSize); 01239 _AnimDetailSkins.resize(animDetailSize); 01240 01241 // ReParse, to fill array. 01242 uint opaqueId= 0; 01243 uint transparentId= 0; 01244 uint animDetailId= 0; 01245 for(it= _Skins.begin();it!=_Skins.end();it++) 01246 { 01247 CTransform *skin= *it; 01248 01249 // If the skin is hidden, don't add it to any list! 01250 if(skin->getVisibility()==CHrcTrav::Hide) 01251 continue; 01252 01253 // if transparent, then must fill in transparent list. 01254 if(skin->isTransparent()) 01255 { 01256 nlassert(transparentId<transparentSize); 01257 _TransparentSkins[transparentId++]= skin; 01258 } 01259 // else may fill in opaquelist. NB: for optimisation, don't add in opaqueList 01260 // if added to the transperent list (all materials are rendered) 01261 else if(skin->isOpaque()) 01262 { 01263 nlassert(opaqueId<opaqueSize); 01264 _OpaqueSkins[opaqueId++]= skin; 01265 } 01266 01267 // if animDetailable, then must fill list 01268 if(skin->isAnimDetailable()) 01269 { 01270 nlassert(animDetailId<animDetailSize); 01271 _AnimDetailSkins[animDetailId++]= skin; 01272 } 01273 } 01274 01275 // set the Transparency to the skeleton only if has at least one transparent skin 01276 setTransparency( transparentSize>0 ); 01277 } 01278 } |
|
Update the world state according to the parent world state and the local states.
Definition at line 663 of file transform.cpp. References NL3D::CTransform::_AncestorSkeletonModel, NL3D::CTransform::_DontUnfreezeChildren, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_Frozen, NL3D::CTransform::_HrcParent, NL3D::CTransform::_LightContribution, NL3D::CTransform::_LocalDate, NL3D::CTransform::_LocalMatrix, NL3D::CTransform::_LocalVis, NL3D::CHrcTrav::_MovingObjects, NL3D::CTransform::_WorldDate, NL3D::CTransform::_WorldMatrix, NL3D::CTransform::_WorldVis, NL3D::CHrcTrav::CurrentDate, NL3D::CTransform::ForceClipRoot, NL3D::CLightContribution::FrozenStaticLightSetup, NL3D::CScene::getHrcTrav(), NL3D::CTransform::getOwnerScene(), NL3D::CTransform::getStateFlag(), NL3D::CTransform::isLightable(), NL3D::CTransform::isTransformShape(), NL3D::CTransform::resetLighting(), and NL3D::CTransform::updateClipTravForAncestorSkeleton(). Referenced by NL3D::CTransform::traverseHrc().
00664 { 00665 const CMatrix *pFatherWM; 00666 bool visFather; 00667 00668 // If not root case, link to Fahter. 00669 if(_HrcParent) 00670 { 00671 pFatherWM= &(_HrcParent->_WorldMatrix); 00672 visFather= _HrcParent->_WorldVis; 00673 00674 // if _HrcParent is not frozen (for any reason), disable us! 00675 00676 if (!_HrcParent->_Frozen && !_HrcParent->_DontUnfreezeChildren) 00677 _Frozen= false; 00678 00679 // herit _AncestorSkeletonModel 00680 if (_HrcParent->_AncestorSkeletonModel) 00681 // If my father has an _AncestorSkeletonModel, get it. 00682 _AncestorSkeletonModel= _HrcParent->_AncestorSkeletonModel; 00683 else 00684 // else I have an ancestor skel model if I am sticked/binded directly to a skeleton model. 00685 _AncestorSkeletonModel= _FatherSkeletonModel; 00686 } 00687 // else, default!! 00688 else 00689 { 00690 pFatherWM= &(CMatrix::Identity); 00691 visFather= true; 00692 00693 // at the root of the hierarchy, we have no parent, hence no FatherSkeletonModel nor _AncestorSkeletonModel. 00694 _AncestorSkeletonModel= NULL; 00695 00696 // NB: Root is Frozen by essence :), so don't modify the frozen state here. 00697 } 00698 00699 // Combine matrix 00700 if(_LocalDate>_WorldDate || (_HrcParent && _HrcParent->_WorldDate>_WorldDate) ) 00701 { 00702 // Must recompute the world matrix. ONLY IF I AM NOT SKINNED/STICKED TO A SKELETON in the hierarchy! 00703 if( _AncestorSkeletonModel==NULL ) 00704 { 00705 _WorldMatrix= *pFatherWM * _LocalMatrix; 00706 _WorldDate= getOwnerScene()->getHrcTrav().CurrentDate; 00707 00708 // Add the model to the moving object list, only if I am a transform shape 00709 if (!_Frozen && isTransformShape() && !getStateFlag(ForceClipRoot)) 00710 getOwnerScene()->getHrcTrav()._MovingObjects.push_back (static_cast<CTransformShape*>(this)); 00711 } 00712 } 00713 00714 // Update dynamic lighting. 00715 /* 00716 If the model is not frozen in StaticLight, then must update lighting each frame. 00717 Even if the object doesn't move, a new dynamic light may enter in its aera. Hence we must test 00718 it in the light quadrid. StaticLight-ed Objects don't need it because they are inserted in a special quadgrid, 00719 where dynamics lights touch all StaticLight-ed object to force their computing 00720 00721 NB: not done if _AncestorSkeletonModel!=NULL. no need because in this case, 00722 result is driven by the _LightContribution of the _AncestorSkeletonModel. 00723 */ 00724 if( !_LightContribution.FrozenStaticLightSetup && _AncestorSkeletonModel==NULL ) 00725 { 00726 // if the model is lightable reset lighting 00727 if( isLightable() ) 00728 resetLighting(); 00729 } 00730 00731 // Combine visibility. 00732 switch(_LocalVis) 00733 { 00734 case CHrcTrav::Herit: _WorldVis= visFather; break; 00735 case CHrcTrav::Hide: _WorldVis= false; break; 00736 case CHrcTrav::Show: _WorldVis= true; break; 00737 default: break; 00738 } 00739 00740 00741 // If I have an ancestor Skeleton Model, I must be binded in ClipTrav to the SonsOfAncestorSkeletonModelGroup 00742 updateClipTravForAncestorSkeleton(); 00743 00744 } |
|
For Skeleton Object Stick. update the wolrd matrix. no-op if skinned. no-op if no AcnestorSkeletonModel. use standard father WorldMatrix if !_FatherSkeletonModel else get the correct boneId WorldMatrix from _FatherSkeletonModel Definition at line 905 of file transform.cpp. References NL3D::CTransform::_AncestorSkeletonModel, NL3D::CTransform::_FatherBoneId, NL3D::CTransform::_FatherSkeletonModel, NL3D::CTransform::_LocalMatrix, NL3D::CTransform::_WorldMatrix, Bones, NL3D::CTransform::hrcGetParent(), and NL3D::CTransform::isSkinned(). Referenced by NL3D::CTransform::forceCompute(), and NL3D::CTransform::traverseAnimDetail().
00906 { 00907 // If I am not skinned, and If I have a skeleton ancestor 00908 if(!isSkinned() && _AncestorSkeletonModel ) 00909 { 00910 // Compute the HRC _WorldMatrix. 00911 // if I am not sticked. 00912 if(!_FatherSkeletonModel) 00913 { 00914 // get the normal father worldMatrix in Hrc. 00915 CTransform *fatherTransform= hrcGetParent(); 00916 // if exist 00917 if(fatherTransform) 00918 { 00919 const CMatrix &parentWM= fatherTransform->_WorldMatrix; 00920 // combine worldMatrix 00921 _WorldMatrix= parentWM * _LocalMatrix; 00922 } 00923 else 00924 _WorldMatrix= _LocalMatrix; 00925 } 00926 else 00927 { 00928 // get the worldMatrix of the bone if I am sticked. 00929 const CMatrix &parentWM= _FatherSkeletonModel->Bones[_FatherBoneId].getWorldMatrix(); 00930 // combine worldMatrix 00931 _WorldMatrix= parentWM * _LocalMatrix; 00932 } 00933 } 00934 } |
|
return true if the current light contribution of this model use a MergedPointLight Definition at line 369 of file transform.h. References NL3D::CTransform::_LightContribution, and NL3D::CLightContribution::UseMergedPointLight.
00369 {return _LightContribution.UseMergedPointLight;} |
|
Definition at line 67 of file smart_ptr.h. |
|
Definition at line 357 of file skeleton_model.h. |
|
Definition at line 851 of file transform.h. Referenced by NL3D::CClipTrav::clipSkeletonShadowMaps(), NL3D::CTransform::CTransform(), NL3D::CTransform::getAncestorSkeletonModel(), NL3D::CAnimDetailTrav::traverse(), NL3D::CTransform::traverseClip(), NL3D::CTransform::updateClipTravForAncestorSkeleton(), NL3D::CTransform::updateWorld(), and NL3D::CTransform::updateWorldMatrixFromFather(). |
|
Definition at line 508 of file skeleton_model.h. Referenced by CSkeletonModel(), setBoneAnimCtrl(), and traverseAnimDetail(). |
|
Definition at line 386 of file skeleton_model.h. Referenced by traverseAnimDetail(), and updateSkinRenderLists(). |
|
List of bones to compute.
Definition at line 429 of file skeleton_model.h. Referenced by computeWorldBBoxForShadow(), getNumBoneComputed(), initBoneUsages(), traverseAnimDetail(), and updateBoneToCompute(). |
|
Flag set if the MRSkeleton lod change, or if a new bone Usage change (only if was 0 or become 0).
Definition at line 431 of file skeleton_model.h. Referenced by decBoneUsage(), incBoneUsage(), initBoneUsages(), setDisplayLodCharacterFlag(), traverseAnimDetail(), and updateBoneToCompute(). |
|
The list of BoneUsage. Updated by Meshes, stickObject(), and lod changes.
Definition at line 427 of file skeleton_model.h. Referenced by computeCurrentBBox(), decBoneUsage(), forceComputeBone(), getActiveBoneSkinMatrix(), incBoneUsage(), initBoneUsages(), isBoneComputed(), and updateBoneToCompute(). |
|
date of last traverseClip()
Definition at line 865 of file transform.h. Referenced by NL3D::CTransform::CTransform(), and NL3D::CTransform::traverseClip(). |
|
Definition at line 849 of file transform.h. Referenced by bindSkin(), NL3D::CTransform::CTransform(), and NL3D::CTransform::updateClipTravForAncestorSkeleton(). |
|
The Lod instance. -1 by default.
Definition at line 470 of file skeleton_model.h. Referenced by computeCLodVertexAlpha(), computeDisplayLodCharacterPriority(), computeLodTexture(), getLodCharacterAnimId(), getLodCharacterAnimTime(), getLodCharacterShape(), getLodCharacterWrapMode(), renderCLod(), setDisplayLodCharacterFlag(), setLodCharacterAnimId(), setLodCharacterAnimTime(), setLodCharacterShape(), and setLodCharacterWrapMode(). |
|
dirt when a bindSkin/stickObject/detachSkeletonSon is called Definition at line 474 of file skeleton_model.h. Referenced by CSkeletonModel(), dirtLodVertexAlpha(), and renderCLod(). |
|
The current lod activated for this skeleton.
Definition at line 433 of file skeleton_model.h. Referenced by initBoneUsages(), traverseAnimDetail(), and updateBoneToCompute(). |
|
The current lod Interpolation Value for this skeleton.
Definition at line 435 of file skeleton_model.h. Referenced by initBoneUsages(), and traverseAnimDetail(). |
|
Definition at line 380 of file skeleton_model.h. Referenced by changeMRMDistanceSetup(), CSkeletonModel(), resetDefaultMRMDistanceSetup(), and updateSkinRenderLists(). |
|
True if the skeleton model and his skins have to be displayed with a CLodCharacterShape, instead of the std way This state is modified early during the HRC Traversal. Because Clip traversal need this result. Definition at line 463 of file skeleton_model.h. Referenced by CSkeletonModel(), isDisplayedAsLodCharacter(), and setDisplayLodCharacterFlag(). |
|
Definition at line 848 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::setDontUnfreezeChildren(), and NL3D::CTransform::updateWorld(). |
|
Deriver must change this method if isSkinnable(). It return a list of sphere relative to each bone of the father skeleton. Use with getSkinBoneUsage() to know to wich bone this sphere apply NB: if a sphere radius is -1, it means that the bone is not used (for any reason...) default is to return NULL. Definition at line 618 of file transform.h. Referenced by computeCLodVertexAlpha(), detachSkeletonSon(), NL3D::CTransform::forceCompute(), stickObjectEx(), and NL3D::CTransform::updateWorldMatrixFromFather(). |
|
Deriver must change this method if isSkinnable(). It return a list of sphere relative to each bone of the father skeleton. Use with getSkinBoneUsage() to know to wich bone this sphere apply NB: if a sphere radius is -1, it means that the bone is not used (for any reason...) default is to return NULL. Definition at line 616 of file transform.h. Referenced by bindSkin(), NL3D::CTransform::CTransform(), detachSkeletonSon(), NL3D::CTransform::forceCompute(), forceComputeBone(), NL3D::CTransform::getSkeletonModel(), NL3D::CTransform::heritVisibility(), NL3D::CTransform::hide(), NL3D::CTransform::registerToChannelMixer(), NL3D::CTransform::setIsForceAnimDetail(), NL3D::CTransform::setOpacity(), NL3D::CTransform::setTransparency(), NL3D::CTransform::show(), stickObjectEx(), NL3D::CTransform::traverseClip(), NL3D::CTransform::updateWorld(), NL3D::CTransform::updateWorldMatrixFromFather(), and NL3D::CTransform::~CTransform(). |
|
Definition at line 847 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::freeze(), NL3D::CTransform::freezeHRC(), NL3D::CTransform::update(), and NL3D::CTransform::updateWorld(). |
|
date of last traverseClip()
Definition at line 869 of file transform.h. Referenced by NL3D::CClipTrav::addVisibleModel(), NL3D::CTransform::CTransform(), and NL3D::CTransform::~CTransform(). |
|
Definition at line 367 of file skeleton_model.h. Referenced by initModel(), and ~CSkeletonModel(). |
|
Definition at line 389 of file skeleton_model.h. |
|
The contribution of all lights. This enlarge the struct only of approx 15%.
Definition at line 626 of file transform.h. Referenced by NL3D::CTransform::freezeStaticLightSetup(), NL3D::CTransform::getLightContribution(), renderSkins(), NL3D::CTransform::resetLighting(), NL3D::CTransform::traverseLight(), NL3D::CTransform::unfreezeStaticLightSetup(), NL3D::CTransform::updateWorld(), and NL3D::CTransform::useMergedPointLight(). |
|
each transform may be in a quadGird of lighted models (see CLightingManager)
Definition at line 634 of file transform.h. Referenced by NL3D::CTransform::unfreezeHRC(), NL3D::CTransform::update(), and NL3D::CTransform::~CTransform(). |
|
Definition at line 894 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::getLoadBalancingGroup(), NL3D::CTransform::initModel(), and NL3D::CTransform::setLoadBalancingGroup(). |
|
Definition at line 841 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::update(), and NL3D::CTransform::updateWorld(). |
|
Hrc IN variables.
Reimplemented from NL3D::ITransformable. Definition at line 839 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::update(), NL3D::CTransform::updateWorld(), and NL3D::CTransform::updateWorldMatrixFromFather(). |
|
Definition at line 840 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::update(), and NL3D::CTransform::updateWorld(). |
|
see setLodCharacterDistance
Definition at line 466 of file skeleton_model.h. Referenced by computeDisplayLodCharacterPriority(), CSkeletonModel(), getLodCharacterDistance(), setDisplayLodCharacterFlag(), and setLodCharacterDistance(). |
|
For lod interpolation. Inverse of distance. If 0, disable interpolation.
Definition at line 437 of file skeleton_model.h. Referenced by getInterpolationDistance(), initBoneUsages(), setInterpolationDistance(), traverseAnimDetail(), and updateBoneToCompute(). |
|
recompute _CLodVertexAlpha, ignoring _CLodVertexAlphaDirty
Definition at line 467 of file skeleton_model.h. Referenced by computeDisplayLodCharacterPriority(), CSkeletonModel(), and setLodCharacterDistance(). |
|
Definition at line 383 of file skeleton_model.h. Referenced by renderShadowSkins(), renderSkins(), and updateSkinRenderLists(). |
|
State for renderFiltering. Default is 0xFFFFFFFF (always displayed) Deriver work to change this value Definition at line 830 of file transform.h. Referenced by NL3D::CTransform::CTransform(), and NL3D::CTransform::traverseClip(). |
|
Definition at line 513 of file skeleton_model.h. |
|
The skins.
Definition at line 373 of file skeleton_model.h. Referenced by bindSkin(), computeCLodVertexAlpha(), computeLodTexture(), detachSkeletonSon(), updateSkinRenderLists(), and ~CSkeletonModel(). |
|
Definition at line 378 of file skeleton_model.h. Referenced by CSkeletonModel(), dirtSkinRenderLists(), and updateSkinRenderLists(). |
|
The StickedObjects.
Definition at line 375 of file skeleton_model.h. Referenced by computeCLodVertexAlpha(), computeWorldBBoxForShadow(), detachSkeletonSon(), renderIntoSkeletonShadowMap(), stickObjectEx(), and ~CSkeletonModel(). |
|
Definition at line 384 of file skeleton_model.h. Referenced by renderShadowSkins(), renderSkins(), and updateSkinRenderLists(). |
|
set to true is the object is visible (not clipped).
Definition at line 867 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::isClipVisible(), and NL3D::CTransform::traverseClip(). |
|
Definition at line 845 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::hrcLinkSon(), NL3D::CTransform::hrcUnlink(), and NL3D::CTransform::updateWorld(). |
|
Hrc OUT variables.
Definition at line 843 of file transform.h. Referenced by NL3D::CTransform::updateWorld(), and NL3D::CTransform::updateWorldMatrixFromFather(). |
|
Definition at line 844 of file transform.h. Referenced by NL3D::CTransform::CTransform(), NL3D::CTransform::isHrcVisible(), NL3D::CTransform::traverseClip(), and NL3D::CTransform::updateWorld(). |
|
The list of CBone, created from the CSkeletonShape. They are odered in depth-first order. Definition at line 98 of file skeleton_model.h. Referenced by NL3D::CLodCharacterBuilder::applySkin(), computeAllBones(), NL3D::CMeshMRMSkinnedGeom::computeBonesId(), NL3D::CMeshMRMGeom::computeBonesId(), NL3D::CMeshGeom::computeBonesId(), computeCLodVertexAlpha(), computeCurrentBBox(), computeRenderedBBox(), NL3D::CSkeletonShape::createInstance(), NL3D::CSkeletonUser::CSkeletonUser(), decForcedBoneUsageAndParents(), NL3D::CTargetAnimCtrl::execute(), flagBoneAndParents(), forceComputeBone(), getActiveBoneSkinMatrix(), getBoneAnimCtrl(), NL3D::CTargetAnimCtrl::getCurrentLSRotationFromBone(), getLightHotSpotInWorld(), incForcedBoneUsageAndParents(), initBoneUsages(), registerToChannelMixer(), setBoneAnimCtrl(), NL3D::CTransformShape::traverseLoadBalancingPass0(), updateBoneToCompute(), NL3D::CMeshMRMSkinnedGeom::updateSkeletonUsage(), NL3D::CMeshMRMGeom::updateSkeletonUsage(), NL3D::CMeshGeom::updateSkeletonUsage(), updateSkinRenderLists(), and NL3D::CTransform::updateWorldMatrixFromFather(). |
|
Definition at line 79 of file smart_ptr.h. Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount(). |
|
Referenced by NLMISC::CRefCount::CRefCount(). |
|
Definition at line 80 of file smart_ptr.h. Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount(). |
|
The shape, the object instancied.
Definition at line 72 of file transform_shape.h. Referenced by NL3D::CTransformShape::clip(), computeLodTexture(), NL3D::CWaveMakerShape::createInstance(), NL3D::CWaterShape::createInstance(), NL3D::CSkeletonShape::createInstance(), NL3D::IShape::createInstance(), NL3D::CSegRemanenceShape::createInstance(), NL3D::CScene::createInstance(), NL3D::CParticleSystemShape::createInstance(), NL3D::CMeshMultiLod::createInstance(), NL3D::CMeshMRMSkinned::createInstance(), NL3D::CMeshMRM::createInstance(), NL3D::CMesh::createInstance(), NL3D::CFlareShape::createInstance(), NL3D::CScene::deleteInstance(), NL3D::CTransformShape::getAABBox(), NL3D::CTransformShape::getNumTriangles(), NL3D::CSkeletonUser::getShapeDistMax(), NL3D::CInstanceUser::getShapeDistMax(), NL3D::CTransformShape::profileRender(), NL3D::CSkeletonUser::setShapeDistMax(), NL3D::CInstanceUser::setShapeDistMax(), and NL3D::CTransformShape::traverseRender(). |