From e2d40c3fb1723eb1dde87248a08f489d26b684f6 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sun, 27 Jun 2010 02:56:55 +0200 Subject: Simplified rotation shader code. --- shaders/bullet_vertex.glsl | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'shaders/bullet_vertex.glsl') diff --git a/shaders/bullet_vertex.glsl b/shaders/bullet_vertex.glsl index 0843be2..0717b0a 100644 --- a/shaders/bullet_vertex.glsl +++ b/shaders/bullet_vertex.glsl @@ -1,14 +1,13 @@ -varying mat4 v_tex_rot; +varying mat3 v_tex_rot; void main() { vec4 l_position = gl_Vertex; - vec2 l_direction = normalize(vec2(l_position.z, l_position.w)); - v_tex_rot = mat4(l_direction.x, l_direction.y, 0.0, 0.0, - -l_direction.y, l_direction.x, 0.0, 0.0, - 0.0, 0.0, 1.0, 0.0, - 0.0, 0.0, 0.0, 1.0); - l_position.z = 0.0; - l_position.w = 1.0; + vec2 l_direction = normalize(l_position.zw); + v_tex_rot = mat3( + l_direction.x, l_direction.y, 0.0, + -l_direction.y, l_direction.x, 0.0, + 1.0 - l_direction.x + l_direction.y, 1.0 - l_direction.y - l_direction.x, 0.0); + l_position.zw = vec2(0.0, 1.0); gl_FrontColor = gl_Color; gl_Position = gl_ModelViewProjectionMatrix * l_position; } -- cgit v1.2.3