diff options
author | chai <chaifix@163.com> | 2021-11-03 18:52:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-03 18:52:30 +0800 |
commit | 08ddd44b634d4da78edd0964f539a310544c7883 (patch) | |
tree | 108317d9138c3e8a19f3cc3f2ffcfba4768f22d5 /Data/Resources/Shaders | |
parent | 6f62a3d5ad405dbab5ac031fb8eeb03bdb395904 (diff) |
! UI9Slicing
Diffstat (limited to 'Data/Resources/Shaders')
-rw-r--r-- | Data/Resources/Shaders/Editor-UI.glsl | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/Data/Resources/Shaders/Editor-UI.glsl b/Data/Resources/Shaders/Editor-UI.glsl index 91aeb01..b831d6c 100644 --- a/Data/Resources/Shaders/Editor-UI.glsl +++ b/Data/Resources/Shaders/Editor-UI.glsl @@ -1,32 +1,46 @@ + #version 330 core -VSH_BEGIN +CMD_BEGIN +Cull Off +Blend SrcAlpha OneMinusSrcAlpha +DepthTest Off +CMD_END + +uniform mat4 gamelab_mat_mvp; +uniform sampler2D gamelab_main_tex; +uniform vec2 gamelab_ui_position; +VSH_BEGIN layout (location = 0) in vec2 vPos; layout (location = 1) in vec2 vUV; - -uniform mat4 mvp; +layout (location = 2) in vec4 vColor; out vec2 uv; +out vec4 color; void main() { - vec4 clip = mvp * vec4(vPos, -1, 1.0); + vec2 pos = vPos + gamelab_ui_position; + vec4 clip = gamelab_mat_mvp * vec4(pos, -1, 1.0); gl_Position = clip; uv = vUV; + color = vColor; } - VSH_END FSH_BEGIN -uniform sampler2D uiTex; - in vec2 uv; +in vec4 color; out vec4 FragColor; void main() { - FragColor = texture(uiTex, uv); + //vec2 uv = vec2(uv.x, 1 - uv.y); + vec4 sampled = texture(gamelab_main_tex, uv); + // sampled *= color; + //sampled = vec4(1,1,1,1); + FragColor = sampled; } FSH_END |