From 83896f18b3cf1f0b19dea385ff34575d84628fab Mon Sep 17 00:00:00 2001 From: Giuseppe Barbieri Date: Fri, 9 Dec 2016 19:27:01 +0100 Subject: [PATCH 1/2] Update ObjFileImporter.h --- code/ObjFileImporter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ObjFileImporter.h b/code/ObjFileImporter.h index a962d43c4..bd3f42f27 100644 --- a/code/ObjFileImporter.h +++ b/code/ObjFileImporter.h @@ -100,7 +100,7 @@ private: void createMaterials(const ObjFile::Model* pModel, aiScene* pScene); /// @brief Adds special property for the used texture mapping mode of the model. - void addTextureMappingModeProperty(aiMaterial* mat, aiTextureType type, int clampMode = 1); + void addTextureMappingModeProperty(aiMaterial* mat, aiTextureType type, int clampMode = 1, int index = 0); //! \brief Appends a child node to a parent node and updates the data structures. void appendChildToParentNode(aiNode *pParent, aiNode *pChild); From b1d5390413ef871964830ad0c70a8426c3f9decb Mon Sep 17 00:00:00 2001 From: Giuseppe Barbieri Date: Fri, 9 Dec 2016 19:31:07 +0100 Subject: [PATCH 2/2] Update ObjFileImporter.cpp --- code/ObjFileImporter.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/code/ObjFileImporter.cpp b/code/ObjFileImporter.cpp index 470564b4c..a30c640a6 100644 --- a/code/ObjFileImporter.cpp +++ b/code/ObjFileImporter.cpp @@ -542,13 +542,13 @@ void ObjFileImporter::countObjects(const std::vector &rObjects // ------------------------------------------------------------------------------------------------ // Add clamp mode property to material if necessary -void ObjFileImporter::addTextureMappingModeProperty( aiMaterial* mat, aiTextureType type, int clampMode) { +void ObjFileImporter::addTextureMappingModeProperty( aiMaterial* mat, aiTextureType type, int clampMode, int index) { if ( nullptr == mat ) { return; } - mat->AddProperty( &clampMode, 1, AI_MATKEY_MAPPINGMODE_U( type, 0 ) ); - mat->AddProperty( &clampMode, 1, AI_MATKEY_MAPPINGMODE_V( type, 0 ) ); + mat->AddProperty( &clampMode, 1, AI_MATKEY_MAPPINGMODE_U( type, index ) ); + mat->AddProperty( &clampMode, 1, AI_MATKEY_MAPPINGMODE_V( type, index ) ); } // ------------------------------------------------------------------------------------------------ @@ -668,12 +668,12 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc unsigned count = type == ObjFile::Material::TextureReflectionSphereType ? 1 : 6; for( unsigned i = 0; i < count; i++ ) + { mat->AddProperty(&pCurrentMaterial->textureReflection[i], AI_MATKEY_TEXTURE_REFLECTION(i)); - if(pCurrentMaterial->clamp[type]) - //TODO addTextureMappingModeProperty should accept an index to handle clamp option for each - //texture of a cubemap - addTextureMappingModeProperty(mat, aiTextureType_REFLECTION); + if(pCurrentMaterial->clamp[type]) + addTextureMappingModeProperty(mat, aiTextureType_REFLECTION, 1, i); + } } if ( 0 != pCurrentMaterial->textureDisp.length )