Skip to content

Commit

Permalink
Added Sky Cubemap methods to Python (#1085)
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde authored Jul 22, 2022
1 parent b001313 commit bf95c0e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/src/sdf/pySky.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ void defineSky(pybind11::object module)
"Get cloud ambient color")
.def("set_cloud_ambient", &sdf::Sky::SetCloudAmbient,
"Set cloud ambient color")
.def("cubemap_uri", &sdf::Sky::CubemapUri,
"Get the skybox texture URI.")
.def("set_cubemap_uri", &sdf::Sky::SetCubemapUri,
"Set the skybox texture URI.")
.def("__copy__", [](const sdf::Sky &self) {
return sdf::Sky(self);
})
Expand Down
10 changes: 10 additions & 0 deletions python/test/pySky_TEST.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def test_default_construction(self):
self.assertAlmostEqual(0.5, sky.cloud_humidity())
self.assertAlmostEqual(0.5, sky.cloud_mean_size())
self.assertEqual(Color(0.8, 0.8, 0.8), sky.cloud_ambient())
self.assertEqual("", sky.cubemap_uri())


def test_copy_construction(self):
Expand All @@ -42,6 +43,8 @@ def test_copy_construction(self):
sky.set_cloud_humidity(0.9)
sky.set_cloud_mean_size(0.123)
sky.set_cloud_ambient(Color.BLUE)
self.assertEqual("", sky.cubemap_uri())
sky.set_cubemap_uri("dummyUri");

sky2 = Sky(sky)
self.assertAlmostEqual(1.0, sky2.time())
Expand All @@ -52,6 +55,7 @@ def test_copy_construction(self):
self.assertAlmostEqual(0.9, sky2.cloud_humidity())
self.assertAlmostEqual(0.123, sky2.cloud_mean_size())
self.assertEqual(Color.BLUE, sky2.cloud_ambient())
self.assertEqual("dummyUri", sky2.cubemap_uri())


def test_assignment(self):
Expand All @@ -64,6 +68,7 @@ def test_assignment(self):
sky.set_cloud_humidity(0.9)
sky.set_cloud_mean_size(0.123)
sky.set_cloud_ambient(Color.BLUE)
sky.set_cubemap_uri("dummyUri");

sky2 = sky
self.assertAlmostEqual(1.0, sky2.time())
Expand All @@ -74,6 +79,7 @@ def test_assignment(self):
self.assertAlmostEqual(0.9, sky2.cloud_humidity())
self.assertAlmostEqual(0.123, sky2.cloud_mean_size())
self.assertEqual(Color.BLUE, sky2.cloud_ambient())
self.assertEqual("dummyUri", sky2.cubemap_uri())


def test_deepcopy(self):
Expand All @@ -86,6 +92,7 @@ def test_deepcopy(self):
sky.set_cloud_humidity(0.9)
sky.set_cloud_mean_size(0.123)
sky.set_cloud_ambient(Color.BLUE)
sky.set_cubemap_uri("dummyUri");

sky2 = copy.deepcopy(sky)
self.assertAlmostEqual(1.0, sky2.time())
Expand All @@ -96,6 +103,7 @@ def test_deepcopy(self):
self.assertAlmostEqual(0.9, sky2.cloud_humidity())
self.assertAlmostEqual(0.123, sky2.cloud_mean_size())
self.assertEqual(Color.BLUE, sky2.cloud_ambient())
self.assertEqual("dummyUri", sky2.cubemap_uri())


def test_set(self):
Expand Down Expand Up @@ -125,6 +133,8 @@ def test_set(self):
sky.set_cloud_ambient(Color(0.1, 0.2, 0.3))
self.assertEqual(Color(0.1, 0.2, 0.3), sky.cloud_ambient())

sky.set_cubemap_uri("dummyUri");
self.assertEqual("dummyUri", sky.cubemap_uri())

if __name__ == '__main__':
unittest.main()

0 comments on commit bf95c0e

Please sign in to comment.