BLT-With-Graphics-Template/include/blt/gfx/renderer/shaders/2d_textured_circle.frag

36 lines
758 B
GLSL
Raw Permalink Normal View History

2024-04-12 17:37:35 -04:00
#ifdef __cplusplus
#include <string>
const std::string shader_2d_textured_cirlce_frag = R"("
#version 300 es
precision mediump float;
layout (location = 0) out vec4 FragColor;
2024-05-13 22:24:06 -04:00
//layout (location = 1) out vec4 OutMask;
2024-04-12 17:37:35 -04:00
in vec2 uv;
in vec2 pos;
uniform sampler2D tex;
uniform vec4 color;
uniform vec4 use_texture;
2024-05-13 22:24:06 -04:00
//uniform vec4 outline_color;
2024-04-12 17:37:35 -04:00
2024-04-16 02:28:02 -04:00
const float offset = 1.0 / 32.0;
2024-04-12 17:37:35 -04:00
vec4 linear_iter(vec4 i, vec4 p, float factor){
return (i + p) * factor;
}
void main() {
float xs = pos.x * pos.x;
float ys = pos.y * pos.y;
2024-04-16 02:28:02 -04:00
float ts = xs + ys;
const float sq = 0.5 * 0.5;
2024-05-01 21:32:53 -04:00
if (ts >= sq)
2024-04-12 17:37:35 -04:00
discard;
FragColor = (texture(tex, uv) * use_texture) + color;
2024-05-13 22:24:06 -04:00
//OutMask = outline_color;
//OutMask.a = FragColor.a;
2024-04-12 17:37:35 -04:00
}
")";
#endif