ol 10.6.2-dev.1751730309835 → 10.6.2-dev.1751978433539
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.js +1 -1
- package/dist/ol.js.map +1 -1
- package/format/Polyline.d.ts +2 -0
- package/format/Polyline.d.ts.map +1 -1
- package/format/Polyline.js +2 -0
- package/package.json +1 -1
- package/render/webgl/ShaderBuilder.d.ts.map +1 -1
- package/render/webgl/ShaderBuilder.js +13 -22
- package/render/webgl/VectorStyleRenderer.d.ts +31 -14
- package/render/webgl/VectorStyleRenderer.d.ts.map +1 -1
- package/render/webgl/VectorStyleRenderer.js +88 -36
- package/render/webgl/bufferUtil.d.ts +12 -10
- package/render/webgl/bufferUtil.d.ts.map +1 -1
- package/render/webgl/bufferUtil.js +30 -139
- package/render/webgl/constants.d.ts +8 -4
- package/render/webgl/constants.js +3 -2
- package/renderer/webgl/PointsLayer.d.ts +9 -2
- package/renderer/webgl/PointsLayer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.js +39 -19
- package/util.js +1 -1
- package/webgl/Helper.d.ts +26 -0
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +77 -5
- package/worker/webgl.js +1 -1
package/format/Polyline.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* Default is `1e5`.
|
|
11
11
|
* @return {string} The encoded string.
|
|
12
12
|
* @api
|
|
13
|
+
* @deprecated
|
|
13
14
|
*/
|
|
14
15
|
export function encodeDeltas(numbers: Array<number>, stride: number, factor?: number): string;
|
|
15
16
|
/**
|
|
@@ -22,6 +23,7 @@ export function encodeDeltas(numbers: Array<number>, stride: number, factor?: nu
|
|
|
22
23
|
* be divided. Default is `1e5`.
|
|
23
24
|
* @return {Array<number>} A list of n-dimensional points.
|
|
24
25
|
* @api
|
|
26
|
+
* @deprecated
|
|
25
27
|
*/
|
|
26
28
|
export function decodeDeltas(encoded: string, stride: number, factor?: number): Array<number>;
|
|
27
29
|
/**
|
package/format/Polyline.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["Polyline.js"],"names":[],"mappings":"AAqJA
|
|
1
|
+
{"version":3,"file":"Polyline.d.ts","sourceRoot":"","sources":["Polyline.js"],"names":[],"mappings":"AAqJA;;;;;;;;;;;;;GAaG;AACH,sCATW,KAAK,CAAC,MAAM,CAAC,UACb,MAAM,WACN,MAAM,GAGL,MAAM,CAqBjB;AAED;;;;;;;;;;;GAWG;AACH,sCATW,MAAM,UACN,MAAM,WAEN,MAAM,GAEL,KAAK,CAAC,MAAM,CAAC,CAmBxB;AAED;;;;;;;;;;;;GAYG;AACH,sCARW,KAAK,CAAC,MAAM,CAAC,WACb,MAAM,GAGL,MAAM,CAWjB;AAED;;;;;;;;;GASG;AACH,sCAPW,MAAM,WACN,MAAM,GAEL,KAAK,CAAC,MAAM,CAAC,CAWxB;AAED;;;;;;;GAOG;AACH,8CAHW,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CAQjB;AAED;;;;;GAKG;AACH,8CAHW,MAAM,GACL,KAAK,CAAC,MAAM,CAAC,CASxB;AAED;;;;;GAKG;AACH,gDAHW,KAAK,CAAC,MAAM,CAAC,GACZ,MAAM,CAQjB;AAED;;;;;GAKG;AACH,gDAHW,MAAM,GACL,KAAK,CAAC,MAAM,CAAC,CAkBxB;AAED;;;;;GAKG;AACH,2CAHW,MAAM,GACL,MAAM,CAajB;;;;;;;;;;;;;AAvUD;;;;;GAKG;AAEH;;;;;;;;;;;;;GAaG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EAyBjB;IAbC;;;OAGG;IACH,gBAAoD;IAEpD;;;OAGG;IACH,wBAEQ;IA+CV;;;;;;OAMG;IACH,6CANW,OAAO,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,YAC3C,OAAO,cAAc,EAAE,YAAY,GAElC,MAAM,CASjB;IAED;;;;;;OAMG;IACH,+CANW,KAAK,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,YAClD,OAAO,cAAc,EAAE,YAAY,GAElC,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,+CANW,UAAU,YACV,OAAO,cAAc,EAAE,YAAY,GAElC,MAAM,CAWjB;CACF;wBA1IuB,kBAAkB;uBALnB,uBAAuB"}
|
package/format/Polyline.js
CHANGED
|
@@ -159,6 +159,7 @@ class Polyline extends TextFeature {
|
|
|
159
159
|
* Default is `1e5`.
|
|
160
160
|
* @return {string} The encoded string.
|
|
161
161
|
* @api
|
|
162
|
+
* @deprecated
|
|
162
163
|
*/
|
|
163
164
|
export function encodeDeltas(numbers, stride, factor) {
|
|
164
165
|
factor = factor ? factor : 1e5;
|
|
@@ -189,6 +190,7 @@ export function encodeDeltas(numbers, stride, factor) {
|
|
|
189
190
|
* be divided. Default is `1e5`.
|
|
190
191
|
* @return {Array<number>} A list of n-dimensional points.
|
|
191
192
|
* @api
|
|
193
|
+
* @deprecated
|
|
192
194
|
*/
|
|
193
195
|
export function decodeDeltas(encoded, stride, factor) {
|
|
194
196
|
factor = factor ? factor : 1e5;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShaderBuilder.d.ts","sourceRoot":"","sources":["ShaderBuilder.js"],"names":[],"mappings":"AAQA,oqBAsBE;AAIF;;;;;;;GAOG;AAEH;;;;GAIG;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,+BAEC;IAED;;OAEG;IACH,gCAAmC;IAEnC;;OAEG;IACH,6BAAiD;IAEjD;;OAEG;IACH,8BAAkD;IAElD;;OAEG;IACH,oCAAwC;IAExC;;OAEG;IACH,uCAA8C;IAE9C;;;OAGG;IACH,iBAAqB;IAErB;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,+BAAgC;IAEhC;;;OAGG;IACH,iCAAkC;IAGpC;;;;;;OAMG;IACH,iBAJW,MAAM,QACN,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAAC,WAAW,GACvC,aAAa,CAQxB;IAED;;;;;;;;;;;OAWG;IACH,mBARW,MAAM,QACN,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,sBAC5B,MAAM,gBAEN,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,GAE3B,aAAa,CAWxB;IAED;;;;;;OAMG;IACH,oCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;OAEG;IACH,2BAFY,MAAM,CAIjB;IAED;;;;;;OAMG;IACH,wCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;;;;OAMG;IACH,sCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;OAEG;IACH,6BAFY,MAAM,CAIjB;IAED;;;;;;OAMG;IACH,qCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;OAEG;IACH,4BAFY,MAAM,CAIjB;IAED;;;;;;OAMG;IACH,2CAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;;;;;;OAQG;IACH,yCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;OAEG;IACH,gCAFY,MAAM,CAIjB;IAED;;;;;OAKG;IACH,wCAHW,OAAO,GACN,aAAa,CAKxB;IAED;;;OAGG;IACH,qCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;;OAGG;IACH,qCAHW,MAAM,GACL,aAAa,CAMxB;IAED;;OAEG;IACH,4BAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,sCAHW,MAAM,GACL,aAAa,CAKxB;IAED;;;OAGG;IACH,mCAHW,MAAM,GACL,aAAa,CAKxB;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,
|
|
1
|
+
{"version":3,"file":"ShaderBuilder.d.ts","sourceRoot":"","sources":["ShaderBuilder.js"],"names":[],"mappings":"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"}
|
|
@@ -475,7 +475,7 @@ export class ShaderBuilder {
|
|
|
475
475
|
return `${COMMON_HEADER}
|
|
476
476
|
${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\n')}
|
|
477
477
|
attribute vec2 a_position;
|
|
478
|
-
attribute
|
|
478
|
+
attribute vec2 a_localPosition;
|
|
479
479
|
attribute vec4 a_hitColor;
|
|
480
480
|
|
|
481
481
|
varying vec2 v_texCoord;
|
|
@@ -505,16 +505,7 @@ void main(void) {
|
|
|
505
505
|
v_quadSizePx = ${this.symbolSizeExpression_};
|
|
506
506
|
vec2 halfSizePx = v_quadSizePx * 0.5;
|
|
507
507
|
vec2 centerOffsetPx = ${this.symbolOffsetExpression_};
|
|
508
|
-
vec2 offsetPx = centerOffsetPx;
|
|
509
|
-
if (a_index == 0.0) {
|
|
510
|
-
offsetPx -= halfSizePx;
|
|
511
|
-
} else if (a_index == 1.0) {
|
|
512
|
-
offsetPx += halfSizePx * vec2(1., -1.);
|
|
513
|
-
} else if (a_index == 2.0) {
|
|
514
|
-
offsetPx += halfSizePx;
|
|
515
|
-
} else {
|
|
516
|
-
offsetPx += halfSizePx * vec2(-1., 1.);
|
|
517
|
-
}
|
|
508
|
+
vec2 offsetPx = centerOffsetPx + a_localPosition * halfSizePx * vec2(1., -1.);
|
|
518
509
|
float angle = ${this.symbolRotationExpression_}${this.symbolRotateWithView_ ? ' + u_rotation' : ''};
|
|
519
510
|
float c = cos(-angle);
|
|
520
511
|
float s = sin(-angle);
|
|
@@ -522,8 +513,8 @@ void main(void) {
|
|
|
522
513
|
vec4 center = u_projectionMatrix * vec4(a_position, 0.0, 1.0);
|
|
523
514
|
gl_Position = center + vec4(pxToScreen(offsetPx), u_depth, 0.);
|
|
524
515
|
vec4 texCoord = ${this.texCoordExpression_};
|
|
525
|
-
float u =
|
|
526
|
-
float v =
|
|
516
|
+
float u = mix(texCoord.s, texCoord.p, a_localPosition.x * 0.5 + 0.5);
|
|
517
|
+
float v = mix(texCoord.t, texCoord.q, a_localPosition.y * 0.5 + 0.5);
|
|
527
518
|
v_texCoord = vec2(u, v);
|
|
528
519
|
v_hitColor = a_hitColor;
|
|
529
520
|
v_angle = angle;
|
|
@@ -597,9 +588,10 @@ ${this.attributes_
|
|
|
597
588
|
${this.uniforms_.map((uniform) => `uniform ${uniform.type} ${uniform.name};`).join('\n')}
|
|
598
589
|
attribute vec2 a_segmentStart;
|
|
599
590
|
attribute vec2 a_segmentEnd;
|
|
591
|
+
attribute vec2 a_localPosition;
|
|
600
592
|
attribute float a_measureStart;
|
|
601
593
|
attribute float a_measureEnd;
|
|
602
|
-
attribute float
|
|
594
|
+
attribute float a_angleTangentSum;
|
|
603
595
|
attribute float a_distance;
|
|
604
596
|
attribute vec2 a_joinAngles;
|
|
605
597
|
attribute vec4 a_hitColor;
|
|
@@ -656,10 +648,9 @@ vec2 getOffsetPoint(vec2 point, vec2 normal, float joinAngle, float offsetPx) {
|
|
|
656
648
|
void main(void) {
|
|
657
649
|
v_angleStart = a_joinAngles.x;
|
|
658
650
|
v_angleEnd = a_joinAngles.y;
|
|
659
|
-
float
|
|
660
|
-
currentLineMetric =
|
|
651
|
+
float startEndRatio = a_localPosition.x * 0.5 + 0.5;
|
|
652
|
+
currentLineMetric = mix(a_measureStart, a_measureEnd, startEndRatio);
|
|
661
653
|
// we're reading the fractional part while keeping the sign (so -4.12 gives -0.12, 3.45 gives 0.45)
|
|
662
|
-
float angleTangentSum = fract(abs(a_parameters) / 10000.) * 10000. * sign(a_parameters);
|
|
663
654
|
|
|
664
655
|
float lineWidth = ${this.strokeWidthExpression_};
|
|
665
656
|
float lineOffsetPx = ${this.strokeOffsetExpression_};
|
|
@@ -673,11 +664,11 @@ void main(void) {
|
|
|
673
664
|
segmentEndPx = getOffsetPoint(segmentEndPx, normalPx, v_angleEnd, lineOffsetPx);
|
|
674
665
|
|
|
675
666
|
// compute current vertex position
|
|
676
|
-
float normalDir =
|
|
677
|
-
float tangentDir =
|
|
678
|
-
float angle =
|
|
667
|
+
float normalDir = -1. * a_localPosition.y;
|
|
668
|
+
float tangentDir = -1. * a_localPosition.x;
|
|
669
|
+
float angle = mix(v_angleStart, v_angleEnd, startEndRatio);
|
|
679
670
|
vec2 joinDirection;
|
|
680
|
-
vec2 positionPx =
|
|
671
|
+
vec2 positionPx = mix(segmentStartPx, segmentEndPx, startEndRatio);
|
|
681
672
|
// if angle is too high, do not make a proper join
|
|
682
673
|
if (cos(angle) > ${LINESTRING_ANGLE_COSINE_CUTOFF} || isCap(angle)) {
|
|
683
674
|
joinDirection = normalPx * normalDir - tangentPx * tangentDir;
|
|
@@ -691,7 +682,7 @@ void main(void) {
|
|
|
691
682
|
v_segmentEnd = segmentEndPx;
|
|
692
683
|
v_width = lineWidth;
|
|
693
684
|
v_hitColor = a_hitColor;
|
|
694
|
-
v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx *
|
|
685
|
+
v_distanceOffsetPx = a_distance / u_resolution - (lineOffsetPx * a_angleTangentSum);
|
|
695
686
|
v_measureStart = a_measureStart;
|
|
696
687
|
v_measureEnd = a_measureEnd;
|
|
697
688
|
${this.attributes_
|
|
@@ -12,12 +12,12 @@ export function convertStyleToShaders(style: FlatStyleLike | StyleShaders | Arra
|
|
|
12
12
|
export type Attributes = string;
|
|
13
13
|
export namespace Attributes {
|
|
14
14
|
let POSITION: string;
|
|
15
|
-
let
|
|
15
|
+
let LOCAL_POSITION: string;
|
|
16
16
|
let SEGMENT_START: string;
|
|
17
17
|
let SEGMENT_END: string;
|
|
18
18
|
let MEASURE_START: string;
|
|
19
19
|
let MEASURE_END: string;
|
|
20
|
-
let
|
|
20
|
+
let ANGLE_TANGENT_SUM: string;
|
|
21
21
|
let JOIN_ANGLES: string;
|
|
22
22
|
let DISTANCE: string;
|
|
23
23
|
}
|
|
@@ -44,19 +44,23 @@ export type AttributeDefinitions = {
|
|
|
44
44
|
export type UniformDefinitions = {
|
|
45
45
|
[x: string]: import("../../webgl/Helper.js").UniformValue;
|
|
46
46
|
};
|
|
47
|
+
/**
|
|
48
|
+
* Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
|
|
49
|
+
*/
|
|
50
|
+
export type WebGLArrayBufferSet = Array<WebGLArrayBuffer>;
|
|
47
51
|
export type WebGLBuffers = {
|
|
48
52
|
/**
|
|
49
53
|
* Array containing indices and vertices buffers for polygons
|
|
50
54
|
*/
|
|
51
|
-
polygonBuffers:
|
|
55
|
+
polygonBuffers: WebGLArrayBufferSet;
|
|
52
56
|
/**
|
|
53
57
|
* Array containing indices and vertices buffers for line strings
|
|
54
58
|
*/
|
|
55
|
-
lineStringBuffers:
|
|
59
|
+
lineStringBuffers: WebGLArrayBufferSet;
|
|
56
60
|
/**
|
|
57
61
|
* Array containing indices and vertices buffers for points
|
|
58
62
|
*/
|
|
59
|
-
pointBuffers:
|
|
63
|
+
pointBuffers: WebGLArrayBufferSet;
|
|
60
64
|
/**
|
|
61
65
|
* Inverse of the transform applied when generating buffers
|
|
62
66
|
*/
|
|
@@ -103,9 +107,17 @@ export type SubRenderPass = {
|
|
|
103
107
|
*/
|
|
104
108
|
fragmentShader: string;
|
|
105
109
|
/**
|
|
106
|
-
* Attributes description
|
|
110
|
+
* Attributes description, defined for each primitive vertex
|
|
107
111
|
*/
|
|
108
112
|
attributesDesc: Array<import("../../webgl/Helper.js").AttributeDescription>;
|
|
113
|
+
/**
|
|
114
|
+
* Attributes description, defined once per primitive
|
|
115
|
+
*/
|
|
116
|
+
instancedAttributesDesc: Array<import("../../webgl/Helper.js").AttributeDescription>;
|
|
117
|
+
/**
|
|
118
|
+
* Number of vertices per instance primitive in this render pass
|
|
119
|
+
*/
|
|
120
|
+
instancePrimitiveVertexCount: number;
|
|
109
121
|
/**
|
|
110
122
|
* Program; this has to be recreated if the helper is lost/changed
|
|
111
123
|
*/
|
|
@@ -137,11 +149,14 @@ export type RenderPass = {
|
|
|
137
149
|
* @typedef {Object<string, AttributeDefinition>} AttributeDefinitions
|
|
138
150
|
* @typedef {Object<string, import("../../webgl/Helper").UniformValue>} UniformDefinitions
|
|
139
151
|
*/
|
|
152
|
+
/**
|
|
153
|
+
* @typedef {Array<WebGLArrayBuffer>} WebGLArrayBufferSet Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
|
|
154
|
+
*/
|
|
140
155
|
/**
|
|
141
156
|
* @typedef {Object} WebGLBuffers
|
|
142
|
-
* @property {
|
|
143
|
-
* @property {
|
|
144
|
-
* @property {
|
|
157
|
+
* @property {WebGLArrayBufferSet} polygonBuffers Array containing indices and vertices buffers for polygons
|
|
158
|
+
* @property {WebGLArrayBufferSet} lineStringBuffers Array containing indices and vertices buffers for line strings
|
|
159
|
+
* @property {WebGLArrayBufferSet} pointBuffers Array containing indices and vertices buffers for points
|
|
145
160
|
* @property {import("../../transform.js").Transform} invertVerticesTransform Inverse of the transform applied when generating buffers
|
|
146
161
|
*/
|
|
147
162
|
/**
|
|
@@ -171,7 +186,9 @@ export type RenderPass = {
|
|
|
171
186
|
* @typedef {Object} SubRenderPass
|
|
172
187
|
* @property {string} vertexShader Vertex shader
|
|
173
188
|
* @property {string} fragmentShader Fragment shader
|
|
174
|
-
* @property {Array<import('../../webgl/Helper.js').AttributeDescription>} attributesDesc Attributes description
|
|
189
|
+
* @property {Array<import('../../webgl/Helper.js').AttributeDescription>} attributesDesc Attributes description, defined for each primitive vertex
|
|
190
|
+
* @property {Array<import('../../webgl/Helper.js').AttributeDescription>} instancedAttributesDesc Attributes description, defined once per primitive
|
|
191
|
+
* @property {number} instancePrimitiveVertexCount Number of vertices per instance primitive in this render pass
|
|
175
192
|
* @property {WebGLProgram} [program] Program; this has to be recreated if the helper is lost/changed
|
|
176
193
|
*/
|
|
177
194
|
/**
|
|
@@ -248,7 +265,7 @@ declare class VectorStyleRenderer {
|
|
|
248
265
|
* @param {Float32Array|null} renderInstructions Render instructions
|
|
249
266
|
* @param {import("../../geom/Geometry.js").Type} geometryType Geometry type
|
|
250
267
|
* @param {import("../../transform.js").Transform} transform Transform to apply to coordinates
|
|
251
|
-
* @return {Promise<
|
|
268
|
+
* @return {Promise<WebGLArrayBufferSet>|null} Indices buffer and vertices buffer; null if nothing to render
|
|
252
269
|
* @private
|
|
253
270
|
*/
|
|
254
271
|
private generateBuffersForType_;
|
|
@@ -261,9 +278,9 @@ declare class VectorStyleRenderer {
|
|
|
261
278
|
render(buffers: WebGLBuffers, frameState: import("../../Map.js").FrameState, preRenderCallback: () => void): void;
|
|
262
279
|
/**
|
|
263
280
|
* @param {WebGLArrayBuffer} indicesBuffer Indices buffer
|
|
264
|
-
* @param {WebGLArrayBuffer}
|
|
265
|
-
* @param {
|
|
266
|
-
* @param {
|
|
281
|
+
* @param {WebGLArrayBuffer} vertexAttributesBuffer Vertex attributes buffer
|
|
282
|
+
* @param {WebGLArrayBuffer} instanceAttributesBuffer Instance attributes buffer
|
|
283
|
+
* @param {SubRenderPass} subRenderPass Render pass (program, attributes, etc.) specific to one geometry type
|
|
267
284
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
268
285
|
* @param {function(): void} preRenderCallback This callback will be called right before drawing, and can be used to set uniforms
|
|
269
286
|
* @private
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VectorStyleRenderer.d.ts","sourceRoot":"","sources":["VectorStyleRenderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VectorStyleRenderer.d.ts","sourceRoot":"","sources":["VectorStyleRenderer.js"],"names":[],"mappings":"AAunBA;;;;;GAKG;AACH,6CAJW,aAAa,GAAC,YAAY,GAAC,KAAK,CAAC,YAAY,CAAC,aAC9C,OAAO,qBAAqB,EAAE,cAAc,GAC3C,KAAK,CAAC,YAAY,CAAC,CAuD9B;;;;;yBA/oBS,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmBF,CAAS,IAAwD,EAAnD,OAAO,yBAAyB,EAAE,iBAAiB,EAAE,IAAmC,EAAnC,OAAO,eAAe,EAAE,WAAW,KAAE,MAAM,GAAC,KAAK,CAAC,MAAM,CAAC;;;;;;;;;;;kCAU7H,KAAK,CAAC,gBAAgB,CAAC;;;;;oBAKtB,mBAAmB;;;;uBACnB,mBAAmB;;;;kBACnB,mBAAmB;;;;6BACnB,OAAO,oBAAoB,EAAE,SAAS;;;;;;yBAKtC,YAAY,GAAC,IAAI;;;;4BACjB,YAAY,GAAC,IAAI;;;;uBACjB,YAAY,GAAC,IAAI;;;;;;;;;YAKjB,MAAM;;;;cACN,MAAM;;2BAIP,OAAO,YAAY,EAAE,gBAAgB;4BAIrC,OAAO,qBAAqB,EAAE,aAAa;wBAG3C,OAAO,qBAAqB,EAAE,SAAS;4BAGvC,OAAO,qBAAqB,EAAE,IAAI;;;;;kBAKjC,MAAM;;;;oBACN,MAAM;;;;oBACN,KAAK,CAAC,OAAO,uBAAuB,EAAE,oBAAoB,CAAC;;;;6BAC3D,KAAK,CAAC,OAAO,uBAAuB,EAAE,oBAAoB,CAAC;;;;kCAC3D,MAAM;;;;;;;;;;;;;;;;;;;;AA3DpB;;;;;;;GAOG;AAEH;;;GAGG;AAEH;;GAEG;AAEH;;;;;;GAMG;AAEH;;;;;GAKG;AAEH;;;;GAIG;AAEH;;GAEG;AAEH;;GAEG;AACH;;GAEG;AACH;;GAEG;AAEH;;;;;;;;GAQG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH;IACE;;;;;OAKG;IACH,oBALW,aAAa,GAAC,YAAY,GAAC,KAAK,CAAC,YAAY,CAAC,aAC9C,OAAO,qBAAqB,EAAE,cAAc,UAC5C,OAAO,uBAAuB,EAAE,OAAO,uBACvC,OAAO,EAqLjB;IAlLC;;;OAGG;IACH,gBAAY;IAEZ;;OAEG;IACH,6BAAgD;IAEhD;;;OAGG;IACH,qBAA4D;IAE5D;;;OAGG;IACH,0BAA2B;IAE3B;;;OAGG;IACH,kBAAmB;IAgCnB;;;OAGG;IACH,sBA2GE;IAEF,kBAAsE;IACtE,oBAA0E;IAC1E,oBAA0E;IAM5E;;;;OAIG;IACH,+BAJW,OAAO,yBAAyB,EAAE,OAAO,aACzC,OAAO,oBAAoB,EAAE,SAAS,GACrC,OAAO,CAAC,YAAY,GAAC,IAAI,CAAC,CAwCrC;IAED;;;;;OAKG;IACH,oCA+BC;IAED;;;;;;OAMG;IACH,gCAiFC;IAED;;;;;OAKG;IACH,gBAJW,YAAY,cACZ,OAAO,cAAc,EAAE,UAAU,qBACjC,MAAY,IAAI,QAgC1B;IAED;;;;;;;;OAQG;IACH,wBAuCC;IAED;;;OAGG;IACH,kBAHW,OAAO,uBAAuB,EAAE,OAAO,YACvC,YAAY,QA4CtB;CACF;6BA5mB4B,uBAAuB"}
|
|
@@ -37,12 +37,12 @@ let workerMessageCounter = 0;
|
|
|
37
37
|
*/
|
|
38
38
|
export const Attributes = {
|
|
39
39
|
POSITION: 'a_position',
|
|
40
|
-
|
|
40
|
+
LOCAL_POSITION: 'a_localPosition',
|
|
41
41
|
SEGMENT_START: 'a_segmentStart',
|
|
42
42
|
SEGMENT_END: 'a_segmentEnd',
|
|
43
43
|
MEASURE_START: 'a_measureStart',
|
|
44
44
|
MEASURE_END: 'a_measureEnd',
|
|
45
|
-
|
|
45
|
+
ANGLE_TANGENT_SUM: 'a_angleTangentSum',
|
|
46
46
|
JOIN_ANGLES: 'a_joinAngles',
|
|
47
47
|
DISTANCE: 'a_distance',
|
|
48
48
|
};
|
|
@@ -61,11 +61,15 @@ export const Attributes = {
|
|
|
61
61
|
* @typedef {Object<string, import("../../webgl/Helper").UniformValue>} UniformDefinitions
|
|
62
62
|
*/
|
|
63
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @typedef {Array<WebGLArrayBuffer>} WebGLArrayBufferSet Buffers organized like so: [indicesBuffer, vertexAttributesBuffer, instanceAttributesBuffer]
|
|
66
|
+
*/
|
|
67
|
+
|
|
64
68
|
/**
|
|
65
69
|
* @typedef {Object} WebGLBuffers
|
|
66
|
-
* @property {
|
|
67
|
-
* @property {
|
|
68
|
-
* @property {
|
|
70
|
+
* @property {WebGLArrayBufferSet} polygonBuffers Array containing indices and vertices buffers for polygons
|
|
71
|
+
* @property {WebGLArrayBufferSet} lineStringBuffers Array containing indices and vertices buffers for line strings
|
|
72
|
+
* @property {WebGLArrayBufferSet} pointBuffers Array containing indices and vertices buffers for points
|
|
69
73
|
* @property {import("../../transform.js").Transform} invertVerticesTransform Inverse of the transform applied when generating buffers
|
|
70
74
|
*/
|
|
71
75
|
|
|
@@ -100,7 +104,9 @@ export const Attributes = {
|
|
|
100
104
|
* @typedef {Object} SubRenderPass
|
|
101
105
|
* @property {string} vertexShader Vertex shader
|
|
102
106
|
* @property {string} fragmentShader Fragment shader
|
|
103
|
-
* @property {Array<import('../../webgl/Helper.js').AttributeDescription>} attributesDesc Attributes description
|
|
107
|
+
* @property {Array<import('../../webgl/Helper.js').AttributeDescription>} attributesDesc Attributes description, defined for each primitive vertex
|
|
108
|
+
* @property {Array<import('../../webgl/Helper.js').AttributeDescription>} instancedAttributesDesc Attributes description, defined once per primitive
|
|
109
|
+
* @property {number} instancePrimitiveVertexCount Number of vertices per instance primitive in this render pass
|
|
104
110
|
* @property {WebGLProgram} [program] Program; this has to be recreated if the helper is lost/changed
|
|
105
111
|
*/
|
|
106
112
|
|
|
@@ -221,6 +227,8 @@ class VectorStyleRenderer {
|
|
|
221
227
|
},
|
|
222
228
|
...customAttributesDesc,
|
|
223
229
|
],
|
|
230
|
+
instancedAttributesDesc: [], // no instanced rendering for polygons
|
|
231
|
+
instancePrimitiveVertexCount: 3,
|
|
224
232
|
};
|
|
225
233
|
}
|
|
226
234
|
if (styleShader.builder.getStrokeVertexShader()) {
|
|
@@ -228,6 +236,13 @@ class VectorStyleRenderer {
|
|
|
228
236
|
vertexShader: styleShader.builder.getStrokeVertexShader(),
|
|
229
237
|
fragmentShader: styleShader.builder.getStrokeFragmentShader(),
|
|
230
238
|
attributesDesc: [
|
|
239
|
+
{
|
|
240
|
+
name: Attributes.LOCAL_POSITION,
|
|
241
|
+
size: 2,
|
|
242
|
+
type: AttributeType.FLOAT,
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
instancedAttributesDesc: [
|
|
231
246
|
{
|
|
232
247
|
name: Attributes.SEGMENT_START,
|
|
233
248
|
size: 2,
|
|
@@ -259,12 +274,13 @@ class VectorStyleRenderer {
|
|
|
259
274
|
type: AttributeType.FLOAT,
|
|
260
275
|
},
|
|
261
276
|
{
|
|
262
|
-
name: Attributes.
|
|
277
|
+
name: Attributes.ANGLE_TANGENT_SUM,
|
|
263
278
|
size: 1,
|
|
264
279
|
type: AttributeType.FLOAT,
|
|
265
280
|
},
|
|
266
281
|
...customAttributesDesc,
|
|
267
282
|
],
|
|
283
|
+
instancePrimitiveVertexCount: 6,
|
|
268
284
|
};
|
|
269
285
|
}
|
|
270
286
|
if (styleShader.builder.getSymbolVertexShader()) {
|
|
@@ -273,17 +289,20 @@ class VectorStyleRenderer {
|
|
|
273
289
|
fragmentShader: styleShader.builder.getSymbolFragmentShader(),
|
|
274
290
|
attributesDesc: [
|
|
275
291
|
{
|
|
276
|
-
name: Attributes.
|
|
292
|
+
name: Attributes.LOCAL_POSITION,
|
|
277
293
|
size: 2,
|
|
278
294
|
type: AttributeType.FLOAT,
|
|
279
295
|
},
|
|
296
|
+
],
|
|
297
|
+
instancedAttributesDesc: [
|
|
280
298
|
{
|
|
281
|
-
name: Attributes.
|
|
282
|
-
size:
|
|
299
|
+
name: Attributes.POSITION,
|
|
300
|
+
size: 2,
|
|
283
301
|
type: AttributeType.FLOAT,
|
|
284
302
|
},
|
|
285
303
|
...customAttributesDesc,
|
|
286
304
|
],
|
|
305
|
+
instancePrimitiveVertexCount: 6,
|
|
287
306
|
};
|
|
288
307
|
}
|
|
289
308
|
return renderPass;
|
|
@@ -385,7 +404,7 @@ class VectorStyleRenderer {
|
|
|
385
404
|
* @param {Float32Array|null} renderInstructions Render instructions
|
|
386
405
|
* @param {import("../../geom/Geometry.js").Type} geometryType Geometry type
|
|
387
406
|
* @param {import("../../transform.js").Transform} transform Transform to apply to coordinates
|
|
388
|
-
* @return {Promise<
|
|
407
|
+
* @return {Promise<WebGLArrayBufferSet>|null} Indices buffer and vertices buffer; null if nothing to render
|
|
389
408
|
* @private
|
|
390
409
|
*/
|
|
391
410
|
generateBuffersForType_(renderInstructions, geometryType, transform) {
|
|
@@ -425,7 +444,7 @@ class VectorStyleRenderer {
|
|
|
425
444
|
|
|
426
445
|
return new Promise((resolve) => {
|
|
427
446
|
/**
|
|
428
|
-
* @param {
|
|
447
|
+
* @param {{data: import('./constants.js').WebGLWorkerGenerateBuffersMessage}} event Event.
|
|
429
448
|
*/
|
|
430
449
|
const handleMessage = (event) => {
|
|
431
450
|
const received = event.data;
|
|
@@ -444,18 +463,27 @@ class VectorStyleRenderer {
|
|
|
444
463
|
}
|
|
445
464
|
|
|
446
465
|
// copy & flush received buffers to GPU
|
|
447
|
-
const verticesBuffer = new WebGLArrayBuffer(
|
|
448
|
-
ARRAY_BUFFER,
|
|
449
|
-
DYNAMIC_DRAW,
|
|
450
|
-
).fromArrayBuffer(received.vertexBuffer);
|
|
451
466
|
const indicesBuffer = new WebGLArrayBuffer(
|
|
452
467
|
ELEMENT_ARRAY_BUFFER,
|
|
453
468
|
DYNAMIC_DRAW,
|
|
454
|
-
).fromArrayBuffer(received.
|
|
455
|
-
|
|
469
|
+
).fromArrayBuffer(received.indicesBuffer);
|
|
470
|
+
const vertexAttributesBuffer = new WebGLArrayBuffer(
|
|
471
|
+
ARRAY_BUFFER,
|
|
472
|
+
DYNAMIC_DRAW,
|
|
473
|
+
).fromArrayBuffer(received.vertexAttributesBuffer);
|
|
474
|
+
const instanceAttributesBuffer = new WebGLArrayBuffer(
|
|
475
|
+
ARRAY_BUFFER,
|
|
476
|
+
DYNAMIC_DRAW,
|
|
477
|
+
).fromArrayBuffer(received.instanceAttributesBuffer);
|
|
456
478
|
this.helper_.flushBufferData(indicesBuffer);
|
|
457
|
-
|
|
458
|
-
|
|
479
|
+
this.helper_.flushBufferData(vertexAttributesBuffer);
|
|
480
|
+
this.helper_.flushBufferData(instanceAttributesBuffer);
|
|
481
|
+
|
|
482
|
+
resolve([
|
|
483
|
+
indicesBuffer,
|
|
484
|
+
vertexAttributesBuffer,
|
|
485
|
+
instanceAttributesBuffer,
|
|
486
|
+
]);
|
|
459
487
|
};
|
|
460
488
|
|
|
461
489
|
WEBGL_WORKER.addEventListener('message', handleMessage);
|
|
@@ -474,8 +502,8 @@ class VectorStyleRenderer {
|
|
|
474
502
|
this.renderInternal_(
|
|
475
503
|
buffers.polygonBuffers[0],
|
|
476
504
|
buffers.polygonBuffers[1],
|
|
477
|
-
|
|
478
|
-
renderPass.fillRenderPass
|
|
505
|
+
buffers.polygonBuffers[2],
|
|
506
|
+
renderPass.fillRenderPass,
|
|
479
507
|
frameState,
|
|
480
508
|
preRenderCallback,
|
|
481
509
|
);
|
|
@@ -483,8 +511,8 @@ class VectorStyleRenderer {
|
|
|
483
511
|
this.renderInternal_(
|
|
484
512
|
buffers.lineStringBuffers[0],
|
|
485
513
|
buffers.lineStringBuffers[1],
|
|
486
|
-
|
|
487
|
-
renderPass.strokeRenderPass
|
|
514
|
+
buffers.lineStringBuffers[2],
|
|
515
|
+
renderPass.strokeRenderPass,
|
|
488
516
|
frameState,
|
|
489
517
|
preRenderCallback,
|
|
490
518
|
);
|
|
@@ -492,8 +520,8 @@ class VectorStyleRenderer {
|
|
|
492
520
|
this.renderInternal_(
|
|
493
521
|
buffers.pointBuffers[0],
|
|
494
522
|
buffers.pointBuffers[1],
|
|
495
|
-
|
|
496
|
-
renderPass.symbolRenderPass
|
|
523
|
+
buffers.pointBuffers[2],
|
|
524
|
+
renderPass.symbolRenderPass,
|
|
497
525
|
frameState,
|
|
498
526
|
preRenderCallback,
|
|
499
527
|
);
|
|
@@ -502,18 +530,18 @@ class VectorStyleRenderer {
|
|
|
502
530
|
|
|
503
531
|
/**
|
|
504
532
|
* @param {WebGLArrayBuffer} indicesBuffer Indices buffer
|
|
505
|
-
* @param {WebGLArrayBuffer}
|
|
506
|
-
* @param {
|
|
507
|
-
* @param {
|
|
533
|
+
* @param {WebGLArrayBuffer} vertexAttributesBuffer Vertex attributes buffer
|
|
534
|
+
* @param {WebGLArrayBuffer} instanceAttributesBuffer Instance attributes buffer
|
|
535
|
+
* @param {SubRenderPass} subRenderPass Render pass (program, attributes, etc.) specific to one geometry type
|
|
508
536
|
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
509
537
|
* @param {function(): void} preRenderCallback This callback will be called right before drawing, and can be used to set uniforms
|
|
510
538
|
* @private
|
|
511
539
|
*/
|
|
512
540
|
renderInternal_(
|
|
513
541
|
indicesBuffer,
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
542
|
+
vertexAttributesBuffer,
|
|
543
|
+
instanceAttributesBuffer,
|
|
544
|
+
subRenderPass,
|
|
517
545
|
frameState,
|
|
518
546
|
preRenderCallback,
|
|
519
547
|
) {
|
|
@@ -521,12 +549,33 @@ class VectorStyleRenderer {
|
|
|
521
549
|
if (renderCount === 0) {
|
|
522
550
|
return;
|
|
523
551
|
}
|
|
524
|
-
|
|
525
|
-
|
|
552
|
+
|
|
553
|
+
const usesInstancedRendering = subRenderPass.instancedAttributesDesc.length;
|
|
554
|
+
|
|
555
|
+
this.helper_.useProgram(subRenderPass.program, frameState);
|
|
556
|
+
this.helper_.bindBuffer(vertexAttributesBuffer);
|
|
526
557
|
this.helper_.bindBuffer(indicesBuffer);
|
|
527
|
-
this.helper_.enableAttributes(
|
|
558
|
+
this.helper_.enableAttributes(subRenderPass.attributesDesc);
|
|
559
|
+
this.helper_.bindBuffer(instanceAttributesBuffer);
|
|
560
|
+
this.helper_.enableAttributesInstanced(
|
|
561
|
+
subRenderPass.instancedAttributesDesc,
|
|
562
|
+
);
|
|
563
|
+
|
|
528
564
|
preRenderCallback();
|
|
529
|
-
|
|
565
|
+
|
|
566
|
+
if (usesInstancedRendering) {
|
|
567
|
+
const instanceAttributesStride =
|
|
568
|
+
subRenderPass.instancedAttributesDesc.reduce(
|
|
569
|
+
(prev, curr) => prev + (curr.size || 1),
|
|
570
|
+
0,
|
|
571
|
+
);
|
|
572
|
+
const instanceCount =
|
|
573
|
+
instanceAttributesBuffer.getSize() / instanceAttributesStride;
|
|
574
|
+
|
|
575
|
+
this.helper_.drawElementsInstanced(0, renderCount, instanceCount);
|
|
576
|
+
} else {
|
|
577
|
+
this.helper_.drawElements(0, renderCount);
|
|
578
|
+
}
|
|
530
579
|
}
|
|
531
580
|
|
|
532
581
|
/**
|
|
@@ -562,14 +611,17 @@ class VectorStyleRenderer {
|
|
|
562
611
|
if (buffers.polygonBuffers) {
|
|
563
612
|
this.helper_.flushBufferData(buffers.polygonBuffers[0]);
|
|
564
613
|
this.helper_.flushBufferData(buffers.polygonBuffers[1]);
|
|
614
|
+
this.helper_.flushBufferData(buffers.polygonBuffers[2]);
|
|
565
615
|
}
|
|
566
616
|
if (buffers.lineStringBuffers) {
|
|
567
617
|
this.helper_.flushBufferData(buffers.lineStringBuffers[0]);
|
|
568
618
|
this.helper_.flushBufferData(buffers.lineStringBuffers[1]);
|
|
619
|
+
this.helper_.flushBufferData(buffers.lineStringBuffers[2]);
|
|
569
620
|
}
|
|
570
621
|
if (buffers.pointBuffers) {
|
|
571
622
|
this.helper_.flushBufferData(buffers.pointBuffers[0]);
|
|
572
623
|
this.helper_.flushBufferData(buffers.pointBuffers[1]);
|
|
624
|
+
this.helper_.flushBufferData(buffers.pointBuffers[2]);
|
|
573
625
|
}
|
|
574
626
|
}
|
|
575
627
|
}
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
* Pushes a quad (two triangles) based on a point geometry
|
|
3
3
|
* @param {Float32Array} instructions Array of render instructions for points.
|
|
4
4
|
* @param {number} elementIndex Index from which render instructions will be read.
|
|
5
|
-
* @param {Float32Array}
|
|
6
|
-
* @param {Uint32Array} indexBuffer Buffer in the form of a typed array.
|
|
5
|
+
* @param {Float32Array} instanceAttributesBuffer Buffer in the form of a typed array.
|
|
7
6
|
* @param {number} customAttributesSize Amount of custom attributes for each element.
|
|
8
7
|
* @param {BufferPositions} [bufferPositions] Buffer write positions; if not specified, positions will be set at 0.
|
|
9
8
|
* @return {BufferPositions} New buffer positions where to write next
|
|
10
|
-
* @property {number}
|
|
11
|
-
* @property {number}
|
|
9
|
+
* @property {number} vertexAttributesPosition New position in the vertex buffer where future writes should start.
|
|
10
|
+
* @property {number} indicesPosition New position in the index buffer where future writes should start.
|
|
12
11
|
* @private
|
|
13
12
|
*/
|
|
14
|
-
export function writePointFeatureToBuffers(instructions: Float32Array, elementIndex: number,
|
|
13
|
+
export function writePointFeatureToBuffers(instructions: Float32Array, elementIndex: number, instanceAttributesBuffer: Float32Array, customAttributesSize: number, bufferPositions?: BufferPositions): BufferPositions;
|
|
15
14
|
/**
|
|
16
15
|
* Pushes a single quad to form a line segment; also includes a computation for the join angles with previous and next
|
|
17
16
|
* segment, in order to be able to offset the vertices correctly in the shader.
|
|
@@ -37,8 +36,7 @@ export function writePointFeatureToBuffers(instructions: Float32Array, elementIn
|
|
|
37
36
|
* @param {number} segmentEndIndex Index of the segment end point from which render instructions will be read.
|
|
38
37
|
* @param {number|null} beforeSegmentIndex Index of the point right before the segment (null if none, e.g this is a line start)
|
|
39
38
|
* @param {number|null} afterSegmentIndex Index of the point right after the segment (null if none, e.g this is a line end)
|
|
40
|
-
* @param {Array<number>}
|
|
41
|
-
* @param {Array<number>} indexArray Array containing indices.
|
|
39
|
+
* @param {Array<number>} instanceAttributesArray Array containing instance attributes.
|
|
42
40
|
* @param {Array<number>} customAttributes Array of custom attributes value
|
|
43
41
|
* @param {import('../../transform.js').Transform} toWorldTransform Transform matrix used to obtain world coordinates from instructions
|
|
44
42
|
* @param {number} currentLength Cumulated length of segments processed so far
|
|
@@ -46,7 +44,7 @@ export function writePointFeatureToBuffers(instructions: Float32Array, elementIn
|
|
|
46
44
|
* @return {{length: number, angle: number}} Cumulated length with the newly processed segment (in world units), new sum of the join angle tangents
|
|
47
45
|
* @private
|
|
48
46
|
*/
|
|
49
|
-
export function writeLineSegmentToBuffers(instructions: Float32Array, segmentStartIndex: number, segmentEndIndex: number, beforeSegmentIndex: number | null, afterSegmentIndex: number | null,
|
|
47
|
+
export function writeLineSegmentToBuffers(instructions: Float32Array, segmentStartIndex: number, segmentEndIndex: number, beforeSegmentIndex: number | null, afterSegmentIndex: number | null, instanceAttributesArray: Array<number>, customAttributes: Array<number>, toWorldTransform: import("../../transform.js").Transform, currentLength: number, currentAngleTangentSum: number): {
|
|
50
48
|
length: number;
|
|
51
49
|
angle: number;
|
|
52
50
|
};
|
|
@@ -69,10 +67,14 @@ export type BufferPositions = {
|
|
|
69
67
|
/**
|
|
70
68
|
* Position in the vertex buffer
|
|
71
69
|
*/
|
|
72
|
-
|
|
70
|
+
vertexAttributesPosition: number;
|
|
71
|
+
/**
|
|
72
|
+
* Position in the vertex buffer
|
|
73
|
+
*/
|
|
74
|
+
instanceAttributesPosition: number;
|
|
73
75
|
/**
|
|
74
76
|
* Position in the index buffer
|
|
75
77
|
*/
|
|
76
|
-
|
|
78
|
+
indicesPosition: number;
|
|
77
79
|
};
|
|
78
80
|
//# sourceMappingURL=bufferUtil.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bufferUtil.d.ts","sourceRoot":"","sources":["bufferUtil.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bufferUtil.d.ts","sourceRoot":"","sources":["bufferUtil.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH,yDAVW,YAAY,gBACZ,MAAM,4BACN,YAAY,wBACZ,MAAM,oBACN,eAAe,GACd,eAAe,CAmC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wDAbW,YAAY,qBACZ,MAAM,mBACN,MAAM,sBACN,MAAM,GAAC,IAAI,qBACX,MAAM,GAAC,IAAI,2BACX,KAAK,CAAC,MAAM,CAAC,oBACb,KAAK,CAAC,MAAM,CAAC,oBACb,OAAO,oBAAoB,EAAE,SAAS,iBACtC,MAAM,0BACN,MAAM,GACL;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CA0H1C;AAED;;;;;;;;;GASG;AACH,6DARW,YAAY,qBACZ,MAAM,eACN,KAAK,CAAC,MAAM,CAAC,cACb,KAAK,CAAC,MAAM,CAAC,wBACb,MAAM,GACL,MAAM,CA0CjB;AAzQD,6CAA8C,KAAK,CAAC;;;;;;;;8BAQtC,MAAM;;;;gCACN,MAAM;;;;qBACN,MAAM"}
|