kfbxaxissystem.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002 
00003    Copyright (C) 2010 Autodesk, Inc.
00004    All rights reserved.
00005 
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009 
00010 ****************************************************************************************/
00011 
00015 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00016 #define FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00017 
00018 #include <fbxfilesdk/fbxfilesdk_def.h>
00019 
00020 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00021 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00022 
00023 #include <fbxfilesdk/kfbxmath/kfbxmatrix.h>
00024 
00025 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00026 
00027 class KFbxNode;
00028 class KFbxScene;
00029 class KFbxAnimCurveNode;
00030 
00105 class KFBX_DLL KFbxAxisSystem
00106 {
00107 public:
00108 
00111     enum eUpVector {
00112         XAxis =    1,
00113         YAxis =    2,
00114         ZAxis =    3
00115     };
00116     
00123     enum eFrontVector {
00124         ParityEven = 1,
00125         ParityOdd  = 2
00126     };
00127 
00133     enum eCoorSystem {
00134         RightHanded = 0,
00135         LeftHanded  = 1
00136     };
00137 
00141     enum ePreDefinedAxisSystem {
00142         eMayaZUp = 0,       
00143         eMayaYUp,           
00144         eMax,               
00145         eMotionBuilder,     
00146         eOpenGL,            
00147         eDirectX,           
00148         eLightwave          
00149     };
00150 
00155 
00161     KFbxAxisSystem(eUpVector pUpVector, eFrontVector pFrontVector, eCoorSystem pCoorSystem);
00162 
00166     KFbxAxisSystem(const KFbxAxisSystem& pAxisSystem);
00167 
00171     KFbxAxisSystem(const ePreDefinedAxisSystem pAxisSystem);
00172 
00174     virtual ~KFbxAxisSystem();
00176 
00181 
00186     bool operator==(const KFbxAxisSystem& pAxisSystem)const;
00187 
00192     bool operator!=(const KFbxAxisSystem& pAxisSystem)const;
00194 
00198     KFbxAxisSystem& operator=(const KFbxAxisSystem& pAxisSystem);
00199 
00205 
00207     static const KFbxAxisSystem MayaZUp;
00208 
00210     static const KFbxAxisSystem MayaYUp;
00211 
00213     static const KFbxAxisSystem Max;
00214 
00216     static const KFbxAxisSystem Motionbuilder;
00217 
00219     static const KFbxAxisSystem OpenGL;
00220 
00222     static const KFbxAxisSystem DirectX;
00223 
00225     static const KFbxAxisSystem Lightwave;
00227 
00231     void ConvertScene(KFbxScene* pScene) const;
00232 
00239     void ConvertScene(KFbxScene* pScene, KFbxNode* pFbxRoot) const;
00240     
00245     eFrontVector GetFrontVector( int & pSign ) const;
00246 
00251     eUpVector GetUpVector( int & pSign ) const;
00252 
00256     eCoorSystem GetCoorSystem() const;
00257 
00265     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem) const;
00266 
00268 //
00269 //  WARNING!
00270 //
00271 //    Anything beyond these lines may not be documented accurately and is 
00272 //     subject to change without notice.
00273 //
00275 
00276 protected:
00277 
00278     class KFbxAxis
00279     {
00280     public:
00281         enum eAxis {
00282             eXAxis = 0, eYAxis, eZAxis
00283         };
00284 
00285         eAxis mAxis;
00286         int   mSign;
00287 
00288         bool operator==(const KFbxAxis& pAxis)const
00289         {
00290             return mAxis == pAxis.mAxis && mSign == pAxis.mSign;
00291         }
00292     };
00293 
00295     KFbxAxis mUpVector;
00296 
00298     KFbxAxis mFrontVector;
00299 
00301     KFbxAxis mCoorSystem;
00302 
00303 protected:
00305     // Conversion engine, here you will find all the step involved into the conversion
00306 
00308     void ConvertTProperty(KArrayTemplate<KFbxNode*>& pNodes, const KFbxAxisSystem& pFrom) const;
00309 
00311     void ConvertCurveNodes(KArrayTemplate<KFbxAnimCurveNode*>& pCurveNodes, const KFbxAxisSystem& pFrom) const;
00312 
00314     void AdjustPreRotation(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00315 
00317     void AdjustPivots(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00318 
00320     void GetConversionMatrix(const KFbxAxisSystem& pFrom, KFbxMatrix& pConversionRM) const;
00321 
00323     void AdjustLimits(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00324 
00326     void AdjustPoses(KFbxScene* pScene, const KFbxMatrix& pConversionRM) const;
00327 
00329     void AdjustCamera(KFbxNode* pNode, const KFbxMatrix& pConversionRM ) const;
00330 
00332     void AdjustCluster(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00333 
00335     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const;
00336 
00337     friend class KFbxGlobalSettings;
00338 };
00339 
00340 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00341 
00342 
00343 #endif // FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00344