Fixed render progress + added terrain raster progress

This commit is contained in:
Michaël Lemaire 2013-06-27 12:15:30 +02:00
parent 56b1a0d97f
commit 71d0eaacd0
2 changed files with 8 additions and 3 deletions

View file

@ -311,8 +311,7 @@ static void _processDirtyPixels(RenderArea* area)
} }
} }
double progress = 0.1 + ((double)area->pixel_done / (double)area->pixel_count) * 0.9; area->callback_update(area->renderer->render_progress);
area->callback_update(progress);
area->dirty_left = area->params.width * area->params.antialias; area->dirty_left = area->params.width * area->params.antialias;
area->dirty_right = -1; area->dirty_right = -1;
@ -700,6 +699,8 @@ void renderPostProcess(RenderArea* area, int nbchunks)
} }
} }
area->renderer->render_progress = 0.1 + ((double)area->pixel_done / (double)area->pixel_count) * 0.9;
if (y < ny && !chunks[i].thread && !area->renderer->render_interrupt) if (y < ny && !chunks[i].thread && !area->renderer->render_interrupt)
{ {
chunks[i].finished = 0; chunks[i].finished = 0;

View file

@ -154,13 +154,14 @@ void terrainGetTessellationInfo(Renderer* renderer, FuncTerrainTessellationCallb
radius_int = 0.0; radius_int = 0.0;
radius_ext = base_chunk_size; radius_ext = base_chunk_size;
chunk_size = base_chunk_size; chunk_size = base_chunk_size;
progress = 0.0; /* TODO */ progress = 0.0;
double cx = cam.x - fmod(cam.x, base_chunk_size); double cx = cam.x - fmod(cam.x, base_chunk_size);
double cz = cam.z - fmod(cam.x, base_chunk_size); double cz = cam.z - fmod(cam.x, base_chunk_size);
while (radius_int < 5000.0) while (radius_int < 5000.0)
{ {
progress = radius_int / 5000.0;
for (i = 0; i < chunk_count - 1; i++) for (i = 0; i < chunk_count - 1; i++)
{ {
_getChunk(renderer, &chunk, cx - radius_ext + chunk_size * i, cz - radius_ext, chunk_size, displaced); _getChunk(renderer, &chunk, cx - radius_ext + chunk_size * i, cz - radius_ext, chunk_size, displaced);
@ -203,10 +204,13 @@ void terrainGetTessellationInfo(Renderer* renderer, FuncTerrainTessellationCallb
static int _standardTessellationCallback(Renderer* renderer, TerrainChunkInfo* chunk, double progress) static int _standardTessellationCallback(Renderer* renderer, TerrainChunkInfo* chunk, double progress)
{ {
terrainTessellateChunk(renderer, chunk, chunk->detail_hint); terrainTessellateChunk(renderer, chunk, chunk->detail_hint);
renderer->render_progress = 0.05 * progress;
return !renderer->render_interrupt; return !renderer->render_interrupt;
} }
void terrainRenderSurface(Renderer* renderer) void terrainRenderSurface(Renderer* renderer)
{ {
renderer->render_progress = 0.0;
terrainGetTessellationInfo(renderer, _standardTessellationCallback, 0); terrainGetTessellationInfo(renderer, _standardTessellationCallback, 0);
renderer->render_progress = 0.05;
} }