1
0
Fork 0

Allow the snow level of the landmass shader to be set from the property system, and expose it in the rendering dialog. Could be used in future to set the snow level based on the current weather.

This commit is contained in:
stuart 2010-03-27 14:02:56 +00:00
parent 21b52ac628
commit 6b4857ce8c
4 changed files with 38 additions and 4 deletions

View file

@ -2,6 +2,9 @@
<PropertyList>
<name>Effects/landmass</name>
<inherits-from>Effects/terrain-default</inherits-from>
<parameters>
<snow-level><use>/sim/rendering/snow-level-m</use></snow-level>
</parameters>
<technique n="9">
<predicate>
<and>
@ -56,14 +59,22 @@
<fragment-shader>Shaders/landmass.frag</fragment-shader>
</program>
<uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value></uniform>
<name>NoiseTex</name>
<type>sampler-3d</type>
<value type="int">0</value>
</uniform>
<uniform>
<name>BaseTex</name>
<type>sampler-2d</type>
<value type="int">1</value>
</uniform>
<uniform>
<name>snowlevel</name>
<type>float</type>
<value type="float">
<use>snow-level</use>
</value>
</uniform>
</pass>
</technique>
</PropertyList>

View file

@ -8,12 +8,13 @@ varying vec4 constantColor;
uniform sampler3D NoiseTex;
uniform sampler2D BaseTex;
uniform float snowlevel;
// From /sim/rendering/snow-level-m
const float scale = 1.0;
void main (void)
{
const float snowlevel=2000.0;
vec4 noisevec = texture3D(NoiseTex, (rawpos.xyz)*0.01*scale);
vec4 nvL = texture3D(NoiseTex, (rawpos.xyz)*0.00066*scale);

View file

@ -271,6 +271,27 @@
</binding>
</checkbox>
</group>
<group>
<layout>hbox</layout>
<halign>right</halign>
<text><label>Snow Level</label></text>
<slider>
<min>0.0</min>
<max>5000.0</max>
<property>/sim/rendering/snow-level-m</property>
<binding>
<command>dialog-apply</command>
</binding>
</slider>
<text>
<label>12345678</label>
<format>%.fm</format>
<live>true</live>
<property>/sim/rendering/snow-level-m</property>
</text>
</group>
</group>
</group>

View file

@ -137,6 +137,7 @@ Started September 2000 by David Megginson, david@megginson.com
<landmass-shader userarchive="y">0</landmass-shader>
<water-shader userarchive="y">0</water-shader>
<urban-shader userarchive="y">0</urban-shader>
<snow-level-m type="double">2000.0</snow-level-m>
</rendering>
<model-hz type="int">120</model-hz>
<navdb>