{
  "Name": "CheckerBoard",
  "_id": "0af4a986-6246-429d-89da-695d52a55278",
  "Namespace": "lib.image.generate",
  "Description": "Creates a linear gradient texture between two points. \r\n\r\nTop left [-0.5 , -0.5]  \r\nBottom right [0.5 , 0.5]\r\n",
  "Inputs": [
    {
      "Name": "Code",
      "MetaInstanceID": "6022db6e-1d39-4b13-83fd-c0c68954a8b9",
      "DefaultValue": {
        "Type": "Text",
        "Value": [
          "//>>> _common parameters\r",
          "float4x4 objectToWorldMatrix;",
          "float4x4 worldToCameraMatrix;",
          "float4x4 projMatrix;",
          "Texture2D txDiffuse;",
          "float2 RenderTargetSize;",
          "//<<< _common parameters\r",
          "\r",
          "//>>> _parameters\r",
          "float4 ColorA;",
          "float4 ColorB;",
          "float2 Repeat;",
          "//<<< _parameters\r",
          "\r",
          "//>>> _setup\r",
          "SamplerState samLinear",
          "{",
          "    Filter = MIN_MAG_MIP_LINEAR;",
          "    AddressU = Clamp;",
          "    AddressV = Clamp;",
          "};",
          "//<<< _setup\r",
          "\r",
          "//>>> _declarations\r",
          "struct VS_IN",
          "{",
          "    float4 pos : POSITION;",
          "    float2 texCoord : TEXCOORD;",
          "};",
          "",
          "struct PS_IN",
          "{",
          "    float4 pos : SV_POSITION;",
          "    float2 texCoord: TEXCOORD0;",
          "};",
          "//<<< _declarations\r",
          "\r",
          "//>>> _GS\r",
          "",
          "//<<< _GS\r",
          "\r",
          "//>>> _VS \r",
          "PS_IN VS( VS_IN input )",
          "{",
          "    PS_IN output = (PS_IN)0;",
          "",
          "    output.pos = mul(input.pos, worldToCameraMatrix);",
          "    output.pos = mul(output.pos, projMatrix);",
          "    output.texCoord = input.texCoord;",
          "",
          "    return output;",
          "}",
          "//<<< _VS\r",
          "\r",
          "float mod(float x, float y)\r",
          "{\r",
          "  return x - y * floor(x/y);\r",
          "}\r",
          "\r",
          "//>>> PS\r",
          "float4 PS(PS_IN input) : SV_Target\r",
          "{\r",
          "    float aspectRatio = RenderTargetSize.x/RenderTargetSize.y;\r",
          "\r",
          "    //return float4(1,1,0,1);\r",
          "    //float2 p= input.pos/RenderTargetSize - float2(0.5,0.5) + 0.5*float2(-Center.x, Center.y);\r",
          "    //p.x *=  aspectRatio;\r",
          "    //p/=  Stretch;\r",
          "    \r",
          "    //return float4(1,1,0,1);\r",
          "    float2 p= input.pos/RenderTargetSize;// - float2(0.5,0.5);\r",
          "    //p.x *=  aspectRatio;\r",
          "    //p/=  Stretch;\r",
          "    \r",
          "    float cx= mod(p.x*Repeat.x/2, 1);\r",
          "    float cy= mod(p.y*Repeat.y/2, 1);\r",
          "    \r",
          "    float4 color;\r",
          "    if( cx > 0.5 && cy> 0.5) {\r",
          "        color= ColorA;\r",
          "    }\r",
          "    else if ( cx < 0.5 && cy < 0.5) {\r",
          "        color= ColorA;\r",
          "    }\r",
          "    else {\r",
          "        color= ColorB;\r",
          "    }\r",
          "\r",
          "    return color;\r",
          "    \r",
          "    \r",
          "    //return lerp( ColorC, ColorD, (d-ColorRadius.x-ColorRadius.y) / (ColorRadius.z));\r",
          "}\r",
          "//<<< PS\r",
          "\r",
          "//>>> _technique\r",
          "technique10 Render",
          "{",
          "    pass P0",
          "    {",
          "        SetGeometryShader( 0 );",
          "        SetVertexShader( CompileShader( vs_4_0, VS() ) );",
          "        SetPixelShader( CompileShader( ps_4_0, PS() ) );",
          "    }",
          "}",
          "//<<< _technique\r",
          ""
        ]
      },
      "MetaID": "c522a66e-3260-4692-b3e3-79fd0361fa3d",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-100000",
      "Max": "100000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorA.R",
      "MetaInstanceID": "4c1eb66f-6269-4874-8b30-694bf5728710",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorA.G",
      "MetaInstanceID": "e4ab0706-2124-4b98-81c5-4f016bbfea8d",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.5"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorA.B",
      "MetaInstanceID": "2a9ed98d-4357-4609-b506-a912e416afef",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.4957108"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorA.A",
      "MetaInstanceID": "5ad2431f-7d0e-4d15-8182-808c4787d269",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorB.R",
      "MetaInstanceID": "19632b08-fdd6-42d5-8498-277d0c1149db",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.7723402"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorB.G",
      "MetaInstanceID": "9895d2fe-0871-4062-b07e-7b8ba7e3c714",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.7723402"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorB.B",
      "MetaInstanceID": "0d6b1abd-837d-4136-bf68-3519edf55585",
      "DefaultValue": {
        "Type": "Float",
        "Value": "0.7723402"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "ColorB.A",
      "MetaInstanceID": "792fe32e-117f-4291-a6d0-0eed82027ae9",
      "DefaultValue": {
        "Type": "Float",
        "Value": "1"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "0",
      "Max": "1",
      "Scale": "0.01",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Repeat.X",
      "MetaInstanceID": "223b713f-3fa4-4075-99e8-26e1ab7c3f03",
      "DefaultValue": {
        "Type": "Float",
        "Value": "10"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-10000",
      "Max": "10000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    },
    {
      "Name": "Repeat.Y",
      "MetaInstanceID": "8905194d-2f57-4276-990c-0ac36ba25711",
      "DefaultValue": {
        "Type": "Float",
        "Value": "10"
      },
      "MetaID": "3f76dee3-3897-44ac-82d6-25ce9f53a506",
      "IsMultiInput": "False",
      "Relevance": "Optional",
      "Description": "",
      "Min": "-10000",
      "Max": "10000",
      "Scale": "0.1",
      "ScaleType": "Linear",
      "EnumValues": []
    }
  ],
  "Outputs": [
    {
      "Name": "Image",
      "MetaInstanceID": "83ba3510-1921-44e5-aed0-b68cce9365c4",
      "MetaID": "9848060d-fd84-45b0-b658-d0d531c61dab"
    }
  ],
  "OperatorParts": [
    {
      "MetaInstanceID": "67489398-fee1-4a8f-86f3-8edf2f924b7a",
      "MetaID": "c8d668f7-26b8-4f94-a83c-bf5c19c9c305",
      "Name": "CheckerBoardFunc",
      "Version": "dbab73bf-6351-41e5-9418-bd8849163160",
      "Type": "Float",
      "IsMultiInput": "True",
      "Script": [
        "//>>> _using",
        "using System;",
        "using System.Collections.Generic;",
        "using System.Linq;",
        "using System.Text;",
        "using SharpDX;",
        "using SharpDX.Direct3D11;",
        "using SharpDX.Windows;",
        "//<<< _using",
        "",
        "namespace Framefield.Core.IDc8d668f7_26b8_4f94_a83c_bf5c19c9c305",
        "{",
        "    public class Class_CheckerBoard : FXImageFunction",
        "    {",
        "        //>>> _inputids",
        "        private enum InputId",
        "        {",
        "            Code = 0,",
        "            ColorAR = 1,",
        "            ColorAG = 2,",
        "            ColorAB = 3,",
        "            ColorAA = 4,",
        "            ColorBR = 5,",
        "            ColorBG = 6,",
        "            ColorBB = 7,",
        "            ColorBA = 8,",
        "            RepeatX = 9,",
        "            RepeatY = 10",
        "        }",
        "        //<<< _inputids",
        "",
        "        public override OperatorPartContext Eval(OperatorPartContext context, List<OperatorPart> inputs, int outputIdx) {",
        "            //>>> _params",
        "            var Code = inputs[(int)InputId.Code].Eval(context).Text;",
        "            var ColorAR = inputs[(int)InputId.ColorAR].Eval(context).Value;",
        "            var ColorAG = inputs[(int)InputId.ColorAG].Eval(context).Value;",
        "            var ColorAB = inputs[(int)InputId.ColorAB].Eval(context).Value;",
        "            var ColorAA = inputs[(int)InputId.ColorAA].Eval(context).Value;",
        "            var ColorA = new Color4(ColorAR, ColorAG, ColorAB, ColorAA);",
        "            var ColorBR = inputs[(int)InputId.ColorBR].Eval(context).Value;",
        "            var ColorBG = inputs[(int)InputId.ColorBG].Eval(context).Value;",
        "            var ColorBB = inputs[(int)InputId.ColorBB].Eval(context).Value;",
        "            var ColorBA = inputs[(int)InputId.ColorBA].Eval(context).Value;",
        "            var ColorB = new Color4(ColorBR, ColorBG, ColorBB, ColorBA);",
        "            var RepeatX = inputs[(int)InputId.RepeatX].Eval(context).Value;",
        "            var RepeatY = inputs[(int)InputId.RepeatY].Eval(context).Value;",
        "            var Repeat = new Vector2(RepeatX, RepeatY);",
        "            //<<< _params",
        "",
        "            return PrepareAndEvalOnChange(context, () => {",
        "                ClearRenderTarget(context, new SharpDX.Color4(0, 0, 0, 0));",
        "",
        "                //>>> _setup",
        "                {",
        "                    _effect.GetVariableByName(\"RenderTargetSize\").AsVector().Set(new Vector2(_usedViewport.Width, _usedViewport.Height));",
        "                    _effect.GetVariableByName(\"ColorA\").AsVector().Set(new Vector4(ColorAR, ColorAG, ColorAB, ColorAA));",
        "                    _effect.GetVariableByName(\"ColorB\").AsVector().Set(new Vector4(ColorBR, ColorBG, ColorBB, ColorBA));",
        "                    _effect.GetVariableByName(\"Repeat\").AsVector().Set(new Vector2(RepeatX, RepeatY));",
        "                //<<< _setup",
        "",
        "                Render(context);",
        "",
        "                //>>> _cleanup",
        "                }",
        "                //<<< _cleanup",
        "            });",
        "        }",
        "",
        "    }",
        "}",
        "",
        "",
        "",
        ""
      ],
      "AdditionalAssemblies": []
    }
  ],
  "Operators": [],
  "Connections": [
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "83ba3510-1921-44e5-aed0-b68cce9365c4"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "6022db6e-1d39-4b13-83fd-c0c68954a8b9",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "4c1eb66f-6269-4874-8b30-694bf5728710",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "e4ab0706-2124-4b98-81c5-4f016bbfea8d",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "2a9ed98d-4357-4609-b506-a912e416afef",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "5ad2431f-7d0e-4d15-8182-808c4787d269",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "19632b08-fdd6-42d5-8498-277d0c1149db",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "9895d2fe-0871-4062-b07e-7b8ba7e3c714",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "0d6b1abd-837d-4136-bf68-3519edf55585",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "792fe32e-117f-4291-a6d0-0eed82027ae9",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "223b713f-3fa4-4075-99e8-26e1ab7c3f03",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    },
    {
      "SourceOp": "00000000-0000-0000-0000-000000000000",
      "SourceOpPart": "8905194d-2f57-4276-990c-0ac36ba25711",
      "TargetOp": "00000000-0000-0000-0000-000000000000",
      "TargetOpPart": "67489398-fee1-4a8f-86f3-8edf2f924b7a"
    }
  ]
}