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/test-assetFactory.cpp') 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 From 8740d30b01f6c12e2fcea0450df73736cd17dc87 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 10 Jan 2024 01:10:44 +0000 Subject: Add spot light definition, loader, and rendering Rendering is untested, data is passed to whatever GL program is currently active. --- test/test-assetFactory.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'test/test-assetFactory.cpp') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index e7ba19c..91a5321 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -49,6 +49,7 @@ public: lights(const SceneShader & shader) const override { shader.pointLight.add({-3, 1, 5}, {1, 1, 1}, .1F); + objects.apply(&Renderable::lights, shader); } void -- cgit v1.2.3 From b8401062e1d3f5e6554ab7fd9b983ea63cfb05c5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 10 Jan 2024 19:04:30 +0000 Subject: Initial commit with working light instancing --- test/test-assetFactory.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test-assetFactory.cpp') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index 91a5321..bc93729 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -138,9 +138,9 @@ BOOST_AUTO_TEST_CASE(lights, *boost::unit_test::timeout(5)) 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}}); + auto light2 = std::make_shared(rlight_f, Location {{-4000, 0, 0}, {0, 2, 0}}); + auto light3 = std::make_shared(rlight_f, Location {{-4000, -4000, 0}, {0, 1, 0}}); + auto light4 = std::make_shared(rlight_f, Location {{3000, 4600, 0}, {0, 3, 0}}); objects.objects.push_back(rlight_f); // yes I'm hacking some floor to light up as though its a bush -- cgit v1.2.3 From 51eb25ea0f1373ca0442b02049406af38eae3b33 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 12 Jan 2024 19:35:58 +0000 Subject: Add model support for point lights Still invokes non-instanced point light shader --- test/test-assetFactory.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'test/test-assetFactory.cpp') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index bc93729..9e278c4 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -48,7 +48,6 @@ public: void lights(const SceneShader & shader) const override { - shader.pointLight.add({-3, 1, 5}, {1, 1, 1}, .1F); objects.apply(&Renderable::lights, shader); } -- cgit v1.2.3 From 48a5de8943bda62ba5caefe3b64c66a0d9024dff Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 13 Jan 2024 10:05:58 +0000 Subject: Add old street lamp model --- test/test-assetFactory.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'test/test-assetFactory.cpp') diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp index 9e278c4..8341fbf 100644 --- a/test/test-assetFactory.cpp +++ b/test/test-assetFactory.cpp @@ -133,14 +133,19 @@ BOOST_AUTO_TEST_CASE(lights, *boost::unit_test::timeout(5)) 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(rlight); BOOST_REQUIRE(rlight_f); + auto oldlamp_f = std::dynamic_pointer_cast(oldlamp); + BOOST_REQUIRE(oldlamp_f); - auto light1 = std::make_shared(rlight_f, Location {{0, 0, 0}, {0, 0, 0}}); + auto light1 = std::make_shared(oldlamp_f, Location {{0, 0, 0}, {0, 0, 0}}); auto light2 = std::make_shared(rlight_f, Location {{-4000, 0, 0}, {0, 2, 0}}); auto light3 = std::make_shared(rlight_f, Location {{-4000, -4000, 0}, {0, 1, 0}}); - auto light4 = std::make_shared(rlight_f, Location {{3000, 4600, 0}, {0, 3, 0}}); + auto light4 = std::make_shared(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(mf->assets.at("floor")); -- cgit v1.2.3