kfbxtexture.h

Go to the documentation of this file.
00001 
00004 #ifndef _FBXSDK_TEXTURE_H_
00005 #define _FBXSDK_TEXTURE_H_
00006 
00007 /**************************************************************************************
00008 
00009  Copyright © 1999 - 2007 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 <kaydaradef.h>
00043 #ifndef KFBX_DLL 
00044     #define KFBX_DLL K_DLLIMPORT
00045 #endif
00046 
00047 #include <kaydara.h>
00048 
00049 #include <klib/kerror.h>
00050 #ifdef KARCH_DEV_MACOSX_CFM
00051     #include <CFURL.h>
00052     #include <Files.h>
00053 #endif
00054 
00055 #include <kfbxplugins/kfbxtakenodecontainer.h>
00056 #include <kfbxmath/kfbxvector2.h>
00057 #include <kfbxplugins/kfbxgroupname.h>
00058 
00059 #include <fbxfilesdk_nsbegin.h>
00060 
00061 class KFbxVector4;
00062 
00063 #define KFBXTEXTURE_LEFT    0
00064 #define KFBXTEXTURE_RIGHT   1
00065 #define KFBXTEXTURE_TOP     2
00066 #define KFBXTEXTURE_BOTTOM  3
00067 
00068 #define KFBXTEXTURE_U   0
00069 #define KFBXTEXTURE_V   1
00070 #define KFBXTEXTURE_W   2
00071 
00072 class KFbxLayerContainer;
00073 class KFbxTexture_internal;
00074 
00075 
00079 class KFBX_DLL KFbxTexture : public KFbxTakeNodeContainer
00080 {
00081     KFBXOBJECT_DECLARE(KFbxTexture);
00082 public:
00087 
00091     void Reset();
00092 
00098     bool SetFileName(char const* pName);
00099 
00105     bool SetRelativeFileName(char* pName);
00106 
00107 #ifdef KARCH_DEV_MACOSX_CFM
00108     bool SetFile(const FSSpec &pMacFileSpec);
00109     bool SetFile(const FSRef &pMacFileRef);
00110     bool SetFile(const CFURLRef &pMacURL);
00111 #endif
00112 
00117     char const* GetFileName () const;
00118 
00123     char* GetRelativeFileName();
00124 
00125 #ifdef KARCH_DEV_MACOSX_CFM
00126     bool GetFile(FSSpec &pMacFileSpec) const;
00127     bool GetFile(FSRef &pMacFileRef) const;
00128     bool GetFile(CFURLRef &pMacURL) const;
00129 #endif
00130 
00135     void SetSwapUV(bool pSwapUV);
00136 
00141     bool GetSwapUV() const;
00142 
00148     typedef enum    
00149     { 
00150         eNONE, 
00151         eRGB_INTENSITY, 
00152         eBLACK 
00153     } EAlphaSource;
00154 
00158     void SetAlphaSource(EAlphaSource pAlphaSource);
00159 
00163     EAlphaSource GetAlphaSource() const;
00164 
00174     void SetCropping(int pLeft, int pTop, int pRight, int pBottom);
00175 
00179     int GetCroppingLeft() const;
00180 
00184     int GetCroppingTop() const;
00185 
00189     int GetCroppingRight() const;
00190 
00194     int GetCroppingBottom() const;
00195     
00206     typedef enum    
00207     { 
00208         eNULL, 
00209         ePLANAR, 
00210         eSPHERICAL, 
00211         eCYLINDRICAL, 
00212         eBOX, 
00213         eFACE,
00214         eUV,
00215         eENVIRONMENT
00216     } EMappingType;
00217 
00221     void SetMappingType(EMappingType pMappingType);
00222 
00226     EMappingType GetMappingType() const;
00227 
00233     typedef enum   
00234     { 
00235         ePLANAR_NORMAL_X, 
00236         ePLANAR_NORMAL_Y, 
00237         ePLANAR_NORMAL_Z 
00238     } EPlanarMappingNormal;
00239 
00243     void SetPlanarMappingNormal(EPlanarMappingNormal pPlanarMappingNormal);
00244 
00248     EPlanarMappingNormal GetPlanarMappingNormal() const;
00249 
00254     typedef enum 
00255     {
00256         eMODEL_MATERIAL,
00257         eDEFAULT_MATERIAL
00258     } EMaterialUse;
00259 
00263     void SetMaterialUse(EMaterialUse pMaterialUse);
00264 
00268     EMaterialUse GetMaterialUse() const;
00269 
00278     typedef enum 
00279     {
00280         eSTANDARD,
00281         eSHADOW_MAP,
00282         eLIGHT_MAP,
00283         eSPHERICAL_REFLEXION_MAP,
00284         eSPHERE_REFLEXION_MAP,
00285         eBUMP_NORMAL_MAP
00286     } ETextureUse;
00287 
00291     void SetTextureUse(ETextureUse pTextureUse);
00292 
00296     ETextureUse GetTextureUse() const;
00297 
00302     typedef enum 
00303     {
00304         eREPEAT,
00305         eCLAMP
00306     } EWrapMode;
00307 
00312     void SetWrapMode(EWrapMode pWrapU, EWrapMode pWrapV);
00313 
00317     EWrapMode GetWrapModeU() const;
00318 
00322     EWrapMode GetWrapModeV() const;
00323 
00330     typedef enum 
00331     {
00332         eTRANSLUCENT,
00333         eADDITIVE,
00334         eMODULATE,
00335         eMODULATE2
00336     } EBlendMode;
00337 
00341     void SetBlendMode(EBlendMode pBlendMode);
00342 
00346     EBlendMode GetBlendMode() const;
00347 
00349 
00356 
00366     void SetDefaultT(const KFbxVector4& pT);
00367 
00378     KFbxVector4& GetDefaultT(KFbxVector4& pT) const;
00379 
00388     void SetDefaultR(const KFbxVector4& pR);
00389 
00399     KFbxVector4& GetDefaultR(KFbxVector4& pR) const;
00400 
00408     void SetDefaultS(const KFbxVector4& pS);
00409 
00418     KFbxVector4& GetDefaultS(KFbxVector4& pS) const;
00419 
00423     void SetDefaultAlpha(double pAlpha);
00424 
00428     double GetDefaultAlpha() const;
00429 
00431 
00440 
00449     void SetTranslation(double pU,double pV);
00450 
00455     double GetTranslationU() const;
00456 
00461     double GetTranslationV() const;
00462 
00470     void SetRotation(double pU, double pV, double pW = 0.0);
00471 
00473     double GetRotationU() const;
00474 
00476     double GetRotationV() const;
00477 
00479     double GetRotationW() const;
00480 
00487     void SetScale(double pU,double pV);
00488 
00493     double GetScaleU() const;
00494 
00499     double GetScaleV() const;
00500 
00502 
00507 
00511     KError& GetError();
00512 
00517     typedef enum 
00518     {
00519         eTAKE_NODE_ERROR,
00520         eERROR_COUNT
00521     } EError;   
00522 
00526     EError GetLastErrorID();
00527 
00531     char* GetLastErrorString();
00532 
00534 
00536 //
00537 //  WARNING!
00538 //
00539 //  Anything beyond these lines may not be documented accurately and is 
00540 //  subject to change without notice.
00541 //
00543 
00544 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00545 
00546     bool operator==(KFbxTexture const& pTexture) const;
00547 
00548     KString& GetMediaName();
00549     void SetMediaName(char const* pMediaName);
00550 
00551     void SetUVTranslation(KFbxVector2& pT);
00552     KFbxVector2& GetUVTranslation();
00553     void SetUVScaling(KFbxVector2& pS);
00554     KFbxVector2& GetUVScaling();
00555 
00556     KString& GetTextureType();
00557 
00558     typedef enum
00559     { 
00560         eUMT_UV, 
00561         eUMT_XY, 
00562         eUMT_YZ, 
00563         eUMT_XZ, 
00564         eUMT_SPHERICAL,
00565         eUMT_CYLINDRICAL,
00566         eUMT_ENVIRONMENT,
00567         eUMT_PROJECTION,
00568         eUMT_BOX, // deprecated
00569         eUMT_FACE, // deprecated
00570         eUMT_NO_MAPPING,
00571     } EUnifiedMappingType;
00572 
00573     typedef enum 
00574     {
00575         eTEXTURE_USE_6_STANDARD,
00576         eTEXTURE_USE_6_SPHERICAL_REFLEXION_MAP,
00577         eTEXTURE_USE_6_SPHERE_REFLEXION_MAP,
00578         eTEXTURE_USE_6_SHADOW_MAP,
00579         eTEXTURE_USE_6_LIGHT_MAP,
00580         eTEXTURE_USE_6_BUMP_NORMAL_MAP
00581     } ETextureUse6;
00582 
00583     virtual KObject* GetFbxObject_internal();
00584     virtual KObject const*  GetFbxObject_internal() const;
00585 
00586     // Clone
00587     virtual KFbxObject* Clone(KFbxObject::ECloneType pCloneType) const;
00588 
00589 protected:
00590     static char const* GetNamePrefix() { return TEXTURE_PREFIX; }
00591 
00592     KFbxTexture(KFbxSdkManager& pManager, char const* pName);  
00593     virtual ~KFbxTexture();
00594 
00595     virtual void Destruct(bool pRecursive, bool pDependents);
00596 
00598     KFbxTexture& operator=(KFbxTexture const& pTexture);
00599 
00600     virtual KFbxObject::ENameSpace GetNameSpace() const;
00601     virtual KString     GetTypeName() const;
00602     virtual KStringList GetTypeFlags() const;
00603     
00604     virtual void AddChannels(KFbxTakeNode *pTakeNode);
00605 
00606     void Init();
00607     void SyncVideoFileName(char const* pFileName);
00608     void SyncVideoRelativeFileName(char const* pFileName);
00609 
00610     int mTillingUV[2]; // not a prop
00611     int mCropping[4]; // not a prop
00612 
00613     EAlphaSource mAlphaSource; // now unused in MB (always set to None); not a prop
00614     EMappingType mMappingType; // CurrentMappingType
00615     EPlanarMappingNormal mPlanarMappingNormal; // CurrentMappingType
00616 
00617     KString mFileName;
00618     KString mRelativeFileName;
00619     KString mMediaName; // not a prop
00620     KString mTextureType;
00621 
00622     static KError smError;
00623 
00624     // Unsupported parameters in the FBX SDK, these are declared but not accessible.
00625     // They are used to keep imported and exported data identical.
00626 
00627     KFbxVector2 mUVScaling; // not a prop
00628     KFbxVector2 mUVTranslation; // not a prop
00629 
00630     KFbxTexture_internal *mPH;
00631 
00632     friend class KFbxWriterFbx6;
00633 
00634     friend class KFbxTexture_internal;
00635 
00636     friend class KFbxLayerContainer;
00637 
00638 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS
00639 
00640 };
00641 
00642 typedef KFbxTexture* HKFbxTexture;
00643 
00644 #include <fbxfilesdk_nsend.h>
00645 
00646 #endif // #ifndef _FBXSDK_TEXTURE_H_
00647 
00648 
00649