fbxaxissystem.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 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 
00013 #ifndef _FBXSDK_SCENE_AXIS_SYSTEM_H_
00014 #define _FBXSDK_SCENE_AXIS_SYSTEM_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/base/fbxarray.h>
00019 #include <fbxsdk/core/base/fbxstring.h>
00020 #include <fbxsdk/core/math/fbxmatrix.h>
00021 
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023 
00024 class FbxNode;
00025 class FbxScene;
00026 class FbxAnimCurveNode;
00027 
00102 class FBXSDK_DLL FbxAxisSystem
00103 {
00104 public:
00105 
00108     enum EUpVector
00109     {
00110         eXAxis = 1,
00111         eYAxis = 2,
00112         eZAxis = 3
00113     };
00114     
00122     enum EFrontVector
00123     {
00124         eParityEven = 1,
00125         eParityOdd = 2
00126     };
00127 
00133     enum ECoordSystem
00134     {
00135         eRightHanded,
00136         eLeftHanded
00137     };
00138 
00142     enum EPreDefinedAxisSystem
00143     {
00144         eMayaZUp,           
00145         eMayaYUp,           
00146         eMax,               
00147         eMotionBuilder,     
00148         eOpenGL,            
00149         eDirectX,           
00150         eLightwave          
00151     };
00152 
00157 
00163     FbxAxisSystem(EUpVector pUpVector, EFrontVector pFrontVector, ECoordSystem pCoorSystem);
00164 
00168     FbxAxisSystem(const FbxAxisSystem& pAxisSystem);
00169 
00173     FbxAxisSystem(const EPreDefinedAxisSystem pAxisSystem);
00174 
00176     virtual ~FbxAxisSystem();
00178 
00183 
00188     bool operator==(const FbxAxisSystem& pAxisSystem)const;
00189 
00194     bool operator!=(const FbxAxisSystem& pAxisSystem)const;
00196 
00200     FbxAxisSystem& operator=(const FbxAxisSystem& pAxisSystem);
00201 
00207 
00209     static const FbxAxisSystem MayaZUp;
00210 
00212     static const FbxAxisSystem MayaYUp;
00213 
00215     static const FbxAxisSystem Max;
00216 
00218     static const FbxAxisSystem Motionbuilder;
00219 
00221     static const FbxAxisSystem OpenGL;
00222 
00224     static const FbxAxisSystem DirectX;
00225 
00227     static const FbxAxisSystem Lightwave;
00229 
00233     void ConvertScene(FbxScene* pScene) const;
00234 
00241     void ConvertScene(FbxScene* pScene, FbxNode* pFbxRoot) const;
00242     
00247     EFrontVector GetFrontVector( int & pSign ) const;
00248 
00253     EUpVector GetUpVector( int & pSign ) const;
00254 
00258     ECoordSystem GetCoorSystem() const;
00259 
00267     void ConvertChildren(FbxNode* pRoot, const FbxAxisSystem& pSrcSystem) const;
00268 
00270 //
00271 //  WARNING!
00272 //
00273 //    Anything beyond these lines may not be documented accurately and is 
00274 //     subject to change without notice.
00275 //
00277 protected:
00278     class AxisDef
00279     {
00280     public:
00281         enum EAxis {eXAxis, eYAxis, eZAxis};
00282 
00283         EAxis   mAxis;
00284         int     mSign;
00285 
00286         bool operator==(const AxisDef& pAxis) const
00287         {
00288             return (mAxis == pAxis.mAxis) && (mSign == pAxis.mSign);
00289         }
00290     };
00291 
00293     AxisDef mUpVector;
00294 
00296     AxisDef mFrontVector;
00297 
00299     AxisDef mCoorSystem;
00300 
00301 protected:
00303     // Conversion engine, here you will find all the step involved into the conversion
00304 
00306     void ConvertTProperty(FbxArray<FbxNode*>& pNodes, const FbxAxisSystem& pFrom) const;
00307 
00309     void ConvertCurveNodes(FbxArray<FbxAnimCurveNode*>& pCurveNodes, const FbxAxisSystem& pFrom) const;
00310 
00312     void AdjustPreRotation(FbxNode* pNode, const FbxMatrix& pConversionRM) const;
00313 
00315     void AdjustPivots(FbxNode* pNode, const FbxMatrix& pConversionRM) const;
00316 
00318     void GetConversionMatrix(const FbxAxisSystem& pFrom, FbxMatrix& pConversionRM) const;
00319 
00321     void AdjustLimits(FbxNode* pNode, const FbxMatrix& pConversionRM) const;
00322 
00324     void AdjustPoses(FbxScene* pScene, const FbxMatrix& pConversionRM) const;
00325 
00327     void AdjustCamera(FbxNode* pNode, const FbxMatrix& pConversionRM ) const;
00328 
00330     void AdjustCluster(FbxNode* pNode, const FbxMatrix& pConversionRM) const;
00331 
00333     void ConvertChildren(FbxNode* pRoot, const FbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const;
00334 
00335     friend class FbxGlobalSettings;
00336 };
00337 
00338 #include <fbxsdk/fbxsdk_nsend.h>
00339 
00340 #endif /* _FBXSDK_SCENE_AXIS_SYSTEM_H_ */