diff --git a/graphics/src/ColladaLoader.cc b/graphics/src/ColladaLoader.cc index 92ba0d3bb..9bfe3206c 100644 --- a/graphics/src/ColladaLoader.cc +++ b/graphics/src/ColladaLoader.cc @@ -59,9 +59,6 @@ namespace ignition /// \brief material dictionary indexed by name public: std::map materialMap; - /// \brief material dictionary indexed by mesh name - public: std::map materialEffectMap; - /// \brief root xml element of COLLADA data public: tinyxml2::XMLElement *colladaXml; @@ -531,7 +528,6 @@ void ColladaLoaderPrivate::LoadNode(tinyxml2::XMLElement *_elem, Mesh *_mesh, tinyxml2::XMLElement *geomXml = this->ElementId("geometry", geomURL); this->materialMap.clear(); - this->materialEffectMap.clear(); tinyxml2::XMLElement *bindMatXml, *techniqueXml, *matXml; bindMatXml = instGeomXml->FirstChildElement("bind_material"); while (bindMatXml) @@ -544,7 +540,6 @@ void ColladaLoaderPrivate::LoadNode(tinyxml2::XMLElement *_elem, Mesh *_mesh, std::string symbol = matXml->Attribute("symbol"); std::string target = matXml->Attribute("target"); this->materialMap[symbol] = target; - this->materialEffectMap[geomURL] = target; matXml = matXml->NextSiblingElement("instance_material"); } } @@ -554,41 +549,6 @@ void ColladaLoaderPrivate::LoadNode(tinyxml2::XMLElement *_elem, Mesh *_mesh, if (_mesh->HasSkeleton()) _mesh->MeshSkeleton()->SetNumVertAttached(0); this->LoadGeometry(geomXml, transform, _mesh); - - // Associate materials defined in library_materials with the right mesh - if (materialEffectMap.size() > 0) - { - std::string matStr; - int matIndex = -1; - std::map::iterator iter; - - iter = this->materialEffectMap.find(geomURL); - if (iter != this->materialEffectMap.end()) - matStr = iter->second; - MaterialPtr mat = this->LoadMaterial(matStr); - matIndex = _mesh->IndexOfMaterial(mat.get()); - if (matIndex < 0) - { - matIndex = _mesh->AddMaterial(mat); - } - if (matIndex < 0) - { - ignwarn << "Unable to add material[" << matStr << "]\n"; - } - else - { - auto subMesh = _mesh->SubMeshByName(this->currentNodeName); - if (subMesh.lock() == nullptr) - { - ignwarn << "Unable to get submesh[" << geomURL << "]\n"; - } - else - { - subMesh.lock().get()->SetMaterialIndex(matIndex); - } - } - } - instGeomXml = instGeomXml->NextSiblingElement("instance_geometry"); } diff --git a/graphics/src/ColladaLoader_TEST.cc b/graphics/src/ColladaLoader_TEST.cc index 9d3b46791..66346cd7e 100644 --- a/graphics/src/ColladaLoader_TEST.cc +++ b/graphics/src/ColladaLoader_TEST.cc @@ -51,33 +51,6 @@ TEST_F(ColladaLoader, LoadBox) EXPECT_STREQ("Cube", mesh->SubMeshByIndex(0).lock()->Name().c_str()); } -///////////////////////////////////////////////// -TEST_F(ColladaLoader, LoadRectangle) -{ - common::ColladaLoader loader; - common::Mesh *mesh = loader.Load(common::joinPaths( - std::string(PROJECT_SOURCE_PATH), "test", "data", "rectangle.dae")); - - EXPECT_STREQ("unknown", mesh->Name().c_str()); - EXPECT_EQ(ignition::math::Vector3d(0.35, 0.4, 1), mesh->Max()); - EXPECT_EQ(ignition::math::Vector3d(-0.35, -0.4, -1), mesh->Min()); - EXPECT_EQ(35u, mesh->VertexCount()); - EXPECT_EQ(35u, mesh->NormalCount()); - EXPECT_EQ(36u, mesh->IndexCount()); - EXPECT_EQ(0u, mesh->TexCoordCount()); - EXPECT_EQ(1u, mesh->SubMeshCount()); - EXPECT_EQ(1u, mesh->MaterialCount()); - - common::MaterialPtr material = mesh->MaterialByIndex(0); - EXPECT_NE(nullptr, material); - EXPECT_EQ(math::Color(0.008957128f, 0.00619848f, 0.64f, 1.0f), - material->Diffuse()); - EXPECT_EQ(math::Color(0.5, 0.5, 0.5, 1), material->Specular()); - EXPECT_EQ(math::Color(0, 0, 0, 1), material->Ambient()); - EXPECT_EQ(math::Color(0, 0, 0, 1), material->Emissive()); - EXPECT_DOUBLE_EQ(50.0, material->Shininess()); -} - ///////////////////////////////////////////////// TEST_F(ColladaLoader, ShareVertices) { diff --git a/test/data/rectangle.dae b/test/data/rectangle.dae deleted file mode 100644 index 8cbefcf0d..000000000 --- a/test/data/rectangle.dae +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Z_UP - - - - - - - - - 0 0 0 1 - - - 0 0 0 1 - - - 0.008957128 0.00619848 0.64 1 - - - 0.5 0.5 0.5 1 - - - 50 - - - 1 - - - - - - - - - - - - - - - - -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 - - - - - - - - - - -1 0 0 0 1 0 1 0 0 0 -1 0 0 0 -1 0 0 1 - - - - - - - - - - - - - - -

1 0 2 0 0 0 3 1 6 1 2 1 7 2 4 2 6 2 5 3 0 3 4 3 6 4 0 4 2 4 3 5 5 5 7 5 1 0 3 0 2 0 3 1 7 1 6 1 7 2 5 2 4 2 5 3 1 3 0 3 6 4 4 4 0 4 3 5 1 5 5 5

-
-
-
-
- - - - 0.35 0 0 0 0 0.4 0 0 0 0 1 0 0 0 0 1 - - - - - - - - - - - - - -