00001
00004 #ifndef _FBXSDK_TEXTURE_H_
00005 #define _FBXSDK_TEXTURE_H_
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
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
00053 #include <kfbxmath/kfbxvector2.h>
00054 #include <kfbxplugins/kfbxshadingnode.h>
00055
00056
00057 #include <fbxfilesdk_nsbegin.h>
00058
00059
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,
00087 eUMT_FACE,
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
00152 KFbxTypedProperty<ETextureUse6> TextureTypeUse;
00153 KFbxTypedProperty<fbxDouble1> Alpha;
00154
00155
00156 KFbxTypedProperty<EUnifiedMappingType> CurrentMappingType;
00157 KFbxTypedProperty<EWrapMode> WrapModeU;
00158 KFbxTypedProperty<EWrapMode> WrapModeV;
00159 KFbxTypedProperty<fbxBool1> UVSwap;
00160
00161
00162 KFbxTypedProperty<fbxDouble3> Translation;
00163 KFbxTypedProperty<fbxDouble3> Rotation;
00164 KFbxTypedProperty<fbxDouble3> Scaling;
00165 KFbxTypedProperty<fbxDouble3> RotationPivot;
00166 KFbxTypedProperty<fbxDouble3> ScalingPivot;
00167
00168
00169 KFbxTypedProperty<fbxBool1> UseMaterial;
00170 KFbxTypedProperty<fbxBool1> UseMipMap;
00171
00172
00173 KFbxTypedProperty<EBlendMode> CurrentTextureBlendMode;
00174
00175
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
00572
00573
00574
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
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];
00614 int mCropping[4];
00615
00616 EAlphaSource mAlphaSource;
00617 EMappingType mMappingType;
00618 EPlanarMappingNormal mPlanarMappingNormal;
00619
00620 KString mFileName;
00621 KString mRelativeFileName;
00622 KString mMediaName;
00623
00624 static KError smError;
00625
00626
00627
00628
00629 KFbxVector2 mUVScaling;
00630 KFbxVector2 mUVTranslation;
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