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 - 2010 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 #include <fbxfilesdk/fbxfilesdk_def.h>
00042 
00043 // FBX includes
00044 #include <fbxfilesdk/kfbxplugins/kfbxobject.h>
00045 #include <fbxfilesdk/kfbxmath/kfbxvector2.h>
00046 
00047 // FBX namespace
00048 #include <fbxfilesdk/fbxfilesdk_nsbegin.h>
00049 
00050 // Forward declaration
00051 class KFbxVector4;
00052 class KFbxLayerContainer;
00053 
00054 
00067 class KFBX_DLL KFbxTexture : public KFbxObject
00068 {
00069     KFBXOBJECT_DECLARE(KFbxTexture,KFbxObject);
00070 
00071     public:
00076 
00090         typedef enum
00091         { 
00092             eUMT_UV, 
00093             eUMT_XY, 
00094             eUMT_YZ, 
00095             eUMT_XZ, 
00096             eUMT_SPHERICAL,
00097             eUMT_CYLINDRICAL,
00098             eUMT_ENVIRONMENT,
00099             eUMT_PROJECTION,
00100             eUMT_BOX, // deprecated
00101             eUMT_FACE, // deprecated
00102             eUMT_NO_MAPPING,
00103         } EUnifiedMappingType;
00104 
00105 
00114         typedef enum 
00115         {
00116             eTEXTURE_USE_6_STANDARD,
00117             eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP,
00118             eTEXTURE_USE_6_SPHERE_REFLEXION_MAP,
00119             eTEXTURE_USE_6_SHADOW_MAP,
00120             eTEXTURE_USE_6_LIGHT_MAP,
00121             eTEXTURE_USE_6_BUMP_NORMAL_MAP
00122         } ETextureUse6;
00123 
00128         typedef enum 
00129         {
00130             eREPEAT,
00131             eCLAMP
00132         } EWrapMode;
00133 
00141         typedef enum 
00142         {
00143             eTRANSLUCENT,
00144             eADDITIVE,
00145             eMODULATE,
00146             eMODULATE2,
00147             eOVER
00148         } EBlendMode;
00149 
00156         typedef enum  
00157         {
00158             eLEFT = 0,
00159             eRIGHT,
00160             eTOP,
00161             eBOTTOM
00162         } EAlignMode;
00163 
00169         typedef enum 
00170         {
00171             eU = 0,
00172             eV,
00173             eW
00174         } ECoordinates;
00175 
00176         // Type description
00177 
00181         KFbxTypedProperty<ETextureUse6>         TextureTypeUse;
00182 
00186         KFbxTypedProperty<fbxDouble1>           Alpha;
00187 
00188 
00189         // Mapping information
00190 
00194         KFbxTypedProperty<EUnifiedMappingType>  CurrentMappingType;
00195 
00199         KFbxTypedProperty<EWrapMode>            WrapModeU;
00200 
00204         KFbxTypedProperty<EWrapMode>            WrapModeV;
00205 
00210         KFbxTypedProperty<fbxBool1>             UVSwap;
00211 
00212         // Texture positioning
00213 
00217         KFbxTypedProperty<fbxDouble3>           Translation;
00218 
00222         KFbxTypedProperty<fbxDouble3>           Rotation;
00223 
00227         KFbxTypedProperty<fbxDouble3>           Scaling;
00228 
00232         KFbxTypedProperty<fbxDouble3>           RotationPivot;
00233 
00237         KFbxTypedProperty<fbxDouble3>           ScalingPivot;
00238 
00239         // Material management
00240 
00244         KFbxTypedProperty<fbxBool1>             UseMaterial;
00245 
00249         KFbxTypedProperty<fbxBool1>             UseMipMap;
00250 
00251         // Blend mode
00255         KFbxTypedProperty<EBlendMode>   CurrentTextureBlendMode;
00256 
00257         // UV set to use.
00261         KFbxTypedProperty<fbxString>            UVSet;
00262 
00266     void Reset();
00267 
00273     bool SetFileName(char const* pName);
00274 
00280     bool SetRelativeFileName(char const* pName);
00281 
00286     char const* GetFileName () const;
00287 
00292     char const* GetRelativeFileName() const;
00293 
00294 
00299     void SetSwapUV(bool pSwapUV);
00300 
00305     bool GetSwapUV() const;
00306 
00312     typedef enum    
00313     { 
00314         eNONE, 
00315         eRGB_INTENSITY, 
00316         eBLACK 
00317     } EAlphaSource;
00318 
00322     void SetAlphaSource(EAlphaSource pAlphaSource);
00323 
00327     EAlphaSource GetAlphaSource() const;
00328 
00338     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00339 
00343     int GetCroppingLeft() const;
00344 
00348     int GetCroppingTop() const;
00349 
00353     int GetCroppingRight() const;
00354 
00358     int GetCroppingBottom() const;
00359     
00370     typedef enum    
00371     { 
00372         eNULL, 
00373         ePLANAR, 
00374         eSPHERICAL, 
00375         eCYLINDRICAL, 
00376         eBOX, 
00377         eFACE,
00378         eUV,
00379         eENVIRONMENT
00380     } EMappingType;
00381 
00385     void SetMappingType(EMappingType pMappingType);
00386 
00390     EMappingType GetMappingType() const;
00391 
00397     typedef enum   
00398     { 
00399         ePLANAR_NORMAL_X, 
00400         ePLANAR_NORMAL_Y, 
00401         ePLANAR_NORMAL_Z 
00402     } EPlanarMappingNormal;
00403 
00407     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00408 
00412     EPlanarMappingNormal GetPlanarMappingNormal() const;
00413 
00418     typedef enum 
00419     {
00420         eMODEL_MATERIAL,
00421         eDEFAULT_MATERIAL
00422     } EMaterialUse;
00423 
00427     void SetMaterialUse(EMaterialUse pMaterialUse);
00428 
00432     EMaterialUse GetMaterialUse() const;
00433 
00442     typedef enum 
00443     {
00444         eSTANDARD,
00445         eSHADOW_MAP,
00446         eLIGHT_MAP,
00447         eSPHERICAL_REFLEXION_MAP,
00448         eSPHERE_REFLEXION_MAP,
00449         eBUMP_NORMAL_MAP
00450     } ETextureUse;
00451 
00455     void SetTextureUse(ETextureUse pTextureUse);
00456 
00460     ETextureUse GetTextureUse() const;
00461 
00462 
00467     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00468 
00472     EWrapMode GetWrapModeU() const;
00473 
00477     EWrapMode GetWrapModeV() const;
00478 
00479 
00483     void SetBlendMode(EBlendMode pBlendMode);
00484 
00488     EBlendMode GetBlendMode() const;
00489 
00491 
00497 
00507     inline void SetDefaultT(const KFbxVector4& pT) { Translation.Set( pT ); }
00508 
00519     KFbxVector4& GetDefaultT(KFbxVector4& pT) const;
00520 
00529     inline void SetDefaultR(const KFbxVector4& pR) { Rotation.Set( fbxDouble3(pR[0],pR[1],pR[2]) ); }
00530 
00540     KFbxVector4& GetDefaultR(KFbxVector4& pR) const;
00541 
00549     inline void SetDefaultS(const KFbxVector4& pS) { Scaling.Set( fbxDouble3(pS[0],pS[1],pS[2]) ); }
00550 
00558     KFbxVector4& GetDefaultS(KFbxVector4& pS) const;
00559 
00563     void SetDefaultAlpha(double pAlpha);
00564 
00568     double GetDefaultAlpha() const;
00569 
00571 
00579 
00586     void SetTranslation(double pU,double pV);
00587 
00592     double GetTranslationU() const;
00593 
00598     double GetTranslationV() const;
00599 
00607     void SetRotation(double pU, double pV, double pW = 0.0);
00608 
00610     double GetRotationU() const;
00611 
00613     double GetRotationV() const;
00614 
00616     double GetRotationW() const;
00617 
00624     void SetScale(double pU,double pV);
00625 
00630     double GetScaleU() const;
00631 
00636     double GetScaleV() const;
00637 
00639 //
00640 //  WARNING!
00641 //
00642 //  Anything beyond these lines may not be documented accurately and is 
00643 //  subject to change without notice.
00644 //
00646 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00647 
00648     virtual KFbxObject& Copy(const KFbxObject& pObject);
00649     virtual KFbxObject* Clone(KFbxObject* pContainer, KFbxObject::ECloneType pCloneType) const;
00650 
00651     bool operator==(KFbxTexture const& pTexture) const;
00652 
00653     KString& GetMediaName();
00654     void SetMediaName(char const* pMediaName);
00655 
00656     void SetUVTranslation(KFbxVector2& pT);
00657     KFbxVector2& GetUVTranslation();
00658     void SetUVScaling(KFbxVector2& pS);
00659     KFbxVector2& GetUVScaling();
00660 
00661     KString GetTextureType();
00662 
00663 protected:
00664     KFbxTexture(KFbxSdkManager& pManager, char const* pName);  
00665 
00666     virtual void Construct(const KFbxTexture* pFrom);
00667     virtual bool ConstructProperties(bool pForceSet);
00668 
00669     void Init();
00670     void SyncVideoFileName(char const* pFileName);
00671     void SyncVideoRelativeFileName(char const* pFileName);
00672 
00673     int mTillingUV[2]; // not a prop
00674     int mCropping[4]; // not a prop
00675 
00676     EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop
00677     EMappingType mMappingType; // CurrentMappingType
00678     EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType
00679 
00680     KString mFileName;
00681     KString mRelativeFileName;
00682     KString mMediaName; // not a prop
00683 
00684     static KError smError;
00685 
00686     // Unsupported parameters in the FBX SDK, these are declared but not accessible.
00687     // They are used to keep imported and exported data identical.
00688 
00689     KFbxVector2 mUVScaling; // not a prop
00690     KFbxVector2 mUVTranslation; // not a prop
00691 
00692     friend class KFbxLayerContainer;
00693 
00694 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00695 
00696 };
00697 
00698 inline EFbxType FbxTypeOf( KFbxTexture::EUnifiedMappingType const &pItem )      { return eENUM; }
00699 inline EFbxType FbxTypeOf( KFbxTexture::ETextureUse6 const &pItem )             { return eENUM; }
00700 inline EFbxType FbxTypeOf( KFbxTexture::EWrapMode const &pItem )                { return eENUM; }
00701 inline EFbxType FbxTypeOf( KFbxTexture::EBlendMode const &pItem )               { return eENUM; }
00702 
00703 typedef KFbxTexture* HKFbxTexture;
00704 
00705 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00706 
00707 #endif // FBXFILESDK_KFBXPLUGINS_KFBXTEXTURE_H
00708