Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added renderOrder to convert functions #514

Merged
merged 5 commits into from
Jan 26, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions src/Conversions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ msgs::Material ignition::gazebo::convert(const sdf::Material &_in)
msgs::Set(out.mutable_diffuse(), _in.Diffuse());
msgs::Set(out.mutable_specular(), _in.Specular());
msgs::Set(out.mutable_emissive(), _in.Emissive());
out.set_render_order(_in.RenderOrder());
chapulina marked this conversation as resolved.
Show resolved Hide resolved
out.set_lighting(_in.Lighting());

// todo(anyone) add double_sided field to msgs::Material
Expand Down Expand Up @@ -321,6 +322,7 @@ sdf::Material ignition::gazebo::convert(const msgs::Material &_in)
out.SetDiffuse(msgs::Convert(_in.diffuse()));
out.SetSpecular(msgs::Convert(_in.specular()));
out.SetEmissive(msgs::Convert(_in.emissive()));
out.SetRenderOrder(_in.render_order());
out.SetLighting(_in.lighting());

// todo(anyone) add double_sided field to msgs::Material
Expand Down
3 changes: 3 additions & 0 deletions src/Conversions_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ TEST(Conversions, Material)
material.SetAmbient(ignition::math::Color(0.9f, 1.0f, 1.1f, 1.2f));
material.SetEmissive(ignition::math::Color(1.3f, 1.4f, 1.5f, 1.6f));
material.SetLighting(true);
material.SetRenderOrder(2.5);

// todo(anyone) add double_sided field to msgs::Material
material.SetDoubleSided(true);
Expand Down Expand Up @@ -237,6 +238,7 @@ TEST(Conversions, Material)
EXPECT_EQ(math::Color(1.3f, 1.4f, 1.5f, 1.6f),
msgs::Convert(materialMsg.emissive()));
EXPECT_TRUE(materialMsg.lighting());
EXPECT_DOUBLE_EQ(2.5, pbrMsg.render_order());
ahcorde marked this conversation as resolved.
Show resolved Hide resolved

// todo(anyone) double_sided is temporarily stored in header
// Need to add double_sided field to msgs::Material
Expand Down Expand Up @@ -266,6 +268,7 @@ TEST(Conversions, Material)
EXPECT_EQ(math::Color(1.3f, 1.4f, 1.5f, 1.6f), newMaterial.Emissive());
EXPECT_TRUE(newMaterial.Lighting());
EXPECT_TRUE(newMaterial.DoubleSided());
EXPECT_DOUBLE_EQ(2.5, newMaterial.RenderOrder());

sdf::Pbr *newPbrMaterial = newMaterial.PbrMaterial();
ASSERT_NE(nullptr, newPbrMaterial);
Expand Down
1 change: 1 addition & 0 deletions src/rendering/SceneManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ rendering::MaterialPtr SceneManager::LoadMaterial(
material->SetDiffuse(_material.Diffuse());
material->SetSpecular(_material.Specular());
material->SetEmissive(_material.Emissive());
material->SetRenderOrder(_material.RenderOrder());

// parse PBR params
const sdf::Pbr *pbr = _material.PbrMaterial();
Expand Down