summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-assetFactory.cpp2
-rw-r--r--test/test-geoData.cpp2
-rw-r--r--test/test-render.cpp14
-rw-r--r--test/test-ui.cpp4
-rw-r--r--test/testRenderOutput.cpp16
-rw-r--r--test/testRenderOutput.h2
6 files changed, 19 insertions, 21 deletions
diff --git a/test/test-assetFactory.cpp b/test/test-assetFactory.cpp
index fee1822..90fae9b 100644
--- a/test/test-assetFactory.cpp
+++ b/test/test-assetFactory.cpp
@@ -38,7 +38,7 @@ namespace {
auto outpath = (ANALYSIS_DIRECTORY / boost::unit_test::framework::current_test_case().full_name())
.replace_extension(".tga");
std::filesystem::create_directories(outpath.parent_path());
- Texture::save(outImage, outpath.c_str());
+ outImage.saveColour(outpath.c_str());
}
void
diff --git a/test/test-geoData.cpp b/test/test-geoData.cpp
index 80d3a08..e489925 100644
--- a/test/test-geoData.cpp
+++ b/test/test-geoData.cpp
@@ -300,7 +300,7 @@ BOOST_DATA_TEST_CASE(Deform, loadFixtureJson<DeformTerrainData>("geoData/deform/
std::for_each(cams.begin(), cams.end(), [&renderer, &terrain, &tro](const auto & cam) {
renderer.camera.setView(cam.first.first, glm::normalize(cam.first.second));
BOOST_CHECK_NO_THROW(renderer.render(terrain));
- Texture::save(tro.outImage, (ANALYSIS_DIRECTORY / cam.second).c_str());
+ tro.outImage.saveColour((ANALYSIS_DIRECTORY / cam.second).c_str());
});
}
diff --git a/test/test-render.cpp b/test/test-render.cpp
index 1a6e1ae..0b47ce8 100644
--- a/test/test-render.cpp
+++ b/test/test-render.cpp
@@ -165,10 +165,10 @@ BOOST_AUTO_TEST_CASE(Basic)
saveBuffers(const std::filesystem::path & prefix) const
{
std::filesystem::create_directories(prefix);
- Texture::save(gAlbedoSpec, (prefix / "albedo.tga").c_str());
- Texture::savePosition(gPosition, (prefix / "position.tga").c_str());
- Texture::saveNormal(gNormal, (prefix / "normal.tga").c_str());
- Texture::save(gIllumination, (prefix / "illumination.tga").c_str());
+ gAlbedoSpec.saveColour((prefix / "albedo.tga").c_str());
+ gPosition.savePosition((prefix / "position.tga").c_str());
+ gNormal.saveNormal((prefix / "normal.tga").c_str());
+ gIllumination.saveColour((prefix / "illumination.tga").c_str());
}
};
@@ -178,7 +178,7 @@ BOOST_AUTO_TEST_CASE(Basic)
renderer.preFrame(scene, gameState.environment->getSunPos());
renderer.render(scene);
renderer.saveBuffers(ANALYSIS_DIRECTORY / "basic");
- Texture::save(outImage, (ANALYSIS_DIRECTORY / "basic/final.tga").c_str());
+ outImage.saveColour((ANALYSIS_DIRECTORY / "basic/final.tga").c_str());
}
BOOST_AUTO_TEST_CASE(TerrainSD19)
@@ -227,7 +227,7 @@ BOOST_AUTO_TEST_CASE(TerrainSD19)
TestTerrain testTerrain;
renderer.preFrame(testTerrain, gameState.environment->getSunPos());
renderer.render(testTerrain);
- Texture::save(outImage, (ANALYSIS_DIRECTORY / "terrain.tga").c_str());
+ outImage.saveColour((ANALYSIS_DIRECTORY / "terrain.tga").c_str());
}
BOOST_AUTO_TEST_CASE(RailNetwork)
@@ -279,7 +279,7 @@ BOOST_AUTO_TEST_CASE(RailNetwork)
};
renderer.render(TestRail {});
- Texture::save(outImage, (ANALYSIS_DIRECTORY / "railnet.tga").c_str());
+ outImage.saveColour((ANALYSIS_DIRECTORY / "railnet.tga").c_str());
}
BOOST_AUTO_TEST_SUITE_END();
diff --git a/test/test-ui.cpp b/test/test-ui.cpp
index c648c2c..74953b3 100644
--- a/test/test-ui.cpp
+++ b/test/test-ui.cpp
@@ -16,6 +16,6 @@ BOOST_AUTO_TEST_CASE(LoadFromFile)
{
SvgIcon svg(ImageDimensions {RENDER_SIZE}, Resource::mapPath("ui/icon/rails.svg"));
const auto size = svg.texture.getSize();
- BOOST_CHECK_EQUAL(size, TextureDimensions(RENDER_SIZE, RENDER_SIZE, 1));
- Texture::save(svg.texture, (ANALYSIS_DIRECTORY / "rails.tga").c_str());
+ BOOST_CHECK_EQUAL(size, ImageDimensions(RENDER_SIZE, RENDER_SIZE));
+ svg.texture.saveColour((ANALYSIS_DIRECTORY / "rails.tga").c_str());
}
diff --git a/test/testRenderOutput.cpp b/test/testRenderOutput.cpp
index 7243032..b86469a 100644
--- a/test/testRenderOutput.cpp
+++ b/test/testRenderOutput.cpp
@@ -5,15 +5,13 @@
TestRenderOutput::TestRenderOutput(TextureAbsCoord outputSize) : size {outputSize}
{
glBindFramebuffer(GL_FRAMEBUFFER, output);
- const auto configuregdata
- = [this](glTexture & data, const GLint format, const GLenum type, const GLenum attachment) {
- data.bind();
- glTexImage2D(GL_TEXTURE_2D, 0, format, size.x, size.y, 0, GL_RGBA, type, nullptr);
- data.parameter(GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- data.parameter(GL_TEXTURE_MAG_FILTER, GL_NEAREST);
- glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, data, 0);
- };
- configuregdata(outImage, GL_RGBA, GL_UNSIGNED_BYTE, GL_COLOR_ATTACHMENT0);
+ const auto configuregdata = [this](glTexture<GL_TEXTURE_2D> & data, const GLenum format, const GLenum attachment) {
+ data.storage(1, format, size);
+ data.parameter(GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ data.parameter(GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glFramebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, data, 0);
+ };
+ configuregdata(outImage, GL_RGBA8, GL_COLOR_ATTACHMENT0);
glDrawBuffer(GL_COLOR_ATTACHMENT0);
glBindRenderbuffer(GL_RENDERBUFFER, depth);
diff --git a/test/testRenderOutput.h b/test/testRenderOutput.h
index 79908b1..248485c 100644
--- a/test/testRenderOutput.h
+++ b/test/testRenderOutput.h
@@ -17,7 +17,7 @@ public:
const TextureAbsCoord size;
glFrameBuffer output;
glRenderBuffer depth;
- glTexture outImage;
+ glTexture<GL_TEXTURE_2D> outImage;
GameState gameState;
};