From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- .../nel/animation__set__user_8h-source.html | 281 +++++++++++++++++++++ 1 file changed, 281 insertions(+) create mode 100644 docs/doxygen/nel/animation__set__user_8h-source.html (limited to 'docs/doxygen/nel/animation__set__user_8h-source.html') diff --git a/docs/doxygen/nel/animation__set__user_8h-source.html b/docs/doxygen/nel/animation__set__user_8h-source.html new file mode 100644 index 00000000..1a561479 --- /dev/null +++ b/docs/doxygen/nel/animation__set__user_8h-source.html @@ -0,0 +1,281 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# 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  
+

animation_set_user.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_ANIMATION_SET_USER_H
+00027 #define NL_ANIMATION_SET_USER_H
+00028 
+00029 #include "nel/misc/types_nl.h"
+00030 #include "nel/misc/stream.h"
+00031 #include "nel/misc/smart_ptr.h"
+00032 #include "nel/misc/file.h"
+00033 #include "nel/misc/path.h"
+00034 
+00035 #include "nel/3d/u_animation_set.h"
+00036 
+00037 #include "3d/animation_set.h"
+00038 
+00039 #define NL3D_MEM_ANIMATION_SET                                          NL_ALLOC_CONTEXT( 3dAnmSt )
+00040 
+00041 namespace NL3D 
+00042 {
+00043 
+00044 
+00045 class   CPlayListManagerUser;
+00046 
+00047 
+00048 // ***************************************************************************
+00055 class CAnimationSetUser : public UAnimationSet
+00056 {
+00057 private:
+00058         NLMISC::CSmartPtr<CAnimationSet>                _AnimationSet;
+00059         friend class CPlayListManagerUser;
+00060         friend class CSceneUser;
+00061 
+00062 public:
+00063 
+00065         CAnimationSetUser()
+00066         {
+00067                 NL3D_MEM_ANIMATION_SET
+00068 
+00069                 nlassert((uint)UAnimationSet::NotFound == (uint)CAnimationSet::NotFound );
+00070 
+00071                 // create a smartptred animation set.
+00072                 _AnimationSet= new CAnimationSet;
+00073         }
+00074 
+00076         CAnimationSetUser(NLMISC::IStream       &f)
+00077         {
+00078                 NL3D_MEM_ANIMATION_SET
+00079 
+00080                 nlassert((uint)UAnimationSet::NotFound == (uint)CAnimationSet::NotFound );
+00081 
+00082                 // create a smartptred animation set.
+00083                 _AnimationSet= new CAnimationSet;
+00084 
+00085                 _AnimationSet->serial(f);
+00086         }
+00087 
+00095         uint addAnimation (const char* fileName, const char* animName)
+00096         {
+00097                 NL3D_MEM_ANIMATION_SET
+00098 
+00099                 // Allocate an animation
+00100                 std::auto_ptr<CAnimation> anim (new CAnimation);
+00101 
+00102                 // Read it
+00103                 NLMISC::CIFile file;
+00104                 std::string path = NLMISC::CPath::lookup (fileName, false, true);
+00105                 if (path.empty())
+00106                         path = fileName;
+00107                 if ( file.open ( path ) )
+00108                 {
+00109                         // Serial the animation
+00110                         file.serial (*anim);
+00111 
+00112                         // Add the animation
+00113                         uint id=_AnimationSet->addAnimation (animName, anim.release());
+00114 
+00115                         // Return id
+00116                         return id;
+00117                 }
+00118                 else return UAnimationSet::NotFound;
+00119         }
+00120 
+00124         virtual void build ()
+00125         {
+00126                 NL3D_MEM_ANIMATION_SET
+00127 
+00128                 _AnimationSet->build ();
+00129         }
+00130 
+00139         virtual uint addSkeletonWeight (const char* fileName, const char* skelName)
+00140         {
+00141                 NL3D_MEM_ANIMATION_SET
+00142 
+00143                 // Allocate an animation
+00144                 std::auto_ptr<CSkeletonWeight> skeletonWeight (new CSkeletonWeight);
+00145 
+00146                 // Read it
+00147                 NLMISC::CIFile file;
+00148                 if (file.open ( NLMISC::CPath::lookup( fileName ) ) )
+00149                 {
+00150                         // Serial the animation
+00151                         file.serial (*skeletonWeight);
+00152 
+00153                         // Add the animation
+00154                         uint id=_AnimationSet->addSkeletonWeight (skelName, skeletonWeight.release());
+00155 
+00156                         // Return id
+00157                         return id;
+00158                 }
+00159                 else return UAnimationSet::NotFound;
+00160         }
+00161 
+00163         // @{
+00167         virtual uint getNumAnimation () const 
+00168         {
+00169                 NL3D_MEM_ANIMATION_SET
+00170 
+00171                 return _AnimationSet->getNumAnimation();
+00172         }
+00173 
+00177         virtual uint getAnimationIdByName (const std::string& name) const  
+00178         {
+00179                 NL3D_MEM_ANIMATION_SET
+00180 
+00181                 return _AnimationSet->getAnimationIdByName(name);
+00182         }
+00183 
+00187         virtual const std::string& getAnimationName (uint animationId) const 
+00188         {
+00189                 NL3D_MEM_ANIMATION_SET
+00190 
+00191                 if(animationId>=getNumAnimation())
+00192                         nlerror("getAnimation*(): bad animation Id");
+00193                 return _AnimationSet->getAnimationName(animationId);
+00194         }
+00195 
+00201         virtual UAnimation* getAnimation (uint animationId);
+00202 
+00203         // @}
+00204 
+00205 
+00207         // @{
+00211         virtual uint getNumSkeletonWeight () const 
+00212         {
+00213                 NL3D_MEM_ANIMATION_SET
+00214 
+00215                 return _AnimationSet->getNumSkeletonWeight();
+00216         }
+00217 
+00221         virtual uint getSkeletonWeightIdByName (const std::string& name) const 
+00222         {
+00223                 NL3D_MEM_ANIMATION_SET
+00224 
+00225                 return _AnimationSet->getSkeletonWeightIdByName(name);
+00226         }
+00227 
+00231         virtual const std::string& getSkeletonWeightName (uint skeletonId) const 
+00232         {
+00233                 NL3D_MEM_ANIMATION_SET
+00234 
+00235                 if(skeletonId>=getNumSkeletonWeight())
+00236                         nlerror("getSkeletonWeight*(): bad SkeletonWeight Id");
+00237                 return _AnimationSet->getSkeletonWeightName(skeletonId);
+00238         }
+00239 
+00240         // @}
+00241 
+00242 
+00244         // @{
+00245 
+00246         virtual uint getChannelIdByName (const std::string& name) const
+00247         {
+00248                 NL3D_MEM_ANIMATION_SET
+00249 
+00250                 return _AnimationSet->getChannelIdByName(name);
+00251         }
+00252 
+00253         // @}
+00254 
+00255         // Access the animation set
+00256         const CAnimationSet* getAnimationSet () const;
+00257 };
+00258 
+00259 } // NL3D
+00260 
+00261 
+00262 #endif // NL_ANIMATION_SET_USER_H
+00263 
+00264 /* End of animation_set_user.h */
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1