diff --git a/code/AssetLib/AC/ACLoader.cpp b/code/AssetLib/AC/ACLoader.cpp index 275a592f4..e93fba5f0 100644 --- a/code/AssetLib/AC/ACLoader.cpp +++ b/code/AssetLib/AC/ACLoader.cpp @@ -227,7 +227,9 @@ void AC3DImporter::LoadObjectSection(std::vector &objects) { } } else if (TokenMatch(buffer, "texture", 7)) { SkipSpaces(&buffer); - buffer = AcGetString(buffer, obj.texture); + std::string texture; + buffer = AcGetString(buffer, texture); + obj.textures.push_back(texture); } else if (TokenMatch(buffer, "texrep", 6)) { SkipSpaces(&buffer); buffer = TAcCheckedLoadFloatArray(buffer, "", 0, 2, &obj.texRepeat); @@ -351,8 +353,8 @@ void AC3DImporter::ConvertMaterial(const Object &object, s.Set(matSrc.name); matDest.AddProperty(&s, AI_MATKEY_NAME); } - if (object.texture.length()) { - s.Set(object.texture); + if (!object.textures.empty()) { + s.Set(object.textures[0]); matDest.AddProperty(&s, AI_MATKEY_TEXTURE_DIFFUSE(0)); // UV transformation @@ -532,7 +534,7 @@ aiNode *AC3DImporter::ConvertObjectSection(Object &object, // allocate UV coordinates, but only if the texture name for the // surface is not empty aiVector3D *uv = nullptr; - if (object.texture.length()) { + if (!object.textures.empty()) { uv = mesh->mTextureCoords[0] = new aiVector3D[mesh->mNumVertices]; mesh->mNumUVComponents[0] = 2; } diff --git a/code/AssetLib/AC/ACLoader.h b/code/AssetLib/AC/ACLoader.h index aabc114e3..7f8dfd03c 100644 --- a/code/AssetLib/AC/ACLoader.h +++ b/code/AssetLib/AC/ACLoader.h @@ -125,7 +125,6 @@ public: type(World), name(), children(), - texture(), texRepeat(1.f, 1.f), texOffset(0.0f, 0.0f), rotation(), @@ -151,7 +150,8 @@ public: std::vector children; // texture to be assigned to all surfaces of the object - std::string texture; + // the .acc format supports up to 4 textures + std::vector textures; // texture repat factors (scaling for all coordinates) aiVector2D texRepeat, texOffset;