mirror of
https://github.com/raysan5/raylib.git
synced 2026-02-04 05:09:17 -05:00
REVIEWED: Shaders formating to follow raylib code conventions
This commit is contained in:
@ -13,9 +13,9 @@ uniform sampler2D gAlbedoSpec;
|
||||
|
||||
struct Light {
|
||||
int enabled;
|
||||
int type; // Unused in this demo.
|
||||
int type; // Unused in this demo
|
||||
vec3 position;
|
||||
vec3 target; // Unused in this demo.
|
||||
vec3 target; // Unused in this demo
|
||||
vec4 color;
|
||||
};
|
||||
|
||||
@ -38,7 +38,7 @@ void main()
|
||||
|
||||
for (int i = 0; i < NR_LIGHTS; ++i)
|
||||
{
|
||||
if(lights[i].enabled == 0) continue;
|
||||
if (lights[i].enabled == 0) continue;
|
||||
vec3 lightDirection = lights[i].position - fragPosition;
|
||||
vec3 diffuse = max(dot(normal, lightDirection), 0.0)*albedo*lights[i].color.xyz;
|
||||
|
||||
@ -48,7 +48,7 @@ void main()
|
||||
|
||||
// Attenuation
|
||||
float distance = length(lights[i].position - fragPosition);
|
||||
float attenuation = 1.0/(1.0 + LINEAR * distance + QUADRATIC*distance*distance);
|
||||
float attenuation = 1.0/(1.0 + LINEAR*distance + QUADRATIC*distance*distance);
|
||||
diffuse *= attenuation;
|
||||
specular *= attenuation;
|
||||
ambient += diffuse + specular;
|
||||
|
||||
Reference in New Issue
Block a user