FBX SDK Reference Guide: kfbxaxissystem.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef _KFbxAxisSystem_h
00005 #define _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 <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <kaydara.h>
00048 
00049 #include <klib/karrayul.h>
00050 #include <klib/kstring.h>
00051 
00052 #ifndef MB_FBXSDK
00053 #include <kbaselib_nsuse.h>
00054 #endif
00055 
00056 #include <kfcurve/kfcurve_forward.h>
00057 #ifndef MB_FBXSDK
00058 #include <kfcurve/kfcurve_nsuse.h>
00059 #endif
00060 
00061 #include <kfbxmath/kfbxmatrix.h>
00062 
00063 #include <fbxfilesdk_nsbegin.h>
00064 
00065 class KFbxNode;
00066 class KFbxScene;
00067 
00072 class KFBX_DLL KFbxAxisSystem
00073 {
00074 public:
00075 
00081     enum eUpVector {
00082         XAxis = 1,
00083         YAxis = 2,
00084         ZAxis = 3        
00085     };
00086     
00087     /* \enum eFrontVector. Vector with origin at the screen pointing toward the camera.
00088      * This is a subset of enum eUpVector because axis cannot be repeated.
00089      * - \e ParityEven
00090      * - \e ParityOdd
00091      */
00092     enum eFrontVector {
00093         ParityEven = 1,
00094         ParityOdd  = 2
00095     };
00096 
00097     /* \enum eCoorSystem.
00098     * - \e RightHanded
00099     * - \e LeftHanded
00100     */
00101     enum eCoorSystem {
00102         RightHanded = 0,
00103         LeftHanded  = 1
00104     };
00105 
00106     /* \enum ePreDefinedAxisSystem.
00107     * - \e eMayaZUp
00108     * - \e eMayaYUp
00109     * - \e eMax
00110     * - \e eMotionBuilder
00111     * - \e eOpenGL
00112     * - \e eDirectX
00113     * - \e eLightwave
00114     */
00115     enum ePreDefinedAxisSystem {
00116         eMayaZUp = 0,
00117         eMayaYUp,
00118         eMax,
00119         eMotionBuilder,
00120         eOpenGL,
00121         eDirectX,
00122         eLightwave
00123     };
00124 
00125     KFbxAxisSystem(eUpVector pUpVector, eFrontVector pFrontVector, eCoorSystem pCoorSystem);
00126     KFbxAxisSystem(const KFbxAxisSystem& pAxisSystem);
00127     KFbxAxisSystem(const ePreDefinedAxisSystem pAxisSystem);
00128     virtual ~KFbxAxisSystem();
00129 
00130     bool operator==(const KFbxAxisSystem& pAxisSystem)const;
00131     bool operator!=(const KFbxAxisSystem& pAxisSystem)const;
00132     KFbxAxisSystem& operator=(const KFbxAxisSystem& pAxisSystem);
00133 
00134     static const KFbxAxisSystem MayaZUp;
00135     static const KFbxAxisSystem MayaYUp;
00136     static const KFbxAxisSystem Max;
00137     static const KFbxAxisSystem Motionbuilder;
00138     static const KFbxAxisSystem OpenGL;
00139     static const KFbxAxisSystem DirectX;
00140     static const KFbxAxisSystem Lightwave;
00141 
00146     void ConvertScene(KFbxScene* pScene) const;
00147 
00155     void ConvertScene(KFbxScene* pScene, KFbxNode* pFbxRoot) const;
00156 
00160     eUpVector GetUpVector( int & pSign ) const;
00161 
00164     eCoorSystem GetCoorSystem() const;
00165 
00171     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem) const;
00172 
00174 //
00175 //  WARNING!
00176 //
00177 //  Anything beyond these lines may not be documented accurately and is 
00178 //  subject to change without notice.
00179 //
00181 
00182 protected:
00183 
00184     class KFbxAxis
00185     {
00186     public:
00187         enum eAxis {
00188             eXAxis = 0, eYAxis, eZAxis
00189         };
00190 
00191         eAxis mAxis;
00192         int   mSign;
00193 
00194         bool operator==(const KFbxAxis& pAxis)const
00195         {
00196             return mAxis == pAxis.mAxis && mSign == pAxis.mSign;
00197         }
00198     };
00199 
00200     KFbxAxis mUpVector;
00201     KFbxAxis mFrontVector;
00202     KFbxAxis mCoorSystem;
00203 
00204 protected:
00206     // Conversion engine, here you will find all the step involed into the conversion
00207 
00208     // Convert Translation and Rotation FCurve.
00209     void ConvertTProperty(KArrayTemplate<KFbxNode*>& pNodes, const KFbxAxisSystem& pFrom) const;
00210     void ConvertFCurve(KArrayTemplate<KFCurve*>& pFCurves, const KFbxAxisSystem& pFrom)const;
00211 
00212     // Adjust Pre rotation to orient the node and childs correctly.
00213     void AdjustPreRotation(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00214 
00215     void AdjustPivots(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00216 
00217     void GetConversionMatrix(const KFbxAxisSystem& pFrom, KFbxMatrix& pConversionRM)const;
00218 
00219     void AdjustLimits(KFbxNode* pNode, const KFbxMatrix& pConversionRM)const;
00220 
00221     void AdjustPoses(KFbxScene* pScene, const KFbxMatrix& pConversionRM) const;
00222 
00223     void AdjustCamera(KFbxNode* pNode, const KFbxMatrix& pConversionRM ) const;
00224 
00225     void AdjustCluster(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00226 
00227     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const;
00228 
00229     friend class KFbxReaderFbx;
00230     friend class KFbxReaderFbx6;
00231     friend class KFbxWriterFbx;
00232     friend class KFbxWriterFbx6;
00233 
00234     friend class KFbxGlobalSettings;
00235 };
00236 
00237 #include <fbxfilesdk_nsend.h>
00238 
00239 
00240 #endif // _KFbxAxisSystem_h