diff options
| author | raysan5 <[email protected]> | 2020-12-24 13:26:30 +0100 |
|---|---|---|
| committer | raysan5 <[email protected]> | 2020-12-24 13:26:30 +0100 |
| commit | 83ab2cb01746a869b625c9d84fbb4737146b73a9 (patch) | |
| tree | 010b0794848d863916e5acb4f766ea9e7ecb6e90 /examples/web/shaders/shaders_postprocessing.data | |
| parent | d11274dcfcb0f349fba16ab4b83d2b96bcac8d1a (diff) | |
| download | raylib.com-83ab2cb01746a869b625c9d84fbb4737146b73a9.tar.gz raylib.com-83ab2cb01746a869b625c9d84fbb4737146b73a9.zip | |
Updated Web examples to raylib 3.5
Diffstat (limited to 'examples/web/shaders/shaders_postprocessing.data')
| -rw-r--r-- | examples/web/shaders/shaders_postprocessing.data | 474 |
1 files changed, 271 insertions, 203 deletions
diff --git a/examples/web/shaders/shaders_postprocessing.data b/examples/web/shaders/shaders_postprocessing.data index 2ba729d..51653c7 100644 --- a/examples/web/shaders/shaders_postprocessing.data +++ b/examples/web/shaders/shaders_postprocessing.data @@ -5116,12 +5116,12 @@ f 1437/204/818 1434/201/817 1442/200/816 �PNG
- +
$7+'9+3 $5.%1+' %!;"5'<2:3)'%,,1/0/.011-)3,362-776En'G$O(s88D72o=AA4Pk?b|GH)F(N1K5P. T$T4[;A=7pd;p5,E_C8JD9sa?k[BHC<dCmT.vfri3OLIJHt_`_]`ab\SfVuldZxpf �H4�M5�a�t>�k-�] �J;�g�s-�}+�PL�TH�Ps�Es�iV�iQ�nk�vp�WK�_P�W{�nX�hZ�sf�th�Q��v��j��|��W��^��f��k��j��m��u��y���/�1$��/ �3(�/O�O�Q.�l�p/�L�O-�u�r0�UJ�tT�{o�TK�pM�og�
�0�0&�7
�6(�U�Q2�d�s0�V�V*�i -�p.�SG�mO�vk�YO�uJ�<؈8�X��T��{��t��M��s��KؒL�nӐu�VȥZ��q̱m��k����u���
��5����0����7��O��w��Q��l��T��kѓϑ-ҫ/��2��(ѐMѐm̯PѲm�O�j�Q�o����4����/��7��R��p��L��n��V��q��������������������˗�蔶̗�榕ԥ�쭨Գ���В�����Ϭ��������䖋劧頋���ы����Ƶ������ӊ�ӂ������������������� +�p.�SG�mO�vk�YO�uJ�<؈8�X��T��{��t��M��s��KؒL�nӐu�VȥZ��q̱m��k����u���
��5����0����7��O��w��Q��l��T��kѓϑ-ҫ/��2��(ѐMѐm̯PѲm�O�j�Q�o����4����/��7��R��p��L��n��V��q��������������������˗�蔶̗�榕ԥ�쭨Գ���В�����Ϭ��������䖋劧頋���ы����Ƶ������ӊ�ӂ������������������� ��w���Ȫ��a⬂�-�_{x����?��X*���(�s�f|��:4;��T��8 �.��*���t����Z��ȁ��rZ,�8�?�ٽ��~��ϱ�o�Q����_�� g� @@ -5381,7 +5381,7 @@ B,q�\�
͉�+� C��{'��s �2(�s�U#@� ������D��O �k�g��{� ܲ�x�ޏ�G�B��b�Kxv@5 -�
@�q�l;��`4xi�@���I�4 [�����#�E��f(�Q{�e �\��Ky�s� �-�'W�����j$Գ)L�� +�
@�q�l;��`4xi�@���I�4 [�����#�E��f(�Q{�e �\��Ky�s� �-�'W�����j$Գ)L�� �=[^��(gb�!��<�p6�?"!?��>`�iv����c�YKI)�8)��kD�/ܣiTfd�H$�����Cs H�`;��a;'�"��j�r37Deg9C�ۺV{y��qVFI)�=�M�� ��h���h���e��ѿ3��h���f�1����Y�܄|�˶C�>0@����ߠ�n��Gtd�S��s2`�P�#W^/c/�� �&p����2B���s͕��s��ش���o.c�:�;v��O(O� �9�W��a��0���p��*�E�@BW��r�?h[X<H
�j,��c����ש�t̡�.l&���p��x��C����A/j�x�wG�Q
@@ -5719,7 +5719,7 @@ GNG���?�=����Q���v�h�#?���� ��M�G�_� @^�1(�������yX �*����� -��8�KY�|�s����_?��#��Gw����g�`�M��!S��9!��5���;�ځ����ߞ +��8�KY�|�s����_?��#��Gw����g�`�M��!S��9!��5���;�ځ����ߞ ��*�f�yI��"��r�{ �{���m�L����Hra~��w��w���J7ydM�H�B���]�� ����� ���M�a�l;��~�?���[3���?0��}W�i��ߟ�;-: @@ -6107,7 +6107,7 @@ H Lk �m - + �%�0m?SP,�Z w
~��i��/'p"���X���PmӚB�+�#n
��T�lP=�vQ���� ��i�ۋP�OQ�O��P�L�6� @@ -6402,7 +6402,7 @@ t'�.ܧH����S���NÃtkI��ʳ��=�0$�S�& 9s�(���b�7-�Q�a�cd�(�`�!���N��� 88`�����N�Gӫ뱶aZ>�%��8� Pj��Y��1���0J�ljPʋ�d�!�&�V��Y�7 -��p&�ޏj?$J��~@��/�e뭀�� +��p&�ޏj?$J��~@��/�e뭀�� �g�����Q+L��W�(j��@�<q��T�09����z��* &���Ĉ�A���<xx�����
(���]����-�ƒ�[���Nm&��f�$��Գ�M�^��{x���[��B�?��b*9��,�Į��ڦH �&�:��nԪ�wd��Y}] �����W�����6��6��|�&GGgg>�:\����S_
^���x���n��|�7 ï�����T�#�|��>8�4�ߩ���+��b/\ld16 @@ -6703,7 +6703,7 @@ tyo�����2ۀ���ӭV�U�ܰ1\��{���|lTk_zVn���=�!u�_��c� 4C/e�Պ��~h�*�2|xq�6�,ŚV)�B�>���{��粵�K$�"Ԋ^h��� ��?���p"�� � ���j���;tp����7�r��(��j�G����P�!p����9��r ����fr礡X�0��#Bu>��=�_g8��BN4"=슫R�`��,4���t�-��I���� ^�5?bR,�Z�x��2P`���ܬ� 7��...h#���P��> �v\W��ʙ �&��S��MP���V�����b!bp]<���ث��%5pJ�dZ�2�����0]Qf������].� �A�r���re -@Jtt|^_��^xk��ԀJ��q-�/2 +@Jtt|^_��^xk��ԀJ��qӱ�L���>�IG�~d�Џ�;��怵�Ŀ��Z!�Ag �Jw������
�XB'��t��7A#m�khp]E����V �ih_����K���1
䭰�6 ����QV�ۗ��jB��?/�)�mB3��
��O`�F�n�bѴN���Y� �<s�%��{��-���?Y����Cd��4��q]��O+�����i�Kt�.
�~.�����?��4H�|/�"�]囸���e p���/���) @@ -6831,7 +6831,7 @@ m�"ӬU\Ln�՚��[���������`�c&pxN��#�����zN�P���int�ӝ���*c_¿�]P�*o�o� %����}x�{r�� ��8�$�Ac(��h�����{��6�+;��~��>�U]�_=�V����q�֣�L 1�fv w��@+L{���ʒx�J
�['�4�i�@��Fk:����i�Qk���M��uP�t�1�e0��f��u����%"�[��w -� +� precision mediump float;
@@ -6844,7 +6844,6 @@ uniform sampler2D texture0; uniform vec4 colDiffuse;
// NOTE: Add here your custom variables
-uniform vec2 resolution = vec2(800, 450);
void main()
{
@@ -6879,121 +6878,65 @@ void main() // Calculate final vertex position
gl_Position = mvp*vec4(vertexPosition, 1.0);
-}#version 330 - -// Input vertex attributes (from vertex shader) -in vec3 fragPosition; -in vec2 fragTexCoord; -in vec4 fragColor; -in vec3 fragNormal; - -// Input uniform values -uniform sampler2D texture0; -uniform vec4 colDiffuse; - -// Output fragment color -out vec4 finalColor; - -// NOTE: Add here your custom variables - -#define MAX_LIGHTS 4 -#define LIGHT_DIRECTIONAL 0 -#define LIGHT_POINT 1 - -struct MaterialProperty { - vec3 color; - int useSampler; - sampler2D sampler; -}; - -struct Light { - int enabled; - int type; - vec3 position; - vec3 target; - vec4 color; -}; - -// Input lighting values -uniform Light lights[MAX_LIGHTS]; -uniform vec4 ambient; -uniform vec3 viewPos; - -void main() -{ - // Texel color fetching from texture sampler - vec4 texelColor = texture(texture0, fragTexCoord); - vec3 lightDot = vec3(0.0); - vec3 normal = normalize(fragNormal); - vec3 viewD = normalize(viewPos - fragPosition); - vec3 specular = vec3(0.0); - - // NOTE: Implement here your fragment shader code - - for (int i = 0; i < MAX_LIGHTS; i++) - { - 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); - } - - float NdotL = max(dot(normal, light), 0.0); - 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); // 16 refers to shine - specular += specCo; - } - } - - finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0))); - finalColor += texelColor*(ambient/10.0); - - // Gamma correction - finalColor = pow(finalColor, vec4(1.0/2.2)); -} -#version 330 - -// Input vertex attributes -in vec3 vertexPosition; -in vec2 vertexTexCoord; -in vec3 vertexNormal; -in vec4 vertexColor; - -// Input uniform values -uniform mat4 mvp; -uniform mat4 matModel; - -// Output vertex attributes (to fragment shader) -out vec3 fragPosition; -out vec2 fragTexCoord; -out vec4 fragColor; -out vec3 fragNormal; - -// NOTE: Add here your custom variables - -void main() -{ - // Send vertex attributes to fragment shader - fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f)); - fragTexCoord = vertexTexCoord; - fragColor = vertexColor; - - mat3 normalMatrix = transpose(inverse(mat3(matModel))); - fragNormal = normalize(normalMatrix*vertexNormal); - - // Calculate final vertex position - gl_Position = mvp*vec4(vertexPosition, 1.0); -} +}#version 100
+
+// Input vertex attributes
+attribute vec3 vertexPosition;
+attribute vec2 vertexTexCoord;
+attribute vec3 vertexNormal;
+attribute vec4 vertexColor;
+
+// Input uniform values
+uniform mat4 mvp;
+uniform mat4 matModel;
+
+// Output vertex attributes (to fragment shader)
+varying vec3 fragPosition;
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+varying vec3 fragNormal;
+
+// NOTE: Add here your custom variables
+
+// https://github.com/glslify/glsl-inverse
+mat3 inverse(mat3 m)
+{
+ float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];
+ float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];
+ float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];
+
+ float b01 = a22*a11 - a12*a21;
+ float b11 = -a22*a10 + a12*a20;
+ float b21 = a21*a10 - a11*a20;
+
+ float det = a00*b01 + a01*b11 + a02*b21;
+
+ return mat3(b01, (-a22*a01 + a02*a21), (a12*a01 - a02*a11),
+ b11, (a22*a00 - a02*a20), (-a12*a00 + a02*a10),
+ b21, (-a21*a00 + a01*a20), (a11*a00 - a01*a10))/det;
+}
+
+// https://github.com/glslify/glsl-transpose
+mat3 transpose(mat3 m)
+{
+ return mat3(m[0][0], m[1][0], m[2][0],
+ m[0][1], m[1][1], m[2][1],
+ m[0][2], m[1][2], m[2][2]);
+}
+
+void main()
+{
+ // Send vertex attributes to fragment shader
+ fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
+ fragTexCoord = vertexTexCoord;
+ fragColor = vertexColor;
+
+ mat3 normalMatrix = transpose(inverse(mat3(matModel)));
+ fragNormal = normalize(normalMatrix*vertexNormal);
+
+ // Calculate final vertex position
+ gl_Position = mvp*vec4(vertexPosition, 1.0);
+}
#version 100
precision mediump float;
@@ -7065,6 +7008,29 @@ void main() tc += texture2D(texture0, fragTexCoord - vec2(offset.z)/renderWidth, 0.0).rgb*weight.z;
gl_FragColor = vec4(tc, 1.0);
+}#version 100
+
+precision mediump float;
+
+// Input vertex attributes (from vertex shader)
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+
+// Input uniform values
+uniform sampler2D texture0;
+uniform sampler2D texture1;
+uniform vec4 colDiffuse;
+
+void main()
+{
+ // Texel color fetching from texture sampler
+ vec4 texelColor0 = texture2D(texture0, fragTexCoord);
+ vec4 texelColor1 = texture2D(texture1, fragTexCoord);
+
+ float x = fract(fragTexCoord.s);
+ float out = smoothstep(0.4, 0.6, x);
+
+ gl_FragColor = mix(texelColor0, texelColor1, out);
}# version 100
precision mediump float;
@@ -7443,21 +7409,20 @@ void main() }
gl_FragColor = texture2D(texture0, uv);
-}#version 330
+}#version 100
+
+precision mediump float;
// Input vertex attributes (from vertex shader)
-in vec2 fragTexCoord;
-in vec4 fragColor;
-in vec3 fragPosition;
-in vec3 fragNormal;
+varying vec3 fragPosition;
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+varying vec3 fragNormal;
// Input uniform values
uniform sampler2D texture0;
uniform vec4 colDiffuse;
-// Output fragment color
-out vec4 finalColor;
-
// NOTE: Add here your custom variables
#define MAX_LIGHTS 4
@@ -7487,7 +7452,7 @@ uniform float fogDensity; void main()
{
// Texel color fetching from texture sampler
- vec4 texelColor = texture(texture0, fragTexCoord);
+ vec4 texelColor = texture2D(texture0, fragTexCoord);
vec3 lightDot = vec3(0.0);
vec3 normal = normalize(fragNormal);
vec3 viewD = normalize(viewPos - fragPosition);
@@ -7500,25 +7465,21 @@ 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);
- }
+
+ 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);
+
float NdotL = max(dot(normal, light), 0.0);
- lightDot += lights[i].color.rgb * NdotL;
+ 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);//16 =shine
+ if (NdotL > 0.0) specCo = pow(max(0.0, dot(viewD, reflect(-(light), normal))), 16.0); // Shine: 16.0
specular += specCo;
-
}
}
- finalColor = (texelColor * ((colDiffuse+vec4(specular,1)) * vec4(lightDot, 1.0)));
- finalColor += texelColor * (ambient/10.0);
+ vec4 finalColor = (texelColor*((colDiffuse + vec4(specular,1))*vec4(lightDot, 1.0)));
+ finalColor += texelColor*(ambient/10.0);
// Gamma correction
finalColor = pow(finalColor, vec4(1.0/2.2));
@@ -7540,39 +7501,7 @@ void main() fogFactor = clamp(fogFactor, 0.0, 1.0);
- finalColor = mix(fogColor, finalColor, fogFactor);
-}
-#version 330
-
-// Input vertex attributes
-in vec3 vertexPosition;
-in vec2 vertexTexCoord;
-in vec3 vertexNormal;
-in vec4 vertexColor;
-
-// Input uniform values
-uniform mat4 mvp;
-uniform mat4 matModel;
-
-// Output vertex attributes (to fragment shader)
-out vec2 fragTexCoord;
-out vec4 fragColor;
-out vec3 fragPosition;
-out vec3 fragNormal;
-
-// NOTE: Add here your custom variables
-
-void main()
-{
- // Send vertex attributes to fragment shader
- fragTexCoord = vertexTexCoord;
- fragColor = vertexColor;
- fragPosition = vec3(matModel*vec4(vertexPosition, 1.0f));
- mat3 normalMatrix = transpose(inverse(mat3(matModel)));
- fragNormal = normalize(normalMatrix*vertexNormal);
-
- // Calculate final vertex position
- gl_Position = mvp*vec4(vertexPosition, 1.0);
+ gl_FragColor = mix(fogColor, finalColor, fogFactor);
}
#version 100
@@ -7681,47 +7610,110 @@ void main() if (norm > 0.999) gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
else gl_FragColor = vec4(Hsv2rgb(vec3(norm, 1.0, 1.0)), 1.0);
}
-#version 330
+#version 100
+
+precision mediump float;
// Input vertex attributes (from vertex shader)
-in vec2 fragTexCoord;
+varying vec3 fragPosition;
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
+varying vec3 fragNormal;
// Input uniform values
uniform sampler2D texture0;
-uniform sampler2D mask;
-uniform int frame;
+uniform vec4 colDiffuse;
+
+// NOTE: Add here your custom variables
+
+#define MAX_LIGHTS 4
+#define LIGHT_DIRECTIONAL 0
+#define LIGHT_POINT 1
-// Output fragment color
-out vec4 finalColor;
+struct MaterialProperty {
+ vec3 color;
+ int useSampler;
+ sampler2D sampler;
+};
+
+struct Light {
+ int enabled;
+ int type;
+ vec3 position;
+ vec3 target;
+ vec4 color;
+};
+
+// Input lighting values
+uniform Light lights[MAX_LIGHTS];
+uniform vec4 ambient;
+uniform vec3 viewPos;
void main()
{
- vec4 maskColour = texture(mask, fragTexCoord+vec2(sin(-frame/150.0)/10.0,cos(-frame/170.0)/10.0));
- if (maskColour.r < 0.25) discard;
- vec4 texelColor = texture(texture0, fragTexCoord+vec2(sin(frame/90.0)/8.0,cos(frame/60.0)/8.0));
+ // Texel color fetching from texture sampler
+ vec4 texelColor = texture2D(texture0, fragTexCoord);
+ vec3 lightDot = vec3(0.0);
+ vec3 normal = normalize(fragNormal);
+ vec3 viewD = normalize(viewPos - fragPosition);
+ vec3 specular = vec3(0.0);
+
+ // NOTE: Implement here your fragment shader code
+
+ for (int i = 0; i < MAX_LIGHTS; i++)
+ {
+ 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);
+ }
+
+ float NdotL = max(dot(normal, light), 0.0);
+ 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
+ specular += specCo;
+ }
+ }
- finalColor = texelColor * maskColour;
+ vec4 finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0)));
+ finalColor += texelColor*(ambient/10.0);
+
+ // Gamma correction
+ gl_FragColor = pow(finalColor, vec4(1.0/2.2));
}
-#version 330
+#version 100
-// Input vertex attributes
-in vec3 vertexPosition;
-in vec2 vertexTexCoord;
+precision mediump float;
+
+// Input vertex attributes (from vertex shader)
+varying vec2 fragTexCoord;
+varying vec4 fragColor;
// Input uniform values
-uniform mat4 mvp;
-uniform mat4 matModel;
+uniform sampler2D texture0;
+uniform sampler2D mask;
+uniform vec4 colDiffuse;
+uniform int frame;
-// Output vertex attributes (to fragment shader)
-out vec2 fragTexCoord;
+// NOTE: Add here your custom variables
void main()
{
- // Send vertex attributes to fragment shader
- fragTexCoord = vertexTexCoord;
+ vec4 maskColour = texture2D(mask, fragTexCoord + vec2(sin(-float(frame)/150.0)/10.0, cos(-float(frame)/170.0)/10.0));
+ if (maskColour.r < 0.25) discard;
+ vec4 texelColor = texture2D(texture0, fragTexCoord + vec2(sin(float(frame)/90.0)/8.0, cos(float(frame)/60.0)/8.0));
- // Calculate final vertex position
- gl_Position = mvp*vec4(vertexPosition, 1.0);
+ gl_FragColor = texelColor*maskColour;
}
#version 100
@@ -7863,8 +7855,6 @@ varying vec4 fragColor; uniform vec3 viewEye;
uniform vec3 viewCenter;
-uniform vec3 viewUp;
-uniform float deltaTime;
uniform float runTime;
uniform vec2 resolution;
@@ -8283,7 +8273,8 @@ void main() #endif
gl_FragColor = vec4( tot, 1.0 );
-}#version 100
+}
+#version 100
precision mediump float;
@@ -8369,6 +8360,83 @@ void main() precision mediump float;
+#define MAX_SPOTS 3
+
+struct Spot {
+ vec2 pos; // window coords of spot
+ float inner; // inner fully transparent centre radius
+ float radius; // alpha fades out to this radius
+};
+
+uniform Spot spots[MAX_SPOTS]; // Spotlight positions array
+uniform float screenWidth; // Width of the screen
+
+void main()
+{
+ float alpha = 1.0;
+
+ // Get the position of the current fragment (screen coordinates!)
+ vec2 pos = vec2(gl_FragCoord.x, gl_FragCoord.y);
+
+ // Find out which spotlight is nearest
+ float d = 65000.0; // some high value
+ int fi = -1; // found index
+
+ for (int i = 0; i < MAX_SPOTS; i++)
+ {
+ for (int j = 0; j < MAX_SPOTS; j++)
+ {
+ float dj = distance(pos, spots[j].pos) - spots[j].radius + spots[i].radius;
+
+ if (d > dj)
+ {
+ d = dj;
+ fi = i;
+ }
+ }
+ }
+
+ // d now equals distance to nearest spot...
+ // allowing for the different radii of all spotlights
+ if (fi == 0)
+ {
+ if (d > spots[0].radius) alpha = 1.0;
+ else
+ {
+ if (d < spots[0].inner) alpha = 0.0;
+ else alpha = (d - spots[0].inner)/(spots[0].radius - spots[0].inner);
+ }
+ }
+ else if (fi == 1)
+ {
+ if (d > spots[1].radius) alpha = 1.0;
+ else
+ {
+ if (d < spots[1].inner) alpha = 0.0;
+ else alpha = (d - spots[1].inner)/(spots[1].radius - spots[1].inner);
+ }
+ }
+ else if (fi == 2)
+ {
+ if (d > spots[2].radius) alpha = 1.0;
+ else
+ {
+ if (d < spots[2].inner) alpha = 0.0;
+ else alpha = (d - spots[2].inner)/(spots[2].radius - spots[2].inner);
+ }
+ }
+
+ // Right hand side of screen is dimly lit,
+ // could make the threshold value user definable
+ if ((pos.x > screenWidth/2.0) && (alpha > 0.9)) alpha = 0.9;
+
+ // could make the black out colour user definable...
+ gl_FragColor = vec4(0, 0, 0, alpha);
+}
+#version 100
+
+precision mediump float;
+
// Input vertex attributes (from vertex shader)
varying vec2 fragTexCoord;
varying vec4 fragColor;
|
