|
@@ -67,6 +67,10 @@ static const std::string ReflectionTexture = "refl";
|
|
static const std::string DisplacementTexture1 = "map_disp";
|
|
static const std::string DisplacementTexture1 = "map_disp";
|
|
static const std::string DisplacementTexture2 = "disp";
|
|
static const std::string DisplacementTexture2 = "disp";
|
|
static const std::string SpecularityTexture = "map_ns";
|
|
static const std::string SpecularityTexture = "map_ns";
|
|
|
|
+static const std::string RoughnessTexture = "map_Pr";
|
|
|
|
+static const std::string MetallicTexture = "map_Pm";
|
|
|
|
+static const std::string SheenTexture = "map_Ps";
|
|
|
|
+static const std::string RMATexture = "map_Ps";
|
|
|
|
|
|
// texture option specific token
|
|
// texture option specific token
|
|
static const std::string BlendUOption = "-blendu";
|
|
static const std::string BlendUOption = "-blendu";
|
|
@@ -178,10 +182,45 @@ void ObjFileMtlImporter::load() {
|
|
case 'e': // New material
|
|
case 'e': // New material
|
|
createMaterial();
|
|
createMaterial();
|
|
break;
|
|
break;
|
|
|
|
+ case 'o': // Norm texture
|
|
|
|
+ --m_DataIt;
|
|
|
|
+ getTexture();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
} break;
|
|
} break;
|
|
|
|
|
|
|
|
+ case 'P':
|
|
|
|
+ {
|
|
|
|
+ ++m_DataIt;
|
|
|
|
+ switch(*m_DataIt)
|
|
|
|
+ {
|
|
|
|
+ case 'r':
|
|
|
|
+ ++m_DataIt;
|
|
|
|
+ getFloatValue(m_pModel->m_pCurrentMaterial->roughness);
|
|
|
|
+ break;
|
|
|
|
+ case 'm':
|
|
|
|
+ ++m_DataIt;
|
|
|
|
+ getFloatValue(m_pModel->m_pCurrentMaterial->metallic);
|
|
|
|
+ break;
|
|
|
|
+ case 's':
|
|
|
|
+ ++m_DataIt;
|
|
|
|
+ getColorRGBA(&m_pModel->m_pCurrentMaterial->sheen);
|
|
|
|
+ break;
|
|
|
|
+ case 'c':
|
|
|
|
+ ++m_DataIt;
|
|
|
|
+ if (*m_DataIt == 'r') {
|
|
|
|
+ ++m_DataIt;
|
|
|
|
+ getFloatValue(m_pModel->m_pCurrentMaterial->clearcoat_roughness);
|
|
|
|
+ } else {
|
|
|
|
+ getFloatValue(m_pModel->m_pCurrentMaterial->clearcoat_thickness);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+
|
|
case 'm': // Texture
|
|
case 'm': // Texture
|
|
case 'b': // quick'n'dirty - for 'bump' sections
|
|
case 'b': // quick'n'dirty - for 'bump' sections
|
|
case 'r': // quick'n'dirty - for 'refl' sections
|
|
case 'r': // quick'n'dirty - for 'refl' sections
|
|
@@ -197,6 +236,12 @@ void ObjFileMtlImporter::load() {
|
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
} break;
|
|
} break;
|
|
|
|
|
|
|
|
+ case 'a': // Anisotropy
|
|
|
|
+ {
|
|
|
|
+ getFloatValue(m_pModel->m_pCurrentMaterial->anisotropy);
|
|
|
|
+ m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
|
|
+ } break;
|
|
|
|
+
|
|
default: {
|
|
default: {
|
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
m_DataIt = skipLine<DataArrayIt>(m_DataIt, m_DataItEnd, m_uiLine);
|
|
} break;
|
|
} break;
|
|
@@ -334,6 +379,22 @@ void ObjFileMtlImporter::getTexture() {
|
|
// Specularity scaling (glossiness)
|
|
// Specularity scaling (glossiness)
|
|
out = &m_pModel->m_pCurrentMaterial->textureSpecularity;
|
|
out = &m_pModel->m_pCurrentMaterial->textureSpecularity;
|
|
clampIndex = ObjFile::Material::TextureSpecularityType;
|
|
clampIndex = ObjFile::Material::TextureSpecularityType;
|
|
|
|
+ } else if ( !ASSIMP_strincmp( pPtr, RoughnessTexture.c_str(), static_cast<unsigned int>(RoughnessTexture.size()))) {
|
|
|
|
+ // PBR Roughness texture
|
|
|
|
+ out = & m_pModel->m_pCurrentMaterial->textureRoughness;
|
|
|
|
+ clampIndex = ObjFile::Material::TextureRoughnessType;
|
|
|
|
+ } else if ( !ASSIMP_strincmp( pPtr, MetallicTexture.c_str(), static_cast<unsigned int>(MetallicTexture.size()))) {
|
|
|
|
+ // PBR Metallic texture
|
|
|
|
+ out = & m_pModel->m_pCurrentMaterial->textureMetallic;
|
|
|
|
+ clampIndex = ObjFile::Material::TextureMetallicType;
|
|
|
|
+ } else if (!ASSIMP_strincmp( pPtr, SheenTexture.c_str(), static_cast<unsigned int>(SheenTexture.size()))) {
|
|
|
|
+ // PBR Sheen (reflectance) texture
|
|
|
|
+ out = & m_pModel->m_pCurrentMaterial->textureSheen;
|
|
|
|
+ clampIndex = ObjFile::Material::TextureSheenType;
|
|
|
|
+ } else if (!ASSIMP_strincmp( pPtr, RMATexture.c_str(), static_cast<unsigned int>(RMATexture.size()))) {
|
|
|
|
+ // PBR Rough/Metal/AO texture
|
|
|
|
+ out = & m_pModel->m_pCurrentMaterial->textureRMA;
|
|
|
|
+ clampIndex = ObjFile::Material::TextureRMAType;
|
|
} else {
|
|
} else {
|
|
ASSIMP_LOG_ERROR("OBJ/MTL: Encountered unknown texture type");
|
|
ASSIMP_LOG_ERROR("OBJ/MTL: Encountered unknown texture type");
|
|
return;
|
|
return;
|