fbxtexture.h

Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2012 Autodesk, Inc.
00004    All rights reserved.
00005  
00006    Use of this software is subject to the terms of the Autodesk license agreement
00007    provided at the time of installation or download, or which otherwise accompanies
00008    this software in either electronic or hard copy form.
00009  
00010 ****************************************************************************************/
00011 
00013 #ifndef _FBXSDK_SCENE_SHADING_TEXTURE_H_
00014 #define _FBXSDK_SCENE_SHADING_TEXTURE_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/core/fbxobject.h>
00019 #include <fbxsdk/core/base/fbxerror.h>
00020 #include <fbxsdk/core/math/fbxvector2.h>
00021 
00022 #include <fbxsdk/fbxsdk_nsbegin.h>
00023 
00024 // Forward declaration
00025 class FbxVector4;
00026 class FbxLayerContainer;
00027 
00032 class FBXSDK_DLL FbxTexture : public FbxObject
00033 {
00034     FBXSDK_OBJECT_DECLARE(FbxTexture, FbxObject);
00035 
00036 public:
00046         enum EUnifiedMappingType
00047         { 
00048             eUMT_UV,            
00049             eUMT_XY,            
00050             eUMT_YZ,            
00051             eUMT_XZ,            
00052             eUMT_SPHERICAL,     
00053             eUMT_CYLINDRICAL,   
00054             eUMT_ENVIRONMENT,   
00055             eUMT_PROJECTION,    
00056             eUMT_BOX,           
00057             eUMT_FACE,          
00058             eUMT_NO_MAPPING,    
00059         };
00060 
00065         enum ETextureUse6
00066         {
00067             eTEXTURE_USE_6_STANDARD,                
00068             eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP, 
00069             eTEXTURE_USE_6_SPHERE_REFLEXION_MAP,    
00070             eTEXTURE_USE_6_SHADOW_MAP,              
00071             eTEXTURE_USE_6_LIGHT_MAP,               
00072             eTEXTURE_USE_6_BUMP_NORMAL_MAP          
00073         };
00074 
00078         enum EWrapMode
00079         {
00080             eRepeat,    
00081             eClamp      
00082         };
00083 
00086         enum EBlendMode
00087         {
00088             eTranslucent,   
00089             eAdditive,      
00090             eModulate,      
00091             eModulate2,     
00092             eOver           
00093         };
00094 
00097         enum EAlignMode
00098         {
00099             eLeft,  
00100             eRight, 
00101             eTop,   
00102             eBottom 
00103         };
00104 
00107         enum ECoordinates
00108         {
00109             eU, 
00110             eV, 
00111             eW  
00112         };
00113 
00114         // Type description
00115 
00119         FbxPropertyT<ETextureUse6>          TextureTypeUse;
00120 
00124         FbxPropertyT<FbxDouble>         Alpha;
00125 
00126 
00127         // Mapping information
00128 
00132         FbxPropertyT<EUnifiedMappingType>   CurrentMappingType;
00133 
00137         FbxPropertyT<EWrapMode>         WrapModeU;
00138 
00142         FbxPropertyT<EWrapMode>         WrapModeV;
00143 
00148         FbxPropertyT<FbxBool>               UVSwap;
00149 
00154         FbxPropertyT<FbxBool>               PremultiplyAlpha;
00155 
00156         // Texture positioning
00157 
00161         FbxPropertyT<FbxDouble3>            Translation;
00162 
00166         FbxPropertyT<FbxDouble3>            Rotation;
00167 
00171         FbxPropertyT<FbxDouble3>            Scaling;
00172 
00176         FbxPropertyT<FbxDouble3>            RotationPivot;
00177 
00181         FbxPropertyT<FbxDouble3>            ScalingPivot;
00182 
00183         // Blend mode
00187         FbxPropertyT<EBlendMode>    CurrentTextureBlendMode;
00188 
00189         // UV set to use.
00193         FbxPropertyT<FbxString>         UVSet;
00194 
00199         static const char* sVectorSpace        ;
00200         static const char* sVectorSpaceWorld   ;
00201         static const char* sVectorSpaceObject  ;
00202         static const char* sVectorSpaceTangent ;
00203 
00208         static const char* sVectorEncoding     ;
00209         static const char* sVectorEncodingFP   ;
00210         static const char* sVectorEncodingSE   ;
00211 
00212 
00215     virtual void Reset();
00216 
00221     void SetSwapUV(bool pSwapUV);
00222 
00227     bool GetSwapUV() const;
00228 
00233     void SetPremultiplyAlpha(bool pPremultiplyAlpha);
00234 
00239     bool GetPremultiplyAlpha() const;
00240 
00243     enum EAlphaSource
00244     { 
00245         eNone,          
00246         eRGBIntensity,  
00247         eBlack          
00248     };
00249 
00253     void SetAlphaSource(EAlphaSource pAlphaSource);
00254 
00258     EAlphaSource GetAlphaSource() const;
00259 
00269     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00270 
00274     int GetCroppingLeft() const;
00275 
00279     int GetCroppingTop() const;
00280 
00284     int GetCroppingRight() const;
00285 
00289     int GetCroppingBottom() const;
00290     
00293     enum EMappingType
00294     { 
00295         eNull,          
00296         ePlanar,        
00297         eSpherical,     
00298         eCylindrical,   
00299         eBox,           
00300         eFace,          
00301         eUV,            
00302         eEnvironment    
00303     };
00304 
00308     void SetMappingType(EMappingType pMappingType);
00309 
00313     EMappingType GetMappingType() const;
00314 
00317     enum EPlanarMappingNormal
00318     { 
00319         ePlanarNormalX, 
00320         ePlanarNormalY, 
00321         ePlanarNormalZ  
00322     };
00323 
00327     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00328 
00332     EPlanarMappingNormal GetPlanarMappingNormal() const;
00333 
00336     enum ETextureUse
00337     {
00338         eStandard,                  
00339         eShadowMap,                 
00340         eLightMap,                  
00341         eSphericalReflectionMap,    
00342         eSphereReflectionMap,       
00343         eBumpNormalMap              
00344     };
00345 
00349     void SetTextureUse(ETextureUse pTextureUse);
00350 
00354     ETextureUse GetTextureUse() const;
00355 
00356 
00361     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00362 
00366     EWrapMode GetWrapModeU() const;
00367 
00371     EWrapMode GetWrapModeV() const;
00372 
00373 
00377     void SetBlendMode(EBlendMode pBlendMode);
00378 
00382     EBlendMode GetBlendMode() const;
00383 
00385 
00391 
00401     inline void SetDefaultT(const FbxVector4& pT) { Translation.Set( pT ); }
00402 
00413     FbxVector4& GetDefaultT(FbxVector4& pT) const;
00414 
00423     inline void SetDefaultR(const FbxVector4& pR) { Rotation.Set( FbxDouble3(pR[0],pR[1],pR[2]) ); }
00424 
00434     FbxVector4& GetDefaultR(FbxVector4& pR) const;
00435 
00443     inline void SetDefaultS(const FbxVector4& pS) { Scaling.Set( FbxDouble3(pS[0],pS[1],pS[2]) ); }
00444 
00452     FbxVector4& GetDefaultS(FbxVector4& pS) const;
00453 
00455 
00460 
00464     void SetDefaultAlpha(double pAlpha);
00465 
00469     double GetDefaultAlpha() const;
00470 
00472 
00480 
00487     void SetTranslation(double pU,double pV);
00488 
00493     double GetTranslationU() const;
00494 
00499     double GetTranslationV() const;
00500 
00508     void SetRotation(double pU, double pV, double pW = 0.0);
00509 
00511     double GetRotationU() const;
00512 
00514     double GetRotationV() const;
00515 
00517     double GetRotationW() const;
00518 
00525     void SetScale(double pU,double pV);
00526 
00531     double GetScaleU() const;
00532 
00537     double GetScaleV() const;
00539 
00541 //
00542 //  WARNING!
00543 //
00544 //  Anything beyond these lines may not be documented accurately and is 
00545 //  subject to change without notice.
00546 //
00548 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00549     virtual FbxObject& Copy(const FbxObject& pObject);
00550 
00551     virtual bool operator==(FbxTexture const& pTexture) const;
00552 
00553     void SetUVTranslation(FbxVector2& pT);
00554     FbxVector2& GetUVTranslation();
00555     void SetUVScaling(FbxVector2& pS);
00556     FbxVector2& GetUVScaling();
00557 
00558     FbxString GetTextureType();
00559 
00560 protected:
00561     FbxTexture(FbxManager& pManager, char const* pName);  
00562 
00563     virtual void Construct(const FbxTexture* pFrom);
00564     virtual bool ConstructProperties(bool pForceSet);
00565 
00566     virtual bool PropertyNotify(EPropertyNotifyType pType, FbxProperty* pProperty);
00567 
00568     void Init();
00569 
00570     int mCropping[4]; // not a prop
00571 
00572     EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop
00573     EMappingType mMappingType; // CurrentMappingType
00574     EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType
00575     static FbxError smError;
00576 
00577     // Unsupported parameters in the FBX SDK, these are declared but not accessible.
00578     // They are used to keep imported and exported data identical.
00579 
00580     FbxVector2 mUVScaling; // not a prop
00581     FbxVector2 mUVTranslation; // not a prop
00582 
00583     friend class FbxLayerContainer;
00584 
00585 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00586 
00587 };
00588 
00589 inline EFbxType FbxTypeOf(const FbxTexture::EUnifiedMappingType&){ return eFbxEnum; }
00590 inline EFbxType FbxTypeOf(const FbxTexture::ETextureUse6&){ return eFbxEnum; }
00591 inline EFbxType FbxTypeOf(const FbxTexture::EWrapMode&){ return eFbxEnum; }
00592 inline EFbxType FbxTypeOf(const FbxTexture::EBlendMode&){ return eFbxEnum; }
00593 
00594 #include <fbxsdk/fbxsdk_nsend.h>
00595 
00596 #endif /* _FBXSDK_SCENE_SHADING_TEXTURE_H_ */