Examples renaming and test examples merge
Examples have been renamed for coherence with raylib modules and test examples have been merged into examples folder.
This commit is contained in:
parent
3a0d164a76
commit
5ecb6801fa
84 changed files with 505 additions and 5229 deletions
|
@ -1,11 +1,11 @@
|
|||
/*******************************************************************************************
|
||||
*
|
||||
* raylib example 07c - Load and draw a 3d model (OBJ)
|
||||
* raylib [models] example - Load and draw a 3d model (OBJ)
|
||||
*
|
||||
* This example has been created using raylib 1.0 (www.raylib.com)
|
||||
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
|
||||
*
|
||||
* Copyright (c) 2013 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
* Copyright (c) 2014 Ramon Santamaria (Ray San - raysan@raysanweb.com)
|
||||
*
|
||||
********************************************************************************************/
|
||||
|
||||
|
@ -18,18 +18,17 @@ int main()
|
|||
int screenWidth = 800;
|
||||
int screenHeight = 450;
|
||||
|
||||
Vector3 position = { 0.0, 0.0, 0.0 };
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading");
|
||||
|
||||
// Define the camera to look into our 3d world
|
||||
Camera camera = {{ 10.0, 8.0, 10.0 }, { 0.0, 0.0, 0.0 }, { 0.0, 1.0, 0.0 }};
|
||||
|
||||
InitWindow(screenWidth, screenHeight, "raylib example 07c - 3d models");
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
|
||||
Texture2D texture = LoadTexture("resources/catsham.png");
|
||||
Model cat = LoadModel("resources/cat.obj");
|
||||
SetModelTexture(&cat, texture); // Link texture to model
|
||||
|
||||
Texture2D texture = LoadTexture("resources/catsham.png"); // Load model texture
|
||||
Model cat = LoadModel("resources/cat.obj"); // Load OBJ model
|
||||
SetModelTexture(&cat, texture); // Bind texture to model
|
||||
Vector3 catPosition = { 0.0, 0.0, 0.0 }; // Set model position
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
// Main game loop
|
||||
|
@ -37,10 +36,10 @@ int main()
|
|||
{
|
||||
// Update
|
||||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyDown(KEY_LEFT)) position.x -= 0.2;
|
||||
if (IsKeyDown(KEY_RIGHT)) position.x += 0.2;
|
||||
if (IsKeyDown(KEY_UP)) position.z -= 0.2;
|
||||
if (IsKeyDown(KEY_DOWN)) position.z += 0.2;
|
||||
if (IsKeyDown(KEY_LEFT)) catPosition.x -= 0.2;
|
||||
if (IsKeyDown(KEY_RIGHT)) catPosition.x += 0.2;
|
||||
if (IsKeyDown(KEY_UP)) catPosition.z -= 0.2;
|
||||
if (IsKeyDown(KEY_DOWN)) catPosition.z += 0.2;
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
@ -51,11 +50,11 @@ int main()
|
|||
|
||||
Begin3dMode(camera);
|
||||
|
||||
DrawModel(cat, position, 0.1f, WHITE); // Draw 3d model with texture
|
||||
DrawModel(cat, catPosition, 0.1f, WHITE); // Draw 3d model with texture
|
||||
|
||||
DrawGrid(10.0, 1.0); // Draw a grid
|
||||
|
||||
DrawGizmo(position);
|
||||
DrawGizmo(catPosition); // Draw gizmo
|
||||
|
||||
End3dMode();
|
||||
|
||||
|
@ -74,4 +73,4 @@ int main()
|
|||
//--------------------------------------------------------------------------------------
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue