Removed size information from SoftwareRenderer + removed full render tests
This commit is contained in:
parent
0c48fb075f
commit
1bf6d9382b
6 changed files with 0 additions and 181 deletions
|
@ -45,8 +45,6 @@ void SoftwareCanvasRenderer::render()
|
||||||
{
|
{
|
||||||
// TEMP
|
// TEMP
|
||||||
started = true;
|
started = true;
|
||||||
render_width = canvas->getWidth();
|
|
||||||
render_height = canvas->getHeight();
|
|
||||||
render_quality = 3;
|
render_quality = 3;
|
||||||
|
|
||||||
render_camera->setRenderSize(canvas->getWidth(), canvas->getHeight());
|
render_camera->setRenderSize(canvas->getWidth(), canvas->getHeight());
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
SoftwareRenderer::SoftwareRenderer(Scenery* scenery)
|
SoftwareRenderer::SoftwareRenderer(Scenery* scenery)
|
||||||
{
|
{
|
||||||
render_quality = 5;
|
render_quality = 5;
|
||||||
render_width = 1;
|
|
||||||
render_height = 1;
|
|
||||||
render_interrupt = 0;
|
render_interrupt = 0;
|
||||||
render_progress = 0.0;
|
render_progress = 0.0;
|
||||||
is_rendering = 0;
|
is_rendering = 0;
|
||||||
|
|
|
@ -20,8 +20,6 @@ public:
|
||||||
|
|
||||||
/* Render base configuration */
|
/* Render base configuration */
|
||||||
int render_quality;
|
int render_quality;
|
||||||
int render_width;
|
|
||||||
int render_height;
|
|
||||||
CameraDefinition* render_camera;
|
CameraDefinition* render_camera;
|
||||||
|
|
||||||
/* Render related */
|
/* Render related */
|
||||||
|
|
|
@ -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");*/
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
#include "BaseTestCase.h"
|
|
||||||
|
|
||||||
#include <cmath>
|
|
||||||
#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");
|
|
||||||
}
|
|
|
@ -10,11 +10,9 @@ SOURCES += main.cpp \
|
||||||
Layers_Test.cpp \
|
Layers_Test.cpp \
|
||||||
PackStream_Test.cpp \
|
PackStream_Test.cpp \
|
||||||
NoiseGenerator_Test.cpp \
|
NoiseGenerator_Test.cpp \
|
||||||
Render_Test.cpp \
|
|
||||||
TerrainPainting_Test.cpp \
|
TerrainPainting_Test.cpp \
|
||||||
Zone_Test.cpp \
|
Zone_Test.cpp \
|
||||||
Euclid_Test.cpp \
|
Euclid_Test.cpp \
|
||||||
Bruneton_Test.cpp \
|
|
||||||
Camera_Test.cpp \
|
Camera_Test.cpp \
|
||||||
Clouds_Test.cpp \
|
Clouds_Test.cpp \
|
||||||
FluidMediumManager_Test.cpp \
|
FluidMediumManager_Test.cpp \
|
||||||
|
|
Loading…
Reference in a new issue