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 - 2010 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 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 #include <fbxfilesdk/components/kbaselib/klib/karrayul.h>
00044 #include <fbxfilesdk/components/kbaselib/klib/kstring.h>
00045 
00046 #include <fbxfilesdk/kfbxmath/kfbxmatrix.h>
00047 
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049 
00050 class KFbxNode;
00051 class KFbxScene;
00052 class KFbxAnimCurveNode;
00053 
00083 class KFBX_DLL KFbxAxisSystem
00084 {
00085 public:
00086 
00089     enum eUpVector {
00090         XAxis =    1,
00091         YAxis =    2,
00092         ZAxis =    3
00093     };
00094     
00101     enum eFrontVector {
00102         ParityEven = 1,
00103         ParityOdd  = 2
00104     };
00105 
00111     enum eCoorSystem {
00112         RightHanded = 0,
00113         LeftHanded  = 1
00114     };
00115 
00119     enum ePreDefinedAxisSystem {
00120         eMayaZUp = 0,       
00121         eMayaYUp,           
00122         eMax,               
00123         eMotionBuilder,     
00124         eOpenGL,            
00125         eDirectX,           
00126         eLightwave          
00127     };
00128 
00133 
00139     KFbxAxisSystem(eUpVector pUpVector, eFrontVector pFrontVector, eCoorSystem pCoorSystem);
00140 
00144     KFbxAxisSystem(const KFbxAxisSystem& pAxisSystem);
00145 
00149     KFbxAxisSystem(const ePreDefinedAxisSystem pAxisSystem);
00150 
00152     virtual ~KFbxAxisSystem();
00154 
00159 
00164     bool operator==(const KFbxAxisSystem& pAxisSystem)const;
00165 
00170     bool operator!=(const KFbxAxisSystem& pAxisSystem)const;
00172 
00176     KFbxAxisSystem& operator=(const KFbxAxisSystem& pAxisSystem);
00177 
00183 
00185     static const KFbxAxisSystem MayaZUp;
00186 
00188     static const KFbxAxisSystem MayaYUp;
00189 
00191     static const KFbxAxisSystem Max;
00192 
00194     static const KFbxAxisSystem Motionbuilder;
00195 
00197     static const KFbxAxisSystem OpenGL;
00198 
00200     static const KFbxAxisSystem DirectX;
00201 
00203     static const KFbxAxisSystem Lightwave;
00205 
00209     void ConvertScene(KFbxScene* pScene) const;
00210 
00217     void ConvertScene(KFbxScene* pScene, KFbxNode* pFbxRoot) const;
00218 
00222     eUpVector GetUpVector( int & pSign ) const;
00223 
00227     eCoorSystem GetCoorSystem() const;
00228 
00236     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem) const;
00237 
00239 //
00240 //  WARNING!
00241 //
00242 //    Anything beyond these lines may not be documented accurately and is 
00243 //     subject to change without notice.
00244 //
00246 
00247 protected:
00248 
00249     class KFbxAxis
00250     {
00251     public:
00252         enum eAxis {
00253             eXAxis = 0, eYAxis, eZAxis
00254         };
00255 
00256         eAxis mAxis;
00257         int   mSign;
00258 
00259         bool operator==(const KFbxAxis& pAxis)const
00260         {
00261             return mAxis == pAxis.mAxis && mSign == pAxis.mSign;
00262         }
00263     };
00264 
00266     KFbxAxis mUpVector;
00267 
00269     KFbxAxis mFrontVector;
00270 
00272     KFbxAxis mCoorSystem;
00273 
00274 protected:
00276     // Conversion engine, here you will find all the step involved into the conversion
00277 
00279     void ConvertTProperty(KArrayTemplate<KFbxNode*>& pNodes, const KFbxAxisSystem& pFrom) const;
00280 
00282     void ConvertCurveNodes(KArrayTemplate<KFbxAnimCurveNode*>& pCurveNodes, const KFbxAxisSystem& pFrom) const;
00283 
00285     void AdjustPreRotation(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00286 
00288     void AdjustPivots(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00289 
00291     void GetConversionMatrix(const KFbxAxisSystem& pFrom, KFbxMatrix& pConversionRM) const;
00292 
00294     void AdjustLimits(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00295 
00297     void AdjustPoses(KFbxScene* pScene, const KFbxMatrix& pConversionRM) const;
00298 
00300     void AdjustCamera(KFbxNode* pNode, const KFbxMatrix& pConversionRM ) const;
00301 
00303     void AdjustCluster(KFbxNode* pNode, const KFbxMatrix& pConversionRM) const;
00304 
00306     void ConvertChildren(KFbxNode* pRoot, const KFbxAxisSystem& pSrcSystem, bool pSubChildrenOnly) const;
00307 
00308     friend class KFbxGlobalSettings;
00309 };
00310 
00311 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00312 
00313 
00314 #endif // FBXFILESDK_KFBXPLUGINS_KFBXAXISSYSTEM_H
00315