fbsdk/fbtypes.h Source File
 
 
 
fbsdk/fbtypes.h
Go to the documentation of this file.
00001 #ifndef __FBTYPES_H__
00002 #define __FBTYPES_H__
00003 /**************************************************************************
00004  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
00005  All Rights Reserved.
00006  
00007  The coded instructions, statements, computer programs, and/or related 
00008  material (collectively the "Data") in these files contain unpublished 
00009  information proprietary to Autodesk, Inc. and/or its licensors, which is 
00010  protected by Canada and United States of America federal copyright law 
00011  and by international treaties.
00012  
00013  The Data may not be disclosed or distributed to third parties, in whole 
00014  or in part, without the prior written consent of Autodesk, Inc. 
00015  ("Autodesk").
00016  
00017  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
00018  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO 
00019  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR 
00020  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES 
00021  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
00022  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT 
00023  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR 
00024  FREE.
00025  
00026  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS 
00027  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR 
00028  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE 
00029  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS 
00030  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR 
00031  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF 
00032  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT 
00033  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE 
00034  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS 
00035  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
00036  
00037 **************************************************************************/
00038 
00043 #include <kaydaradef.h>
00044 
00045 #ifndef FBSDK_DLL
00046 
00049   #define FBSDK_DLL K_DLLIMPORT
00050 #endif
00051 
00052 #include <fbsdk/fbversion.h>
00053 
00054 #ifdef FBSDKUseNamespace
00055         namespace FBSDKNamespace {
00056 #endif
00057 
00058 
00062 #define FB_FORWARD( ClassName ) class ClassName
00063 
00064 
00068 #define __FB_FORWARD( ClassName ) \
00069         FB_FORWARD( ClassName ); \
00070         class Data##ClassName
00071 
00072 
00074 enum kFbxObjectStore   { 
00075         kInit=1,                
00076         kAttributes=2,  
00077         kRelations=4,   
00078         kAll=7,                 
00079         kCleanup=8,             
00080         kData=16,               
00081         kMerge=32               
00082 };
00083 
00085 // New classes
00088 template <class tType> class FBSDK_DLL FBVector2
00089 { 
00090   private:
00091   public:
00092         tType mValue[2]; 
00093 
00094   public:
00095 
00097         FBVector2();
00098 
00100     FBVector2( const FBVector2& pVector );
00101 
00105         FBVector2( tType *pValue );
00106 
00111         FBVector2( tType p1,tType p2 );
00112 
00116         void Init();
00117 
00122         tType &operator[](int pIndex);
00123 
00127         void Set( tType *pValue );
00128 
00132     operator tType *() const;
00133 
00138     const FBVector2& operator = ( const FBVector2& pVector );
00139     
00144     bool operator != ( const FBVector2& pVector );
00145 
00150     bool operator == ( const FBVector2& pVector );
00151 };
00152 
00154 template <class tType> class FBSDK_DLL FBVector3
00155 { 
00156   private:
00157   public:
00158         tType mValue[3];        
00159 
00160   public:
00161 
00163         FBVector3();
00164 
00166     FBVector3( const FBVector3& pVector );
00167 
00171         FBVector3( tType *pValue );
00172 
00178         FBVector3( tType p1,tType p2, tType p3 = 0);
00179 
00183         void Init();
00184 
00189         tType &operator[](int pIndex);
00190 
00194         void Set( tType *pValue );
00195 
00199     operator tType *() const;
00200 
00205     const FBVector3& operator = ( const FBVector3& pVector );
00206 
00211     bool operator != ( const FBVector3& pVector );
00212 
00217     bool operator == ( const FBVector3& pVector );
00218 };
00219 
00221 template <class tType> class FBSDK_DLL FBVector4
00222 { 
00223   private:
00224   public:
00225 
00226     tType mValue[4];                            
00227 
00229         FBVector4();
00230 
00232     FBVector4( const FBVector4& pVector );
00233 
00237         FBVector4( tType *pValue );
00238 
00245         FBVector4( tType p1,tType p2, tType p3, tType p4 = 1);
00246 
00250         void Init();
00251 
00256         tType &operator[](int pIndex);
00257 
00261         void Set( tType *pValue );
00262 
00266     operator tType *() const;
00267 
00272     const FBVector4& operator = ( const FBVector4& pVector );
00273 
00278     bool operator != ( const FBVector4& pVector );
00279 
00284     bool operator == ( const FBVector4& pVector );
00285 
00286 };
00287 
00289 class FBSDK_DLL FBMatrix
00290 { 
00291   private:
00292         double mValue[4][4];                    
00293 
00294   public:
00298         FBMatrix();
00299 
00303         FBMatrix( const double *pValue );
00304 
00308     FBMatrix( const FBMatrix& pMatrix );
00309 
00311         void Identity();
00312 
00316         void Set( const double *pValue );
00317 
00321     operator double *() const;
00322 
00326     double **  GetData() const;
00327 
00331     double& operator () ( int i, int j );
00332 
00337     const FBMatrix& operator = ( const FBMatrix& pMatrix );
00338 
00343     const FBMatrix& operator = ( const double *pValue );
00344 
00349     bool operator != ( const FBMatrix& pMatrix );
00350 
00355     bool operator == ( const FBMatrix& pMatrix );
00356 
00361     const FBMatrix operator + ( const FBMatrix& pMatrix ) const;
00362 
00367     FBMatrix &operator += ( const FBMatrix& pMatrix );
00368 
00372     const FBMatrix operator - ();
00373 
00378     const FBMatrix operator - ( const FBMatrix& pMatrix ) const;
00379 
00384     FBMatrix &operator -= ( const FBMatrix& pMatrix );
00385 
00390     const FBMatrix operator * ( const FBMatrix& pMatrix ) const;
00391 
00396     FBMatrix &operator *= ( const FBMatrix& pMatrix );
00397 
00402     const FBMatrix operator * ( const double pN ) const;
00403 
00408     FBMatrix &operator *= ( const double pN );
00409 
00413     FBMatrix &Inverse();
00414 
00418     FBMatrix &Transpose();
00419 
00423     bool Validate();
00424 
00429     const FBMatrix InverseProduct( const FBMatrix& pMatrix );
00430 
00431 };
00432 
00433 
00435 typedef class FBSDK_DLL FBVector2<double>       FBVector2d;  
00436 
00438 typedef class FBSDK_DLL FBVector3<double>       FBVector3d;  
00439 
00441 typedef class FBSDK_DLL FBVector4<double>       FBVector4d;
00442 
00444 typedef  class FBSDK_DLL FBVector4<float>  FBColorF;  
00445 
00447 class FBSDK_DLL FBColor : public FBVector3< double >
00448 {
00449   public:
00451         FBColor();
00452 
00456         FBColor( double *pValue );
00457 
00463         FBColor( double pRed, double pGreen, double pBlue);
00464 
00466     FBColor( const FBColor& pVector );
00467 
00472         double &operator[](int pIndex);
00473 
00477     operator double *() const;
00478 
00483     const FBColor& operator = ( const FBColor& pVector );
00484         void operator=(double *pValue);
00485     const FBVector3< double >& operator = ( const FBVector3< double >& pVector );
00486 };
00487 
00489 class FBSDK_DLL FBColorAndAlpha : public FBVector4< double >
00490 {
00491   public:
00493         FBColorAndAlpha();
00494 
00498         FBColorAndAlpha( double *pValue );
00499 
00506         FBColorAndAlpha( double pRed, double pGreen, double pBlue, double pAlpha=1.0);
00507 
00511         FBColorAndAlpha( const FBColor &pValue );
00512 
00516     FBColorAndAlpha( const FBColorF& pValue );
00517 
00519     FBColorAndAlpha( const FBColorAndAlpha& pVector );
00520 
00525         double &operator[](int pIndex);
00526 
00530     operator double *() const;
00531 
00536     const FBColorAndAlpha& operator = ( const FBColorAndAlpha& pVector );
00537     const FBColorAndAlpha& operator = ( const FBColor& pVector );
00538     const FBColorAndAlpha& operator = ( const FBColorF& pVector );
00539         void operator=(double *pValue);
00540     const FBVector4< double >& operator = ( const FBVector4< double >& pVector );
00541 };
00542 
00544 typedef FBVector2<double> FBVector2d;  
00545 
00547 typedef FBVector3<double> FBVector3d;  
00548 
00550 typedef FBVector4<double> FBVector4d;
00551 
00553 typedef FBVector3<double> FBRVector;
00554 
00556 typedef FBVector4<double> FBTVector;  
00557 
00559 typedef class FBSDK_DLL FBVector3< double > FBVector3Double;
00560 
00562 typedef class FBSDK_DLL FBVector4< double > FBVector4Double;
00563 
00565 class FBSDK_DLL FBSVector : public FBVector3< double >
00566 { 
00567   private:
00568   public:
00570         FBSVector();
00571 
00575         FBSVector( double *pValue );
00576 
00582         FBSVector( double p1,double p2, double p3=1.0 );
00583 
00588         void Init();
00589 };
00590 
00591 //typedef FBVector3<double> FBSVector; 
00593 typedef class FBSDK_DLL FBVector4<double>   FBQuaternion;  
00595 typedef class FBSDK_DLL FBVector2<float>    FBUV;
00597 typedef class FBSDK_DLL FBVector4<float>    FBVertex;
00599 typedef class FBSDK_DLL FBVector4<float>        FBNormal;  
00600 
00602 // Global
00604 #ifdef FBSDKUseNamespace
00605         }
00606 #endif
00607 
00608 #endif
00609