1
0
Fork 0

ALS: Tentative fix for random building fog issue II - fall back to old up-vector computations when building flag is set

This commit is contained in:
Thorsten Renk 2018-02-11 09:46:21 +02:00
parent 8814847d59
commit 69e8d90247
4 changed files with 25 additions and 1 deletions

View file

@ -106,6 +106,7 @@
<fogstructure><use>/environment/fog-structure</use></fogstructure>
<delta_T><use>/environment/surface/delta-T-structure</use></delta_T>
<!-- END fog include -->
<building-flag type="int">1</building-flag>
</parameters>
<!-- Atmospheric scattering technique with model shader-->

View file

@ -194,6 +194,7 @@ please see Docs/README.model-combined.eff for documentation
<cloudpos20_y><use>/local-weather/cloud-shadows/cloudpos-y[19]</use></cloudpos20_y>
<cloud_shadow_flag><use>/local-weather/cloud-shadows/cloud-shadow-flag</use></cloud_shadow_flag>
<rembrandt><use>/sim/rendering/rembrandt/enabled</use></rembrandt>
<building-flag type="int">0</building-flag>
<!-- END fog include -->
</parameters>
@ -1260,6 +1261,12 @@ please see Docs/README.model-combined.eff for documentation
<type>int</type>
<value><use>darkmap-enabled</use></value>
</uniform>
<uniform>
<name>building_flag</name>
<type>int</type>
<value><use>building-flag</use></value>
</uniform>
<!-- END fog include -->
<uniform>

View file

@ -187,6 +187,7 @@
<cloudpos20_y><use>/local-weather/cloud-shadows/cloudpos-y[19]</use></cloudpos20_y>
<cloud_shadow_flag><use>/local-weather/cloud-shadows/cloud-shadow-flag</use></cloud_shadow_flag>
<rembrandt><use>/sim/rendering/rembrandt/enabled</use></rembrandt>
<building-flag type="int">0</building-flag>
<!-- END fog include -->
</parameters>
@ -1215,6 +1216,11 @@
<type>int</type>
<value><use>darkmap-enabled</use></value>
</uniform>
<uniform>
<name>building_flag</name>
<type>int</type>
<value><use>building-flag</use></value>
</uniform>
<!-- END fog include -->
<uniform>

View file

@ -43,6 +43,7 @@ uniform int use_searchlight;
uniform int use_landing_light;
uniform int use_alt_landing_light;
uniform int snow_enabled;
uniform int building_flag;
uniform float amb_correction;
uniform float dirt_b_factor;
@ -156,7 +157,16 @@ void main (void)
/// BEGIN geometry for light
vec3 up = (osg_ViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;
vec3 up;
if (building_flag == 1) // osg_ViewMatrix contains the transforms of animations, but doesn't work for random buildings
{
up = (gl_ModelViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;
}
else
{
up = (osg_ViewMatrix * vec4(0.0,0.0,1.0,0.0)).xyz;
}
//vec4 worldPos3D = (osg_ViewMatrixInverse * vec4 (0.0,0.0,0.0, 1.0));
//worldPos3D.a = 0.0;
//vec3 up = (osg_ViewMatrix * worldPos3D).xyz;