2019-01-30 12:11:34 +00:00
|
|
|
#version 330 core
|
|
|
|
|
2019-05-14 06:43:07 +00:00
|
|
|
#include <globals.glsl>
|
|
|
|
|
2019-01-30 12:11:34 +00:00
|
|
|
in vec2 f_uv;
|
2019-02-23 02:41:52 +00:00
|
|
|
in vec4 f_color;
|
|
|
|
flat in uint f_mode;
|
2019-01-30 12:11:34 +00:00
|
|
|
|
2019-05-14 06:43:07 +00:00
|
|
|
layout (std140)
|
|
|
|
uniform u_locals {
|
2020-10-21 21:05:25 +00:00
|
|
|
vec4 w_pos;
|
2019-05-14 06:43:07 +00:00
|
|
|
};
|
|
|
|
|
2019-01-30 12:11:34 +00:00
|
|
|
uniform sampler2D u_tex;
|
|
|
|
|
|
|
|
out vec4 tgt_color;
|
|
|
|
|
|
|
|
void main() {
|
2019-05-02 22:42:04 +00:00
|
|
|
// Text
|
|
|
|
if (f_mode == uint(0)) {
|
|
|
|
tgt_color = f_color * vec4(1.0, 1.0, 1.0, texture(u_tex, f_uv).a);
|
|
|
|
// Image
|
2020-02-06 17:34:32 +00:00
|
|
|
// HACK: bit 0 is set for both ordinary and north-facing images.
|
|
|
|
} else if ((f_mode & uint(1)) == uint(1)) {
|
2019-05-02 22:42:04 +00:00
|
|
|
tgt_color = f_color * texture(u_tex, f_uv);
|
|
|
|
// 2D Geometry
|
|
|
|
} else if (f_mode == uint(2)) {
|
|
|
|
tgt_color = f_color;
|
|
|
|
}
|
2019-01-30 12:11:34 +00:00
|
|
|
}
|