2013-12-05 15:44:18 +00:00
|
|
|
#ifndef TERRAINRASTERIZER_H
|
|
|
|
#define TERRAINRASTERIZER_H
|
|
|
|
|
|
|
|
#include "software_global.h"
|
|
|
|
|
2014-06-05 15:12:49 +00:00
|
|
|
#include "Rasterizer.h"
|
2013-12-05 15:44:18 +00:00
|
|
|
#include "Vector3.h"
|
|
|
|
|
|
|
|
namespace paysages {
|
|
|
|
namespace software {
|
|
|
|
|
2014-06-05 15:12:49 +00:00
|
|
|
class SOFTWARESHARED_EXPORT TerrainRasterizer: public Rasterizer
|
2013-12-05 15:44:18 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
Vector3 point_nw;
|
|
|
|
Vector3 point_sw;
|
|
|
|
Vector3 point_se;
|
|
|
|
Vector3 point_ne;
|
|
|
|
int detail_hint;
|
|
|
|
} TerrainChunkInfo;
|
|
|
|
|
|
|
|
public:
|
2014-06-12 15:45:59 +00:00
|
|
|
TerrainRasterizer(SoftwareRenderer* renderer, int client_id);
|
2013-12-05 15:44:18 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Method called for each chunk tessellated by getTessellationInfo.
|
|
|
|
*/
|
|
|
|
int processChunk(TerrainChunkInfo* chunk, double progress);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tessellate the terrain, calling processChunk for each chunk.
|
|
|
|
*
|
|
|
|
* The terrain will be broken in chunks, most detailed near the camera.
|
|
|
|
*/
|
|
|
|
void getTessellationInfo(int displaced);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Tessellate a terrain chunk, pushing the quads in the render area.
|
|
|
|
*/
|
|
|
|
void tessellateChunk(TerrainChunkInfo* chunk, int detail);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Start the final rasterization of terrain.
|
|
|
|
*
|
|
|
|
* This will push the rasterized quads in the render area, waiting for post process.
|
|
|
|
*/
|
2014-06-12 15:45:59 +00:00
|
|
|
virtual void rasterize();
|
2013-12-05 15:44:18 +00:00
|
|
|
|
2014-06-18 18:10:05 +00:00
|
|
|
virtual void rasterizeToCanvas(CanvasPortion* canvas);
|
|
|
|
|
2013-12-05 15:44:18 +00:00
|
|
|
private:
|
2014-01-02 14:08:00 +00:00
|
|
|
ParallelQueue* queue;
|
2013-12-05 15:44:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TERRAINRASTERIZER_H
|