paysages : Added lighting filtering to water preview.

git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@538 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
Michaël Lemaire 2013-03-11 13:32:05 +00:00 committed by ThunderK
parent 1dc8917a4b
commit 954076af69
2 changed files with 15 additions and 1 deletions

1
TODO
View file

@ -14,7 +14,6 @@ Technology Preview 2 :
=> Covering texture height should inpact terrain height.
=> Add texture shadowing.
- Clouds should keep distance to ground.
- Apply depth filtering to water preview.
- Fix rendering when inside a cloud layer, with other upper or lower layers.
- Improve cloud rendering precision (and beware of precision discontinuity when rendering clouds in front of ground (shorter distance)).
- Translations.

View file

@ -168,6 +168,21 @@ private:
result.hit_location.x = x;
result.hit_location.y = y;
result.hit_location.z = 0.0;
if (result.hit_location.y < 0.0)
{
if (result.hit_location.y < -renderer->water->definition->lighting_depth)
{
result.hit_color = COLOR_BLACK;
}
else
{
double attenuation = -result.hit_location.y / renderer->water->definition->lighting_depth;
result.hit_color.r *= 1.0 - attenuation;
result.hit_color.g *= 1.0 - attenuation;
result.hit_color.b *= 1.0 - attenuation;
}
}
}
return result;