From 0638aaaf2a60efae95a1b404d7eee29e894047bc Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Apr 2023 01:54:19 +0100 Subject: No need to pass size around, we can get it back from the texture --- test/test-render.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/test-render.cpp') diff --git a/test/test-render.cpp b/test/test-render.cpp index 7771760..8c6b31c 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -73,7 +73,7 @@ BOOST_AUTO_TEST_CASE(basic) const TestScene scene; ss.render(scene); glDisable(GL_DEBUG_OUTPUT); - Texture::save(outImage, size, "/tmp/basic.tga"); + Texture::save(outImage, "/tmp/basic.tga"); } BOOST_AUTO_TEST_CASE(pointlight) @@ -101,7 +101,7 @@ BOOST_AUTO_TEST_CASE(pointlight) const PointLightScene scene; ss.render(scene); glDisable(GL_DEBUG_OUTPUT); - Texture::save(outImage, size, "/tmp/pointlight.tga"); + Texture::save(outImage, "/tmp/pointlight.tga"); } BOOST_AUTO_TEST_CASE(spotlight) @@ -128,7 +128,7 @@ BOOST_AUTO_TEST_CASE(spotlight) const PointLightScene scene; ss.render(scene); glDisable(GL_DEBUG_OUTPUT); - Texture::save(outImage, size, "/tmp/spotlight.tga"); + Texture::save(outImage, "/tmp/spotlight.tga"); } BOOST_AUTO_TEST_SUITE_END(); -- cgit v1.2.3 From 7c2977ee4de2cfd967871a0927443f24361944b1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 14 Apr 2023 17:07:40 +0100 Subject: Use asset factory models in test-render --- test/test-render.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'test/test-render.cpp') diff --git a/test/test-render.cpp b/test/test-render.cpp index 8c6b31c..45acab5 100644 --- a/test/test-render.cpp +++ b/test/test-render.cpp @@ -6,8 +6,10 @@ #include #include +#include #include #include +#include #include #include #include @@ -19,18 +21,30 @@ #include class TestScene : public SceneProvider { - RailVehicleClass train {"brush47"}; + std::shared_ptr train1, train2; + Terrain terrain {[]() { auto gd = std::make_shared(GeoData::Limits {{0, 0}, {100, 100}}); gd->generateRandom(); return gd; }()}; + +public: + TestScene() + { + const auto assetFactory = AssetFactory::loadXML(RESDIR "/brush47.xml"); + const auto brush47rvc = std::dynamic_pointer_cast(assetFactory->assets.at("brush-47")); + train1 = std::make_shared(brush47rvc); + train1->location.pos = {52, 50, 2}; + train2 = std::make_shared(brush47rvc); + train2->location.pos = {52, 30, 2}; + } void content(const SceneShader & shader) const override { terrain.render(shader); - train.render(shader, Location {{52, 50, 2}}, {Location {{52, 56, 2}}, Location {{52, 44, 2}}}); - train.render(shader, Location {{52, 30, 2}}, {Location {{52, 36, 2}}, Location {{52, 24, 2}}}); + train1->render(shader); + train2->render(shader); } void lights(const SceneShader &) const override @@ -40,8 +54,8 @@ class TestScene : public SceneProvider { shadows(const ShadowMapper & shadowMapper) const override { terrain.shadows(shadowMapper); - train.shadows(shadowMapper, Location {{52, 50, 2}}, {Location {{52, 56, 2}}, Location {{52, 44, 2}}}); - train.shadows(shadowMapper, Location {{52, 30, 2}}, {Location {{52, 36, 2}}, Location {{52, 24, 2}}}); + train1->shadows(shadowMapper); + train2->shadows(shadowMapper); } }; -- cgit v1.2.3