aboutsummaryrefslogtreecommitdiff
path: root/examples/models
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2017-04-08 23:31:58 +0200
committerRay <raysan5@gmail.com>2017-04-08 23:31:58 +0200
commit20d205cae5bf78d00fb03c266999c33488cbd2c8 (patch)
tree8aafb630d19f3a2a827bf212e16c531a0c672d41 /examples/models
parent5fd83708cf860db358d843cb30f99a88aaf3bd2c (diff)
downloadraylib-20d205cae5bf78d00fb03c266999c33488cbd2c8.tar.gz
raylib-20d205cae5bf78d00fb03c266999c33488cbd2c8.zip
Working on examples...
Diffstat (limited to 'examples/models')
-rw-r--r--examples/models/models_ray_picking.c19
-rw-r--r--examples/models/resources/tower.obj (renamed from examples/models/resources/model/lowpoly-tower.obj)0
-rw-r--r--examples/models/resources/tower.png (renamed from examples/models/resources/model/lowpoly-tower.png)bin24939 -> 24939 bytes
3 files changed, 11 insertions, 8 deletions
diff --git a/examples/models/models_ray_picking.c b/examples/models/models_ray_picking.c
index 67b13155..55914fa2 100644
--- a/examples/models/models_ray_picking.c
+++ b/examples/models/models_ray_picking.c
@@ -11,7 +11,7 @@
********************************************************************************************/
#include "raylib.h"
-#include "../src/raymath.h"
+#include "raymath.h"
#include <stdio.h>
#include <float.h>
@@ -28,19 +28,19 @@ int main()
// Define the camera to look into our 3d world
Camera camera;
- camera.position = (Vector3){ 10.0f, 8.0f, 10.0f }; // Camera position
+ 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 line ray
- Model tower = LoadModel("resources/model/lowpoly-tower.obj"); // Load OBJ model
- Texture2D texture = LoadTexture("resources/model/lowpoly-tower.png"); // Load model texture
- tower.material.texDiffuse = texture; // Set model diffuse texture
+ 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 );
+ Vector3 towerPos = { 0.0f, 0.0f, 0.0f }; // Set model position
+ BoundingBox towerBBox = CalculateBoundingBox(tower.mesh);
bool hitMeshBBox = false;
bool hitTriangle = false;
@@ -187,7 +187,10 @@ int main()
// De-Initialization
//--------------------------------------------------------------------------------------
- CloseWindow(); // Close window and OpenGL context
+ UnloadModel(tower); // Unload model
+ UnloadTexture(texture); // Unload texture
+
+ CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
diff --git a/examples/models/resources/model/lowpoly-tower.obj b/examples/models/resources/tower.obj
index ea03a9fc..ea03a9fc 100644
--- a/examples/models/resources/model/lowpoly-tower.obj
+++ b/examples/models/resources/tower.obj
diff --git a/examples/models/resources/model/lowpoly-tower.png b/examples/models/resources/tower.png
index 7c9239e2..7c9239e2 100644
--- a/examples/models/resources/model/lowpoly-tower.png
+++ b/examples/models/resources/tower.png
Binary files differ