1
0
Fork 0

Environment/interpolator.xml: create copies of tied properties used by the ubershader reflection rotation.

Effects/model-combined.eff: use copies instead of tied properties Shaders/ubershader: fix reflection rotation for dynamic reflections.
This commit is contained in:
Emilian Huminiuc 2015-05-25 16:29:56 +02:00 committed by Christian Schmitt
parent 79fbcfe777
commit 52887ad7c3
4 changed files with 24 additions and 8 deletions

View file

@ -129,10 +129,10 @@ please see Docs/README.model-combined.eff for documentation
<use>orientation/model/roll-deg</use>
</model-roll>
<pos-lon>
<use>position/longitude-deg</use>
<use>position/model/longitude-deg</use>
</pos-lon>
<pos-lat>
<use>position/latitude-deg</use>
<use>position/model/latitude-deg</use>
</pos-lat>
<!-- fog include -->
<visibility><use>/environment/ground-visibility-m</use></visibility>

View file

@ -245,6 +245,22 @@
<output>/orientation/model/roll-deg</output>
</filter>
<filter>
<name>EnvironmentInterpolator:model:latitude</name>
<input>/position/latitude-deg</input>
<output>/position/model/latitude-deg</output>
<type>gain</type>
<gain>1</gain>
</filter>
<filter>
<name>EnvironmentInterpolator:model:longitude</name>
<input>/position/longitude-deg</input>
<output>/position/model/longitude-deg</output>
<type>gain</type>
<gain>1</gain>
</filter>
<filter>
<name>EnvironmentInterpolator:wave:amp</name>
<type>gain</type>

View file

@ -142,12 +142,12 @@ void main (void)
float latRad = radians(90. - latDeg);
float lonRad = radians(lonDeg);
mat3 rotCorrX = rotX(-lonRad);
mat3 rotCorrY = rotY(latRad);
mat3 reflCorr = rotCorrX * rotCorrY;
mat3 rotCorrZ = rotZ(lonRad);
mat3 reflCorr = rotCorrY * rotCorrZ;
wRefVec = reflect(wVertVec,wNormal);
wRefVec = normalize(reflCorr * wRefVec);
} else if (refl_enabled > 0) { ///static reflection
} else { ///static reflection
wRefVec = normalize(reflMatrix * vec4(wRefVec,0.0)).xyz;
}

View file

@ -139,12 +139,12 @@ void main (void)
vec3 wVertVec = normalize(reflMatrix * vec4(viewVec,0.0)).xyz;
vec3 wNormal = normalize(reflMatrix * vec4(N,0.0)).xyz;
float latRad = radians(90. - latDeg);
float latRad = radians(90.-latDeg);
float lonRad = radians(lonDeg);
mat3 rotCorrX = rotX(-lonRad);
mat3 rotCorrY = rotY(latRad);
mat3 reflCorr = rotCorrX * rotCorrY;
mat3 rotCorrZ = rotZ(lonRad);
mat3 reflCorr = rotCorrY * rotCorrZ;
wRefVec = reflect(wVertVec,wNormal);
wRefVec = normalize(reflCorr * wRefVec);
} else { ///static reflection