paysages : Optimized terrain shadows.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@332 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
4daf92f3dd
commit
d204a2c294
4 changed files with 28 additions and 7 deletions
2
TODO
2
TODO
|
@ -1,5 +1,7 @@
|
|||
Technology Preview 2 :
|
||||
- Fix the fog impression when cloud layer overlaps with ground range.
|
||||
- Fix dialog previews not always updating at dialog open.
|
||||
- Fix forms with layers apply and revert buttons (when deleting last cloud layer, can't apply it).
|
||||
- Replace zone ranges with curves (with curve input and curve dialog).
|
||||
- Interface for textures thickness, slope_range and thickness_transparency (and correct slider ranges).
|
||||
- Render tab previews should not rerender when changing render options.
|
||||
|
|
|
@ -47,6 +47,7 @@ public:
|
|||
TextureLayerDefinition* texture;
|
||||
|
||||
_renderer = rendererCreate();
|
||||
_renderer.render_quality = 3;
|
||||
_renderer.applyTextures = _applyTextures;
|
||||
_renderer.getTerrainHeight = _getTerrainHeight;
|
||||
_renderer.applyLightingToSurface = _applyLightingToSurface;
|
||||
|
|
|
@ -568,7 +568,7 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<context>
|
||||
<name>FormTerrain</name>
|
||||
<message>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="146"/>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="147"/>
|
||||
<source>Height preview (normalized)</source>
|
||||
<translation>Aperçu de la hauteur (normalisée)</translation>
|
||||
</message>
|
||||
|
@ -577,22 +577,22 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
<translation type="obsolete">Aperçu du rendu (sans ombres)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="147"/>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="148"/>
|
||||
<source>Lighted preview (no texture)</source>
|
||||
<translation>Aperçu éclairé (sans texture)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="149"/>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="150"/>
|
||||
<source>Noise</source>
|
||||
<translation>Bruit</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="150"/>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="151"/>
|
||||
<source>Height</source>
|
||||
<translation>Hauteur</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="151"/>
|
||||
<location filename="../gui_qt/formterrain.cpp" line="152"/>
|
||||
<source>Scaling</source>
|
||||
<translation>Echelle</translation>
|
||||
</message>
|
||||
|
|
|
@ -156,6 +156,23 @@ static inline double _getHeight(TerrainDefinition* definition, double x, double
|
|||
return location.y;
|
||||
}
|
||||
|
||||
static inline double _getHeightDetail(TerrainDefinition* definition, double x, double z, double detail)
|
||||
{
|
||||
Vector3 location;
|
||||
int i;
|
||||
|
||||
location.x = x;
|
||||
location.y = noiseGet2DDetail(definition->height_noise, x / definition->scaling, z / definition->scaling, detail / definition->height_factor) * definition->height_factor;
|
||||
location.z = z;
|
||||
|
||||
for (i = 0; i < definition->height_modifiers_count; i++)
|
||||
{
|
||||
location = modifierApply(definition->height_modifiers[i], location);
|
||||
}
|
||||
|
||||
return location.y;
|
||||
}
|
||||
|
||||
static inline Vector3 _getPoint(TerrainDefinition* definition, double x, double z)
|
||||
{
|
||||
Vector3 result;
|
||||
|
@ -195,12 +212,13 @@ Color terrainLightFilter(TerrainDefinition* definition, Renderer* renderer, Colo
|
|||
|
||||
light_factor = 1.0;
|
||||
length = 0.0;
|
||||
diff = 0.0;
|
||||
do
|
||||
{
|
||||
inc_vector = v3Scale(direction_to_light, inc_value);
|
||||
length += v3Norm(inc_vector);
|
||||
location = v3Add(location, inc_vector);
|
||||
height = _getHeight(definition, location.x, location.z);
|
||||
height = _getHeightDetail(definition, location.x, location.z, diff / inc_factor);
|
||||
diff = location.y - height;
|
||||
if (diff < 0.0)
|
||||
{
|
||||
|
@ -219,7 +237,7 @@ Color terrainLightFilter(TerrainDefinition* definition, Renderer* renderer, Colo
|
|||
{
|
||||
inc_value = diff;
|
||||
}
|
||||
} while (light_factor > 0.0 && length < 50.0 && location.y <= definition->_max_height);
|
||||
} while (light_factor > 0.0 && length < (10.0 * inc_factor) && location.y <= definition->_max_height);
|
||||
|
||||
if (light_factor <= 0.0)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue