summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-11-19 15:04:30 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-11-23 18:38:43 +0000
commitffdaa93edf5eeaf9db7dc17e51554a77dd9d596d (patch)
tree5ec8af60e0761417d4f80a012679e3071de59888 /test
parentShared context, persist main window in test, send test for upcoming pointlight (diff)
downloadilt-ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d.tar.bz2
ilt-ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d.tar.xz
ilt-ffdaa93edf5eeaf9db7dc17e51554a77dd9d596d.zip
Separate out the illumation of the scene
Diffstat (limited to 'test')
-rw-r--r--test/test-render.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/test/test-render.cpp b/test/test-render.cpp
index 62090e3..d5a79ec 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -54,6 +54,19 @@ public:
}
};
+class TestScene : public SceneRenderer::SceneProvider {
+ Terrain terrain {[]() {
+ auto gd = std::make_shared<GeoData>(GeoData::Limits {{0, 0}, {100, 100}});
+ gd->generateRandom();
+ return gd;
+ }()};
+ void
+ content(const SceneShader & shader) const
+ {
+ terrain.render(shader);
+ }
+};
+
BOOST_GLOBAL_FIXTURE(ApplicationBase);
BOOST_GLOBAL_FIXTURE(TestMainWindow);
@@ -61,29 +74,21 @@ BOOST_FIXTURE_TEST_SUITE(w, TestRenderOutput);
BOOST_AUTO_TEST_CASE(basic)
{
- auto gd = std::make_shared<GeoData>(GeoData::Limits {{0, 0}, {100, 100}});
- gd->generateRandom();
- Terrain terrain {gd};
SceneRenderer ss {size, output};
ss.camera.pos = {-10, -10, 60};
ss.camera.forward = glm::normalize(glm::vec3 {1, 1, -0.5F});
- ss.render([&terrain](const auto & shader) {
- terrain.render(shader);
- });
+ TestScene scene;
+ ss.render(scene);
Texture::save(outImage, size, "/tmp/basic.tga");
}
BOOST_AUTO_TEST_CASE(pointlight)
{
- auto gd = std::make_shared<GeoData>(GeoData::Limits {{0, 0}, {100, 100}});
- gd->generateRandom();
- Terrain terrain {gd};
SceneRenderer ss {size, output};
ss.camera.pos = {-10, -10, 60};
ss.camera.forward = glm::normalize(glm::vec3 {1, 1, -0.5F});
- ss.render([&terrain](const auto & shader) {
- terrain.render(shader);
- });
+ TestScene scene;
+ ss.render(scene);
Texture::save(outImage, size, "/tmp/pointlight.tga");
}