Added support for reflection maps for OBJ files

This commit is contained in:
Francesco Guastella
2015-10-15 15:46:35 +02:00
parent f489a7d076
commit 2750f8da24
4 changed files with 78 additions and 6 deletions

View File

@@ -636,6 +636,22 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
}
}
if( 0 != pCurrentMaterial->textureReflection[0].length )
{
ObjFile::Material::TextureType type = 0 != pCurrentMaterial->textureReflection[1].length ?
ObjFile::Material::TextureReflectionCubeTopType :
ObjFile::Material::TextureReflectionSphereType;
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 ( 0 != pCurrentMaterial->textureDisp.length )
{
mat->AddProperty( &pCurrentMaterial->textureDisp, AI_MATKEY_TEXTURE_DISPLACEMENT(0) );