1
0
Fork 0

Tentative change to linear-parabolic wingbeat animation for ALS wingflex shader

This commit is contained in:
Thorsten Renk 2015-11-14 13:27:38 +02:00
parent 9937c758c9
commit fd0b47865f

View file

@ -55,16 +55,32 @@ void main(void)
{
vec4 vertex = gl_Vertex;
float x_factor = max((abs(vertex.x) - 1.2),0);
float body_width = 0.7;
float arm_reach = 4.8;
float x_factor = max((abs(vertex.x) - body_width),0);
float y_factor = max(vertex.y,0.0);
float flex_factor1 = wingflex_alpha * (1.0 - wingsweep_factor);
float flex_factor2 = wingflex_trailing_alpha * (1.0 -wingsweep_factor);
if (flex_factor1<0.0) {flex_factor1 *=0.7;}
if (flex_factor2<0.0) {flex_factor1 *=0.7;}
// basic flapping motion is parabolic
// basic flapping motion is linear to arm_reach, then parabolic
float intercept_point = 0.1 * arm_reach * arm_reach * flex_factor1;
if (x_factor < arm_reach)
{
vertex.z += x_factor/arm_reach * intercept_point;
}
else
{
vertex.z += 0.1 * x_factor * x_factor * flex_factor1;
}
// upward stroke is slightly forward-swept, downward stroke a bit backward
vertex.y += -0.25 * abs(x_factor) * flex_factor1;