|
|
@ -3,8 +3,6 @@ A glsllib that perform morph animation. |
|
|
|
Note that it only handles morphing position, normals and tangents. |
|
|
|
Note that it only handles morphing position, normals and tangents. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
#ifdef NUM_MORPH_TARGETS |
|
|
|
#ifdef NUM_MORPH_TARGETS |
|
|
|
vec3 dummy_norm = vec3(0.0); |
|
|
|
|
|
|
|
vec3 dummy_tan = vec3(0.0); |
|
|
|
|
|
|
|
#define NUM_BUFFERS NUM_MORPH_TARGETS * NUM_TARGETS_BUFFERS |
|
|
|
#define NUM_BUFFERS NUM_MORPH_TARGETS * NUM_TARGETS_BUFFERS |
|
|
|
#if (NUM_BUFFERS > 0) |
|
|
|
#if (NUM_BUFFERS > 0) |
|
|
|
uniform float m_MorphWeights[NUM_MORPH_TARGETS]; |
|
|
|
uniform float m_MorphWeights[NUM_MORPH_TARGETS]; |
|
|
@ -98,7 +96,7 @@ Note that it only handles morphing position, normals and tangents. |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float Get_Inverse_Weights_Sum(){ |
|
|
|
float Get_Inverse_Weights_Sum(){ |
|
|
|
float sum = 0; |
|
|
|
float sum = 0.0; |
|
|
|
for( int i = 0;i < NUM_MORPH_TARGETS; i++){ |
|
|
|
for( int i = 0;i < NUM_MORPH_TARGETS; i++){ |
|
|
|
sum += m_MorphWeights[i]; |
|
|
|
sum += m_MorphWeights[i]; |
|
|
|
} |
|
|
|
} |
|
|
@ -175,10 +173,10 @@ Note that it only handles morphing position, normals and tangents. |
|
|
|
|
|
|
|
|
|
|
|
void Morph_Compute(inout vec4 pos){ |
|
|
|
void Morph_Compute(inout vec4 pos){ |
|
|
|
#if (NUM_TARGETS_BUFFERS == 2) |
|
|
|
#if (NUM_TARGETS_BUFFERS == 2) |
|
|
|
Morph_Compute_Pos_Norm(pos,dummy_norm); |
|
|
|
Morph_Compute_Pos_Norm(pos,vec3(0.0)); |
|
|
|
return; |
|
|
|
return; |
|
|
|
#elif (NUM_TARGETS_BUFFERS == 3) |
|
|
|
#elif (NUM_TARGETS_BUFFERS == 3) |
|
|
|
Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan); |
|
|
|
Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0)); |
|
|
|
return; |
|
|
|
return; |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
Morph_Compute_Pos(pos); |
|
|
|
Morph_Compute_Pos(pos); |
|
|
@ -189,7 +187,7 @@ Note that it only handles morphing position, normals and tangents. |
|
|
|
Morph_Compute_Pos(pos); |
|
|
|
Morph_Compute_Pos(pos); |
|
|
|
return; |
|
|
|
return; |
|
|
|
#elif (NUM_TARGETS_BUFFERS == 3) |
|
|
|
#elif (NUM_TARGETS_BUFFERS == 3) |
|
|
|
Morph_Compute_Pos_Norm_Tan(pos, dummy_norm, dummy_tan); |
|
|
|
Morph_Compute_Pos_Norm_Tan(pos, vec3(0.0), vec3(0.0)); |
|
|
|
return; |
|
|
|
return; |
|
|
|
#elif (NUM_TARGETS_BUFFERS == 2) |
|
|
|
#elif (NUM_TARGETS_BUFFERS == 2) |
|
|
|
Morph_Compute_Pos_Norm(pos, norm); |
|
|
|
Morph_Compute_Pos_Norm(pos, norm); |
|
|
|