35 lines
686 B
GLSL
35 lines
686 B
GLSL
#ifdef __cplusplus
|
|
#include <string>
|
|
const std::string shader_2d_textured_cirlce_frag = R"("
|
|
#version 300 es
|
|
precision mediump float;
|
|
|
|
out vec4 FragColor;
|
|
in vec2 uv;
|
|
in vec2 pos;
|
|
|
|
uniform sampler2D tex;
|
|
uniform vec4 color;
|
|
uniform vec4 use_texture;
|
|
|
|
const float offset = 1.0 / 32.0;
|
|
|
|
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;
|
|
float ts = xs + ys;
|
|
const float sq = 0.5 * 0.5;
|
|
if (ts > sq)
|
|
discard;
|
|
if (ts + offset > sq)
|
|
FragColor = vec4(1.0, 1.0, 1.0, 1.0);
|
|
else
|
|
FragColor = (texture(tex, uv) * use_texture) + color;
|
|
}
|
|
|
|
")";
|
|
#endif |