AddBone adds a bone to the skeleton along with an optional inverseBindMatrix.
(node *core.Node, inverseBindMatrix *math32.Matrix4)
| 27 | |
| 28 | // AddBone adds a bone to the skeleton along with an optional inverseBindMatrix. |
| 29 | func (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. |
| 44 | func (sk *Skeleton) Bones() []*core.Node { |