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

NL3D::CSkeletonUser Class Reference

USkeleton implementation. More...

#include <skeleton_user.h>

Inheritance diagram for NL3D::CSkeletonUser:

NL3D::USkeleton NL3D::CTransformUser NL3D::UTransform NL3D::UTransform NL3D::CTransformableUser NL3D::UTransformable NL3D::UTransformable NL3D::UTransformable List of all members.

Public Methods

Object
 CSkeletonUser (CScene *scene, IModel *model)
 This model should have been created with Scene::createInstance(). More...

virtual ~CSkeletonUser ()
Skin operation.
virtual bool bindSkin (UInstance *mi)
 bind a MeshInstance skin to the skeleton. More...

virtual void stickObject (UTransform *mi, uint boneId)
 parent a CTransform to a bone of the skeleton. More...

virtual void stickObjectEx (UTransform *mi, uint boneId, bool forceCLod)
 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. More...

virtual void detachSkeletonSon (UTransform *mi)
 unparent a CTransform from a bone of the skeleton, or unbind a skin. More...

Bone access.
virtual uint getNumBones () const
 retrieve the number of bones. More...

virtual UBonegetBone (uint boneId)
 retrieve the bone. nlerror if not here. (>=getNumBones()). More...

virtual sint getBoneIdByName (const std::string &boneName) const
 retrieve the bone Id, by his name. -1 if not found. More...

virtual bool isBoneComputed (uint boneId) const
 Tell if a bone has been computed in the last frame or not. false if boneId is invalid. More...

Lod interaction
virtual uint getNumBoneComputed () const
 return the number of bones currently animated/computed (because of bindSkin()/stickObject() / Lod system). More...

virtual void setInterpolationDistance (float dist)
 change the Lod Bone interpolation distance (in meters). More...

virtual float getInterpolationDistance () const
 see setInterpolationDistance(). More...

virtual void setShapeDistMax (float distMax)
 Change Max Display Skeleton distance. More...

virtual float getShapeDistMax () const
 see setShapeDistMax(). More...

virtual void changeMRMDistanceSetup (float distanceFinest, float distanceMiddle, float distanceCoarsest)
 Special version for skins. More...

CLod / Character Lod
virtual void setLodCharacterShape (sint shapeId)
 Change the Character Lod shape Id. More...

virtual sint getLodCharacterShape () const
 see setLodCharacterShape. More...

virtual void setLodCharacterAnimId (uint animId)
 Change/get the Character Lod anim setup. More...

virtual uint getLodCharacterAnimId () const
virtual void setLodCharacterAnimTime (TGlobalAnimationTime time)
virtual TGlobalAnimationTime getLodCharacterAnimTime () const
virtual bool isDisplayedAsLodCharacter () const
 True if the skeleton model and his skins have been displayed with a CLodCharacterShape at last scene render. More...

virtual void setLodCharacterDistance (float dist)
 This is the distance at which the skeleton use a CLodCharacterShape to display himself if 0, never display the skeleton as a CLodCharacterShape. More...

virtual float getLodCharacterDistance () const
 see setLodCharacterDistance. 0 if disabled. More...

virtual void setLodCharacterWrapMode (bool wrapMode)
 tells if the animation must loop or clamp. More...

virtual bool getLodCharacterWrapMode () const
virtual void computeLodTexture ()
 Call it when you want the system to recompute the Lod texture NB: Lod texturing is possible only in conjunction with AsyncTextureManager. More...

Misc
virtual bool computeRenderedBBox (NLMISC::CAABBox &bbox)
 Retrieve the current approx BBox around the skeleton, computed in the last USene::render(). More...

virtual bool computeCurrentBBox (NLMISC::CAABBox &bbox, UPlayList *playList, double playTime=0, bool forceCompute=false)
 same as computeRenderedBBox() but force animation and compute of all bones => don't need render(), but slower. More...

Accessor for CSeneUser.
CSkeletonModelgetSkeleton ()

Public Attributes

CSkeletonModel_Skeleton
 This is the SAME pointer than _Transform, but correctly casted. More...

std::vector< CBoneUser_Bones
 This is a mirror of _Skeleton->Bones. More...


Detailed Description

USkeleton implementation.

Author:
Lionel Berenguier , Nevrax France
Date:
2001

Definition at line 51 of file skeleton_user.h.


Constructor & Destructor Documentation

NL3D::CSkeletonUser::CSkeletonUser CScene   scene,
IModel   model
[inline]
 

This model should have been created with Scene::createInstance().

Definition at line 66 of file skeleton_user.h.

References _Bones, _Skeleton, and NL3D_MEM_SKELETON.

virtual NL3D::CSkeletonUser::~CSkeletonUser   [inline, virtual]
 

Definition at line 80 of file skeleton_user.h.

References _Skeleton, and NL3D_MEM_SKELETON.


Member Function Documentation

bool NL3D::CSkeletonUser::bindSkin UInstance   mi [virtual]
 

bind a MeshInstance skin to the skeleton.

NB: ~UTransform() and ~USkeleton() call detachSkeletonSon(). NB: nlerror() if mi is not a UInstance. (ie a mesh instance). 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

Returns:
false if mi is NULL or not skinnable, true otherwise

Implements NL3D::USkeleton.

Definition at line 97 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and nlerror.

void NL3D::CSkeletonUser::changeMRMDistanceSetup float    distanceFinest,
float    distanceMiddle,
float    distanceCoarsest
[virtual]
 

Special version for skins.

NB: skins never follow their original MRM distance setup, but follow this skeleton MRM setup. Default is 3-10-50. NB: Unlike UInstance::changeMRMDistanceSetup(), this setup applies to the SkeletonModel, not the shape. NB: no-op if distanceFinest<0, distanceMiddle<=distanceFinest or if distanceCoarsest<=distanceMiddle.

Parameters:
distanceFinest  The MRM has its max faces when dist<=distanceFinest.
distanceMiddle  The MRM has 50% of its faces at dist==distanceMiddle.
distanceCoarsest  The MRM has faces/Divisor (ie near 0) when dist>=distanceCoarsest.

Implements NL3D::USkeleton.

Definition at line 256 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

bool NL3D::CSkeletonUser::computeCurrentBBox NLMISC::CAABBox   bbox,
UPlayList   playList,
double    playTime = 0,
bool    forceCompute = false
[virtual]
 

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

Parameters:
bbox  return the bbox of the skinned skeleton, local to the skeleton. If the skeleton is not skinned/sticked at all, bbox is not modified.
playList  set NULL if no one, else this playList will be played at the time playTime
forceCompute  force evaluation of bbox even if not skinned
Returns:
true if the bbox is computed, false otherwise.

Implements NL3D::USkeleton.

Definition at line 272 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::computeLodTexture   [virtual]
 

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)

Implements NL3D::USkeleton.

Definition at line 286 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

bool NL3D::CSkeletonUser::computeRenderedBBox NLMISC::CAABBox   bbox [virtual]
 

Retrieve the current approx BBox around the skeleton, computed in the last USene::render().

for all computed bones, extend the bbox with their pos

Parameters:
bbox  return the bbox of the skinned skeleton, local to the skeleton. If the skeleton was clipped, the bbox is not modified.
Returns:
true if the bbox is computed, false otherwise.

Implements NL3D::USkeleton.

Definition at line 265 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::detachSkeletonSon UTransform   mi [virtual]
 

unparent a CTransform from a bone of the skeleton, or unbind a skin.

No-op if not here. NB: mi is placed at root of hierarchy.

Implements NL3D::USkeleton.

Definition at line 142 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and nlerror.

UBone & NL3D::CSkeletonUser::getBone uint    boneId [virtual]
 

retrieve the bone. nlerror if not here. (>=getNumBones()).

Implements NL3D::USkeleton.

Definition at line 162 of file skeleton_user.cpp.

References _Bones, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and nlerror.

sint NL3D::CSkeletonUser::getBoneIdByName const std::string &    boneName const [virtual]
 

retrieve the bone Id, by his name. -1 if not found.

Implements NL3D::USkeleton.

Definition at line 171 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

float NL3D::CSkeletonUser::getInterpolationDistance   const [virtual]
 

see setInterpolationDistance().

Implements NL3D::USkeleton.

Definition at line 60 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

uint NL3D::CSkeletonUser::getLodCharacterAnimId   const [virtual]
 

Implements NL3D::USkeleton.

Definition at line 205 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

TGlobalAnimationTime NL3D::CSkeletonUser::getLodCharacterAnimTime   const [virtual]
 

Implements NL3D::USkeleton.

Definition at line 217 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and NL3D::TGlobalAnimationTime.

float NL3D::CSkeletonUser::getLodCharacterDistance   const [virtual]
 

see setLodCharacterDistance. 0 if disabled.

Implements NL3D::USkeleton.

Definition at line 235 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

sint NL3D::CSkeletonUser::getLodCharacterShape   const [virtual]
 

see setLodCharacterShape.

Implements NL3D::USkeleton.

Definition at line 193 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

bool NL3D::CSkeletonUser::getLodCharacterWrapMode   const [virtual]
 

Implements NL3D::USkeleton.

Definition at line 247 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

uint NL3D::CSkeletonUser::getNumBoneComputed   const [virtual]
 

return the number of bones currently animated/computed (because of bindSkin()/stickObject() / Lod system).

Implements NL3D::USkeleton.

Definition at line 42 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

uint NL3D::CSkeletonUser::getNumBones   const [virtual]
 

retrieve the number of bones.

Implements NL3D::USkeleton.

Definition at line 155 of file skeleton_user.cpp.

References _Bones, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

float NL3D::CSkeletonUser::getShapeDistMax   const [virtual]
 

see setShapeDistMax().

Implements NL3D::USkeleton.

Definition at line 82 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

CSkeletonModel* NL3D::CSkeletonUser::getSkeleton   [inline]
 

Definition at line 145 of file skeleton_user.h.

References _Skeleton, and NL3D_MEM_SKELETON.

bool NL3D::CSkeletonUser::isBoneComputed uint    boneId const [virtual]
 

Tell if a bone has been computed in the last frame or not. false if boneId is invalid.

Implements NL3D::USkeleton.

Definition at line 178 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

bool NL3D::CSkeletonUser::isDisplayedAsLodCharacter   const [virtual]
 

True if the skeleton model and his skins have been displayed with a CLodCharacterShape at last scene render.

Implements NL3D::USkeleton.

Definition at line 223 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::setInterpolationDistance float    dist [virtual]
 

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.

Implements NL3D::USkeleton.

Definition at line 51 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::setLodCharacterAnimId uint    animId [virtual]
 

Change/get the Character Lod anim setup.

Implements NL3D::USkeleton.

Definition at line 199 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::setLodCharacterAnimTime TGlobalAnimationTime    time [virtual]
 

Implements NL3D::USkeleton.

Definition at line 211 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and NL3D::TGlobalAnimationTime.

void NL3D::CSkeletonUser::setLodCharacterDistance float    dist [virtual]
 

This is the distance at which the skeleton use a CLodCharacterShape to display himself if 0, never display the skeleton as a CLodCharacterShape.

Implements NL3D::USkeleton.

Definition at line 229 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::setLodCharacterShape sint    shapeId [virtual]
 

Change the Character Lod shape Id.

set -1 if want to disable the feature (default)

Implements NL3D::USkeleton.

Definition at line 187 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::setLodCharacterWrapMode bool    wrapMode [virtual]
 

tells if the animation must loop or clamp.

Implements NL3D::USkeleton.

Definition at line 241 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::setShapeDistMax float    distMax [virtual]
 

Change Max Display Skeleton distance.

After this distance the shape won't be displayed. setting <0 means -1 and so means DistMax = infinite (default in meshs but multilod meshes). NB: This apply to the shape direclty!! ie All instances using same shape will be affected

Note: If the skeleton himself is sticked to an other skeleton, this setup is not taken into account. ie the skeleton clip follow the ancestor skeleton clip result (ie the first skeleton in hierarchy which is not sticked).

Note (complex): same remark for QuadGridClipManager interaction with this function as in UInstance::setShapeDistMax()

Implements NL3D::USkeleton.

Definition at line 70 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, and NL3D_MEM_SKELETON.

void NL3D::CSkeletonUser::stickObject UTransform   mi,
uint    boneId
[virtual]
 

parent a CTransform to a bone of the skeleton.

NB: ~CTransform() calls detachSkeletonSon(). This object will be visible only when the Skeleton is not clipped. NB: an object can't be skinned and sticked at same time :) NB: replaced if already here.

Implements NL3D::USkeleton.

Definition at line 118 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and nlerror.

void NL3D::CSkeletonUser::stickObjectEx UTransform   mi,
uint    boneId,
bool    forceCLod
[virtual]
 

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.

Implements NL3D::USkeleton.

Definition at line 130 of file skeleton_user.cpp.

References _Skeleton, NL3D_HAUTO_UI_SKELETON, NL3D_MEM_SKELETON, and nlerror.


Member Data Documentation

std::vector<CBoneUser> NL3D::CSkeletonUser::_Bones
 

This is a mirror of _Skeleton->Bones.

Definition at line 58 of file skeleton_user.h.

Referenced by CSkeletonUser, getBone, and getNumBones.

CSkeletonModel* NL3D::CSkeletonUser::_Skeleton
 

This is the SAME pointer than _Transform, but correctly casted.

Definition at line 55 of file skeleton_user.h.

Referenced by bindSkin, changeMRMDistanceSetup, computeCurrentBBox, computeLodTexture, computeRenderedBBox, CSkeletonUser, detachSkeletonSon, getBoneIdByName, getInterpolationDistance, getLodCharacterAnimId, getLodCharacterAnimTime, getLodCharacterDistance, getLodCharacterShape, getLodCharacterWrapMode, getNumBoneComputed, getShapeDistMax, getSkeleton, isBoneComputed, isDisplayedAsLodCharacter, setInterpolationDistance, setLodCharacterAnimId, setLodCharacterAnimTime, setLodCharacterDistance, setLodCharacterShape, setLodCharacterWrapMode, setShapeDistMax, stickObject, stickObjectEx, and ~CSkeletonUser.


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