fbxsdk/utils/fbxmaterialconverter.h Source File
 
 
 
fbxsdk/utils/fbxmaterialconverter.h
Go to the documentation of this file.
00001 /****************************************************************************************
00002  
00003    Copyright (C) 2013 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 
00020 #include <fbxsdk/fbxsdk_nsbegin.h>
00021 
00022 class LayerConfig;
00023 class FbxMaterialConverter_Impl;
00024 
00031 class FBXSDK_DLL FbxMaterialConverter
00032 {
00033 public:
00034         FbxMaterialConverter( FbxManager& mManager, FbxSurfaceMaterial* pDefaultMaterial = NULL);
00035         ~FbxMaterialConverter();
00036 
00043         bool ConnectTexturesToMaterials( FbxScene& pScene );
00044 
00051         bool ConnectTexturesToMaterials( FbxNode* pNode );
00052 
00060         bool AssignTexturesToLayerElements( FbxScene& pScene );
00061 
00062 /*****************************************************************************************************************************
00063 ** WARNING! Anything beyond these lines is for internal use, may not be documented and is subject to change without notice! **
00064 *****************************************************************************************************************************/
00065 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00066 private:
00067         typedef FbxPair<FbxTexture*, FbxLayerElementTexture::EBlendMode> TexData;
00068 
00069         FbxMaterialConverter& operator=(const FbxMaterialConverter&);
00070 
00071         FbxManager& mManager;
00072         FbxSurfaceMaterial* mDefaultMaterial;
00073     FbxMaterialConverter_Impl* mImpl;
00074 
00075 
00076         void GetTextures( int pComponent, FbxLayer* pLayer, LayerConfig& pLayerConfig ) const;
00077         FbxSurfaceMaterial* GetMaterial( int pComponent, FbxLayer* pLayer, FbxNode* pNode, bool pLookOnNode );
00078         int                  GetMaterialOrder( int pComponent, FbxLayer* pLayer, FbxNode* pNode, bool pLookOnNode );
00079 
00080         bool HasGoodMappingModes( FbxNode* pNode, FbxGeometry* pGeom ) const;
00081         void ConnectTextures( FbxSurfaceMaterial* pMat, FbxObject* pTexture, int pTextureType ) const;
00082         bool HasPerFaceMaterialMapping( FbxGeometry* pGeom ) const;
00083         void SetTextureUVSets( FbxGeometry* pGeom ) const;
00084         bool HasTextures( FbxGeometry* pGeom ) const;
00085 
00086         void GetTextureList( FbxArray<TexData>& pTextures, FbxLayeredTexture* pTex ) const;
00087 
00088         FbxLayer* FindLayerForTexture( FbxTexture* pTex, 
00089                                                                   FbxLayerElement::EType pTexType, 
00090                                   FbxLayerElementTexture::EBlendMode pTexBlendMode, 
00091                                                                   FbxGeometry* pGeom, 
00092                                                                   int lComponentIndex, 
00093                                                                   int lStartIndex = 0 ) const;
00094 
00095         void InitTextureElement( FbxLayerElementTexture* pTexElm, int pComponentCount,
00096         FbxLayerElementTexture::EBlendMode pMode) const;
00097 
00098         bool AssignTexturesToLayerElements( FbxNode* pNode); 
00099 
00100         bool HasTextureLayerElements( FbxGeometry& pGeom ) const;
00101 
00102         void ConvertToPerFaceMapping( FbxMesh* pGeom ) const;
00103 #endif /* !DOXYGEN_SHOULD_SKIP_THIS *****************************************************************************************/
00104 };
00105 
00106 #include <fbxsdk/fbxsdk_nsend.h>
00107 
00108 #endif /* _FBXSDK_UTILS_MATERIAL_CONVERTER_H_ */