summaryrefslogtreecommitdiffhomepage
path: root/examples/shaders_standard_lighting.c
diff options
context:
space:
mode:
authorJoshua Reisenauer <[email protected]>2016-05-30 15:39:21 -0700
committerJoshua Reisenauer <[email protected]>2016-05-30 15:39:21 -0700
commit6ad832386097d6301555490e94cf9cc2c882137d (patch)
tree2f18bcb487aabe5b3b6073f88078a986328fbec2 /examples/shaders_standard_lighting.c
parent9f2fc81df2ad6731b521bd7dfd523ee10f63be90 (diff)
parent8a4e28f81db16c034274e5d78dddfe33824e59fe (diff)
downloadraylib-6ad832386097d6301555490e94cf9cc2c882137d.tar.gz
raylib-6ad832386097d6301555490e94cf9cc2c882137d.zip
Merge remote-tracking branch 'refs/remotes/raysan5/develop' into develop
Diffstat (limited to 'examples/shaders_standard_lighting.c')
-rw-r--r--examples/shaders_standard_lighting.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/examples/shaders_standard_lighting.c b/examples/shaders_standard_lighting.c
index 2dde7193..6b5cd9f5 100644
--- a/examples/shaders_standard_lighting.c
+++ b/examples/shaders_standard_lighting.c
@@ -22,8 +22,8 @@ int main()
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ int screenWidth = 1280;
+ int screenHeight = 720;
SetConfigFlags(FLAG_MSAA_4X_HINT); // Enable Multi Sampling Anti Aliasing 4x (if available)
@@ -36,13 +36,18 @@ int main()
Model dwarf = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
Material material = LoadStandardMaterial();
+
material.texDiffuse = LoadTexture("resources/model/dwarf_diffuse.png"); // Load model diffuse texture
+ material.texNormal = LoadTexture("resources/model/dwarf_normal.png"); // Load model normal texture
+ material.texSpecular = LoadTexture("resources/model/dwarf_specular.png"); // Load model specular texture
material.colDiffuse = (Color){255, 255, 255, 255};
material.colAmbient = (Color){0, 0, 10, 255};
material.colSpecular = (Color){255, 255, 255, 255};
material.glossiness = 50.0f;
dwarf.material = material; // Apply material to model
+
+ Model dwarf2 = LoadModel("resources/model/dwarf.obj"); // Load OBJ model
Light spotLight = CreateLight(LIGHT_SPOT, (Vector3){3.0f, 5.0f, 2.0f}, (Color){255, 255, 255, 255});
spotLight->target = (Vector3){0.0f, 0.0f, 0.0f};
@@ -58,10 +63,10 @@ int main()
Light pointLight = CreateLight(LIGHT_POINT, (Vector3){0.0f, 4.0f, 5.0f}, (Color){255, 255, 255, 255});
pointLight->intensity = 2.0f;
pointLight->diffuse = (Color){100, 100, 255, 255};
- pointLight->attenuation = 3.0f;
+ pointLight->radius = 3.0f;
// Setup orbital camera
- SetCameraMode(CAMERA_ORBITAL); // Set a orbital camera mode
+ SetCameraMode(CAMERA_ORBITAL); // Set an orbital camera mode
SetCameraPosition(camera.position); // Set internal camera position to match our camera position
SetCameraTarget(camera.target); // Set internal camera target to match our camera target
@@ -83,7 +88,7 @@ int main()
ClearBackground(RAYWHITE);
Begin3dMode(camera);
-
+
DrawModel(dwarf, position, 2.0f, WHITE); // Draw 3d model with texture
DrawLights(); // Draw all created lights in 3D world
@@ -93,7 +98,7 @@ int main()
End3dMode();
DrawText("(c) Dwarf 3D model by David Moreno", screenWidth - 200, screenHeight - 20, 10, GRAY);
-
+
DrawFPS(10, 10);
EndDrawing();