From 7cb1cbb8416442cb8de498dd06e34d6e8c5634a8 Mon Sep 17 00:00:00 2001 From: Jules Blok Date: Mon, 7 Mar 2016 21:00:49 +0100 Subject: [PATCH] shaders: Add GLSL port of editor. --- res/gamedata/shaders/gl/editor.vs | 13 ++++++++ res/gamedata/shaders/gl/iostructs/v_editor.h | 33 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 res/gamedata/shaders/gl/editor.vs create mode 100644 res/gamedata/shaders/gl/iostructs/v_editor.h diff --git a/res/gamedata/shaders/gl/editor.vs b/res/gamedata/shaders/gl/editor.vs new file mode 100644 index 00000000000..e2f6c49a381 --- /dev/null +++ b/res/gamedata/shaders/gl/editor.vs @@ -0,0 +1,13 @@ +#include "common.h" +#include "iostructs\v_editor.h" + +uniform float4 tfactor; +v2p _main (vf i) +{ + v2p o; + + o.P = mul (m_WVP, i.P); // xform, input in world coords + o.C = tfactor*i.C; + + return o; +} diff --git a/res/gamedata/shaders/gl/iostructs/v_editor.h b/res/gamedata/shaders/gl/iostructs/v_editor.h new file mode 100644 index 00000000000..efb62a40e3c --- /dev/null +++ b/res/gamedata/shaders/gl/iostructs/v_editor.h @@ -0,0 +1,33 @@ + +out gl_PerVertex { vec4 gl_Position; }; + +struct vf +{ + float4 C ; // COLOR0; + float4 P ; // POSITION; +}; + +struct v2p +{ + float4 C ; // COLOR0; + float4 P ; // SV_Position; +}; + +layout(location = COLOR0) in float4 v_editor_C ; // COLOR0; +layout(location = POSITION) in float4 v_editor_P ; // POSITION; + +layout(location = COLOR0) out float4 v2p_editor_C ; // COLOR0; + +v2p _main (vf i); + +void main() +{ + vf I; + I.C = v_editor_C; + I.P = v_editor_P; + + v2p O = _main (I); + + v2p_editor_C = O.C; + gl_Position = O.P; +}