summaryrefslogtreecommitdiffhomepage
path: root/examples/shaders/shaders_model_shader.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-20 16:36:42 +0200
committerRay <[email protected]>2019-05-20 16:36:42 +0200
commitb525039e0ab8bcaa2fd6bde34c72a6405f88ae49 (patch)
tree08f1c79bfe693643564ed78202c9474b7eb83a79 /examples/shaders/shaders_model_shader.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/shaders/shaders_model_shader.c')
-rw-r--r--examples/shaders/shaders_model_shader.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/examples/shaders/shaders_model_shader.c b/examples/shaders/shaders_model_shader.c
index 2717c192..8224a337 100644
--- a/examples/shaders/shaders_model_shader.c
+++ b/examples/shaders/shaders_model_shader.c
@@ -24,13 +24,13 @@
#define GLSL_VERSION 100
#endif
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
-
+ const int screenWidth = 800;
+ const int screenHeight = 450;
+
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - model shader");
@@ -45,16 +45,16 @@ int main()
Model model = LoadModel("resources/models/watermill.obj"); // Load OBJ model
Texture2D texture = LoadTexture("resources/models/watermill_diffuse.png"); // Load model texture
-
+
// Load shader for model
// NOTE: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
model.materials[0].shader = shader; // Set shader effect to 3d model
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Bind texture to model
-
+
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
-
+
SetCameraMode(camera, CAMERA_FREE); // Set an orbital camera mode
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
@@ -81,11 +81,8 @@ int main()
DrawGrid(10, 1.0f); // Draw a grid
EndMode3D();
-
+
DrawText("(c) Watermill 3D model by Alberto Cano", screenWidth - 210, screenHeight - 20, 10, GRAY);
-
- DrawText(FormatText("Camera position: (%.2f, %.2f, %.2f)", camera.position.x, camera.position.y, camera.position.z), 600, 20, 10, BLACK);
- DrawText(FormatText("Camera target: (%.2f, %.2f, %.2f)", camera.target.x, camera.target.y, camera.target.z), 600, 40, 10, GRAY);
DrawFPS(10, 10);