paysages : Partially restored render progress.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@534 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-03-07 14:55:37 +00:00 committed by ThunderK
parent dbb9e95442
commit 866a001167
4 changed files with 10 additions and 7 deletions

1
TODO
View file

@ -26,7 +26,6 @@ Technlogy Preview 3 :
- Create a StandardPreviewClass in C-lib (with renderer, updateData, changeView, getColor, choices and toggles). - Create a StandardPreviewClass in C-lib (with renderer, updateData, changeView, getColor, choices and toggles).
- Fully move layer management from BaseForm to BaseFormLayer. - Fully move layer management from BaseForm to BaseFormLayer.
- Start vegetation system. - Start vegetation system.
- Add tone-mapping and exposure control to final image.
- Allow render saving in HDR compatible format. - Allow render saving in HDR compatible format.
- Add clouds to explorer with 3d textures. - Add clouds to explorer with 3d textures.
- Add fresnel effect to specular lighting. - Add fresnel effect to specular lighting.

View file

@ -47,6 +47,7 @@ struct RenderArea
ColorProfile* hdr_mapping; ColorProfile* hdr_mapping;
RenderParams params; RenderParams params;
int pixel_count; int pixel_count;
int pixel_done;
RenderFragment* pixels; RenderFragment* pixels;
ScanPoint* scanline_up; ScanPoint* scanline_up;
ScanPoint* scanline_down; ScanPoint* scanline_down;
@ -73,6 +74,7 @@ typedef struct {
int endy; int endy;
int finished; int finished;
int interrupt; int interrupt;
int pixel_done;
Thread* thread; Thread* thread;
RenderArea* area; RenderArea* area;
Renderer* renderer; Renderer* renderer;
@ -307,7 +309,8 @@ static void _processDirtyPixels(RenderArea* area)
} }
} }
area->callback_update(0.0); double progress = 0.1 + ((double)area->pixel_done / (double)area->pixel_count) * 0.9;
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;
@ -615,7 +618,7 @@ void* _renderPostProcessChunk(void* data)
_setDirtyPixel(chunk->area, x, y); _setDirtyPixel(chunk->area, x, y);
mutexRelease(chunk->area->lock); mutexRelease(chunk->area->lock);
} }
/* chunk->area->progress_pixels++; */ chunk->area->pixel_done++;
} }
if (chunk->interrupt) if (chunk->interrupt)
{ {
@ -650,7 +653,7 @@ void renderPostProcess(RenderArea* area, Renderer* renderer, int nbchunks)
dy = area->params.height * area->params.antialias / ny; dy = area->params.height * area->params.antialias / ny;
x = 0; x = 0;
y = 0; y = 0;
/*_progress_pixels = 0;*/ area->pixel_done = 0;
for (i = 0; i < nbchunks; i++) for (i = 0; i < nbchunks; i++)
{ {
@ -718,7 +721,6 @@ void renderPostProcess(RenderArea* area, Renderer* renderer, int nbchunks)
if (++loops >= 10) if (++loops >= 10)
{ {
mutexAcquire(area->lock); mutexAcquire(area->lock);
/*_progress = (double)_progress_pixels / (double)_pixel_count;*/
_processDirtyPixels(area); _processDirtyPixels(area);
mutexRelease(area->lock); mutexRelease(area->lock);
@ -726,7 +728,6 @@ void renderPostProcess(RenderArea* area, Renderer* renderer, int nbchunks)
} }
} }
/*_progress = 1.0;*/
_processDirtyPixels(area); _processDirtyPixels(area);
area->callback_update(1.0); area->callback_update(1.0);
} }

View file

@ -49,7 +49,7 @@ void waterAutoPreset(WaterDefinition* definition, WaterPreset preset)
definition->foam_material.base.g = 0.8; definition->foam_material.base.g = 0.8;
definition->foam_material.base.b = 0.8; definition->foam_material.base.b = 0.8;
definition->foam_material.base.a = 1.0; definition->foam_material.base.a = 1.0;
definition->foam_material.reflection = 0.4; definition->foam_material.reflection = 0.1;
definition->foam_material.shininess = 1.5; definition->foam_material.shininess = 1.5;
WaterDefinitionClass.validate(definition); WaterDefinitionClass.validate(definition);

View file

@ -141,6 +141,9 @@ static inline Color _getFoamMask(Renderer* renderer, WaterDefinition* definition
/* TODO Re-use base lighting status */ /* TODO Re-use base lighting status */
result = renderer->applyLightingToSurface(renderer, location, normal, &definition->foam_material); result = renderer->applyLightingToSurface(renderer, location, normal, &definition->foam_material);
result.r *= 2.0;
result.g *= 2.0;
result.b *= 2.0;
/* TODO This should be configurable */ /* TODO This should be configurable */
if (foam_factor > 0.2) if (foam_factor > 0.2)