Skip to content

Commit

Permalink
fix for "missing texture" when both colourindex and texture are given…
Browse files Browse the repository at this point in the history
… for a facet
  • Loading branch information
josaine committed Sep 10, 2020
1 parent e8a5b62 commit 4f04ccf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,10 @@ void ToJson(std::ostream& os, const rwe::_3do::Primitive& prim, const CompositeT
const std::string colorIndexTextureName = GetColorIndexName(*prim.colorIndex);
os << JsonKey("colorIndex") << *prim.colorIndex << ',';
os << JsonKey("colorIndexTextureName") << '"' << colorIndexTextureName << '"' << ',';
textures.getTextureUV(colorIndexTextureName, uvMin, uvMax);
if (!prim.textureName)
{
textures.getTextureUV(colorIndexTextureName, uvMin, uvMax);
}
}
if (prim.textureName)
{
Expand Down Expand Up @@ -494,7 +497,7 @@ std::shared_ptr<CompositeTexture> MakeTextures(const rwe::_3do::Object& obj, con

for (const std::string tadata : taDataDirs)
{
const std::string directory = tadata + "\\textures";
std::filesystem::path directory = std::filesystem::path(tadata) / "textures";
for (const auto& dirEntry : std::filesystem::recursive_directory_iterator(directory))
{
if (!dirEntry.is_regular_file())
Expand All @@ -510,7 +513,6 @@ std::shared_ptr<CompositeTexture> MakeTextures(const rwe::_3do::Object& obj, con
{
if (allTextures.count(entry.name)>0 && gafByTextureName.count(entry.name)==0u)
{
//std::cerr << "found texture:" << dirEntry << '/' << entry.name << std::endl;
gafByTextureName[entry.name] = gaf;
}
}
Expand All @@ -527,7 +529,6 @@ std::shared_ptr<CompositeTexture> MakeTextures(const rwe::_3do::Object& obj, con
std::filesystem::path candidate = std::filesystem::path(tadata) / "palettes" / "PALETTE.PAL";
if (std::filesystem::exists(candidate))
{
//std::cerr << "Found palette file: " << candidate.string() << std::endl;
palettesFile = candidate;
break;
}
Expand Down

0 comments on commit 4f04ccf

Please sign in to comment.