kfbxtexture.h

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 (C) 2001 - 2009 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 
00114         typedef enum 
00115         {
00116             eTRANSLUCENT,
00117             eADDITIVE,
00118             eMODULATE,
00119             eMODULATE2,
00120             eOVER
00121         } EBlendMode;
00122 
00129         typedef enum  
00130         {
00131             eLEFT = 0,
00132             eRIGHT,
00133             eTOP,
00134             eBOTTOM
00135         } EAlignMode;
00136 
00142         typedef enum 
00143         {
00144             eU = 0,
00145             eV,
00146             eW
00147         } ECoordinates;
00148 
00149         // Type description
00150         KFbxTypedProperty<ETextureUse6>         TextureTypeUse;
00151         KFbxTypedProperty<fbxDouble1>           Alpha;
00152 
00153         // Mapping information
00154         KFbxTypedProperty<EUnifiedMappingType>  CurrentMappingType;
00155         KFbxTypedProperty<EWrapMode>            WrapModeU;
00156         KFbxTypedProperty<EWrapMode>            WrapModeV;
00157         KFbxTypedProperty<fbxBool1>             UVSwap;
00158 
00159         // Texture positioning
00160         KFbxTypedProperty<fbxDouble3>           Translation;
00161         KFbxTypedProperty<fbxDouble3>           Rotation;
00162         KFbxTypedProperty<fbxDouble3>           Scaling;
00163         KFbxTypedProperty<fbxDouble3>           RotationPivot;
00164         KFbxTypedProperty<fbxDouble3>           ScalingPivot;
00165 
00166         // Material management
00167         KFbxTypedProperty<fbxBool1>             UseMaterial;
00168         KFbxTypedProperty<fbxBool1>             UseMipMap;
00169 
00170         // Blend mode
00171         KFbxTypedProperty<EBlendMode>   CurrentTextureBlendMode;
00172 
00173         // UV set to use.
00174         KFbxTypedProperty<fbxString>            UVSet;
00175 
00179     void Reset();
00180 
00186     bool SetFileName(char const* pName);
00187 
00193     bool SetRelativeFileName(char const* pName);
00194 
00195     #ifdef KARCH_DEV_MACOSX_CFM
00196     bool SetFile(const FSSpec &pMacFileSpec);
00197     bool SetFile(const FSRef &pMacFileRef);
00198     bool SetFile(const CFURLRef &pMacURL);
00199     #endif
00200 
00205     char const* GetFileName () const;
00206 
00211     char const* GetRelativeFileName() const;
00212 
00213     #ifdef KARCH_DEV_MACOSX_CFM
00214     bool GetFile(FSSpec &pMacFileSpec) const;
00215     bool GetFile(FSRef &pMacFileRef) const;
00216     bool GetFile(CFURLRef &pMacURL) const;
00217     #endif
00218 
00223     void SetSwapUV(bool pSwapUV);
00224 
00229     bool GetSwapUV() const;
00230 
00236     typedef enum    
00237     { 
00238         eNONE, 
00239         eRGB_INTENSITY, 
00240         eBLACK 
00241     } EAlphaSource;
00242 
00246     void SetAlphaSource(EAlphaSource pAlphaSource);
00247 
00251     EAlphaSource GetAlphaSource() const;
00252 
00262     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00263 
00267     int GetCroppingLeft() const;
00268 
00272     int GetCroppingTop() const;
00273 
00277     int GetCroppingRight() const;
00278 
00282     int GetCroppingBottom() const;
00283     
00294     typedef enum    
00295     { 
00296         eNULL, 
00297         ePLANAR, 
00298         eSPHERICAL, 
00299         eCYLINDRICAL, 
00300         eBOX, 
00301         eFACE,
00302         eUV,
00303         eENVIRONMENT
00304     } EMappingType;
00305 
00309     void SetMappingType(EMappingType pMappingType);
00310 
00314     EMappingType GetMappingType() const;
00315 
00321     typedef enum   
00322     { 
00323         ePLANAR_NORMAL_X, 
00324         ePLANAR_NORMAL_Y, 
00325         ePLANAR_NORMAL_Z 
00326     } EPlanarMappingNormal;
00327 
00331     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00332 
00336     EPlanarMappingNormal GetPlanarMappingNormal() const;
00337 
00342     typedef enum 
00343     {
00344         eMODEL_MATERIAL,
00345         eDEFAULT_MATERIAL
00346     } EMaterialUse;
00347 
00351     void SetMaterialUse(EMaterialUse pMaterialUse);
00352 
00356     EMaterialUse GetMaterialUse() const;
00357 
00366     typedef enum 
00367     {
00368         eSTANDARD,
00369         eSHADOW_MAP,
00370         eLIGHT_MAP,
00371         eSPHERICAL_REFLEXION_MAP,
00372         eSPHERE_REFLEXION_MAP,
00373         eBUMP_NORMAL_MAP
00374     } ETextureUse;
00375 
00379     void SetTextureUse(ETextureUse pTextureUse);
00380 
00384     ETextureUse GetTextureUse() const;
00385 
00386 
00391     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00392 
00396     EWrapMode GetWrapModeU() const;
00397 
00401     EWrapMode GetWrapModeV() const;
00402 
00403 
00407     void SetBlendMode(EBlendMode pBlendMode);
00408 
00412     EBlendMode GetBlendMode() const;
00413 
00415 
00422 
00432         inline void SetDefaultT(const KFbxVector4& pT) { Translation.Set( pT ); }
00433 
00444     KFbxVector4& GetDefaultT(KFbxVector4& pT) const;
00445 
00454     inline void SetDefaultR(const KFbxVector4& pR) { Rotation.Set( fbxDouble3(pR[0],pR[1],pR[2]) ); }
00455 
00465     KFbxVector4& GetDefaultR(KFbxVector4& pR) const;
00466 
00474     inline void SetDefaultS(const KFbxVector4& pS) { Scaling.Set( fbxDouble3(pS[0],pS[1],pS[2]) ); }
00475 
00484     KFbxVector4& GetDefaultS(KFbxVector4& pS) const;
00485 
00489     void SetDefaultAlpha(double pAlpha);
00490 
00494     double GetDefaultAlpha() const;
00495 
00497 
00506 
00515     void SetTranslation(double pU,double pV);
00516 
00521     double GetTranslationU() const;
00522 
00527     double GetTranslationV() const;
00528 
00536     void SetRotation(double pU, double pV, double pW = 0.0);
00537 
00539     double GetRotationU() const;
00540 
00542     double GetRotationV() const;
00543 
00545     double GetRotationW() const;
00546 
00553     void SetScale(double pU,double pV);
00554 
00559     double GetScaleU() const;
00560 
00565     double GetScaleV() const;
00566 
00568 //
00569 //  WARNING!
00570 //
00571 //  Anything beyond these lines may not be documented accurately and is 
00572 //  subject to change without notice.
00573 //
00575 
00576 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00577 
00578     bool operator==(KFbxTexture const& pTexture) const;
00579 
00580     KString& GetMediaName();
00581     void SetMediaName(char const* pMediaName);
00582 
00583     void SetUVTranslation(KFbxVector2& pT);
00584     KFbxVector2& GetUVTranslation();
00585     void SetUVScaling(KFbxVector2& pS);
00586     KFbxVector2& GetUVScaling();
00587 
00588     KString GetTextureType();
00589 
00590 
00591     // Clone
00592     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00593 
00594 protected:
00595     KFbxTexture(KFbxSdkManager& pManager, char const* pName);  
00596 
00597     virtual void Construct(const KFbxTexture* pFrom);
00598     virtual bool ConstructProperties(bool pForceSet);
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