From 61558ab83faa52e738b264ea85fe34448651ba87 Mon Sep 17 00:00:00 2001 From: raysan5 Date: Tue, 19 Jul 2016 10:57:35 +0200 Subject: Updated shaders pack Some deep review of this shaders is required for optimization... --- shaders/glsl330/standard.fs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'shaders/glsl330/standard.fs') 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); } } -- cgit v1.2.3