summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-03-04 14:27:23 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-03-04 14:27:23 +0000
commit54ddcd3da0916b6a46f5fcf3f33ff0fbffe375ce (patch)
treea1a46ac32486375a7b2636e467779916d28c8c4c /test
parentAdd Asset helpers to construct OpenGL ready meshes from Asset Factory meshes ... (diff)
downloadilt-54ddcd3da0916b6a46f5fcf3f33ff0fbffe375ce.tar.bz2
ilt-54ddcd3da0916b6a46f5fcf3f33ff0fbffe375ce.tar.xz
ilt-54ddcd3da0916b6a46f5fcf3f33ff0fbffe375ce.zip
Support and load factory asset directly into a RailVehicleClass instance
Diffstat (limited to 'test')
-rw-r--r--test/test-assetFactory.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index 8feb831..9930714 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -8,6 +8,7 @@
#include "assetFactory/assetFactory.h"
#include "assetFactory/factoryMesh.h"
#include "assetFactory/object.h"
+#include "game/vehicles/railVehicleClass.h"
#include "gfx/gl/sceneRenderer.h"
#include "lib/collection.hpp"
#include "lib/location.hpp"
@@ -167,16 +168,15 @@ BOOST_AUTO_TEST_CASE(brush47xml)
BOOST_CHECK_EQUAL(1, mf->assets.size());
auto brush47 = mf->assets.at("brush-47");
BOOST_REQUIRE(brush47);
- BOOST_CHECK_EQUAL(3, brush47->meshes.size());
- auto body = brush47->meshes.at(0);
- BOOST_REQUIRE(body);
- BOOST_CHECK_EQUAL("body", body->id);
- BOOST_CHECK_EQUAL(2, body->uses.size());
+ auto brush47rvc = std::dynamic_pointer_cast<RailVehicleClass>(brush47);
+ BOOST_REQUIRE(brush47rvc);
+ BOOST_REQUIRE(brush47rvc->bodyMesh);
+ BOOST_REQUIRE(brush47rvc->bogies.front());
+ BOOST_REQUIRE(brush47rvc->bogies.back());
- std::transform(brush47->meshes.begin(), brush47->meshes.end(), std::back_inserter(meshes.objects),
- [](const FactoryMesh::CPtr & factoryMesh) -> Mesh::Ptr {
- return factoryMesh->createMesh();
- });
+ meshes.objects.push_back(brush47rvc->bodyMesh);
+ meshes.objects.push_back(brush47rvc->bogies.front());
+ meshes.objects.push_back(brush47rvc->bogies.back());
render(20);
}