fbxmaterialconverter.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_UTILS_MATERIAL_CONVERTER_H_
00014 #define _FBXSDK_UTILS_MATERIAL_CONVERTER_H_
00015 
00016 #include <fbxsdk/fbxsdk_def.h>
00017 
00018 #include <fbxsdk/scene/geometry/fbxlayer.h>
00019 #include <fbxsdk/core/base/fbxpair.h>
00020 
00021 #include <fbxsdk/fbxsdk_nsbegin.h>
00022 
00023 class FbxObject;
00024 class FbxManager;
00025 class FbxScene;
00026 class FbxGeometry;
00027 class FbxLayer;
00028 class FbxSurfaceMaterial;
00029 class FbxLayeredTexture;
00030 class FbxTexture;
00031 
00032 class LayerConfig;
00033 
00034 class FbxMaterialConverter_Impl;
00035 
00042 class FBXSDK_DLL FbxMaterialConverter
00043 {
00044 public:
00045     FbxMaterialConverter( FbxManager& mManager, FbxSurfaceMaterial* pDefaultMaterial = NULL);
00046     ~FbxMaterialConverter();
00047 
00054     bool ConnectTexturesToMaterials( FbxScene& pScene );
00055 
00062     bool ConnectTexturesToMaterials( FbxNode* pNode );
00063 
00071     bool AssignTexturesToLayerElements( FbxScene& pScene );
00072 
00074 //
00075 //  WARNING!
00076 //
00077 //  Anything beyond these lines may not be documented accurately and is 
00078 //  subject to change without notice.
00079 //
00081 
00082 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00083 private:
00084     typedef FbxPair<FbxTexture*, FbxLayerElementTexture::EBlendMode> TexData;
00085 
00086     FbxMaterialConverter& operator=(const FbxMaterialConverter&);
00087 
00088     FbxManager& mManager;
00089     FbxSurfaceMaterial* mDefaultMaterial;
00090     FbxMaterialConverter_Impl* mImpl;
00091 
00092 
00093     void GetTextures( int pComponent, FbxLayer* pLayer, LayerConfig& pLayerConfig ) const;
00094     FbxSurfaceMaterial* GetMaterial( int pComponent, FbxLayer* pLayer, FbxNode* pNode, bool pLookOnNode );
00095     int                  GetMaterialOrder( int pComponent, FbxLayer* pLayer, FbxNode* pNode, bool pLookOnNode );
00096 
00097     bool HasGoodMappingModes( FbxNode* pNode, FbxGeometry* pGeom ) const;
00098     void ConnectTextures( FbxSurfaceMaterial* pMat, FbxObject* pTexture, int pTextureType ) const;
00099     bool HasPerFaceMaterialMapping( FbxGeometry* pGeom ) const;
00100     void SetTextureUVSets( FbxGeometry* pGeom ) const;
00101     bool HasTextures( FbxGeometry* pGeom ) const;
00102 
00103     void GetTextureList( FbxArray<TexData>& pTextures, FbxLayeredTexture* pTex ) const;
00104 
00105     FbxLayer* FindLayerForTexture( FbxTexture* pTex, 
00106                                   FbxLayerElement::EType pTexType, 
00107                                   FbxLayerElementTexture::EBlendMode pTexBlendMode, 
00108                                   FbxGeometry* pGeom, 
00109                                   int lComponentIndex, 
00110                                   int lStartIndex = 0 ) const;
00111 
00112     void InitTextureElement( FbxLayerElementTexture* pTexElm, int pComponentCount,
00113         FbxLayerElementTexture::EBlendMode pMode) const;
00114 
00115     bool AssignTexturesToLayerElements( FbxNode* pNode); 
00116 
00117     bool HasTextureLayerElements( FbxGeometry& pGeom ) const;
00118 
00119     void ConvertToPerFaceMapping( FbxMesh* pGeom ) const;
00120 
00121 #endif // #ifndef DOXYGEN_SHOULD_SKIP_THIS 
00122 };
00123 
00124 #include <fbxsdk/fbxsdk_nsend.h>
00125 
00126 #endif /* _FBXSDK_UTILS_MATERIAL_CONVERTER_H_ */