summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--res/brush47.xml79
-rw-r--r--test/test-assetFactory.cpp14
2 files changed, 73 insertions, 20 deletions
diff --git a/res/brush47.xml b/res/brush47.xml
index 9c7d2a8..dbd3327 100644
--- a/res/brush47.xml
+++ b/res/brush47.xml
@@ -1,36 +1,89 @@
<?xml version="1.0"?>
<ilt p.id="assetFactory">
<object id="wheel">
- <use type="cylinder" position="0,0,0.571" scale="1.142,1.142,0.07" rotation="0,0,1.5708"/>
+ <use type="cylinder" position="0,0,0.571" scale="1.142,1.142,0.07" rotation="0,0,1.5708" colour="silver">
+ <face id="top" colour="#413b3a"/>
+ <face id="bottom" colour="#413b3a"/>
+ </use>
+ <use type="cuboid" scale="0.3,0.5,0.3" position="0.2,0,0.421" colour="grey30"/>
+ </object>
+ <object id="spring">
+ <use type="cylinder" scale="0.15,0.15,0.2" position="0,0,-0.1" colour="red"/>
+ </object>
+ <object id="spring-pair">
+ <use type="spring" position="0.0,-0.1,0.0"/>
+ <use type="spring" position="0.0,0.1,0.0"/>
</object>
<object id="axel">
- <use type="wheel" position="-0.717,0,0"/>
- <use type="wheel" position="0.717,0,0" rotation="0,3.14159,0"/>
+ <use type="wheel" position="-0.717,0,0" rotation="0,3.14159,0"/>
+ <use type="wheel" position="0.717,0,0"/>
+ <use type="cylinder" scale="0.1,0.1,2.2" position="-1.1,0,0.571" rotation="0,0,1.5708" colour="yellow"/>
+ </object>
+ <object id="bogie-side">
+ <use type="spring-pair" position="0,-1.1,0"/>
+ <use type="spring-pair" position="0,1.1,0"/>
+ <use type="cuboid" scale="0.2,4.3,0.15" position="0,0,-0.25" colour="darkgrey">
+ <face id="bottom" type="extrude" scale="1,0.3,1" position="0,0,-0.1"/>
+ </use>
+ <use type="cuboid" scale="0.2,4.3,0.15" position="0,0,0.1" colour="darkgrey">
+ <face id="top" type="extrude" scale="1,0.3,1" position="0,0,0.3"/>
+ </use>
</object>
<object id="bogie">
<use type="axel" position="0,0,0"/>
<use type="axel" position="0,2,0"/>
<use type="axel" position="0,-2,0"/>
+ <use type="bogie-side" position="0.9,0,0.571"/>
+ <use type="bogie-side" position="-0.9,0,0.571"/>
+ <use type="cuboid" scale="1.8,0.6,0.5" position="0,1,0.4" colour="darkgrey"/>
+ <use type="cuboid" scale="1.8,0.6,0.5" position="0,-1,0.4" colour="darkgrey"/>
+ <use type="cuboid" scale="1.2,1.9,0.5" position="0,0,0.5" colour="grey30"/>
+ <use type="cuboid" scale="1,5.3,0.4" position="0,0,0.4" colour="darkgrey"/>
+ <use type="cuboid" scale="1.6,0.2,0.3" position="0,2.7,0.4" colour="grey30"/>
+ </object>
+ <object id="battery">
+ <use type="cuboid" scale="2.6,2.2,0.7" position="0,0,0.4" colour="slategrey">
+ <face id="bottom" type="extrude" scale="0.6,1,1" position="0,0,-0.3"/>
+ </use>
+ </object>
+ <object id="buffer">
+ <use type="cylinder" scale="0.3,0.3,0.3" colour="grey10"/>
+ <use type="cylinder" scale="0.6,0.6,0.1" position="0,0,0.3" colour="grey10"/>
+ </object>
+ <object id="buffers">
+ <use type="buffer" rotation="-1.5708,0,0" position="1.1,0,-0.3"/>
+ <use type="buffer" rotation="-1.5708,0,0" position="-1.1,0,-0.3"/>
+ <use type="cuboid" scale="2.65,0.1,0.6" position="0,-0.05,-0.6">
+ <face id="front" type="extrude" scale="0.9,1,0.4" position="0,-0.5,0.18">
+ <face id="front" type="extrude" scale="0.4,1,0" position="0,-0.5,0.09"/>
+ </face>
+ </use>
</object>
<asset p.typeid="RailVehicleClass" id="brush-47" name="Brush 47" length="19.38" wheelBase="15.70" maxSpeed="42.4688">
<bodyMesh id="body" size="2.69,19.38,3.9">
- <use type="cuboid" position="0,0,1.2" scale="2.69,19.38,1.5" colour="#2c4f5a">
+ <use type="cuboid" position="0,0,1.2" scale="2.69,19.38,0.3" colour="goldenrod">
<face id="bottom" colour="#2c3539"/>
- <face id="front" colour="goldenrod"/>
- <face id="back" colour="goldenrod"/>
- <face id="top" type="extrude" scale="1,0.95,1" position="0,0,0.8">
- <face id="front" colour="#e1eff3"/>
- <face id="back" colour="#e1eff3"/>
- <face id="top" type="extrude" scale="0.5,0.8,0" position="0,0,0.4" smooth="true" colour="#aeb0b0"/>
+ <face id="top" type="extrude" position="0,0,1.05" colour="#2c4f5a">
+ <face id="front" colour="goldenrod"/>
+ <face id="back" colour="goldenrod"/>
+ <face id="top" type="extrude" scale="1,0.96,1" position="0,0,0.775">
+ <face id="front" colour="#e1eff3"/>
+ <face id="back" colour="#e1eff3"/>
+ <face id="top" type="extrude" scale="0.5,0.85,0" smooth="true" position="0,0,0.575" colour="#aeb0b0"/>
+ </face>
</face>
</use>
- <use type="cuboid" position="0,0,0.2" scale="2.6,4.5,1" colour="grey30"/>
+ <use type="cuboid" position="0,0,0.3" scale="1.6,4,1" colour="darkslategrey"/>
+ <use type="battery" position="0,1.2,0"/>
+ <use type="battery" position="0,-1.2,0"/>
+ <use type="buffers" position="0,9.69,1.2" colour="grey20"/>
+ <use type="buffers" position="0,-9.69,1.2" colour="grey20" rotation="0,3.14159,0"/>
</bodyMesh>
<bogie id="bogie1">
- <use type="bogie" position="0,-1.85,0" colour="#413b3a"/>
+ <use type="bogie" position="0,-1.85,0"/>
</bogie>
<bogie id="bogie2">
- <use type="bogie" position="0,1.85,0" rotation="0,3.14159,0" colour="#413b3a"/>
+ <use type="bogie" position="0,1.85,0" rotation="0,3.14159,0"/>
</bogie>
</asset>
</ilt>
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index ae5a88a..204ffb3 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -21,7 +21,7 @@ BOOST_GLOBAL_FIXTURE(ApplicationBase);
BOOST_GLOBAL_FIXTURE(TestMainWindow);
const std::filesystem::path TMP {"/tmp"};
-class FactoryFixture : public TestRenderOutputSize<glm::ivec2 {2048, 2048}>, public SceneProvider {
+class FactoryFixture : public TestRenderOutputSize<glm::ivec2 {2048, 1024}>, public SceneProvider {
public:
FactoryFixture() : sceneRenderer {size, output} { }
~FactoryFixture()
@@ -45,8 +45,8 @@ public:
void
environment(const SceneShader &, const SceneRenderer & sceneRenderer) const override
{
- sceneRenderer.setAmbientLight({.2, .2, .2});
- sceneRenderer.setDirectionalLight({.3, .3, .3}, east + south + south + down, *this);
+ sceneRenderer.setAmbientLight({.4, .4, .4});
+ sceneRenderer.setDirectionalLight({.6, .6, .6}, east + south + south + down, *this);
}
void
shadows(const ShadowMapper & mapper) const override
@@ -57,7 +57,7 @@ public:
void
render(float dist = 10.f)
{
- sceneRenderer.camera.setView({dist, dist, dist}, south + west + down);
+ sceneRenderer.camera.setView({-dist, dist * 1.2f, dist * 1.2f}, south + east + down);
sceneRenderer.render(*this);
}
Collection<const Renderable> objects;
@@ -71,7 +71,7 @@ BOOST_AUTO_TEST_CASE(brush47xml)
{
auto mf = AssetFactory::loadXML(RESDIR "/brush47.xml");
BOOST_REQUIRE(mf);
- BOOST_REQUIRE_EQUAL(6, mf->shapes.size());
+ BOOST_REQUIRE_GE(mf->shapes.size(), 6);
BOOST_CHECK(mf->shapes.at("plane"));
BOOST_CHECK(mf->shapes.at("cylinder"));
BOOST_CHECK(mf->shapes.at("cuboid"));
@@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(brush47xml)
auto bogie = mf->shapes.at("bogie");
BOOST_REQUIRE(bogie);
auto bogieObj = std::dynamic_pointer_cast<const Object>(bogie);
- BOOST_CHECK_EQUAL(3, bogieObj->uses.size());
+ BOOST_CHECK_GE(bogieObj->uses.size(), 3);
BOOST_CHECK_EQUAL(1, mf->assets.size());
auto brush47 = mf->assets.at("brush-47");
BOOST_REQUIRE(brush47);
@@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(brush47xml)
auto railVehicle = std::make_shared<RailVehicle>(brush47rvc);
objects.objects.push_back(railVehicle);
- render(20);
+ render();
}
BOOST_AUTO_TEST_SUITE_END();