소스 검색

Update models_loading_gltf.c

Ray 2 년 전
부모
커밋
39f9045703
1개의 변경된 파일7개의 추가작업 그리고 7개의 파일을 삭제
  1. 7 7
      examples/models/models_loading_gltf.c

+ 7 - 7
examples/models/models_loading_gltf.c

@@ -56,21 +56,21 @@ int main(void)
     SetTargetFPS(60);                       // Set our game to run at 60 frames-per-second
     //--------------------------------------------------------------------------------------
 
-
-
     // Main game loop
     while (!WindowShouldClose())            // Detect window close button or ESC key
     {
         // Update
         //----------------------------------------------------------------------------------
-        ModelAnimation anim = modelAnimations[animIndex];
-        
+        // Select current animation
         if (IsKeyPressed(KEY_UP)) animIndex = (animIndex + 1)%animsCount;
         else if (IsKeyPressed(KEY_DOWN)) animIndex = (animIndex + animsCount - 1)%animsCount;
-
+        
+        // Update model animation
+        ModelAnimation anim = modelAnimations[animIndex];
         animCurrentFrame = (animCurrentFrame + 1)%anim.frameCount;
         UpdateModelAnimation(model, anim, animCurrentFrame);
         
+        // Update camera
         UpdateCamera(&camera);
         //----------------------------------------------------------------------------------
 
@@ -82,8 +82,8 @@ int main(void)
 
             BeginMode3D(camera);
 
-                DrawModel(model, position, 1.0f, WHITE);
-                DrawGrid(10, 1.0f);         // Draw a grid
+                DrawModel(model, position, 1.0f, WHITE);    // Draw animated model
+                DrawGrid(10, 1.0f);
 
             EndMode3D();