summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-11-23 19:07:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-11-23 19:07:18 +0000
commit50d6f63fb28c82a35e68914fe941b685d26f6e89 (patch)
tree4a86d800d36341aedee7319307675cd1e6e5b784 /test
parentSupport setting a viewPort uniform for those shaders which need it (diff)
downloadilt-50d6f63fb28c82a35e68914fe941b685d26f6e89.tar.bz2
ilt-50d6f63fb28c82a35e68914fe941b685d26f6e89.tar.xz
ilt-50d6f63fb28c82a35e68914fe941b685d26f6e89.zip
Add rendering support for point lights
Diffstat (limited to 'test')
-rw-r--r--test/test-render.cpp25
1 files changed, 24 insertions, 1 deletions
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 <game/terrain.h>
#include <gfx/models/texture.h>
#include <lib/glArrays.h>
+#include <maths.h>
#include <ui/applicationBase.h>
#include <ui/sceneRenderer.h>
#include <ui/window.h>
@@ -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");
}