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 --- test/test-assetFactory.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'test') 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