From f8376c790d1f459bac83b3e6f61167b291fd33a0 Mon Sep 17 00:00:00 2001 From: Luca Della Vedova Date: Wed, 13 Dec 2023 09:55:44 +0800 Subject: [PATCH] Use scene name for texture name in assimp loader Signed-off-by: Luca Della Vedova --- graphics/src/AssimpLoader.cc | 2 +- graphics/src/AssimpLoader_TEST.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphics/src/AssimpLoader.cc b/graphics/src/AssimpLoader.cc index 2eda1248..9a72be07 100644 --- a/graphics/src/AssimpLoader.cc +++ b/graphics/src/AssimpLoader.cc @@ -584,7 +584,7 @@ ImagePtr AssimpLoader::Implementation::LoadEmbeddedTexture( std::string AssimpLoader::Implementation::GenerateTextureName( const aiScene* _scene, aiMaterial* _mat, const std::string& _type) const { - return ToString(_scene->mRootNode->mName) + "_" + ToString(_mat->GetName()) + + return ToString(_scene->mName) + "_" + ToString(_mat->GetName()) + "_" + _type; } diff --git a/graphics/src/AssimpLoader_TEST.cc b/graphics/src/AssimpLoader_TEST.cc index 5df30d0f..348b954e 100644 --- a/graphics/src/AssimpLoader_TEST.cc +++ b/graphics/src/AssimpLoader_TEST.cc @@ -673,7 +673,7 @@ TEST_F(AssimpLoader, LoadGlTF2BoxWithJPEGTexture) EXPECT_EQ(math::Color(0.4f, 0.4f, 0.4f, 1.0f), mat->Ambient()); EXPECT_EQ(math::Color(1.0f, 1.0f, 1.0f, 1.0f), mat->Diffuse()); EXPECT_EQ(math::Color(0.0f, 0.0f, 0.0f, 1.0f), mat->Specular()); - EXPECT_EQ("Cube_Material_Diffuse", mat->TextureImage()); + EXPECT_EQ("Scene_Material_Diffuse", mat->TextureImage()); EXPECT_NE(nullptr, mat->TextureData()); }