Browse Source

REXM: RENAME: example: `models_gpu_skinning` --> `models_animation_gpu_skinning`

pull/5184/head
Ray 2 months ago
parent
commit
068978d5b3
8 changed files with 694 additions and 694 deletions
  1. +1
    -1
      examples/Makefile
  2. +2
    -2
      examples/Makefile.Web
  3. +1
    -1
      examples/README.md
  4. +1
    -1
      examples/examples_list.txt
  5. +120
    -120
      examples/models/models_animation_gpu_skinning.c
  6. +0
    -0
      examples/models/models_animation_gpu_skinning.png
  7. +568
    -568
      projects/VS2022/examples/models_animation_gpu_skinning.vcxproj
  8. +1
    -1
      projects/VS2022/raylib.sln

+ 1
- 1
examples/Makefile View File

@ -611,7 +611,7 @@ MODELS = \
models/models_cubicmap_rendering \
models/models_first_person_maze \
models/models_geometric_shapes \
models/models_gpu_skinning \
models/models_animation_gpu_skinning \
models/models_heightmap_rendering \
models/models_loading \
models/models_loading_gltf \

+ 2
- 2
examples/Makefile.Web View File

@ -611,7 +611,7 @@ MODELS = \
models/models_cubicmap_rendering \
models/models_first_person_maze \
models/models_geometric_shapes \
models/models_gpu_skinning \
models/models_animation_gpu_skinning \
models/models_heightmap_rendering \
models/models_loading \
models/models_loading_gltf \
@ -1063,7 +1063,7 @@ models/models_first_person_maze: models/models_first_person_maze.c
models/models_geometric_shapes: models/models_geometric_shapes.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM)
models/models_gpu_skinning: models/models_gpu_skinning.c
models/models_animation_gpu_skinning: models/models_animation_gpu_skinning.c
$(CC) -o $@$(EXT) $< $(CFLAGS) $(INCLUDE_PATHS) $(LDFLAGS) $(LDLIBS) -D$(PLATFORM) \
--preload-file models/resources/models/gltf/greenman.glb@resources/models/gltf/greenman.glb \
--preload-file models/resources/shaders/glsl100/skinning.vs@resources/shaders/glsl100/skinning.vs \

+ 1
- 1
examples/README.md View File

@ -170,7 +170,7 @@ Examples using raylib models functionality, including models loading/generation
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |
| [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) |

+ 1
- 1
examples/examples_list.txt View File

@ -124,7 +124,7 @@ models;models_waving_cubes;★★★☆;2.5;3.7;2019;2025;"Codecat";@codecat
models;models_heightmap_rendering;★☆☆☆;1.8;3.5;2015;2025;"Ramon Santamaria";@raysan5
models;models_skybox_rendering;★★☆☆;1.8;4.0;2017;2025;"Ramon Santamaria";@raysan5
models;models_textured_cube;★★☆☆;4.5;4.5;2022;2025;"Ramon Santamaria";@raysan5
models;models_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
models;models_animation_gpu_skinning;★★★☆;4.5;4.5;2024;2025;"Daniel Holden";@orangeduck
models;models_bone_socket;★★★★;4.5;4.5;2024;2025;"iP";@ipzaur
models;models_tesseract_view;★★☆☆;5.6-dev;5.6-dev;2024;2025;"Timothy van der Valk";@arceryz
shaders;shaders_basic_lighting;★★★★;3.0;4.2;2019;2025;"Chris Camacho";@chriscamacho

examples/models/models_gpu_skinning.c → examples/models/models_animation_gpu_skinning.c View File

@ -1,121 +1,121 @@
/*******************************************************************************************
*
* raylib [models] example - gpu skinning
*
* Example complexity rating: [] 3/4
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by Daniel Holden (@orangeduck) and reviewed by Ramon Santamaria (@raysan5)
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2024-2025 Daniel Holden (@orangeduck)
*
* Note: Due to limitations in the Apple OpenGL driver, this feature does not work on MacOS
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else 1">// PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
c1">//------------------------------------------------------------------------------------
c1">// Program main entry point
c1">//------------------------------------------------------------------------------------
int main(void)
{
c1">// Initialization
c1">//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - gpu skinning");
c1">// Define the camera to look into our 3d world
Camera camera = { 0 };
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; c1">// Camera position
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; c1">// Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; c1">// Camera up vector (rotation towards target)
camera.fovy = 45.0f; c1">// Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; c1">// Camera projection type
c1">// Load gltf model
Model characterModel = LoadModel("resources/models/gltf/greenman.glb"); c1">// Load character model
c1">// Load skinning shader
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
characterModel.materials[1].shader = skinningShader;
c1">// Load gltf model animations
int animsCount = 0;
unsigned int animIndex = 0;
unsigned int animCurrentFrame = 0;
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/greenman.glb", &animsCount);
Vector3 position = { 0.0f, 0.0f, 0.0f }; c1">// Set model position
DisableCursor(); c1">// Limit cursor to relative movement inside the window
SetTargetFPS(60); c1">// Set our game to run at 60 frames-per-second
c1">//--------------------------------------------------------------------------------------
c1">// Main game loop
while (!WindowShouldClose()) c1">// Detect window close button or ESC key
{
c1">// Update
c1">//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
c1">// Select current animation
if (IsKeyPressed(KEY_T)) animIndex = (animIndex + 1)%animsCount;
else if (IsKeyPressed(KEY_G)) animIndex = (animIndex + animsCount - 1)%animsCount;
c1">// Update model animation
ModelAnimation anim = modelAnimations[animIndex];
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
characterModel.transform = MatrixTranslate(position.x, position.y, position.z);
UpdateModelAnimationBones(characterModel, anim, animCurrentFrame);
c1">//----------------------------------------------------------------------------------
c1">// Draw
c1">//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
c1">// Draw character mesh, pose calculation is done in shader (GPU skinning)
DrawMesh(characterModel.meshes[0], characterModel.materials[1], characterModel.transform);
DrawGrid(10, 1.0f);
EndMode3D();
DrawText("Use the T/G to switch animation", 10, 10, 20, GRAY);
EndDrawing();
c1">//----------------------------------------------------------------------------------
}
c1">// De-Initialization
c1">//--------------------------------------------------------------------------------------
UnloadModelAnimations(modelAnimations, animsCount); c1">// Unload model animation
UnloadModel(characterModel); c1">// Unload model and meshes/material
UnloadShader(skinningShader); c1">// Unload GPU skinning shader
CloseWindow(); c1">// Close window and OpenGL context
c1">//--------------------------------------------------------------------------------------
return 0;
/*******************************************************************************************
*
* raylib [models] example - animation gpu skinning
*
* Example complexity rating: [] 3/4
*
* Example originally created with raylib 4.5, last time updated with raylib 4.5
*
* Example contributed by Daniel Holden (@orangeduck) and reviewed by Ramon Santamaria (@raysan5)
*
* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
* BSD-like license that allows static linking with closed source software
*
* Copyright (c) 2024-2025 Daniel Holden (@orangeduck)
*
* Note: Due to limitations in the Apple OpenGL driver, this feature does not work on MacOS
*
********************************************************************************************/
#include "raylib.h"
#include "raymath.h"
#if defined(PLATFORM_DESKTOP)
#define GLSL_VERSION 330
#else p">// PLATFORM_ANDROID, PLATFORM_WEB
#define GLSL_VERSION 100
#endif
o">//------------------------------------------------------------------------------------
o">// Program main entry point
o">//------------------------------------------------------------------------------------
int main(void)
{
o">// Initialization
o">//--------------------------------------------------------------------------------------
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - animation gpu skinning");
o">// Define the camera to look into our 3d world
Camera camera = { 0 };
camera.position = (Vector3){ 5.0f, 5.0f, 5.0f }; o">// Camera position
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; o">// Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; o">// Camera up vector (rotation towards target)
camera.fovy = 45.0f; o">// Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; o">// Camera projection type
o">// Load gltf model
Model characterModel = LoadModel("resources/models/gltf/greenman.glb"); o">// Load character model
o">// Load skinning shader
Shader skinningShader = LoadShader(TextFormat("resources/shaders/glsl%i/skinning.vs", GLSL_VERSION),
TextFormat("resources/shaders/glsl%i/skinning.fs", GLSL_VERSION));
characterModel.materials[1].shader = skinningShader;
o">// Load gltf model animations
int animsCount = 0;
unsigned int animIndex = 0;
unsigned int animCurrentFrame = 0;
ModelAnimation *modelAnimations = LoadModelAnimations("resources/models/gltf/greenman.glb", &animsCount);
Vector3 position = { 0.0f, 0.0f, 0.0f }; o">// Set model position
DisableCursor(); o">// Limit cursor to relative movement inside the window
SetTargetFPS(60); o">// Set our game to run at 60 frames-per-second
o">//--------------------------------------------------------------------------------------
o">// Main game loop
while (!WindowShouldClose()) o">// Detect window close button or ESC key
{
o">// Update
o">//----------------------------------------------------------------------------------
UpdateCamera(&camera, CAMERA_THIRD_PERSON);
o">// Select current animation
if (IsKeyPressed(KEY_T)) animIndex = (animIndex + 1)%animsCount;
else if (IsKeyPressed(KEY_G)) animIndex = (animIndex + animsCount - 1)%animsCount;
o">// Update model animation
ModelAnimation anim = modelAnimations[animIndex];
animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
characterModel.transform = MatrixTranslate(position.x, position.y, position.z);
UpdateModelAnimationBones(characterModel, anim, animCurrentFrame);
o">//----------------------------------------------------------------------------------
o">// Draw
o">//----------------------------------------------------------------------------------
BeginDrawing();
ClearBackground(RAYWHITE);
BeginMode3D(camera);
o">// Draw character mesh, pose calculation is done in shader (GPU skinning)
DrawMesh(characterModel.meshes[0], characterModel.materials[1], characterModel.transform);
DrawGrid(10, 1.0f);
EndMode3D();
DrawText("Use the T/G to switch animation", 10, 10, 20, GRAY);
EndDrawing();
o">//----------------------------------------------------------------------------------
}
o">// De-Initialization
o">//--------------------------------------------------------------------------------------
UnloadModelAnimations(modelAnimations, animsCount); o">// Unload model animation
UnloadModel(characterModel); o">// Unload model and meshes/material
UnloadShader(skinningShader); o">// Unload GPU skinning shader
CloseWindow(); o">// Close window and OpenGL context
o">//--------------------------------------------------------------------------------------
return 0;
}

examples/models/models_gpu_skinning.png → examples/models/models_animation_gpu_skinning.png View File


projects/VS2022/examples/models_animation_gpu_skinning.vcxproj
File diff suppressed because it is too large
View File


+ 1
- 1
projects/VS2022/raylib.sln View File

@ -299,7 +299,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_top_down_lights", "e
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shapes_rectangle_advanced", "examples\shapes_rectangle_advanced.vcxproj", "{FAFEE2F9-24B0-4AF1-B512-433E9590033F}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_gpu_skinning", "examples\models_gpu_skinning.vcxproj", "{8245DAD9-D402-4D5C-8F45-32229CD3B263}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "models_animation_gpu_skinning", "examples\models_animation_gpu_skinning.vcxproj", "{8245DAD9-D402-4D5C-8F45-32229CD3B263}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "shaders_shadowmap_rendering", "examples\shaders_shadowmap_rendering.vcxproj", "{41BBCC10-6FDE-48A1-B2E0-A0EC6A668629}"
EndProject

Loading…
Cancel
Save