Skip to content
Open
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
10 changes: 5 additions & 5 deletions src/SdfEntityCreator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -940,10 +940,10 @@ Entity SdfEntityCreator::CreateEntities(const sdf::Visual *_visual)
components::Geometry(*_visual->Geom()));
}

// \todo(louise) Populate with default material if undefined
sdf::Material visualMaterial;
if (_visual->Material())
{
sdf::Material visualMaterial = *_visual->Material();
visualMaterial = *_visual->Material();
if (!_visual->Material()->ScriptUri().empty())
{
gzwarn << "Gazebo does not support Ogre material scripts. See " <<
Expand All @@ -967,7 +967,7 @@ Entity SdfEntityCreator::CreateEntities(const sdf::Visual *_visual)
std::optional<MaterialParser::MaterialValues> parsed =
this->dataPtr->materialParser.GetMaterialValues(scriptName);

if(parsed.has_value())
if (parsed.has_value())
{
visualMaterial.SetAmbient
(parsed->ambient.value_or(visualMaterial.Ambient()));
Expand All @@ -983,9 +983,9 @@ Entity SdfEntityCreator::CreateEntities(const sdf::Visual *_visual)
}
}
}
this->dataPtr->ecm->CreateComponent(visualEntity,
components::Material(visualMaterial));
}
this->dataPtr->ecm->CreateComponent(visualEntity,
components::Material(visualMaterial));

// store the plugin in a component
if (!_visual->Plugins().empty())
Expand Down
9 changes: 5 additions & 4 deletions test/integration/mesh_uri.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class MeshUriTest : public InternalFixture<::testing::Test>
/////////////////////////////////////////////////
// Test spawning mesh by name and verify that the mesh is correctly
// spawned in both rendering and physics. Cameras should see the spawned
// mesh and spawend object should collide with one another on the physics
// mesh and spawned object should collide with one another on the physics
// side.
TEST_F(MeshUriTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(SpawnMeshByName))
{
Expand Down Expand Up @@ -195,9 +195,10 @@ TEST_F(MeshUriTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(SpawnMeshByName))
r = imageBuffer[midIdx];
g = imageBuffer[midIdx + 1];
b = imageBuffer[midIdx + 2];
EXPECT_EQ(255u, r);
EXPECT_EQ(255u, g);
EXPECT_EQ(255u, b);
// Default material is black
EXPECT_EQ(0u, r);
EXPECT_EQ(0u, g);
EXPECT_EQ(0u, b);

// Spawn another box over the static one
const std::string spawnedModel2Name = "spawned_model2";
Expand Down
Loading