summaryrefslogtreecommitdiff
path: root/test/test-render.cpp
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 13:51:33 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 14:14:13 +0000
commit7fba471728f2216d7e3b7900297fc3b3531e286c (patch)
tree5caef3b2efc23aefccb215ec9005cd8e7d2e91b8 /test/test-render.cpp
parentFix todo for handling a terrain walk from outside the mesh (diff)
parentModel positions as integers (diff)
downloadilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.bz2
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.tar.xz
ilt-7fba471728f2216d7e3b7900297fc3b3531e286c.zip
Merge branch 'ints' into terrain
Conflicts fix, compiles, some test failures remain. Trees not added, possibility of OM invalid handle assertion failures, normals broken due to integer overflow in Newell's method.
Diffstat (limited to 'test/test-render.cpp')
-rw-r--r--test/test-render.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/test-render.cpp b/test/test-render.cpp
index fb2a71b..f15e51e 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -26,7 +26,7 @@ class TestScene : public SceneProvider {
std::shared_ptr<RailVehicle> train1, train2;
Terrain terrain {[]() {
- auto gd = std::make_shared<GeoData>(GeoData::createFlat({0, 0}, {1000, 1000}, 1));
+ auto gd = std::make_shared<GeoData>(GeoData::createFlat({0, 0}, {1000000, 1000000}, 1));
return gd;
}()};
@@ -34,11 +34,11 @@ public:
TestScene()
{
train1 = std::make_shared<RailVehicle>(brush47rvc);
- train1->location.setPosition({52, 50, 2});
+ train1->location.setPosition({52000, 50000, 2000});
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.setPosition({52, 30, 2});
+ train2->location.setPosition({52000, 30000, 2000});
train2->bogies.front().setPosition(train2->bogies.front().position() + train2->location.position());
train2->bogies.back().setPosition(train2->bogies.back().position() + train2->location.position());
}
@@ -87,7 +87,7 @@ BOOST_FIXTURE_TEST_SUITE(w, TestRenderOutput);
BOOST_AUTO_TEST_CASE(basic)
{
SceneRenderer ss {size, output};
- ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
const TestScene scene;
ss.render(scene);
Texture::save(outImage, "/tmp/basic.tga");
@@ -96,7 +96,7 @@ BOOST_AUTO_TEST_CASE(basic)
BOOST_AUTO_TEST_CASE(pointlight)
{
SceneRenderer ss {size, output};
- ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
class PointLightScene : public TestScene {
public:
@@ -110,9 +110,9 @@ BOOST_AUTO_TEST_CASE(pointlight)
void
lights(const SceneShader & shader) const override
{
- for (int x = 50; x < 100; x += 20) {
- for (int y = 50; y < 2000; y += 20) {
- shader.pointLight.add({x, y, 4}, {1.0, 1.0, 1.0}, 0.1F);
+ for (int x = 50000; x < 100000; x += 20000) {
+ for (int y = 50000; y < 2000000; y += 20000) {
+ shader.pointLight.add({x, y, 4000}, {1.0, 1.0, 1.0}, 0.1F);
}
}
}
@@ -126,7 +126,7 @@ BOOST_AUTO_TEST_CASE(pointlight)
BOOST_AUTO_TEST_CASE(spotlight)
{
SceneRenderer ss {size, output};
- ss.camera.setView({-10, -10, 60}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
+ ss.camera.setView({-10000, -10000, 60000}, glm::normalize(glm::vec3 {1, 1, -0.5F}));
class PointLightScene : public TestScene {
public:
@@ -140,10 +140,10 @@ BOOST_AUTO_TEST_CASE(spotlight)
void
lights(const SceneShader & shader) const override
{
- shader.spotLight.add({50, 50, 15}, down, {1.0, 1.0, 1.0}, 0.01F, 1);
- shader.spotLight.add({51, 59.5, 1}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
- shader.spotLight.add({53, 59.5, 1}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
- shader.spotLight.add({60, 50, 3}, north + east, {1.0, 1.0, 1.0}, 0.0001F, .7F);
+ shader.spotLight.add({50000, 50000, 15000}, down, {1.0, 1.0, 1.0}, 0.01F, 1);
+ shader.spotLight.add({51000, 59500, 1000}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
+ shader.spotLight.add({53000, 59500, 1000}, north, {1.0, 1.0, 1.0}, 0.001F, .5);
+ shader.spotLight.add({60000, 50000, 3000}, north + east, {1.0, 1.0, 1.0}, 0.0001F, .7F);
}
};