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 
00059 class KFBX_DLL KFbxTexture : public KFbxObject
00060 {
00061     KFBXOBJECT_DECLARE(KFbxTexture,KFbxObject);
00062 
00063     public:
00068 
00074         typedef enum
00075         { 
00077             eUMT_UV, 
00079             eUMT_XY, 
00081             eUMT_YZ, 
00083             eUMT_XZ, 
00085             eUMT_SPHERICAL,
00087             eUMT_CYLINDRICAL,
00089             eUMT_ENVIRONMENT,
00091             eUMT_PROJECTION,
00093             eUMT_BOX, // deprecated
00095             eUMT_FACE, // deprecated
00097             eUMT_NO_MAPPING,
00098         } EUnifiedMappingType;
00099 
00100 
00105         typedef enum 
00106         {
00108             eTEXTURE_USE_6_STANDARD,
00110             eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP,
00112             eTEXTURE_USE_6_SPHERE_REFLEXION_MAP,
00114             eTEXTURE_USE_6_SHADOW_MAP,
00116             eTEXTURE_USE_6_LIGHT_MAP,
00118             eTEXTURE_USE_6_BUMP_NORMAL_MAP
00119         } ETextureUse6;
00120 
00124         typedef enum 
00125         {
00127             eREPEAT,
00129             eCLAMP
00130         } EWrapMode;
00131 
00134         typedef enum 
00135         {
00137             eTRANSLUCENT,
00139             eADDITIVE,
00141             eMODULATE,
00143             eMODULATE2,
00145             eOVER
00146         } EBlendMode;
00147 
00150         typedef enum  
00151         {
00153             eLEFT = 0,
00155             eRIGHT,
00157             eTOP,
00159             eBOTTOM
00160         } EAlignMode;
00161 
00164         typedef enum 
00165         {
00167             eU = 0,
00169             eV,
00171             eW
00172         } ECoordinates;
00173 
00174         // Type description
00175 
00179         KFbxTypedProperty<ETextureUse6>         TextureTypeUse;
00180 
00184         KFbxTypedProperty<fbxDouble1>           Alpha;
00185 
00186 
00187         // Mapping information
00188 
00192         KFbxTypedProperty<EUnifiedMappingType>  CurrentMappingType;
00193 
00197         KFbxTypedProperty<EWrapMode>            WrapModeU;
00198 
00202         KFbxTypedProperty<EWrapMode>            WrapModeV;
00203 
00208         KFbxTypedProperty<fbxBool1>             UVSwap;
00209 
00214         KFbxTypedProperty<fbxBool1>             PremultiplyAlpha;
00215 
00216         // Texture positioning
00217 
00221         KFbxTypedProperty<fbxDouble3>           Translation;
00222 
00226         KFbxTypedProperty<fbxDouble3>           Rotation;
00227 
00231         KFbxTypedProperty<fbxDouble3>           Scaling;
00232 
00236         KFbxTypedProperty<fbxDouble3>           RotationPivot;
00237 
00241         KFbxTypedProperty<fbxDouble3>           ScalingPivot;
00242 
00243         // Blend mode
00247         KFbxTypedProperty<EBlendMode>   CurrentTextureBlendMode;
00248 
00249         // UV set to use.
00253         KFbxTypedProperty<fbxString>            UVSet;
00254 
00259         static const char* sVectorSpace        ;
00260         static const char* sVectorSpaceWorld   ;
00261         static const char* sVectorSpaceObject  ;
00262         static const char* sVectorSpaceTangent ;
00263 
00268         static const char* sVectorEncoding     ;
00269         static const char* sVectorEncodingFP   ;
00270         static const char* sVectorEncodingSE   ;
00271 
00272 
00275     virtual void Reset();
00276 
00281     void SetSwapUV(bool pSwapUV);
00282 
00287     bool GetSwapUV() const;
00288 
00293     void SetPremultiplyAlpha(bool pPremultiplyAlpha);
00294 
00299     bool GetPremultiplyAlpha() const;
00300 
00303     typedef enum    
00304     { 
00306         eNONE, 
00308         eRGB_INTENSITY, 
00310         eBLACK 
00311     } EAlphaSource;
00312 
00316     void SetAlphaSource(EAlphaSource pAlphaSource);
00317 
00321     EAlphaSource GetAlphaSource() const;
00322 
00332     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00333 
00337     int GetCroppingLeft() const;
00338 
00342     int GetCroppingTop() const;
00343 
00347     int GetCroppingRight() const;
00348 
00352     int GetCroppingBottom() const;
00353     
00356     typedef enum    
00357     { 
00359         eNULL, 
00361         ePLANAR, 
00363         eSPHERICAL, 
00365         eCYLINDRICAL, 
00367         eBOX, 
00369         eFACE,
00371         eUV,
00373         eENVIRONMENT
00374     } EMappingType;
00375 
00379     void SetMappingType(EMappingType pMappingType);
00380 
00384     EMappingType GetMappingType() const;
00385 
00388     typedef enum   
00389     { 
00391         ePLANAR_NORMAL_X, 
00393         ePLANAR_NORMAL_Y, 
00395         ePLANAR_NORMAL_Z 
00396     } EPlanarMappingNormal;
00397 
00401     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00402 
00406     EPlanarMappingNormal GetPlanarMappingNormal() const;
00407 
00410     typedef enum 
00411     {
00413         eSTANDARD,
00415         eSHADOW_MAP,
00417         eLIGHT_MAP,
00419         eSPHERICAL_REFLEXION_MAP,
00421         eSPHERE_REFLEXION_MAP,
00423         eBUMP_NORMAL_MAP
00424     } ETextureUse;
00425 
00429     void SetTextureUse(ETextureUse pTextureUse);
00430 
00434     ETextureUse GetTextureUse() const;
00435 
00436 
00441     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00442 
00446     EWrapMode GetWrapModeU() const;
00447 
00451     EWrapMode GetWrapModeV() const;
00452 
00453 
00457     void SetBlendMode(EBlendMode pBlendMode);
00458 
00462     EBlendMode GetBlendMode() const;
00463 
00465 
00471 
00481     inline void SetDefaultT(const KFbxVector4& pT) { Translation.Set( pT ); }
00482 
00493     KFbxVector4& GetDefaultT(KFbxVector4& pT) const;
00494 
00503     inline void SetDefaultR(const KFbxVector4& pR) { Rotation.Set( fbxDouble3(pR[0],pR[1],pR[2]) ); }
00504 
00514     KFbxVector4& GetDefaultR(KFbxVector4& pR) const;
00515 
00523     inline void SetDefaultS(const KFbxVector4& pS) { Scaling.Set( fbxDouble3(pS[0],pS[1],pS[2]) ); }
00524 
00532     KFbxVector4& GetDefaultS(KFbxVector4& pS) const;
00533 
00535 
00540 
00544     void SetDefaultAlpha(double pAlpha);
00545 
00549     double GetDefaultAlpha() const;
00550 
00552 
00560 
00567     void SetTranslation(double pU,double pV);
00568 
00573     double GetTranslationU() const;
00574 
00579     double GetTranslationV() const;
00580 
00588     void SetRotation(double pU, double pV, double pW = 0.0);
00589 
00591     double GetRotationU() const;
00592 
00594     double GetRotationV() const;
00595 
00597     double GetRotationW() const;
00598 
00605     void SetScale(double pU,double pV);
00606 
00611     double GetScaleU() const;
00612 
00617     double GetScaleV() const;
00619 
00621 //
00622 //  WARNING!
00623 //
00624 //  Anything beyond these lines may not be documented accurately and is 
00625 //  subject to change without notice.
00626 //
00628 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00629     virtual KFbxObject& Copy(const KFbxObject& pObject);
00630 
00631     virtual bool operator==(KFbxTexture const& pTexture) const;
00632 
00633     void SetUVTranslation(KFbxVector2& pT);
00634     KFbxVector2& GetUVTranslation();
00635     void SetUVScaling(KFbxVector2& pS);
00636     KFbxVector2& GetUVScaling();
00637 
00638     KString GetTextureType();
00639 
00640 protected:
00641     KFbxTexture(KFbxSdkManager& pManager, char const* pName);  
00642 
00643     virtual void Construct(const KFbxTexture* pFrom);
00644     virtual bool ConstructProperties(bool pForceSet);
00645 
00646     virtual bool PropertyNotify(eFbxPropertyNotify pType, KFbxProperty* pProperty);
00647 
00648     void Init();
00649 
00650     int mCropping[4]; // not a prop
00651 
00652     EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop
00653     EMappingType mMappingType; // CurrentMappingType
00654     EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType
00655     static KError smError;
00656 
00657     // Unsupported parameters in the FBX SDK, these are declared but not accessible.
00658     // They are used to keep imported and exported data identical.
00659 
00660     KFbxVector2 mUVScaling; // not a prop
00661     KFbxVector2 mUVTranslation; // not a prop
00662 
00663     friend class KFbxLayerContainer;
00664 
00665 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00666 
00667 };
00668 
00669 inline EFbxType FbxTypeOf( KFbxTexture::EUnifiedMappingType const &pItem )      { return eENUM; }
00670 inline EFbxType FbxTypeOf( KFbxTexture::ETextureUse6 const &pItem )             { return eENUM; }
00671 inline EFbxType FbxTypeOf( KFbxTexture::EWrapMode const &pItem )                { return eENUM; }
00672 inline EFbxType FbxTypeOf( KFbxTexture::EBlendMode const &pItem )               { return eENUM; }
00673 
00674 #include <fbxfilesdk/fbxfilesdk_nsend.h>
00675 
00676 #endif // FBXFILESDK_KFBXPLUGINS_KFBXTEXTURE_H
00677