# 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  

bone.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_BONE_H
00027 #define NL_BONE_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "3d/transformable.h"
00031 #include "nel/misc/smart_ptr.h"
00032 
00033 
00034 namespace NL3D
00035 {
00036 
00037 
00038 // ***************************************************************************
00046 class CBoneBase : public NLMISC::CRefCount
00047 {
00048 public:
00050         std::string                             Name;
00051 
00053         CMatrix                                 InvBindPos;
00054 
00056         sint32                                  FatherId;
00057 
00059         bool                                    UnheritScale;
00060 
00062         CTrackDefaultVector             DefaultPos;
00063         CTrackDefaultVector             DefaultRotEuler;
00064         CTrackDefaultQuat               DefaultRotQuat;
00065         CTrackDefaultVector             DefaultScale;
00066         CTrackDefaultVector             DefaultPivot;
00067 
00069         float                                   LodDisableDistance;
00070 
00071 public:
00072 
00074         CBoneBase();
00075 
00077         void                    serial(NLMISC::IStream &f);
00078 
00079 };
00080 
00081 
00082 // ***************************************************************************
00089 class CBone : public ITransformable
00090 {
00091 public:
00092 
00099         CBone(CBoneBase *boneBase);
00100 
00101 
00103         const std::string       &getBoneName() const {nlassert(_BoneBase); return _BoneBase->Name;}
00105         sint32                          getFatherId() const {nlassert(_BoneBase); return _BoneBase->FatherId;}
00106 
00107 
00109         // @{
00111         virtual ITrack* getDefaultTrack (uint valueId);
00112 
00114         virtual void    registerToChannelMixer(CChannelMixer *chanMixer, const std::string &prefix);
00115         // @}
00116 
00117 
00125         void                    compute(CBone *parent, const CMatrix &rootMatrix);
00126 
00131         void                    interpolateBoneSkinMatrix(const CMatrix &otherMatrix, float interp);
00132 
00134         const CMatrix   &getLocalSkeletonMatrix() const {return _LocalSkeletonMatrix;}
00135 
00137         const CMatrix   &getWorldMatrix() const {return _WorldMatrix;}
00138 
00140         const CMatrix   &getBoneSkinMatrix() const {return _BoneSkinMatrix;}
00141 
00142 
00144         void                    lodEnableChannels(CChannelMixer *chanMixer, bool enable);
00145 
00146 
00147 // *************************
00148 private:
00149         // the boneBase of the skeletonShape which create this bone..
00150         NLMISC::CRefPtr<CBoneBase>      _BoneBase;
00151 
00152         // The result Matrix, local to the skeleton.
00153         CMatrix                                         _LocalSkeletonMatrix;
00154         // The result WorldMatrix.
00155         CMatrix                                         _WorldMatrix;
00156         // The result Disaplcement _LocalSkeletonMatrix, local to the skeleton.
00157         CMatrix                                         _BoneSkinMatrix;
00158 
00159         // The bkuped channelIds for each channel of the bone. -1 if not registered (or no tracks in animationSet).
00160         sint                                            _PosChannelId;
00161         sint                                            _RotEulerChannelId;
00162         sint                                            _RotQuatChannelId;
00163         sint                                            _ScaleChannelId;
00164         sint                                            _PivotChannelId;
00165 };
00166 
00167 
00168 } // NL3D
00169 
00170 
00171 #endif // NL_BONE_H
00172 
00173 /* End of bone.h */