1
0
Fork 0

Wing sweep animation for ALS wingflex shader

This commit is contained in:
Thorsten Renk 2015-11-11 11:34:41 +02:00
parent 1274c933ba
commit 4f51ab3bec

View file

@ -24,6 +24,7 @@ uniform float roll;
uniform float hdg;
uniform float wingflex_alpha;
uniform float wingflex_trailing_alpha;
uniform float wingsweep_factor;
uniform int refl_dynamic;
uniform int nmap_enabled;
uniform int shader_qual;
@ -56,8 +57,8 @@ void main(void)
float x_factor = max((abs(vertex.x) - 1.2),0);
float y_factor = max(vertex.y,0.0);
float flex_factor1 = wingflex_alpha;
float flex_factor2 = wingflex_trailing_alpha;
float flex_factor1 = wingflex_alpha * wingsweep_factor;
float flex_factor2 = wingflex_trailing_alpha * wingsweep_factor;
if (flex_factor1<0.0) {flex_factor1 *=0.7;}
if (flex_factor2<0.0) {flex_factor1 *=0.7;}
@ -72,6 +73,14 @@ void main(void)
vertex.z += 0.2 * y_factor * x_factor * flex_factor2;
// if the wings are folded, we sweep them back
vertex.y += 0.5 * x_factor * (1.0-wingsweep_factor);
float sweep_x = 0.5;
if (vertex.x > 0.0) {sweep_x = - 0.5;}
vertex.x+= sweep_x * (1.0 + 0.5 *x_factor) * (1.0 - wingsweep_factor);
rawpos = vertex.xyz;
vec4 ecPosition = gl_ModelViewMatrix * vertex;