diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 11:31:13 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-13 11:31:13 +0000 |
commit | 332355a9f4a4199e0ddb51852546d44ec54e176f (patch) | |
tree | 4998cde56004f53a0218dc5f00d578f939ffea08 /test/test-assetFactory.cpp | |
parent | Integer support in persistence (diff) | |
parent | Only create VAOs for the light type(s) in use (diff) | |
download | ilt-332355a9f4a4199e0ddb51852546d44ec54e176f.tar.bz2 ilt-332355a9f4a4199e0ddb51852546d44ec54e176f.tar.xz ilt-332355a9f4a4199e0ddb51852546d44ec54e176f.zip |
Merge branch 'model-lights'
Diffstat (limited to 'test/test-assetFactory.cpp')
-rw-r--r-- | test/test-assetFactory.cpp | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index c8183df..8341fbf 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" @@ -46,7 +48,7 @@ public: void lights(const SceneShader & shader) const override { - shader.pointLight.add({-3, 1, 5}, {1, 1, 1}, .1F); + objects.apply(&Renderable::lights, shader); } void @@ -125,6 +127,34 @@ 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 oldlamp = mf->assets.at("old-lamp"); + BOOST_REQUIRE(oldlamp); + auto rlight_f = std::dynamic_pointer_cast<Illuminator>(rlight); + BOOST_REQUIRE(rlight_f); + auto oldlamp_f = std::dynamic_pointer_cast<Illuminator>(oldlamp); + BOOST_REQUIRE(oldlamp_f); + + auto light1 = std::make_shared<Light>(oldlamp_f, Location {{0, 0, 0}, {0, 0, 0}}); + auto light2 = std::make_shared<Light>(rlight_f, Location {{-4000, 0, 0}, {0, 2, 0}}); + auto light3 = std::make_shared<Light>(rlight_f, Location {{-4000, -4000, 0}, {0, 1, 0}}); + auto light4 = std::make_shared<Light>(oldlamp_f, Location {{3000, 4600, 0}, {0, 2, 0}}); + objects.objects.push_back(rlight_f); + objects.objects.push_back(oldlamp_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) |