summaryrefslogtreecommitdiffhomepage
path: root/examples/web/shaders/shaders_rlgl_mesh_instanced.data
diff options
context:
space:
mode:
authorRay <[email protected]>2021-03-17 15:14:35 +0100
committerRay <[email protected]>2021-03-17 15:14:35 +0100
commit459a55ab3342a9e6cfbd7e27499332e7d6aa58e8 (patch)
tree0cc826d2c776d0c212fa5605f94a03a572379be5 /examples/web/shaders/shaders_rlgl_mesh_instanced.data
parent647aac406f588b913a1d7dbaf6251aa0532eb25f (diff)
downloadraylib.com-459a55ab3342a9e6cfbd7e27499332e7d6aa58e8.tar.gz
raylib.com-459a55ab3342a9e6cfbd7e27499332e7d6aa58e8.zip
Updated
Diffstat (limited to 'examples/web/shaders/shaders_rlgl_mesh_instanced.data')
-rw-r--r--examples/web/shaders/shaders_rlgl_mesh_instanced.data14
1 files changed, 6 insertions, 8 deletions
diff --git a/examples/web/shaders/shaders_rlgl_mesh_instanced.data b/examples/web/shaders/shaders_rlgl_mesh_instanced.data
index 3a5cdea..5ba3bb5 100644
--- a/examples/web/shaders/shaders_rlgl_mesh_instanced.data
+++ b/examples/web/shaders/shaders_rlgl_mesh_instanced.data
@@ -63,7 +63,7 @@ void main()
precision mediump float;
-// Input vertex attributes (from vertex shader)
+// Input vertex attributes
varying vec3 fragPosition;
varying vec2 fragTexCoord;
varying vec4 fragColor;
@@ -73,11 +73,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;
@@ -112,7 +110,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);
@@ -120,7 +118,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;
}
}