From b44da4916aa09b27155ce6675cccbcc128b5a66c Mon Sep 17 00:00:00 2001 From: RealBadAngel Date: Sun, 7 Feb 2016 04:08:43 +0100 Subject: Cleanup selection mesh code, add shaders for halo and selection boxes --- client/shaders/default_shader/opengl_fragment.glsl | 4 ++++ client/shaders/default_shader/opengl_vertex.glsl | 9 +++++++++ client/shaders/selection_shader/opengl_fragment.glsl | 9 +++++++++ client/shaders/selection_shader/opengl_vertex.glsl | 9 +++++++++ 4 files changed, 31 insertions(+) create mode 100644 client/shaders/default_shader/opengl_fragment.glsl create mode 100644 client/shaders/default_shader/opengl_vertex.glsl create mode 100644 client/shaders/selection_shader/opengl_fragment.glsl create mode 100644 client/shaders/selection_shader/opengl_vertex.glsl (limited to 'client/shaders') diff --git a/client/shaders/default_shader/opengl_fragment.glsl b/client/shaders/default_shader/opengl_fragment.glsl new file mode 100644 index 000000000..925ab6e1d --- /dev/null +++ b/client/shaders/default_shader/opengl_fragment.glsl @@ -0,0 +1,4 @@ +void main(void) +{ + gl_FragColor = gl_Color; +} diff --git a/client/shaders/default_shader/opengl_vertex.glsl b/client/shaders/default_shader/opengl_vertex.glsl new file mode 100644 index 000000000..0f4609177 --- /dev/null +++ b/client/shaders/default_shader/opengl_vertex.glsl @@ -0,0 +1,9 @@ +uniform mat4 mWorldViewProj; + +void main(void) +{ + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = mWorldViewProj * gl_Vertex; + + gl_FrontColor = gl_BackColor = gl_Color; +} diff --git a/client/shaders/selection_shader/opengl_fragment.glsl b/client/shaders/selection_shader/opengl_fragment.glsl new file mode 100644 index 000000000..c679d0e12 --- /dev/null +++ b/client/shaders/selection_shader/opengl_fragment.glsl @@ -0,0 +1,9 @@ +uniform sampler2D baseTexture; + +void main(void) +{ + vec2 uv = gl_TexCoord[0].st; + vec4 color = texture2D(baseTexture, uv); + color.rgb *= gl_Color.rgb; + gl_FragColor = color; +} diff --git a/client/shaders/selection_shader/opengl_vertex.glsl b/client/shaders/selection_shader/opengl_vertex.glsl new file mode 100644 index 000000000..0f4609177 --- /dev/null +++ b/client/shaders/selection_shader/opengl_vertex.glsl @@ -0,0 +1,9 @@ +uniform mat4 mWorldViewProj; + +void main(void) +{ + gl_TexCoord[0] = gl_MultiTexCoord0; + gl_Position = mWorldViewProj * gl_Vertex; + + gl_FrontColor = gl_BackColor = gl_Color; +} -- cgit v1.2.3