diff options
| author | Ray <raysan5@gmail.com> | 2016-05-30 23:25:18 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2016-05-30 23:25:18 +0200 |
| commit | 4b93349db575bedb48b8c13e95d37df1ec694387 (patch) | |
| tree | afcb06723fd9d4f4c0ae7b7d3e9a3f30e494ae1f /examples/shaders_standard_lighting.c | |
| parent | ea5b00528b0cb1e5cc1e7169a195b75915c8607a (diff) | |
| parent | 11cf455fe0d2c956043aa70f7d8256c4a339b430 (diff) | |
| download | raylib-4b93349db575bedb48b8c13e95d37df1ec694387.tar.gz raylib-4b93349db575bedb48b8c13e95d37df1ec694387.zip | |
Merge pull request #122 from victorfisac/develop
Standard Lighting (3/3)
Diffstat (limited to 'examples/shaders_standard_lighting.c')
| -rw-r--r-- | examples/shaders_standard_lighting.c | 17 |
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(); |
