From 2842719a9d6f385852d90c0046b90e694be8f818 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 19 Jan 2024 02:10:39 +0000 Subject: Add rail network render test --- test/test-render.cpp | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'test/test-render.cpp') diff --git a/test/test-render.cpp b/test/test-render.cpp index 41731dd..19261fe 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -158,4 +159,46 @@ BOOST_AUTO_TEST_CASE(terrain) Texture::save(outImage, "/tmp/terrain.tga"); } +BOOST_AUTO_TEST_CASE(railnet) +{ + SceneRenderer ss {size, output}; + ss.camera.setView({0, 0, 10000}, glm::normalize(glm::vec3 {1, 1, -0.5F})); + + class TestRail : public SceneProvider { + RailLinks net; + + public: + TestRail() + { + net.addLinksBetween({10000, 10000, 0}, {100000, 100000, 0}); + } + + void + content(const SceneShader & shader) const override + { + net.render(shader); + } + + void + environment(const SceneShader &, const SceneRenderer & sr) const override + { + sr.setAmbientLight({0.1, 0.1, 0.1}); + sr.setDirectionalLight({1, 1, 1}, south + down, *this); + } + + void + lights(const SceneShader &) const override + { + } + + void + shadows(const ShadowMapper &) const override + { + } + }; + + ss.render(TestRail {}); + Texture::save(outImage, "/tmp/railnet.tga"); +} + BOOST_AUTO_TEST_SUITE_END(); -- cgit v1.2.3 From 1e43d23ae40282ef9c4047c77b7994527ee95b38 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jan 2024 12:57:55 +0000 Subject: Add mail rail network to render test, include curves --- test/test-render.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'test/test-render.cpp') diff --git a/test/test-render.cpp b/test/test-render.cpp index 19261fe..cc2bba2 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -170,7 +170,11 @@ BOOST_AUTO_TEST_CASE(railnet) public: TestRail() { - net.addLinksBetween({10000, 10000, 0}, {100000, 100000, 0}); + net.addLinksBetween({20000, 10000, 0}, {100000, 100000, 0}); + net.addLinksBetween({20000, 10000, 0}, {10000, 10000, 0}); + net.addLinksBetween({10000, 20000, 0}, {100000, 120000, 0}); + net.addLinksBetween({10000, 20000, 0}, {10000, 10000, 0}); + net.addLinksBetween({100000, 100000, 0}, {100000, 120000, 0}); } void -- cgit v1.2.3 From 8391c63472641c67f59723d0a6706efff6fb17d4 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Tue, 23 Jan 2024 23:50:46 +0000 Subject: Fix network population of position in gBuffer Adds some rails to the basic test highlighting broken shadows --- test/test-render.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test/test-render.cpp') diff --git a/test/test-render.cpp b/test/test-render.cpp index cc2bba2..6c20a23 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -25,6 +25,7 @@ class TestScene : public SceneProvider { const RailVehicleClassPtr brush47rvc = std::dynamic_pointer_cast( AssetFactory::loadXML(RESDIR "/brush47.xml")->assets.at("brush-47")); std::shared_ptr train1, train2; + RailLinks rail; Terrain terrain {[]() { auto gd = std::make_shared(GeoData::createFlat({0, 0}, {1000000, 1000000}, 1)); @@ -42,6 +43,8 @@ public: train2->location.setPosition({52000, 30000, 2000}); train2->bogies.front().setPosition(train2->bogies.front().position() + train2->location.position()); train2->bogies.back().setPosition(train2->bogies.back().position() + train2->location.position()); + rail.addLinksBetween({42000, 50000, 1000}, {65000, 50000, 1000}); + rail.addLinksBetween({65000, 50000, 1000}, {75000, 45000, 2000}); } void @@ -49,6 +52,7 @@ public: { terrain.render(shader); brush47rvc->render(shader); + rail.render(shader); } void -- cgit v1.2.3