aboutsummaryrefslogtreecommitdiff
path: root/tests/glmark2/data/shaders/bump-height.vert
diff options
context:
space:
mode:
Diffstat (limited to 'tests/glmark2/data/shaders/bump-height.vert')
-rw-r--r--tests/glmark2/data/shaders/bump-height.vert28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/glmark2/data/shaders/bump-height.vert b/tests/glmark2/data/shaders/bump-height.vert
new file mode 100644
index 00000000..cf49d7ac
--- /dev/null
+++ b/tests/glmark2/data/shaders/bump-height.vert
@@ -0,0 +1,28 @@
+attribute vec3 position;
+attribute vec2 texcoord;
+attribute vec3 normal;
+attribute vec3 tangent;
+
+uniform mat4 ModelViewProjectionMatrix;
+uniform mat4 NormalMatrix;
+
+varying vec2 TextureCoord;
+varying vec3 NormalEye;
+varying vec3 TangentEye;
+varying vec3 BitangentEye;
+
+void main(void)
+{
+ TextureCoord = texcoord;
+
+ // Transform normal, tangent and bitangent to eye space, keeping
+ // all of them perpendicular to the Normal. That is why we use
+ // NormalMatrix, instead of ModelView, to transform the tangent and
+ // bitangent.
+ NormalEye = normalize(vec3(NormalMatrix * vec4(normal, 1.0)));
+ TangentEye = normalize(vec3(NormalMatrix * vec4(tangent, 1.0)));
+ BitangentEye = normalize(vec3(NormalMatrix * vec4(cross(normal, tangent), 1.0)));
+
+ // Transform the position to clip coordinates
+ gl_Position = ModelViewProjectionMatrix * vec4(position, 1.0);
+}