summaryrefslogtreecommitdiff
path: root/examples/resources
diff options
context:
space:
mode:
authorjussi2023-11-16 22:37:28 +0200
committerjussi2023-11-16 22:37:28 +0200
commit5c8324d25f5f3500d5258f599afc710352611513 (patch)
treefa92484c2aeabc7b7d66b53f12dd1e9c5c984652 /examples/resources
parent118a1f3a8bc468077fdd8bac4d46c452965ce283 (diff)
downloadreilua-enhanced-5c8324d25f5f3500d5258f599afc710352611513.tar.gz
reilua-enhanced-5c8324d25f5f3500d5258f599afc710352611513.tar.bz2
reilua-enhanced-5c8324d25f5f3500d5258f599afc710352611513.zip
Lightmap 100 and 120 shaders. Snake and platformer example refining.
Diffstat (limited to 'examples/resources')
-rw-r--r--examples/resources/shaders/glsl100/lightmap.fs22
-rw-r--r--examples/resources/shaders/glsl100/lightmap.vs31
-rw-r--r--examples/resources/shaders/glsl120/lightmap.fs20
-rw-r--r--examples/resources/shaders/glsl120/lightmap.vs31
4 files changed, 104 insertions, 0 deletions
diff --git a/examples/resources/shaders/glsl100/lightmap.fs b/examples/resources/shaders/glsl100/lightmap.fs
new file mode 100644
index 0000000..9f0bcd2
--- /dev/null
+++ b/examples/resources/shaders/glsl100/lightmap.fs
@@ -0,0 +1,22 @@
+#version 100
+
+precision mediump float;
+
+// Input vertex attributes (from vertex shader)
+varying vec2 fragTexCoord;
+varying vec2 fragTexCoord2;
+varying vec3 fragPosition;
+varying vec4 fragColor;
+
+// Input uniform values
+uniform sampler2D texture0;
+uniform sampler2D texture1;
+
+void main()
+{
+ // Texel color fetching from texture sampler
+ vec4 texelColor = texture2D(texture0, fragTexCoord);
+ vec4 texelColor2 = texture2D(texture1, fragTexCoord2);
+
+ gl_FragColor = texelColor * texelColor2;
+}
diff --git a/examples/resources/shaders/glsl100/lightmap.vs b/examples/resources/shaders/glsl100/lightmap.vs
new file mode 100644
index 0000000..f5d87b3
--- /dev/null
+++ b/examples/resources/shaders/glsl100/lightmap.vs
@@ -0,0 +1,31 @@
+#version 100
+
+// Input vertex attributes
+attribute vec3 vertexPosition;
+attribute vec2 vertexTexCoord;
+attribute vec2 vertexTexCoord2;
+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 vec2 fragTexCoord2;
+varying vec4 fragColor;
+
+// NOTE: Add here your custom variables
+
+void main()
+{
+ // Send vertex attributes to fragment shader
+ fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
+ fragTexCoord = vertexTexCoord;
+ fragTexCoord2 = vertexTexCoord2;
+ fragColor = vertexColor;
+
+ // Calculate final vertex position
+ gl_Position = mvp*vec4(vertexPosition, 1.0);
+}
diff --git a/examples/resources/shaders/glsl120/lightmap.fs b/examples/resources/shaders/glsl120/lightmap.fs
new file mode 100644
index 0000000..93a0609
--- /dev/null
+++ b/examples/resources/shaders/glsl120/lightmap.fs
@@ -0,0 +1,20 @@
+#version 120
+
+// Input vertex attributes (from vertex shader)
+varying vec2 fragTexCoord;
+varying vec2 fragTexCoord2;
+varying vec3 fragPosition;
+varying vec4 fragColor;
+
+// Input uniform values
+uniform sampler2D texture0;
+uniform sampler2D texture1;
+
+void main()
+{
+ // Texel color fetching from texture sampler
+ vec4 texelColor = texture2D(texture0, fragTexCoord);
+ vec4 texelColor2 = texture2D(texture1, fragTexCoord2);
+
+ gl_FragColor = texelColor * texelColor2;
+}
diff --git a/examples/resources/shaders/glsl120/lightmap.vs b/examples/resources/shaders/glsl120/lightmap.vs
new file mode 100644
index 0000000..9847b25
--- /dev/null
+++ b/examples/resources/shaders/glsl120/lightmap.vs
@@ -0,0 +1,31 @@
+#version 120
+
+// Input vertex attributes
+attribute vec3 vertexPosition;
+attribute vec2 vertexTexCoord;
+attribute vec2 vertexTexCoord2;
+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 vec2 fragTexCoord2;
+varying vec4 fragColor;
+
+// NOTE: Add here your custom variables
+
+void main()
+{
+ // Send vertex attributes to fragment shader
+ fragPosition = vec3(matModel*vec4(vertexPosition, 1.0));
+ fragTexCoord = vertexTexCoord;
+ fragTexCoord2 = vertexTexCoord2;
+ fragColor = vertexColor;
+
+ // Calculate final vertex position
+ gl_Position = mvp*vec4(vertexPosition, 1.0);
+}