From 00f25bcce58789ad0f8082406f233de461d7ccf2 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 9 Jan 2024 20:18:17 +0000 Subject: Add lights resource set and test scene --- res/lights.xml | 16 ++++++++++++++++ test/test-assetFactory.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 res/lights.xml diff --git a/res/lights.xml b/res/lights.xml new file mode 100644 index 0000000..137137d --- /dev/null +++ b/res/lights.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index c8183df..e7ba19c 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -9,6 +9,8 @@ #include "assetFactory/object.h" #include "assetFactory/texturePacker.h" #include "game/scenary/foliage.h" +#include "game/scenary/illuminator.h" +#include "game/scenary/light.h" #include "game/scenary/plant.h" #include "game/vehicles/railVehicle.h" #include "game/vehicles/railVehicleClass.h" @@ -125,6 +127,29 @@ BOOST_AUTO_TEST_CASE(foliage, *boost::unit_test::timeout(5)) render(6000); } +BOOST_AUTO_TEST_CASE(lights, *boost::unit_test::timeout(5)) +{ + auto mf = AssetFactory::loadXML(RESDIR "/lights.xml"); + BOOST_REQUIRE(mf); + auto rlight = mf->assets.at("r-light"); + BOOST_REQUIRE(rlight); + auto rlight_f = std::dynamic_pointer_cast(rlight); + BOOST_REQUIRE(rlight_f); + + auto light1 = std::make_shared(rlight_f, Location {{0, 0, 0}, {0, 0, 0}}); + auto light2 = std::make_shared(rlight_f, Location {{-4000, 0, 0}, {0, -1, 0}}); + auto light3 = std::make_shared(rlight_f, Location {{-4000, -4000, 0}, {0, -3, 0}}); + auto light4 = std::make_shared(rlight_f, Location {{3000, 4600, 0}, {0, 1, 0}}); + objects.objects.push_back(rlight_f); + + // yes I'm hacking some floor to light up as though its a bush + auto floorf = std::dynamic_pointer_cast(mf->assets.at("floor")); + auto floor = std::make_shared(floorf, Location {}); + objects.objects.push_back(floorf); + + render(6000); +} + BOOST_AUTO_TEST_SUITE_END(); BOOST_AUTO_TEST_CASE(loadall) -- cgit v1.2.3