kfbxaxissystem.h

Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00006 
00007 /**************************************************************************************
00008 
00009  Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors.
00010  All Rights Reserved.
00011 
00012  The coded instructions, statements, computer programs, and/or related material 
00013  (collectively the "Data") in these files contain unpublished information 
00014  proprietary to Autodesk, Inc. and/or its licensors, which is protected by 
00015  Canada and United States of America federal copyright law and by international 
00016  treaties. 
00017  
00018  The Data may not be disclosed or distributed to third parties, in whole or in
00019  part, without the prior written consent of Autodesk, Inc. ("Autodesk").
00020 
00021  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00022  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
00023  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING
00024  BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, 
00025  NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. 
00026  WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION
00027  OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. 
00028  
00029  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
00030  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES
00031  OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER
00032  SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE
00033  OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND),
00034  HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED
00035  FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE,
00036  ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE,
00037  WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS
00038  OR DAMAGE. 
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 //  WARNING!
00219 //
00220 //    Anything beyond these lines may not be documented accurately and is 
00221 //     subject to change without notice.
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     // Conversion engine, here you will find all the step involed into the conversion
00250 
00251     // Convert Translation and Rotation FCurve.
00252     void ConvertTProperty(KArrayTemplate<KFbxNode*>& pNodes, const KFbxAxisSystem& pFrom) const;
00253     void ConvertFCurve(KArrayTemplate<KFCurve*>& pFCurves, const KFbxAxisSystem& pFrom)const;
00254 
00255     // Adjust Pre rotation to orient the node and children correctly.
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