summaryrefslogtreecommitdiff
path: root/test/test-assetFactory.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-09 20:18:17 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-09 20:18:17 +0000
commit00f25bcce58789ad0f8082406f233de461d7ccf2 (patch)
treecf6b1c22b31ba4a7c5531f4fe71c461a8cc09f9a /test/test-assetFactory.cpp
parentAdd the Illuminator (type) and Light (instance) classes (diff)
downloadilt-00f25bcce58789ad0f8082406f233de461d7ccf2.tar.bz2
ilt-00f25bcce58789ad0f8082406f233de461d7ccf2.tar.xz
ilt-00f25bcce58789ad0f8082406f233de461d7ccf2.zip
Add lights resource set and test scene
Diffstat (limited to 'test/test-assetFactory.cpp')
-rw-r--r--test/test-assetFactory.cpp25
1 files changed, 25 insertions, 0 deletions
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<Illuminator>(rlight);
+ BOOST_REQUIRE(rlight_f);
+
+ auto light1 = std::make_shared<Light>(rlight_f, Location {{0, 0, 0}, {0, 0, 0}});
+ auto light2 = std::make_shared<Light>(rlight_f, Location {{-4000, 0, 0}, {0, -1, 0}});
+ auto light3 = std::make_shared<Light>(rlight_f, Location {{-4000, -4000, 0}, {0, -3, 0}});
+ auto light4 = std::make_shared<Light>(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<Foliage>(mf->assets.at("floor"));
+ auto floor = std::make_shared<Plant>(floorf, Location {});
+ objects.objects.push_back(floorf);
+
+ render(6000);
+}
+
BOOST_AUTO_TEST_SUITE_END();
BOOST_AUTO_TEST_CASE(loadall)