summaryrefslogtreecommitdiff
path: root/test/test-render.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-19 02:10:39 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-19 23:53:15 +0000
commit2842719a9d6f385852d90c0046b90e694be8f818 (patch)
tree2110eb2599a6222b71b0f417e278671fa40150c4 /test/test-render.cpp
parentAdd traits wrapper for setting uniforms (diff)
downloadilt-2842719a9d6f385852d90c0046b90e694be8f818.tar.bz2
ilt-2842719a9d6f385852d90c0046b90e694be8f818.tar.xz
ilt-2842719a9d6f385852d90c0046b90e694be8f818.zip
Add rail network render test
Diffstat (limited to 'test/test-render.cpp')
-rw-r--r--test/test-render.cpp43
1 files changed, 43 insertions, 0 deletions
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 <assetFactory/assetFactory.h>
#include <game/geoData.h>
+#include <game/network/rail.h>
#include <game/terrain.h>
#include <game/vehicles/railVehicle.h>
#include <game/vehicles/railVehicleClass.h>
@@ -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();