From 50d6f63fb28c82a35e68914fe941b685d26f6e89 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 23 Nov 2022 19:07:18 +0000 Subject: Add rendering support for point lights --- test/test-render.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test-render.cpp b/test/test-render.cpp index d5a79ec..089665f 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -65,6 +66,10 @@ class TestScene : public SceneRenderer::SceneProvider { { terrain.render(shader); } + void + lights(const SceneShader &) const + { + } }; BOOST_GLOBAL_FIXTURE(ApplicationBase); @@ -87,7 +92,25 @@ BOOST_AUTO_TEST_CASE(pointlight) SceneRenderer ss {size, output}; ss.camera.pos = {-10, -10, 60}; ss.camera.forward = glm::normalize(glm::vec3 {1, 1, -0.5F}); - TestScene scene; + class PointLightScene : public TestScene { + public: + void + environment(const SceneShader &, const SceneRenderer & r) const override + { + r.setAmbientLight({0.2F, 0.2F, 0.2F}); + r.setDirectionalLight({}, down); + } + void + lights(const SceneShader & shader) const override + { + for (int x = 50; x < 100; x += 20) { + for (int y = 50; y < 2000; y += 20) { + shader.pointLight.add({x, y, 4}, {1.0, 1.0, 1.0}, 0.1); + } + } + } + }; + PointLightScene scene; ss.render(scene); Texture::save(outImage, size, "/tmp/pointlight.tga"); } -- cgit v1.2.3