ol 10.4.1-dev.1740542736318 → 10.4.1-dev.1740751716860
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/ol.d.ts +47 -33
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/expr/gpu.d.ts +0 -5
- package/expr/gpu.d.ts.map +1 -1
- package/expr/gpu.js +3 -8
- package/layer/BaseVector.d.ts +2 -2
- package/layer/BaseVector.d.ts.map +1 -1
- package/layer/BaseVector.js +1 -1
- package/layer/Flow.d.ts.map +1 -1
- package/layer/Flow.js +2 -3
- package/layer/Heatmap.d.ts +54 -18
- package/layer/Heatmap.d.ts.map +1 -1
- package/layer/Heatmap.js +169 -50
- package/layer/WebGLPoints.d.ts +1 -1
- package/layer/WebGLPoints.d.ts.map +1 -1
- package/layer/WebGLPoints.js +2 -2
- package/layer/WebGLTile.d.ts.map +1 -1
- package/layer/WebGLTile.js +1 -2
- package/package.json +1 -1
- package/render/webgl/MixedGeometryBatch.d.ts.map +1 -1
- package/render/webgl/MixedGeometryBatch.js +4 -0
- package/{webgl → render/webgl}/ShaderBuilder.d.ts +28 -29
- package/render/webgl/ShaderBuilder.d.ts.map +1 -0
- package/{webgl → render/webgl}/ShaderBuilder.js +115 -123
- package/render/webgl/VectorStyleRenderer.d.ts +2 -2
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +3 -3
- package/render/webgl/{utils.d.ts → bufferUtil.d.ts} +1 -37
- package/render/webgl/bufferUtil.d.ts.map +1 -0
- package/render/webgl/{utils.js → bufferUtil.js} +2 -123
- package/render/webgl/compileUtil.d.ts +51 -0
- package/render/webgl/compileUtil.d.ts.map +1 -0
- package/render/webgl/compileUtil.js +203 -0
- package/render/webgl/encodeUtil.d.ts +20 -0
- package/render/webgl/encodeUtil.d.ts.map +1 -0
- package/render/webgl/encodeUtil.js +39 -0
- package/render/webgl/style.d.ts +57 -0
- package/render/webgl/style.d.ts.map +1 -0
- package/{webgl/styleparser.js → render/webgl/style.js} +187 -322
- package/renderer/webgl/PointsLayer.js +1 -1
- package/renderer/webgl/VectorLayer.d.ts +1 -0
- package/renderer/webgl/VectorLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorLayer.js +4 -1
- package/renderer/webgl/VectorTileLayer.d.ts.map +1 -1
- package/renderer/webgl/VectorTileLayer.js +5 -3
- package/util.js +1 -1
- package/worker/webgl.js +1 -1
- package/render/webgl/utils.d.ts.map +0 -1
- package/webgl/ShaderBuilder.d.ts.map +0 -1
- package/webgl/styleparser.d.ts +0 -57
- package/webgl/styleparser.d.ts.map +0 -1
package/layer/WebGLTile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGLTile.d.ts","sourceRoot":"","sources":["WebGLTile.js"],"names":[],"mappings":";yBAmBa,OAAO,uBAAuB,EAAE,OAAO,CAAC,OAAO,gBAAgB,EAAE,OAAO,GAAC,OAAO,iBAAiB,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wIA+C/E,OAAO,cAAc,EAAE,MAAM,QAAE,MAAM,KAAE,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBnF,MAAM;;;;oBACN,MAAM;;;;;;;;;;qBAEN,KAAK,CAAC,OAAO,4BAA4B,EAAE,OAAO,CAAC;;
|
|
1
|
+
{"version":3,"file":"WebGLTile.d.ts","sourceRoot":"","sources":["WebGLTile.js"],"names":[],"mappings":";yBAmBa,OAAO,uBAAuB,EAAE,OAAO,CAAC,OAAO,gBAAgB,EAAE,OAAO,GAAC,OAAO,iBAAiB,EAAE,OAAO,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wIA+C/E,OAAO,cAAc,EAAE,MAAM,QAAE,MAAM,KAAE,KAAK,CAAC,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAiBnF,MAAM;;;;oBACN,MAAM;;;;;;;;;;qBAEN,KAAK,CAAC,OAAO,4BAA4B,EAAE,OAAO,CAAC;;AAwLjE;;;;;;;;;;;;GAYG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EA0CjB;IAhCC;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,wBAA2B;IAE3B;;;OAGG;IACH,4BAA8B;IAE9B;;;OAGG;IACH,eAAmB;IAEnB;;;OAGG;IACH,wBAAkD;IAMpD;;;;;OAKG;IACH,mBAJW,OAAO,cAAc,EAAE,MAAM,cAC7B,MAAM,GACL,KAAK,CAAC,UAAU,CAAC,CAW5B;IAED;;;OAGG;IACH,4BAHY,UAAU,CAKrB;IAWD;;OAEG;IACH,4BAkBC;IAED;;;OAGG;IACH,4BAMC;IAED;;OAEG;IACH,wDAUC;IAED;;;;OAIG;IACH,0BAJW,OAAO,QAAQ,EAAE,UAAU,WAC3B,KAAK,CAAC,UAAU,CAAC,GAChB,WAAW,CAYtB;IAED;;;;;;OAMG;IACH,4BANY,OAAO,WAAW,EAAE,UAAU,OAAA,UAC/B,WAAW,GAEV,WAAW,CAuCtB;IAED;;;;;;;OAOG;IACH,gBAFW,KAAK,QAgBf;IAED;;;;OAIG;IACH;;aAGC;CACF;mCA7eM,gCAAgC;0BACb,eAAe"}
|
package/layer/WebGLTile.js
CHANGED
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
uniformNameForVariable,
|
|
10
10
|
} from '../expr/gpu.js';
|
|
11
11
|
import LayerProperty from '../layer/Property.js';
|
|
12
|
+
import {expressionToGlsl} from '../render/webgl/compileUtil.js';
|
|
12
13
|
import WebGLTileLayerRenderer, {
|
|
13
14
|
Attributes,
|
|
14
15
|
Uniforms,
|
|
15
16
|
} from '../renderer/webgl/TileLayer.js';
|
|
16
|
-
import {expressionToGlsl} from '../webgl/styleparser.js';
|
|
17
17
|
import BaseTileLayer from './BaseTile.js';
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -121,7 +121,6 @@ function parseStyle(style, bandCount) {
|
|
|
121
121
|
*/
|
|
122
122
|
const context = {
|
|
123
123
|
...newCompilationContext(),
|
|
124
|
-
inFragmentShader: true,
|
|
125
124
|
bandCount: bandCount,
|
|
126
125
|
};
|
|
127
126
|
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MixedGeometryBatch.d.ts","sourceRoot":"","sources":["MixedGeometryBatch.js"],"names":[],"mappings":";sBAQa,OAAO,kBAAkB,EAAE,OAAO;2BAGlC,OAAO,wBAAwB,EAAE,IAAI;;;;;;;;aAKpC,OAAO,GAAC,aAAa;;;;iBACrB,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;;;;;;;;;;;;;;;;;;4BAQrB,kBAAkB,GAAC,uBAAuB,GAAC,oBAAoB;;;;;;;;;;;;;;;qBAO9D,MAAM;;;;mBACN,MAAM;;;;gBACN,MAAM;;;;;;;;;;;;;;;;qBAON,MAAM;;;;mBACN,MAAM;;;;;;;;;;;;;;;;qBAON,MAAM;;AA1CpB;;GAEG;AACH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH;IAEI;;OAEG;IACH,uBAAuB;IAEvB;;;;OAIG;IACH,sBAA8B;IAE9B;;;;OAIG;IACH,kBAA0B;IAE1B;;;;;OAKG;IACH,uBAAwB;IAExB;;OAEG;IACH,cAFU,oBAAoB,CAO7B;IAED;;OAEG;IACH,YAFU,kBAAkB,CAK3B;IAED;;OAEG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,YAFU,kBAAkB,CAK3B;IAED;;OAEG;IACH,iBAFU,uBAAuB,CAMhC;IAGH;;;OAGG;IACH,sBAHW,KAAK,CAAC,OAAO,GAAC,aAAa,CAAC,wBAC5B,OAAO,eAAe,EAAE,iBAAiB,QAMnD;IAED;;;OAGG;IACH,oBAHW,OAAO,GAAC,aAAa,wBACrB,OAAO,eAAe,EAAE,iBAAiB,QAYnD;IAED;;;;OAIG;IACH,uCASC;IAED;;;;OAIG;IACH,4CAUC;IAED;;;;OAIG;IACH,yCAWC;IAED;;;;OAIG;IACH,qBA2GC;IAED;;;;;;;;;OASG;IACH,wBAyJC;IAED;;;;;OAKG;IACH,uBAYC;IAED;;;;;OAKG;IACH,mBAOC;IAED;;OAEG;IACH,uBAFW,OAAO,GAAC,aAAa,QAa/B;IAED;;OAEG;IACH,uBAFW,OAAO,GAAC,aAAa,QAS/B;IAED,cAcC;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACL,OAAO,GAAC,aAAa,CAIhC;IAED,mBAEC;IAED;;;;;OAKG;IACH,sBAHW,CAAS,IAAuB,EAAvB,CAAC,OAAO,GAAC,aAAa,CAAC,KAAG,OAAO,GACzC,kBAAkB,CAU7B;CACF;0BA3kByB,yBAAyB"}
|
|
@@ -521,6 +521,10 @@ class MixedGeometryBatch {
|
|
|
521
521
|
* @param {Feature|RenderFeature} feature Feature
|
|
522
522
|
*/
|
|
523
523
|
changeFeature(feature) {
|
|
524
|
+
// the feature is not present in the batch; do not add it to avoid unexpected behaviors
|
|
525
|
+
if (!this.uidToRef_.get(getUid(feature))) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
524
528
|
this.removeFeature(feature);
|
|
525
529
|
const geometry = feature.getGeometry();
|
|
526
530
|
if (!geometry) {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export const COMMON_HEADER: "#ifdef GL_FRAGMENT_PRECISION_HIGH\nprecision highp float;\n#else\nprecision mediump float;\n#endif\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_screenToWorldMatrix;\nuniform vec2 u_viewportSizePx;\nuniform float u_pixelRatio;\nuniform float u_globalAlpha;\nuniform float u_time;\nuniform float u_zoom;\nuniform float u_resolution;\nuniform float u_rotation;\nuniform vec4 u_renderExtent;\nuniform vec2 u_patternOrigin;\nuniform float u_depth;\nuniform mediump int u_hitDetection;\n\nconst float PI = 3.141592653589793238;\nconst float TWO_PI = 2.0 * PI;\nfloat currentLineMetric = 0.; // an actual value will be used in the stroke shaders\n";
|
|
2
2
|
/**
|
|
3
|
-
* @typedef {Object}
|
|
4
|
-
* @property {string} name
|
|
5
|
-
* @property {string} type
|
|
6
|
-
* @property {string}
|
|
7
|
-
*
|
|
3
|
+
* @typedef {Object} AttributeDescription
|
|
4
|
+
* @property {string} name Attribute name, as will be declared in the headers (including a_)
|
|
5
|
+
* @property {string} type Attribute type, either `float`, `vec2`, `vec4`...
|
|
6
|
+
* @property {string} varyingName Varying name, as will be declared in the fragment shader (including v_)
|
|
7
|
+
* @property {string} varyingType Varying type, either `float`, `vec2`, `vec4`...
|
|
8
|
+
* @property {string} varyingExpression GLSL expression to assign to the varying in the vertex shader
|
|
8
9
|
*/
|
|
9
10
|
/**
|
|
10
11
|
* @classdesc
|
|
@@ -33,16 +34,10 @@ export class ShaderBuilder {
|
|
|
33
34
|
private uniforms_;
|
|
34
35
|
/**
|
|
35
36
|
* Attributes; these will be declared in the header (should include the type).
|
|
36
|
-
* @type {Array<
|
|
37
|
+
* @type {Array<AttributeDescription>}
|
|
37
38
|
* @private
|
|
38
39
|
*/
|
|
39
40
|
private attributes_;
|
|
40
|
-
/**
|
|
41
|
-
* Varyings with a name, a type and an expression.
|
|
42
|
-
* @type {Array<VaryingDescription>}
|
|
43
|
-
* @private
|
|
44
|
-
*/
|
|
45
|
-
private varyings_;
|
|
46
41
|
/**
|
|
47
42
|
* @type {boolean}
|
|
48
43
|
* @private
|
|
@@ -148,19 +143,16 @@ export class ShaderBuilder {
|
|
|
148
143
|
/**
|
|
149
144
|
* Adds an attribute accessible in the vertex shader, read from the geometry buffer.
|
|
150
145
|
* The given name should include a type, such as `vec2 a_position`.
|
|
146
|
+
* Attributes will also be made available under the same name in fragment shaders.
|
|
151
147
|
* @param {string} name Attribute name
|
|
152
|
-
* @return {ShaderBuilder} the builder object
|
|
153
|
-
*/
|
|
154
|
-
addAttribute(name: string): ShaderBuilder;
|
|
155
|
-
/**
|
|
156
|
-
* Adds a varying defined in the vertex shader and accessible from the fragment shader.
|
|
157
|
-
* The type and expression of the varying have to be specified separately.
|
|
158
|
-
* @param {string} name Varying name
|
|
159
148
|
* @param {'float'|'vec2'|'vec3'|'vec4'} type Type
|
|
160
|
-
* @param {string}
|
|
149
|
+
* @param {string} [transform] Expression which will be assigned to the varying in the vertex shader, and
|
|
150
|
+
* passed on to the fragment shader.
|
|
151
|
+
* @param {'float'|'vec2'|'vec3'|'vec4'} [transformedType] Type of the attribute after transformation;
|
|
152
|
+
* e.g. `vec4` after unpacking color components
|
|
161
153
|
* @return {ShaderBuilder} the builder object
|
|
162
154
|
*/
|
|
163
|
-
|
|
155
|
+
addAttribute(name: string, type: "float" | "vec2" | "vec3" | "vec4", transform?: string, transformedType?: "float" | "vec2" | "vec3" | "vec4"): ShaderBuilder;
|
|
164
156
|
/**
|
|
165
157
|
* Sets an expression to compute the size of the shape.
|
|
166
158
|
* This expression can use all the uniforms and attributes available
|
|
@@ -283,8 +275,8 @@ export class ShaderBuilder {
|
|
|
283
275
|
* @return {string} The current fill color expression
|
|
284
276
|
*/
|
|
285
277
|
getFillColorExpression(): string;
|
|
286
|
-
addVertexShaderFunction(code: any):
|
|
287
|
-
addFragmentShaderFunction(code: any):
|
|
278
|
+
addVertexShaderFunction(code: any): this;
|
|
279
|
+
addFragmentShaderFunction(code: any): this;
|
|
288
280
|
/**
|
|
289
281
|
* Generates a symbol vertex shader from the builder parameters
|
|
290
282
|
* @return {string|null} The full shader as a string; null if no size or color specified
|
|
@@ -318,19 +310,26 @@ export class ShaderBuilder {
|
|
|
318
310
|
*/
|
|
319
311
|
getFillFragmentShader(): string | null;
|
|
320
312
|
}
|
|
321
|
-
export type
|
|
313
|
+
export type AttributeDescription = {
|
|
322
314
|
/**
|
|
323
|
-
*
|
|
315
|
+
* Attribute name, as will be declared in the headers (including a_)
|
|
324
316
|
*/
|
|
325
317
|
name: string;
|
|
326
318
|
/**
|
|
327
|
-
*
|
|
319
|
+
* Attribute type, either `float`, `vec2`, `vec4`...
|
|
328
320
|
*/
|
|
329
321
|
type: string;
|
|
330
322
|
/**
|
|
331
|
-
*
|
|
332
|
-
|
|
323
|
+
* Varying name, as will be declared in the fragment shader (including v_)
|
|
324
|
+
*/
|
|
325
|
+
varyingName: string;
|
|
326
|
+
/**
|
|
327
|
+
* Varying type, either `float`, `vec2`, `vec4`...
|
|
328
|
+
*/
|
|
329
|
+
varyingType: string;
|
|
330
|
+
/**
|
|
331
|
+
* GLSL expression to assign to the varying in the vertex shader
|
|
333
332
|
*/
|
|
334
|
-
|
|
333
|
+
varyingExpression: string;
|
|
335
334
|
};
|
|
336
335
|
//# sourceMappingURL=ShaderBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ShaderBuilder.d.ts","sourceRoot":"","sources":["ShaderBuilder.js"],"names":[],"mappings":"AAQA,oqBAsBE;AAIF;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AACH;IAEI;;;;OAIG;IACH,kBAAmB;IAEnB;;;;OAIG;IACH,oBAAqB;IAErB;;;OAGG;IACH,mBAAuB;IAEvB;;;OAGG;IACH,8BAEkE;IAElE;;;OAGG;IACH,kCAAsC;IAEtC;;;OAGG;IACH,gCAA0C;IAE1C;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,4BAAqD;IAErD;;;OAGG;IACH,2BAAiC;IAEjC;;;OAGG;IACH,8BAAkC;IAElC;;;OAGG;IACH,mBAAuB;IAEvB;;;OAGG;IACH,+BAAyE;IAEzE;;;OAGG;IACH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IAED;;;OAGG;IACH,oCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;OAGG;IACH,0CAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;;OAIG;IACH,6CAJW,MAAM,GAEL,aAAa,CAKxB;IAED;;;OAGG;IACH,mCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;OAEG;IACH,0BAFY,MAAM,CAIjB;IAED,yCAMC;IACD,2CAMC;IAED;;;OAGG;IACH,yBAFY,MAAM,GAAC,IAAI,CA0EtB;IAED;;;OAGG;IACH,2BAFY,MAAM,GAAC,IAAI,CAwCtB;IAED;;;OAGG;IACH,yBAFY,MAAM,GAAC,IAAI,CAmHtB;IAED;;;;OAIG;IACH,2BAFY,MAAM,GAAC,IAAI,CA2KtB;IAED;;;;OAIG;IACH,uBAFY,MAAM,GAAC,IAAI,CA+BtB;IAED;;;OAGG;IACH,yBAFY,MAAM,GAAC,IAAI,CAyDtB;CACF;;;;;UAp6Ba,MAAM;;;;UACN,MAAM;;;;iBACN,MAAM;;;;iBACN,MAAM;;;;uBACN,MAAM"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Class for generating shaders from literal style objects
|
|
3
|
-
* @module ol/webgl/ShaderBuilder
|
|
3
|
+
* @module ol/render/webgl/ShaderBuilder
|
|
4
4
|
*/
|
|
5
|
-
import {colorToGlsl, numberToGlsl, stringToGlsl} from '
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import {colorToGlsl, numberToGlsl, stringToGlsl} from '../../expr/gpu.js';
|
|
6
|
+
import {createDefaultStyle} from '../../style/flat.js';
|
|
7
|
+
import {LINESTRING_ANGLE_COSINE_CUTOFF} from './bufferUtil.js';
|
|
8
8
|
|
|
9
9
|
export const COMMON_HEADER = `#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
10
10
|
precision highp float;
|
|
@@ -33,11 +33,12 @@ float currentLineMetric = 0.; // an actual value will be used in the stroke shad
|
|
|
33
33
|
const DEFAULT_STYLE = createDefaultStyle();
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* @typedef {Object}
|
|
37
|
-
* @property {string} name
|
|
38
|
-
* @property {string} type
|
|
39
|
-
* @property {string}
|
|
40
|
-
*
|
|
36
|
+
* @typedef {Object} AttributeDescription
|
|
37
|
+
* @property {string} name Attribute name, as will be declared in the headers (including a_)
|
|
38
|
+
* @property {string} type Attribute type, either `float`, `vec2`, `vec4`...
|
|
39
|
+
* @property {string} varyingName Varying name, as will be declared in the fragment shader (including v_)
|
|
40
|
+
* @property {string} varyingType Varying type, either `float`, `vec2`, `vec4`...
|
|
41
|
+
* @property {string} varyingExpression GLSL expression to assign to the varying in the vertex shader
|
|
41
42
|
*/
|
|
42
43
|
|
|
43
44
|
/**
|
|
@@ -69,18 +70,11 @@ export class ShaderBuilder {
|
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* Attributes; these will be declared in the header (should include the type).
|
|
72
|
-
* @type {Array<
|
|
73
|
+
* @type {Array<AttributeDescription>}
|
|
73
74
|
* @private
|
|
74
75
|
*/
|
|
75
76
|
this.attributes_ = [];
|
|
76
77
|
|
|
77
|
-
/**
|
|
78
|
-
* Varyings with a name, a type and an expression.
|
|
79
|
-
* @type {Array<VaryingDescription>}
|
|
80
|
-
* @private
|
|
81
|
-
*/
|
|
82
|
-
this.varyings_ = [];
|
|
83
|
-
|
|
84
78
|
/**
|
|
85
79
|
* @type {boolean}
|
|
86
80
|
* @private
|
|
@@ -219,27 +213,22 @@ export class ShaderBuilder {
|
|
|
219
213
|
/**
|
|
220
214
|
* Adds an attribute accessible in the vertex shader, read from the geometry buffer.
|
|
221
215
|
* The given name should include a type, such as `vec2 a_position`.
|
|
216
|
+
* Attributes will also be made available under the same name in fragment shaders.
|
|
222
217
|
* @param {string} name Attribute name
|
|
223
|
-
* @return {ShaderBuilder} the builder object
|
|
224
|
-
*/
|
|
225
|
-
addAttribute(name) {
|
|
226
|
-
this.attributes_.push(name);
|
|
227
|
-
return this;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* Adds a varying defined in the vertex shader and accessible from the fragment shader.
|
|
232
|
-
* The type and expression of the varying have to be specified separately.
|
|
233
|
-
* @param {string} name Varying name
|
|
234
218
|
* @param {'float'|'vec2'|'vec3'|'vec4'} type Type
|
|
235
|
-
* @param {string}
|
|
219
|
+
* @param {string} [transform] Expression which will be assigned to the varying in the vertex shader, and
|
|
220
|
+
* passed on to the fragment shader.
|
|
221
|
+
* @param {'float'|'vec2'|'vec3'|'vec4'} [transformedType] Type of the attribute after transformation;
|
|
222
|
+
* e.g. `vec4` after unpacking color components
|
|
236
223
|
* @return {ShaderBuilder} the builder object
|
|
237
224
|
*/
|
|
238
|
-
|
|
239
|
-
this.
|
|
240
|
-
name
|
|
241
|
-
type
|
|
242
|
-
|
|
225
|
+
addAttribute(name, type, transform, transformedType) {
|
|
226
|
+
this.attributes_.push({
|
|
227
|
+
name,
|
|
228
|
+
type,
|
|
229
|
+
varyingName: name.replace(/^a_/, 'v_'),
|
|
230
|
+
varyingType: transformedType ?? type,
|
|
231
|
+
varyingExpression: transform ?? name,
|
|
243
232
|
});
|
|
244
233
|
return this;
|
|
245
234
|
}
|
|
@@ -451,15 +440,17 @@ export class ShaderBuilder {
|
|
|
451
440
|
|
|
452
441
|
addVertexShaderFunction(code) {
|
|
453
442
|
if (this.vertexShaderFunctions_.includes(code)) {
|
|
454
|
-
return;
|
|
443
|
+
return this;
|
|
455
444
|
}
|
|
456
445
|
this.vertexShaderFunctions_.push(code);
|
|
446
|
+
return this;
|
|
457
447
|
}
|
|
458
448
|
addFragmentShaderFunction(code) {
|
|
459
449
|
if (this.fragmentShaderFunctions_.includes(code)) {
|
|
460
|
-
return;
|
|
450
|
+
return this;
|
|
461
451
|
}
|
|
462
452
|
this.fragmentShaderFunctions_.push(code);
|
|
453
|
+
return this;
|
|
463
454
|
}
|
|
464
455
|
|
|
465
456
|
/**
|
|
@@ -472,29 +463,23 @@ export class ShaderBuilder {
|
|
|
472
463
|
}
|
|
473
464
|
|
|
474
465
|
return `${COMMON_HEADER}
|
|
475
|
-
${this.uniforms_
|
|
476
|
-
.map(function (uniform) {
|
|
477
|
-
return 'uniform ' + uniform + ';';
|
|
478
|
-
})
|
|
479
|
-
.join('\n')}
|
|
466
|
+
${this.uniforms_.map((uniform) => `uniform ${uniform};`).join('\n')}
|
|
480
467
|
attribute vec2 a_position;
|
|
481
468
|
attribute float a_index;
|
|
482
469
|
attribute vec4 a_hitColor;
|
|
483
|
-
|
|
484
|
-
.map(function (attribute) {
|
|
485
|
-
return 'attribute ' + attribute + ';';
|
|
486
|
-
})
|
|
487
|
-
.join('\n')}
|
|
470
|
+
|
|
488
471
|
varying vec2 v_texCoord;
|
|
489
472
|
varying vec2 v_quadCoord;
|
|
490
473
|
varying vec4 v_hitColor;
|
|
491
474
|
varying vec2 v_centerPx;
|
|
492
475
|
varying float v_angle;
|
|
493
476
|
varying vec2 v_quadSizePx;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
477
|
+
|
|
478
|
+
${this.attributes_
|
|
479
|
+
.map(
|
|
480
|
+
(attribute) => `attribute ${attribute.type} ${attribute.name};
|
|
481
|
+
varying ${attribute.varyingType} ${attribute.varyingName};`,
|
|
482
|
+
)
|
|
498
483
|
.join('\n')}
|
|
499
484
|
${this.vertexShaderFunctions_.join('\n')}
|
|
500
485
|
vec2 pxToScreen(vec2 coordPx) {
|
|
@@ -537,10 +522,11 @@ void main(void) {
|
|
|
537
522
|
s = sin(-v_angle);
|
|
538
523
|
centerOffsetPx = vec2(c * centerOffsetPx.x - s * centerOffsetPx.y, s * centerOffsetPx.x + c * centerOffsetPx.y);
|
|
539
524
|
v_centerPx = screenToPx(center.xy) + centerOffsetPx;
|
|
540
|
-
${this.
|
|
541
|
-
.map(
|
|
542
|
-
|
|
543
|
-
}
|
|
525
|
+
${this.attributes_
|
|
526
|
+
.map(
|
|
527
|
+
(attribute) =>
|
|
528
|
+
` ${attribute.varyingName} = ${attribute.varyingExpression};`,
|
|
529
|
+
)
|
|
544
530
|
.join('\n')}
|
|
545
531
|
}`;
|
|
546
532
|
}
|
|
@@ -555,24 +541,26 @@ ${this.varyings_
|
|
|
555
541
|
}
|
|
556
542
|
|
|
557
543
|
return `${COMMON_HEADER}
|
|
558
|
-
${this.uniforms_
|
|
559
|
-
.map(function (uniform) {
|
|
560
|
-
return 'uniform ' + uniform + ';';
|
|
561
|
-
})
|
|
562
|
-
.join('\n')}
|
|
544
|
+
${this.uniforms_.map((uniform) => `uniform ${uniform};`).join('\n')}
|
|
563
545
|
varying vec2 v_texCoord;
|
|
564
546
|
varying vec4 v_hitColor;
|
|
565
547
|
varying vec2 v_centerPx;
|
|
566
548
|
varying float v_angle;
|
|
567
549
|
varying vec2 v_quadSizePx;
|
|
568
|
-
${this.
|
|
569
|
-
.map(
|
|
570
|
-
|
|
571
|
-
|
|
550
|
+
${this.attributes_
|
|
551
|
+
.map(
|
|
552
|
+
(attribute) => `varying ${attribute.varyingType} ${attribute.varyingName};`,
|
|
553
|
+
)
|
|
572
554
|
.join('\n')}
|
|
573
555
|
${this.fragmentShaderFunctions_.join('\n')}
|
|
574
556
|
|
|
575
557
|
void main(void) {
|
|
558
|
+
${this.attributes_
|
|
559
|
+
.map(
|
|
560
|
+
(attribute) =>
|
|
561
|
+
` ${attribute.varyingType} ${attribute.name} = ${attribute.varyingName}; // assign to original attribute name`,
|
|
562
|
+
)
|
|
563
|
+
.join('\n')}
|
|
576
564
|
if (${this.discardExpression_}) { discard; }
|
|
577
565
|
vec2 coordsPx = gl_FragCoord.xy / u_pixelRatio - v_centerPx; // relative to center
|
|
578
566
|
float c = cos(v_angle);
|
|
@@ -597,11 +585,7 @@ void main(void) {
|
|
|
597
585
|
}
|
|
598
586
|
|
|
599
587
|
return `${COMMON_HEADER}
|
|
600
|
-
${this.uniforms_
|
|
601
|
-
.map(function (uniform) {
|
|
602
|
-
return 'uniform ' + uniform + ';';
|
|
603
|
-
})
|
|
604
|
-
.join('\n')}
|
|
588
|
+
${this.uniforms_.map((uniform) => `uniform ${uniform};`).join('\n')}
|
|
605
589
|
attribute vec2 a_segmentStart;
|
|
606
590
|
attribute vec2 a_segmentEnd;
|
|
607
591
|
attribute float a_measureStart;
|
|
@@ -610,11 +594,7 @@ attribute float a_parameters;
|
|
|
610
594
|
attribute float a_distance;
|
|
611
595
|
attribute vec2 a_joinAngles;
|
|
612
596
|
attribute vec4 a_hitColor;
|
|
613
|
-
|
|
614
|
-
.map(function (attribute) {
|
|
615
|
-
return 'attribute ' + attribute + ';';
|
|
616
|
-
})
|
|
617
|
-
.join('\n')}
|
|
597
|
+
|
|
618
598
|
varying vec2 v_segmentStart;
|
|
619
599
|
varying vec2 v_segmentEnd;
|
|
620
600
|
varying float v_angleStart;
|
|
@@ -624,10 +604,12 @@ varying vec4 v_hitColor;
|
|
|
624
604
|
varying float v_distanceOffsetPx;
|
|
625
605
|
varying float v_measureStart;
|
|
626
606
|
varying float v_measureEnd;
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
607
|
+
|
|
608
|
+
${this.attributes_
|
|
609
|
+
.map(
|
|
610
|
+
(attribute) => `attribute ${attribute.type} ${attribute.name};
|
|
611
|
+
varying ${attribute.varyingType} ${attribute.varyingName};`,
|
|
612
|
+
)
|
|
631
613
|
.join('\n')}
|
|
632
614
|
${this.vertexShaderFunctions_.join('\n')}
|
|
633
615
|
vec2 worldToPx(vec2 worldPos) {
|
|
@@ -703,10 +685,11 @@ void main(void) {
|
|
|
703
685
|
v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * angleTangentSum);
|
|
704
686
|
v_measureStart = a_measureStart;
|
|
705
687
|
v_measureEnd = a_measureEnd;
|
|
706
|
-
${this.
|
|
707
|
-
.map(
|
|
708
|
-
|
|
709
|
-
}
|
|
688
|
+
${this.attributes_
|
|
689
|
+
.map(
|
|
690
|
+
(attribute) =>
|
|
691
|
+
` ${attribute.varyingName} = ${attribute.varyingExpression};`,
|
|
692
|
+
)
|
|
710
693
|
.join('\n')}
|
|
711
694
|
}`;
|
|
712
695
|
}
|
|
@@ -722,11 +705,7 @@ ${this.varyings_
|
|
|
722
705
|
}
|
|
723
706
|
|
|
724
707
|
return `${COMMON_HEADER}
|
|
725
|
-
${this.uniforms_
|
|
726
|
-
.map(function (uniform) {
|
|
727
|
-
return 'uniform ' + uniform + ';';
|
|
728
|
-
})
|
|
729
|
-
.join('\n')}
|
|
708
|
+
${this.uniforms_.map((uniform) => `uniform ${uniform};`).join('\n')}
|
|
730
709
|
varying vec2 v_segmentStart;
|
|
731
710
|
varying vec2 v_segmentEnd;
|
|
732
711
|
varying float v_angleStart;
|
|
@@ -736,10 +715,10 @@ varying vec4 v_hitColor;
|
|
|
736
715
|
varying float v_distanceOffsetPx;
|
|
737
716
|
varying float v_measureStart;
|
|
738
717
|
varying float v_measureEnd;
|
|
739
|
-
${this.
|
|
740
|
-
.map(
|
|
741
|
-
|
|
742
|
-
|
|
718
|
+
${this.attributes_
|
|
719
|
+
.map(
|
|
720
|
+
(attribute) => `varying ${attribute.varyingType} ${attribute.varyingName};`,
|
|
721
|
+
)
|
|
743
722
|
.join('\n')}
|
|
744
723
|
${this.fragmentShaderFunctions_.join('\n')}
|
|
745
724
|
|
|
@@ -826,7 +805,22 @@ float computeSegmentPointDistance(vec2 point, vec2 start, vec2 end, float width,
|
|
|
826
805
|
return joinDistanceField(point, start, end, width, joinAngle, joinType);
|
|
827
806
|
}
|
|
828
807
|
|
|
808
|
+
float distanceFromSegment(vec2 point, vec2 start, vec2 end) {
|
|
809
|
+
vec2 tangent = end - start;
|
|
810
|
+
vec2 startToPoint = point - start;
|
|
811
|
+
// inspire by capsule fn in https://iquilezles.org/articles/distfunctions/
|
|
812
|
+
float h = clamp(dot(startToPoint, tangent) / dot(tangent, tangent), 0.0, 1.0);
|
|
813
|
+
return length(startToPoint - tangent * h);
|
|
814
|
+
}
|
|
815
|
+
|
|
829
816
|
void main(void) {
|
|
817
|
+
${this.attributes_
|
|
818
|
+
.map(
|
|
819
|
+
(attribute) =>
|
|
820
|
+
` ${attribute.varyingType} ${attribute.name} = ${attribute.varyingName}; // assign to original attribute name`,
|
|
821
|
+
)
|
|
822
|
+
.join('\n')}
|
|
823
|
+
|
|
830
824
|
vec2 currentPoint = gl_FragCoord.xy / u_pixelRatio;
|
|
831
825
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
832
826
|
vec2 worldPos = pxToWorld(currentPoint);
|
|
@@ -847,24 +841,25 @@ void main(void) {
|
|
|
847
841
|
vec2 segmentNormal = vec2(-segmentTangent.y, segmentTangent.x);
|
|
848
842
|
vec2 startToPoint = currentPoint - v_segmentStart;
|
|
849
843
|
float lengthToPoint = max(0., min(dot(segmentTangent, startToPoint), segmentLength));
|
|
850
|
-
float currentLengthPx = lengthToPoint + v_distanceOffsetPx;
|
|
851
|
-
float currentRadiusPx =
|
|
844
|
+
float currentLengthPx = lengthToPoint + v_distanceOffsetPx;
|
|
845
|
+
float currentRadiusPx = distanceFromSegment(currentPoint, v_segmentStart, v_segmentEnd);
|
|
852
846
|
float currentRadiusRatio = dot(segmentNormal, startToPoint) * 2. / v_width;
|
|
853
847
|
currentLineMetric = mix(v_measureStart, v_measureEnd, lengthToPoint / segmentLength);
|
|
854
848
|
|
|
855
849
|
if (${this.discardExpression_}) { discard; }
|
|
856
850
|
|
|
857
|
-
vec4 color = ${this.strokeColorExpression_};
|
|
858
851
|
float capType = ${this.strokeCapExpression_};
|
|
859
852
|
float joinType = ${this.strokeJoinExpression_};
|
|
860
853
|
float segmentStartDistance = computeSegmentPointDistance(currentPoint, v_segmentStart, v_segmentEnd, v_width, v_angleStart, capType, joinType);
|
|
861
854
|
float segmentEndDistance = computeSegmentPointDistance(currentPoint, v_segmentEnd, v_segmentStart, v_width, v_angleEnd, capType, joinType);
|
|
862
|
-
float
|
|
855
|
+
float distanceField = max(
|
|
863
856
|
segmentDistanceField(currentPoint, v_segmentStart, v_segmentEnd, v_width),
|
|
864
857
|
max(segmentStartDistance, segmentEndDistance)
|
|
865
858
|
);
|
|
866
|
-
|
|
867
|
-
|
|
859
|
+
distanceField = max(distanceField, ${this.strokeDistanceFieldExpression_});
|
|
860
|
+
|
|
861
|
+
vec4 color = ${this.strokeColorExpression_};
|
|
862
|
+
color.a *= smoothstep(0.5, -0.5, distanceField);
|
|
868
863
|
gl_FragColor = color;
|
|
869
864
|
gl_FragColor.a *= u_globalAlpha;
|
|
870
865
|
gl_FragColor.rgb *= gl_FragColor.a;
|
|
@@ -886,32 +881,27 @@ void main(void) {
|
|
|
886
881
|
}
|
|
887
882
|
|
|
888
883
|
return `${COMMON_HEADER}
|
|
889
|
-
${this.uniforms_
|
|
890
|
-
.map(function (uniform) {
|
|
891
|
-
return 'uniform ' + uniform + ';';
|
|
892
|
-
})
|
|
893
|
-
.join('\n')}
|
|
884
|
+
${this.uniforms_.map((uniform) => `uniform ${uniform};`).join('\n')}
|
|
894
885
|
attribute vec2 a_position;
|
|
895
886
|
attribute vec4 a_hitColor;
|
|
896
|
-
|
|
897
|
-
.map(function (attribute) {
|
|
898
|
-
return 'attribute ' + attribute + ';';
|
|
899
|
-
})
|
|
900
|
-
.join('\n')}
|
|
887
|
+
|
|
901
888
|
varying vec4 v_hitColor;
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
889
|
+
|
|
890
|
+
${this.attributes_
|
|
891
|
+
.map(
|
|
892
|
+
(attribute) => `attribute ${attribute.type} ${attribute.name};
|
|
893
|
+
varying ${attribute.varyingType} ${attribute.varyingName};`,
|
|
894
|
+
)
|
|
906
895
|
.join('\n')}
|
|
907
896
|
${this.vertexShaderFunctions_.join('\n')}
|
|
908
897
|
void main(void) {
|
|
909
898
|
gl_Position = u_projectionMatrix * vec4(a_position, u_depth, 1.0);
|
|
910
899
|
v_hitColor = a_hitColor;
|
|
911
|
-
${this.
|
|
912
|
-
.map(
|
|
913
|
-
|
|
914
|
-
}
|
|
900
|
+
${this.attributes_
|
|
901
|
+
.map(
|
|
902
|
+
(attribute) =>
|
|
903
|
+
` ${attribute.varyingName} = ${attribute.varyingExpression};`,
|
|
904
|
+
)
|
|
915
905
|
.join('\n')}
|
|
916
906
|
}`;
|
|
917
907
|
}
|
|
@@ -926,16 +916,12 @@ ${this.varyings_
|
|
|
926
916
|
}
|
|
927
917
|
|
|
928
918
|
return `${COMMON_HEADER}
|
|
929
|
-
${this.uniforms_
|
|
930
|
-
.map(function (uniform) {
|
|
931
|
-
return 'uniform ' + uniform + ';';
|
|
932
|
-
})
|
|
933
|
-
.join('\n')}
|
|
919
|
+
${this.uniforms_.map((uniform) => `uniform ${uniform};`).join('\n')}
|
|
934
920
|
varying vec4 v_hitColor;
|
|
935
|
-
${this.
|
|
936
|
-
.map(
|
|
937
|
-
|
|
938
|
-
|
|
921
|
+
${this.attributes_
|
|
922
|
+
.map(
|
|
923
|
+
(attribute) => `varying ${attribute.varyingType} ${attribute.varyingName};`,
|
|
924
|
+
)
|
|
939
925
|
.join('\n')}
|
|
940
926
|
${this.fragmentShaderFunctions_.join('\n')}
|
|
941
927
|
vec2 pxToWorld(vec2 pxPos) {
|
|
@@ -949,6 +935,12 @@ vec2 worldToPx(vec2 worldPos) {
|
|
|
949
935
|
}
|
|
950
936
|
|
|
951
937
|
void main(void) {
|
|
938
|
+
${this.attributes_
|
|
939
|
+
.map(
|
|
940
|
+
(attribute) =>
|
|
941
|
+
` ${attribute.varyingType} ${attribute.name} = ${attribute.varyingName}; // assign to original attribute name`,
|
|
942
|
+
)
|
|
943
|
+
.join('\n')}
|
|
952
944
|
vec2 pxPos = gl_FragCoord.xy / u_pixelRatio;
|
|
953
945
|
vec2 pxOrigin = worldToPx(u_patternOrigin);
|
|
954
946
|
#ifdef GL_FRAGMENT_PRECISION_HIGH
|
|
@@ -86,7 +86,7 @@ export type AsShaders = {
|
|
|
86
86
|
/**
|
|
87
87
|
* Shader builder with the appropriate presets.
|
|
88
88
|
*/
|
|
89
|
-
builder: import("
|
|
89
|
+
builder: import("./ShaderBuilder.js").ShaderBuilder;
|
|
90
90
|
/**
|
|
91
91
|
* Custom attributes made available in the vertex shaders.
|
|
92
92
|
* Default shaders rely on the attributes in {@link Attributes}.
|
|
@@ -144,7 +144,7 @@ export type VectorStyle = AsRule | AsShaders;
|
|
|
144
144
|
*/
|
|
145
145
|
/**
|
|
146
146
|
* @typedef {Object} AsShaders
|
|
147
|
-
* @property {import("
|
|
147
|
+
* @property {import("./ShaderBuilder.js").ShaderBuilder} builder Shader builder with the appropriate presets.
|
|
148
148
|
* @property {AttributeDefinitions} [attributes] Custom attributes made available in the vertex shaders.
|
|
149
149
|
* Default shaders rely on the attributes in {@link Attributes}.
|
|
150
150
|
* @property {UniformDefinitions} [uniforms] Additional uniforms usable in shaders.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorStyleRenderer.d.ts","sourceRoot":"","sources":["VectorStyleRenderer.js"],"names":[],"mappings":";;;;yBAyCU,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmBF,CAAS,IAAwD,EAAnD,OAAO,yBAAyB,EAAE,iBAAiB,EAAE,IAAmC,EAAnC,OAAO,eAAe,EAAE,WAAW,KAAE,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;;;;;;;;;;;;oBAW5H,KAAK,CAAC,gBAAgB,CAAC;;;;uBACvB,KAAK,CAAC,gBAAgB,CAAC;;;;kBACvB,KAAK,CAAC,gBAAgB,CAAC;;;;6BACvB,OAAO,oBAAoB,EAAE,SAAS;;;;;;yBAKtC,YAAY,GAAC,IAAI;;;;4BACjB,YAAY,GAAC,IAAI;;;;uBACjB,YAAY,GAAC,IAAI;;;;;;;;;YAKjB,MAAM;;;;cACN,MAAM;;;;;;aAKN,OAAO,
|
|
1
|
+
{"version":3,"file":"VectorStyleRenderer.d.ts","sourceRoot":"","sources":["VectorStyleRenderer.js"],"names":[],"mappings":";;;;yBAy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;;OAGG;IACH,mBAA6D;IAE3D;;OAEG;IACH,4BAAoE;IACpE;;OAEG;IACH,8BAAwE;IAG1E;;;OAGG;IACH,uBAA0B;IAgB1B;;OAEG;IACH,0BAIC;IACD;;OAEG;IACH,kBAAmC;IASnC;;;OAGG;IACH,+BAOC;IACD;;;OAGG;IACH,kCAqCC;IACD;;;OAGG;IACH,6BAYC;IAKH;;;;;OAKG;IACH,6BAgCC;IAED;;;;OAIG;IACH,+BAJW,OAAO,yBAAyB,EAAE,OAAO,aACzC,OAAO,oBAAoB,EAAE,SAAS,GACrC,OAAO,CAAC,YAAY,GAAC,IAAI,CAAC,CA4CrC;IAED;;;;;OAKG;IACH,oCA+BC;IAED;;;;;;OAMG;IACH,gCAwEC;IAED;;;;;OAKG;IACH,gBAJW,YAAY,cACZ,OAAO,cAAc,EAAE,UAAU,qBACjC,MAAY,IAAI,QA8B1B;IAED;;;;;;;;OAQG;IACH,wBAkBC;IAED;;;OAGG;IACH,kBAHW,OAAO,uBAAuB,EAAE,OAAO,YACvC,YAAY,QAuCtB;CACF;6BAloB4B,uBAAuB"}
|
|
@@ -13,17 +13,17 @@ import {
|
|
|
13
13
|
} from '../../transform.js';
|
|
14
14
|
import WebGLArrayBuffer from '../../webgl/Buffer.js';
|
|
15
15
|
import {AttributeType} from '../../webgl/Helper.js';
|
|
16
|
-
import {parseLiteralStyle} from '../../webgl/styleparser.js';
|
|
17
16
|
import {ARRAY_BUFFER, DYNAMIC_DRAW, ELEMENT_ARRAY_BUFFER} from '../../webgl.js';
|
|
18
17
|
import {create as createWebGLWorker} from '../../worker/webgl.js';
|
|
19
18
|
import {WebGLWorkerMessageType} from './constants.js';
|
|
19
|
+
import {colorEncodeId} from './encodeUtil.js';
|
|
20
20
|
import {
|
|
21
21
|
generateLineStringRenderInstructions,
|
|
22
22
|
generatePointRenderInstructions,
|
|
23
23
|
generatePolygonRenderInstructions,
|
|
24
24
|
getCustomAttributesSize,
|
|
25
25
|
} from './renderinstructions.js';
|
|
26
|
-
import {
|
|
26
|
+
import {parseLiteralStyle} from './style.js';
|
|
27
27
|
|
|
28
28
|
const tmpColor = [];
|
|
29
29
|
/** @type {Worker|undefined} */
|
|
@@ -90,7 +90,7 @@ export const Attributes = {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* @typedef {Object} AsShaders
|
|
93
|
-
* @property {import("
|
|
93
|
+
* @property {import("./ShaderBuilder.js").ShaderBuilder} builder Shader builder with the appropriate presets.
|
|
94
94
|
* @property {AttributeDefinitions} [attributes] Custom attributes made available in the vertex shaders.
|
|
95
95
|
* Default shaders rely on the attributes in {@link Attributes}.
|
|
96
96
|
* @property {UniformDefinitions} [uniforms] Additional uniforms usable in shaders.
|