@genome-spy/core 0.30.0 → 0.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +16373 -0
- package/dist/index.js +43 -43
- package/package.json +10 -7
- package/src/data/collector.js +0 -183
- package/src/data/collector.test.js +0 -84
- package/src/data/dataFlow.js +0 -148
- package/src/data/dataFlow.test.js +0 -5
- package/src/data/facetNode.js +0 -17
- package/src/data/flow.test.js +0 -72
- package/src/data/flowBatch.d.ts +0 -40
- package/src/data/flowNode.js +0 -283
- package/src/data/flowNode.test.js +0 -50
- package/src/data/flowOptimizer.js +0 -123
- package/src/data/flowOptimizer.test.js +0 -193
- package/src/data/flowTestUtils.js +0 -63
- package/src/data/formats/fasta.js +0 -32
- package/src/data/formats/fasta.test.js +0 -27
- package/src/data/sources/dataSource.js +0 -22
- package/src/data/sources/dataSourceFactory.js +0 -24
- package/src/data/sources/dataUtils.js +0 -78
- package/src/data/sources/dynamicCallbackSource.js +0 -57
- package/src/data/sources/dynamicSource.js +0 -37
- package/src/data/sources/inlineSource.js +0 -67
- package/src/data/sources/inlineSource.test.js +0 -56
- package/src/data/sources/namedSource.js +0 -79
- package/src/data/sources/sequenceSource.js +0 -46
- package/src/data/sources/sequenceSource.test.js +0 -46
- package/src/data/sources/urlSource.js +0 -74
- package/src/data/transforms/aggregate.js +0 -70
- package/src/data/transforms/clone.js +0 -40
- package/src/data/transforms/clone.test.js +0 -11
- package/src/data/transforms/coverage.js +0 -187
- package/src/data/transforms/coverage.test.js +0 -123
- package/src/data/transforms/filter.js +0 -37
- package/src/data/transforms/filter.test.js +0 -18
- package/src/data/transforms/filterScoredLabels.js +0 -134
- package/src/data/transforms/flattenCompressedExons.js +0 -57
- package/src/data/transforms/flattenDelimited.js +0 -74
- package/src/data/transforms/flattenDelimited.test.js +0 -87
- package/src/data/transforms/flattenSequence.js +0 -39
- package/src/data/transforms/flattenSequence.test.js +0 -34
- package/src/data/transforms/formula.js +0 -39
- package/src/data/transforms/formula.test.js +0 -19
- package/src/data/transforms/identifier.js +0 -108
- package/src/data/transforms/identifier.test.js +0 -83
- package/src/data/transforms/linearizeGenomicCoordinate.js +0 -101
- package/src/data/transforms/measureText.js +0 -44
- package/src/data/transforms/pileup.js +0 -128
- package/src/data/transforms/pileup.test.js +0 -70
- package/src/data/transforms/project.js +0 -41
- package/src/data/transforms/project.test.js +0 -32
- package/src/data/transforms/regexExtract.js +0 -61
- package/src/data/transforms/regexExtract.test.js +0 -67
- package/src/data/transforms/regexFold.js +0 -141
- package/src/data/transforms/regexFold.test.js +0 -160
- package/src/data/transforms/sample.js +0 -101
- package/src/data/transforms/sample.test.js +0 -38
- package/src/data/transforms/stack.js +0 -137
- package/src/data/transforms/stack.test.js +0 -91
- package/src/data/transforms/transformFactory.js +0 -60
- package/src/embedApi.d.ts +0 -67
- package/src/encoder/accessor.js +0 -82
- package/src/encoder/accessor.test.js +0 -47
- package/src/encoder/encoder.js +0 -394
- package/src/encoder/encoder.test.js +0 -98
- package/src/fonts/Lato-Regular.json +0 -1267
- package/src/fonts/Lato-Regular.png +0 -0
- package/src/fonts/OFL.txt +0 -93
- package/src/fonts/README.md +0 -3
- package/src/fonts/bmFont.d.ts +0 -58
- package/src/fonts/bmFontManager.js +0 -357
- package/src/fonts/bmFontMetrics.js +0 -108
- package/src/genome/genome.js +0 -317
- package/src/genome/genome.test.js +0 -188
- package/src/genome/genomeStore.js +0 -54
- package/src/genome/locusFormat.js +0 -31
- package/src/genome/scaleIndex.d.ts +0 -38
- package/src/genome/scaleIndex.js +0 -166
- package/src/genome/scaleIndex.test.js +0 -78
- package/src/genome/scaleLocus.d.ts +0 -11
- package/src/genome/scaleLocus.js +0 -108
- package/src/genome/scaleLocus.test.js +0 -4
- package/src/genomeSpy.js +0 -785
- package/src/gl/arrayBuilder.js +0 -199
- package/src/gl/dataToVertices.js +0 -636
- package/src/gl/includes/common.glsl +0 -63
- package/src/gl/includes/picking.fragment.glsl +0 -1
- package/src/gl/includes/picking.vertex.glsl +0 -27
- package/src/gl/includes/sampleFacet.glsl +0 -107
- package/src/gl/includes/scales.glsl +0 -112
- package/src/gl/link.fragment.glsl +0 -18
- package/src/gl/link.vertex.glsl +0 -111
- package/src/gl/point.fragment.glsl +0 -123
- package/src/gl/point.vertex.glsl +0 -129
- package/src/gl/rect.fragment.glsl +0 -51
- package/src/gl/rect.vertex.glsl +0 -114
- package/src/gl/rule.fragment.glsl +0 -52
- package/src/gl/rule.vertex.glsl +0 -89
- package/src/gl/text.fragment.glsl +0 -31
- package/src/gl/text.vertex.glsl +0 -246
- package/src/gl/webGLHelper.js +0 -504
- package/src/img/bowtie.svg +0 -1
- package/src/img/genomespy-favicon.svg +0 -34
- package/src/index.html +0 -11
- package/src/index.js +0 -128
- package/src/marks/link.js +0 -175
- package/src/marks/mark.js +0 -975
- package/src/marks/markUtils.js +0 -125
- package/src/marks/pointMark.js +0 -251
- package/src/marks/rectMark.js +0 -241
- package/src/marks/rule.js +0 -250
- package/src/marks/text.js +0 -278
- package/src/node_modules/.vitest/results.json +0 -1
- package/src/scale/colorUtils.js +0 -184
- package/src/scale/glslScaleGenerator.js +0 -502
- package/src/scale/scale.js +0 -451
- package/src/scale/scale.test.js +0 -324
- package/src/scale/ticks.js +0 -203
- package/src/scale/ticks.test.js +0 -40
- package/src/singlePageApp.js +0 -13
- package/src/spec/axis.d.ts +0 -296
- package/src/spec/channel.d.ts +0 -430
- package/src/spec/data.d.ts +0 -196
- package/src/spec/font.d.ts +0 -15
- package/src/spec/genome.d.ts +0 -35
- package/src/spec/mark.d.ts +0 -429
- package/src/spec/root.d.ts +0 -17
- package/src/spec/sampleView.d.ts +0 -180
- package/src/spec/scale.d.ts +0 -273
- package/src/spec/title.d.ts +0 -102
- package/src/spec/tooltip.d.ts +0 -9
- package/src/spec/transform.d.ts +0 -479
- package/src/spec/view.d.ts +0 -201
- package/src/styles/genome-spy.scss +0 -153
- package/src/tooltip/dataTooltipHandler.js +0 -64
- package/src/tooltip/refseqGeneTooltipHandler.js +0 -78
- package/src/tooltip/tooltipHandler.ts +0 -12
- package/src/types/filetypes.d.ts +0 -14
- package/src/types/flatqueue.d.ts +0 -53
- package/src/types/glsl.d.ts +0 -4
- package/src/types/internmap.d.ts +0 -22
- package/src/types/object.d.ts +0 -21
- package/src/types/vega-loader.d.ts +0 -1
- package/src/types/vega-scale.d.ts +0 -60
- package/src/utils/addBaseUrl.js +0 -19
- package/src/utils/addBaseUrl.test.js +0 -22
- package/src/utils/animator.js +0 -83
- package/src/utils/arrayUtils.js +0 -61
- package/src/utils/binnedIndex.js +0 -167
- package/src/utils/binnedIndex.test.js +0 -155
- package/src/utils/clamp.js +0 -8
- package/src/utils/cloner.js +0 -34
- package/src/utils/cloner.test.js +0 -24
- package/src/utils/coalesce.js +0 -11
- package/src/utils/coalesce.test.js +0 -16
- package/src/utils/concatIterables.js +0 -26
- package/src/utils/concatIterables.test.js +0 -8
- package/src/utils/debounce.js +0 -37
- package/src/utils/domainArray.js +0 -216
- package/src/utils/domainArray.test.js +0 -130
- package/src/utils/eerp.js +0 -13
- package/src/utils/expression.js +0 -32
- package/src/utils/field.js +0 -28
- package/src/utils/formatObject.js +0 -31
- package/src/utils/indexer.js +0 -43
- package/src/utils/indexer.test.js +0 -47
- package/src/utils/inertia.js +0 -124
- package/src/utils/interactionEvent.js +0 -33
- package/src/utils/iterateNestedMaps.js +0 -21
- package/src/utils/iterateNestedMaps.test.js +0 -33
- package/src/utils/kWayMerge.js +0 -42
- package/src/utils/kWayMerge.test.js +0 -26
- package/src/utils/layout/flexLayout.js +0 -368
- package/src/utils/layout/flexLayout.test.js +0 -311
- package/src/utils/layout/grid.js +0 -95
- package/src/utils/layout/grid.test.js +0 -71
- package/src/utils/layout/padding.js +0 -120
- package/src/utils/layout/point.js +0 -23
- package/src/utils/layout/rectangle.js +0 -288
- package/src/utils/layout/rectangle.test.js +0 -172
- package/src/utils/mergeObjects.js +0 -99
- package/src/utils/mergeObjects.test.js +0 -42
- package/src/utils/numberExtractor.js +0 -24
- package/src/utils/numberExtractor.test.js +0 -6
- package/src/utils/point.js +0 -14
- package/src/utils/propertyCacher.js +0 -70
- package/src/utils/propertyCacher.test.js +0 -85
- package/src/utils/propertyCoalescer.js +0 -42
- package/src/utils/propertyCoalescer.test.js +0 -22
- package/src/utils/reservationMap.js +0 -103
- package/src/utils/reservationMap.test.js +0 -20
- package/src/utils/scaleNull.js +0 -19
- package/src/utils/setOperations.js +0 -75
- package/src/utils/smoothstep.js +0 -10
- package/src/utils/throttle.js +0 -34
- package/src/utils/topK.js +0 -76
- package/src/utils/topK.test.js +0 -64
- package/src/utils/transition.js +0 -74
- package/src/utils/ui/tooltip.js +0 -189
- package/src/utils/url.js +0 -22
- package/src/utils/variableTools.js +0 -24
- package/src/utils/variableTools.test.js +0 -13
- package/src/view/axisResolution.js +0 -140
- package/src/view/axisResolution.test.js +0 -201
- package/src/view/axisView.js +0 -747
- package/src/view/concatView.js +0 -45
- package/src/view/containerView.js +0 -159
- package/src/view/facetView.js +0 -491
- package/src/view/flowBuilder.js +0 -367
- package/src/view/flowBuilder.test.js +0 -125
- package/src/view/gridView.js +0 -786
- package/src/view/implicitRootView.js +0 -14
- package/src/view/importView.js +0 -19
- package/src/view/layerView.js +0 -74
- package/src/view/rendering.d.ts +0 -44
- package/src/view/renderingContext/compositeViewRenderingContext.js +0 -51
- package/src/view/renderingContext/deferredViewRenderingContext.js +0 -176
- package/src/view/renderingContext/layoutRecorderViewRenderingContext.js +0 -128
- package/src/view/renderingContext/simpleViewRenderingContext.js +0 -64
- package/src/view/renderingContext/svgViewRenderingContext.js +0 -125
- package/src/view/renderingContext/viewRenderingContext.js +0 -41
- package/src/view/scaleResolution.js +0 -797
- package/src/view/scaleResolution.test.js +0 -572
- package/src/view/scaleResolutionApi.d.ts +0 -40
- package/src/view/testUtils.js +0 -51
- package/src/view/title.js +0 -165
- package/src/view/unitView.js +0 -382
- package/src/view/view.js +0 -612
- package/src/view/view.test.js +0 -214
- package/src/view/viewContext.d.ts +0 -62
- package/src/view/viewFactory.js +0 -181
- package/src/view/viewFactory.test.js +0 -17
- package/src/view/viewUtils.js +0 -327
- package/src/view/zoom.js +0 -89
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Based on concepts presented at:
|
|
3
|
-
* https://webglfundamentals.org/webgl/lessons/webgl-picking.html
|
|
4
|
-
* https://deck.gl/docs/developer-guide/custom-layers/picking
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
out highp vec4 vPickingColor;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Passes the unique id to the fragment shader as a color if picking is enabled.
|
|
11
|
-
* Returns true if picking is enabled.
|
|
12
|
-
*/
|
|
13
|
-
bool setupPicking() {
|
|
14
|
-
if (uPickingEnabled) {
|
|
15
|
-
#ifdef uniqueId_DEFINED
|
|
16
|
-
int id = int(getScaled_uniqueId());
|
|
17
|
-
// TODO: Take the sign bit into account
|
|
18
|
-
vPickingColor = vec4(
|
|
19
|
-
ivec4(id >> 0, id >> 8, id >> 16, 0xFF) & 0xFF
|
|
20
|
-
) / float(0xFF);
|
|
21
|
-
#else
|
|
22
|
-
vPickingColor = vec4(1.0);
|
|
23
|
-
#endif
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return false;
|
|
27
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Describes where a sample facet should be shown. Interpolating between the
|
|
4
|
-
* current and target positions/heights allows for transitioning between facet
|
|
5
|
-
* configurations.
|
|
6
|
-
*/
|
|
7
|
-
struct SampleFacetPosition {
|
|
8
|
-
float pos;
|
|
9
|
-
float height;
|
|
10
|
-
float targetPos;
|
|
11
|
-
float targetHeight;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Trasition fraction [0, 1] between the current and target configurations.
|
|
16
|
-
*/
|
|
17
|
-
uniform float uTransitionOffset;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
// ----------------------------------------------------------------------------
|
|
21
|
-
|
|
22
|
-
#if !defined(SAMPLE_FACET_UNIFORM) && !defined(SAMPLE_FACET_TEXTURE)
|
|
23
|
-
|
|
24
|
-
SampleFacetPosition getSampleFacetPos() {
|
|
25
|
-
return SampleFacetPosition(0.0, 1.0, 0.0, 1.0);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
#elif defined(SAMPLE_FACET_UNIFORM)
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Location and height of the band on the Y axis on a normalized [0, 1] scale.
|
|
32
|
-
* Elements: curr pos, curr height, target pos, target height
|
|
33
|
-
*/
|
|
34
|
-
uniform vec4 uSampleFacet;
|
|
35
|
-
|
|
36
|
-
SampleFacetPosition getSampleFacetPos() {
|
|
37
|
-
return SampleFacetPosition(
|
|
38
|
-
1.0 - uSampleFacet.x - uSampleFacet.y,
|
|
39
|
-
uSampleFacet.y,
|
|
40
|
-
1.0 - uSampleFacet.z - uSampleFacet.w,
|
|
41
|
-
uSampleFacet.w
|
|
42
|
-
);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
#elif defined(SAMPLE_FACET_TEXTURE)
|
|
46
|
-
|
|
47
|
-
uniform sampler2D uSampleFacetTexture;
|
|
48
|
-
|
|
49
|
-
SampleFacetPosition getSampleFacetPos() {
|
|
50
|
-
vec4 texel = texelFetch(uSampleFacetTexture, ivec2(int(attr_facetIndex), 0), 0);
|
|
51
|
-
return SampleFacetPosition(
|
|
52
|
-
1.0 - texel.r - texel.g,
|
|
53
|
-
texel.g,
|
|
54
|
-
1.0 - texel.r - texel.g,
|
|
55
|
-
texel.g);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
#endif
|
|
59
|
-
|
|
60
|
-
// ----------------------------------------------------------------------------
|
|
61
|
-
|
|
62
|
-
bool isFacetedSamples(SampleFacetPosition facetPos) {
|
|
63
|
-
return facetPos != SampleFacetPosition(0.0, 1.0, 0.0, 1.0);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
bool isFacetedSamples() {
|
|
67
|
-
return isFacetedSamples(getSampleFacetPos());
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
bool isInTransit() {
|
|
71
|
-
return uTransitionOffset > 0.0;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
float getTransitionFraction(float xPos) {
|
|
75
|
-
return smoothstep(0.0, 0.7 + uTransitionOffset, (xPos - uTransitionOffset) * 2.0);
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
vec2 applySampleFacet(vec2 pos) {
|
|
79
|
-
SampleFacetPosition facetPos = getSampleFacetPos();
|
|
80
|
-
|
|
81
|
-
if (!isFacetedSamples(facetPos)) {
|
|
82
|
-
return pos;
|
|
83
|
-
} else if (isInTransit()) {
|
|
84
|
-
vec2 interpolated = mix(
|
|
85
|
-
vec2(facetPos.pos, facetPos.height),
|
|
86
|
-
vec2(facetPos.targetPos, facetPos.targetHeight),
|
|
87
|
-
getTransitionFraction(pos.x));
|
|
88
|
-
return vec2(pos.x, interpolated[0] + pos.y * interpolated[1]);
|
|
89
|
-
} else {
|
|
90
|
-
return vec2(pos.x, facetPos.pos + pos.y * facetPos.height);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
float getSampleFacetHeight(vec2 pos) {
|
|
95
|
-
SampleFacetPosition facetPos = getSampleFacetPos();
|
|
96
|
-
|
|
97
|
-
if (!isFacetedSamples(facetPos)) {
|
|
98
|
-
return 1.0;
|
|
99
|
-
} else if (isInTransit()) {
|
|
100
|
-
return mix(
|
|
101
|
-
facetPos.height,
|
|
102
|
-
facetPos.targetHeight,
|
|
103
|
-
getTransitionFraction(pos.x));
|
|
104
|
-
} else {
|
|
105
|
-
return facetPos.height;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
const float inf = 1.0 / 0.0;
|
|
2
|
-
|
|
3
|
-
// Utils ------------
|
|
4
|
-
|
|
5
|
-
vec3 getDiscreteColor(sampler2D s, int index) {
|
|
6
|
-
return texelFetch(s, ivec2(index % textureSize(s, 0).x, 0), 0).rgb;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
vec3 getInterpolatedColor(sampler2D s, float unitValue) {
|
|
10
|
-
return texture(s, vec2(unitValue, 0.0)).rgb;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
float clampToRange(float value, vec2 range) {
|
|
14
|
-
return clamp(value, min(range[0], range[1]), max(range[0], range[1]));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Scales ------------
|
|
18
|
-
// Based on d3 scales: https://github.com/d3/d3-scale
|
|
19
|
-
|
|
20
|
-
float scaleIdentity(float value) {
|
|
21
|
-
return value;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
float scaleLinear(float value, vec2 domain, vec2 range) {
|
|
25
|
-
float domainSpan = domain[1] - domain[0];
|
|
26
|
-
float rangeSpan = range[1] - range[0];
|
|
27
|
-
return (value - domain[0]) / domainSpan * rangeSpan + range[0];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
float scaleLog(float value, vec2 domain, vec2 range, float base) {
|
|
31
|
-
// y = m log(x) + b
|
|
32
|
-
// TODO: Perf optimization: precalculate log domain in js.
|
|
33
|
-
// TODO: Reversed domain, etc
|
|
34
|
-
return scaleLinear(log(value) / log(base), log(domain) / log(base), range);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
float symlog(float value, float constant) {
|
|
38
|
-
// WARNING: emulating log1p with log(x + 1). Small numbers are likely to
|
|
39
|
-
// have significant precision problems.
|
|
40
|
-
return sign(value) * log(abs(value / constant) + 1.0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
float scaleSymlog(float value, vec2 domain, vec2 range, float constant) {
|
|
44
|
-
return scaleLinear(
|
|
45
|
-
symlog(value, constant),
|
|
46
|
-
vec2(symlog(domain[0], constant), symlog(domain[1], constant)),
|
|
47
|
-
range
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
float scalePow(float value, vec2 domain, vec2 range, float exponent) {
|
|
52
|
-
// y = mx^k + b
|
|
53
|
-
// TODO: Perf optimization: precalculate pow domain in js.
|
|
54
|
-
// TODO: Reversed domain, etc
|
|
55
|
-
return scaleLinear(
|
|
56
|
-
pow(abs(value), exponent) * sign(value),
|
|
57
|
-
pow(abs(domain), vec2(exponent)) * sign(domain),
|
|
58
|
-
range
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// TODO: scaleThreshold
|
|
63
|
-
// TODO: scaleQuantile (special case of threshold scale)
|
|
64
|
-
|
|
65
|
-
float scaleBand(float value, vec2 domainExtent, vec2 range,
|
|
66
|
-
float paddingInner, float paddingOuter,
|
|
67
|
-
float align, float band) {
|
|
68
|
-
|
|
69
|
-
// TODO: reverse
|
|
70
|
-
float start = range[0];
|
|
71
|
-
float stop = range[1];
|
|
72
|
-
float rangeSpan = stop - start;
|
|
73
|
-
|
|
74
|
-
float n = domainExtent[1] - domainExtent[0];
|
|
75
|
-
|
|
76
|
-
// This fix departs from Vega and d3: https://github.com/vega/vega/issues/3357#issuecomment-1063253596
|
|
77
|
-
paddingInner = int(n) > 1 ? paddingInner : 0.0;
|
|
78
|
-
|
|
79
|
-
// Adapted from: https://github.com/d3/d3-scale/blob/master/src/band.js
|
|
80
|
-
float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);
|
|
81
|
-
start += (rangeSpan - step * (n - paddingInner)) * align;
|
|
82
|
-
float bandwidth = step * (1.0 - paddingInner);
|
|
83
|
-
|
|
84
|
-
return start + (value - domainExtent[0]) * step + bandwidth * band;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// High precision variant of scaleBand for index/locus scales
|
|
88
|
-
float scaleBandHp(vec2 value, vec3 domainExtent, vec2 range,
|
|
89
|
-
float paddingInner, float paddingOuter,
|
|
90
|
-
float align, float band) {
|
|
91
|
-
|
|
92
|
-
// TODO: reverse
|
|
93
|
-
float start = range[0];
|
|
94
|
-
float stop = range[1];
|
|
95
|
-
float rangeSpan = stop - start;
|
|
96
|
-
|
|
97
|
-
vec2 domainStart = domainExtent.xy;
|
|
98
|
-
float n = domainExtent[2];
|
|
99
|
-
|
|
100
|
-
// The following computation is identical for every vertex. Could be done on the JS side.
|
|
101
|
-
float step = rangeSpan / max(1.0, n - paddingInner + paddingOuter * 2.0);
|
|
102
|
-
start += (rangeSpan - step * (n - paddingInner)) * align;
|
|
103
|
-
float bandwidth = step * (1.0 - paddingInner);
|
|
104
|
-
|
|
105
|
-
// Using max to prevent the shader compiler from wrecking the precision.
|
|
106
|
-
// Othwewise the compiler could optimize the sum of the four terms into
|
|
107
|
-
// some equivalent form that does premature rounding.
|
|
108
|
-
float hi = max(value[0] - domainStart[0], -inf);
|
|
109
|
-
float lo = max(value[1] - domainStart[1], -inf);
|
|
110
|
-
|
|
111
|
-
return dot(vec4(start, hi, lo, bandwidth), vec4(1.0, step, step, band));
|
|
112
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
in lowp vec4 vColor;
|
|
2
|
-
in float vSize;
|
|
3
|
-
in float vNormalLengthInPixels;
|
|
4
|
-
|
|
5
|
-
out lowp vec4 fragColor;
|
|
6
|
-
|
|
7
|
-
void main(void) {
|
|
8
|
-
float dpr = uDevicePixelRatio;
|
|
9
|
-
|
|
10
|
-
float distance = abs(vNormalLengthInPixels);
|
|
11
|
-
float opacity = clamp(((vSize / 2.0 - distance) * dpr), 0.0, 1.0);
|
|
12
|
-
|
|
13
|
-
fragColor = vColor * opacity;
|
|
14
|
-
|
|
15
|
-
if (uPickingEnabled) {
|
|
16
|
-
fragColor = vPickingColor;
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/gl/link.vertex.glsl
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
uniform float uSagittaScaleFactor;
|
|
2
|
-
|
|
3
|
-
/** Make very small arcs visible */
|
|
4
|
-
uniform float uMinSagittaLength;
|
|
5
|
-
|
|
6
|
-
in vec2 strip;
|
|
7
|
-
|
|
8
|
-
out vec4 vColor;
|
|
9
|
-
|
|
10
|
-
/** Stroke width */
|
|
11
|
-
out float vSize;
|
|
12
|
-
|
|
13
|
-
/** The distance from the line center to the direction of normal in pixels */
|
|
14
|
-
out float vNormalLengthInPixels;
|
|
15
|
-
|
|
16
|
-
void main(void) {
|
|
17
|
-
float pixelSize = 1.0 / uDevicePixelRatio;
|
|
18
|
-
float opacity = getScaled_opacity() * uViewOpacity;
|
|
19
|
-
|
|
20
|
-
vec2 a = vec2(getScaled_x(), getScaled_y()) * uViewportSize;
|
|
21
|
-
vec2 b = vec2(getScaled_x2(), getScaled_y2()) * uViewportSize;
|
|
22
|
-
|
|
23
|
-
vec2 chordVector = b - a;
|
|
24
|
-
vec2 unitChordVector = normalize(chordVector);
|
|
25
|
-
vec2 chordNormal = vec2(-unitChordVector.y, unitChordVector.x);
|
|
26
|
-
|
|
27
|
-
float sagitta = max(
|
|
28
|
-
length(chordVector) / 2.0 * uSagittaScaleFactor,
|
|
29
|
-
uMinSagittaLength
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
bool compress = false;
|
|
33
|
-
if (compress) {
|
|
34
|
-
// Work in progres...
|
|
35
|
-
float maxSagittaLen = length(chordNormal * uViewportSize);
|
|
36
|
-
float maxChordLen = length(unitChordVector * uViewportSize);
|
|
37
|
-
|
|
38
|
-
float threshold = maxSagittaLen * 0.5;
|
|
39
|
-
if (sagitta > threshold) {
|
|
40
|
-
float m = (maxSagittaLen - threshold) / (maxChordLen - threshold);
|
|
41
|
-
sagitta = (sagitta - threshold) * m + threshold;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
vec2 controlOffset = chordNormal * sagitta / 0.75;
|
|
46
|
-
|
|
47
|
-
vec2 p1 = a;
|
|
48
|
-
vec2 p2 = a + controlOffset;
|
|
49
|
-
vec2 p3 = b + controlOffset;
|
|
50
|
-
vec2 p4 = b;
|
|
51
|
-
|
|
52
|
-
// Make segments shorter near the endpoints to make the tightly bent attachment points smoother
|
|
53
|
-
float t = smoothstep(0.0, 1.0, strip.x);
|
|
54
|
-
|
|
55
|
-
// https://stackoverflow.com/a/31317254/1547896
|
|
56
|
-
vec2 C1 = p4 - 3.0 * p3 + 3.0 * p2 - p1;
|
|
57
|
-
vec2 C2 = 3.0 * p3 - 6.0 * p2 + 3.0 * p1;
|
|
58
|
-
vec2 C3 = 3.0 * p2 - 3.0 * p1;
|
|
59
|
-
vec2 C4 = p1;
|
|
60
|
-
|
|
61
|
-
vec2 p;
|
|
62
|
-
// Skip computation at endpoints to maintain precision
|
|
63
|
-
if (t == 0.0) {
|
|
64
|
-
p = p1;
|
|
65
|
-
} else if (t == 1.0) {
|
|
66
|
-
p = p4;
|
|
67
|
-
} else {
|
|
68
|
-
p = C1*t*t*t + C2*t*t + C3*t + C4;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
vec2 tangent = normalize(3.0*C1*t*t + 2.0*C2*t + C3);
|
|
72
|
-
vec2 normal = vec2(-tangent.y, tangent.x);
|
|
73
|
-
|
|
74
|
-
//p = applySampleFacet(p);
|
|
75
|
-
|
|
76
|
-
#ifdef size2_DEFINED
|
|
77
|
-
float mixedSize = mix(getScaled_size(), getScaled_size2(), t);
|
|
78
|
-
#else
|
|
79
|
-
float mixedSize = getScaled_size();
|
|
80
|
-
#endif
|
|
81
|
-
|
|
82
|
-
// Avoid artifacts in very thin lines by clamping the size and adjusting opacity respectively
|
|
83
|
-
if (mixedSize < pixelSize) {
|
|
84
|
-
opacity *= mixedSize / pixelSize;
|
|
85
|
-
mixedSize = pixelSize;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// Add an extra pixel to stroke width to accommodate edge antialiasing
|
|
89
|
-
float paddedSize = mixedSize + pixelSize;
|
|
90
|
-
|
|
91
|
-
vNormalLengthInPixels = strip.y * paddedSize;
|
|
92
|
-
|
|
93
|
-
// Extrude
|
|
94
|
-
p += normal * vNormalLengthInPixels;
|
|
95
|
-
|
|
96
|
-
gl_Position = pixelsToNdc(p);
|
|
97
|
-
|
|
98
|
-
#ifdef color2_DEFINED
|
|
99
|
-
// Yuck, RGB interpolation in gamma space!
|
|
100
|
-
// TODO: linear space: https://unlimited3d.wordpress.com/2020/01/08/srgb-color-space-in-opengl/
|
|
101
|
-
vec3 color = mix(getScaled_color(), getScaled_color2(), t);
|
|
102
|
-
#else
|
|
103
|
-
vec3 color = getScaled_color();
|
|
104
|
-
#endif
|
|
105
|
-
|
|
106
|
-
vColor = vec4(color * opacity, opacity);
|
|
107
|
-
|
|
108
|
-
vSize = paddedSize;
|
|
109
|
-
|
|
110
|
-
setupPicking();
|
|
111
|
-
}
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
const lowp vec4 white = vec4(1.0);
|
|
2
|
-
const lowp vec4 black = vec4(0.0, 0.0, 0.0, 1.0);
|
|
3
|
-
|
|
4
|
-
uniform bool uInwardStroke;
|
|
5
|
-
uniform float uGradientStrength;
|
|
6
|
-
|
|
7
|
-
in float vRadius;
|
|
8
|
-
in float vRadiusWithPadding;
|
|
9
|
-
|
|
10
|
-
in lowp vec4 vFillColor;
|
|
11
|
-
in lowp vec4 vStrokeColor;
|
|
12
|
-
in lowp float vShape;
|
|
13
|
-
in lowp float vHalfStrokeWidth;
|
|
14
|
-
|
|
15
|
-
in mat2 vRotationMatrix;
|
|
16
|
-
|
|
17
|
-
out lowp vec4 fragColor;
|
|
18
|
-
|
|
19
|
-
const float CIRCLE = 0.0;
|
|
20
|
-
const float SQUARE = 1.0;
|
|
21
|
-
const float TRIANGLE_UP = 2.0;
|
|
22
|
-
const float CROSS = 3.0;
|
|
23
|
-
const float DIAMOND = 4.0;
|
|
24
|
-
const float TRIANGLE_DOWN = 5.0;
|
|
25
|
-
const float TRIANGLE_RIGHT = 6.0;
|
|
26
|
-
const float TRIANGLE_LEFT = 7.0;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// The distance functions are inspired by:
|
|
30
|
-
// http://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
|
|
31
|
-
// However, these are not true distance functions, because the corners need to be sharp.
|
|
32
|
-
|
|
33
|
-
float circle(vec2 p, float r) {
|
|
34
|
-
return length(p) - r;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
float square(vec2 p, float r) {
|
|
38
|
-
p = abs(p);
|
|
39
|
-
return max(p.x, p.y) - r;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
float equilateralTriangle(vec2 p, float r, bool flip, bool swap) {
|
|
43
|
-
if (swap) {
|
|
44
|
-
p.xy = p.yx;
|
|
45
|
-
}
|
|
46
|
-
if (flip) {
|
|
47
|
-
p.y = -p.y;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
float k = sqrt(3.0);
|
|
51
|
-
float kr = k * r;
|
|
52
|
-
//p.y -= kr * 2.0 / 3.0;
|
|
53
|
-
p.y -= kr / 2.0;
|
|
54
|
-
return max((abs(p.x) * k + p.y) / 2.0, -p.y - kr);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
float crossShape(vec2 p, float r) {
|
|
58
|
-
p = abs(p);
|
|
59
|
-
|
|
60
|
-
vec2 b = vec2(0.4, 1.0) * r;
|
|
61
|
-
vec2 v = abs(p) - b.xy;
|
|
62
|
-
vec2 h = abs(p) - b.yx;
|
|
63
|
-
return min(max(v.x, v.y), max(h.x, h.y));
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
float diamond(vec2 p, float r) {
|
|
67
|
-
p = abs(p);
|
|
68
|
-
return (max(abs(p.x - p.y), abs(p.x + p.y)) - r) / sqrt(2.0);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
void main() {
|
|
72
|
-
float d;
|
|
73
|
-
|
|
74
|
-
/** Normalized point coord */
|
|
75
|
-
vec2 p = vRotationMatrix * (2.0 * gl_PointCoord - 1.0) * vRadiusWithPadding;
|
|
76
|
-
float r = vRadius;
|
|
77
|
-
|
|
78
|
-
// We could also use textures here. Could even be faster, because we have plenty of branching here.
|
|
79
|
-
if (vShape == CIRCLE) {
|
|
80
|
-
d = circle(p, r);
|
|
81
|
-
|
|
82
|
-
} else if (vShape == SQUARE) {
|
|
83
|
-
d = square(p, r);
|
|
84
|
-
|
|
85
|
-
} else if (vShape == TRIANGLE_UP) {
|
|
86
|
-
d = equilateralTriangle(p, r, true, false);
|
|
87
|
-
|
|
88
|
-
} else if (vShape == CROSS) {
|
|
89
|
-
d = crossShape(p, r);
|
|
90
|
-
|
|
91
|
-
} else if (vShape == DIAMOND) {
|
|
92
|
-
d = diamond(p, r);
|
|
93
|
-
|
|
94
|
-
} else if (vShape == TRIANGLE_DOWN) {
|
|
95
|
-
d = equilateralTriangle(p, r, false, false);
|
|
96
|
-
|
|
97
|
-
} else if (vShape == TRIANGLE_RIGHT) {
|
|
98
|
-
d = equilateralTriangle(p, r, false, true);
|
|
99
|
-
|
|
100
|
-
} else if (vShape == TRIANGLE_LEFT) {
|
|
101
|
-
d = equilateralTriangle(p, r, true, true);
|
|
102
|
-
|
|
103
|
-
} else {
|
|
104
|
-
d = 0.0;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (!uPickingEnabled) {
|
|
108
|
-
lowp vec4 fillColor = mix(vFillColor, white, -d * uGradientStrength / vRadius);
|
|
109
|
-
|
|
110
|
-
fragColor = distanceToColor(
|
|
111
|
-
d + (uInwardStroke ? vHalfStrokeWidth : 0.0),
|
|
112
|
-
fillColor,
|
|
113
|
-
vStrokeColor,
|
|
114
|
-
vHalfStrokeWidth);
|
|
115
|
-
|
|
116
|
-
} else if (d - vHalfStrokeWidth <= 0.0) {
|
|
117
|
-
fragColor = vPickingColor;
|
|
118
|
-
|
|
119
|
-
} else {
|
|
120
|
-
discard;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
package/src/gl/point.vertex.glsl
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The stroke should only grow inwards, e.g, the diameter/outline is not affected by the stroke width.
|
|
3
|
-
* Thus, a point that has a zero size has no visible stroke. This allows strokes to be used with
|
|
4
|
-
* geometric zoom, etc.
|
|
5
|
-
*/
|
|
6
|
-
uniform bool uInwardStroke;
|
|
7
|
-
|
|
8
|
-
/** Maximum size of the largest point as the fraction of the height of the (faceted) view */
|
|
9
|
-
uniform lowp float uMaxRelativePointDiameter;
|
|
10
|
-
|
|
11
|
-
/** Scale factor for geometric zoom */
|
|
12
|
-
uniform float uScaleFactor;
|
|
13
|
-
|
|
14
|
-
/** The size of the largest point in the data */
|
|
15
|
-
uniform float uMaxPointSize;
|
|
16
|
-
|
|
17
|
-
uniform float uZoomLevel;
|
|
18
|
-
uniform float uSemanticThreshold;
|
|
19
|
-
|
|
20
|
-
out float vRadius;
|
|
21
|
-
out float vRadiusWithPadding;
|
|
22
|
-
out lowp vec4 vFillColor;
|
|
23
|
-
out lowp vec4 vStrokeColor;
|
|
24
|
-
out lowp float vShape;
|
|
25
|
-
out lowp float vHalfStrokeWidth;
|
|
26
|
-
out mat2 vRotationMatrix;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
float computeSemanticThresholdFactor() {
|
|
30
|
-
// TODO: add smooth transition
|
|
31
|
-
return getScaled_semanticScore() >= uSemanticThreshold ? 1.0 : 0.0;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Computes a scaling factor for the points in a sample-faceted view.
|
|
36
|
-
*/
|
|
37
|
-
float getDownscaleFactor(vec2 pos) {
|
|
38
|
-
if (!isFacetedSamples()) {
|
|
39
|
-
return 1.0;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
float sampleFacetHeight = getSampleFacetHeight(pos);
|
|
43
|
-
float maxPointDiameter = sqrt(uMaxPointSize);
|
|
44
|
-
|
|
45
|
-
float factor = sampleFacetHeight *
|
|
46
|
-
uViewportSize.y *
|
|
47
|
-
uMaxRelativePointDiameter;
|
|
48
|
-
|
|
49
|
-
return clamp(0.0, maxPointDiameter, factor) / maxPointDiameter;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// TODO: Move this into common.glsl or something
|
|
53
|
-
vec2 getDxDy() {
|
|
54
|
-
#if defined(dx_DEFINED) || defined(dy_DEFINED)
|
|
55
|
-
return vec2(getScaled_dx(), getScaled_dy()) / uViewportSize;
|
|
56
|
-
#else
|
|
57
|
-
return vec2(0.0, 0.0);
|
|
58
|
-
#endif
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
void main(void) {
|
|
62
|
-
|
|
63
|
-
float semanticThresholdFactor = computeSemanticThresholdFactor();
|
|
64
|
-
if (semanticThresholdFactor <= 0.0) {
|
|
65
|
-
gl_PointSize = 0.0;
|
|
66
|
-
// Place the vertex outside the viewport. The default (0, 0) makes this super-slow
|
|
67
|
-
// on Apple Silicon. Probably related to the tile-based GPU architecture.
|
|
68
|
-
gl_Position = vec4(100.0, 0.0, 0.0, 0.0);
|
|
69
|
-
// Exit early. MAY prevent some unnecessary calculations.
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
float size = getScaled_size();
|
|
74
|
-
vec2 pos = vec2(getScaled_x(), getScaled_y()) + getDxDy();
|
|
75
|
-
|
|
76
|
-
gl_Position = unitToNdc(applySampleFacet(pos));
|
|
77
|
-
|
|
78
|
-
float strokeWidth = getScaled_strokeWidth();
|
|
79
|
-
|
|
80
|
-
float diameter = sqrt(size) *
|
|
81
|
-
uScaleFactor *
|
|
82
|
-
semanticThresholdFactor *
|
|
83
|
-
getDownscaleFactor(pos);
|
|
84
|
-
|
|
85
|
-
// Clamp minimum size and adjust opacity instead. Yields more pleasing result,
|
|
86
|
-
// no flickering etc.
|
|
87
|
-
float opacity = uViewOpacity;
|
|
88
|
-
if (strokeWidth <= 0.0 || uInwardStroke) {
|
|
89
|
-
float minDiameter = 1.0 / uDevicePixelRatio;
|
|
90
|
-
if (diameter < minDiameter) {
|
|
91
|
-
// We do some "cheap" gamma correction here. It breaks on dark background, though.
|
|
92
|
-
// First we take a square of the size and then apply "gamma" of 1.5.
|
|
93
|
-
opacity *= pow(diameter / minDiameter, 2.5);
|
|
94
|
-
diameter = minDiameter;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
float fillOpa = getScaled_fillOpacity() * opacity;
|
|
99
|
-
float strokeOpa = getScaled_strokeOpacity() * opacity;
|
|
100
|
-
|
|
101
|
-
vShape = getScaled_shape();
|
|
102
|
-
|
|
103
|
-
// Circle doesn't have sharp corners. Do some special optimizations to minimize the point size.
|
|
104
|
-
bool circle = vShape == 0.0;
|
|
105
|
-
|
|
106
|
-
float angleInDegrees = getScaled_angle();
|
|
107
|
-
float angle = -angleInDegrees * PI / 180.0;
|
|
108
|
-
float sinTheta = sin(angle);
|
|
109
|
-
float cosTheta = cos(angle);
|
|
110
|
-
vRotationMatrix = mat2(cosTheta, sinTheta, -sinTheta, cosTheta);
|
|
111
|
-
float roomForRotation = circle ? 1.0 : sin(mod(angle, PI / 2.0) + PI / 4.0) / sin(PI / 4.0);
|
|
112
|
-
|
|
113
|
-
float aaPadding = 1.0 / uDevicePixelRatio;
|
|
114
|
-
float rotationPadding = (diameter * roomForRotation) - diameter;
|
|
115
|
-
// sqrt(3.0) ensures that the angles of equilateral triangles have enough room
|
|
116
|
-
float strokePadding = uInwardStroke ? 0.0 : strokeWidth * (circle ? 1.0 : sqrt(3.0));
|
|
117
|
-
float padding = rotationPadding + strokePadding + aaPadding;
|
|
118
|
-
gl_PointSize = (diameter + padding) * uDevicePixelRatio;
|
|
119
|
-
|
|
120
|
-
vRadius = diameter / 2.0;
|
|
121
|
-
vRadiusWithPadding = vRadius + padding / 2.0;
|
|
122
|
-
|
|
123
|
-
vHalfStrokeWidth = strokeWidth / 2.0;
|
|
124
|
-
|
|
125
|
-
vFillColor = vec4(getScaled_fill() * fillOpa, fillOpa);
|
|
126
|
-
vStrokeColor = vec4(getScaled_stroke() * strokeOpa, strokeOpa);
|
|
127
|
-
|
|
128
|
-
setupPicking();
|
|
129
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
#if defined(ROUNDED_CORNERS) || defined(STROKED)
|
|
2
|
-
in vec2 vPosInPixels;
|
|
3
|
-
#endif
|
|
4
|
-
|
|
5
|
-
in vec2 vHalfSizeInPixels;
|
|
6
|
-
|
|
7
|
-
in lowp vec4 vFillColor;
|
|
8
|
-
in lowp vec4 vStrokeColor;
|
|
9
|
-
in float vHalfStrokeWidth;
|
|
10
|
-
in vec4 vCornerRadii;
|
|
11
|
-
|
|
12
|
-
out lowp vec4 fragColor;
|
|
13
|
-
|
|
14
|
-
// Source: https://www.iquilezles.org/www/articles/distfunctions2d/distfunctions2d.htm
|
|
15
|
-
float sdRoundedBox(vec2 p, vec2 b, vec4 r) {
|
|
16
|
-
r.xy = p.x > 0.0 ? r.xy : r.zw;
|
|
17
|
-
r.x = p.y > 0.0 ? r.x : r.y;
|
|
18
|
-
vec2 q = abs(p) - b + r.x;
|
|
19
|
-
return min(max(q.x, q.y), 0.0) + length(max(q, 0.0)) - r.x;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// Not a true SDF. Makes the corners of strokes sharp and is faster.
|
|
23
|
-
float sdSharpBox(vec2 p, vec2 b) {
|
|
24
|
-
vec2 q = abs(p) - b;
|
|
25
|
-
return max(q.x, q.y);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
void main(void) {
|
|
29
|
-
|
|
30
|
-
#if defined(ROUNDED_CORNERS) || defined(STROKED)
|
|
31
|
-
#ifdef ROUNDED_CORNERS
|
|
32
|
-
// Distance from rectangle's edge in pixels. Negative inside the rectangle.
|
|
33
|
-
float d = sdRoundedBox(vPosInPixels, vHalfSizeInPixels, vCornerRadii);
|
|
34
|
-
#else
|
|
35
|
-
float d = sdSharpBox(vPosInPixels, vHalfSizeInPixels);
|
|
36
|
-
#endif
|
|
37
|
-
|
|
38
|
-
fragColor = distanceToColor(d, vFillColor, vStrokeColor, vHalfStrokeWidth);
|
|
39
|
-
|
|
40
|
-
if (fragColor.a == 0.0) {
|
|
41
|
-
discard;
|
|
42
|
-
}
|
|
43
|
-
#else
|
|
44
|
-
// The trivial, non-decorated case
|
|
45
|
-
fragColor = vFillColor;
|
|
46
|
-
#endif
|
|
47
|
-
|
|
48
|
-
if (uPickingEnabled) {
|
|
49
|
-
fragColor = vPickingColor;
|
|
50
|
-
}
|
|
51
|
-
}
|