summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2012-12-11 17:33:49 -0800
committerMatt Turner <mattst88@gmail.com>2012-12-11 17:33:49 -0800
commit21396b4fa36856ce770297df59cd61725ff268da (patch)
tree81b36348aaad2283ec0c3f6a98455f87f63f85c1 /data
parent18b7caedb71a56381fafaa724ad3c9fa2dc8e465 (diff)
Implement cubic bezier surfaceHEADmaster
Diffstat (limited to 'data')
-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.