FBX SDK Reference Guide: kfbxaxissystem.h Source File
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 © 2001 - 2008 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     
00076     /* \enum eFrontVector. Vector with origin at the screen pointing toward the camera.
00077      * This is a subset of enum eUpVector because axis cannot be repeated.
00078      * - \e ParityEven
00079      * - \e ParityOdd
00080      */
00081     enum eFrontVector {
00082         ParityEven = 1,
00083         ParityOdd  = 2
00084     };
00085 
00086     /* \enum eCoorSystem.
00087     * - \e RightHanded
00088     * - \e LeftHanded
00089     */
00090     enum eCoorSystem {
00091         RightHanded = 0,
00092         LeftHanded  = 1
00093     };
00094 
00095     /* \enum ePreDefinedAxisSystem.
00096     * - \e eMayaZUp
00097     * - \e eMayaYUp
00098     * - \e eMax
00099     * - \e eMotionBuilder
00100     * - \e eOpenGL
00101     * - \e eDirectX
00102     * - \e eLightwave
00103     */
00104     enum ePreDefinedAxisSystem {
00105         eMayaZUp = 0,
00106         eMayaYUp,
00107         eMax,
00108         eMotionBuilder,
00109         eOpenGL,
00110         eDirectX,
00111         eLightwave
00112     };
00113 
00114     KFbxAxisSystem(eUpVector pUpVector, eFrontVector pFrontVector, eCoorSystem pCoorSystem);
00115     KFbxAxisSystem(const KFbxAxisSystem& pAxisSystem);
00116     KFbxAxisSystem(const ePreDefinedAxisSystem pAxisSystem);
00117     virtual ~KFbxAxisSystem();
00118 
00119     bool operator==(const KFbxAxisSystem& pAxisSystem)const;
00120     bool operator!=(const KFbxAxisSystem& pAxisSystem)const;
00121     KFbxAxisSystem& operator=(const KFbxAxisSystem& pAxisSystem);
00122 
00123     static const KFbxAxisSystem MayaZUp;
00124     static const KFbxAxisSystem MayaYUp;
00125     static const KFbxAxisSystem Max;
00126     static const KFbxAxisSystem Motionbuilder;
00127     static const KFbxAxisSystem OpenGL;
00128     static const KFbxAxisSystem DirectX;
00129     static const KFbxAxisSystem Lightwave;
00130 
00135     void ConvertScene(KFbxScene* pScene) const;
00136 
00144     void ConvertScene(KFbxScene* pScene, KFbxNode* pFbxRoot) const;
00145 
00149     eUpVector GetUpVector( int & pSign ) const;
00150 
00153     eCoorSystem GetCoorSystem() const;
00154 
00162     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem) const;
00163 
00165 //
00166 //  WARNING!
00167 //
00168 //  Anything beyond these lines may not be documented accurately and is 
00169 //  subject to change without notice.
00170 //
00172 
00173 protected:
00174 
00175     class KFbxAxis
00176     {
00177     public:
00178         enum eAxis {
00179             eXAxis = 0, eYAxis, eZAxis
00180         };
00181 
00182         eAxis mAxis;
00183         int   mSign;
00184 
00185         bool operator==(const KFbxAxis& pAxis)const
00186         {
00187             return mAxis == pAxis.mAxis && mSign == pAxis.mSign;
00188         }
00189     };
00190 
00191     KFbxAxis mUpVector;
00192     KFbxAxis mFrontVector;
00193     KFbxAxis mCoorSystem;
00194 
00195 protected:
00197     // Conversion engine, here you will find all the step involed into the conversion
00198 
00199     // Convert Translation and Rotation FCurve.
00200     void ConvertTProperty(KArrayTemplate<KFbxNode*>& pNodes, const KFbxAxisSystem& pFrom) const;
00201     void ConvertFCurve(KArrayTemplate<KFCurve*>& pFCurves, const KFbxAxisSystem& pFrom)const;
00202 
00203     // Adjust Pre rotation to orient the node and childs correctly.
00204     void AdjustPreRotation(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00205 
00206     void AdjustPivots(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00207 
00208     void GetConversionMatrix(const KFbxAxisSystem& pFrom, KFbxMatrix& pConversionRM)const;
00209 
00210     void AdjustLimits(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00211 
00212     void AdjustPoses(KFbxScene* pScene, const KFbxMatrix& pConversionRM) const;
00213 
00214     void AdjustCamera(KFbxNode* pNode, const KFbxMatrix& pConversionRM ) const;
00215 
00216     void AdjustCluster(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00217 
00218     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const;
00219 
00220     friend class KFbxGlobalSettings;
00221 };
00222 
00223 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00224 
00225 
00226 #endif // FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00227