Added skin support and simplified APIs to override bone position.

This commit is contained in:
Juan Linietsky 2019-09-18 19:46:32 -03:00
parent 2861fd9552
commit d81ddaf33e
29 changed files with 419 additions and 281 deletions

View file

@ -302,8 +302,6 @@ out highp float dp_clip;
#ifdef USE_SKELETON
uniform highp sampler2D skeleton_texture; // texunit:-1
uniform highp mat4 skeleton_transform;
uniform bool skeleton_in_world_coords;
#endif
out highp vec4 position_interp;
@ -432,14 +430,8 @@ void main() {
vec4(0.0, 0.0, 0.0, 1.0)) *
bone_weights.w;
if (skeleton_in_world_coords) {
highp mat4 bone_matrix = skeleton_transform * (transpose(m) * inverse(skeleton_transform));
world_matrix = bone_matrix * world_matrix;
world_matrix = world_matrix * transpose(m);
} else {
world_matrix = world_matrix * transpose(m);
}
}
#endif