summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-04-18 19:53:33 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2024-04-18 19:53:33 +0100
commit3b5450676b61efd2ee8eaab09ee95eba34a39870 (patch)
tree3b0e57763b1c03f1cd6ebdf948e77652952c8369
parentCustom vertex, vertex shader and fragment shader for landmass (diff)
downloadilt-3b5450676b61efd2ee8eaab09ee95eba34a39870.tar.bz2
ilt-3b5450676b61efd2ee8eaab09ee95eba34a39870.tar.xz
ilt-3b5450676b61efd2ee8eaab09ee95eba34a39870.zip
Define some initial surface types
-rw-r--r--res/surfaces.xml7
-rw-r--r--test/test-assetFactory.cpp15
2 files changed, 22 insertions, 0 deletions
diff --git a/res/surfaces.xml b/res/surfaces.xml
new file mode 100644
index 0000000..459eb9c
--- /dev/null
+++ b/res/surfaces.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<ilt p.id="assetFactory">
+ <asset p.typeid="Surface" id="terrain.surface.gravel" name="Gravel" colorBias=".9,.9,.9" quality="1"/>
+ <asset p.typeid="Surface" id="terrain.surface.dirt" name="Dirt" colorBias=".38,.35,.25" quality=".1"/>
+ <asset p.typeid="Surface" id="terrain.surface.tarmac" name="Tarmac" colorBias=".1,.1,.1" quality="1"/>
+ <asset p.typeid="Surface" id="terrain.surface.concrete" name="Concrete" colorBias=".8,.8,.8" quality=".9"/>
+</ilt>
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index 8341fbf..6061723 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -12,6 +12,7 @@
#include "game/scenary/illuminator.h"
#include "game/scenary/light.h"
#include "game/scenary/plant.h"
+#include "game/surface.h"
#include "game/vehicles/railVehicle.h"
#include "game/vehicles/railVehicleClass.h"
#include "gfx/gl/sceneRenderer.h"
@@ -80,6 +81,20 @@ private:
BOOST_FIXTURE_TEST_SUITE(m, FactoryFixture);
+BOOST_AUTO_TEST_CASE(surfaces, *boost::unit_test::timeout(5))
+{
+ auto mf = AssetFactory::loadXML(RESDIR "/surfaces.xml");
+ BOOST_REQUIRE(mf);
+ BOOST_CHECK_EQUAL(4, mf->assets.size());
+ auto gravelAsset = mf->assets.at("terrain.surface.gravel");
+ BOOST_REQUIRE(gravelAsset);
+ auto gravel = std::dynamic_pointer_cast<Surface>(gravelAsset);
+ BOOST_REQUIRE(gravel);
+ BOOST_REQUIRE_EQUAL(gravel->name, "Gravel");
+ BOOST_REQUIRE_EQUAL(gravel->colorBias, RGB {.9F});
+ BOOST_REQUIRE_EQUAL(gravel->quality, 1.F);
+}
+
BOOST_AUTO_TEST_CASE(brush47xml, *boost::unit_test::timeout(5))
{
auto mf = AssetFactory::loadXML(RESDIR "/brush47.xml");