{ "QEP": { "QQEM": "0.43", "connections": [ { "fromId": 0, "toId": 3 }, { "fromId": 3, "toId": 1 } ], "exportDirectory": ".", "exportFlags": 2, "exportName": "gridshader", "nodes": [ { "fragmentCode": [ "void main() {", " @nodes", " fragColor = fragColor * qt_Opacity;", "}" ], "name": "Main", "nodeId": 0, "type": 0, "vertexCode": [ "void main() {", " texCoord = qt_MultiTexCoord0;", " if (origo == 0)", " fragCoord = vec2(qt_Vertex.x, iResolution.y - qt_Vertex.y);", " else if (origo == 1)", " fragCoord = qt_Vertex.xy;", " else if (origo == 2)", " fragCoord = vec2(iResolution.x - qt_Vertex.x, qt_Vertex.y);", " else", " fragCoord = vec2(iResolution.x - qt_Vertex.x, iResolution.y - qt_Vertex.y);", " fragCoord += gridMovement;", " vec2 vertCoord = qt_Vertex.xy;", " @nodes", " gl_Position = qt_Matrix * vec4(vertCoord, 0.0, 1.0);", "}" ], "x": 140, "y": 35.400001525878906 }, { "name": "Output", "nodeId": 1, "type": 1, "x": 140, "y": 592.5999755859375 }, { "description": "This is an empty node for creating custom effects.", "fragmentCode": [ "float createBars(float coord, float spacing, float strokeWidth) {", " float sbar = 1.0 / spacing;// * 0.5;", " float barWidth = strokeWidth / spacing;// * 0.5;", " float firstPos = -((gridLineWidth / spacing) * 0.5);", " float p = firstPos + coord * sbar;", " //float p = (coord - 0.5) * sbar;", " float bar = abs(2.0 * fract(p) - 1.0);", " float barSmoothness = smoothing / spacing;", " bar = smoothstep(1.0 - barWidth - barSmoothness, 1.0 - barWidth + barSmoothness, bar);", " return bar;", "}", "", "@main", "{", " // sublines", " float subLines = 0.0;", " if (gridVisibility.z > 0)", " subLines += createBars(fragCoord.x, gridWidth * horizontalSubGridScale, subGridLineWidth);", " if (gridVisibility.w > 0)", " subLines += createBars(fragCoord.y, gridHeight * verticalSubGridScale, subGridLineWidth) * (1.0 - subLines);", " // Major lines", " float lines = 0.0;", " if (gridVisibility.x > 0)", " lines += createBars(fragCoord.x, gridWidth, gridLineWidth);", " if (gridVisibility.y > 0)", " lines += createBars(fragCoord.y, gridHeight, gridLineWidth) * (1.0 - lines);", " // Combine lines, sublines below", " vec3 barColor = plotAreaBackgroundColor.rgb;", " float gridColorAlpha = lines * gridColor.a;", " float subGridColorAlpha = subLines * subGridColor.a;", " barColor = mix(barColor, subGridColor.rgb, subGridColorAlpha);", " barColor = mix(barColor, gridColor.rgb, gridColorAlpha);", " fragColor = vec4(barColor, min(1.0, subGridColorAlpha + gridColorAlpha + plotAreaBackgroundColor.a));", "}" ], "name": "Grids", "nodeId": 3, "properties": [ { "defaultValue": "0", "maxValue": "3", "minValue": "0", "name": "origo", "type": "int", "value": "0" }, { "defaultValue": "1, 1, 1, 1", "maxValue": "1, 1, 1, 1", "minValue": "0, 0, 0, 0", "name": "gridVisibility", "type": "vec4", "value": "1, 1, 1, 1" }, { "defaultValue": "50", "maxValue": "100", "minValue": "10", "name": "gridWidth", "type": "float", "value": "50" }, { "defaultValue": "50", "maxValue": "100", "minValue": "10", "name": "gridHeight", "type": "float", "value": "50" }, { "defaultValue": "0, 0", "maxValue": "500, 500", "minValue": "-500, -500", "name": "gridMovement", "type": "vec2", "value": "0, 0" }, { "defaultValue": "0.5, 0.5, 0.5, 1", "name": "subGridColor", "type": "color", "value": "0.5, 0.5, 0.5, 1" }, { "defaultValue": "1, 1, 1, 1", "name": "gridColor", "type": "color", "value": "1, 1, 1, 1" }, { "defaultValue": "1", "maxValue": "5", "minValue": "0", "name": "subGridLineWidth", "type": "float", "value": "1" }, { "defaultValue": "2", "maxValue": "5", "minValue": "0", "name": "gridLineWidth", "type": "float", "value": "2" }, { "defaultValue": "1", "maxValue": "5", "minValue": "0", "name": "smoothing", "type": "float", "value": "1" }, { "defaultValue": "0.2", "maxValue": "1", "minValue": "0", "name": "verticalSubGridScale", "type": "float", "value": "0.2" }, { "defaultValue": "0.2", "maxValue": "1", "minValue": "0", "name": "horizontalSubGridScale", "type": "float", "value": "0.2" }, { "defaultValue": "0, 0, 0, 0", "name": "plotAreaBackgroundColor", "type": "color", "value": "0, 0, 0, 0" } ], "type": 2, "x": 105, "y": 129.55999755859375 } ], "version": 1 } }