#ifdef __cplusplus #include const std::string shader_highlight_frag = R"(" #version 300 es precision mediump float; out vec4 FragColor; in vec2 uv; in vec2 pos; uniform sampler2D tex; uniform ivec4 size; uniform vec4 mousePos; void main() { vec2 texelSize = 1.0 / vec2(float(size.x), float(size.y)); vec4 result = vec4(0.0, 0.0, 0.0, 0.0); for (int x = -size.z; x <= size.z; ++x) { for (int y = -size.w; y <= size.w; ++y) { vec2 offset = (vec2(float(x), float(y)) * texelSize); result += texture(tex, uv + offset); } } float px = mousePos.x / float(size.x); float py = mousePos.y / float(size.y); float dx = (gl_FragCoord.x - mousePos.x) / float(size.x); float dy = (gl_FragCoord.y - mousePos.y) / float(size.y); float distx = sqrt(dx * dx); float disty = sqrt(dy * dy); vec4 n_color = result / vec4((float(size.z) * 2.0 + 1.0) * (float(size.w) * 2.0 + 1.0)); FragColor = vec4(distx, disty, 0.0, 1.0); //FragColor = ; } ")"; #endif