{
  "name": "Blackout (Fade Black)",
  "type": "dynamic",
  "passes": [
    {
      "name": "blackout",
      "inputs": [
        "default"
      ],
      "glsl": "precision highp float;

varying vec2 sourceTextureCoordinate;

uniform float progress; // normalized 0-1
uniform vec3 fadeColor; // unused for now
uniform float inOutSwitch;


void main() {
  vec2 uv = sourceTextureCoordinate;

  float progressDirection = mix(progress, 1.0 - progress, inOutSwitch);
  vec4 color = sampleInput(uv) * (1.0 - progressDirection);
  color.a = 1.0;
  gl_FragColor = toOutputFormat(color);
}
",
    "metal": "
      using namespace metal;
      struct fragmentIn { float2 sourceTextureCoordinate [[user(locn1)]]; };
      struct fragmentOut { float4 _gl_FragColor [[color(0)]]; };
      typedef struct {
        float4x4 content_transform;
        float4x4 texture_transform;
        float strength;
        float progress;
        float time_sec;
        float duration_sec;
        float clip_duration_sec;
        float2 inputSize;
        float2 outputSize;
        float2 tex0Size;
        float3 fadeColor;
        float inOutSwitch;
      } Uniforms;
      fragment fragmentOut fragmentShader(
        fragmentIn in [[stage_in]],
        constant Uniforms & uniforms [[buffer(1)]],
        DefaultInputs defaultInputs) {

        fragmentOut out = {};
        float2 uv = in.sourceTextureCoordinate;

        float progressDirection = mix(uniforms.progress, 1.0 - uniforms.progress, uniforms.inOutSwitch);
        float4 color = sampleInput(defaultInputs, uv) * (1.0 - progressDirection);
        color.a = 1.0;
        out._gl_FragColor = toOutputFormat(color);
        return out;
    }
  ",
      "uniforms": {
        "fadeColor": {
          "value": [
            0,
            0,
            0
          ]
        },
        "inOutSwitch": {
          "value": 0
        }
      }
    }
  ]
}
