{
  "name": "Draw Square",
  "id": "ide:345bbc3b-ab93-4b78-b783-6609e421cf68",
  "module": {
    "kind": "shader",
    "id": "ide:345bbc3b-ab93-4b78-b783-6609e421cf68",
    "name": "Draw Square",
    "inputs": [
      {
        "id": "in",
        "label": "In",
        "type": "frame"
      },
      {
        "id": "x",
        "label": "x",
        "type": "number"
      },
      {
        "id": "y",
        "label": "y",
        "type": "number"
      },
      {
        "id": "w",
        "label": "Width",
        "type": "number"
      },
      {
        "id": "h",
        "label": "Height",
        "type": "number"
      },
      {
        "id": "r",
        "label": "Red",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1,
        "step": 0.01
      },
      {
        "id": "g",
        "label": "Green",
        "type": "number",
        "default": 1,
        "min": 0,
        "max": 1,
        "step": 0.01
      },
      {
        "id": "b",
        "label": "Blue",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1,
        "step": 0.01
      },
      {
        "id": "a",
        "label": "Alpha",
        "type": "number",
        "default": 1,
        "min": 0,
        "max": 1,
        "step": 0.01
      }
    ],
    "outputs": [
      {
        "id": "out",
        "label": "Out",
        "type": "frame"
      }
    ],
    "fragmentSrc": "#version 300 es\nprecision highp float;\n\nin vec2 v_texCoord;\nuniform sampler2D u_texture0;\nuniform vec2 u_resolution;\nuniform float x;\nuniform float y;\nuniform float w;\nuniform float h;\nuniform float r;\nuniform float g;\nuniform float b;\nuniform float a;\nout vec4 fragColor;\n\nvoid main() {\n  vec4 c = texture(u_texture0, v_texCoord);\n  float thickness = 1.;\n  vec2 pixel = v_texCoord * u_resolution;\n  bool inRect = pixel.x >= x && pixel.x <= x + w &&\n                pixel.y >= y && pixel.y <= y + h;\n  bool inInner = pixel.x >= x + thickness && pixel.x <= x + w - thickness &&\n                 pixel.y >= y + thickness && pixel.y <= y + h - thickness;\n  fragColor = (inRect && !inInner) ? vec4(r, g, b, a) : vec4(0,0,0,0);\n}"
  }
}
