From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03402.html | 1389 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1389 insertions(+) create mode 100644 docs/doxygen/nel/a03402.html (limited to 'docs/doxygen/nel/a03402.html') diff --git a/docs/doxygen/nel/a03402.html b/docs/doxygen/nel/a03402.html new file mode 100644 index 00000000..022032c9 --- /dev/null +++ b/docs/doxygen/nel/a03402.html @@ -0,0 +1,1389 @@ + + +NeL: NL3D::CSkeletonShape class Reference + + + +
+

NL3D::CSkeletonShape Class Reference

#include <skeleton_shape.h> +

+

Inheritance diagram for NL3D::CSkeletonShape: +

+ +NL3D::IShape +NLMISC::CRefCount +NLMISC::IStreamable +NLMISC::IClassable + +

Detailed Description

+a definition of a skeleton. can be instanciated into a CSkeletonModel.
Author:
Lionel Berenguier

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 48 of file skeleton_shape.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void build (const std::vector< CBoneBase > &bones)
 CSkeletonShape ()
 Constructor.

sint32 getBoneIdByName (const std::string &name) const
 Return the id of a bone, from it's name. -1 if not present.

virtual std::string getClassName ()=0
float getDistMax () const
const CLodgetLod (uint lod) const
 get lod information.

uint getLodForDistance (float dist) const
 retrieve the lod to use for a given distance (log(n)).

uint getNumLods () const
const sintgetRefCount () const
virtual void profileSceneRender (CRenderTrav *rdrTrav, CTransformShape *trans, bool opaquePass)
void retrieve (std::vector< CBoneBase > &bones) const
void setDistMax (float distMax)
From IShape
virtual bool clip (const std::vector< CPlane > &pyramid, const CMatrix &worldMatrix)
 clip this skeleton.

virtual CTransformShapecreateInstance (CScene &scene)
 Create a CSkeletonModel, which contains bones.

virtual void flushTextures (IDriver &driver, uint selectedTexture)
 flush textures used by this shape.

virtual void getAABBox (NLMISC::CAABBox &bbox) const
virtual float getNumTriangles (float distance)
 get an approximation of the number of triangles this instance will render for a fixed distance.

 NLMISC_DECLARE_CLASS (CSkeletonShape)
 clip this skeleton.

virtual void render (IDriver *drv, CTransformShape *trans, bool opaquePass)
 render() this skeletonshape in a driver (no-op)

virtual void serial (NLMISC::IStream &f) throw (NLMISC::EStream)
 serial this skeletonshape.


Data Fields

sint crefs
CPtrInfo * pinfo

Static Public Attributes

CPtrInfo NullPtrInfo

Protected Attributes

float _DistMax
 Default to -1.


Private Attributes

NLMISC::CAABBox _BBox
std::map< std::string, uint32_BoneMap
std::vector< CBoneBase_Bones
std::vector< CLod_Lods

Friends

struct CPtrInfo
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NL3D::CSkeletonShape::CSkeletonShape  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 51 of file skeleton_shape.cpp. +

+References NLMISC::CAABBox::setCenter(), and NLMISC::CAABBox::setSize(). +

+

00052 {
+00053         // By default for now....
+00054         // Temp. Have a huge BBox, so clip badly. 
+00055         _BBox.setCenter(CVector(0,0,1.5));
+00056         _BBox.setSize(CVector(3,3,3));
+00057 }
+
+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + +
void NL3D::CSkeletonShape::build const std::vector< CBoneBase > &  bones  ) 
+
+ + + + + +
+   + + +

+Build a skeletonShape, replacing old. WARNING: bones must be organized in Depth-first order (this is not checked). Bone.LodDisableDistance are minimized such sons have always a distance <= father distance. +

+Definition at line 72 of file skeleton_shape.cpp. +

+References min, sint32, and uint. +

+

00073 {
+00074         uint    i;
+00075 
+00076         // copy bones.
+00077         _Bones= bones;
+00078 
+00079         // for all bones
+00080         for(i=0;i<_Bones.size();i++)
+00081         {
+00082                 // build the map.
+00083                 _BoneMap[_Bones[i].Name]= i;
+00084                 // validate distances.
+00085                 _Bones[i].LodDisableDistance= max(0.f, _Bones[i].LodDisableDistance);
+00086 
+00087                 // get fahter dist.
+00088                 sint32  fatherId= _Bones[i].FatherId;
+00089                 // if father exist and is not "always enabled"
+00090                 if(fatherId>=0 && _Bones[fatherId].LodDisableDistance!=0)
+00091                 {
+00092                         float   fatherDist= _Bones[fatherId].LodDisableDistance;
+00093                         // I must disable me at least before my father (never after).
+00094                         if(_Bones[i].LodDisableDistance==0)
+00095                                 _Bones[i].LodDisableDistance= fatherDist;
+00096                         else
+00097                                 _Bones[i].LodDisableDistance= min(_Bones[i].LodDisableDistance, fatherDist);
+00098                 }
+00099         }
+00100 
+00101         // build Lod Information.
+00102         //==============
+00103         _Lods.clear();
+00104 
+00105         // build all distances used.
+00106         set<float>      distSet;
+00107         for(i=0;i<_Bones.size();i++)
+00108         {
+00109                 float   dist= _Bones[i].LodDisableDistance;
+00110                 // if lod enabled for this bone, add a new distance, or do nothing
+00111                 if(dist>0)
+00112                         distSet.insert(dist);
+00113         }
+00114 
+00115         // create a lod for each distance used + 1 (the "dist==0" distance).
+00116         _Lods.resize(distSet.size() + 1);
+00117         // create the default lod: all bones activated.
+00118         _Lods[0].Distance=0;
+00119         _Lods[0].ActiveBones.resize(_Bones.size(), 0xFF);
+00120 
+00121         // For each lods not 0th.
+00122         set<float>::iterator    it= distSet.begin();
+00123         for(uint j=1; j<_Lods.size(); j++, it++)
+00124         {
+00125                 float   lodDist= *it;
+00126                 // set the distance of activation
+00127                 _Lods[j].Distance= lodDist;
+00128                 // resize and default to all enabled.
+00129                 _Lods[j].ActiveBones.resize(_Bones.size(), 0xFF);
+00130 
+00131                 // Search what lod are to be disabled at this distance.
+00132                 for(i=0;i<_Bones.size();i++)
+00133                 {
+00134                         float   dist= _Bones[i].LodDisableDistance;
+00135                         // if the dist of the lod is greater (or equal) to the disableDist of the bone, 
+00136                         // and if the bone is not "always enabled", disable the bone
+00137                         if(lodDist>=dist && dist!=0 )
+00138                                 _Lods[j].ActiveBones[i]= 0;
+00139                 }
+00140 
+00141         }
+00142 
+00143 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NL3D::CSkeletonShape::clip const std::vector< CPlane > &  pyramid,
const CMatrix worldMatrix
[virtual]
+
+ + + + + +
+   + + +

+clip this skeleton. +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 216 of file skeleton_shape.cpp. +

+References NLMISC::CBSphere::applyTransform(), NLMISC::CBSphere::Center, NLMISC::CAABBox::getCenter(), NLMISC::CAABBox::getRadius(), NLMISC::CBSphere::Radius, and sint. +

+

00217 {
+00218         // Speed Clip: clip just the sphere.
+00219         CBSphere        localSphere(_BBox.getCenter(), _BBox.getRadius());
+00220         CBSphere        worldSphere;
+00221 
+00222         // transform the sphere in WorldMatrix (with nearly good scale info).
+00223         localSphere.applyTransform(worldMatrix, worldSphere);
+00224 
+00225         // if out of only plane, entirely out.
+00226         for(sint i=0;i<(sint)pyramid.size();i++)
+00227         {
+00228                 // We are sure that pyramid has normalized plane normals.
+00229                 // if SpherMax OUT return false.
+00230                 float   d= pyramid[i]*worldSphere.Center;
+00231                 if(d>worldSphere.Radius)
+00232                         return false;
+00233         }
+00234 
+00235         return true;
+00236 }
+
+

+ + + + +
+ + + + + + + + + + +
CTransformShape * NL3D::CSkeletonShape::createInstance CScene scene  )  [virtual]
+
+ + + + + +
+   + + +

+Create a CSkeletonModel, which contains bones. +

+ +

+Reimplemented from NL3D::IShape. +

+Definition at line 154 of file skeleton_shape.cpp. +

+References NL3D::CSkeletonModel::Bones, NL3D::CScene::createModel(), NL3D::CSkeletonModel::initBoneUsages(), NL3D::CTransform::setLoadBalancingGroup(), NL3D::CTransformShape::Shape, and sint. +

+

00155 {
+00156         // Create a CSkeletonModel, an instance of a mesh.
+00157         //===============================================
+00158         CSkeletonModel          *sm= (CSkeletonModel*)scene.createModel(NL3D::SkeletonModelId);
+00159         sm->Shape= this;
+00160 
+00161         // setup bones.
+00162         //=================
+00163         sm->Bones.reserve(_Bones.size());
+00164         for(sint i=0;i<(sint)_Bones.size();i++)
+00165         {
+00166                 // Append a new bone.
+00167                 sm->Bones.push_back( CBone(&_Bones[i]) );
+00168 
+00169                 // Must set the Animatable father of the bone (the skeleton model!).
+00170                 sm->Bones[i].setFather(sm, CSkeletonModel::OwnerBit);
+00171         }
+00172 
+00173         // Must create and init skeleton bone usage to 0.
+00174         sm->initBoneUsages();
+00175 
+00176         // For skinning: setup skeleton in Skin LoadBalancing group
+00177         sm->setLoadBalancingGroup("Skin");
+00178 
+00179         return sm;
+00180 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
virtual void NL3D::CSkeletonShape::flushTextures IDriver driver,
uint  selectedTexture
[inline, virtual]
+
+ + + + + +
+   + + +

+flush textures used by this shape. +

+ +

+Implements NL3D::IShape. +

+Definition at line 110 of file skeleton_shape.h. +

+References uint. +

+

00110 {};
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CSkeletonShape::getAABBox NLMISC::CAABBox bbox  )  const [virtual]
+
+ + + + + +
+   + + +

+return the bounding box of the shape. Default is to return Null bbox. +

+Reimplemented from NL3D::IShape. +

+Definition at line 240 of file skeleton_shape.cpp. +

+

00241 {
+00242         bbox= _BBox;
+00243 }
+
+

+ + + + +
+ + + + + + + + + + +
sint32 NL3D::CSkeletonShape::getBoneIdByName const std::string &  name  )  const
+
+ + + + + +
+   + + +

+Return the id of a bone, from it's name. -1 if not present. +

+ +

+Definition at line 61 of file skeleton_shape.cpp. +

+References sint32. +

+Referenced by NL3D::CSkeletonModel::getBoneIdByName(). +

+

00062 {
+00063         std::map<std::string, uint32>::const_iterator   it= _BoneMap.find(name);
+00064         if(it==_BoneMap.end())
+00065                 return -1;
+00066         else
+00067                 return it->second;
+00068 }
+
+

+ + + + +
+ + + + + + + + + +
virtual std::string NLMISC::IClassable::getClassName  )  [pure virtual, inherited]
+
+ + + + + +
+   + + +

+ +

+Implemented in NLAIAGENT::CNumericIndex, NLAIC::IPointerGestion, NLAIC::CIdentType, and CAutomataDesc. +

+Referenced by NLMISC::CClassRegistry::checkObject(), and NL3D::GetTextureSize().

+

+ + + + +
+ + + + + + + + + +
float NL3D::IShape::getDistMax  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+return the DistMax where the shape is no more displayed. Default is to return -1, meaning DistMax = infinite. +

+Definition at line 112 of file shape.h. +

+

00112 {return _DistMax;}
+
+

+ + + + +
+ + + + + + + + + + +
const CLod& NL3D::CSkeletonShape::getLod uint  lod  )  const [inline]
+
+ + + + + +
+   + + +

+get lod information. +

+ +

+Definition at line 119 of file skeleton_shape.h. +

+References uint. +

+Referenced by NL3D::CSkeletonModel::traverseAnimDetail(), and NL3D::CSkeletonModel::updateBoneToCompute(). +

+

00119 {return _Lods[lod];}
+
+

+ + + + +
+ + + + + + + + + + +
uint NL3D::CSkeletonShape::getLodForDistance float  dist  )  const
+
+ + + + + +
+   + + +

+retrieve the lod to use for a given distance (log(n)). +

+ +

+Definition at line 247 of file skeleton_shape.cpp. +

+References uint. +

+Referenced by NL3D::CSkeletonModel::traverseAnimDetail(). +

+

00248 {
+00249         uint    start=0;
+00250         uint    end= _Lods.size();
+00251         // find lower_bound by dichotomy
+00252         while(end-1>start)
+00253         {
+00254                 uint    pivot= (end+start)/2;
+00255                 // return the lower_bound, ie return first start with _Lods[pivot].Distance<=dist
+00256                 if(_Lods[pivot].Distance <= dist)
+00257                         start= pivot;
+00258                 else
+00259                         end= pivot;
+00260         }
+00261 
+00262         return start;
+00263 }
+
+

+ + + + +
+ + + + + + + + + +
uint NL3D::CSkeletonShape::getNumLods  )  const [inline]
+
+ + + + + +
+   + + +

+ +

+Definition at line 120 of file skeleton_shape.h. +

+References uint. +

+Referenced by NL3D::CSkeletonModel::traverseAnimDetail(), and NL3D::CSkeletonModel::updateBoneToCompute(). +

+

00120 {return _Lods.size();}
+
+

+ + + + +
+ + + + + + + + + + +
float NL3D::CSkeletonShape::getNumTriangles float  distance  )  [virtual]
+
+ + + + + +
+   + + +

+get an approximation of the number of triangles this instance will render for a fixed distance. +

+ +

+Implements NL3D::IShape. +

+Definition at line 208 of file skeleton_shape.cpp. +

+

00209 {
+00210         // No polygons
+00211         return 0;
+00212 }
+
+

+ + + + +
+ + + + + + + + + +
const sint& NLMISC::CRefCount::getRefCount  )  const [inline, inherited]
+
+ + + + + +
+   + + +

+ +

+Definition at line 70 of file smart_ptr.h. +

+References NLMISC::CRefCount::crefs, and sint. +

+

00071         {
+00072                 return  crefs;
+00073         }
+
+

+ + + + +
+ + + + + + + + + + +
NL3D::CSkeletonShape::NLMISC_DECLARE_CLASS CSkeletonShape   ) 
+
+ + + + + +
+   + + +

+clip this skeleton. +

+

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void NL3D::IShape::profileSceneRender CRenderTrav rdrTrav,
CTransformShape trans,
bool  opaquePass
[inline, virtual, inherited]
+
+ + + + + +
+   + + +

+Profiling. Called in RenderPass if Current Frame profiled. No-Op by default Informations must be added in rdrTrav->Scene +

+Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod. +

+Definition at line 123 of file shape.h. +

+

00123 {}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
virtual void NL3D::CSkeletonShape::render IDriver drv,
CTransformShape trans,
bool  opaquePass
[inline, virtual]
+
+ + + + + +
+   + + +

+render() this skeletonshape in a driver (no-op) +

+ +

+Implements NL3D::IShape. +

+Definition at line 94 of file skeleton_shape.h. +

+

00095         {
+00096         }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::CSkeletonShape::retrieve std::vector< CBoneBase > &  bones  )  const
+
+ + + + + +
+   + + +

+Retrieve Bones Information. +

+Definition at line 147 of file skeleton_shape.cpp. +

+

00148 {
+00149         bones= _Bones;
+00150 }
+
+

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

+serial this skeletonshape. +

+ +

+Implements NLMISC::IStreamable. +

+Definition at line 183 of file skeleton_shape.cpp. +

+References sint. +

+

00184 {
+00185         /*
+00186         Version 1:
+00187                 - _Lods.
+00188         */
+00189         sint    ver= f.serialVersion(1);
+00190 
+00191         f.serialCont(_Bones);
+00192         f.serialCont(_BoneMap);
+00193 
+00194         if(ver>=1)
+00195                 f.serialCont(_Lods);
+00196         else
+00197         {
+00198                 // create a skeleton shape with bones activated all the time
+00199                 _Lods.resize(1);
+00200                 // create the default lod: all bones activated.
+00201                 _Lods[0].Distance=0;
+00202                 _Lods[0].ActiveBones.resize(_Bones.size(), 0xFF);
+00203         }
+00204 }
+
+

+ + + + +
+ + + + + + + + + + +
void NL3D::IShape::setDistMax float  distMax  )  [inherited]
+
+ + + + + +
+   + + +

+setup the DistMax where the shape is no more displayed. Take effect only for the next created instances. setting <0 means -1 and so means DistMax = infinite. +

+Definition at line 66 of file shape.cpp. +

+Referenced by NL3D::CFlareShape::CFlareShape(). +

+

00067 {
+00068         _DistMax= distMax;
+00069         // normalize infinite setup.
+00070         if(distMax<0)
+00071                 _DistMax= -1;
+00072 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
virtual IMeshGeom* NL3D::IShape::supportMeshBlockRendering CTransformShape trans,
float &  polygonCount
const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+return !NULL if this shape can support MeshBlock rendering for a special instance. NB: Mesh Block render cannot occurs if the Mesh is Skinned/MeshMorphed. NB: Mesh Block render can occurs only in Opaque pass NB: Mesh block render can occurs only for CMeshBase meshes.

Parameters:
+ + + +
trans the instance to take into account (meshMultiLod may return NULL in blend transition).
polygonCount the number of polygons to render for the meshGeom returned
+
+
Returns:
the meshgeom to render per block if OK, else NULL (default)
+ +

+Reimplemented in NL3D::CMesh, NL3D::CMeshMRM, NL3D::CMeshMRMSkinned, and NL3D::CMeshMultiLod. +

+Definition at line 158 of file shape.h. +

+

00158 {return NULL;}
+
+

+ + + + +
+ + + + + + + + + +
virtual bool NL3D::IShape::useLightingLocalAttenuation  )  const [inline, virtual, inherited]
+
+ + + + + +
+   + + +

+tells if the shape wants LocalAttenuation for RealTime lighting. Default is false +

+Reimplemented in NL3D::CMeshBase. +

+Definition at line 142 of file shape.h. +

+

00142 {return false;}
+
+


Friends And Related Function Documentation

+

+ + + + +
+ + +
friend struct CPtrInfo [friend, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 67 of file smart_ptr.h.

+


Field Documentation

+

+ + + + +
+ + +
NLMISC::CAABBox NL3D::CSkeletonShape::_BBox [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 126 of file skeleton_shape.h.

+

+ + + + +
+ + +
std::map<std::string, uint32> NL3D::CSkeletonShape::_BoneMap [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 125 of file skeleton_shape.h.

+

+ + + + +
+ + +
std::vector<CBoneBase> NL3D::CSkeletonShape::_Bones [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 124 of file skeleton_shape.h.

+

+ + + + +
+ + +
float NL3D::IShape::_DistMax [protected, inherited] +
+
+ + + + + +
+   + + +

+Default to -1. +

+ +

+Definition at line 165 of file shape.h.

+

+ + + + +
+ + +
std::vector<CLod> NL3D::CSkeletonShape::_Lods [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 128 of file skeleton_shape.h.

+

+ + + + +
+ + +
sint NLMISC::CRefCount::crefs [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 79 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), NLMISC::CRefCount::getRefCount(), and NLMISC::CRefCount::~CRefCount().

+

+ + + + +
+ + +
CRefCount::CPtrInfo NLMISC::CRefCount::NullPtrInfo [static, inherited] +
+
+ + + + + +
+   + + +

+ +

+Referenced by NLMISC::CRefCount::CRefCount().

+

+ + + + +
+ + +
CPtrInfo* NLMISC::CRefCount::pinfo [mutable, inherited] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 80 of file smart_ptr.h. +

+Referenced by NLMISC::CRefCount::CRefCount(), and NLMISC::CRefCount::~CRefCount().

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 07:46:19 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1