summaryrefslogtreecommitdiff
path: root/data/simple.vert
diff options
context:
space:
mode:
Diffstat (limited to 'data/simple.vert')
-rw-r--r--data/simple.vert25
1 files changed, 16 insertions, 9 deletions
diff --git a/data/simple.vert b/data/simple.vert
index 1850a67..6fdb13b 100644
--- a/data/simple.vert
+++ b/data/simple.vert
@@ -3,6 +3,7 @@
uniform mat4 mvp;
uniform mat3 mv_normal;
+uniform mat4x3 k_uniform[4];
layout(location = 0) in vec2 uv;
@@ -14,15 +15,21 @@ out vec3 normal_cs;
void main(void)
{
- /* Center the region at the origin. Assume that it's 7 units by 7
- * units.
- */
- vec2 bias_uv = uv - 0.5;
- vec4 position = vec4(bias_uv.x * 7.,
- 0.0,
- bias_uv.y * 7.,
- 1.0);
- gl_Position = mvp * position;
+ vec4 uhat = vec4((1 - uv.x) * (1 - uv.x) * (1 - uv.x),
+ 3. * uv.x * (1 - uv.x) * (1 - uv.x),
+ 3. * uv.x * uv.x * (1 - uv.x),
+ uv.x * uv.x * uv.x);
+ vec4 vhat = vec4((1 - uv.y) * (1 - uv.y) * (1 - uv.y),
+ 3. * uv.y * (1 - uv.y) * (1 - uv.y),
+ 3. * uv.y * uv.y * (1 - uv.y),
+ uv.y * uv.y * uv.y);
+ mat4x3 m;
+ m[0] = k_uniform[0] * uhat;
+ m[1] = k_uniform[1] * uhat;
+ m[2] = k_uniform[2] * uhat;
+ m[3] = k_uniform[3] * uhat;
+
+ gl_Position = mvp * vec4(m * vhat, 1.0);
/* Transform the normal by the inverse-transpose of the model-view
* matrix.