diff options
author | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-05-21 00:59:44 +0200 |
---|---|---|
committer | Vegard Storheil Eriksen <zyp@jvnv.net> | 2010-05-21 00:59:44 +0200 |
commit | 14833f2e5bddab2ff0ac637fe1340ade94eb88ae (patch) | |
tree | e36353df0d1c648a4e7eac3fe5931c0465ac6068 /shaders | |
parent | ca56469cbb3ebf77dba433da9b23698ff5138a3d (diff) |
Moved resource files.
Diffstat (limited to 'shaders')
-rw-r--r-- | shaders/bullet_fragment.glsl | 15 | ||||
-rw-r--r-- | shaders/bullet_vertex.glsl | 14 |
2 files changed, 29 insertions, 0 deletions
diff --git a/shaders/bullet_fragment.glsl b/shaders/bullet_fragment.glsl new file mode 100644 index 0000000..5e8becd --- /dev/null +++ b/shaders/bullet_fragment.glsl @@ -0,0 +1,15 @@ +varying mat4 v_tex_rot; +uniform sampler2D tex; + +void main() { + vec2 l_uv = gl_TexCoord[0].xy; + const vec2 l_offset = vec2(0.5, 0.5); + l_uv -= l_offset; + l_uv = vec2(v_tex_rot * vec4(l_uv, 0.0, 1.0)); + l_uv += l_offset; + gl_FragColor = texture2D(tex, l_uv); + float M = max(max(gl_FragColor.x, gl_FragColor.y), gl_FragColor.z); + float C = M - min(min(gl_FragColor.x, gl_FragColor.y), gl_FragColor.z); + float S = C > 0.0 ? C / M : 0.0; + gl_FragColor.xyz = M * mix(vec3(1.0, 1.0, 1.0), gl_Color.xyz, S); +} diff --git a/shaders/bullet_vertex.glsl b/shaders/bullet_vertex.glsl new file mode 100644 index 0000000..0843be2 --- /dev/null +++ b/shaders/bullet_vertex.glsl @@ -0,0 +1,14 @@ +varying mat4 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; + gl_FrontColor = gl_Color; + gl_Position = gl_ModelViewProjectionMatrix * l_position; +} |