step_04.glsl Diff

step_03.glsl to step_04.glsl diff
--- /home/docs/checkouts/readthedocs.org/user_builds/arcade-library/checkouts/development/doc/tutorials/raycasting/step_03.glsl
+++ /home/docs/checkouts/readthedocs.org/user_builds/arcade-library/checkouts/development/doc/tutorials/raycasting/step_04.glsl
@@ -2,6 +2,15 @@
 uniform vec2 lightPosition;
 // Size of light in pixels
 uniform float lightSize;
+
+float terrain(vec2 samplePoint)
+{
+    float samplePointAlpha = texture(iChannel0, samplePoint).a;
+    float sampleStepped = step(0.1, samplePointAlpha);
+    float returnValue = 1.0 - sampleStepped;
+
+    return returnValue;
+}
 
 void mainImage( out vec4 fragColor, in vec2 fragCoord )
 {
@@ -14,6 +23,9 @@
     // Start our mixing variable at 1.0
     float lightAmount = 1.0;
 
+    float shadowAmount = terrain(normalizedFragCoord);
+    lightAmount *= shadowAmount;
+
     // Find out how much light we have based on the distance to our light
     lightAmount *= 1.0 - smoothstep(0.0, lightSize, distanceToLight);