UpdateModelAnimationBones function added

This commit is contained in:
JupiterRider 2024-11-24 15:49:58 +01:00
parent 493260d376
commit b09e22b6ad
2 changed files with 17 additions and 2 deletions

View file

@ -452,6 +452,7 @@ var setMaterialTexture func(material *Material, mapType int32, texture uintptr)
var setModelMeshMaterial func(model *Model, meshId int32, materialId int32) var setModelMeshMaterial func(model *Model, meshId int32, materialId int32)
var loadModelAnimations func(fileName string, animCount *int32) *ModelAnimation var loadModelAnimations func(fileName string, animCount *int32) *ModelAnimation
var updateModelAnimation func(model uintptr, anim uintptr, frame int32) var updateModelAnimation func(model uintptr, anim uintptr, frame int32)
var updateModelAnimationBones func(model uintptr, anim uintptr, frame int32)
var unloadModelAnimation func(anim uintptr) var unloadModelAnimation func(anim uintptr)
var unloadModelAnimations func(animations *ModelAnimation, animCount int32) var unloadModelAnimations func(animations *ModelAnimation, animCount int32)
var isModelAnimationValid func(model uintptr, anim uintptr) bool var isModelAnimationValid func(model uintptr, anim uintptr) bool
@ -967,6 +968,7 @@ func init() {
purego.RegisterLibFunc(&setModelMeshMaterial, raylibDll, "SetModelMeshMaterial") purego.RegisterLibFunc(&setModelMeshMaterial, raylibDll, "SetModelMeshMaterial")
purego.RegisterLibFunc(&loadModelAnimations, raylibDll, "LoadModelAnimations") purego.RegisterLibFunc(&loadModelAnimations, raylibDll, "LoadModelAnimations")
purego.RegisterLibFunc(&updateModelAnimation, raylibDll, "UpdateModelAnimation") purego.RegisterLibFunc(&updateModelAnimation, raylibDll, "UpdateModelAnimation")
purego.RegisterLibFunc(&updateModelAnimationBones, raylibDll, "UpdateModelAnimationBones")
purego.RegisterLibFunc(&unloadModelAnimation, raylibDll, "UnloadModelAnimation") purego.RegisterLibFunc(&unloadModelAnimation, raylibDll, "UnloadModelAnimation")
purego.RegisterLibFunc(&unloadModelAnimations, raylibDll, "UnloadModelAnimations") purego.RegisterLibFunc(&unloadModelAnimations, raylibDll, "UnloadModelAnimations")
purego.RegisterLibFunc(&isModelAnimationValid, raylibDll, "IsModelAnimationValid") purego.RegisterLibFunc(&isModelAnimationValid, raylibDll, "IsModelAnimationValid")
@ -3481,11 +3483,16 @@ func LoadModelAnimations(fileName string) []ModelAnimation {
return unsafe.Slice(ret, animCount) return unsafe.Slice(ret, animCount)
} }
// UpdateModelAnimation - Update model animation pose // UpdateModelAnimation - Update model animation pose (CPU)
func UpdateModelAnimation(model Model, anim ModelAnimation, frame int32) { func UpdateModelAnimation(model Model, anim ModelAnimation, frame int32) {
updateModelAnimation(uintptr(unsafe.Pointer(&model)), uintptr(unsafe.Pointer(&anim)), frame) updateModelAnimation(uintptr(unsafe.Pointer(&model)), uintptr(unsafe.Pointer(&anim)), frame)
} }
// UpdateModelAnimationBones - Update model animation mesh bone matrices (GPU skinning)
func UpdateModelAnimationBones(model Model, anim ModelAnimation, frame int32) {
updateModelAnimationBones(uintptr(unsafe.Pointer(&model)), uintptr(unsafe.Pointer(&anim)), frame)
}
// UnloadModelAnimation - Unload animation data // UnloadModelAnimation - Unload animation data
func UnloadModelAnimation(anim ModelAnimation) { func UnloadModelAnimation(anim ModelAnimation) {
unloadModelAnimation(uintptr(unsafe.Pointer(&anim))) unloadModelAnimation(uintptr(unsafe.Pointer(&anim)))

View file

@ -605,7 +605,7 @@ func LoadModelAnimations(fileName string) []ModelAnimation {
return v return v
} }
// UpdateModelAnimation - Update model animation pose // UpdateModelAnimation - Update model animation pose (CPU)
func UpdateModelAnimation(model Model, anim ModelAnimation, frame int32) { func UpdateModelAnimation(model Model, anim ModelAnimation, frame int32) {
cmodel := model.cptr() cmodel := model.cptr()
canim := anim.cptr() canim := anim.cptr()
@ -613,6 +613,14 @@ func UpdateModelAnimation(model Model, anim ModelAnimation, frame int32) {
C.UpdateModelAnimation(*cmodel, *canim, cframe) C.UpdateModelAnimation(*cmodel, *canim, cframe)
} }
// UpdateModelAnimationBones - Update model animation mesh bone matrices (GPU skinning)
func UpdateModelAnimationBones(model Model, anim ModelAnimation, frame int32) {
cmodel := model.cptr()
canim := anim.cptr()
cframe := (C.int)(frame)
C.UpdateModelAnimationBones(*cmodel, *canim, cframe)
}
// UnloadModelAnimation - Unload animation data // UnloadModelAnimation - Unload animation data
func UnloadModelAnimation(anim ModelAnimation) { func UnloadModelAnimation(anim ModelAnimation) {
canim := anim.cptr() canim := anim.cptr()