#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 dx = (gl_FragCoord.x - mousePos.x) / float(size.x); float dy = (gl_FragCoord.y - mousePos.y) / float(size.y); float distx = 1.0 - sqrt(dx * dx); float disty = 1.0 - sqrt(dy * dy); float dist = (distx + disty) / 2.0; vec4 n_color = result / vec4((float(size.z) * 2.0 + 1.0) * (float(size.w) * 2.0 + 1.0)); n_color = n_color * vec4(16.0); if (dist >= 0.5) FragColor = normalize(n_color); else FragColor = texture(tex, uv); //FragColor = ; } ")"; #endif