OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
15 "uniform vec4 sprite;",
16 "uniform vec2 screen;",
17 "attribute vec2 position, colour_uv;",
18 "varying vec2 colour_tex_uv;",
20 " vec2 size = sprite.zw / screen.xy;",
21 " vec2 offset = ((2.0 * sprite.xy + sprite.zw) / screen.xy - 1.0) * vec2(1.0, -1.0);",
22 " colour_tex_uv = colour_uv;",
23 " gl_Position = vec4(position * size + offset, 0.0, 1.0);",
30 "uniform vec4 sprite;",
31 "uniform vec2 screen;",
32 "in vec2 position, colour_uv;",
33 "out vec2 colour_tex_uv;",
35 " vec2 size = sprite.zw / screen.xy;",
36 " vec2 offset = ((2.0 * sprite.xy + sprite.zw) / screen.xy - 1.0) * vec2(1.0, -1.0);",
37 " colour_tex_uv = colour_uv;",
38 " gl_Position = vec4(position * size + offset, 0.0, 1.0);",
45 "uniform sampler2D colour_tex;",
46 "varying vec2 colour_tex_uv;",
48 " gl_FragData[0] = texture2D(colour_tex, colour_tex_uv);",
55 "uniform sampler2D colour_tex;",
56 "in vec2 colour_tex_uv;",
59 " colour = texture(colour_tex, colour_tex_uv);",
66 "uniform sampler2D colour_tex;",
67 "uniform sampler1D palette;",
68 "varying vec2 colour_tex_uv;",
70 " float idx = texture2D(colour_tex, colour_tex_uv).r;",
71 " gl_FragData[0] = texture1D(palette, idx);",
78 "uniform sampler2D colour_tex;",
79 "uniform sampler1D palette;",
80 "in vec2 colour_tex_uv;",
83 " float idx = texture(colour_tex, colour_tex_uv).r;",
84 " colour = texture(palette, idx);",
91 "float max3(vec3 v) {"
92 " return max(max(v.x, v.y), v.z);"
95 "vec3 adj_brightness(vec3 colour, float brightness) {"
96 " vec3 adj = colour * (brightness > 0.0 ? brightness / 0.5 : 1.0);"
97 " vec3 ob_vec = clamp(adj - 1.0, 0.0, 1.0);"
98 " float ob = (ob_vec.r + ob_vec.g + ob_vec.b) / 2.0;"
100 " return clamp(adj + ob * (1.0 - adj), 0.0, 1.0);"
106 "#extension GL_ATI_shader_texture_lod: enable\n",
107 "#extension GL_ARB_shader_texture_lod: enable\n",
108 "uniform sampler2D colour_tex;",
109 "uniform sampler1D palette;",
110 "uniform sampler2D remap_tex;",
112 "uniform float zoom;",
113 "varying vec2 colour_tex_uv;",
118 " float idx = texture2DLod(remap_tex, colour_tex_uv, zoom).r;",
119 " vec4 remap_col = texture1D(palette, idx);",
120 " vec4 rgb_col = texture2DLod(colour_tex, colour_tex_uv, zoom);",
122 " gl_FragData[0].a = rgb ? rgb_col.a : remap_col.a;",
123 " gl_FragData[0].rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
130 "uniform sampler2D colour_tex;",
131 "uniform sampler1D palette;",
132 "uniform sampler2D remap_tex;",
133 "uniform float zoom;",
135 "in vec2 colour_tex_uv;",
141 " float idx = textureLod(remap_tex, colour_tex_uv, zoom).r;",
142 " vec4 remap_col = texture(palette, idx);",
143 " vec4 rgb_col = textureLod(colour_tex, colour_tex_uv, zoom);",
145 " colour.a = rgb ? rgb_col.a : remap_col.a;",
146 " colour.rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
153 "#extension GL_ATI_shader_texture_lod: enable\n",
154 "#extension GL_ARB_shader_texture_lod: enable\n",
155 "uniform sampler2D colour_tex;",
156 "uniform sampler1D palette;",
157 "uniform sampler2D remap_tex;",
158 "uniform sampler1D pal;",
159 "uniform float zoom;",
161 "uniform bool crash;",
162 "varying vec2 colour_tex_uv;",
167 " float idx = texture2DLod(remap_tex, colour_tex_uv, zoom).r;",
168 " float r = texture1D(pal, idx).r;",
169 " vec4 remap_col = texture1D(palette, idx);",
170 " vec4 rgb_col = texture2DLod(colour_tex, colour_tex_uv, zoom);",
172 " if (crash && idx == 0.0) rgb_col.rgb = vec2(dot(rgb_col.rgb, vec3(0.199325561523, 0.391342163085, 0.076004028320)), 0.0).rrr;"
173 " gl_FragData[0].a = rgb && (r > 0.0 || idx == 0.0) ? rgb_col.a : remap_col.a;",
174 " gl_FragData[0].rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
181 "uniform sampler2D colour_tex;",
182 "uniform sampler1D palette;",
183 "uniform sampler2D remap_tex;",
184 "uniform sampler1D pal;",
185 "uniform float zoom;",
187 "uniform bool crash;",
188 "in vec2 colour_tex_uv;",
194 " float idx = textureLod(remap_tex, colour_tex_uv, zoom).r;"
195 " float r = texture(pal, idx).r;",
196 " vec4 remap_col = texture(palette, r);",
197 " vec4 rgb_col = textureLod(colour_tex, colour_tex_uv, zoom);",
199 " if (crash && idx == 0.0) rgb_col.rgb = vec2(dot(rgb_col.rgb, vec3(0.199325561523, 0.391342163085, 0.076004028320)), 0.0).rrr;"
200 " colour.a = rgb && (r > 0.0 || idx == 0.0) ? rgb_col.a : remap_col.a;",
201 " colour.rgb = idx > 0.0 ? adj_brightness(remap_col.rgb, max3(rgb_col.rgb)) : rgb_col.rgb;",
static const char * _frag_shader_palette[]
Fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_sprite_blend_150[]
GLSL 1.50 fragment shader that performs a palette lookup to read the colour from a sprite texture.
static const char * _frag_shader_direct_150[]
GLSL 1.50 fragment shader that reads the fragment colour from a 32bpp texture.
static const char * _vertex_shader_sprite[]
Vertex shader that positions a sprite on screen.
static const char * _frag_shader_palette_150[]
GLSL 1.50 fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _vertex_shader_sprite_150[]
GLSL 1.50 vertex shader that positions a sprite on screen.
static const char * _frag_shader_rgb_mask_blend_150[]
GLSL 1.50 fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_sprite_blend[]
Fragment shader that performs a palette lookup to read the colour from a sprite texture.
static const char * _frag_shader_remap_func
Fragment shader function for remap brightness modulation.
static const char * _frag_shader_rgb_mask_blend[]
Fragment shader that performs a palette lookup to read the colour from an 8bpp texture.
static const char * _frag_shader_direct[]
Fragment shader that reads the fragment colour from a 32bpp texture.