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:
parent
79fbcfe777
commit
52887ad7c3
4 changed files with 24 additions and 8 deletions
|
@ -129,10 +129,10 @@ please see Docs/README.model-combined.eff for documentation
|
||||||
<use>orientation/model/roll-deg</use>
|
<use>orientation/model/roll-deg</use>
|
||||||
</model-roll>
|
</model-roll>
|
||||||
<pos-lon>
|
<pos-lon>
|
||||||
<use>position/longitude-deg</use>
|
<use>position/model/longitude-deg</use>
|
||||||
</pos-lon>
|
</pos-lon>
|
||||||
<pos-lat>
|
<pos-lat>
|
||||||
<use>position/latitude-deg</use>
|
<use>position/model/latitude-deg</use>
|
||||||
</pos-lat>
|
</pos-lat>
|
||||||
<!-- fog include -->
|
<!-- fog include -->
|
||||||
<visibility><use>/environment/ground-visibility-m</use></visibility>
|
<visibility><use>/environment/ground-visibility-m</use></visibility>
|
||||||
|
|
|
@ -245,6 +245,22 @@
|
||||||
<output>/orientation/model/roll-deg</output>
|
<output>/orientation/model/roll-deg</output>
|
||||||
</filter>
|
</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>
|
<filter>
|
||||||
<name>EnvironmentInterpolator:wave:amp</name>
|
<name>EnvironmentInterpolator:wave:amp</name>
|
||||||
<type>gain</type>
|
<type>gain</type>
|
||||||
|
|
|
@ -142,12 +142,12 @@ void main (void)
|
||||||
float latRad = radians(90. - latDeg);
|
float latRad = radians(90. - latDeg);
|
||||||
float lonRad = radians(lonDeg);
|
float lonRad = radians(lonDeg);
|
||||||
|
|
||||||
mat3 rotCorrX = rotX(-lonRad);
|
|
||||||
mat3 rotCorrY = rotY(latRad);
|
mat3 rotCorrY = rotY(latRad);
|
||||||
mat3 reflCorr = rotCorrX * rotCorrY;
|
mat3 rotCorrZ = rotZ(lonRad);
|
||||||
|
mat3 reflCorr = rotCorrY * rotCorrZ;
|
||||||
wRefVec = reflect(wVertVec,wNormal);
|
wRefVec = reflect(wVertVec,wNormal);
|
||||||
wRefVec = normalize(reflCorr * wRefVec);
|
wRefVec = normalize(reflCorr * wRefVec);
|
||||||
} else if (refl_enabled > 0) { ///static reflection
|
} else { ///static reflection
|
||||||
wRefVec = normalize(reflMatrix * vec4(wRefVec,0.0)).xyz;
|
wRefVec = normalize(reflMatrix * vec4(wRefVec,0.0)).xyz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,12 +139,12 @@ void main (void)
|
||||||
vec3 wVertVec = normalize(reflMatrix * vec4(viewVec,0.0)).xyz;
|
vec3 wVertVec = normalize(reflMatrix * vec4(viewVec,0.0)).xyz;
|
||||||
vec3 wNormal = normalize(reflMatrix * vec4(N,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);
|
float lonRad = radians(lonDeg);
|
||||||
|
|
||||||
mat3 rotCorrX = rotX(-lonRad);
|
|
||||||
mat3 rotCorrY = rotY(latRad);
|
mat3 rotCorrY = rotY(latRad);
|
||||||
mat3 reflCorr = rotCorrX * rotCorrY;
|
mat3 rotCorrZ = rotZ(lonRad);
|
||||||
|
mat3 reflCorr = rotCorrY * rotCorrZ;
|
||||||
wRefVec = reflect(wVertVec,wNormal);
|
wRefVec = reflect(wVertVec,wNormal);
|
||||||
wRefVec = normalize(reflCorr * wRefVec);
|
wRefVec = normalize(reflCorr * wRefVec);
|
||||||
} else { ///static reflection
|
} else { ///static reflection
|
||||||
|
|
Loading…
Reference in a new issue