diff options
| author | raysan5 <[email protected]> | 2017-07-24 20:04:54 +0200 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2017-07-24 20:04:54 +0200 |
| commit | 072684d276373b58ddf7203e34b66a14f6e0c848 (patch) | |
| tree | 64dd10af55f0602864ce79eb9c46a23531341059 /docs/examples/src/models | |
| parent | b2712b6db7c184aff47436f387f2012cf77f4f67 (diff) | |
| download | raylib-072684d276373b58ddf7203e34b66a14f6e0c848.tar.gz raylib-072684d276373b58ddf7203e34b66a14f6e0c848.zip | |
Removed webpage from raylib repo
Moved to own repo at @raysan5/raylib.com
Diffstat (limited to 'docs/examples/src/models')
| -rw-r--r-- | docs/examples/src/models/models_billboard.c | 70 | ||||
| -rw-r--r-- | docs/examples/src/models/models_box_collisions.c | 121 | ||||
| -rw-r--r-- | docs/examples/src/models/models_cubicmap.c | 85 | ||||
| -rw-r--r-- | docs/examples/src/models/models_geometric_shapes.c | 75 | ||||
| -rw-r--r-- | docs/examples/src/models/models_heightmap.c | 80 | ||||
| -rw-r--r-- | docs/examples/src/models/models_mesh_picking.c | 195 | ||||
| -rw-r--r-- | docs/examples/src/models/models_obj_loading.c | 75 |
7 files changed, 0 insertions, 701 deletions
diff --git a/docs/examples/src/models/models_billboard.c b/docs/examples/src/models/models_billboard.c deleted file mode 100644 index bca9faf8..00000000 --- a/docs/examples/src/models/models_billboard.c +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Drawing billboards -* -* This example has been created using raylib 1.3 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - drawing billboards"); - - // Define the camera to look into our 3d world - Camera camera = {{ 5.0f, 4.0f, 5.0f }, { 0.0f, 2.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; - - Texture2D bill = LoadTexture("resources/billboard.png"); // Our texture billboard - Vector3 billPosition = { 0.0f, 2.0f, 0.0f }; // Position where draw billboard - - SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode - - 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 - //---------------------------------------------------------------------------------- - UpdateCamera(&camera); // Update camera - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - DrawBillboard(camera, bill, billPosition, 2.0f, WHITE); - - DrawGrid(10, 1.0f); // Draw a grid - - End3dMode(); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - UnloadTexture(bill); // Unload texture - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file diff --git a/docs/examples/src/models/models_box_collisions.c b/docs/examples/src/models/models_box_collisions.c deleted file mode 100644 index 69cec418..00000000 --- a/docs/examples/src/models/models_box_collisions.c +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Detect basic 3d collisions (box vs sphere vs box) -* -* This example has been created using raylib 1.3 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions"); - - // Define the camera to look into our 3d world - Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; - - Vector3 playerPosition = { 0.0f, 1.0f, 2.0f }; - Vector3 playerSize = { 1.0f, 2.0f, 1.0f }; - Color playerColor = GREEN; - - Vector3 enemyBoxPos = { -4.0f, 1.0f, 0.0f }; - Vector3 enemyBoxSize = { 2.0f, 2.0f, 2.0f }; - - Vector3 enemySpherePos = { 4.0f, 0.0f, 0.0f }; - float enemySphereSize = 1.5f; - - bool collision = false; - - 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 - //---------------------------------------------------------------------------------- - - // Move player - if (IsKeyDown(KEY_RIGHT)) playerPosition.x += 0.2f; - else if (IsKeyDown(KEY_LEFT)) playerPosition.x -= 0.2f; - else if (IsKeyDown(KEY_DOWN)) playerPosition.z += 0.2f; - else if (IsKeyDown(KEY_UP)) playerPosition.z -= 0.2f; - - collision = false; - - // Check collisions player vs enemy-box - if (CheckCollisionBoxes( - (BoundingBox){(Vector3){ playerPosition.x - playerSize.x/2, - playerPosition.y - playerSize.y/2, - playerPosition.z - playerSize.z/2 }, - (Vector3){ playerPosition.x + playerSize.x/2, - playerPosition.y + playerSize.y/2, - playerPosition.z + playerSize.z/2 }}, - (BoundingBox){(Vector3){ enemyBoxPos.x - enemyBoxSize.x/2, - enemyBoxPos.y - enemyBoxSize.y/2, - enemyBoxPos.z - enemyBoxSize.z/2 }, - (Vector3){ enemyBoxPos.x + enemyBoxSize.x/2, - enemyBoxPos.y + enemyBoxSize.y/2, - enemyBoxPos.z + enemyBoxSize.z/2 }})) collision = true; - - // Check collisions player vs enemy-sphere - if (CheckCollisionBoxSphere( - (BoundingBox){(Vector3){ playerPosition.x - playerSize.x/2, - playerPosition.y - playerSize.y/2, - playerPosition.z - playerSize.z/2 }, - (Vector3){ playerPosition.x + playerSize.x/2, - playerPosition.y + playerSize.y/2, - playerPosition.z + playerSize.z/2 }}, - enemySpherePos, enemySphereSize)) collision = true; - - if (collision) playerColor = RED; - else playerColor = GREEN; - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - // Draw enemy-box - DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY); - DrawCubeWires(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, DARKGRAY); - - // Draw enemy-sphere - DrawSphere(enemySpherePos, enemySphereSize, GRAY); - DrawSphereWires(enemySpherePos, enemySphereSize, 16, 16, DARKGRAY); - - // Draw player - DrawCubeV(playerPosition, playerSize, playerColor); - - DrawGrid(10, 1.0f); // Draw a grid - - End3dMode(); - - DrawText("Move player with cursors to collide", 220, 40, 20, GRAY); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file diff --git a/docs/examples/src/models/models_cubicmap.c b/docs/examples/src/models/models_cubicmap.c deleted file mode 100644 index 0e613029..00000000 --- a/docs/examples/src/models/models_cubicmap.c +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Cubicmap loading and drawing -* -* This example has been created using raylib 1.3 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - cubesmap loading and drawing"); - - // Define the camera to look into our 3d world - Camera camera = {{ 16.0f, 14.0f, 16.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; - - Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM) - Texture2D cubicmap = LoadTextureFromImage(image); // Convert image to texture to display (VRAM) - Model map = LoadCubicmap(image); // Load cubicmap model (generate model from image) - - // NOTE: By default each cube is mapped to one part of texture atlas - Texture2D texture = LoadTexture("resources/cubicmap_atlas.png"); // Load map texture - map.material.texDiffuse = texture; // Set map diffuse texture - - Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position - - UnloadImage(image); // Unload cubesmap image from RAM, already uploaded to VRAM - - SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode - - 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 - //---------------------------------------------------------------------------------- - UpdateCamera(&camera); // Update camera - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - DrawModel(map, mapPosition, 1.0f, WHITE); - - End3dMode(); - - DrawTextureEx(cubicmap, (Vector2){ screenWidth - cubicmap.width*4 - 20, 20 }, 0.0f, 4.0f, WHITE); - DrawRectangleLines(screenWidth - cubicmap.width*4 - 20, 20, cubicmap.width*4, cubicmap.height*4, GREEN); - - DrawText("cubicmap image used to", 658, 90, 10, GRAY); - DrawText("generate map 3d model", 658, 104, 10, GRAY); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - UnloadTexture(cubicmap); // Unload cubicmap texture - UnloadTexture(texture); // Unload map texture - UnloadModel(map); // Unload map model - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -} diff --git a/docs/examples/src/models/models_geometric_shapes.c b/docs/examples/src/models/models_geometric_shapes.c deleted file mode 100644 index a13a1f3b..00000000 --- a/docs/examples/src/models/models_geometric_shapes.c +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Draw some basic geometric shapes (cube, sphere, cylinder...) -* -* 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) 2014 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes"); - - // Define the camera to look into our 3d world - Camera camera = {{ 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; - - 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 - //---------------------------------------------------------------------------------- - // TODO: Update your variables here - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - DrawCube((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, RED); - DrawCubeWires((Vector3){-4.0f, 0.0f, 2.0f}, 2.0f, 5.0f, 2.0f, GOLD); - DrawCubeWires((Vector3){-4.0f, 0.0f, -2.0f}, 3.0f, 6.0f, 2.0f, MAROON); - - DrawSphere((Vector3){-1.0f, 0.0f, -2.0f}, 1.0f, GREEN); - DrawSphereWires((Vector3){1.0f, 0.0f, 2.0f}, 2.0f, 16, 16, LIME); - - DrawCylinder((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, SKYBLUE); - DrawCylinderWires((Vector3){4.0f, 0.0f, -2.0f}, 1.0f, 2.0f, 3.0f, 4, DARKBLUE); - DrawCylinderWires((Vector3){4.5f, -1.0f, 2.0f}, 1.0f, 1.0f, 2.0f, 6, BROWN); - - DrawCylinder((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, GOLD); - DrawCylinderWires((Vector3){1.0f, 0.0f, -4.0f}, 0.0f, 1.5f, 3.0f, 8, PINK); - - DrawGrid(10, 1.0f); // Draw a grid - - End3dMode(); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file diff --git a/docs/examples/src/models/models_heightmap.c b/docs/examples/src/models/models_heightmap.c deleted file mode 100644 index 10069e03..00000000 --- a/docs/examples/src/models/models_heightmap.c +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Heightmap loading and drawing -* -* This example has been created using raylib 1.3 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - heightmap loading and drawing"); - - // Define our custom camera to look into our 3d world - Camera camera = {{ 18.0f, 16.0f, 18.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; - - Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM) - Texture2D texture = LoadTextureFromImage(image); // Convert image to texture (VRAM) - Model map = LoadHeightmap(image, (Vector3){ 16, 8, 16 }); // Load heightmap model with defined size - map.material.texDiffuse = texture; // Set map diffuse texture - Vector3 mapPosition = { -8.0f, 0.0f, -8.0f }; // Set model position (depends on model scaling!) - - UnloadImage(image); // Unload heightmap image from RAM, already uploaded to VRAM - - SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode - - 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 - //---------------------------------------------------------------------------------- - UpdateCamera(&camera); // Update camera - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - // NOTE: Model is scaled to 1/4 of its original size (128x128 units) - DrawModel(map, mapPosition, 1.0f, RED); - - DrawGrid(20, 1.0f); - - End3dMode(); - - DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE); - DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - UnloadTexture(texture); // Unload texture - UnloadModel(map); // Unload model - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file diff --git a/docs/examples/src/models/models_mesh_picking.c b/docs/examples/src/models/models_mesh_picking.c deleted file mode 100644 index 0b5247ec..00000000 --- a/docs/examples/src/models/models_mesh_picking.c +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Mesh picking in 3d mode, ground plane, triangle, mesh -* -* This example has been created using raylib 1.7 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2015 Ramon Santamaria (@raysan5) -* Example contributed by Joel Davis (@joeld42) -* -********************************************************************************************/ - -#include "raylib.h" -#include "raymath.h" - -#define FLT_MAX 3.40282347E+38F // Maximum value of a float, defined in <float.h> - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - mesh picking"); - - // Define the camera to look into our 3d world - Camera camera; - camera.position = (Vector3){ 10.0f, 8.0f, 10.0f }; // Camera position - camera.target = (Vector3){ 0.0f, 2.3f, 0.0f }; // Camera looking at point - camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target) - camera.fovy = 45.0f; // Camera field-of-view Y - - Ray ray; // Picking ray - - Model tower = LoadModel("resources/tower.obj"); // Load OBJ model - Texture2D texture = LoadTexture("resources/tower.png"); // Load model texture - tower.material.texDiffuse = texture; // Set model diffuse texture - - Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position - BoundingBox towerBBox = CalculateBoundingBox(tower.mesh); - bool hitMeshBBox = false; - bool hitTriangle = false; - - // Test triangle - Vector3 ta = (Vector3){ -25.0, 0.5, 0.0 }; - Vector3 tb = (Vector3){ -4.0, 2.5, 1.0 }; - Vector3 tc = (Vector3){ -8.0, 6.5, 0.0 }; - - Vector3 bary = { 0.0f, 0.0f, 0.0f }; - - SetCameraMode(camera, CAMERA_FREE); // Set a free camera mode - - 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 - //---------------------------------------------------------------------------------- - UpdateCamera(&camera); // Update camera - - // Display information about closest hit - RayHitInfo nearestHit; - char *hitObjectName = "None"; - nearestHit.distance = FLT_MAX; - nearestHit.hit = false; - Color cursorColor = WHITE; - - // Get ray and test against ground, triangle, and mesh - ray = GetMouseRay(GetMousePosition(), camera); - - // Check ray collision aginst ground plane - RayHitInfo groundHitInfo = GetCollisionRayGround(ray, 0.0f); - - if ((groundHitInfo.hit) && (groundHitInfo.distance < nearestHit.distance)) - { - nearestHit = groundHitInfo; - cursorColor = GREEN; - hitObjectName = "Ground"; - } - - // Check ray collision against test triangle - RayHitInfo triHitInfo = GetCollisionRayTriangle(ray, ta, tb, tc); - - if ((triHitInfo.hit) && (triHitInfo.distance < nearestHit.distance)) - { - nearestHit = triHitInfo; - cursorColor = PURPLE; - hitObjectName = "Triangle"; - - bary = VectorBarycenter(nearestHit.hitPosition, ta, tb, tc); - hitTriangle = true; - } - else hitTriangle = false; - - RayHitInfo meshHitInfo; - - // Check ray collision against bounding box first, before trying the full ray-mesh test - if (CheckCollisionRayBox(ray, towerBBox)) - { - hitMeshBBox = true; - - // Check ray collision against mesh - meshHitInfo = GetCollisionRayMesh(ray, &tower.mesh); - - if ((meshHitInfo.hit) && (meshHitInfo.distance < nearestHit.distance)) - { - nearestHit = meshHitInfo; - cursorColor = ORANGE; - hitObjectName = "Mesh"; - } - - } hitMeshBBox = false; - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - // Draw the tower - DrawModel(tower, towerPos, 1.0, WHITE); - - // Draw the test triangle - DrawLine3D(ta, tb, PURPLE); - DrawLine3D(tb, tc, PURPLE); - DrawLine3D(tc, ta, PURPLE); - - // Draw the mesh bbox if we hit it - if (hitMeshBBox) DrawBoundingBox(towerBBox, LIME); - - // If we hit something, draw the cursor at the hit point - if (nearestHit.hit) - { - DrawCube(nearestHit.hitPosition, 0.3, 0.3, 0.3, cursorColor); - DrawCubeWires(nearestHit.hitPosition, 0.3, 0.3, 0.3, RED); - - Vector3 normalEnd; - normalEnd.x = nearestHit.hitPosition.x + nearestHit.hitNormal.x; - normalEnd.y = nearestHit.hitPosition.y + nearestHit.hitNormal.y; - normalEnd.z = nearestHit.hitPosition.z + nearestHit.hitNormal.z; - - DrawLine3D(nearestHit.hitPosition, normalEnd, RED); - } - - DrawRay(ray, MAROON); - - DrawGrid(100, 1.0f); - - End3dMode(); - - // Draw some debug GUI text - DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK); - - if (nearestHit.hit) - { - int ypos = 70; - - DrawText(FormatText("Distance: %3.2f", nearestHit.distance), 10, ypos, 10, BLACK); - - DrawText(FormatText("Hit Pos: %3.2f %3.2f %3.2f", - nearestHit.hitPosition.x, - nearestHit.hitPosition.y, - nearestHit.hitPosition.z), 10, ypos + 15, 10, BLACK); - - DrawText(FormatText("Hit Norm: %3.2f %3.2f %3.2f", - nearestHit.hitNormal.x, - nearestHit.hitNormal.y, - nearestHit.hitNormal.z), 10, ypos + 30, 10, BLACK); - - if (hitTriangle) DrawText(FormatText("Barycenter: %3.2f %3.2f %3.2f", bary.x, bary.y, bary.z), 10, ypos + 45, 10, BLACK); - } - - DrawText("Use Mouse to Move Camera", 10, 430, 10, GRAY); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - UnloadModel(tower); // Unload model - UnloadTexture(texture); // Unload texture - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file diff --git a/docs/examples/src/models/models_obj_loading.c b/docs/examples/src/models/models_obj_loading.c deleted file mode 100644 index 50d42d2e..00000000 --- a/docs/examples/src/models/models_obj_loading.c +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************************* -* -* raylib [models] example - Load and draw a 3d model (OBJ) -* -* This example has been created using raylib 1.3 (www.raylib.com) -* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details) -* -* Copyright (c) 2014 Ramon Santamaria (@raysan5) -* -********************************************************************************************/ - -#include "raylib.h" - -int main() -{ - // Initialization - //-------------------------------------------------------------------------------------- - int screenWidth = 800; - int screenHeight = 450; - - InitWindow(screenWidth, screenHeight, "raylib [models] example - obj model loading"); - - // Define the camera to look into our 3d world - Camera camera = {{ 3.0f, 3.0f, 3.0f }, { 0.0f, 1.5f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f }; - - Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model - Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture - dwarf.material.texDiffuse = texture; // Set dwarf model diffuse texture - Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position - - 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 - //---------------------------------------------------------------------------------- - //... - //---------------------------------------------------------------------------------- - - // Draw - //---------------------------------------------------------------------------------- - BeginDrawing(); - - ClearBackground(RAYWHITE); - - Begin3dMode(camera); - - DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture - - DrawGrid(10, 1.0f); // Draw a grid - - DrawGizmo(position); // Draw gizmo - - End3dMode(); - - DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY); - - DrawFPS(10, 10); - - EndDrawing(); - //---------------------------------------------------------------------------------- - } - - // De-Initialization - //-------------------------------------------------------------------------------------- - UnloadTexture(texture); // Unload texture - UnloadModel(dwarf); // Unload model - - CloseWindow(); // Close window and OpenGL context - //-------------------------------------------------------------------------------------- - - return 0; -}
\ No newline at end of file |
