Add missing include_fog.[vert/frag] to the forest, glacier, and herbtundra effects.
adapt forest.[vert/frag] shader to the common fog. Thanks Stuart for reporting it. Signed-off-by: Emilian Huminiuc <emilianh@gmail.com>
This commit is contained in:
parent
6261badedb
commit
eb6672f313
5 changed files with 249 additions and 37 deletions
|
@ -40,6 +40,26 @@
|
|||
<season-green type="float">0.86</season-green>
|
||||
<season-blue type="float">0.22</season-blue>
|
||||
<!-- end season color -->
|
||||
<!--fog include-->
|
||||
<visibility>
|
||||
<use>/environment/ground-visibility-m</use>
|
||||
</visibility>
|
||||
<avisibility>
|
||||
<use>/environment/visibility-m</use>
|
||||
</avisibility>
|
||||
<lthickness>
|
||||
<use>/environment/ground-haze-thickness-m</use>
|
||||
</lthickness>
|
||||
<scattering>
|
||||
<use>/rendering/scene/scattering</use>
|
||||
</scattering>
|
||||
<terminator>
|
||||
<use>/environment/terminator-relative-position-m</use>
|
||||
</terminator>
|
||||
<fogtype>
|
||||
<use>/sim/rendering/shaders/skydome</use>
|
||||
</fogtype>
|
||||
<!-- END fog include -->
|
||||
|
||||
</parameters>
|
||||
<generate>
|
||||
|
@ -128,8 +148,10 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
|
@ -199,6 +221,50 @@
|
|||
<type>float</type>
|
||||
<value>0.0</value>
|
||||
</uniform>
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>avisibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>avisibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>hazeLayerAltitude</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>lthickness</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>scattering</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>scattering</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>terminator</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>terminator</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>fogType</name>
|
||||
<type>int</type>
|
||||
<value>
|
||||
<use>fogtype</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<!-- END fog include -->
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
|
@ -41,6 +41,27 @@
|
|||
<season-blue type="float">0.22</season-blue>
|
||||
<!-- end season color -->
|
||||
|
||||
<!--fog include-->
|
||||
<visibility>
|
||||
<use>/environment/ground-visibility-m</use>
|
||||
</visibility>
|
||||
<avisibility>
|
||||
<use>/environment/visibility-m</use>
|
||||
</avisibility>
|
||||
<lthickness>
|
||||
<use>/environment/ground-haze-thickness-m</use>
|
||||
</lthickness>
|
||||
<scattering>
|
||||
<use>/rendering/scene/scattering</use>
|
||||
</scattering>
|
||||
<terminator>
|
||||
<use>/environment/terminator-relative-position-m</use>
|
||||
</terminator>
|
||||
<fogtype>
|
||||
<use>/sim/rendering/shaders/skydome</use>
|
||||
</fogtype>
|
||||
<!-- END fog include -->
|
||||
|
||||
</parameters>
|
||||
<generate>
|
||||
<tangent type="int">6</tangent>
|
||||
|
@ -128,8 +149,10 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
|
@ -199,6 +222,50 @@
|
|||
<type>float</type>
|
||||
<value>0.0</value>
|
||||
</uniform>
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>avisibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>avisibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>hazeLayerAltitude</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>lthickness</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>scattering</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>scattering</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>terminator</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>terminator</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>fogType</name>
|
||||
<type>int</type>
|
||||
<value>
|
||||
<use>fogtype</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<!-- END fog include -->
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
|
@ -40,6 +40,27 @@
|
|||
<season-blue type="float">0.22</season-blue>
|
||||
<!-- end season color -->
|
||||
|
||||
<!--fog include-->
|
||||
<visibility>
|
||||
<use>/environment/ground-visibility-m</use>
|
||||
</visibility>
|
||||
<avisibility>
|
||||
<use>/environment/visibility-m</use>
|
||||
</avisibility>
|
||||
<lthickness>
|
||||
<use>/environment/ground-haze-thickness-m</use>
|
||||
</lthickness>
|
||||
<scattering>
|
||||
<use>/rendering/scene/scattering</use>
|
||||
</scattering>
|
||||
<terminator>
|
||||
<use>/environment/terminator-relative-position-m</use>
|
||||
</terminator>
|
||||
<fogtype>
|
||||
<use>/sim/rendering/shaders/skydome</use>
|
||||
</fogtype>
|
||||
<!-- END fog include -->
|
||||
|
||||
<quality-level><use>/sim/rendering/shaders/transition</use></quality-level>
|
||||
</parameters>
|
||||
<generate>
|
||||
|
@ -128,8 +149,10 @@
|
|||
</internal-format>
|
||||
</texture-unit>
|
||||
<program>
|
||||
<vertex-shader>Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader>Shaders/forest.frag</fragment-shader>
|
||||
<vertex-shader n="0">Shaders/include_fog.vert</vertex-shader>
|
||||
<vertex-shader n="1">Shaders/forest.vert</vertex-shader>
|
||||
<fragment-shader n="0">Shaders/include_fog.frag</fragment-shader>
|
||||
<fragment-shader n="1">Shaders/forest.frag</fragment-shader>
|
||||
<attribute>
|
||||
<name>tangent</name>
|
||||
<index>6</index>
|
||||
|
@ -199,6 +222,50 @@
|
|||
<type>float</type>
|
||||
<value>0.0</value>
|
||||
</uniform>
|
||||
<!-- BEGIN fog include -->
|
||||
<uniform>
|
||||
<name>visibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>visibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>avisibility</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>avisibility</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>hazeLayerAltitude</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>lthickness</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>scattering</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>scattering</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>terminator</name>
|
||||
<type>float</type>
|
||||
<value>
|
||||
<use>terminator</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<uniform>
|
||||
<name>fogType</name>
|
||||
<type>int</type>
|
||||
<value>
|
||||
<use>fogtype</use>
|
||||
</value>
|
||||
</uniform>
|
||||
<!-- END fog include -->
|
||||
</pass>
|
||||
</technique>
|
||||
</PropertyList>
|
||||
|
|
|
@ -22,6 +22,12 @@ uniform float snowlevel; // From /sim/rendering/snow-level-m
|
|||
const float scale = 1.0;
|
||||
int linear_search_steps = 10;
|
||||
|
||||
////fog "include" /////
|
||||
uniform int fogType;
|
||||
|
||||
vec3 fog_Func(vec3 color, int type);
|
||||
//////////////////////
|
||||
|
||||
float ray_intersect(sampler2D reliefMap, vec2 dp, vec2 ds)
|
||||
{
|
||||
|
||||
|
@ -182,8 +188,6 @@ void main (void)
|
|||
c1 *= ambient_light;
|
||||
vec4 finalColor = c1;
|
||||
|
||||
if(gl_Fog.density == 1.0)
|
||||
fogFactor=1.0;
|
||||
|
||||
gl_FragColor = mix(gl_Fog.color,finalColor, fogFactor);
|
||||
finalColor.rgb = fog_Func(finalColor.rgb, fogType);
|
||||
gl_FragColor = finalColor;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#version 120
|
||||
varying vec4 rawpos;
|
||||
varying vec4 ecPosition;
|
||||
varying vec3 VNormal;
|
||||
|
@ -9,6 +10,12 @@ varying vec4 constantColor;
|
|||
attribute vec3 tangent;
|
||||
attribute vec3 binormal;
|
||||
|
||||
////fog "include"////////
|
||||
uniform int fogType;
|
||||
|
||||
void fog_Func(int type);
|
||||
/////////////////////////
|
||||
|
||||
void main(void)
|
||||
{
|
||||
rawpos = gl_Vertex;
|
||||
|
@ -23,4 +30,5 @@ void main(void)
|
|||
+ gl_FrontColor * (gl_LightModel.ambient + gl_LightSource[0].ambient);
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
|
||||
fog_Func(fogType);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue