summaryrefslogtreecommitdiff
path: root/test/test-render.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-04-27 17:55:30 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2023-04-27 17:55:30 +0100
commit4f34ed9c949785784f0006f971b5fd2bb9508553 (patch)
tree20f6627a2f441212365d05d04160a5a6a97063e7 /test/test-render.cpp
parentMerge remote-tracking branch 'origin/assimp-normals' (diff)
parentRevert "Export mesh size and primitive type" (diff)
downloadilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.bz2
ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.tar.xz
ilt-4f34ed9c949785784f0006f971b5fd2bb9508553.zip
Merge branch 'instancing-pt2'
Diffstat (limited to 'test/test-render.cpp')
-rw-r--r--test/test-render.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/test/test-render.cpp b/test/test-render.cpp
index 1643068..d5e2d87 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -22,6 +22,8 @@
class TestScene : public SceneProvider {
std::shared_ptr<RailVehicle> train1, train2;
+ const RailVehicleClassPtr brush47rvc = std::dynamic_pointer_cast<RailVehicleClass>(
+ AssetFactory::loadXML(RESDIR "/brush47.xml")->assets.at("brush-47"));
Terrain terrain {[]() {
auto gd = std::make_shared<GeoData>(GeoData::Limits {{0, 0}, {100, 100}});
@@ -32,19 +34,20 @@ class TestScene : public SceneProvider {
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};
+ train1->location.setPosition({52, 50, 2});
+ train1->bogies.front().setPosition(train1->bogies.front().position() + train1->location.position());
+ train1->bogies.back().setPosition(train1->bogies.back().position() + train1->location.position());
train2 = std::make_shared<RailVehicle>(brush47rvc);
- train2->location.pos = {52, 30, 2};
+ train2->location.setPosition({52, 30, 2});
+ train2->bogies.front().setPosition(train2->bogies.front().position() + train2->location.position());
+ train2->bogies.back().setPosition(train2->bogies.back().position() + train2->location.position());
}
void
content(const SceneShader & shader) const override
{
terrain.render(shader);
- train1->render(shader);
- train2->render(shader);
+ brush47rvc->render(shader);
}
void
lights(const SceneShader &) const override
@@ -54,8 +57,7 @@ public:
shadows(const ShadowMapper & shadowMapper) const override
{
terrain.shadows(shadowMapper);
- train1->shadows(shadowMapper);
- train2->shadows(shadowMapper);
+ brush47rvc->shadows(shadowMapper);
}
};