diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-05 19:45:36 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-01-05 19:45:36 +0000 |
commit | 7c1e9b25fa4062a69ea00c20cdbcc745d1b82659 (patch) | |
tree | 03a200a82211016a70420930ee88d2afd01f60a5 /test | |
parent | Include uniform name in required uniform does not exist error message (diff) | |
download | ilt-7c1e9b25fa4062a69ea00c20cdbcc745d1b82659.tar.bz2 ilt-7c1e9b25fa4062a69ea00c20cdbcc745d1b82659.tar.xz ilt-7c1e9b25fa4062a69ea00c20cdbcc745d1b82659.zip |
Add rendering support for spot lights
Diffstat (limited to 'test')
-rw-r--r-- | test/test-render.cpp | 27 |
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(); |