MCPcopy
hub / github.com/g3n/engine / AddBone

Method AddBone

graphic/skeleton.go:29–41  ·  view source on GitHub ↗

AddBone adds a bone to the skeleton along with an optional inverseBindMatrix.

(node *core.Node, inverseBindMatrix *math32.Matrix4)

Source from the content-addressed store, hash-verified

27
28// AddBone adds a bone to the skeleton along with an optional inverseBindMatrix.
29func (sk *Skeleton) AddBone(node *core.Node, inverseBindMatrix *math32.Matrix4) {
30
31 // Useful for debugging:
32 //node.Add(NewAxisHelper(0.2))
33
34 sk.bones = append(sk.bones, node)
35 sk.boneMatrices = append(sk.boneMatrices, *math32.NewMatrix4())
36 if inverseBindMatrix == nil {
37 inverseBindMatrix = math32.NewMatrix4() // Identity matrix
38 }
39
40 sk.inverseBindMatrices = append(sk.inverseBindMatrices, *inverseBindMatrix)
41}
42
43// Bones returns the list of bones in the skeleton.
44func (sk *Skeleton) Bones() []*core.Node {

Callers 1

LoadSkinMethod · 0.95

Calls 1

NewMatrix4Function · 0.92

Tested by

no test coverage detected