diff options
| author | Ray <raysan5@gmail.com> | 2016-07-19 12:48:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-19 12:48:55 +0200 |
| commit | ab0d19f356dc6aadff11ab4034880c8759315000 (patch) | |
| tree | fcd102935dcbd0d007fc413e8e97ba9c4fd90701 /shaders/glsl330/standard.fs | |
| parent | 13e18c23edb668e40d07c100fd1652c9c0af300b (diff) | |
| parent | c482f37dfde9343ee1cc315153dcef80254c7a0b (diff) | |
| download | raylib-ab0d19f356dc6aadff11ab4034880c8759315000.tar.gz raylib-ab0d19f356dc6aadff11ab4034880c8759315000.zip | |
Merge pull request #137 from raysan5/develop1.5.0
Integrate Develop branch
Diffstat (limited to 'shaders/glsl330/standard.fs')
| -rw-r--r-- | shaders/glsl330/standard.fs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/shaders/glsl330/standard.fs b/shaders/glsl330/standard.fs index e5a6d1bc..f728be81 100644 --- a/shaders/glsl330/standard.fs +++ b/shaders/glsl330/standard.fs @@ -34,7 +34,6 @@ struct Light { }; const int maxLights = 8; -uniform int lightsCount; uniform Light lights[maxLights]; vec3 CalcPointLight(Light l, vec3 n, vec3 v, float s) @@ -134,19 +133,15 @@ void main() float spec = 1.0; if (useSpecular == 1) spec *= normalize(texture(texture2, fragTexCoord).r); - for (int i = 0; i < lightsCount; i++) + for (int i = 0; i < maxLights; i++) { // Check if light is enabled if (lights[i].enabled == 1) { // Calculate lighting based on light type - switch (lights[i].type) - { - case 0: lighting += CalcPointLight(lights[i], n, v, spec); break; - case 1: lighting += CalcDirectionalLight(lights[i], n, v, spec); break; - case 2: lighting += CalcSpotLight(lights[i], n, v, spec); break; - default: break; - } + if(lights[i].type == 0) lighting += CalcPointLight(lights[i], n, v, spec); + else if(lights[i].type == 1) lighting += CalcDirectionalLight(lights[i], n, v, spec); + else if(lights[i].type == 2) lighting += CalcSpotLight(lights[i], n, v, spec); } } |
