Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Meshconvert/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,18 @@ HRESULT Mesh::ExportToSDKMESH(const wchar_t* szFileName, size_t nMaterials, cons
*m2->EmissiveTexture = 0;
}
}

// Allow RMA texture material property to override drived name
if (!m0->rmaTexture.empty())
{
int result = WideCharToMultiByte(CP_UTF8, WC_NO_BEST_FIT_CHARS,
m0->rmaTexture.c_str(), -1,
m2->RMATexture, MAX_TEXTURE_NAME, nullptr, FALSE);
if (!result)
{
*m2->RMATexture = 0;
}
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions Meshconvert/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class Mesh
std::wstring normalTexture;
std::wstring specularTexture;
std::wstring emissiveTexture;
std::wstring rmaTexture;

Material() noexcept :
perVertexColor(false),
Expand Down
1 change: 1 addition & 0 deletions Meshconvert/MeshOBJ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ HRESULT LoadFromOBJ(
{
mtl.emissiveTexture = ProcessTextureFileName(it->strEmissiveTexture, dds);
}
mtl.rmaTexture = ProcessTextureFileName(it->strRMATexture, dds);

inMaterial.push_back(mtl);
}
Expand Down
10 changes: 9 additions & 1 deletion Utilities/WaveFrontReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ class WaveFrontReader
LoadTexturePath(InFile, curMaterial->strEmissiveTexture, MAX_PATH);
curMaterial->bEmissive = true;
}
else if (0 == wcscmp(strCommand.c_str(), L"map_RMA")
|| 0 == wcscmp(strCommand.c_str(), L"map_ORM"))
{
// RMA texture
LoadTexturePath(InFile, curMaterial->strRMATexture, MAX_PATH);
}
else
{
// Unimplemented or unrecognized command
Expand Down Expand Up @@ -614,6 +620,7 @@ class WaveFrontReader
wchar_t strNormalTexture[MAX_PATH];
wchar_t strSpecularTexture[MAX_PATH];
wchar_t strEmissiveTexture[MAX_PATH];
wchar_t strRMATexture[MAX_PATH];

Material() noexcept :
vAmbient(0.2f, 0.2f, 0.2f),
Expand All @@ -628,7 +635,8 @@ class WaveFrontReader
strTexture{},
strNormalTexture{},
strSpecularTexture{},
strEmissiveTexture{}
strEmissiveTexture{},
strRMATexture{}
{
}
};
Expand Down