ol 7.0.0-dev.1658443472213 → 7.0.0-dev.1658733468997
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/Overlay.d.ts +3 -25
- package/Overlay.d.ts.map +1 -1
- package/Overlay.js +3 -25
- package/Overlay.js.map +1 -1
- package/package.json +2 -1
- package/render/webgl/BatchRenderer.d.ts +92 -0
- package/render/webgl/BatchRenderer.d.ts.map +1 -0
- package/render/webgl/BatchRenderer.js +165 -0
- package/render/webgl/BatchRenderer.js.map +1 -0
- package/render/webgl/LineStringBatchRenderer.d.ts +27 -0
- package/render/webgl/LineStringBatchRenderer.d.ts.map +1 -0
- package/render/webgl/LineStringBatchRenderer.js +114 -0
- package/render/webgl/LineStringBatchRenderer.js.map +1 -0
- package/render/webgl/MixedGeometryBatch.d.ts +306 -0
- package/render/webgl/MixedGeometryBatch.d.ts.map +1 -0
- package/render/webgl/MixedGeometryBatch.js +342 -0
- package/render/webgl/MixedGeometryBatch.js.map +1 -0
- package/render/webgl/PointBatchRenderer.d.ts +26 -0
- package/render/webgl/PointBatchRenderer.d.ts.map +1 -0
- package/render/webgl/PointBatchRenderer.js +102 -0
- package/render/webgl/PointBatchRenderer.js.map +1 -0
- package/render/webgl/PolygonBatchRenderer.d.ts +25 -0
- package/render/webgl/PolygonBatchRenderer.d.ts.map +1 -0
- package/render/webgl/PolygonBatchRenderer.js +110 -0
- package/render/webgl/PolygonBatchRenderer.js.map +1 -0
- package/render/webgl/constants.d.ts +43 -0
- package/render/webgl/constants.d.ts.map +1 -0
- package/render/webgl/constants.js +26 -0
- package/render/webgl/constants.js.map +1 -0
- package/render/webgl/utils.d.ts +76 -0
- package/render/webgl/utils.d.ts.map +1 -0
- package/render/webgl/utils.js +257 -0
- package/render/webgl/utils.js.map +1 -0
- package/renderer/webgl/Layer.d.ts +0 -98
- package/renderer/webgl/Layer.d.ts.map +1 -1
- package/renderer/webgl/Layer.js +0 -134
- package/renderer/webgl/Layer.js.map +1 -1
- package/renderer/webgl/PointsLayer.d.ts +4 -1
- package/renderer/webgl/PointsLayer.d.ts.map +1 -1
- package/renderer/webgl/PointsLayer.js +15 -8
- package/renderer/webgl/PointsLayer.js.map +1 -1
- package/renderer/webgl/TileLayer.js +1 -1
- package/renderer/webgl/TileLayer.js.map +1 -1
- package/renderer/webgl/VectorLayer.d.ts +142 -0
- package/renderer/webgl/VectorLayer.d.ts.map +1 -0
- package/renderer/webgl/VectorLayer.js +304 -0
- package/renderer/webgl/VectorLayer.js.map +1 -0
- package/renderer/webgl/shaders.d.ts +43 -0
- package/renderer/webgl/shaders.d.ts.map +1 -0
- package/renderer/webgl/shaders.js +53 -0
- package/renderer/webgl/shaders.js.map +1 -0
- package/src/Overlay.js +3 -25
- package/src/render/webgl/BatchRenderer.js +201 -0
- package/src/render/webgl/LineStringBatchRenderer.js +116 -0
- package/src/render/webgl/MixedGeometryBatch.js +364 -0
- package/src/render/webgl/PointBatchRenderer.js +97 -0
- package/src/render/webgl/PolygonBatchRenderer.js +117 -0
- package/src/render/webgl/constants.js +27 -0
- package/src/render/webgl/utils.js +351 -0
- package/src/renderer/webgl/Layer.js +0 -160
- package/src/renderer/webgl/PointsLayer.js +16 -12
- package/src/renderer/webgl/TileLayer.js +1 -1
- package/src/renderer/webgl/VectorLayer.js +409 -0
- package/src/renderer/webgl/shaders.js +198 -0
- package/src/webgl/Helper.js +30 -45
- package/src/worker/webgl.js +1 -1
- package/util.js +1 -1
- package/webgl/Helper.d.ts +17 -25
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +29 -43
- package/webgl/Helper.js.map +1 -1
- package/worker/webgl.js +1 -1
- package/worker/webgl.js.map +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names of attributes made available to the vertex shader.
|
|
3
|
+
* Please note: changing these *will* break custom shaders!
|
|
4
|
+
*/
|
|
5
|
+
export type Attributes = string;
|
|
6
|
+
export namespace Attributes {
|
|
7
|
+
const POSITION: string;
|
|
8
|
+
const INDEX: string;
|
|
9
|
+
}
|
|
10
|
+
export default PointBatchRenderer;
|
|
11
|
+
declare class PointBatchRenderer extends AbstractBatchRenderer {
|
|
12
|
+
attributes: {
|
|
13
|
+
name: string;
|
|
14
|
+
size: number;
|
|
15
|
+
type: number;
|
|
16
|
+
}[];
|
|
17
|
+
/**
|
|
18
|
+
* Render instructions for lines are structured like so:
|
|
19
|
+
* [ x0, y0, customAttr0, ... , xN, yN, customAttrN ]
|
|
20
|
+
* @param {import("./MixedGeometryBatch.js").PointGeometryBatch} batch Point geometry batch
|
|
21
|
+
* @override
|
|
22
|
+
*/
|
|
23
|
+
override generateRenderInstructions(batch: import("./MixedGeometryBatch.js").PointGeometryBatch): void;
|
|
24
|
+
}
|
|
25
|
+
import AbstractBatchRenderer from "./BatchRenderer.js";
|
|
26
|
+
//# sourceMappingURL=PointBatchRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointBatchRenderer.d.ts","sourceRoot":"","sources":["../../src/render/webgl/PointBatchRenderer.js"],"names":[],"mappings":";;;;yBAWU,MAAM;;;;;;AAOhB;IAYI;;;;QAmBC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,kBAAkB,QAsC9D;CACF"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ol/render/webgl/PointBatchRenderer
|
|
3
|
+
*/
|
|
4
|
+
var __extends = (this && this.__extends) || (function () {
|
|
5
|
+
var extendStatics = function (d, b) {
|
|
6
|
+
extendStatics = Object.setPrototypeOf ||
|
|
7
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
8
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
9
|
+
return extendStatics(d, b);
|
|
10
|
+
};
|
|
11
|
+
return function (d, b) {
|
|
12
|
+
if (typeof b !== "function" && b !== null)
|
|
13
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
14
|
+
extendStatics(d, b);
|
|
15
|
+
function __() { this.constructor = d; }
|
|
16
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
17
|
+
};
|
|
18
|
+
})();
|
|
19
|
+
import AbstractBatchRenderer from './BatchRenderer.js';
|
|
20
|
+
import { AttributeType } from '../../webgl/Helper.js';
|
|
21
|
+
import { apply as applyTransform } from '../../transform.js';
|
|
22
|
+
/**
|
|
23
|
+
* Names of attributes made available to the vertex shader.
|
|
24
|
+
* Please note: changing these *will* break custom shaders!
|
|
25
|
+
* @enum {string}
|
|
26
|
+
*/
|
|
27
|
+
export var Attributes = {
|
|
28
|
+
POSITION: 'a_position',
|
|
29
|
+
INDEX: 'a_index',
|
|
30
|
+
};
|
|
31
|
+
var PointBatchRenderer = /** @class */ (function (_super) {
|
|
32
|
+
__extends(PointBatchRenderer, _super);
|
|
33
|
+
/**
|
|
34
|
+
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
|
35
|
+
* @param {Worker} worker WebGL worker instance
|
|
36
|
+
* @param {string} vertexShader Vertex shader
|
|
37
|
+
* @param {string} fragmentShader Fragment shader
|
|
38
|
+
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes List of custom attributes
|
|
39
|
+
*/
|
|
40
|
+
function PointBatchRenderer(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
|
41
|
+
var _this = _super.call(this, helper, worker, vertexShader, fragmentShader, customAttributes) || this;
|
|
42
|
+
// vertices for point must hold both a position (x,y) and an index (their position in the quad)
|
|
43
|
+
_this.attributes = [
|
|
44
|
+
{
|
|
45
|
+
name: Attributes.POSITION,
|
|
46
|
+
size: 2,
|
|
47
|
+
type: AttributeType.FLOAT,
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: Attributes.INDEX,
|
|
51
|
+
size: 1,
|
|
52
|
+
type: AttributeType.FLOAT,
|
|
53
|
+
},
|
|
54
|
+
].concat(customAttributes.map(function (attribute) {
|
|
55
|
+
return {
|
|
56
|
+
name: 'a_' + attribute.name,
|
|
57
|
+
size: 1,
|
|
58
|
+
type: AttributeType.FLOAT,
|
|
59
|
+
};
|
|
60
|
+
}));
|
|
61
|
+
return _this;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Render instructions for lines are structured like so:
|
|
65
|
+
* [ x0, y0, customAttr0, ... , xN, yN, customAttrN ]
|
|
66
|
+
* @param {import("./MixedGeometryBatch.js").PointGeometryBatch} batch Point geometry batch
|
|
67
|
+
* @override
|
|
68
|
+
*/
|
|
69
|
+
PointBatchRenderer.prototype.generateRenderInstructions = function (batch) {
|
|
70
|
+
// here we anticipate the amount of render instructions for points:
|
|
71
|
+
// 2 instructions per vertex for position (x and y)
|
|
72
|
+
// + 1 instruction per vertex per custom attributes
|
|
73
|
+
var totalInstructionsCount = (2 + this.customAttributes.length) * batch.geometriesCount;
|
|
74
|
+
if (!batch.renderInstructions ||
|
|
75
|
+
batch.renderInstructions.length !== totalInstructionsCount) {
|
|
76
|
+
batch.renderInstructions = new Float32Array(totalInstructionsCount);
|
|
77
|
+
}
|
|
78
|
+
// loop on features to fill the render instructions
|
|
79
|
+
var batchEntry;
|
|
80
|
+
var tmpCoords = [];
|
|
81
|
+
var renderIndex = 0;
|
|
82
|
+
var value;
|
|
83
|
+
for (var featureUid in batch.entries) {
|
|
84
|
+
batchEntry = batch.entries[featureUid];
|
|
85
|
+
for (var i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {
|
|
86
|
+
tmpCoords[0] = batchEntry.flatCoordss[i][0];
|
|
87
|
+
tmpCoords[1] = batchEntry.flatCoordss[i][1];
|
|
88
|
+
applyTransform(batch.renderInstructionsTransform, tmpCoords);
|
|
89
|
+
batch.renderInstructions[renderIndex++] = tmpCoords[0];
|
|
90
|
+
batch.renderInstructions[renderIndex++] = tmpCoords[1];
|
|
91
|
+
// pushing custom attributes
|
|
92
|
+
for (var j = 0, jj = this.customAttributes.length; j < jj; j++) {
|
|
93
|
+
value = this.customAttributes[j].callback(batchEntry.feature);
|
|
94
|
+
batch.renderInstructions[renderIndex++] = value;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
return PointBatchRenderer;
|
|
100
|
+
}(AbstractBatchRenderer));
|
|
101
|
+
export default PointBatchRenderer;
|
|
102
|
+
//# sourceMappingURL=PointBatchRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PointBatchRenderer.js","sourceRoot":"","sources":["../../src/render/webgl/PointBatchRenderer.js"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,OAAO,qBAAqB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,KAAK,IAAI,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,YAAY;IACtB,KAAK,EAAE,SAAS;CACjB,CAAC;AAEF;IAAiC,sCAAqB;IACpD;;;;;;OAMG;IACH,4BAAY,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB;QAA1E,YACE,kBAAM,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,SAuBtE;QArBC,+FAA+F;QAC/F,KAAI,CAAC,UAAU,GAAG;YAChB;gBACE,IAAI,EAAE,UAAU,CAAC,QAAQ;gBACzB,IAAI,EAAE,CAAC;gBACP,IAAI,EAAE,aAAa,CAAC,KAAK;aAC1B;YACD;gBACE,IAAI,EAAE,UAAU,CAAC,KAAK;gBACtB,IAAI,EAAE,CAAC;gBACP,IAAI,EAAE,aAAa,CAAC,KAAK;aAC1B;SACF,CAAC,MAAM,CACN,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,CAAC;gBAE7D,KAAK,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBACvD,KAAK,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;gBAEvD,4BAA4B;gBAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;oBAC9D,KAAK,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;oBAC9D,KAAK,CAAC,kBAAkB,CAAC,WAAW,EAAE,CAAC,GAAG,KAAK,CAAC;iBACjD;aACF;SACF;IACH,CAAC;IACH,yBAAC;AAAD,CAAC,AA5ED,CAAiC,qBAAqB,GA4ErD;AAED,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Names of attributes made available to the vertex shader.
|
|
3
|
+
* Please note: changing these *will* break custom shaders!
|
|
4
|
+
*/
|
|
5
|
+
export type Attributes = string;
|
|
6
|
+
export namespace Attributes {
|
|
7
|
+
const POSITION: string;
|
|
8
|
+
}
|
|
9
|
+
export default PolygonBatchRenderer;
|
|
10
|
+
declare class PolygonBatchRenderer extends AbstractBatchRenderer {
|
|
11
|
+
attributes: {
|
|
12
|
+
name: string;
|
|
13
|
+
size: number;
|
|
14
|
+
type: number;
|
|
15
|
+
}[];
|
|
16
|
+
/**
|
|
17
|
+
* Render instructions for polygons are structured like so:
|
|
18
|
+
* [ customAttr0, ..., customAttrN, numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, ..., xN, yN, numberOfRings,... ]
|
|
19
|
+
* @param {import("./MixedGeometryBatch.js").PolygonGeometryBatch} batch Polygon geometry batch
|
|
20
|
+
* @override
|
|
21
|
+
*/
|
|
22
|
+
override generateRenderInstructions(batch: import("./MixedGeometryBatch.js").PolygonGeometryBatch): void;
|
|
23
|
+
}
|
|
24
|
+
import AbstractBatchRenderer from "./BatchRenderer.js";
|
|
25
|
+
//# sourceMappingURL=PolygonBatchRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolygonBatchRenderer.d.ts","sourceRoot":"","sources":["../../src/render/webgl/PolygonBatchRenderer.js"],"names":[],"mappings":";;;;yBAUU,MAAM;;;;;AAMhB;IAYI;;;;QAcC;IAGH;;;;;OAKG;IACH,2CAHW,OAAO,yBAAyB,EAAE,oBAAoB,QAiEhE;CACF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __extends = (this && this.__extends) || (function () {
|
|
2
|
+
var extendStatics = function (d, b) {
|
|
3
|
+
extendStatics = Object.setPrototypeOf ||
|
|
4
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
+
return extendStatics(d, b);
|
|
7
|
+
};
|
|
8
|
+
return function (d, b) {
|
|
9
|
+
if (typeof b !== "function" && b !== null)
|
|
10
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
+
extendStatics(d, b);
|
|
12
|
+
function __() { this.constructor = d; }
|
|
13
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
+
};
|
|
15
|
+
})();
|
|
16
|
+
/**
|
|
17
|
+
* @module ol/render/webgl/PolygonBatchRenderer
|
|
18
|
+
*/
|
|
19
|
+
import AbstractBatchRenderer from './BatchRenderer.js';
|
|
20
|
+
import { AttributeType } from '../../webgl/Helper.js';
|
|
21
|
+
import { transform2D } from '../../geom/flat/transform.js';
|
|
22
|
+
/**
|
|
23
|
+
* Names of attributes made available to the vertex shader.
|
|
24
|
+
* Please note: changing these *will* break custom shaders!
|
|
25
|
+
* @enum {string}
|
|
26
|
+
*/
|
|
27
|
+
export var Attributes = {
|
|
28
|
+
POSITION: 'a_position',
|
|
29
|
+
};
|
|
30
|
+
var PolygonBatchRenderer = /** @class */ (function (_super) {
|
|
31
|
+
__extends(PolygonBatchRenderer, _super);
|
|
32
|
+
/**
|
|
33
|
+
* @param {import("../../webgl/Helper.js").default} helper WebGL helper instance
|
|
34
|
+
* @param {Worker} worker WebGL worker instance
|
|
35
|
+
* @param {string} vertexShader Vertex shader
|
|
36
|
+
* @param {string} fragmentShader Fragment shader
|
|
37
|
+
* @param {Array<import('./BatchRenderer.js').CustomAttribute>} customAttributes List of custom attributes
|
|
38
|
+
*/
|
|
39
|
+
function PolygonBatchRenderer(helper, worker, vertexShader, fragmentShader, customAttributes) {
|
|
40
|
+
var _this = _super.call(this, helper, worker, vertexShader, fragmentShader, customAttributes) || this;
|
|
41
|
+
// By default only a position attribute is required to render polygons
|
|
42
|
+
_this.attributes = [
|
|
43
|
+
{
|
|
44
|
+
name: Attributes.POSITION,
|
|
45
|
+
size: 2,
|
|
46
|
+
type: AttributeType.FLOAT,
|
|
47
|
+
},
|
|
48
|
+
].concat(customAttributes.map(function (attribute) {
|
|
49
|
+
return {
|
|
50
|
+
name: 'a_' + attribute.name,
|
|
51
|
+
size: 1,
|
|
52
|
+
type: AttributeType.FLOAT,
|
|
53
|
+
};
|
|
54
|
+
}));
|
|
55
|
+
return _this;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Render instructions for polygons are structured like so:
|
|
59
|
+
* [ customAttr0, ..., customAttrN, numberOfRings, numberOfVerticesInRing0, ..., numberOfVerticesInRingN, x0, y0, ..., xN, yN, numberOfRings,... ]
|
|
60
|
+
* @param {import("./MixedGeometryBatch.js").PolygonGeometryBatch} batch Polygon geometry batch
|
|
61
|
+
* @override
|
|
62
|
+
*/
|
|
63
|
+
PolygonBatchRenderer.prototype.generateRenderInstructions = function (batch) {
|
|
64
|
+
// here we anticipate the amount of render instructions for polygons:
|
|
65
|
+
// 2 instructions per vertex for position (x and y)
|
|
66
|
+
// + 1 instruction per polygon per custom attributes
|
|
67
|
+
// + 1 instruction per polygon (for vertices count in polygon)
|
|
68
|
+
// + 1 instruction per ring (for vertices count in ring)
|
|
69
|
+
var totalInstructionsCount = 2 * batch.verticesCount +
|
|
70
|
+
(1 + this.customAttributes.length) * batch.geometriesCount +
|
|
71
|
+
batch.ringsCount;
|
|
72
|
+
if (!batch.renderInstructions ||
|
|
73
|
+
batch.renderInstructions.length !== totalInstructionsCount) {
|
|
74
|
+
batch.renderInstructions = new Float32Array(totalInstructionsCount);
|
|
75
|
+
}
|
|
76
|
+
// loop on features to fill the render instructions
|
|
77
|
+
var batchEntry;
|
|
78
|
+
var flatCoords = [];
|
|
79
|
+
var renderIndex = 0;
|
|
80
|
+
var value;
|
|
81
|
+
for (var featureUid in batch.entries) {
|
|
82
|
+
batchEntry = batch.entries[featureUid];
|
|
83
|
+
for (var i = 0, ii = batchEntry.flatCoordss.length; i < ii; i++) {
|
|
84
|
+
flatCoords.length = batchEntry.flatCoordss[i].length;
|
|
85
|
+
transform2D(batchEntry.flatCoordss[i], 0, flatCoords.length, 2, batch.renderInstructionsTransform, flatCoords);
|
|
86
|
+
// custom attributes
|
|
87
|
+
for (var k = 0, kk = this.customAttributes.length; k < kk; k++) {
|
|
88
|
+
value = this.customAttributes[k].callback(batchEntry.feature);
|
|
89
|
+
batch.renderInstructions[renderIndex++] = value;
|
|
90
|
+
}
|
|
91
|
+
// ring count
|
|
92
|
+
batch.renderInstructions[renderIndex++] =
|
|
93
|
+
batchEntry.ringsVerticesCounts[i].length;
|
|
94
|
+
// vertices count in each ring
|
|
95
|
+
for (var j = 0, jj = batchEntry.ringsVerticesCounts[i].length; j < jj; j++) {
|
|
96
|
+
batch.renderInstructions[renderIndex++] =
|
|
97
|
+
batchEntry.ringsVerticesCounts[i][j];
|
|
98
|
+
}
|
|
99
|
+
// looping on points for positions
|
|
100
|
+
for (var j = 0, jj = flatCoords.length; j < jj; j += 2) {
|
|
101
|
+
batch.renderInstructions[renderIndex++] = flatCoords[j];
|
|
102
|
+
batch.renderInstructions[renderIndex++] = flatCoords[j + 1];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
return PolygonBatchRenderer;
|
|
108
|
+
}(AbstractBatchRenderer));
|
|
109
|
+
export default PolygonBatchRenderer;
|
|
110
|
+
//# sourceMappingURL=PolygonBatchRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PolygonBatchRenderer.js","sourceRoot":"","sources":["../../src/render/webgl/PolygonBatchRenderer.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;GAEG;AACH,OAAO,qBAAqB,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAC;AAEzD;;;;GAIG;AACH,MAAM,CAAC,IAAM,UAAU,GAAG;IACxB,QAAQ,EAAE,YAAY;CACvB,CAAC;AAEF;IAAmC,wCAAqB;IACtD;;;;;;OAMG;IACH,8BAAY,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB;QAA1E,YACE,kBAAM,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,gBAAgB,CAAC,SAkBtE;QAhBC,sEAAsE;QACtE,KAAI,CAAC,UAAU,GAAG;YAChB;gBACE,IAAI,EAAE,UAAU,CAAC,QAAQ;gBACzB,IAAI,EAAE,CAAC;gBACP,IAAI,EAAE,aAAa,CAAC,KAAK;aAC1B;SACF,CAAC,MAAM,CACN,gBAAgB,CAAC,GAAG,CAAC,UAAU,SAAS;YACtC,OAAO;gBACL,IAAI,EAAE,IAAI,GAAG,SAAS,CAAC,IAAI;gBAC3B,IAAI,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export namespace WebGLWorkerMessageType {
|
|
3
|
+
const GENERATE_POLYGON_BUFFERS: string;
|
|
4
|
+
const GENERATE_POINT_BUFFERS: string;
|
|
5
|
+
const GENERATE_LINE_STRING_BUFFERS: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* This message will trigger the generation of a vertex and an index buffer based on the given render instructions.
|
|
9
|
+
* When the buffers are generated, the worked will send a message of the same type to the main thread, with
|
|
10
|
+
* the generated buffers in it.
|
|
11
|
+
* Note that any addition properties present in the message *will* be sent back to the main thread.
|
|
12
|
+
*/
|
|
13
|
+
export type WebGLWorkerGenerateBuffersMessage = {
|
|
14
|
+
/**
|
|
15
|
+
* Message id; will be used both in request and response as a means of identification
|
|
16
|
+
*/
|
|
17
|
+
id: number;
|
|
18
|
+
/**
|
|
19
|
+
* Message type
|
|
20
|
+
*/
|
|
21
|
+
type: WebGLWorkerMessageType;
|
|
22
|
+
/**
|
|
23
|
+
* Polygon render instructions raw binary buffer.
|
|
24
|
+
*/
|
|
25
|
+
renderInstructions: ArrayBuffer;
|
|
26
|
+
/**
|
|
27
|
+
* Amount of custom attributes count in the polygon render instructions.
|
|
28
|
+
*/
|
|
29
|
+
customAttributesCount?: number | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Vertices array raw binary buffer (sent by the worker).
|
|
32
|
+
*/
|
|
33
|
+
vertexBuffer?: ArrayBuffer | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Indices array raw binary buffer (sent by the worker).
|
|
36
|
+
*/
|
|
37
|
+
indexBuffer?: ArrayBuffer | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Transformation matrix used to project the instructions coordinates
|
|
40
|
+
*/
|
|
41
|
+
renderInstructionsTransform?: number[] | undefined;
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/render/webgl/constants.js"],"names":[],"mappings":"qCAKU,MAAM;;;;;;;;;;;;;;;;QAcF,MAAM;;;;UACN,sBAAsB;;;;wBACtB,WAAW"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ol/render/webgl/constants
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @enum {string}
|
|
6
|
+
*/
|
|
7
|
+
export var WebGLWorkerMessageType = {
|
|
8
|
+
GENERATE_POLYGON_BUFFERS: 'GENERATE_POLYGON_BUFFERS',
|
|
9
|
+
GENERATE_POINT_BUFFERS: 'GENERATE_POINT_BUFFERS',
|
|
10
|
+
GENERATE_LINE_STRING_BUFFERS: 'GENERATE_LINE_STRING_BUFFERS',
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {Object} WebGLWorkerGenerateBuffersMessage
|
|
14
|
+
* This message will trigger the generation of a vertex and an index buffer based on the given render instructions.
|
|
15
|
+
* When the buffers are generated, the worked will send a message of the same type to the main thread, with
|
|
16
|
+
* the generated buffers in it.
|
|
17
|
+
* Note that any addition properties present in the message *will* be sent back to the main thread.
|
|
18
|
+
* @property {number} id Message id; will be used both in request and response as a means of identification
|
|
19
|
+
* @property {WebGLWorkerMessageType} type Message type
|
|
20
|
+
* @property {ArrayBuffer} renderInstructions Polygon render instructions raw binary buffer.
|
|
21
|
+
* @property {number} [customAttributesCount] Amount of custom attributes count in the polygon render instructions.
|
|
22
|
+
* @property {ArrayBuffer} [vertexBuffer] Vertices array raw binary buffer (sent by the worker).
|
|
23
|
+
* @property {ArrayBuffer} [indexBuffer] Indices array raw binary buffer (sent by the worker).
|
|
24
|
+
* @property {import("../../transform").Transform} [renderInstructionsTransform] Transformation matrix used to project the instructions coordinates
|
|
25
|
+
*/
|
|
26
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/render/webgl/constants.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,CAAC,IAAM,sBAAsB,GAAG;IACpC,wBAAwB,EAAE,0BAA0B;IACpD,sBAAsB,EAAE,wBAAwB;IAChD,4BAA4B,EAAE,8BAA8B;CAC7D,CAAC;AAEF;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pushes a quad (two triangles) based on a point geometry
|
|
3
|
+
* @param {Float32Array} instructions Array of render instructions for points.
|
|
4
|
+
* @param {number} elementIndex Index from which render instructions will be read.
|
|
5
|
+
* @param {Float32Array} vertexBuffer Buffer in the form of a typed array.
|
|
6
|
+
* @param {Uint32Array} indexBuffer Buffer in the form of a typed array.
|
|
7
|
+
* @param {number} customAttributesCount Amount of custom attributes for each element.
|
|
8
|
+
* @param {BufferPositions} [bufferPositions] Buffer write positions; if not specified, positions will be set at 0.
|
|
9
|
+
* @return {BufferPositions} New buffer positions where to write next
|
|
10
|
+
* @property {number} vertexPosition New position in the vertex buffer where future writes should start.
|
|
11
|
+
* @property {number} indexPosition New position in the index buffer where future writes should start.
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
export function writePointFeatureToBuffers(instructions: Float32Array, elementIndex: number, vertexBuffer: Float32Array, indexBuffer: Uint32Array, customAttributesCount: number, bufferPositions?: BufferPositions | undefined): BufferPositions;
|
|
15
|
+
/**
|
|
16
|
+
* Pushes a single quad to form a line segment; also includes a computation for the join angles with previous and next
|
|
17
|
+
* segment, in order to be able to offset the vertices correctly in the shader
|
|
18
|
+
* @param {Float32Array} instructions Array of render instructions for lines.
|
|
19
|
+
* @param {number} segmentStartIndex Index of the segment start point from which render instructions will be read.
|
|
20
|
+
* @param {number} segmentEndIndex Index of the segment start point from which render instructions will be read.
|
|
21
|
+
* @param {number|null} beforeSegmentIndex Index of the point right before the segment (null if none, e.g this is a line start)
|
|
22
|
+
* @param {number|null} afterSegmentIndex Index of the point right after the segment (null if none, e.g this is a line end)
|
|
23
|
+
* @param {Array<number>} vertexArray Array containing vertices.
|
|
24
|
+
* @param {Array<number>} indexArray Array containing indices.
|
|
25
|
+
* @param {Array<number>} customAttributes Array of custom attributes value
|
|
26
|
+
* @param {import('../../transform.js').Transform} instructionsTransform Transform matrix used to project coordinates in instructions
|
|
27
|
+
* @param {import('../../transform.js').Transform} invertInstructionsTransform Transform matrix used to project coordinates in instructions
|
|
28
|
+
* @private
|
|
29
|
+
*/
|
|
30
|
+
export function writeLineSegmentToBuffers(instructions: Float32Array, segmentStartIndex: number, segmentEndIndex: number, beforeSegmentIndex: number | null, afterSegmentIndex: number | null, vertexArray: Array<number>, indexArray: Array<number>, customAttributes: Array<number>, instructionsTransform: import('../../transform.js').Transform, invertInstructionsTransform: import('../../transform.js').Transform): void;
|
|
31
|
+
/**
|
|
32
|
+
* Pushes several triangles to form a polygon, including holes
|
|
33
|
+
* @param {Float32Array} instructions Array of render instructions for lines.
|
|
34
|
+
* @param {number} polygonStartIndex Index of the polygon start point from which render instructions will be read.
|
|
35
|
+
* @param {Array<number>} vertexArray Array containing vertices.
|
|
36
|
+
* @param {Array<number>} indexArray Array containing indices.
|
|
37
|
+
* @param {number} customAttributesCount Amount of custom attributes for each element.
|
|
38
|
+
* @return {number} Next polygon instructions index
|
|
39
|
+
* @private
|
|
40
|
+
*/
|
|
41
|
+
export function writePolygonTrianglesToBuffers(instructions: Float32Array, polygonStartIndex: number, vertexArray: Array<number>, indexArray: Array<number>, customAttributesCount: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a texture of 1x1 pixel, white
|
|
44
|
+
* @private
|
|
45
|
+
* @return {ImageData} Image data.
|
|
46
|
+
*/
|
|
47
|
+
export function getBlankImageData(): ImageData;
|
|
48
|
+
/**
|
|
49
|
+
* Generates a color array based on a numerical id
|
|
50
|
+
* Note: the range for each component is 0 to 1 with 256 steps
|
|
51
|
+
* @param {number} id Id
|
|
52
|
+
* @param {Array<number>} [opt_array] Reusable array
|
|
53
|
+
* @return {Array<number>} Color array containing the encoded id
|
|
54
|
+
*/
|
|
55
|
+
export function colorEncodeId(id: number, opt_array?: number[] | undefined): Array<number>;
|
|
56
|
+
/**
|
|
57
|
+
* Reads an id from a color-encoded array
|
|
58
|
+
* Note: the expected range for each component is 0 to 1 with 256 steps.
|
|
59
|
+
* @param {Array<number>} color Color array containing the encoded id
|
|
60
|
+
* @return {number} Decoded id
|
|
61
|
+
*/
|
|
62
|
+
export function colorDecodeId(color: Array<number>): number;
|
|
63
|
+
/**
|
|
64
|
+
* An object holding positions both in an index and a vertex buffer.
|
|
65
|
+
*/
|
|
66
|
+
export type BufferPositions = {
|
|
67
|
+
/**
|
|
68
|
+
* Position in the vertex buffer
|
|
69
|
+
*/
|
|
70
|
+
vertexPosition: number;
|
|
71
|
+
/**
|
|
72
|
+
* Position in the index buffer
|
|
73
|
+
*/
|
|
74
|
+
indexPosition: number;
|
|
75
|
+
};
|
|
76
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/render/webgl/utils.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;GAYG;AACH,yDAXW,YAAY,gBACZ,MAAM,gBACN,YAAY,eACZ,WAAW,yBACX,MAAM,kDAEL,eAAe,CAgE1B;AAED;;;;;;;;;;;;;;GAcG;AACH,wDAZW,YAAY,qBACZ,MAAM,mBACN,MAAM,sBACN,MAAM,GAAC,IAAI,qBACX,MAAM,GAAC,IAAI,eACX,MAAM,MAAM,CAAC,cACb,MAAM,MAAM,CAAC,oBACb,MAAM,MAAM,CAAC,yBACb,OAAO,oBAAoB,EAAE,SAAS,+BACtC,OAAO,oBAAoB,EAAE,SAAS,QA4IhD;AAED;;;;;;;;;GASG;AACH,6DARW,YAAY,qBACZ,MAAM,eACN,MAAM,MAAM,CAAC,cACb,MAAM,MAAM,CAAC,yBACb,MAAM,GACL,MAAM,CA0CjB;AAED;;;;GAIG;AACH,qCAFY,SAAS,CAUpB;AAED;;;;;;GAMG;AACH,kCAJW,MAAM,qCAEL,MAAM,MAAM,CAAC,CAWxB;AAED;;;;;GAKG;AACH,qCAHW,MAAM,MAAM,CAAC,GACZ,MAAM,CAWjB;;;;;;;;oBAlVa,MAAM;;;;mBACN,MAAM"}
|