ModelAnimation.GetName() added

This commit is contained in:
JupiterRider 2024-12-14 21:26:58 +01:00
parent dce94f509d
commit 533c35110b

View file

@ -929,7 +929,7 @@ type ModelAnimation struct {
FrameCount int32 FrameCount int32
Bones *BoneInfo Bones *BoneInfo
FramePoses **Transform FramePoses **Transform
Name [32]int8 Name [32]uint8
} }
// GetBones returns the bones information (skeleton) of a ModelAnimation as go slice // GetBones returns the bones information (skeleton) of a ModelAnimation as go slice
@ -943,6 +943,17 @@ func (m ModelAnimation) GetFramePose(frame, bone int) Transform {
return unsafe.Slice(framePoses[frame], m.BoneCount)[bone] return unsafe.Slice(framePoses[frame], m.BoneCount)[bone]
} }
// GetName returns the ModelAnimation's name as go string
func (m ModelAnimation) GetName() string {
var end int
for end = range m.Name {
if m.Name[end] == 0 {
break
}
}
return string(m.Name[:end])
}
// RayCollision type - ray hit information // RayCollision type - ray hit information
type RayCollision struct { type RayCollision struct {
Hit bool Hit bool