diff options
| author | Ray <[email protected]> | 2021-03-17 15:14:35 +0100 |
|---|---|---|
| committer | Ray <[email protected]> | 2021-03-17 15:14:35 +0100 |
| commit | 459a55ab3342a9e6cfbd7e27499332e7d6aa58e8 (patch) | |
| tree | 0cc826d2c776d0c212fa5605f94a03a572379be5 /examples/web/shaders/resources | |
| parent | 647aac406f588b913a1d7dbaf6251aa0532eb25f (diff) | |
| download | raylib.com-459a55ab3342a9e6cfbd7e27499332e7d6aa58e8.tar.gz raylib.com-459a55ab3342a9e6cfbd7e27499332e7d6aa58e8.zip | |
Updated
Diffstat (limited to 'examples/web/shaders/resources')
| -rw-r--r-- | examples/web/shaders/resources/shaders/glsl100/lighting.fs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/examples/web/shaders/resources/shaders/glsl100/lighting.fs b/examples/web/shaders/resources/shaders/glsl100/lighting.fs index 1d60a83..1a4faa7 100644 --- a/examples/web/shaders/resources/shaders/glsl100/lighting.fs +++ b/examples/web/shaders/resources/shaders/glsl100/lighting.fs @@ -2,7 +2,7 @@ precision mediump float; -// Input vertex attributes (from vertex shader) +// Input vertex attributes varying vec3 fragPosition; varying vec2 fragTexCoord; varying vec4 fragColor; @@ -12,11 +12,9 @@ varying vec3 fragNormal; uniform sampler2D texture0; uniform vec4 colDiffuse; -// NOTE: Add here your custom variables - -#define MAX_LIGHTS 4 -#define LIGHT_DIRECTIONAL 0 -#define LIGHT_POINT 1 +#define MAX_LIGHTS 4 +#define LIGHT_DIRECTIONAL 0 +#define LIGHT_POINT 1 struct MaterialProperty { vec3 color; @@ -51,7 +49,7 @@ void main() if (lights[i].enabled == 1) { vec3 light = vec3(0.0); - + if (lights[i].type == LIGHT_DIRECTIONAL) light = -normalize(lights[i].target - lights[i].position); if (lights[i].type == LIGHT_POINT) light = normalize(lights[i].position - fragPosition); @@ -59,7 +57,7 @@ void main() lightDot += lights[i].color.rgb*NdotL; float specCo = 0.0; - if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // 16 refers to shine + if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); specular += specCo; } } |
