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; typedef ClassName *H##ClassName;
00063 
00064 
00068 #define __FB_FORWARD( ClassName ) \
00069     FB_FORWARD( ClassName ) \
00070     class Data##ClassName; typedef Data##ClassName *HData##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 typedef FBColorF         *HFBColorF;  
00448 
00450 class FBSDK_DLL FBColor : public FBVector3< double >
00451 {
00452   public:
00454     FBColor();
00455 
00459     FBColor( double *pValue );
00460 
00466     FBColor( double pRed, double pGreen, double pBlue);
00467 
00469     FBColor( const FBColor& pVector );
00470 
00475     double &operator[](int pIndex);
00476 
00480     operator double *() const;
00481 
00486     const FBColor& operator = ( const FBColor& pVector );
00487     void operator=(double *pValue);
00488     const FBVector3< double >& operator = ( const FBVector3< double >& pVector );
00489 };
00490 
00492 typedef FBColor*    HFBColor;
00493 
00495 class FBSDK_DLL FBColorAndAlpha : public FBVector4< double >
00496 {
00497   public:
00499     FBColorAndAlpha();
00500 
00504     FBColorAndAlpha( double *pValue );
00505 
00512     FBColorAndAlpha( double pRed, double pGreen, double pBlue, double pAlpha=1.0);
00513 
00517     FBColorAndAlpha( const FBColor &pValue );
00518 
00522     FBColorAndAlpha( const FBColorF& pValue );
00523 
00525     FBColorAndAlpha( const FBColorAndAlpha& pVector );
00526 
00531     double &operator[](int pIndex);
00532 
00536     operator double *() const;
00537 
00542     const FBColorAndAlpha& operator = ( const FBColorAndAlpha& pVector );
00543     const FBColorAndAlpha& operator = ( const FBColor& pVector );
00544     const FBColorAndAlpha& operator = ( const FBColorF& pVector );
00545     void operator=(double *pValue);
00546     const FBVector4< double >& operator = ( const FBVector4< double >& pVector );
00547 };
00548 
00550 typedef FBVector2<double> FBVector2d;  
00551 
00553 typedef FBVector3<double> FBVector3d;  
00554 
00556 typedef FBVector4<double> FBVector4d;
00557 
00559 typedef FBVector3<double> FBRVector;
00560 
00562 typedef FBRVector        *HFBRVector; 
00563 
00565 typedef FBVector4<double> FBTVector;  
00566 
00568 typedef FBTVector        *HFBTVector; 
00569 
00571 typedef class FBSDK_DLL FBVector3< double > FBVector3Double;
00572 
00574 typedef class FBSDK_DLL FBVector4< double > FBVector4Double;
00575 
00577 class FBSDK_DLL FBSVector : public FBVector3< double >
00578 { 
00579   private:
00580   public:
00582     FBSVector();
00583 
00587     FBSVector( double *pValue );
00588 
00594     FBSVector( double p1,double p2, double p3=1.0 );
00595 
00600     void Init();
00601 };
00602 
00603 //typedef FBVector3<double> FBSVector; 
00605 
00606 typedef FBSVector*                          HFBSVector; 
00608 typedef class FBSDK_DLL FBVector4<double>   FBQuaternion;  
00610 typedef FBQuaternion*                       HFBQuaternion; 
00612 typedef class FBSDK_DLL FBVector2<float>    FBUV;
00614 typedef FBUV*                               HFBUV; 
00616 typedef class FBSDK_DLL FBVector4<float>    FBVertex;
00618 typedef FBVertex*                           HFBVertex; 
00620 typedef class FBSDK_DLL FBVector4<float>    FBNormal;  
00622 typedef FBNormal*                           HFBNormal; 
00623 
00625 // Global
00627 #ifdef FBSDKUseNamespace
00628     }
00629 #endif
00630 
00631 #endif
00632