paysages : Added sun halo control.
git-svn-id: https://subversion.assembla.com/svn/thunderk/paysages@337 b1fd45b6-86a6-48da-8261-f70d1f35bdcc
This commit is contained in:
parent
6ff990bf8f
commit
d9aa79ea28
6 changed files with 38 additions and 8 deletions
|
@ -7,6 +7,7 @@
|
|||
* Version management in saved files.
|
||||
* Added ground texture and sun location in 3D explorer.
|
||||
* 3D explorer now takes advantage of multiple CPU cores.
|
||||
* Added sun halo control.
|
||||
|
||||
2012-04-20 Technology Preview 1
|
||||
-------------------------------
|
||||
|
|
|
@ -90,7 +90,9 @@ FormSky::FormSky(QWidget *parent):
|
|||
|
||||
addInputDouble(tr("Day time"), &_definition.daytime, 0.0, 1.0, 0.01, 0.1);
|
||||
addInputColorGradation(tr("Sun color"), _definition.sun_color);
|
||||
addInputDouble(tr("Sun radius"), &_definition.sun_radius, 0.0, 0.3, 0.01, 0.03);
|
||||
addInputDouble(tr("Sun radius"), &_definition.sun_radius, 0.0, 0.4, 0.004, 0.04);
|
||||
addInputDouble(tr("Sun halo radius"), &_definition.sun_halo_size, 0.0, 0.4, 0.004, 0.04);
|
||||
addInputCurve(tr("Sun halo profile"), _definition.sun_halo_profile, 0.0, 1.0, 0.0, 1.0);
|
||||
addInputColorGradation(tr("Zenith color"), _definition.zenith_color);
|
||||
addInputColorGradation(tr("Haze color"), _definition.haze_color);
|
||||
addInputDouble(tr("Haze height"), &_definition.haze_height, 0.0, 1.0, 0.01, 0.1);
|
||||
|
|
|
@ -546,21 +546,31 @@ Maintenir Ctrl : Plus rapide</translation>
|
|||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="94"/>
|
||||
<source>Sun halo radius</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="95"/>
|
||||
<source>Sun halo profile</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="96"/>
|
||||
<source>Zenith color</source>
|
||||
<translation>Couleur du ciel au zénith</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="95"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="97"/>
|
||||
<source>Haze color</source>
|
||||
<translation>Couleur de la brume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="96"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="98"/>
|
||||
<source>Haze height</source>
|
||||
<translation>Hauteur apparente de la brume</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../gui_qt/formsky.cpp" line="97"/>
|
||||
<location filename="../gui_qt/formsky.cpp" line="99"/>
|
||||
<source>Haze smoothing</source>
|
||||
<translation>Facteur de lissage de la brume</translation>
|
||||
</message>
|
||||
|
|
|
@ -127,6 +127,11 @@ void autoGenRealisticLandscape(int seed)
|
|||
sky.haze_height = 0.75;
|
||||
sky.haze_smoothing = 0.3;
|
||||
sky.sun_radius = 0.02;
|
||||
sky.sun_halo_size = 0.3;
|
||||
curveClear(sky.sun_halo_profile);
|
||||
curveQuickAddPoint(sky.sun_halo_profile, 0.0, 1.0);
|
||||
curveQuickAddPoint(sky.sun_halo_profile, 0.1, 0.2);
|
||||
curveQuickAddPoint(sky.sun_halo_profile, 1.0, 0.0);
|
||||
scenerySetSky(&sky);
|
||||
skyDeleteDefinition(&sky);
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ void skySave(PackStream* stream, SkyDefinition* definition)
|
|||
packWriteDouble(stream, &definition->daytime);
|
||||
colorGradationSave(stream, definition->sun_color);
|
||||
packWriteDouble(stream, &definition->sun_radius);
|
||||
packWriteDouble(stream, &definition->sun_halo_size);
|
||||
curveSave(stream, definition->sun_halo_profile);
|
||||
colorGradationSave(stream, definition->zenith_color);
|
||||
colorGradationSave(stream, definition->haze_color);
|
||||
packWriteDouble(stream, &definition->haze_height);
|
||||
|
@ -37,6 +39,8 @@ void skyLoad(PackStream* stream, SkyDefinition* definition)
|
|||
packReadDouble(stream, &definition->daytime);
|
||||
colorGradationLoad(stream, definition->sun_color);
|
||||
packReadDouble(stream, &definition->sun_radius);
|
||||
packReadDouble(stream, &definition->sun_halo_size);
|
||||
curveLoad(stream, definition->sun_halo_profile);
|
||||
colorGradationLoad(stream, definition->zenith_color);
|
||||
colorGradationLoad(stream, definition->haze_color);
|
||||
packReadDouble(stream, &definition->haze_height);
|
||||
|
@ -52,6 +56,8 @@ SkyDefinition skyCreateDefinition()
|
|||
def.daytime = 0.0;
|
||||
def.sun_color = colorGradationCreate();
|
||||
def.sun_radius = 1.0;
|
||||
def.sun_halo_size = 0.0;
|
||||
def.sun_halo_profile = curveCreate();
|
||||
def.zenith_color = colorGradationCreate();
|
||||
def.haze_color = colorGradationCreate();
|
||||
def.haze_height = 0.0;
|
||||
|
@ -64,6 +70,7 @@ SkyDefinition skyCreateDefinition()
|
|||
|
||||
void skyDeleteDefinition(SkyDefinition* definition)
|
||||
{
|
||||
curveDelete(definition->sun_halo_profile);
|
||||
colorGradationDelete(definition->sun_color);
|
||||
colorGradationDelete(definition->zenith_color);
|
||||
colorGradationDelete(definition->haze_color);
|
||||
|
@ -73,9 +80,12 @@ void skyCopyDefinition(SkyDefinition* source, SkyDefinition* destination)
|
|||
{
|
||||
destination->daytime = source->daytime;
|
||||
destination->sun_radius = source->sun_radius;
|
||||
destination->sun_halo_size = source->sun_halo_size;
|
||||
destination->haze_height = source->haze_height;
|
||||
destination->haze_smoothing = source->haze_smoothing;
|
||||
|
||||
curveCopy(source->sun_halo_profile, destination->sun_halo_profile);
|
||||
|
||||
colorGradationCopy(source->sun_color, destination->sun_color);
|
||||
colorGradationCopy(source->zenith_color, destination->zenith_color);
|
||||
colorGradationCopy(source->haze_color, destination->haze_color);
|
||||
|
@ -152,17 +162,17 @@ Color skyGetColor(SkyDefinition* definition, Renderer* renderer, Vector3 eye, Ve
|
|||
dist = v3Norm(v3Sub(look, sun_position));
|
||||
|
||||
sky_color = colorGradationGet(definition->_sky_gradation, look.y * 0.5 + 0.5);
|
||||
if (dist < definition->sun_radius)
|
||||
if (dist < definition->sun_radius + definition->sun_halo_size)
|
||||
{
|
||||
dist = dist / definition->sun_radius;
|
||||
sun_color = colorGradationGet(definition->sun_color, definition->daytime);
|
||||
if (dist < 0.9)
|
||||
if (dist <= definition->sun_radius)
|
||||
{
|
||||
return sun_color;
|
||||
}
|
||||
else
|
||||
{
|
||||
sun_color.a = (1.0 - dist) / 0.1;
|
||||
dist = (dist - definition->sun_radius) / definition->sun_halo_size;
|
||||
sun_color.a = curveGetValue(definition->sun_halo_profile, dist);
|
||||
colorMask(&sky_color, &sun_color);
|
||||
return sky_color;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ typedef struct
|
|||
double daytime;
|
||||
ColorGradation* sun_color;
|
||||
double sun_radius;
|
||||
double sun_halo_size;
|
||||
Curve* sun_halo_profile;
|
||||
ColorGradation* zenith_color;
|
||||
ColorGradation* haze_color;
|
||||
double haze_height;
|
||||
|
|
Loading…
Reference in a new issue