3 Commits

Author SHA1 Message Date
919ad68ca7 rlparser: update raylib_api.* by CI 2026-02-10 17:02:58 +00:00
Ray
3aced1fd7c Update rmodels.c 2026-02-10 18:02:42 +01:00
Ray
48ec41f0ec Update raylib.h 2026-02-10 18:02:36 +01:00
6 changed files with 21 additions and 20 deletions

View File

@ -417,11 +417,11 @@ typedef struct Model {
// ModelAnimation
typedef struct ModelAnimation {
char name[32]; // Animation name
int boneCount; // Number of bones
int frameCount; // Number of animation frames
BoneInfo *bones; // Bones information (skeleton)
Transform **framePoses; // Poses array by frame
char name[32]; // Animation name
} ModelAnimation;
// Ray, ray for raycasting

View File

@ -2358,11 +2358,12 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
Mesh mesh = model.meshes[m];
Vector3 animVertex = { 0 };
Vector3 animNormal = { 0 };
const int vValues = mesh.vertexCount*3;
int boneId = 0;
int boneCounter = 0;
float boneWeight = 0.0;
float boneWeight = 0.0f;
bool updated = false; // Flag to check when anim vertex information is updated
const int vValues = mesh.vertexCount*3;
// Skip if missing bone data, causes segfault without on some models
if ((mesh.boneWeights == NULL) || (mesh.boneIds == NULL)) continue;
@ -2388,7 +2389,7 @@ void UpdateModelAnimation(Model model, ModelAnimation anim, int frame)
// Early stop when no transformation will be applied
if (boneWeight == 0.0f) continue;
animVertex = (Vector3){ mesh.vertices[vCounter], mesh.vertices[vCounter + 1], mesh.vertices[vCounter + 2] };
animVertex = Vector3Transform(animVertex,model.meshes[m].boneMatrices[boneId]);
animVertex = Vector3Transform(animVertex, model.meshes[m].boneMatrices[boneId]);
mesh.animVertices[vCounter] += animVertex.x*boneWeight;
mesh.animVertices[vCounter+1] += animVertex.y*boneWeight;
mesh.animVertices[vCounter+2] += animVertex.z*boneWeight;

View File

@ -1029,6 +1029,11 @@
"name": "ModelAnimation",
"description": "ModelAnimation",
"fields": [
{
"type": "char[32]",
"name": "name",
"description": "Animation name"
},
{
"type": "int",
"name": "boneCount",
@ -1048,11 +1053,6 @@
"type": "Transform **",
"name": "framePoses",
"description": "Poses array by frame"
},
{
"type": "char[32]",
"name": "name",
"description": "Animation name"
}
]
},

View File

@ -1029,6 +1029,11 @@ return {
name = "ModelAnimation",
description = "ModelAnimation",
fields = {
{
type = "char[32]",
name = "name",
description = "Animation name"
},
{
type = "int",
name = "boneCount",
@ -1048,11 +1053,6 @@ return {
type = "Transform **",
name = "framePoses",
description = "Poses array by frame"
},
{
type = "char[32]",
name = "name",
description = "Animation name"
}
}
},

View File

@ -466,11 +466,11 @@ Struct 21: Model (9 fields)
Struct 22: ModelAnimation (5 fields)
Name: ModelAnimation
Description: ModelAnimation
Field[1]: int boneCount // Number of bones
Field[2]: int frameCount // Number of animation frames
Field[3]: BoneInfo * bones // Bones information (skeleton)
Field[4]: Transform ** framePoses // Poses array by frame
Field[5]: char[32] name // Animation name
Field[1]: char[32] name // Animation name
Field[2]: int boneCount // Number of bones
Field[3]: int frameCount // Number of animation frames
Field[4]: BoneInfo * bones // Bones information (skeleton)
Field[5]: Transform ** framePoses // Poses array by frame
Struct 23: Ray (2 fields)
Name: Ray
Description: Ray, ray for raycasting

View File

@ -214,11 +214,11 @@
<Field type="Transform *" name="bindPose" desc="Bones base transformation (pose)" />
</Struct>
<Struct name="ModelAnimation" fieldCount="5" desc="ModelAnimation">
<Field type="char[32]" name="name" desc="Animation name" />
<Field type="int" name="boneCount" desc="Number of bones" />
<Field type="int" name="frameCount" desc="Number of animation frames" />
<Field type="BoneInfo *" name="bones" desc="Bones information (skeleton)" />
<Field type="Transform **" name="framePoses" desc="Poses array by frame" />
<Field type="char[32]" name="name" desc="Animation name" />
</Struct>
<Struct name="Ray" fieldCount="2" desc="Ray, ray for raycasting">
<Field type="Vector3" name="position" desc="Ray position (origin)" />