Skip to content

Commit 791cf7c

Browse files
raysan5psxdev
authored andcommitted
REXM: RENAME: example: models_gpu_skinning --> models_animation_gpu_skinning
1 parent 960642b commit 791cf7c

File tree

8 files changed

+694
-694
lines changed

8 files changed

+694
-694
lines changed

examples/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ MODELS = \
611611
models/models_cubicmap_rendering \
612612
models/models_first_person_maze \
613613
models/models_geometric_shapes \
614-
models/models_gpu_skinning \
614+
models/models_animation_gpu_skinning \
615615
models/models_heightmap_rendering \
616616
models/models_loading \
617617
models/models_loading_gltf \

examples/Makefile.Web

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ MODELS = \
611611
models/models_cubicmap_rendering \
612612
models/models_first_person_maze \
613613
models/models_geometric_shapes \
614-
models/models_gpu_skinning \
614+
models/models_animation_gpu_skinning \
615615
models/models_heightmap_rendering \
616616
models/models_loading \
617617
models/models_loading_gltf \
@@ -1063,7 +1063,7 @@ models/models_first_person_maze: models/models_first_person_maze.c
10631063
models/models_geometric_shapes: models/models_geometric_shapes.c
10641064
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
10651065

1066-
models/models_gpu_skinning: models/models_gpu_skinning.c
1066+
models/models_animation_gpu_skinning: models/models_animation_gpu_skinning.c
10671067
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
10681068
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
10691069
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Examples using raylib models functionality, including models loading/generation
170170
| [models_heightmap_rendering](models/models_heightmap_rendering.c) | <img src="models/models_heightmap_rendering.png" alt="models_heightmap_rendering" width="80"> | ⭐☆☆☆ | 1.8 | 3.5 | [Ramon Santamaria](https://github.com/raysan5) |
171171
| [models_skybox_rendering](models/models_skybox_rendering.c) | <img src="models/models_skybox_rendering.png" alt="models_skybox_rendering" width="80"> | ⭐⭐☆☆ | 1.8 | 4.0 | [Ramon Santamaria](https://github.com/raysan5) |
172172
| [models_textured_cube](models/models_textured_cube.c) | <img src="models/models_textured_cube.png" alt="models_textured_cube" width="80"> | ⭐⭐☆☆ | 4.5 | 4.5 | [Ramon Santamaria](https://github.com/raysan5) |
173-
| [models_gpu_skinning](models/models_gpu_skinning.c) | <img src="models/models_gpu_skinning.png" alt="models_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
173+
| [models_animation_gpu_skinning](models/models_animation_gpu_skinning.c) | <img src="models/models_animation_gpu_skinning.png" alt="models_animation_gpu_skinning" width="80"> | ⭐⭐⭐☆ | 4.5 | 4.5 | [Daniel Holden](https://github.com/orangeduck) |
174174
| [models_bone_socket](models/models_bone_socket.c) | <img src="models/models_bone_socket.png" alt="models_bone_socket" width="80"> | ⭐⭐⭐⭐️ | 4.5 | 4.5 | [iP](https://github.com/ipzaur) |
175175
| [models_tesseract_view](models/models_tesseract_view.c) | <img src="models/models_tesseract_view.png" alt="models_tesseract_view" width="80"> | ⭐⭐☆☆ | 5.6-dev | 5.6-dev | [Timothy van der Valk](https://github.com/arceryz) |
176176

examples/examples_list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ models;models_waving_cubes;★★★☆;2.5;3.7;2019;2025;"Codecat";@codecat
124124
models;models_heightmap_rendering;★☆☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
125125
models;models_skybox_rendering;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
126126
models;models_textured_cube;★★☆☆;4.5;4.5;2022;2025;"Ramon Santamaria";@raysan5
127-
models;models_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
127+
models;models_animation_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
128128
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
129129
models;models_tesseract_view;★★☆☆;5.6-dev;5.6-dev;2024;2025;"Timothy van der Valk";@arceryz
130130
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho
Lines changed: 120 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -1,121 +1,121 @@
1-
/*******************************************************************************************
2-
*
3-
* raylib [models] example - gpu skinning
4-
*
5-
* Example complexity rating: [★★★☆] 3/4
6-
*
7-
* Example originally created with raylib 4.5, last time updated with raylib 4.5
8-
*
9-
* Example contributed by Daniel Holden (@orangeduck) and reviewed by Ramon Santamaria (@raysan5)
10-
*
11-
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
12-
* BSD-like license that allows static linking with closed source software
13-
*
14-
* Copyright (c) 2024-2025 Daniel Holden (@orangeduck)
15-
*
16-
* Note: Due to limitations in the Apple OpenGL driver, this feature does not work on MacOS
17-
*
18-
********************************************************************************************/
19-
20-
#include "raylib.h"
21-
22-
#include "raymath.h"
23-
24-
#if defined(PLATFORM_DESKTOP)
25-
#define GLSL_VERSION 330
26-
#else // PLATFORM_ANDROID, PLATFORM_WEB
27-
#define GLSL_VERSION 100
28-
#endif
29-
30-
//------------------------------------------------------------------------------------
31-
// Program main entry point
32-
//------------------------------------------------------------------------------------
33-
int main(void)
34-
{
35-
// Initialization
36-
//--------------------------------------------------------------------------------------
37-
const int screenWidth = 800;
38-
const int screenHeight = 450;
39-
40-
InitWindow(screenWidth, screenHeight, "raylib [models] example - gpu skinning");
41-
42-
// Define the camera to look into our 3d world
43-
Camera camera = { 0 };
44-
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
45-
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
46-
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
47-
camera.fovy = 45.0f; // Camera field-of-view Y
48-
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
49-
50-
// Load gltf model
51-
Model characterModel = LoadModel("resources/models/gltf/greenman.glb"); // Load character model
52-
53-
// Load skinning shader
54-
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
55-
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
56-
57-
characterModel.materials[1].shader = skinningShader;
58-
59-
// Load gltf model animations
60-
int animsCount = 0;
61-
unsigned int animIndex = 0;
62-
unsigned int animCurrentFrame = 0;
63-
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/greenman.glb", &animsCount);
64-
65-
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
66-
67-
DisableCursor(); // Limit cursor to relative movement inside the window
68-
69-
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
70-
//--------------------------------------------------------------------------------------
71-
72-
// Main game loop
73-
while (!WindowShouldClose()) // Detect window close button or ESC key
74-
{
75-
// Update
76-
//----------------------------------------------------------------------------------
77-
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
78-
79-
// Select current animation
80-
if (IsKeyPressed(KEY_T)) animIndex = (animIndex + 1)%animsCount;
81-
else if (IsKeyPressed(KEY_G)) animIndex = (animIndex + animsCount - 1)%animsCount;
82-
83-
// Update model animation
84-
ModelAnimation anim = modelAnimations[animIndex];
85-
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
86-
characterModel.transform = MatrixTranslate(position.x, position.y, position.z);
87-
UpdateModelAnimationBones(characterModel, anim, animCurrentFrame);
88-
//----------------------------------------------------------------------------------
89-
90-
// Draw
91-
//----------------------------------------------------------------------------------
92-
BeginDrawing();
93-
94-
ClearBackground(RAYWHITE);
95-
96-
BeginMode3D(camera);
97-
98-
// Draw character mesh, pose calculation is done in shader (GPU skinning)
99-
DrawMesh(characterModel.meshes[0], characterModel.materials[1], characterModel.transform);
100-
101-
DrawGrid(10, 1.0f);
102-
103-
EndMode3D();
104-
105-
DrawText("Use the T/G to switch animation", 10, 10, 20, GRAY);
106-
107-
EndDrawing();
108-
//----------------------------------------------------------------------------------
109-
}
110-
111-
// De-Initialization
112-
//--------------------------------------------------------------------------------------
113-
UnloadModelAnimations(modelAnimations, animsCount); // Unload model animation
114-
UnloadModel(characterModel); // Unload model and meshes/material
115-
UnloadShader(skinningShader); // Unload GPU skinning shader
116-
117-
CloseWindow(); // Close window and OpenGL context
118-
//--------------------------------------------------------------------------------------
119-
120-
return 0;
1+
/*******************************************************************************************
2+
*
3+
* raylib [models] example - animation gpu skinning
4+
*
5+
* Example complexity rating: [★★★☆] 3/4
6+
*
7+
* Example originally created with raylib 4.5, last time updated with raylib 4.5
8+
*
9+
* Example contributed by Daniel Holden (@orangeduck) and reviewed by Ramon Santamaria (@raysan5)
10+
*
11+
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
12+
* BSD-like license that allows static linking with closed source software
13+
*
14+
* Copyright (c) 2024-2025 Daniel Holden (@orangeduck)
15+
*
16+
* Note: Due to limitations in the Apple OpenGL driver, this feature does not work on MacOS
17+
*
18+
********************************************************************************************/
19+
20+
#include "raylib.h"
21+
22+
#include "raymath.h"
23+
24+
#if defined(PLATFORM_DESKTOP)
25+
#define GLSL_VERSION 330
26+
#else // PLATFORM_ANDROID, PLATFORM_WEB
27+
#define GLSL_VERSION 100
28+
#endif
29+
30+
//------------------------------------------------------------------------------------
31+
// Program main entry point
32+
//------------------------------------------------------------------------------------
33+
int main(void)
34+
{
35+
// Initialization
36+
//--------------------------------------------------------------------------------------
37+
const int screenWidth = 800;
38+
const int screenHeight = 450;
39+
40+
InitWindow(screenWidth, screenHeight, "raylib [models] example - animation gpu skinning");
41+
42+
// Define the camera to look into our 3d world
43+
Camera camera = { 0 };
44+
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; // Camera position
45+
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
46+
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
47+
camera.fovy = 45.0f; // Camera field-of-view Y
48+
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
49+
50+
// Load gltf model
51+
Model characterModel = LoadModel("resources/models/gltf/greenman.glb"); // Load character model
52+
53+
// Load skinning shader
54+
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
55+
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
56+
57+
characterModel.materials[1].shader = skinningShader;
58+
59+
// Load gltf model animations
60+
int animsCount = 0;
61+
unsigned int animIndex = 0;
62+
unsigned int animCurrentFrame = 0;
63+
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/greenman.glb", &animsCount);
64+
65+
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
66+
67+
DisableCursor(); // Limit cursor to relative movement inside the window
68+
69+
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
70+
//--------------------------------------------------------------------------------------
71+
72+
// Main game loop
73+
while (!WindowShouldClose()) // Detect window close button or ESC key
74+
{
75+
// Update
76+
//----------------------------------------------------------------------------------
77+
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
78+
79+
// Select current animation
80+
if (IsKeyPressed(KEY_T)) animIndex = (animIndex + 1)%animsCount;
81+
else if (IsKeyPressed(KEY_G)) animIndex = (animIndex + animsCount - 1)%animsCount;
82+
83+
// Update model animation
84+
ModelAnimation anim = modelAnimations[animIndex];
85+
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
86+
characterModel.transform = MatrixTranslate(position.x, position.y, position.z);
87+
UpdateModelAnimationBones(characterModel, anim, animCurrentFrame);
88+
//----------------------------------------------------------------------------------
89+
90+
// Draw
91+
//----------------------------------------------------------------------------------
92+
BeginDrawing();
93+
94+
ClearBackground(RAYWHITE);
95+
96+
BeginMode3D(camera);
97+
98+
// Draw character mesh, pose calculation is done in shader (GPU skinning)
99+
DrawMesh(characterModel.meshes[0], characterModel.materials[1], characterModel.transform);
100+
101+
DrawGrid(10, 1.0f);
102+
103+
EndMode3D();
104+
105+
DrawText("Use the T/G to switch animation", 10, 10, 20, GRAY);
106+
107+
EndDrawing();
108+
//----------------------------------------------------------------------------------
109+
}
110+
111+
// De-Initialization
112+
//--------------------------------------------------------------------------------------
113+
UnloadModelAnimations(modelAnimations, animsCount); // Unload model animation
114+
UnloadModel(characterModel); // Unload model and meshes/material
115+
UnloadShader(skinningShader); // Unload GPU skinning shader
116+
117+
CloseWindow(); // Close window and OpenGL context
118+
//--------------------------------------------------------------------------------------
119+
120+
return 0;
121121
}
File renamed without changes.

0 commit comments

Comments
 (0)