summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2014-08-16 22:08:13 -0400
committerDavid Thompson <dthompson2@worcester.edu>2014-08-25 19:33:07 -0400
commit39fdda4aaba16990ac271b880059ebeb0d747b43 (patch)
tree5190bd82d764237dc6371c41cec469550dccd237 /data
parent2f27f5c49a61d0d891b2d2f045915a89365762ae (diff)
Use a single default shader for all meshes.
* data/shaders/default-fragment.glsl: New file. * data/shaders/default-vertex.glsl: New file. * data/shaders/font-fragment.glsl: Delete. * data/shaders/font-vertex.glsl: Delete. * data/shaders/sprite-fragment.glsl: Delete. * data/shaders/sprite-vertex.glsl: Delete. * examples/common.scm: Remove call to enable-sprites. * sly/font.scm (font-shader): Delete. (enable-fonts): Remove shader loading. (make-label): Use default shader. * sly/shape.scm (make-cube): Make texture and shader optional keyword arguments. * sly/sprite.scm (sprite-shader, enable-sprites): Delete. (make-sprite): Make shader an optional keyword argument.
Diffstat (limited to 'data')
-rw-r--r--data/shaders/default-fragment.glsl8
-rw-r--r--data/shaders/default-vertex.glsl11
-rw-r--r--data/shaders/font-fragment.glsl8
-rw-r--r--data/shaders/font-vertex.glsl15
-rw-r--r--data/shaders/sprite-fragment.glsl8
-rw-r--r--data/shaders/sprite-vertex.glsl26
6 files changed, 19 insertions, 57 deletions
diff --git a/data/shaders/default-fragment.glsl b/data/shaders/default-fragment.glsl
new file mode 100644
index 0000000..e90adbe
--- /dev/null
+++ b/data/shaders/default-fragment.glsl
@@ -0,0 +1,8 @@
+#version 130
+
+in vec2 frag_tex;
+uniform sampler2D color_texture;
+
+void main (void) {
+ gl_FragColor = texture2D(color_texture, frag_tex);
+}
diff --git a/data/shaders/default-vertex.glsl b/data/shaders/default-vertex.glsl
new file mode 100644
index 0000000..11f389f
--- /dev/null
+++ b/data/shaders/default-vertex.glsl
@@ -0,0 +1,11 @@
+#version 130
+
+in vec3 position;
+in vec2 tex;
+out vec2 frag_tex;
+uniform mat4 mvp;
+
+void main(void) {
+ frag_tex = tex;
+ gl_Position = mvp * vec4(position.xyz, 1.0);
+}
diff --git a/data/shaders/font-fragment.glsl b/data/shaders/font-fragment.glsl
deleted file mode 100644
index 3dd10f1..0000000
--- a/data/shaders/font-fragment.glsl
+++ /dev/null
@@ -1,8 +0,0 @@
-#version 120
-
-uniform sampler2D color_texture;
-uniform vec4 color;
-
-void main (void) {
- gl_FragColor = texture2D(color_texture, gl_TexCoord[0].st) * color;
-}
diff --git a/data/shaders/font-vertex.glsl b/data/shaders/font-vertex.glsl
deleted file mode 100644
index 196da12..0000000
--- a/data/shaders/font-vertex.glsl
+++ /dev/null
@@ -1,15 +0,0 @@
-#version 120
-
-uniform mat4 projection;
-uniform vec2 position;
-uniform vec2 anchor;
-
-void main(void) {
- mat4 translation = mat4(1.0, 0.0, 0.0, position.x - anchor.x,
- 0.0, 1.0, 0.0, position.y - anchor.y,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0);
-
- gl_Position = projection * (gl_Vertex * translation);
- gl_TexCoord[0] = gl_MultiTexCoord0;
-}
diff --git a/data/shaders/sprite-fragment.glsl b/data/shaders/sprite-fragment.glsl
deleted file mode 100644
index 3dd10f1..0000000
--- a/data/shaders/sprite-fragment.glsl
+++ /dev/null
@@ -1,8 +0,0 @@
-#version 120
-
-uniform sampler2D color_texture;
-uniform vec4 color;
-
-void main (void) {
- gl_FragColor = texture2D(color_texture, gl_TexCoord[0].st) * color;
-}
diff --git a/data/shaders/sprite-vertex.glsl b/data/shaders/sprite-vertex.glsl
deleted file mode 100644
index d6efd3f..0000000
--- a/data/shaders/sprite-vertex.glsl
+++ /dev/null
@@ -1,26 +0,0 @@
-#version 120
-
-uniform mat4 projection;
-uniform vec2 position;
-uniform vec2 anchor;
-uniform vec2 scale;
-uniform float rotation;
-
-void main(void) {
- mat4 rotationMatrix = mat4(cos(rotation), -sin(rotation), 0.0, 0.0,
- sin(rotation), cos(rotation), 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0);
- mat4 translationMatrix = mat4(1.0, 0.0, 0.0, position.x - anchor.x,
- 0.0, 1.0, 0.0, position.y - anchor.y,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0);
- mat4 scaleMatrix = mat4(scale.x, 0.0, 0.0, 0.0,
- 0.0, scale.y, 0.0, 0.0,
- 0.0, 0.0, 1.0, 0.0,
- 0.0, 0.0, 0.0, 1.0);
-
- gl_Position = projection * (gl_Vertex * scaleMatrix *
- rotationMatrix * translationMatrix);
- gl_TexCoord[0] = gl_MultiTexCoord0;
-}