FBX SDK Reference Guide: kfbxtexture.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef FBXFILESDK_KFBXPLUGINS_KFBXTEXTURE_H
00005 #define FBXFILESDK_KFBXPLUGINS_KFBXTEXTURE_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 #ifdef KARCH_DEV_MACOSX_CFM
00044     #include <CFURL.h>
00045     #include <Files.h>
00046 #endif
00047 
00048 // FBX includes
00049 #include <fbxfilesdk/kfbxmath/kfbxvector2.h>
00050 #include <fbxfilesdk/kfbxplugins/kfbxshadingnode.h>
00051 
00052 // FBX namespace
00053 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00054 
00055 // Forward declaration
00056 class KFbxVector4;
00057 class KFbxLayerContainer;
00058 
00059 
00063 class KFBX_DLL KFbxTexture : public KFbxShadingNode
00064 {
00065     KFBXOBJECT_DECLARE(KFbxTexture,KFbxShadingNode);
00066 
00067     public:
00072         typedef enum
00073         { 
00074             eUMT_UV, 
00075             eUMT_XY, 
00076             eUMT_YZ, 
00077             eUMT_XZ, 
00078             eUMT_SPHERICAL,
00079             eUMT_CYLINDRICAL,
00080             eUMT_ENVIRONMENT,
00081             eUMT_PROJECTION,
00082             eUMT_BOX, // deprecated
00083             eUMT_FACE, // deprecated
00084             eUMT_NO_MAPPING,
00085         } EUnifiedMappingType;
00086 
00087         typedef enum 
00088         {
00089             eTEXTURE_USE_6_STANDARD,
00090             eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP,
00091             eTEXTURE_USE_6_SPHERE_REFLEXION_MAP,
00092             eTEXTURE_USE_6_SHADOW_MAP,
00093             eTEXTURE_USE_6_LIGHT_MAP,
00094             eTEXTURE_USE_6_BUMP_NORMAL_MAP
00095         } ETextureUse6;
00096 
00101         typedef enum 
00102         {
00103             eREPEAT,
00104             eCLAMP
00105         } EWrapMode;
00106 
00113         typedef enum 
00114         {
00115             eTRANSLUCENT,
00116             eADDITIVE,
00117             eMODULATE,
00118             eMODULATE2
00119         } EBlendMode;
00120 
00127         typedef enum  
00128         {
00129             eLEFT = 0,
00130             eRIGHT,
00131             eTOP,
00132             eBOTTOM
00133         } EAlignMode;
00134 
00140         typedef enum 
00141         {
00142             eU = 0,
00143             eV,
00144             eW
00145         } ECoordinates;
00146 
00147         // Type description
00148         KFbxTypedProperty<ETextureUse6>         TextureTypeUse;
00149         KFbxTypedProperty<fbxDouble1>           Alpha;
00150 
00151         // Mapping information
00152         KFbxTypedProperty<EUnifiedMappingType>  CurrentMappingType;
00153         KFbxTypedProperty<EWrapMode>            WrapModeU;
00154         KFbxTypedProperty<EWrapMode>            WrapModeV;
00155         KFbxTypedProperty<fbxBool1>             UVSwap;
00156 
00157         // Texture positioning
00158         KFbxTypedProperty<fbxDouble3>           Translation;
00159         KFbxTypedProperty<fbxDouble3>           Rotation;
00160         KFbxTypedProperty<fbxDouble3>           Scaling;
00161         KFbxTypedProperty<fbxDouble3>           RotationPivot;
00162         KFbxTypedProperty<fbxDouble3>           ScalingPivot;
00163 
00164         // Material management
00165         KFbxTypedProperty<fbxBool1>             UseMaterial;
00166         KFbxTypedProperty<fbxBool1>             UseMipMap;
00167 
00168         // Blend mode
00169         KFbxTypedProperty<EBlendMode>   CurrentTextureBlendMode;
00170 
00171         // UV set to use.
00172         KFbxTypedProperty<fbxString>            UVSet;
00173 
00177     void Reset();
00178 
00184     bool SetFileName(char const* pName);
00185 
00191     bool SetRelativeFileName(char const* pName);
00192 
00193     #ifdef KARCH_DEV_MACOSX_CFM
00194     bool SetFile(const FSSpec &pMacFileSpec);
00195     bool SetFile(const FSRef &pMacFileRef);
00196     bool SetFile(const CFURLRef &pMacURL);
00197     #endif
00198 
00203     char const* GetFileName () const;
00204 
00209     char const* GetRelativeFileName() const;
00210 
00211     #ifdef KARCH_DEV_MACOSX_CFM
00212     bool GetFile(FSSpec &pMacFileSpec) const;
00213     bool GetFile(FSRef &pMacFileRef) const;
00214     bool GetFile(CFURLRef &pMacURL) const;
00215     #endif
00216 
00221     void SetSwapUV(bool pSwapUV);
00222 
00227     bool GetSwapUV() const;
00228 
00234     typedef enum    
00235     { 
00236         eNONE, 
00237         eRGB_INTENSITY, 
00238         eBLACK 
00239     } EAlphaSource;
00240 
00244     void SetAlphaSource(EAlphaSource pAlphaSource);
00245 
00249     EAlphaSource GetAlphaSource() const;
00250 
00260     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00261 
00265     int GetCroppingLeft() const;
00266 
00270     int GetCroppingTop() const;
00271 
00275     int GetCroppingRight() const;
00276 
00280     int GetCroppingBottom() const;
00281     
00292     typedef enum    
00293     { 
00294         eNULL, 
00295         ePLANAR, 
00296         eSPHERICAL, 
00297         eCYLINDRICAL, 
00298         eBOX, 
00299         eFACE,
00300         eUV,
00301         eENVIRONMENT
00302     } EMappingType;
00303 
00307     void SetMappingType(EMappingType pMappingType);
00308 
00312     EMappingType GetMappingType() const;
00313 
00319     typedef enum   
00320     { 
00321         ePLANAR_NORMAL_X, 
00322         ePLANAR_NORMAL_Y, 
00323         ePLANAR_NORMAL_Z 
00324     } EPlanarMappingNormal;
00325 
00329     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00330 
00334     EPlanarMappingNormal GetPlanarMappingNormal() const;
00335 
00340     typedef enum 
00341     {
00342         eMODEL_MATERIAL,
00343         eDEFAULT_MATERIAL
00344     } EMaterialUse;
00345 
00349     void SetMaterialUse(EMaterialUse pMaterialUse);
00350 
00354     EMaterialUse GetMaterialUse() const;
00355 
00364     typedef enum 
00365     {
00366         eSTANDARD,
00367         eSHADOW_MAP,
00368         eLIGHT_MAP,
00369         eSPHERICAL_REFLEXION_MAP,
00370         eSPHERE_REFLEXION_MAP,
00371         eBUMP_NORMAL_MAP
00372     } ETextureUse;
00373 
00377     void SetTextureUse(ETextureUse pTextureUse);
00378 
00382     ETextureUse GetTextureUse() const;
00383 
00384 
00389     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00390 
00394     EWrapMode GetWrapModeU() const;
00395 
00399     EWrapMode GetWrapModeV() const;
00400 
00401 
00405     void SetBlendMode(EBlendMode pBlendMode);
00406 
00410     EBlendMode GetBlendMode() const;
00411 
00413 
00420 
00430         inline void SetDefaultT(const KFbxVector4& pT) { Translation.Set( pT ); }
00431 
00442     KFbxVector4& GetDefaultT(KFbxVector4& pT) const;
00443 
00452     inline void SetDefaultR(const KFbxVector4& pR) { Rotation.Set( fbxDouble3(pR[0],pR[1],pR[2]) ); }
00453 
00463     KFbxVector4& GetDefaultR(KFbxVector4& pR) const;
00464 
00472     inline void SetDefaultS(const KFbxVector4& pS) { Scaling.Set( fbxDouble3(pS[0],pS[1],pS[2]) ); }
00473 
00482     KFbxVector4& GetDefaultS(KFbxVector4& pS) const;
00483 
00487     void SetDefaultAlpha(double pAlpha);
00488 
00492     double GetDefaultAlpha() const;
00493 
00495 
00504 
00513     void SetTranslation(double pU,double pV);
00514 
00519     double GetTranslationU() const;
00520 
00525     double GetTranslationV() const;
00526 
00534     void SetRotation(double pU, double pV, double pW = 0.0);
00535 
00537     double GetRotationU() const;
00538 
00540     double GetRotationV() const;
00541 
00543     double GetRotationW() const;
00544 
00551     void SetScale(double pU,double pV);
00552 
00557     double GetScaleU() const;
00558 
00563     double GetScaleV() const;
00564 
00566 //
00567 //  WARNING!
00568 //
00569 //  Anything beyond these lines may not be documented accurately and is 
00570 //  subject to change without notice.
00571 //
00573 
00574 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00575 
00576     bool operator==(KFbxTexture const& pTexture) const;
00577 
00578     KString& GetMediaName();
00579     void SetMediaName(char const* pMediaName);
00580 
00581     void SetUVTranslation(KFbxVector2& pT);
00582     KFbxVector2& GetUVTranslation();
00583     void SetUVScaling(KFbxVector2& pS);
00584     KFbxVector2& GetUVScaling();
00585 
00586     KString GetTextureType();
00587 
00588 
00589     // Clone
00590     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00591 
00592 protected:
00593     KFbxTexture(KFbxSdkManager& pManager, char const* pName);  
00594     virtual ~KFbxTexture();
00595 
00596     virtual void Construct(const KFbxTexture* pFrom);
00597     virtual bool ConstructProperties(bool pForceSet);
00598     virtual void Destruct(bool pRecursive, bool pDependents);
00599 
00601     KFbxTexture& operator=(KFbxTexture const& pTexture);
00602 
00603     virtual KStringList GetTypeFlags() const;
00604     
00605     void Init();
00606     void SyncVideoFileName(char const* pFileName);
00607     void SyncVideoRelativeFileName(char const* pFileName);
00608 
00609     int mTillingUV[2]; // not a prop
00610     int mCropping[4]; // not a prop
00611 
00612     EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop
00613     EMappingType mMappingType; // CurrentMappingType
00614     EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType
00615 
00616     KString mFileName;
00617     KString mRelativeFileName;
00618     KString mMediaName; // not a prop
00619 
00620     static KError smError;
00621 
00622     // Unsupported parameters in the FBX SDK, these are declared but not accessible.
00623     // They are used to keep imported and exported data identical.
00624 
00625     KFbxVector2 mUVScaling; // not a prop
00626     KFbxVector2 mUVTranslation; // not a prop
00627 
00628     friend class KFbxLayerContainer;
00629 
00630 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00631 
00632 };
00633 
00634 inline EFbxType FbxTypeOf( KFbxTexture::EUnifiedMappingType const &pItem )      { return eENUM; }
00635 inline EFbxType FbxTypeOf( KFbxTexture::ETextureUse6 const &pItem )             { return eENUM; }
00636 inline EFbxType FbxTypeOf( KFbxTexture::EWrapMode const &pItem )                { return eENUM; }
00637 inline EFbxType FbxTypeOf( KFbxTexture::EBlendMode const &pItem )               { return eENUM; }
00638 
00639 typedef KFbxTexture* HKFbxTexture;
00640 
00641 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00642 
00643 #endif // FBXFILESDK_KFBXPLUGINS_KFBXTEXTURE_H
00644