Added rendering tests for bruneton aerial paerspective
This commit is contained in:
parent
22a44540d9
commit
25a49f52d8
3 changed files with 84 additions and 1 deletions
|
@ -682,7 +682,7 @@ void renderPostProcess(RenderArea* area, int nbchunks)
|
|||
loops = 0;
|
||||
while ((y < ny && !area->renderer->render_interrupt) || running > 0)
|
||||
{
|
||||
timeSleepMs(100);
|
||||
timeSleepMs(50);
|
||||
|
||||
for (i = 0; i < nbchunks; i++)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@ extern void test_clouds_case(Suite* s);
|
|||
extern void test_render_case(Suite* s);
|
||||
extern void test_noise_case(Suite* s);
|
||||
extern void test_terrain_painting_case(Suite* s);
|
||||
extern void test_bruneton_case(Suite* s);
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -28,6 +29,7 @@ int main(int argc, char** argv)
|
|||
test_render_case(s);
|
||||
test_noise_case(s);
|
||||
test_terrain_painting_case(s);
|
||||
test_bruneton_case(s);
|
||||
|
||||
SRunner *sr = srunner_create(s);
|
||||
srunner_run_all(sr, CK_NORMAL);
|
||||
|
|
81
src/testing/test_bruneton.c
Normal file
81
src/testing/test_bruneton.c
Normal file
|
@ -0,0 +1,81 @@
|
|||
#include "testing/common.h"
|
||||
#include "rendering/system.h"
|
||||
#include "rendering/scenery.h"
|
||||
|
||||
#define OUTPUT_WIDTH 400
|
||||
#define OUTPUT_HEIGHT 300
|
||||
|
||||
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void* data)
|
||||
{
|
||||
return renderer->atmosphere->applyAerialPerspective(renderer, location, COLOR_BLACK).final;
|
||||
}
|
||||
|
||||
START_TEST(testBrunetonAerialPerspective)
|
||||
{
|
||||
Renderer* renderer = sceneryCreateStandardRenderer();
|
||||
renderer->render_width = 800;
|
||||
renderer->render_height = 600;
|
||||
renderer->render_quality = 1;
|
||||
|
||||
cameraSetLocation(renderer->render_camera, VECTOR_ZERO);
|
||||
cameraSetTarget(renderer->render_camera, VECTOR_EAST);
|
||||
cameraSetRenderSize(renderer->render_camera, renderer->render_width, renderer->render_height);
|
||||
|
||||
RenderParams params = {renderer->render_width, renderer->render_height, 1, 1};
|
||||
renderSetParams(renderer->render_area, params);
|
||||
renderSetBackgroundColor(renderer->render_area, &COLOR_BLACK);
|
||||
renderClear(renderer->render_area);
|
||||
|
||||
renderer->pushQuad(renderer, v3(50.0, -10.0, -50.0), v3(1.0, -10.0, -50.0), v3(1.0, -10.0, 50.0), v3(50.0, -10.0, 50.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(10.0, -10.0, -10.0), v3(10.0, -10.0, -5.0), v3(10.0, 50.0, -5.0), v3(10.0, 50.0, -10.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(15.0, -10.0, -5.0), v3(15.0, -10.0, 0.0), v3(15.0, 50.0, 0.0), v3(15.0, 50.0, -5.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(20.0, -10.0, 5.0), v3(20.0, -10.0, 10.0), v3(20.0, 50.0, 10.0), v3(20.0, 50.0, 5.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(30.0, -10.0, 25.0), v3(30.0, -10.0, 30.0), v3(30.0, 50.0, 30.0), v3(30.0, 50.0, 25.0), _postProcessFragment, NULL);
|
||||
renderPostProcess(renderer->render_area, tests_cpu_count);
|
||||
|
||||
renderSaveToFile(renderer->render_area, "./output/test_bruneton_perspective.png");
|
||||
|
||||
rendererDelete(renderer);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST(testBrunetonAerialPerspective1)
|
||||
{
|
||||
AtmosphereDefinition* atmo = AtmosphereDefinitionClass.create();
|
||||
sceneryGetAtmosphere(atmo);
|
||||
atmo->hour = 6;
|
||||
atmo->minute = 30;
|
||||
scenerySetAtmosphere(atmo);
|
||||
AtmosphereDefinitionClass.destroy(atmo);
|
||||
|
||||
Renderer* renderer = sceneryCreateStandardRenderer();
|
||||
renderer->render_width = 800;
|
||||
renderer->render_height = 600;
|
||||
renderer->render_quality = 1;
|
||||
|
||||
cameraSetLocation(renderer->render_camera, VECTOR_ZERO);
|
||||
cameraSetTarget(renderer->render_camera, VECTOR_EAST);
|
||||
cameraSetRenderSize(renderer->render_camera, renderer->render_width, renderer->render_height);
|
||||
|
||||
RenderParams params = {renderer->render_width, renderer->render_height, 1, 1};
|
||||
renderSetParams(renderer->render_area, params);
|
||||
renderSetBackgroundColor(renderer->render_area, &COLOR_BLACK);
|
||||
renderClear(renderer->render_area);
|
||||
|
||||
renderer->pushQuad(renderer, v3(50.0, -10.0, -50.0), v3(1.0, -10.0, -50.0), v3(1.0, -10.0, 50.0), v3(50.0, -10.0, 50.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(10.0, -10.0, -10.0), v3(10.0, -10.0, -5.0), v3(10.0, 50.0, -5.0), v3(10.0, 50.0, -10.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(15.0, -10.0, -5.0), v3(15.0, -10.0, 0.0), v3(15.0, 50.0, 0.0), v3(15.0, 50.0, -5.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(20.0, -10.0, 5.0), v3(20.0, -10.0, 10.0), v3(20.0, 50.0, 10.0), v3(20.0, 50.0, 5.0), _postProcessFragment, NULL);
|
||||
renderer->pushQuad(renderer, v3(30.0, -10.0, 25.0), v3(30.0, -10.0, 30.0), v3(30.0, 50.0, 30.0), v3(30.0, 50.0, 25.0), _postProcessFragment, NULL);
|
||||
renderPostProcess(renderer->render_area, tests_cpu_count);
|
||||
|
||||
renderSaveToFile(renderer->render_area, "./output/test_bruneton_perspective1.png");
|
||||
|
||||
rendererDelete(renderer);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
TEST_CASE(bruneton,
|
||||
testBrunetonAerialPerspective,
|
||||
testBrunetonAerialPerspective1)
|
||||
|
Loading…
Reference in a new issue