diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-14 17:07:40 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2023-04-14 17:07:40 +0100 |
commit | 7c2977ee4de2cfd967871a0927443f24361944b1 (patch) | |
tree | 2a50e1fd4814659a3e86f7422203434c9b6f7cab /test | |
parent | Handle different mapmodes in basic shader (diff) | |
download | ilt-7c2977ee4de2cfd967871a0927443f24361944b1.tar.bz2 ilt-7c2977ee4de2cfd967871a0927443f24361944b1.tar.xz ilt-7c2977ee4de2cfd967871a0927443f24361944b1.zip |
Use asset factory models in test-render
Diffstat (limited to 'test')
-rw-r--r-- | test/Jamfile.jam | 6 | ||||
-rw-r--r-- | test/test-render.cpp | 24 |
2 files changed, 22 insertions, 8 deletions
diff --git a/test/Jamfile.jam b/test/Jamfile.jam index 482b388..d91af1d 100644 --- a/test/Jamfile.jam +++ b/test/Jamfile.jam @@ -52,11 +52,11 @@ run test-network.cpp ; run test-persistence.cpp : -- : [ sequence.insertion-sort [ glob-tree fixtures : *.json ] ] : <library>test ; run test-text.cpp ; run test-enumDetails.cpp ; -run test-render.cpp : : : <library>test ; +run test-render.cpp : -- : test-assetFactory : <library>test ; run test-glContextBhvr.cpp ; run test-assetFactory.cpp : -- : [ sequence.insertion-sort [ glob-tree $(res) : *.* ] fixtures/rgb.txt ] : <library>test ; -run perf-assetFactory.cpp : : : <library>benchmark <library>test <dependency>test-assetFactory ; -run perf-persistence.cpp : : : <library>benchmark <library>test <dependency>test-persistence ; +run perf-assetFactory.cpp : -- : test-assetFactory : <library>benchmark <library>test ; +run perf-persistence.cpp : -- : test-persistence : <library>benchmark <library>test ; run test-worker.cpp ; compile test-static-enumDetails.cpp ; compile test-static-stream_support.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 <boost/test/data/test_case.hpp> #include <boost/test/unit_test.hpp> +#include <assetFactory/assetFactory.h> #include <game/geoData.h> #include <game/terrain.h> +#include <game/vehicles/railVehicle.h> #include <game/vehicles/railVehicleClass.h> #include <gfx/gl/sceneRenderer.h> #include <gfx/models/texture.h> @@ -19,18 +21,30 @@ #include <ui/window.h> class TestScene : public SceneProvider { - RailVehicleClass train {"brush47"}; + std::shared_ptr<RailVehicle> train1, train2; + Terrain terrain {[]() { auto gd = std::make_shared<GeoData>(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<RailVehicleClass>(assetFactory->assets.at("brush-47")); + train1 = std::make_shared<RailVehicle>(brush47rvc); + train1->location.pos = {52, 50, 2}; + train2 = std::make_shared<RailVehicle>(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); } }; |