Refactored water rasterizer

This commit is contained in:
Michaël Lemaire 2013-12-08 18:05:18 +01:00
parent 6bb03c5957
commit 50d499d10f
6 changed files with 41 additions and 13 deletions

View file

@ -8,6 +8,7 @@
#include "CloudsRenderer.h" #include "CloudsRenderer.h"
#include "SkyRasterizer.h" #include "SkyRasterizer.h"
#include "TerrainRasterizer.h" #include "TerrainRasterizer.h"
#include "WaterRasterizer.h"
// Legacy compatibility // Legacy compatibility
@ -137,7 +138,8 @@ void SoftwareRenderer::rasterize()
TerrainRasterizer terrain(this); TerrainRasterizer terrain(this);
terrain.renderSurface(); terrain.renderSurface();
waterRenderSurface(this); WaterRasterizer water(this);
water.renderSurface();
SkyRasterizer sky(this); SkyRasterizer sky(this);
sky.rasterize(); sky.rasterize();

View file

@ -1,9 +1,13 @@
#include "public.h" #include "WaterRasterizer.h"
#include "private.h"
#include <cmath> #include "SoftwareRenderer.h"
#include "../renderer.h" #include "water/public.h"
#include "../tools/parallel.h" #include "tools/parallel.h"
WaterRasterizer::WaterRasterizer(SoftwareRenderer* renderer):
renderer(renderer)
{
}
static Color _postProcessFragment(Renderer* renderer, Vector3 location, void*) static Color _postProcessFragment(Renderer* renderer, Vector3 location, void*)
{ {
@ -35,7 +39,7 @@ static void _renderQuad(Renderer* renderer, double x, double z, double size)
typedef struct typedef struct
{ {
Renderer* renderer; SoftwareRenderer* renderer;
int i; int i;
double cx; double cx;
double cz; double cz;
@ -60,7 +64,7 @@ static int _parallelJobCallback(ParallelQueue*, int, void* data, int stopping)
return 0; return 0;
} }
void waterRenderSurface(Renderer* renderer) void WaterRasterizer::renderSurface()
{ {
ParallelRasterInfo* info; ParallelRasterInfo* info;
ParallelQueue* queue; ParallelQueue* queue;

View file

@ -0,0 +1,23 @@
#ifndef WATERRASTERIZER_H
#define WATERRASTERIZER_H
#include "software_global.h"
namespace paysages {
namespace software {
class WaterRasterizer
{
public:
WaterRasterizer(SoftwareRenderer* renderer);
void renderSurface();
private:
SoftwareRenderer* renderer;
};
}
}
#endif // WATERRASTERIZER_H

View file

@ -23,7 +23,8 @@ SOURCES += SoftwareRenderer.cpp \
CloudBasicLayerRenderer.cpp \ CloudBasicLayerRenderer.cpp \
clouds/BaseCloudsModel.cpp \ clouds/BaseCloudsModel.cpp \
clouds/CloudModelStratoCumulus.cpp \ clouds/CloudModelStratoCumulus.cpp \
TerrainRasterizer.cpp TerrainRasterizer.cpp \
WaterRasterizer.cpp
HEADERS += SoftwareRenderer.h\ HEADERS += SoftwareRenderer.h\
software_global.h \ software_global.h \
@ -36,7 +37,8 @@ HEADERS += SoftwareRenderer.h\
CloudBasicLayerRenderer.h \ CloudBasicLayerRenderer.h \
clouds/BaseCloudsModel.h \ clouds/BaseCloudsModel.h \
clouds/CloudModelStratoCumulus.h \ clouds/CloudModelStratoCumulus.h \
TerrainRasterizer.h TerrainRasterizer.h \
WaterRasterizer.h
unix:!symbian { unix:!symbian {
maemo5 { maemo5 {

View file

@ -24,7 +24,6 @@ SOURCES += main.cpp \
tools/data.cpp \ tools/data.cpp \
tools/cache.cpp \ tools/cache.cpp \
water/wat_render.cpp \ water/wat_render.cpp \
water/wat_raster.cpp \
RenderingScenery.cpp RenderingScenery.cpp
HEADERS += \ HEADERS += \

View file

@ -33,8 +33,6 @@ public:
RENDERINGSHARED_EXPORT extern StandardRenderer WaterRendererClass; RENDERINGSHARED_EXPORT extern StandardRenderer WaterRendererClass;
RENDERINGSHARED_EXPORT void waterRenderSurface(Renderer* renderer);
RENDERINGSHARED_EXPORT void waterAlterPreviewCoverageRenderer(Renderer* renderer); RENDERINGSHARED_EXPORT void waterAlterPreviewCoverageRenderer(Renderer* renderer);
RENDERINGSHARED_EXPORT Color waterGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int highlight_enabled); RENDERINGSHARED_EXPORT Color waterGetPreviewCoverage(Renderer* renderer, double x, double y, double scaling, int highlight_enabled);