From 1bf6d9382bfcc982385337930996876135055ed7 Mon Sep 17 00:00:00 2001 From: Michael Lemaire Date: Tue, 19 Aug 2014 12:22:27 +0200 Subject: [PATCH] Removed size information from SoftwareRenderer + removed full render tests --- .../software/SoftwareCanvasRenderer.cpp | 2 - src/render/software/SoftwareRenderer.cpp | 2 - src/render/software/SoftwareRenderer.h | 2 - src/tests/Bruneton_Test.cpp | 83 ----------------- src/tests/Render_Test.cpp | 90 ------------------- src/tests/tests.pro | 2 - 6 files changed, 181 deletions(-) delete mode 100644 src/tests/Bruneton_Test.cpp delete mode 100644 src/tests/Render_Test.cpp diff --git a/src/render/software/SoftwareCanvasRenderer.cpp b/src/render/software/SoftwareCanvasRenderer.cpp index 3d417a3..87e45da 100644 --- a/src/render/software/SoftwareCanvasRenderer.cpp +++ b/src/render/software/SoftwareCanvasRenderer.cpp @@ -45,8 +45,6 @@ void SoftwareCanvasRenderer::render() { // TEMP started = true; - render_width = canvas->getWidth(); - render_height = canvas->getHeight(); render_quality = 3; render_camera->setRenderSize(canvas->getWidth(), canvas->getHeight()); diff --git a/src/render/software/SoftwareRenderer.cpp b/src/render/software/SoftwareRenderer.cpp index 3ab791b..a12f762 100644 --- a/src/render/software/SoftwareRenderer.cpp +++ b/src/render/software/SoftwareRenderer.cpp @@ -23,8 +23,6 @@ SoftwareRenderer::SoftwareRenderer(Scenery* scenery) { render_quality = 5; - render_width = 1; - render_height = 1; render_interrupt = 0; render_progress = 0.0; is_rendering = 0; diff --git a/src/render/software/SoftwareRenderer.h b/src/render/software/SoftwareRenderer.h index cb6b278..3ddc34a 100644 --- a/src/render/software/SoftwareRenderer.h +++ b/src/render/software/SoftwareRenderer.h @@ -20,8 +20,6 @@ public: /* Render base configuration */ int render_quality; - int render_width; - int render_height; CameraDefinition* render_camera; /* Render related */ diff --git a/src/tests/Bruneton_Test.cpp b/src/tests/Bruneton_Test.cpp deleted file mode 100644 index dcce68a..0000000 --- a/src/tests/Bruneton_Test.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include "BaseTestCase.h" - -#include "CameraDefinition.h" -#include "SoftwareRenderer.h" -#include "AtmosphereDefinition.h" -#include "AtmosphereRenderer.h" -#include "AtmosphereResult.h" -#include "Scenery.h" -#include "System.h" - -#define OUTPUT_WIDTH 400 -#define OUTPUT_HEIGHT 300 - -static Color _postProcessFragment(SoftwareRenderer* renderer, const Vector3 &location, void*) -{ - return renderer->getAtmosphereRenderer()->applyAerialPerspective(location, COLOR_BLACK).final; -} - -TEST(Bruneton, AerialPerspective1) -{ -#ifndef TESTS_FULL - return; -#endif - Scenery scenery; - SoftwareRenderer renderer(&scenery); - renderer.render_width = 800; - renderer.render_height = 600; - renderer.render_quality = 1; - - renderer.render_camera->setLocation(VECTOR_ZERO); - renderer.render_camera->setTarget(VECTOR_EAST); - renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height); - - /*RenderArea::RenderParams params = {renderer.render_width, renderer.render_height, 1, 1}; - renderer.render_area->setParams(params); - renderer.render_area->setBackgroundColor(COLOR_BLACK); - renderer.render_area->clear(); - - renderer.pushQuad(Vector3(50.0, -10.0, -50.0), Vector3(1.0, -10.0, -50.0), Vector3(1.0, -10.0, 50.0), Vector3(50.0, -10.0, 50.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(10.0, -10.0, -10.0), Vector3(10.0, -10.0, -5.0), Vector3(10.0, 50.0, -5.0), Vector3(10.0, 50.0, -10.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(15.0, -10.0, -5.0), Vector3(15.0, -10.0, 0.0), Vector3(15.0, 50.0, 0.0), Vector3(15.0, 50.0, -5.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(20.0, -10.0, 5.0), Vector3(20.0, -10.0, 10.0), Vector3(20.0, 50.0, 10.0), Vector3(20.0, 50.0, 5.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(30.0, -10.0, 25.0), Vector3(30.0, -10.0, 30.0), Vector3(30.0, 50.0, 30.0), Vector3(30.0, 50.0, 25.0), _postProcessFragment, NULL); - renderer.render_area->postProcess(System::getCoreCount()); - - renderer.render_area->saveToFile("./output/test_bruneton_perspective.png");*/ -} - -TEST(Bruneton, AerialPerspective2) -{ -#ifndef TESTS_FULL - return; -#endif - Scenery scenery; - - AtmosphereDefinition* atmo = scenery.getAtmosphere(); - atmo->hour = 6; - atmo->minute = 30; - atmo->validate(); - - SoftwareRenderer renderer(&scenery); - renderer.render_width = 800; - renderer.render_height = 600; - renderer.render_quality = 1; - - renderer.render_camera->setLocation(VECTOR_ZERO); - renderer.render_camera->setTarget(VECTOR_EAST); - renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height); - - /*RenderArea::RenderParams params = {renderer.render_width, renderer.render_height, 1, 1}; - renderer.render_area->setParams(params); - renderer.render_area->setBackgroundColor(COLOR_BLACK); - renderer.render_area->clear(); - - renderer.pushQuad(Vector3(50.0, -10.0, -50.0), Vector3(1.0, -10.0, -50.0), Vector3(1.0, -10.0, 50.0), Vector3(50.0, -10.0, 50.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(10.0, -10.0, -10.0), Vector3(10.0, -10.0, -5.0), Vector3(10.0, 50.0, -5.0), Vector3(10.0, 50.0, -10.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(15.0, -10.0, -5.0), Vector3(15.0, -10.0, 0.0), Vector3(15.0, 50.0, 0.0), Vector3(15.0, 50.0, -5.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(20.0, -10.0, 5.0), Vector3(20.0, -10.0, 10.0), Vector3(20.0, 50.0, 10.0), Vector3(20.0, 50.0, 5.0), _postProcessFragment, NULL); - renderer.pushQuad(Vector3(30.0, -10.0, 25.0), Vector3(30.0, -10.0, 30.0), Vector3(30.0, 50.0, 30.0), Vector3(30.0, 50.0, 25.0), _postProcessFragment, NULL); - renderer.render_area->postProcess(System::getCoreCount()); - - renderer.render_area->saveToFile("./output/test_bruneton_perspective1.png");*/ -} diff --git a/src/tests/Render_Test.cpp b/src/tests/Render_Test.cpp deleted file mode 100644 index a98803d..0000000 --- a/src/tests/Render_Test.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "BaseTestCase.h" - -#include -#include "SoftwareRenderer.h" -#include "CameraDefinition.h" -#include "ColorProfile.h" -#include "System.h" - -static Color _postProcessFragment(SoftwareRenderer*, const Vector3 &location, void*) -{ - /* Checker-board */ - double x = fmod(location.x, 0.2); - double z = fmod(location.z, 0.2); - if (x < 0.0) - { - x = 0.2 + x; - } - if (z < 0.0) - { - z = 0.2 + z; - } - if ((x > 0.1) ^ (z > 0.1)) - { - return COLOR_WHITE; - } - else - { - return COLOR_BLACK; - } -} - -static void _render_quad_checker(SoftwareRenderer &renderer) -{ - renderer.render_width = 800; - renderer.render_height = 600; - renderer.render_quality = 1; - //renderer.render_area->setToneMapping(ColorProfile(ColorProfile::TONE_MAPPING_CLAMP, 0.0)); - - renderer.render_camera->setRenderSize(renderer.render_width, renderer.render_height); - renderer.render_camera->setFov(1.57); - - /*RenderConfig params(renderer.render_width, renderer.render_height, 1, 1); - renderer.render_area->setParams(params); - - renderer.render_area->setBackgroundColor(COLOR_BLUE); - renderer.render_area->clear(); - - 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());*/ -} - -TEST(Render, quad) -{ -#ifndef TESTS_FULL - return; -#endif - 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); - ASSERT_COLOR_RGBA(col, 1.0, 1.0, 1.0, 1.0); - col = renderer.render_area->getPixel(399, 599 - 436); - ASSERT_COLOR_RGBA(col, 0.0, 0.0, 0.0, 1.0); - col = renderer.render_area->getPixel(400, 599 - 435); - ASSERT_COLOR_RGBA(col, 0.0, 0.0, 0.0, 1.0); - col = renderer.render_area->getPixel(400, 599 - 436); - ASSERT_COLOR_RGBA(col, 1.0, 1.0, 1.0, 1.0); - - renderer.render_area->saveToFile("./output/test_render_quad.png");*/ -} - -TEST(Render, quad_cut) -{ -#ifndef TESTS_FULL - return; -#endif - 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"); -} diff --git a/src/tests/tests.pro b/src/tests/tests.pro index 481b17a..f01b4e3 100644 --- a/src/tests/tests.pro +++ b/src/tests/tests.pro @@ -10,11 +10,9 @@ SOURCES += main.cpp \ Layers_Test.cpp \ PackStream_Test.cpp \ NoiseGenerator_Test.cpp \ - Render_Test.cpp \ TerrainPainting_Test.cpp \ Zone_Test.cpp \ Euclid_Test.cpp \ - Bruneton_Test.cpp \ Camera_Test.cpp \ Clouds_Test.cpp \ FluidMediumManager_Test.cpp \