diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-06-11 23:44:25 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-06-12 00:47:24 +0300 |
commit | 8e1fc2522ee907da5fc3e65691990fd608539a72 (patch) | |
tree | 888bdab76dc75120a68c4213c204d0ce13da6f61 /data | |
parent | 41836760fa59abc74098aed7450b4858dc288e56 (diff) | |
download | manaplus-8e1fc2522ee907da5fc3e65691990fd608539a72.tar.gz manaplus-8e1fc2522ee907da5fc3e65691990fd608539a72.tar.bz2 manaplus-8e1fc2522ee907da5fc3e65691990fd608539a72.tar.xz manaplus-8e1fc2522ee907da5fc3e65691990fd608539a72.zip |
Use only one shader program for all drawing.
Diffstat (limited to 'data')
-rw-r--r-- | data/graphics/shaders/CMakeLists.txt | 2 | ||||
-rw-r--r-- | data/graphics/shaders/Makefile.am | 4 | ||||
-rw-r--r-- | data/graphics/shaders/simple_frag.glsl | 11 | ||||
-rw-r--r-- | data/graphics/shaders/simple_vertex.glsl | 4 | ||||
-rw-r--r-- | data/graphics/shaders/texture_frag.glsl | 9 | ||||
-rw-r--r-- | data/graphics/shaders/texture_vertex.glsl | 9 |
6 files changed, 14 insertions, 25 deletions
diff --git a/data/graphics/shaders/CMakeLists.txt b/data/graphics/shaders/CMakeLists.txt index bc4c3e78f..0dc6cc124 100644 --- a/data/graphics/shaders/CMakeLists.txt +++ b/data/graphics/shaders/CMakeLists.txt @@ -1,8 +1,6 @@ SET(FILES simple_frag.glsl simple_vertex.glsl - texture_frag.glsl - texture_vertex.glsl ) INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/graphics/shaders) diff --git a/data/graphics/shaders/Makefile.am b/data/graphics/shaders/Makefile.am index 54aab1330..db10da9b1 100644 --- a/data/graphics/shaders/Makefile.am +++ b/data/graphics/shaders/Makefile.am @@ -2,9 +2,7 @@ shadersdir = $(pkgdatadir)/data/graphics/shaders shaders_DATA = \ simple_frag.glsl \ - simple_vertex.glsl \ - texture_frag.glsl \ - texture_vertex.glsl + simple_vertex.glsl EXTRA_DIST = \ $(shaders_DATA) \ diff --git a/data/graphics/shaders/simple_frag.glsl b/data/graphics/shaders/simple_frag.glsl index 02fbf5519..45c1ddd73 100644 --- a/data/graphics/shaders/simple_frag.glsl +++ b/data/graphics/shaders/simple_frag.glsl @@ -1,7 +1,16 @@ #version 150 core +in vec2 Texcoord; out vec4 outColor; +uniform sampler2D tex; uniform vec4 color; +uniform float drawType; +uniform float alpha; + void main() { - outColor = color; + outColor = texture(tex, Texcoord); + if (drawType >= 0.1) + outColor = texture(tex, Texcoord) * vec4(1.0, 1.0, 1.0, alpha); + else + outColor = color; } diff --git a/data/graphics/shaders/simple_vertex.glsl b/data/graphics/shaders/simple_vertex.glsl index 3be44c6d8..a10a39b13 100644 --- a/data/graphics/shaders/simple_vertex.glsl +++ b/data/graphics/shaders/simple_vertex.glsl @@ -1,7 +1,9 @@ #version 150 core -in vec2 position; +in vec4 position; +out vec2 Texcoord; uniform vec2 screen; void main() { + Texcoord = vec2(position.z, position.w); gl_Position = vec4(position.x / screen.x - 1, 1 - position.y / screen.y, 0.0, 1.0); } diff --git a/data/graphics/shaders/texture_frag.glsl b/data/graphics/shaders/texture_frag.glsl deleted file mode 100644 index db6c7176f..000000000 --- a/data/graphics/shaders/texture_frag.glsl +++ /dev/null @@ -1,9 +0,0 @@ -#version 150 core -in vec2 Texcoord; -out vec4 outColor; -uniform sampler2D tex; -uniform float color; -void main() -{ - outColor = texture(tex, Texcoord) * vec4(1.0, 1.0, 1.0, color); -} diff --git a/data/graphics/shaders/texture_vertex.glsl b/data/graphics/shaders/texture_vertex.glsl deleted file mode 100644 index a10a39b13..000000000 --- a/data/graphics/shaders/texture_vertex.glsl +++ /dev/null @@ -1,9 +0,0 @@ -#version 150 core -in vec4 position; -out vec2 Texcoord; -uniform vec2 screen; -void main() -{ - Texcoord = vec2(position.z, position.w); - gl_Position = vec4(position.x / screen.x - 1, 1 - position.y / screen.y, 0.0, 1.0); -} |