瀏覽代碼

Added ModelAnimation.name, initially with GLTF animation names loaded (#3044)

pull/3049/head
Alfred Reinold Baudisch 1 年之前
committed by GitHub
父節點
當前提交
53b7b26c45
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 3 個檔案被更改,包括 5 行新增0 行删除
  1. +1
    -0
      examples/models/models_loading_gltf.c
  2. +1
    -0
      src/raylib.h
  3. +3
    -0
      src/rmodels.c

+ 1
- 0
examples/models/models_loading_gltf.c 查看文件

@ -86,6 +86,7 @@ int main(void)
EndMode3D();
DrawText("Use the UP/DOWN arrow keys to switch animation", 10, 10, 20, GRAY);
DrawText(TextFormat("Animation: %s", anim.name), 10, GetScreenHeight() - 20, 10, DARKGRAY);
EndDrawing();
//----------------------------------------------------------------------------------

+ 1
- 0
src/raylib.h 查看文件

@ -402,6 +402,7 @@ typedef struct ModelAnimation {
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

+ 3
- 0
src/rmodels.c 查看文件

@ -5375,6 +5375,9 @@ static ModelAnimation *LoadModelAnimationsGLTF(const char *fileName, unsigned in
animDuration = (t > animDuration)? t : animDuration;
}
strncpy(animations[i].name, animData.name, sizeof(animations[i].name));
animations[i].name[sizeof(animations[i].name) - 1] = '\0';
animations[i].frameCount = (int)(animDuration*1000.0f/GLTF_ANIMDELAY);
animations[i].framePoses = RL_MALLOC(animations[i].frameCount*sizeof(Transform *));

Loading…
取消
儲存