00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 #include <fbxfilesdk/components/kbaselib/kaydaradef_h.h>
00043 #include <fbxfilesdk/components/kbaselib/kaydara.h>
00044 
00045 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00046 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00047 
00048 #include <fbxfilesdk/components/kfcurve/kfcurve_forward.h>
00049 
00050 #include <fbxfilesdk/kfbxmath/kfbxmatrix.h>
00051 
00052 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00053 
00054 class KFbxNode;
00055 class KFbxScene;
00056 
00061 class KFBX_DLL KFbxAxisSystem
00062 {
00063 public:
00064 
00070     enum eUpVector {
00071         XAxis =    1,
00072         YAxis =    2,
00073         ZAxis =    3
00074     };
00075     
00081     enum eFrontVector {
00082         ParityEven = 1,
00083         ParityOdd  = 2
00084     };
00085 
00090     enum eCoorSystem {
00091         RightHanded = 0,
00092         LeftHanded  = 1
00093     };
00094 
00104     enum ePreDefinedAxisSystem {
00105         eMayaZUp = 0,
00106         eMayaYUp,
00107         eMax,
00108         eMotionBuilder,
00109         eOpenGL,
00110         eDirectX,
00111         eLightwave
00112     };
00113 
00118 
00124     KFbxAxisSystem(eUpVector pUpVector, eFrontVector pFrontVector, eCoorSystem pCoorSystem);
00125 
00129     KFbxAxisSystem(const KFbxAxisSystem& pAxisSystem);
00130 
00134     KFbxAxisSystem(const ePreDefinedAxisSystem pAxisSystem);
00135 
00137     virtual ~KFbxAxisSystem();
00139 
00144 
00149     bool operator==(const KFbxAxisSystem& pAxisSystem)const;
00150 
00155     bool operator!=(const KFbxAxisSystem& pAxisSystem)const;
00157 
00161     KFbxAxisSystem& operator=(const KFbxAxisSystem& pAxisSystem);
00162 
00164     static const KFbxAxisSystem MayaZUp;
00165 
00167     static const KFbxAxisSystem MayaYUp;
00168 
00170     static const KFbxAxisSystem Max;
00171 
00173     static const KFbxAxisSystem Motionbuilder;
00174 
00176     static const KFbxAxisSystem OpenGL;
00177 
00179     static const KFbxAxisSystem DirectX;
00180 
00182     static const KFbxAxisSystem Lightwave;
00183 
00187     void ConvertScene(KFbxScene* pScene) const;
00188 
00195     void ConvertScene(KFbxScene* pScene, KFbxNode* pFbxRoot) const;
00196 
00200     eUpVector GetUpVector( int & pSign ) const;
00201 
00205     eCoorSystem GetCoorSystem() const;
00206 
00214     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem) const;
00215 
00217 
00218 
00219 
00220 
00221 
00222 
00224 
00225 protected:
00226 
00227     class KFbxAxis
00228     {
00229     public:
00230         enum eAxis {
00231             eXAxis = 0, eYAxis, eZAxis
00232         };
00233 
00234         eAxis mAxis;
00235         int   mSign;
00236 
00237         bool operator==(const KFbxAxis& pAxis)const
00238         {
00239             return mAxis == pAxis.mAxis && mSign == pAxis.mSign;
00240         }
00241     };
00242 
00243     KFbxAxis mUpVector;
00244     KFbxAxis mFrontVector;
00245     KFbxAxis mCoorSystem;
00246 
00247 protected:
00249     
00250 
00251     
00252     void ConvertTProperty(KArrayTemplate<KFbxNode*>& pNodes, const KFbxAxisSystem& pFrom) const;
00253     void ConvertFCurve(KArrayTemplate<KFCurve*>& pFCurves, const KFbxAxisSystem& pFrom)const;
00254 
00255     
00256     void AdjustPreRotation(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00257 
00258     void AdjustPivots(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00259 
00260     void GetConversionMatrix(const KFbxAxisSystem& pFrom, KFbxMatrix& pConversionRM)const;
00261 
00262     void AdjustLimits(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00263 
00264     void AdjustPoses(KFbxScene* pScene, const KFbxMatrix& pConversionRM) const;
00265 
00266     void AdjustCamera(KFbxNode* pNode, const KFbxMatrix& pConversionRM ) const;
00267 
00268     void AdjustCluster(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00269 
00270     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const;
00271 
00272     friend class KFbxGlobalSettings;
00273 };
00274 
00275 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00276 
00277 
00278 #endif // FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00279