Update examples for #466
This commit is contained in:
parent
533c35110b
commit
46524a8c46
1 changed files with 7 additions and 8 deletions
|
@ -19,9 +19,7 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
rl "github.com/gen2brain/raylib-go/raylib"
|
||||||
|
|
||||||
"github.com/gen2brain/raylib-go/raylib"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -116,9 +114,8 @@ func main() {
|
||||||
if drawSkeleton {
|
if drawSkeleton {
|
||||||
modelBones := model.GetBones()
|
modelBones := model.GetBones()
|
||||||
modelPoses := model.GetBindPose()
|
modelPoses := model.GetBindPose()
|
||||||
animBones := unsafe.Slice(anims[animID].Bones, anims[animID].BoneCount)
|
anim := anims[animID]
|
||||||
animPoses := unsafe.Slice(anims[animID].FramePoses, anims[animID].FrameCount)
|
animBones := anim.GetBones()
|
||||||
transforms := unsafe.Slice(animPoses[animFrameCounter], anims[animID].BoneCount)
|
|
||||||
for bone := 0; bone < int(model.BoneCount)-1; bone++ {
|
for bone := 0; bone < int(model.BoneCount)-1; bone++ {
|
||||||
if !animPlaying || animsCount == 0 {
|
if !animPlaying || animsCount == 0 {
|
||||||
// Display the bind-pose skeleton
|
// Display the bind-pose skeleton
|
||||||
|
@ -128,9 +125,11 @@ func main() {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// // Display the frame-pose skeleton
|
// // Display the frame-pose skeleton
|
||||||
rl.DrawCube(transforms[bone].Translation, 0.05, 0.05, 0.05, rl.Red)
|
pos := anim.GetFramePose(animFrameCounter, bone).Translation
|
||||||
|
rl.DrawCube(pos, 0.05, 0.05, 0.05, rl.Red)
|
||||||
if animBones[bone].Parent >= 0 {
|
if animBones[bone].Parent >= 0 {
|
||||||
rl.DrawLine3D(transforms[bone].Translation, transforms[animBones[bone].Parent].Translation, rl.Red)
|
endPos := anim.GetFramePose(animFrameCounter, int(animBones[bone].Parent)).Translation
|
||||||
|
rl.DrawLine3D(pos, endPos, rl.Red)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue