Skip to content

Commit

Permalink
added additivePose
Browse files Browse the repository at this point in the history
  • Loading branch information
ncannasse committed Nov 18, 2024
1 parent 0d75998 commit 07bc22f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions h3d/scene/Skin.hx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ class Skin extends MultiMaterial {
var paletteChanged : Bool;
var skinShader : h3d.shader.SkinBase;
var jointsGraphics : Graphics;
var additivePose : Array<h3d.Matrix>;

public var showJoints : Bool;
public var enableRetargeting : Bool = true;
Expand Down Expand Up @@ -170,10 +171,14 @@ class Skin extends MultiMaterial {
return skinData;
}

public function setJointRelPosition( name : String, pos : h3d.Matrix ) {
public function setJointRelPosition( name : String, pos : h3d.Matrix, additive = false ) {
var j = skinData.namedJoints.get(name);
if( j == null ) return;
currentRelPose[j.index] = pos;
if( additive ) {
if( additivePose == null ) additivePose = [];
additivePose[j.index] = pos;
} else
currentRelPose[j.index] = pos;
jointsUpdated = true;
}

Expand Down Expand Up @@ -251,6 +256,10 @@ class Skin extends MultiMaterial {
m.multiply3x4inline(r, absPos);
else
m.multiply3x4inline(r, currentAbsPose[j.parent.index]);
if( additivePose != null ) {
var a = additivePose[id];
if( a != null ) m.multiply3x4inline(a, m);
}
if( bid >= 0 )
currentPalette[bid].multiply3x4inline(j.transPos, m);
}
Expand Down

0 comments on commit 07bc22f

Please sign in to comment.