Browse Source

update : add displacement map support to obj-material importer. this feature is supported by some special exporters.

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@1347 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
kimmi 12 years ago
parent
commit
cc88a3a0de
3 changed files with 8 additions and 0 deletions
  1. 1 0
      code/ObjFileData.h
  2. 3 0
      code/ObjFileImporter.cpp
  3. 4 0
      code/ObjFileMtlImporter.cpp

+ 1 - 0
code/ObjFileData.h

@@ -159,6 +159,7 @@ struct Material
 	aiString textureBump;
 	aiString textureSpecularity;
 	aiString textureOpacity;
+	aiString textureDisp;
 
 	//!	Ambient color 
 	aiColor3D ambient;

+ 3 - 0
code/ObjFileImporter.cpp

@@ -556,6 +556,9 @@ void ObjFileImporter::createMaterials(const ObjFile::Model* pModel, aiScene* pSc
 		if ( 0 != pCurrentMaterial->textureBump.length )
 			mat->AddProperty( &pCurrentMaterial->textureBump, AI_MATKEY_TEXTURE_HEIGHT(0));
 
+		if ( 0 != pCurrentMaterial->textureDisp.length )
+			mat->AddProperty( &pCurrentMaterial->textureDisp, AI_MATKEY_TEXTURE_DISPLACEMENT(0) );
+
 		if ( 0 != pCurrentMaterial->textureOpacity.length )
 			mat->AddProperty( &pCurrentMaterial->textureOpacity, AI_MATKEY_TEXTURE_OPACITY(0));
 

+ 4 - 0
code/ObjFileMtlImporter.cpp

@@ -279,6 +279,10 @@ void ObjFileMtlImporter::getTexture()
 	else if (!ASSIMP_strincmp(&(*m_DataIt),"map_bump",8) || !ASSIMP_strincmp(&(*m_DataIt),"bump",4))
 		out = & m_pModel->m_pCurrentMaterial->textureBump;
 
+	// Displacement texture
+	else if (!ASSIMP_strincmp(&(*m_DataIt),"disp",4))
+		out = &m_pModel->m_pCurrentMaterial->textureDisp;
+
 	// Specularity scaling (glossiness)
 	else if (!ASSIMP_strincmp(&(*m_DataIt),"map_ns",6))
 		out = & m_pModel->m_pCurrentMaterial->textureSpecularity;