diff options
Diffstat (limited to 'drivers/gles3/shaders/scene.glsl')
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index 3b06b08dec..630e1c2089 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -302,6 +302,8 @@ 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; @@ -430,7 +432,14 @@ void main() { vec4(0.0, 0.0, 0.0, 1.0)) * bone_weights.w; - world_matrix = transpose(m) * world_matrix; + if (skeleton_in_world_coords) { + highp mat4 bone_matrix = skeleton_transform * (transpose(m) * inverse(skeleton_transform)); + world_matrix = bone_matrix * world_matrix; + + } else { + + world_matrix = world_matrix * transpose(m); + } } #endif |