summaryrefslogtreecommitdiff
path: root/test/test-render.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-01-05 19:45:36 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-01-05 19:45:36 +0000
commit7c1e9b25fa4062a69ea00c20cdbcc745d1b82659 (patch)
tree03a200a82211016a70420930ee88d2afd01f60a5 /test/test-render.cpp
parentInclude uniform name in required uniform does not exist error message (diff)
downloadilt-7c1e9b25fa4062a69ea00c20cdbcc745d1b82659.tar.bz2
ilt-7c1e9b25fa4062a69ea00c20cdbcc745d1b82659.tar.xz
ilt-7c1e9b25fa4062a69ea00c20cdbcc745d1b82659.zip
Add rendering support for spot lights
Diffstat (limited to 'test/test-render.cpp')
-rw-r--r--test/test-render.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/test-render.cpp b/test/test-render.cpp
index 76b8e6a..1cad732 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -104,4 +104,31 @@ BOOST_AUTO_TEST_CASE(pointlight)
Texture::save(outImage, size, "/tmp/pointlight.tga");
}
+BOOST_AUTO_TEST_CASE(spotlight)
+{
+ SceneRenderer ss {size, output};
+ ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ class PointLightScene : public TestScene {
+ public:
+ void
+ environment(const SceneShader &, const SceneRenderer & r) const override
+ {
+ r.setAmbientLight({0.2F, 0.2F, 0.2F});
+ r.setDirectionalLight({0.2F, 0.2F, 0.2F}, west + down, *this);
+ }
+ void
+ lights(const SceneShader & shader) const override
+ {
+ shader.spotLight.add({50, 50, 15}, down, {1.0, 1.0, 1.0}, 0.01, 1);
+ shader.spotLight.add({51, 59.5, 1}, north, {1.0, 1.0, 1.0}, 0.001, .5);
+ shader.spotLight.add({53, 59.5, 1}, north, {1.0, 1.0, 1.0}, 0.001, .5);
+ shader.spotLight.add({60, 50, 3}, north + east, {1.0, 1.0, 1.0}, 0.0001, .7);
+ }
+ };
+ PointLightScene scene;
+ ss.render(scene);
+ glDisable(GL_DEBUG_OUTPUT);
+ Texture::save(outImage, size, "/tmp/spotlight.tga");
+}
+
BOOST_AUTO_TEST_SUITE_END();