#ifdef __cplusplus
#include <string>
const std::string shader_pp_outline_step_frag = R"("
#version 300 es
precision mediump float;

out vec4 FragColor;
in vec2 uv;
in vec2 pos;

uniform vec2 viewportSize;

uniform sampler2D albedo;
uniform sampler2D mask;

vec4 outline_color = vec4(1.0f, 0.0f, 0.0f, 1.0f);

float longest(vec3 v){
    return max(v.r, max(v.b, v.g));
}

#define LINE_WEIGHT 1.0

void main() {
//    float dx = (1.0 / viewportSize.x) * LINE_WEIGHT;
//    float dy = (1.0 / viewportSize.y) * LINE_WEIGHT;
//
//    vec2 uvCenter   = uv;
//    vec2 uvRight    = vec2(uvCenter.x + dx, uvCenter.y);
//    vec2 uvTop      = vec2(uvCenter.x,      uvCenter.y - dy);
//    vec2 uvTopRight = vec2(uvCenter.x + dx, uvCenter.y - dy);
//
//    float mCenter   = longest(texture(mask, uvCenter).rgb);
//    float mTop      = longest(texture(mask, uvTop).rgb);
//    float mRight    = longest(texture(mask, uvRight).rgb);
//    float mTopRight = longest(texture(mask, uvTopRight).rgb);
//
//    float dT  = abs(mCenter - mTop);
//    float dR  = abs(mCenter - mRight);
//    float dTR = abs(mCenter - mTopRight);
//
//    float delta = 0.0f;
//    delta = max(delta, dT);
//    delta = max(delta, dR);
//    delta = max(delta, dTR);
//
//    vec4 outline = vec4(delta, delta, delta, 1.0);
//    vec4 albedo  = texture(albedo, uv);
//
//    if (delta <= 0.0)
//        FragColor = albedo;
//    else
//        FragColor = outline_color;
    FragColor = texture(albedo, uv);
    if (FragColor.a == 0.0)
        FragColor = texture(mask, uv);
}

")";
#endif