paysages : Compute shadows only once for all textures at the same ground location.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@342 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2012-06-08 19:06:16 +00:00 committed by ThunderK
parent 23c2056809
commit f541c081db
5 changed files with 25 additions and 24 deletions

3
TODO
View file

@ -1,10 +1,9 @@
Technology Preview 2 : Technology Preview 2 :
- Fix the fog impression when cloud layer overlaps with ground range. - Fix the fog impression when cloud layer overlaps with ground range.
- Remove color gradations (replace with automatic boolean and simple colors).
- Replace zone ranges with curves (with curve input and curve dialog). - Replace zone ranges with curves (with curve input and curve dialog).
- Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges). - Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges).
- Render tab previews should not rerender when changing render options. - Render tab previews should not rerender when changing render options.
- Compute shadows only once for all textures at a same location.
=> Add an intermediary light status (two pass lighting).
- Add layer sorting/naming. - Add layer sorting/naming.
- Disable specular lighting in explorer (and everything camera dependent). - Disable specular lighting in explorer (and everything camera dependent).
- Add logarithmic sliders for some float values. - Add logarithmic sliders for some float values.

View file

@ -70,7 +70,7 @@ bool BaseExplorerChunk::maintain()
void BaseExplorerChunk::updatePriority(CameraDefinition* camera) void BaseExplorerChunk::updatePriority(CameraDefinition* camera)
{ {
if (_reset_needed || (_texture_max_size > 0 && _texture_current_size == 0)) if (_reset_needed || (_texture_max_size > 1 && _texture_current_size <= 1))
{ {
priority = 1000.0; priority = 1000.0;
} }

View file

@ -27,6 +27,7 @@ public:
protected: protected:
QColor getColor(double x, double y) QColor getColor(double x, double y)
{ {
y -= 100.0 * scaling;
if (y > 0.0) if (y > 0.0)
{ {
return QColor(0, 0, 0); return QColor(0, 0, 0);
@ -66,6 +67,7 @@ public:
protected: protected:
QColor getColor(double x, double y) QColor getColor(double x, double y)
{ {
y -= 100.0 * scaling;
if (y > 0.0) if (y > 0.0)
{ {
return QColor(0, 0, 0); return QColor(0, 0, 0);

View file

@ -555,57 +555,57 @@ Maintenir Ctrl : Plus rapide</translation>
<context> <context>
<name>FormSky</name> <name>FormSky</name>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="101"/> <location filename="../gui_qt/formsky.cpp" line="103"/>
<source>West preview</source> <source>West preview</source>
<translation>Aperçu de l&apos;ouest</translation> <translation>Aperçu de l&apos;ouest</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="103"/> <location filename="../gui_qt/formsky.cpp" line="105"/>
<source>East preview</source> <source>East preview</source>
<translation>Aperçu de l&apos;est</translation> <translation>Aperçu de l&apos;est</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="105"/> <location filename="../gui_qt/formsky.cpp" line="107"/>
<source>Day time</source> <source>Day time</source>
<translation>Heure du jour</translation> <translation>Heure du jour</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="106"/> <location filename="../gui_qt/formsky.cpp" line="108"/>
<source>Sun color</source> <source>Sun color</source>
<translation>Couleur du soleil</translation> <translation>Couleur du soleil</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="107"/> <location filename="../gui_qt/formsky.cpp" line="109"/>
<source>Sun radius</source> <source>Sun radius</source>
<translation>Diamètre apparent du soleil</translation> <translation>Diamètre apparent du soleil</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="108"/> <location filename="../gui_qt/formsky.cpp" line="110"/>
<source>Sun halo radius</source> <source>Sun halo radius</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="109"/> <location filename="../gui_qt/formsky.cpp" line="111"/>
<source>Sun halo profile</source> <source>Sun halo profile</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="110"/> <location filename="../gui_qt/formsky.cpp" line="112"/>
<source>Zenith color</source> <source>Zenith color</source>
<translation>Couleur du ciel au zénith</translation> <translation>Couleur du ciel au zénith</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="111"/> <location filename="../gui_qt/formsky.cpp" line="113"/>
<source>Haze color</source> <source>Haze color</source>
<translation>Couleur de la brume</translation> <translation>Couleur de la brume</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="112"/> <location filename="../gui_qt/formsky.cpp" line="114"/>
<source>Haze height</source> <source>Haze height</source>
<translation>Hauteur apparente de la brume</translation> <translation>Hauteur apparente de la brume</translation>
</message> </message>
<message> <message>
<location filename="../gui_qt/formsky.cpp" line="113"/> <location filename="../gui_qt/formsky.cpp" line="115"/>
<source>Haze smoothing</source> <source>Haze smoothing</source>
<translation>Facteur de lissage de la brume</translation> <translation>Facteur de lissage de la brume</translation>
</message> </message>

View file

@ -336,17 +336,17 @@ double texturesGetLayerCoverage(TextureLayerDefinition* definition, Renderer* re
return zoneGetValue(definition->zone, base.location, base.normal); return zoneGetValue(definition->zone, base.location, base.normal);
} }
static inline Color _getLayerColor(Renderer* renderer, TextureResult result) static inline Color _getLayerColor(Renderer* renderer, TextureResult result, LightStatus* light)
{ {
LightStatus light; return renderer->applyLightStatus(renderer, light, result.location, result.normal, result.definition->material);
renderer->getLightStatus(renderer, &light, result.location);
return renderer->applyLightStatus(renderer, &light, result.location, result.normal, result.definition->material);
} }
Color texturesGetLayerColor(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail) Color texturesGetLayerColor(TextureLayerDefinition* definition, Renderer* renderer, Vector3 location, double detail)
{ {
return _getLayerColor(renderer, _getLayerResult(definition, renderer, location.x, location.z, detail)); LightStatus light;
TextureResult result = _getLayerResult(definition, renderer, location.x, location.z, detail);
renderer->getLightStatus(renderer, &light, result.location);
return _getLayerColor(renderer, result, &light);
} }
Color texturesGetColor(TexturesDefinition* definition, Renderer* renderer, double x, double z, double detail) Color texturesGetColor(TexturesDefinition* definition, Renderer* renderer, double x, double z, double detail)
@ -356,8 +356,6 @@ Color texturesGetColor(TexturesDefinition* definition, Renderer* renderer, doubl
double thickness, last_height; double thickness, last_height;
int i, start; int i, start;
/* TODO Optimize : each layer computes the same shadows */
detail *= 0.1; detail *= 0.1;
results[0] = _getTerrainResult(renderer, x, z, detail); results[0] = _getTerrainResult(renderer, x, z, detail);
@ -403,9 +401,11 @@ Color texturesGetColor(TexturesDefinition* definition, Renderer* renderer, doubl
} }
/* Apply colors and alphas */ /* Apply colors and alphas */
LightStatus light;
renderer->getLightStatus(renderer, &light, results[start].location);
if (results[start].definition) if (results[start].definition)
{ {
result = _getLayerColor(renderer, results[start]); result = _getLayerColor(renderer, results[start], &light);
} }
else else
{ {
@ -417,7 +417,7 @@ Color texturesGetColor(TexturesDefinition* definition, Renderer* renderer, doubl
{ {
if (results[i].definition) if (results[i].definition)
{ {
color = _getLayerColor(renderer, results[i]); color = _getLayerColor(renderer, results[i], &light);
color.a = results[i].thickness; color.a = results[i].thickness;
} }
else else