summaryrefslogtreecommitdiffhomepage
path: root/examples/models
diff options
context:
space:
mode:
authorDavid Reid <[email protected]>2018-05-21 20:26:28 +1000
committerDavid Reid <[email protected]>2018-05-21 20:26:28 +1000
commit6d8cc250bd086a6bfdf34effad4b9b3cca3e97a7 (patch)
tree95d9092e666ef409dd4cb75a5f836e37acabfdf9 /examples/models
parent3ca5047c8285318c2385c6b52b2e2b5f12905f0d (diff)
parente025e62445913bf1ec9cf075eaaf1dc7374da83c (diff)
downloadraylib-6d8cc250bd086a6bfdf34effad4b9b3cca3e97a7.tar.gz
raylib-6d8cc250bd086a6bfdf34effad4b9b3cca3e97a7.zip
Merge branch 'master' of https://github.com/raysan5/raylib into dr/mini_al
Diffstat (limited to 'examples/models')
-rw-r--r--examples/models/models_billboard.c4
-rw-r--r--examples/models/models_box_collisions.c4
-rw-r--r--examples/models/models_cubicmap.c4
-rw-r--r--examples/models/models_geometric_shapes.c4
-rw-r--r--examples/models/models_heightmap.c4
-rw-r--r--examples/models/models_material_pbr.c7
-rw-r--r--examples/models/models_mesh_generation.c4
-rw-r--r--examples/models/models_mesh_picking.c5
-rw-r--r--examples/models/models_obj_loading.c14
-rw-r--r--examples/models/models_orthographic_projection.c4
-rw-r--r--examples/models/models_skybox.c4
-rw-r--r--examples/models/models_yaw_pitch_roll.c4
-rw-r--r--examples/models/resources/shaders/pbr.vs6
13 files changed, 35 insertions, 33 deletions
diff --git a/examples/models/models_billboard.c b/examples/models/models_billboard.c
index 3b3efc47..8ce6a44f 100644
--- a/examples/models/models_billboard.c
+++ b/examples/models/models_billboard.c
@@ -51,13 +51,13 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawBillboard(camera, bill, billPosition, 2.0f, WHITE);
DrawGrid(10, 1.0f); // Draw a grid
- End3dMode();
+ EndMode3D();
DrawFPS(10, 10);
diff --git a/examples/models/models_box_collisions.c b/examples/models/models_box_collisions.c
index eb72c54c..41f6056c 100644
--- a/examples/models/models_box_collisions.c
+++ b/examples/models/models_box_collisions.c
@@ -87,7 +87,7 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
// Draw enemy-box
DrawCube(enemyBoxPos, enemyBoxSize.x, enemyBoxSize.y, enemyBoxSize.z, GRAY);
@@ -102,7 +102,7 @@ int main()
DrawGrid(10, 1.0f); // Draw a grid
- End3dMode();
+ EndMode3D();
DrawText("Move player with cursors to collide", 220, 40, 20, GRAY);
diff --git a/examples/models/models_cubicmap.c b/examples/models/models_cubicmap.c
index 47b88748..c8d62c46 100644
--- a/examples/models/models_cubicmap.c
+++ b/examples/models/models_cubicmap.c
@@ -56,11 +56,11 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(model, mapPosition, 1.0f, WHITE);
- End3dMode();
+ EndMode3D();
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);
diff --git a/examples/models/models_geometric_shapes.c b/examples/models/models_geometric_shapes.c
index 7a1e7e48..82ca4c60 100644
--- a/examples/models/models_geometric_shapes.c
+++ b/examples/models/models_geometric_shapes.c
@@ -45,7 +45,7 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(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);
@@ -63,7 +63,7 @@ int main()
DrawGrid(10, 1.0f); // Draw a grid
- End3dMode();
+ EndMode3D();
DrawFPS(10, 10);
diff --git a/examples/models/models_heightmap.c b/examples/models/models_heightmap.c
index 55474185..d131b127 100644
--- a/examples/models/models_heightmap.c
+++ b/examples/models/models_heightmap.c
@@ -53,13 +53,13 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(model, mapPosition, 1.0f, RED);
DrawGrid(20, 1.0f);
- End3dMode();
+ EndMode3D();
DrawTexture(texture, screenWidth - texture.width - 20, 20, WHITE);
DrawRectangleLines(screenWidth - texture.width - 20, 20, texture.width, texture.height, GREEN);
diff --git a/examples/models/models_material_pbr.c b/examples/models/models_material_pbr.c
index 4ad2c9e7..d50ef3da 100644
--- a/examples/models/models_material_pbr.c
+++ b/examples/models/models_material_pbr.c
@@ -38,6 +38,7 @@ int main()
// Load model and PBR material
Model model = LoadModel("resources/pbr/trooper.obj");
+ MeshTangents(&model.mesh);
model.material = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
// Define lights attributes
@@ -72,13 +73,13 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(model, Vector3Zero(), 1.0f, WHITE);
DrawGrid(10, 1.0f);
- End3dMode();
+ EndMode3D();
DrawFPS(10, 10);
@@ -121,7 +122,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
mat.shader.locs[LOC_MAP_BRDF] = GetShaderLocation(mat.shader, "brdfLUT");
// Set view matrix location
- mat.shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "mMatrix");
+ mat.shader.locs[LOC_MATRIX_MODEL] = GetShaderLocation(mat.shader, "matModel");
mat.shader.locs[LOC_MATRIX_VIEW] = GetShaderLocation(mat.shader, "view");
mat.shader.locs[LOC_VECTOR_VIEW] = GetShaderLocation(mat.shader, "viewPos");
diff --git a/examples/models/models_mesh_generation.c b/examples/models/models_mesh_generation.c
index d9c28ac2..c02bd91a 100644
--- a/examples/models/models_mesh_generation.c
+++ b/examples/models/models_mesh_generation.c
@@ -72,13 +72,13 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(models[currentModel], position, 1.0f, WHITE);
DrawGrid(10, 1.0);
- End3dMode();
+ EndMode3D();
DrawRectangle(30, 400, 310, 30, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(30, 400, 310, 30, Fade(DARKBLUE, 0.5f));
diff --git a/examples/models/models_mesh_picking.c b/examples/models/models_mesh_picking.c
index e09f9860..56b9397a 100644
--- a/examples/models/models_mesh_picking.c
+++ b/examples/models/models_mesh_picking.c
@@ -30,6 +30,7 @@ int main()
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
+ camera.type = CAMERA_PERSPECTIVE; // Camera mode type
Ray ray; // Picking ray
@@ -120,7 +121,7 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
// Draw the tower
DrawModel(tower, towerPos, 1.0, WHITE);
@@ -151,7 +152,7 @@ int main()
DrawGrid(100, 1.0f);
- End3dMode();
+ EndMode3D();
// Draw some debug GUI text
DrawText(FormatText("Hit Object: %s", hitObjectName), 10, 50, 10, BLACK);
diff --git a/examples/models/models_obj_loading.c b/examples/models/models_obj_loading.c
index 4f89130f..45eb3e98 100644
--- a/examples/models/models_obj_loading.c
+++ b/examples/models/models_obj_loading.c
@@ -22,11 +22,11 @@ int main()
// Define the camera to look into our 3d world
Camera camera = { 0 };
- camera.position = (Vector3){ 3.0f, 3.0f, 3.0f };
- camera.target = (Vector3){ 0.0f, 1.5f, 0.0f };
- camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
- camera.fovy = 45.0f;
- camera.type = CAMERA_PERSPECTIVE;
+ camera.position = (Vector3){ 3.0f, 3.0f, 3.0f }; // Camera position
+ camera.target = (Vector3){ 0.0f, 1.5f, 0.0f }; // Camera looking at point
+ camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
+ camera.fovy = 45.0f; // Camera field-of-view Y
+ camera.type = CAMERA_PERSPECTIVE; // Camera mode type
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model texture
@@ -50,7 +50,7 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
@@ -58,7 +58,7 @@ int main()
DrawGizmo(position); // Draw gizmo
- End3dMode();
+ EndMode3D();
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
diff --git a/examples/models/models_orthographic_projection.c b/examples/models/models_orthographic_projection.c
index cb5ea053..f9b54b6d 100644
--- a/examples/models/models_orthographic_projection.c
+++ b/examples/models/models_orthographic_projection.c
@@ -57,7 +57,7 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(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);
@@ -75,7 +75,7 @@ int main()
DrawGrid(10, 1.0f); // Draw a grid
- End3dMode();
+ EndMode3D();
DrawText("Press Spacebar to switch camera type", 10, GetScreenHeight() - 30, 20, DARKGRAY);
diff --git a/examples/models/models_skybox.c b/examples/models/models_skybox.c
index 700824d3..589f139b 100644
--- a/examples/models/models_skybox.c
+++ b/examples/models/models_skybox.c
@@ -60,13 +60,13 @@ int main()
ClearBackground(RAYWHITE);
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(skybox, (Vector3){0, 0, 0}, 1.0f, WHITE);
DrawGrid(10, 1.0f);
- End3dMode();
+ EndMode3D();
DrawFPS(10, 10);
diff --git a/examples/models/models_yaw_pitch_roll.c b/examples/models/models_yaw_pitch_roll.c
index c559e67b..0dcf8c70 100644
--- a/examples/models/models_yaw_pitch_roll.c
+++ b/examples/models/models_yaw_pitch_roll.c
@@ -137,12 +137,12 @@ int main()
EndTextureMode();
// Draw 3D model (recomended to draw 3D always before 2D)
- Begin3dMode(camera);
+ BeginMode3D(camera);
DrawModel(model, (Vector3){ 0, 6.0f, 0 }, 1.0f, WHITE); // Draw 3d model with texture
DrawGrid(10, 10.0f);
- End3dMode();
+ EndMode3D();
// Draw 2D GUI stuff
DrawAngleGauge(texAngleGauge, 80, 70, roll, "roll", RED);
diff --git a/examples/models/resources/shaders/pbr.vs b/examples/models/resources/shaders/pbr.vs
index 885cb199..8bd3faa1 100644
--- a/examples/models/resources/shaders/pbr.vs
+++ b/examples/models/resources/shaders/pbr.vs
@@ -16,7 +16,7 @@ in vec4 vertexTangent;
// Input uniform values
uniform mat4 mvp;
-uniform mat4 mMatrix;
+uniform mat4 matModel;
// Output vertex attributes (to fragment shader)
out vec3 fragPosition;
@@ -31,10 +31,10 @@ void main()
vec3 vertexBinormal = cross(vertexNormal, vec3(vertexTangent));
// Calculate fragment normal based on normal transformations
- mat3 normalMatrix = transpose(inverse(mat3(mMatrix)));
+ mat3 normalMatrix = transpose(inverse(mat3(matModel)));
// Calculate fragment position based on model transformations
- fragPosition = vec3(mMatrix*vec4(vertexPosition, 1.0f));
+ fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
// Send vertex attributes to fragment shader
fragTexCoord = vertexTexCoord;