This commit is contained in:
Tyler Bezera 2020-05-16 01:55:18 -07:00
commit 3161b74c32

View file

@ -2,18 +2,17 @@
*
* raylib [models] example - Load 3d model with animations and play them
*
* This example has been created using raylib 2.5 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Culacant (@culacant) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2019 Culacant (@culacant) and Ramon Santamaria (@raysan5)
*
********************************************************************************************
******************************************************************************
*
* To export a model from blender, make sure it is not posed, the vertices need to be in the
* same position as they would be in edit mode.
* and that the scale of your models is set to 0. Scaling can be done from the export menu.
* This example has been created using raylib 3.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Example contributed by Snowminx (@gamerfiend) and reviewed by Ramon Santamaria (@raysan5)
*
* Copyright (c) 2020 Snowminx (@gamerfiend) and Ramon Santamaria (@raysan5)
*
********************************************************************************************/
@ -31,7 +30,7 @@ int main(void)
const int screenWidth = 800;
const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [models] example - model animation");
InitWindow(screenWidth, screenHeight, "raylib [models] example - model animation gltf");
// Define the camera to look into our 3d world
Camera camera = { 0 };
@ -48,10 +47,18 @@ int main(void)
int animsCount = 0;
ModelAnimation *anims = LoadModelAnimations("resources/models/MonsterScaled.glb", &animsCount);
int animFrameCounter = 0;
<<<<<<< HEAD
//bool isValid = IsModelAnimationValid(model2, anims[0]);
// if (!isValid) {
// printf("\n\n\n\nModel Bone Count: %i, Animation Bone Count: %i, Animation Count: %i\n\n\n\n", model2.boneCount, anims[2].boneCount, animsCount);
// }
=======
bool isValid = IsModelAnimationValid(model2, anims[2]);
if (!isValid) {
printf("\n\n\n\nModel Bone Count: %i, Animation Bone Count: %i, Animation Count: %i\n\n\n\n", model2.boneCount, anims[2].boneCount, animsCount);
}
>>>>>>> 7b20e00596cfce39af3b9cb3503fe549575b25d8
SetCameraMode(camera, CAMERA_FREE); // Set free camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
@ -80,8 +87,12 @@ int main(void)
ClearBackground(RAYWHITE);
BeginMode3D(camera);
<<<<<<< HEAD
DrawModelEx(model2, position, (Vector3){ 0.0f, 0.0f, 0.0f }, 0.0f, (Vector3){ 1.0f, 1.0f, 1.0f }, WHITE);
=======
DrawModelEx(model2, position, (Vector3){ 1.0f, 0.0f, 0.0f }, -90.0f, (Vector3){ 1.0f, 1.0f, 1.0f }, WHITE);
>>>>>>> 7b20e00596cfce39af3b9cb3503fe549575b25d8
//Draw debug
if(DEBUG_DRAW)
@ -94,10 +105,10 @@ int main(void)
}
DrawGrid(10, 1.0f); // Draw a grid
EndMode3D();
DrawText("PRESS SPACE to PLAY GLTF MODEL ANIMATION", 10, 10, 20, MAROON);
EndDrawing();