Added render test for canvas aliasing

This commit is contained in:
Michaël Lemaire 2016-02-01 18:28:46 +01:00
parent a54c8d5217
commit cf853f2019
2 changed files with 26 additions and 0 deletions

View file

@ -551,13 +551,38 @@ static void testCloudModels() {
}
}
static void testCanvasAliasing() {
class FakeRasterizer : public OverlayRasterizer {
public:
FakeRasterizer(SoftwareCanvasRenderer *renderer) : OverlayRasterizer(renderer) {
}
virtual Color processPixel(int x, int y, double relx, double rely) const override {
double d = sqrt(relx * relx + rely * rely);
double s = relx * 0.5 + rely;
return (x == y or x / 2 == y or y / 2 == x or (d > 0.8 and d < 0.9) or fabs(s) < 0.1) ? COLOR_BLACK : COLOR_WHITE.scaled(5.0);
}
};
Scenery scenery;
SoftwareCanvasRenderer renderer(&scenery);
FakeRasterizer rasterizer(&renderer);
renderer.setSoloRasterizer(&rasterizer);
for (int i = 0; i < 6; i++) {
renderer.setSize(400, 400, i + 1);
startTestRender(&renderer, "canvas_aliasing", i);
}
}
void runTestSuite() {
testNoise();
testCanvasAliasing();
testTextures();
testGodRays();
testCelestialBodies();
testNearFrustum();
testCloudsLighting();
testCloudModels();
testCloudsNearGround();
testVegetationModels();
testOpenGLVegetationImpostor();

View file

@ -116,6 +116,7 @@ void SoftwareCanvasRenderer::render() {
progress->exitSub();
progress->end();
finished = true;
started = false;
}
void SoftwareCanvasRenderer::interrupt() {