From cff72fd00d06fba21c55e972601ecfd23c8500d3 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 1 Jun 2022 04:18:08 -0400 Subject: [PATCH 01/11] add skybox uri field Signed-off-by: Mabel Zhang --- include/sdf/Sky.hh | 8 ++++++++ src/Sky.cc | 25 +++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index f9679f0e3..6a4aad5bb 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -99,6 +99,14 @@ namespace sdf /// \param[in] _ambient cloud ambient color public: void SetCloudAmbient(const ignition::math::Color &_ambient); + /// \brief Get the skybox texture URI. + /// \return The URI of the skybox texture. + public: std::string Uri() const; + + /// \brief Set the skybox texture URI. + /// \param[in] _uri The URI of the skybox texture. + public: void SetUri(const std::string &_uri); + /// \brief Load the sky based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/src/Sky.cc b/src/Sky.cc index 21651b07f..839521734 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -48,6 +48,9 @@ class sdf::Sky::Implementation public: ignition::math::Color cloudAmbient = ignition::math::Color(0.8f, 0.8f, 0.8f); + /// \brief Skybox texture URI + public: std::string uri = ""; + /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; }; @@ -154,6 +157,18 @@ void Sky::SetCloudAmbient(const ignition::math::Color &_ambient) this->dataPtr->cloudAmbient = _ambient; } +////////////////////////////////////////////////// +std::string Sky::Uri() const +{ + return this->dataPtr->uri; +} + +////////////////////////////////////////////////// +void Sky::SetUri(const std::string &_uri) +{ + this->dataPtr->uri = _uri; +} + ///////////////////////////////////////////////// Errors Sky::Load(ElementPtr _sdf) { @@ -171,6 +186,13 @@ Errors Sky::Load(ElementPtr _sdf) return errors; } + // Optional uri element. If not provided, assume there is some default in + // downstream implementation. + if (_sdf->HasElement("uri")) + { + this->dataPtr->uri = _sdf->Get("uri", "").first; + } + this->dataPtr->time = _sdf->Get("time", this->dataPtr->time).first; this->dataPtr->sunrise = _sdf->Get("sunrise", this->dataPtr->sunrise).first; @@ -210,6 +232,9 @@ sdf::ElementPtr Sky::ToElement() const sdf::initFile("scene.sdf", sceneElem); sdf::ElementPtr elem = sceneElem->GetElement("sky"); + sdf::ElementPtr uriElem = elem->GetElement("uri"); + uriElem->Set(this->Uri()); + elem->GetElement("time")->Set(this->Time()); elem->GetElement("sunrise")->Set(this->Sunrise()); elem->GetElement("sunset")->Set(this->Sunset()); From 31eab7aedb8823db75a243968440d43e81445a7e Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Fri, 3 Jun 2022 03:22:18 -0400 Subject: [PATCH 02/11] add tests Signed-off-by: Mabel Zhang --- src/Sky.cc | 20 ++++++++++---------- src/Sky_TEST.cc | 14 ++++++++++++++ test/integration/scene_dom.cc | 1 + test/sdf/scene_with_sky.sdf | 1 + 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/Sky.cc b/src/Sky.cc index 839521734..9952f05ca 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -186,13 +186,6 @@ Errors Sky::Load(ElementPtr _sdf) return errors; } - // Optional uri element. If not provided, assume there is some default in - // downstream implementation. - if (_sdf->HasElement("uri")) - { - this->dataPtr->uri = _sdf->Get("uri", "").first; - } - this->dataPtr->time = _sdf->Get("time", this->dataPtr->time).first; this->dataPtr->sunrise = _sdf->Get("sunrise", this->dataPtr->sunrise).first; @@ -216,6 +209,13 @@ Errors Sky::Load(ElementPtr _sdf) this->dataPtr->cloudAmbient).first; } + // Optional uri element. If not provided, assume there is some default in + // downstream implementation. + if (_sdf->HasElement("uri")) + { + this->dataPtr->uri = _sdf->Get("uri", "__default__").first; + } + return errors; } @@ -232,9 +232,6 @@ sdf::ElementPtr Sky::ToElement() const sdf::initFile("scene.sdf", sceneElem); sdf::ElementPtr elem = sceneElem->GetElement("sky"); - sdf::ElementPtr uriElem = elem->GetElement("uri"); - uriElem->Set(this->Uri()); - elem->GetElement("time")->Set(this->Time()); elem->GetElement("sunrise")->Set(this->Sunrise()); elem->GetElement("sunset")->Set(this->Sunset()); @@ -246,5 +243,8 @@ sdf::ElementPtr Sky::ToElement() const cloudElem->GetElement("mean_size")->Set(this->CloudMeanSize()); cloudElem->GetElement("ambient")->Set(this->CloudAmbient()); + sdf::ElementPtr uriElem = elem->GetElement("uri"); + uriElem->Set(this->Uri()); + return elem; } diff --git a/src/Sky_TEST.cc b/src/Sky_TEST.cc index e629493e5..f1d2393ac 100644 --- a/src/Sky_TEST.cc +++ b/src/Sky_TEST.cc @@ -31,6 +31,7 @@ TEST(DOMSky, Construction) EXPECT_DOUBLE_EQ(0.5, sky.CloudMeanSize()); EXPECT_EQ(ignition::math::Color(0.8f, 0.8f, 0.8f), sky.CloudAmbient()); + EXPECT_EQ("", sky.Uri()); } ///////////////////////////////////////////////// @@ -48,6 +49,7 @@ TEST(DOMSky, CopyConstruction) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); + sky.SetUri("dummyUri"); sdf::Sky sky2(sky); EXPECT_DOUBLE_EQ(1.0, sky2.Time()); @@ -58,6 +60,7 @@ TEST(DOMSky, CopyConstruction) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); + EXPECT_EQ("dummyUri", sky2.Uri()); EXPECT_NE(nullptr, sky2.Element()); EXPECT_EQ(sky.Element(), sky2.Element()); @@ -75,6 +78,7 @@ TEST(DOMSky, MoveConstruction) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); + sky.SetUri("dummyUri"); sdf::Sky sky2(std::move(sky)); EXPECT_DOUBLE_EQ(1.0, sky2.Time()); @@ -85,6 +89,7 @@ TEST(DOMSky, MoveConstruction) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); + EXPECT_EQ("dummyUri", sky2.Uri()); } ///////////////////////////////////////////////// @@ -99,6 +104,7 @@ TEST(DOMSky, MoveAssignmentOperator) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); + sky.SetUri("dummyUri"); sdf::Sky sky2; sky2 = std::move(sky); @@ -110,6 +116,7 @@ TEST(DOMSky, MoveAssignmentOperator) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); + EXPECT_EQ("dummyUri", sky2.Uri()); } ///////////////////////////////////////////////// @@ -124,6 +131,7 @@ TEST(DOMSky, AssignmentOperator) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); + sky.SetUri("dummyUri"); sdf::Sky sky2; sky2 = sky; @@ -135,6 +143,7 @@ TEST(DOMSky, AssignmentOperator) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); + EXPECT_EQ("dummyUri", sky2.Uri()); } ///////////////////////////////////////////////// @@ -185,6 +194,9 @@ TEST(DOMSky, Set) sky.SetCloudAmbient(ignition::math::Color(0.1f, 0.2f, 0.3f)); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f), sky.CloudAmbient()); + + sky.SetUri("dummyUri"); + EXPECT_EQ("dummyUri", sky.Uri()); } ///////////////////////////////////////////////// @@ -200,6 +212,7 @@ TEST(DOMSky, ToElement) sky.SetCloudHumidity(0.2); sky.SetCloudMeanSize(0.5); sky.SetCloudAmbient(ignition::math::Color(0.1f, 0.2f, 0.3f, 1.0f)); + sky.SetUri("dummyUri"); sdf::ElementPtr elem = sky.ToElement(); ASSERT_NE(nullptr, elem); @@ -215,4 +228,5 @@ TEST(DOMSky, ToElement) EXPECT_DOUBLE_EQ(sky.CloudHumidity(), sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(sky.CloudMeanSize(), sky2.CloudMeanSize()); EXPECT_EQ(sky.CloudAmbient(), sky2.CloudAmbient()); + EXPECT_EQ(sky.Uri(), sky2.Uri()); } diff --git a/test/integration/scene_dom.cc b/test/integration/scene_dom.cc index edcee1acb..b0831ff2f 100644 --- a/test/integration/scene_dom.cc +++ b/test/integration/scene_dom.cc @@ -69,4 +69,5 @@ TEST(DOMScene, LoadScene) EXPECT_DOUBLE_EQ(0.2, sky->CloudMeanSize()); EXPECT_DOUBLE_EQ(0.9, sky->CloudHumidity()); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f), sky->CloudAmbient()); + EXPECT_EQ("dummyUri", sky->Uri()); } diff --git a/test/sdf/scene_with_sky.sdf b/test/sdf/scene_with_sky.sdf index 1f794c443..df9de7fa5 100644 --- a/test/sdf/scene_with_sky.sdf +++ b/test/sdf/scene_with_sky.sdf @@ -19,6 +19,7 @@ 0.9 0.1 0.2 0.3 + dummyUri From 06f2366e7259217fdf666aff04d29af04ae9b5d7 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Fri, 3 Jun 2022 03:32:52 -0400 Subject: [PATCH 03/11] include for CI Signed-off-by: Mabel Zhang --- include/sdf/Sky.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index 6a4aad5bb..038a9f902 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -18,6 +18,8 @@ #ifndef SDF_SKY_HH_ #define SDF_SKY_HH_ +#include + #include #include From b40fe3b0afeafa4ed14eee061e253ff7d3df0843 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Fri, 3 Jun 2022 03:47:09 -0400 Subject: [PATCH 04/11] fix ToElement Signed-off-by: Mabel Zhang --- src/Sky.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sky.cc b/src/Sky.cc index 9952f05ca..363490249 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -244,7 +244,7 @@ sdf::ElementPtr Sky::ToElement() const cloudElem->GetElement("ambient")->Set(this->CloudAmbient()); sdf::ElementPtr uriElem = elem->GetElement("uri"); - uriElem->Set(this->Uri()); + uriElem->GetElement("uri")->Set(this->Uri()); return elem; } From 7c47aee6d14d5f7d018dc8a441857eae83d84d26 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Fri, 3 Jun 2022 04:05:54 -0400 Subject: [PATCH 05/11] fix ToElement, add default value Signed-off-by: Mabel Zhang --- src/Sky.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Sky.cc b/src/Sky.cc index 363490249..095749760 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -49,7 +49,7 @@ class sdf::Sky::Implementation ignition::math::Color(0.8f, 0.8f, 0.8f); /// \brief Skybox texture URI - public: std::string uri = ""; + public: std::string uri = "__default__"; /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; @@ -213,7 +213,8 @@ Errors Sky::Load(ElementPtr _sdf) // downstream implementation. if (_sdf->HasElement("uri")) { - this->dataPtr->uri = _sdf->Get("uri", "__default__").first; + this->dataPtr->uri = _sdf->Get("uri", + this->dataPtr->uri).first; } return errors; @@ -235,6 +236,7 @@ sdf::ElementPtr Sky::ToElement() const elem->GetElement("time")->Set(this->Time()); elem->GetElement("sunrise")->Set(this->Sunrise()); elem->GetElement("sunset")->Set(this->Sunset()); + elem->GetElement("uri")->Set(this->Uri()); sdf::ElementPtr cloudElem = elem->GetElement("clouds"); cloudElem->GetElement("speed")->Set(this->CloudSpeed()); @@ -243,8 +245,5 @@ sdf::ElementPtr Sky::ToElement() const cloudElem->GetElement("mean_size")->Set(this->CloudMeanSize()); cloudElem->GetElement("ambient")->Set(this->CloudAmbient()); - sdf::ElementPtr uriElem = elem->GetElement("uri"); - uriElem->GetElement("uri")->Set(this->Uri()); - return elem; } From 68f1041ce7da225bf019adb59c3339f266541241 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 7 Jun 2022 04:16:10 -0400 Subject: [PATCH 06/11] change field name to cubemap_uri Signed-off-by: Mabel Zhang --- include/sdf/Sky.hh | 4 ++-- sdf/1.9/scene.sdf | 4 ++++ src/Sky.cc | 22 ++++++++-------------- src/Sky_TEST.cc | 26 +++++++++++++------------- test/integration/scene_dom.cc | 2 +- test/sdf/scene_with_sky.sdf | 2 +- 6 files changed, 29 insertions(+), 31 deletions(-) diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index 038a9f902..ab1f21922 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -103,11 +103,11 @@ namespace sdf /// \brief Get the skybox texture URI. /// \return The URI of the skybox texture. - public: std::string Uri() const; + public: std::string CubemapUri() const; /// \brief Set the skybox texture URI. /// \param[in] _uri The URI of the skybox texture. - public: void SetUri(const std::string &_uri); + public: void SetCubemapUri(const std::string &_uri); /// \brief Load the sky based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root diff --git a/sdf/1.9/scene.sdf b/sdf/1.9/scene.sdf index 01b26a7a2..13da7702b 100644 --- a/sdf/1.9/scene.sdf +++ b/sdf/1.9/scene.sdf @@ -46,6 +46,10 @@ Ambient cloud color + + + Skybox texture uri + diff --git a/src/Sky.cc b/src/Sky.cc index 095749760..901316ad5 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -49,7 +49,7 @@ class sdf::Sky::Implementation ignition::math::Color(0.8f, 0.8f, 0.8f); /// \brief Skybox texture URI - public: std::string uri = "__default__"; + public: std::string cubemapUri = ""; /// \brief The SDF element pointer used during load. public: sdf::ElementPtr sdf; @@ -158,15 +158,15 @@ void Sky::SetCloudAmbient(const ignition::math::Color &_ambient) } ////////////////////////////////////////////////// -std::string Sky::Uri() const +std::string Sky::CubemapUri() const { - return this->dataPtr->uri; + return this->dataPtr->cubemapUri; } ////////////////////////////////////////////////// -void Sky::SetUri(const std::string &_uri) +void Sky::SetCubemapUri(const std::string &_uri) { - this->dataPtr->uri = _uri; + this->dataPtr->cubemapUri = _uri; } ///////////////////////////////////////////////// @@ -191,6 +191,8 @@ Errors Sky::Load(ElementPtr _sdf) _sdf->Get("sunrise", this->dataPtr->sunrise).first; this->dataPtr->sunset = _sdf->Get("sunset", this->dataPtr->sunset).first; + this->dataPtr->cubemapUri = + _sdf->Get("cubemap_uri", this->dataPtr->cubemapUri).first; if ( _sdf->HasElement("clouds")) { @@ -209,14 +211,6 @@ Errors Sky::Load(ElementPtr _sdf) this->dataPtr->cloudAmbient).first; } - // Optional uri element. If not provided, assume there is some default in - // downstream implementation. - if (_sdf->HasElement("uri")) - { - this->dataPtr->uri = _sdf->Get("uri", - this->dataPtr->uri).first; - } - return errors; } @@ -236,7 +230,7 @@ sdf::ElementPtr Sky::ToElement() const elem->GetElement("time")->Set(this->Time()); elem->GetElement("sunrise")->Set(this->Sunrise()); elem->GetElement("sunset")->Set(this->Sunset()); - elem->GetElement("uri")->Set(this->Uri()); + elem->GetElement("cubemap_uri")->Set(this->CubemapUri()); sdf::ElementPtr cloudElem = elem->GetElement("clouds"); cloudElem->GetElement("speed")->Set(this->CloudSpeed()); diff --git a/src/Sky_TEST.cc b/src/Sky_TEST.cc index f1d2393ac..81d6a1632 100644 --- a/src/Sky_TEST.cc +++ b/src/Sky_TEST.cc @@ -31,7 +31,7 @@ TEST(DOMSky, Construction) EXPECT_DOUBLE_EQ(0.5, sky.CloudMeanSize()); EXPECT_EQ(ignition::math::Color(0.8f, 0.8f, 0.8f), sky.CloudAmbient()); - EXPECT_EQ("", sky.Uri()); + EXPECT_EQ("", sky.CubemapUri()); } ///////////////////////////////////////////////// @@ -49,7 +49,7 @@ TEST(DOMSky, CopyConstruction) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); - sky.SetUri("dummyUri"); + sky.SetCubemapUri("dummyUri"); sdf::Sky sky2(sky); EXPECT_DOUBLE_EQ(1.0, sky2.Time()); @@ -60,7 +60,7 @@ TEST(DOMSky, CopyConstruction) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); - EXPECT_EQ("dummyUri", sky2.Uri()); + EXPECT_EQ("dummyUri", sky2.CubemapUri()); EXPECT_NE(nullptr, sky2.Element()); EXPECT_EQ(sky.Element(), sky2.Element()); @@ -78,7 +78,7 @@ TEST(DOMSky, MoveConstruction) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); - sky.SetUri("dummyUri"); + sky.SetCubemapUri("dummyUri"); sdf::Sky sky2(std::move(sky)); EXPECT_DOUBLE_EQ(1.0, sky2.Time()); @@ -89,7 +89,7 @@ TEST(DOMSky, MoveConstruction) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); - EXPECT_EQ("dummyUri", sky2.Uri()); + EXPECT_EQ("dummyUri", sky2.CubemapUri()); } ///////////////////////////////////////////////// @@ -104,7 +104,7 @@ TEST(DOMSky, MoveAssignmentOperator) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); - sky.SetUri("dummyUri"); + sky.SetCubemapUri("dummyUri"); sdf::Sky sky2; sky2 = std::move(sky); @@ -116,7 +116,7 @@ TEST(DOMSky, MoveAssignmentOperator) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); - EXPECT_EQ("dummyUri", sky2.Uri()); + EXPECT_EQ("dummyUri", sky2.CubemapUri()); } ///////////////////////////////////////////////// @@ -131,7 +131,7 @@ TEST(DOMSky, AssignmentOperator) sky.SetCloudHumidity(0.9); sky.SetCloudMeanSize(0.123); sky.SetCloudAmbient(ignition::math::Color::Blue); - sky.SetUri("dummyUri"); + sky.SetCubemapUri("dummyUri"); sdf::Sky sky2; sky2 = sky; @@ -143,7 +143,7 @@ TEST(DOMSky, AssignmentOperator) EXPECT_DOUBLE_EQ(0.9, sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(0.123, sky2.CloudMeanSize()); EXPECT_EQ(ignition::math::Color::Blue, sky2.CloudAmbient()); - EXPECT_EQ("dummyUri", sky2.Uri()); + EXPECT_EQ("dummyUri", sky2.CubemapUri()); } ///////////////////////////////////////////////// @@ -195,8 +195,8 @@ TEST(DOMSky, Set) EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f), sky.CloudAmbient()); - sky.SetUri("dummyUri"); - EXPECT_EQ("dummyUri", sky.Uri()); + sky.SetCubemapUri("dummyUri"); + EXPECT_EQ("dummyUri", sky.CubemapUri()); } ///////////////////////////////////////////////// @@ -212,7 +212,7 @@ TEST(DOMSky, ToElement) sky.SetCloudHumidity(0.2); sky.SetCloudMeanSize(0.5); sky.SetCloudAmbient(ignition::math::Color(0.1f, 0.2f, 0.3f, 1.0f)); - sky.SetUri("dummyUri"); + sky.SetCubemapUri("dummyUri"); sdf::ElementPtr elem = sky.ToElement(); ASSERT_NE(nullptr, elem); @@ -228,5 +228,5 @@ TEST(DOMSky, ToElement) EXPECT_DOUBLE_EQ(sky.CloudHumidity(), sky2.CloudHumidity()); EXPECT_DOUBLE_EQ(sky.CloudMeanSize(), sky2.CloudMeanSize()); EXPECT_EQ(sky.CloudAmbient(), sky2.CloudAmbient()); - EXPECT_EQ(sky.Uri(), sky2.Uri()); + EXPECT_EQ(sky.CubemapUri(), sky2.CubemapUri()); } diff --git a/test/integration/scene_dom.cc b/test/integration/scene_dom.cc index b0831ff2f..fd4579a5d 100644 --- a/test/integration/scene_dom.cc +++ b/test/integration/scene_dom.cc @@ -69,5 +69,5 @@ TEST(DOMScene, LoadScene) EXPECT_DOUBLE_EQ(0.2, sky->CloudMeanSize()); EXPECT_DOUBLE_EQ(0.9, sky->CloudHumidity()); EXPECT_EQ(ignition::math::Color(0.1f, 0.2f, 0.3f), sky->CloudAmbient()); - EXPECT_EQ("dummyUri", sky->Uri()); + EXPECT_EQ("dummyUri", sky->CubemapUri()); } diff --git a/test/sdf/scene_with_sky.sdf b/test/sdf/scene_with_sky.sdf index df9de7fa5..c3063fe73 100644 --- a/test/sdf/scene_with_sky.sdf +++ b/test/sdf/scene_with_sky.sdf @@ -19,7 +19,7 @@ 0.9 0.1 0.2 0.3 - dummyUri + dummyUri From 638de12f4fb13d9b896f93470fbdfc36f7f292db Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Mon, 20 Jun 2022 14:47:19 -0400 Subject: [PATCH 07/11] skybox description Signed-off-by: Mabel Zhang Co-authored-by: Nate Koenig --- sdf/1.9/scene.sdf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdf/1.9/scene.sdf b/sdf/1.9/scene.sdf index 13da7702b..1428d2c92 100644 --- a/sdf/1.9/scene.sdf +++ b/sdf/1.9/scene.sdf @@ -48,7 +48,7 @@ - Skybox texture uri + The URI to a cubemap texture for a skybox. A .dds file is typically used for the cubemap. From ab4429eb1dcd12a4605f539ad05c69b4087b5b9e Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Sat, 25 Jun 2022 23:00:30 -0400 Subject: [PATCH 08/11] Update src/Sky.cc Signed-off-by: Mabel Zhang Co-authored-by: Louise Poubel --- src/Sky.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sky.cc b/src/Sky.cc index 901316ad5..a97ae0242 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -158,7 +158,7 @@ void Sky::SetCloudAmbient(const ignition::math::Color &_ambient) } ////////////////////////////////////////////////// -std::string Sky::CubemapUri() const +const std::string &Sky::CubemapUri() const { return this->dataPtr->cubemapUri; } From fc0cf3fb2858be09964412971e9ac38a676c4874 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Tue, 28 Jun 2022 00:11:34 -0400 Subject: [PATCH 09/11] header file signature Signed-off-by: Mabel Zhang --- include/sdf/Sky.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index ab1f21922..8bb76a5ae 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -103,7 +103,7 @@ namespace sdf /// \brief Get the skybox texture URI. /// \return The URI of the skybox texture. - public: std::string CubemapUri() const; + public: const std::string &CubemapUri() const; /// \brief Set the skybox texture URI. /// \param[in] _uri The URI of the skybox texture. From 3df8a5c67b09e3a614591d4def224b0ed91361fc Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 29 Jun 2022 02:11:52 -0400 Subject: [PATCH 10/11] try ABI without const Signed-off-by: Mabel Zhang --- include/sdf/Sky.hh | 2 +- src/Sky.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index 8bb76a5ae..ab1f21922 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -103,7 +103,7 @@ namespace sdf /// \brief Get the skybox texture URI. /// \return The URI of the skybox texture. - public: const std::string &CubemapUri() const; + public: std::string CubemapUri() const; /// \brief Set the skybox texture URI. /// \param[in] _uri The URI of the skybox texture. diff --git a/src/Sky.cc b/src/Sky.cc index a97ae0242..901316ad5 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -158,7 +158,7 @@ void Sky::SetCloudAmbient(const ignition::math::Color &_ambient) } ////////////////////////////////////////////////// -const std::string &Sky::CubemapUri() const +std::string Sky::CubemapUri() const { return this->dataPtr->cubemapUri; } From caa2eefd3a997c1202f23ac7846a6800c7548d47 Mon Sep 17 00:00:00 2001 From: Mabel Zhang Date: Wed, 29 Jun 2022 15:22:41 -0400 Subject: [PATCH 11/11] add back const Signed-off-by: Mabel Zhang --- include/sdf/Sky.hh | 2 +- src/Sky.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sdf/Sky.hh b/include/sdf/Sky.hh index ab1f21922..8bb76a5ae 100644 --- a/include/sdf/Sky.hh +++ b/include/sdf/Sky.hh @@ -103,7 +103,7 @@ namespace sdf /// \brief Get the skybox texture URI. /// \return The URI of the skybox texture. - public: std::string CubemapUri() const; + public: const std::string &CubemapUri() const; /// \brief Set the skybox texture URI. /// \param[in] _uri The URI of the skybox texture. diff --git a/src/Sky.cc b/src/Sky.cc index 901316ad5..a97ae0242 100644 --- a/src/Sky.cc +++ b/src/Sky.cc @@ -158,7 +158,7 @@ void Sky::SetCloudAmbient(const ignition::math::Color &_ambient) } ////////////////////////////////////////////////// -std::string Sky::CubemapUri() const +const std::string &Sky::CubemapUri() const { return this->dataPtr->cubemapUri; }