mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Skeletons can now choose between using local or world coords for processing, fixes #26468
This commit is contained in:
parent
9db96d9f81
commit
2f32a75d2e
18 changed files with 119 additions and 47 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue