diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-13 01:46:36 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-12-13 01:46:36 +0000 |
commit | e4b85a5f84f73548def2162fc534625470404df1 (patch) | |
tree | ecc2af343899770915d8727534b5b0c3a91e3755 | |
parent | Fix clamping to seafloor and add specific test (diff) | |
download | ilt-e4b85a5f84f73548def2162fc534625470404df1.tar.bz2 ilt-e4b85a5f84f73548def2162fc534625470404df1.tar.xz ilt-e4b85a5f84f73548def2162fc534625470404df1.zip |
Basic support for saving intermediate render buffers
-rw-r--r-- | gfx/gl/sceneRenderer.h | 2 | ||||
-rw-r--r-- | test/test-render.cpp | 20 |
2 files changed, 19 insertions, 3 deletions
diff --git a/gfx/gl/sceneRenderer.h b/gfx/gl/sceneRenderer.h index 30fd8d3..7f72d76 100644 --- a/gfx/gl/sceneRenderer.h +++ b/gfx/gl/sceneRenderer.h @@ -19,7 +19,7 @@ public: Camera camera; -private: +protected: void renderQuad() const; ScreenAbsCoord size; diff --git a/test/test-render.cpp b/test/test-render.cpp index 37bacdd..e2797a4 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -98,11 +98,27 @@ BOOST_FIXTURE_TEST_SUITE(w, TestRenderOutput); BOOST_AUTO_TEST_CASE(basic) { - SceneRenderer ss {size, output}; + class TestSceneRenderer : public SceneRenderer { + using SceneRenderer::SceneRenderer; + + public: + void + saveBuffers(const std::filesystem::path & prefix) const + { + std::filesystem::create_directories(prefix); + Texture::save(gAlbedoSpec, (prefix / "albedo.tga").c_str()); + Texture::save(gPosition, (prefix / "position.tga").c_str()); + Texture::saveNormal(gNormal, (prefix / "normal.tga").c_str()); + Texture::save(gIllumination, (prefix / "illumination.tga").c_str()); + } + }; + + TestSceneRenderer ss {size, output}; ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F})); const TestScene scene; ss.render(scene); - Texture::save(outImage, "/tmp/basic.tga"); + ss.saveBuffers("/tmp/basic"); + Texture::save(outImage, "/tmp/basic/final.tga"); } BOOST_AUTO_TEST_CASE(terrain) |