FBX SDK Reference Guide: kfbxtexture.h Source File
Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_TEXTURE_H_
00005 #define _FBXSDK_TEXTURE_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 #ifdef KARCH_DEV_MACOSX_CFM
00048     #include <CFURL.h>
00049     #include <Files.h>
00050 #endif
00051 
00052 // FBX includes
00053 #include <kfbxmath/kfbxvector2.h>
00054 #include <kfbxplugins/kfbxshadingnode.h>
00055 
00056 // FBX namespace
00057 #include <fbxfilesdk_nsbegin.h>
00058 
00059 // Forward declaration
00060 class KFbxVector4;
00061 class KFbxLayerContainer;
00062 
00063 
00067 class KFBX_DLL KFbxTexture : public KFbxShadingNode
00068 {
00069     KFBXOBJECT_DECLARE(KFbxTexture,KFbxShadingNode);
00070 
00071     public:
00076         typedef enum
00077         { 
00078             eUMT_UV, 
00079             eUMT_XY, 
00080             eUMT_YZ, 
00081             eUMT_XZ, 
00082             eUMT_SPHERICAL,
00083             eUMT_CYLINDRICAL,
00084             eUMT_ENVIRONMENT,
00085             eUMT_PROJECTION,
00086             eUMT_BOX, // deprecated
00087             eUMT_FACE, // deprecated
00088             eUMT_NO_MAPPING,
00089         } EUnifiedMappingType;
00090 
00091         typedef enum 
00092         {
00093             eTEXTURE_USE_6_STANDARD,
00094             eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP,
00095             eTEXTURE_USE_6_SPHERE_REFLEXION_MAP,
00096             eTEXTURE_USE_6_SHADOW_MAP,
00097             eTEXTURE_USE_6_LIGHT_MAP,
00098             eTEXTURE_USE_6_BUMP_NORMAL_MAP
00099         } ETextureUse6;
00100 
00105         typedef enum 
00106         {
00107             eREPEAT,
00108             eCLAMP
00109         } EWrapMode;
00110 
00117         typedef enum 
00118         {
00119             eTRANSLUCENT,
00120             eADDITIVE,
00121             eMODULATE,
00122             eMODULATE2
00123         } EBlendMode;
00124 
00131         typedef enum  
00132         {
00133             eLEFT = 0,
00134             eRIGHT,
00135             eTOP,
00136             eBOTTOM
00137         } EAlignMode;
00138 
00144         typedef enum 
00145         {
00146             eU = 0,
00147             eV,
00148             eW
00149         } ECoordinates;
00150 
00151         // Type description
00152         KFbxTypedProperty<ETextureUse6>         TextureTypeUse;
00153         KFbxTypedProperty<fbxDouble1>           Alpha;
00154 
00155         // Mapping information
00156         KFbxTypedProperty<EUnifiedMappingType>  CurrentMappingType;
00157         KFbxTypedProperty<EWrapMode>            WrapModeU;
00158         KFbxTypedProperty<EWrapMode>            WrapModeV;
00159         KFbxTypedProperty<fbxBool1>             UVSwap;
00160 
00161         // Texture positioning
00162         KFbxTypedProperty<fbxDouble3>           Translation;
00163         KFbxTypedProperty<fbxDouble3>           Rotation;
00164         KFbxTypedProperty<fbxDouble3>           Scaling;
00165         KFbxTypedProperty<fbxDouble3>           RotationPivot;
00166         KFbxTypedProperty<fbxDouble3>           ScalingPivot;
00167 
00168         // Material management
00169         KFbxTypedProperty<fbxBool1>             UseMaterial;
00170         KFbxTypedProperty<fbxBool1>             UseMipMap;
00171 
00172         // Blend mode
00173         KFbxTypedProperty<EBlendMode>   CurrentTextureBlendMode;
00174 
00175         // UV set to use.
00176         KFbxTypedProperty<fbxString>            UVSet;
00177 
00181     void Reset();
00182 
00188     bool SetFileName(char const* pName);
00189 
00195     bool SetRelativeFileName(char const* pName);
00196 
00197     #ifdef KARCH_DEV_MACOSX_CFM
00198     bool SetFile(const FSSpec &pMacFileSpec);
00199     bool SetFile(const FSRef &pMacFileRef);
00200     bool SetFile(const CFURLRef &pMacURL);
00201     #endif
00202 
00207     char const* GetFileName () const;
00208 
00213     char const* GetRelativeFileName() const;
00214 
00215     #ifdef KARCH_DEV_MACOSX_CFM
00216     bool GetFile(FSSpec &pMacFileSpec) const;
00217     bool GetFile(FSRef &pMacFileRef) const;
00218     bool GetFile(CFURLRef &pMacURL) const;
00219     #endif
00220 
00225     void SetSwapUV(bool pSwapUV);
00226 
00231     bool GetSwapUV() const;
00232 
00238     typedef enum    
00239     { 
00240         eNONE, 
00241         eRGB_INTENSITY, 
00242         eBLACK 
00243     } EAlphaSource;
00244 
00248     void SetAlphaSource(EAlphaSource pAlphaSource);
00249 
00253     EAlphaSource GetAlphaSource() const;
00254 
00264     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00265 
00269     int GetCroppingLeft() const;
00270 
00274     int GetCroppingTop() const;
00275 
00279     int GetCroppingRight() const;
00280 
00284     int GetCroppingBottom() const;
00285     
00296     typedef enum    
00297     { 
00298         eNULL, 
00299         ePLANAR, 
00300         eSPHERICAL, 
00301         eCYLINDRICAL, 
00302         eBOX, 
00303         eFACE,
00304         eUV,
00305         eENVIRONMENT
00306     } EMappingType;
00307 
00311     void SetMappingType(EMappingType pMappingType);
00312 
00316     EMappingType GetMappingType() const;
00317 
00323     typedef enum   
00324     { 
00325         ePLANAR_NORMAL_X, 
00326         ePLANAR_NORMAL_Y, 
00327         ePLANAR_NORMAL_Z 
00328     } EPlanarMappingNormal;
00329 
00333     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00334 
00338     EPlanarMappingNormal GetPlanarMappingNormal() const;
00339 
00344     typedef enum 
00345     {
00346         eMODEL_MATERIAL,
00347         eDEFAULT_MATERIAL
00348     } EMaterialUse;
00349 
00353     void SetMaterialUse(EMaterialUse pMaterialUse);
00354 
00358     EMaterialUse GetMaterialUse() const;
00359 
00368     typedef enum 
00369     {
00370         eSTANDARD,
00371         eSHADOW_MAP,
00372         eLIGHT_MAP,
00373         eSPHERICAL_REFLEXION_MAP,
00374         eSPHERE_REFLEXION_MAP,
00375         eBUMP_NORMAL_MAP
00376     } ETextureUse;
00377 
00381     void SetTextureUse(ETextureUse pTextureUse);
00382 
00386     ETextureUse GetTextureUse() const;
00387 
00388 
00393     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00394 
00398     EWrapMode GetWrapModeU() const;
00399 
00403     EWrapMode GetWrapModeV() const;
00404 
00405 
00409     void SetBlendMode(EBlendMode pBlendMode);
00410 
00414     EBlendMode GetBlendMode() const;
00415 
00417 
00424 
00434         inline void SetDefaultT(const KFbxVector4& pT) { Translation.Set( pT ); }
00435 
00446     KFbxVector4& GetDefaultT(KFbxVector4& pT) const;
00447 
00456     inline void SetDefaultR(const KFbxVector4& pR) { Rotation.Set( fbxDouble3(pR[0],pR[1],pR[2]) ); }
00457 
00467     KFbxVector4& GetDefaultR(KFbxVector4& pR) const;
00468 
00476     inline void SetDefaultS(const KFbxVector4& pS) { Scaling.Set( fbxDouble3(pS[0],pS[1],pS[2]) ); }
00477 
00486     KFbxVector4& GetDefaultS(KFbxVector4& pS) const;
00487 
00491     void SetDefaultAlpha(double pAlpha);
00492 
00496     double GetDefaultAlpha() const;
00497 
00499 
00508 
00517     void SetTranslation(double pU,double pV);
00518 
00523     double GetTranslationU() const;
00524 
00529     double GetTranslationV() const;
00530 
00538     void SetRotation(double pU, double pV, double pW = 0.0);
00539 
00541     double GetRotationU() const;
00542 
00544     double GetRotationV() const;
00545 
00547     double GetRotationW() const;
00548 
00555     void SetScale(double pU,double pV);
00556 
00561     double GetScaleU() const;
00562 
00567     double GetScaleV() const;
00568 
00570 //
00571 //  WARNING!
00572 //
00573 //  Anything beyond these lines may not be documented accurately and is 
00574 //  subject to change without notice.
00575 //
00577 
00578 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00579 
00580     bool operator==(KFbxTexture const& pTexture) const;
00581 
00582     KString& GetMediaName();
00583     void SetMediaName(char const* pMediaName);
00584 
00585     void SetUVTranslation(KFbxVector2& pT);
00586     KFbxVector2& GetUVTranslation();
00587     void SetUVScaling(KFbxVector2& pS);
00588     KFbxVector2& GetUVScaling();
00589 
00590     KString GetTextureType();
00591 
00592 
00593     // Clone
00594     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00595 
00596 protected:
00597     KFbxTexture(KFbxSdkManager& pManager, char const* pName);  
00598     virtual ~KFbxTexture();
00599 
00600     virtual void Construct(const KFbxTexture* pFrom);
00601     virtual bool ConstructProperties(bool pForceSet);
00602     virtual void Destruct(bool pRecursive, bool pDependents);
00603 
00605     KFbxTexture& operator=(KFbxTexture const& pTexture);
00606 
00607     virtual KStringList GetTypeFlags() const;
00608     
00609     void Init();
00610     void SyncVideoFileName(char const* pFileName);
00611     void SyncVideoRelativeFileName(char const* pFileName);
00612 
00613     int mTillingUV[2]; // not a prop
00614     int mCropping[4]; // not a prop
00615 
00616     EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop
00617     EMappingType mMappingType; // CurrentMappingType
00618     EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType
00619 
00620     KString mFileName;
00621     KString mRelativeFileName;
00622     KString mMediaName; // not a prop
00623 
00624     static KError smError;
00625 
00626     // Unsupported parameters in the FBX SDK, these are declared but not accessible.
00627     // They are used to keep imported and exported data identical.
00628 
00629     KFbxVector2 mUVScaling; // not a prop
00630     KFbxVector2 mUVTranslation; // not a prop
00631 
00632     friend class KFbxWriterFbx6;
00633 
00634     friend class KFbxLayerContainer;
00635 
00636 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00637 
00638 };
00639 
00640 inline EFbxType FbxTypeOf( KFbxTexture::EUnifiedMappingType const &pItem )      { return eENUM; }
00641 inline EFbxType FbxTypeOf( KFbxTexture::ETextureUse6 const &pItem )             { return eENUM; }
00642 inline EFbxType FbxTypeOf( KFbxTexture::EWrapMode const &pItem )                { return eENUM; }
00643 inline EFbxType FbxTypeOf( KFbxTexture::EBlendMode const &pItem )               { return eENUM; }
00644 
00645 typedef KFbxTexture* HKFbxTexture;
00646 
00647 #include <fbxfilesdk_nsend.h>
00648 
00649 #endif // #ifndef _FBXSDK_TEXTURE_H_
00650 
00651 
00652