Add a test for scanlines cutting
This commit is contained in:
parent
879f88fd20
commit
a59d8f2cc6
1 changed files with 24 additions and 6 deletions
|
@ -29,18 +29,13 @@ static Color _postProcessFragment(SoftwareRenderer*, Vector3 location, void*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Render, quad)
|
static void _render_quad_checker(SoftwareRenderer &renderer)
|
||||||
{
|
{
|
||||||
Color col;
|
|
||||||
SoftwareRenderer renderer;
|
|
||||||
|
|
||||||
renderer.render_width = 800;
|
renderer.render_width = 800;
|
||||||
renderer.render_height = 600;
|
renderer.render_height = 600;
|
||||||
renderer.render_quality = 1;
|
renderer.render_quality = 1;
|
||||||
renderer.render_area->setToneMapping(ColorProfile(ColorProfile::TONE_MAPPING_CLAMP, 0.0));
|
renderer.render_area->setToneMapping(ColorProfile(ColorProfile::TONE_MAPPING_CLAMP, 0.0));
|
||||||
|
|
||||||
renderer.render_camera->setLocationCoords(0.0, 0.5, 2.0);
|
|
||||||
renderer.render_camera->setTargetCoords(0.0, 0.5, 0.0);
|
|
||||||
renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height);
|
renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height);
|
||||||
|
|
||||||
RenderArea::RenderParams params = {renderer.render_width, renderer.render_height, 1, 1};
|
RenderArea::RenderParams params = {renderer.render_width, renderer.render_height, 1, 1};
|
||||||
|
@ -51,7 +46,18 @@ TEST(Render, quad)
|
||||||
|
|
||||||
renderer.pushQuad(Vector3(-1.0, 0.0, 1.0), Vector3(-1.0, 0.0, -1.0), Vector3(1.0, 0.0, -1.0), Vector3(1.0, 0.0, 1.0), _postProcessFragment, NULL);
|
renderer.pushQuad(Vector3(-1.0, 0.0, 1.0), Vector3(-1.0, 0.0, -1.0), Vector3(1.0, 0.0, -1.0), Vector3(1.0, 0.0, 1.0), _postProcessFragment, NULL);
|
||||||
renderer.render_area->postProcess(System::getCoreCount());
|
renderer.render_area->postProcess(System::getCoreCount());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(Render, quad)
|
||||||
|
{
|
||||||
|
SoftwareRenderer renderer;
|
||||||
|
|
||||||
|
renderer.render_camera->setLocationCoords(0.0, 0.5, 2.0);
|
||||||
|
renderer.render_camera->setTargetCoords(0.0, 0.5, 0.0);
|
||||||
|
|
||||||
|
_render_quad_checker(renderer);
|
||||||
|
|
||||||
|
Color col;
|
||||||
col = renderer.render_area->getPixel(399, 599 - 435);
|
col = renderer.render_area->getPixel(399, 599 - 435);
|
||||||
ASSERT_COLOR_RGBA(col, 1.0, 1.0, 1.0, 1.0);
|
ASSERT_COLOR_RGBA(col, 1.0, 1.0, 1.0, 1.0);
|
||||||
col = renderer.render_area->getPixel(399, 599 - 436);
|
col = renderer.render_area->getPixel(399, 599 - 436);
|
||||||
|
@ -63,3 +69,15 @@ TEST(Render, quad)
|
||||||
|
|
||||||
renderer.render_area->saveToFile("./output/test_render_quad.png");
|
renderer.render_area->saveToFile("./output/test_render_quad.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Render, quad_cut)
|
||||||
|
{
|
||||||
|
SoftwareRenderer renderer;
|
||||||
|
|
||||||
|
renderer.render_camera->setLocationCoords(0.8, 0.7, 1.0);
|
||||||
|
renderer.render_camera->setTargetCoords(0.0, 0.0, -0.5);
|
||||||
|
|
||||||
|
_render_quad_checker(renderer);
|
||||||
|
|
||||||
|
renderer.render_area->saveToFile("./output/test_render_quad_cut.png");
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue