summaryrefslogtreecommitdiffstats
path: root/src/graphs2d/data/TickerShader.qep
blob: ec81ae0eecd46c8c54fcb9df964f280c3e9b6741 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
{
    "QEP": {
        "QQEM": "0.43",
        "connections": [
            {
                "fromId": 0,
                "toId": 3
            },
            {
                "fromId": 3,
                "toId": 1
            }
        ],
        "exportDirectory": ".",
        "exportFlags": 2,
        "exportName": "tickershader",
        "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);",
                    "#if (HORIZONTAL == 1)",
                    "    fragCoord.x += displacement;",
                    "#else",
                    "    fragCoord.y += displacement;",
                    "#endif",
                    "    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 = -((tickLineWidth / 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",
                    "{",
                    "    float subLines = 0.0;",
                    "    float lines = 0.0;",
                    "#if (HORIZONTAL == 1)",
                    "    // sublines",
                    "    if (subTicksVisible) {",
                    "        if (flipped && fragCoord.y < iResolution.y * subTickLength)",
                    "            subLines += createBars(fragCoord.x, spacing * subTickScale, subTickLineWidth);",
                    "        if (!flipped && fragCoord.y > iResolution.y * (1.0 - subTickLength))",
                    "            subLines += createBars(fragCoord.x, spacing * subTickScale, subTickLineWidth);",
                    "    }",
                    "    // major lines",
                    "    lines += createBars(fragCoord.x, spacing, tickLineWidth);",
                    "#else",
                    "    // sublines",
                    "    if (subTicksVisible) {",
                    "        if (flipped && fragCoord.x < iResolution.x * subTickLength)",
                    "            subLines += createBars(fragCoord.y, spacing * subTickScale, subTickLineWidth);",
                    "        if (!flipped && fragCoord.x > iResolution.x * (1.0 - subTickLength))",
                    "            subLines += createBars(fragCoord.y, spacing * subTickScale, subTickLineWidth);",
                    "    }",
                    "    // major lines",
                    "    lines += createBars(fragCoord.y, spacing, tickLineWidth);",
                    "#endif",
                    "    // Combine lines, subLines below",
                    "    vec3 lineColor = vec3(0.0);",
                    "    float tickColorAlpha = lines * tickColor.a;",
                    "    float subTickColorAlpha = subLines * subTickColor.a;",
                    "    lineColor = mix(lineColor, subTickColor.rgb, subTickColorAlpha);",
                    "    lineColor = mix(lineColor, tickColor.rgb, tickColorAlpha);",
                    "    fragColor = vec4(lineColor, min(1.0, subTickColorAlpha + tickColorAlpha));",
                    "}"
                ],
                "name": "Grids",
                "nodeId": 3,
                "properties": [
                    {
                        "defaultValue": "0",
                        "name": "HORIZONTAL",
                        "type": "define",
                        "value": "0"
                    },
                    {
                        "defaultValue": "0",
                        "maxValue": "3",
                        "minValue": "0",
                        "name": "origo",
                        "type": "int",
                        "value": "0"
                    },
                    {
                        "defaultValue": "true",
                        "name": "subTicksVisible",
                        "type": "bool",
                        "value": "true"
                    },
                    {
                        "defaultValue": "50",
                        "maxValue": "100",
                        "minValue": "10",
                        "name": "spacing",
                        "type": "float",
                        "value": "50"
                    },
                    {
                        "defaultValue": "0.5",
                        "maxValue": "1",
                        "minValue": "0.1",
                        "name": "subTickLength",
                        "type": "float",
                        "value": "0.5"
                    },
                    {
                        "defaultValue": "0",
                        "maxValue": "500",
                        "minValue": "-500",
                        "name": "displacement",
                        "type": "float",
                        "value": "0"
                    },
                    {
                        "defaultValue": "0.5, 0.5, 0.5, 1",
                        "name": "subTickColor",
                        "type": "color",
                        "value": "0.5, 0.5, 0.5, 1"
                    },
                    {
                        "defaultValue": "1, 1, 1, 1",
                        "name": "tickColor",
                        "type": "color",
                        "value": "1, 1, 1, 1"
                    },
                    {
                        "defaultValue": "1",
                        "maxValue": "5",
                        "minValue": "0",
                        "name": "subTickLineWidth",
                        "type": "float",
                        "value": "1"
                    },
                    {
                        "defaultValue": "2",
                        "maxValue": "5",
                        "minValue": "0",
                        "name": "tickLineWidth",
                        "type": "float",
                        "value": "2"
                    },
                    {
                        "defaultValue": "1",
                        "maxValue": "5",
                        "minValue": "0",
                        "name": "smoothing",
                        "type": "float",
                        "value": "1"
                    },
                    {
                        "defaultValue": "0.2",
                        "maxValue": "1",
                        "minValue": "0",
                        "name": "subTickScale",
                        "type": "float",
                        "value": "0.2"
                    },
                    {
                        "defaultValue": "false",
                        "name": "flipped",
                        "type": "bool",
                        "value": "false"
                    }
                ],
                "type": 2,
                "x": 105,
                "y": 129.55999755859375
            }
        ],
        "version": 1
    }
}