ol 10.1.1-dev.1724296077041 → 10.1.1-dev.1724415449548
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 +4 -0
- package/dist/ol.d.ts.map +1 -1
- package/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/layer/Flow.d.ts +199 -0
- package/layer/Flow.d.ts.map +1 -0
- package/layer/Flow.js +504 -0
- package/layer/WebGLTile.d.ts +5 -1
- package/layer/WebGLTile.d.ts.map +1 -1
- package/package.json +1 -1
- package/renderer/webgl/FlowLayer.d.ts +247 -0
- package/renderer/webgl/FlowLayer.d.ts.map +1 -0
- package/renderer/webgl/FlowLayer.js +496 -0
- package/renderer/webgl/TileLayer.d.ts +7 -5
- package/renderer/webgl/TileLayer.d.ts.map +1 -1
- package/renderer/webgl/TileLayer.js +14 -3
- package/renderer/webgl/TileLayerBase.d.ts +5 -0
- package/renderer/webgl/TileLayerBase.d.ts.map +1 -1
- package/renderer/webgl/TileLayerBase.js +9 -0
- package/util.js +1 -1
- package/webgl/Buffer.d.ts +5 -1
- package/webgl/Buffer.d.ts.map +1 -1
- package/webgl/Buffer.js +12 -1
- package/webgl/Helper.d.ts +22 -5
- package/webgl/Helper.d.ts.map +1 -1
- package/webgl/Helper.js +80 -13
- package/webgl/PostProcessingPass.d.ts +3 -0
- package/webgl/PostProcessingPass.d.ts.map +1 -1
- package/webgl/PostProcessingPass.js +7 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module ol/renderer/webgl/FlowLayer
|
|
3
|
+
*/
|
|
4
|
+
import WebGLArrayBuffer from '../../webgl/Buffer.js';
|
|
5
|
+
import WebGLTileLayerRenderer from './TileLayer.js';
|
|
6
|
+
import {ARRAY_BUFFER, STATIC_DRAW} from '../../webgl.js';
|
|
7
|
+
import {DefaultUniform} from '../../webgl/Helper.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {import("../../layer/Flow.js").default} LayerType
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {Object} Options
|
|
15
|
+
* @property {number} maxSpeed The maximum particle speed in the input data.
|
|
16
|
+
* @property {number} [speedFactor=0.001] A larger factor increases the rate at which particles cross the screen.
|
|
17
|
+
* @property {number} [particles=65536] The number of particles to render.
|
|
18
|
+
* @property {number} [cacheSize=512] The texture cache size.
|
|
19
|
+
* @property {string} tileVertexShader The flow tile vertex shader.
|
|
20
|
+
* @property {string} tileFragmentShader The flow tile fragment shader.
|
|
21
|
+
* @property {string} textureVertexShader Generic texture fragment shader.
|
|
22
|
+
* @property {string} textureFragmentShader Generic texture fragment shader.
|
|
23
|
+
* @property {string} particlePositionVertexShader The particle position vertex shader.
|
|
24
|
+
* @property {string} particlePositionFragmentShader The particle position fragment shader.
|
|
25
|
+
* @property {string} particleColorVertexShader The particle color vertex shader.
|
|
26
|
+
* @property {string} particleColorFragmentShader The particle color fragment shader.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Shader uniforms.
|
|
31
|
+
* @enum {string}
|
|
32
|
+
*/
|
|
33
|
+
export const U = {
|
|
34
|
+
TEXTURE: 'u_texture',
|
|
35
|
+
VELOCITY_TEXTURE: 'u_velocityTexture',
|
|
36
|
+
POSITION_TEXTURE: 'u_positionTexture',
|
|
37
|
+
PARTICLE_COUNT_SQRT: 'u_particleCountSqrt',
|
|
38
|
+
MAX_SPEED: 'u_maxSpeed',
|
|
39
|
+
GAIN: 'u_gain',
|
|
40
|
+
OFFSET: 'u_offset',
|
|
41
|
+
IS_FLOAT: 'u_isFloat',
|
|
42
|
+
RANDOM_SEED: 'u_randomSeed',
|
|
43
|
+
SPEED_FACTOR: 'u_speedFactor',
|
|
44
|
+
DROP_RATE: 'u_dropRate',
|
|
45
|
+
DROP_RATE_BUMP: 'u_dropRateBump',
|
|
46
|
+
OPACITY: 'u_opacity',
|
|
47
|
+
ROTATION: DefaultUniform.ROTATION,
|
|
48
|
+
VIEWPORT_SIZE_PX: DefaultUniform.VIEWPORT_SIZE_PX,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Shader attributes.
|
|
53
|
+
* @enum {string}
|
|
54
|
+
*/
|
|
55
|
+
export const A = {
|
|
56
|
+
POSITION: 'a_position',
|
|
57
|
+
INDEX: 'a_index',
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Shader varyings.
|
|
62
|
+
* @enum {string}
|
|
63
|
+
*/
|
|
64
|
+
export const V = {
|
|
65
|
+
POSITION: 'v_position',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @classdesc
|
|
70
|
+
* Experimental WebGL renderer for vector fields.
|
|
71
|
+
* @extends {WebGLTileLayerRenderer<LayerType>}
|
|
72
|
+
*/
|
|
73
|
+
class FlowLayerRenderer extends WebGLTileLayerRenderer {
|
|
74
|
+
/**
|
|
75
|
+
* @param {LayerType} layer The tiled field layer.
|
|
76
|
+
* @param {Options} options The renderer options.
|
|
77
|
+
*/
|
|
78
|
+
constructor(layer, options) {
|
|
79
|
+
super(layer, {
|
|
80
|
+
vertexShader: options.tileVertexShader,
|
|
81
|
+
fragmentShader: options.tileFragmentShader,
|
|
82
|
+
cacheSize: options.cacheSize,
|
|
83
|
+
// TODO: rework the post-processing logic
|
|
84
|
+
// see https://github.com/openlayers/openlayers/issues/16120
|
|
85
|
+
postProcesses: [{}],
|
|
86
|
+
uniforms: {
|
|
87
|
+
[U.MAX_SPEED]: options.maxSpeed,
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* @type {string}
|
|
93
|
+
* @private
|
|
94
|
+
*/
|
|
95
|
+
this.particleColorFragmentShader_ = options.particleColorFragmentShader;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @type {WebGLTexture|null}
|
|
99
|
+
* @private
|
|
100
|
+
*/
|
|
101
|
+
this.velocityTexture_ = null;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @type {number}
|
|
105
|
+
* @private
|
|
106
|
+
*/
|
|
107
|
+
this.particleCountSqrt_ = options.particles
|
|
108
|
+
? Math.ceil(Math.sqrt(options.particles))
|
|
109
|
+
: 256;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @type {WebGLArrayBuffer}
|
|
113
|
+
* @private
|
|
114
|
+
*/
|
|
115
|
+
this.particleIndexBuffer_;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* @type {WebGLArrayBuffer}
|
|
119
|
+
* @private
|
|
120
|
+
*/
|
|
121
|
+
this.quadBuffer_;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @type {WebGLProgram}
|
|
125
|
+
* @private
|
|
126
|
+
*/
|
|
127
|
+
this.particlePositionProgram_;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* @type {string}
|
|
131
|
+
* @private
|
|
132
|
+
*/
|
|
133
|
+
this.particlePositionVertexShader_ = options.particlePositionVertexShader;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @type {string}
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
this.particlePositionFragmentShader_ =
|
|
140
|
+
options.particlePositionFragmentShader;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* @type {WebGLTexture}
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
this.previousPositionTexture_;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @type {WebGLTexture}
|
|
150
|
+
* @private
|
|
151
|
+
*/
|
|
152
|
+
this.nextPositionTexture_;
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @type {WebGLProgram}
|
|
156
|
+
* @private
|
|
157
|
+
*/
|
|
158
|
+
this.particleColorProgram_;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @type {string}
|
|
162
|
+
* @private
|
|
163
|
+
*/
|
|
164
|
+
this.particleColorVertexShader_ = options.particleColorVertexShader;
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @type {string}
|
|
168
|
+
* @private
|
|
169
|
+
*/
|
|
170
|
+
this.particleColorFragmentShader_ = options.particleColorFragmentShader;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* @type {WebGLProgram}
|
|
174
|
+
* @private
|
|
175
|
+
*/
|
|
176
|
+
this.textureProgram_;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @type {string}
|
|
180
|
+
* @private
|
|
181
|
+
*/
|
|
182
|
+
this.textureVertexShader_ = options.textureVertexShader;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* @type {string}
|
|
186
|
+
* @private
|
|
187
|
+
*/
|
|
188
|
+
this.textureFragmentShader_ = options.textureFragmentShader;
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* @type {WebGLTexture}
|
|
192
|
+
* @private
|
|
193
|
+
*/
|
|
194
|
+
this.previousTrailsTexture_;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @type {WebGLTexture}
|
|
198
|
+
* @private
|
|
199
|
+
*/
|
|
200
|
+
this.nextTrailsTexture_;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* @type {number}
|
|
204
|
+
* @private
|
|
205
|
+
*/
|
|
206
|
+
this.fadeOpacity_ = 0.996; // how fast the particle trails fade on each frame
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @type {number}
|
|
210
|
+
* @private
|
|
211
|
+
*/
|
|
212
|
+
this.maxSpeed_ = options.maxSpeed;
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @type {number}
|
|
216
|
+
* @private
|
|
217
|
+
*/
|
|
218
|
+
this.speedFactor_ = options.speedFactor || 0.001;
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* @type {number}
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
this.dropRate_ = 0.003; // how often the particles move to a random place
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* @type {number}
|
|
228
|
+
* @private
|
|
229
|
+
*/
|
|
230
|
+
this.dropRateBump_ = 0.01; // drop rate increase relative to individual particle speed
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @type {Array<number>}
|
|
234
|
+
* @private
|
|
235
|
+
*/
|
|
236
|
+
this.tempVec2_ = [0, 0];
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @type {number}
|
|
240
|
+
* @private
|
|
241
|
+
*/
|
|
242
|
+
this.renderedWidth_ = 0;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* @type {number}
|
|
246
|
+
* @private
|
|
247
|
+
*/
|
|
248
|
+
this.renderedHeight_ = 0;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* @override
|
|
253
|
+
*/
|
|
254
|
+
afterHelperCreated() {
|
|
255
|
+
super.afterHelperCreated();
|
|
256
|
+
const helper = this.helper;
|
|
257
|
+
|
|
258
|
+
const gl = helper.getGL();
|
|
259
|
+
this.framebuffer_ = gl.createFramebuffer();
|
|
260
|
+
|
|
261
|
+
const particleCount = this.particleCountSqrt_ * this.particleCountSqrt_;
|
|
262
|
+
const particleIndices = new Float32Array(particleCount);
|
|
263
|
+
for (let i = 0; i < particleCount; ++i) {
|
|
264
|
+
particleIndices[i] = i;
|
|
265
|
+
}
|
|
266
|
+
const particleIndexBuffer = new WebGLArrayBuffer(ARRAY_BUFFER, STATIC_DRAW);
|
|
267
|
+
particleIndexBuffer.setArray(particleIndices);
|
|
268
|
+
helper.flushBufferData(particleIndexBuffer);
|
|
269
|
+
this.particleIndexBuffer_ = particleIndexBuffer;
|
|
270
|
+
|
|
271
|
+
const quadIndices = new Float32Array([0, 0, 1, 0, 0, 1, 0, 1, 1, 0, 1, 1]);
|
|
272
|
+
const quadBuffer = new WebGLArrayBuffer(ARRAY_BUFFER, STATIC_DRAW);
|
|
273
|
+
quadBuffer.setArray(quadIndices);
|
|
274
|
+
helper.flushBufferData(quadBuffer);
|
|
275
|
+
this.quadBuffer_ = quadBuffer;
|
|
276
|
+
|
|
277
|
+
const particlePositions = new Uint8Array(particleCount * 4);
|
|
278
|
+
for (let i = 0; i < particlePositions.length; ++i) {
|
|
279
|
+
particlePositions[i] = Math.floor(Math.random() * 256);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
this.previousPositionTexture_ = helper.createTexture(
|
|
283
|
+
[this.particleCountSqrt_, this.particleCountSqrt_],
|
|
284
|
+
particlePositions,
|
|
285
|
+
null,
|
|
286
|
+
true,
|
|
287
|
+
);
|
|
288
|
+
|
|
289
|
+
this.nextPositionTexture_ = helper.createTexture(
|
|
290
|
+
[this.particleCountSqrt_, this.particleCountSqrt_],
|
|
291
|
+
particlePositions,
|
|
292
|
+
null,
|
|
293
|
+
true,
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
this.particlePositionProgram_ = helper.getProgram(
|
|
297
|
+
this.particlePositionFragmentShader_,
|
|
298
|
+
this.particlePositionVertexShader_,
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
this.particleColorProgram_ = helper.getProgram(
|
|
302
|
+
this.particleColorFragmentShader_,
|
|
303
|
+
this.particleColorVertexShader_,
|
|
304
|
+
);
|
|
305
|
+
|
|
306
|
+
this.textureProgram_ = helper.getProgram(
|
|
307
|
+
this.textureFragmentShader_,
|
|
308
|
+
this.textureVertexShader_,
|
|
309
|
+
);
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
createSizeDependentTextures_() {
|
|
313
|
+
const helper = this.helper;
|
|
314
|
+
const gl = helper.getGL();
|
|
315
|
+
const canvas = helper.getCanvas();
|
|
316
|
+
const screenWidth = canvas.width;
|
|
317
|
+
const screenHeight = canvas.height;
|
|
318
|
+
|
|
319
|
+
const blank = new Uint8Array(screenWidth * screenHeight * 4);
|
|
320
|
+
|
|
321
|
+
if (this.nextTrailsTexture_) {
|
|
322
|
+
gl.deleteTexture(this.nextTrailsTexture_);
|
|
323
|
+
}
|
|
324
|
+
this.nextTrailsTexture_ = helper.createTexture(
|
|
325
|
+
[screenWidth, screenHeight],
|
|
326
|
+
blank,
|
|
327
|
+
null,
|
|
328
|
+
true,
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
if (this.previousTrailsTexture_) {
|
|
332
|
+
gl.deleteTexture(this.previousTrailsTexture_);
|
|
333
|
+
}
|
|
334
|
+
this.previousTrailsTexture_ = helper.createTexture(
|
|
335
|
+
[screenWidth, screenHeight],
|
|
336
|
+
blank,
|
|
337
|
+
null,
|
|
338
|
+
true,
|
|
339
|
+
);
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @override
|
|
344
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
345
|
+
*/
|
|
346
|
+
beforeFinalize(frameState) {
|
|
347
|
+
const helper = this.helper;
|
|
348
|
+
const gl = helper.getGL();
|
|
349
|
+
const canvas = helper.getCanvas();
|
|
350
|
+
const screenWidth = canvas.width;
|
|
351
|
+
const screenHeight = canvas.height;
|
|
352
|
+
|
|
353
|
+
if (
|
|
354
|
+
this.renderedWidth_ != screenWidth ||
|
|
355
|
+
this.renderedHeight_ != screenHeight
|
|
356
|
+
) {
|
|
357
|
+
this.createSizeDependentTextures_();
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
const size = [screenWidth, screenHeight];
|
|
361
|
+
|
|
362
|
+
// copy current frame buffer to the velocity texture
|
|
363
|
+
this.velocityTexture_ = helper.createTexture(
|
|
364
|
+
size,
|
|
365
|
+
null,
|
|
366
|
+
this.velocityTexture_,
|
|
367
|
+
);
|
|
368
|
+
gl.copyTexImage2D(
|
|
369
|
+
gl.TEXTURE_2D,
|
|
370
|
+
0,
|
|
371
|
+
gl.RGBA,
|
|
372
|
+
0,
|
|
373
|
+
0,
|
|
374
|
+
screenWidth,
|
|
375
|
+
screenHeight,
|
|
376
|
+
0,
|
|
377
|
+
);
|
|
378
|
+
|
|
379
|
+
this.drawParticleTrails_(frameState);
|
|
380
|
+
this.updateParticlePositions_(frameState);
|
|
381
|
+
|
|
382
|
+
frameState.animate = true;
|
|
383
|
+
this.renderedWidth_ = screenWidth;
|
|
384
|
+
this.renderedHeight_ = screenHeight;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
389
|
+
*/
|
|
390
|
+
drawParticleTrails_(frameState) {
|
|
391
|
+
const helper = this.helper;
|
|
392
|
+
const gl = helper.getGL();
|
|
393
|
+
|
|
394
|
+
helper.bindFrameBuffer(this.framebuffer_, this.nextTrailsTexture_);
|
|
395
|
+
|
|
396
|
+
this.drawTexture_(this.previousTrailsTexture_, this.fadeOpacity_);
|
|
397
|
+
this.drawParticleColor_(frameState);
|
|
398
|
+
|
|
399
|
+
helper.bindInitialFrameBuffer();
|
|
400
|
+
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
401
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
402
|
+
|
|
403
|
+
gl.enable(gl.BLEND);
|
|
404
|
+
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
405
|
+
this.drawTexture_(this.nextTrailsTexture_, 1);
|
|
406
|
+
gl.disable(gl.BLEND);
|
|
407
|
+
|
|
408
|
+
const current = this.nextTrailsTexture_;
|
|
409
|
+
this.nextTrailsTexture_ = this.previousTrailsTexture_;
|
|
410
|
+
this.previousTrailsTexture_ = current;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
|
+
* @param {WebGLTexture} texture The texture to draw.
|
|
415
|
+
* @param {number} opacity The opacity.
|
|
416
|
+
*/
|
|
417
|
+
drawTexture_(texture, opacity) {
|
|
418
|
+
const helper = this.helper;
|
|
419
|
+
const gl = helper.getGL();
|
|
420
|
+
|
|
421
|
+
helper.useProgram(this.textureProgram_);
|
|
422
|
+
helper.bindTexture(texture, 0, U.TEXTURE);
|
|
423
|
+
helper.bindAttribute(this.quadBuffer_, A.POSITION, 2);
|
|
424
|
+
this.helper.setUniformFloatValue(U.OPACITY, opacity);
|
|
425
|
+
|
|
426
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
431
|
+
*/
|
|
432
|
+
drawParticleColor_(frameState) {
|
|
433
|
+
const helper = this.helper;
|
|
434
|
+
const gl = helper.getGL();
|
|
435
|
+
|
|
436
|
+
helper.useProgram(this.particleColorProgram_);
|
|
437
|
+
|
|
438
|
+
const particleCount = this.particleCountSqrt_ * this.particleCountSqrt_;
|
|
439
|
+
|
|
440
|
+
helper.bindAttribute(this.particleIndexBuffer_, A.INDEX, 1);
|
|
441
|
+
|
|
442
|
+
helper.bindTexture(this.previousPositionTexture_, 0, U.POSITION_TEXTURE);
|
|
443
|
+
helper.bindTexture(this.velocityTexture_, 1, U.VELOCITY_TEXTURE);
|
|
444
|
+
|
|
445
|
+
this.helper.setUniformFloatValue(
|
|
446
|
+
U.PARTICLE_COUNT_SQRT,
|
|
447
|
+
this.particleCountSqrt_,
|
|
448
|
+
);
|
|
449
|
+
|
|
450
|
+
const rotation = this.tempVec2_;
|
|
451
|
+
rotation[0] = Math.cos(frameState.viewState.rotation);
|
|
452
|
+
rotation[1] = Math.sin(frameState.viewState.rotation);
|
|
453
|
+
this.helper.setUniformFloatVec2(U.ROTATION, rotation);
|
|
454
|
+
|
|
455
|
+
this.helper.setUniformFloatValue(U.MAX_SPEED, this.maxSpeed_);
|
|
456
|
+
|
|
457
|
+
gl.drawArrays(gl.POINTS, 0, particleCount);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
462
|
+
*/
|
|
463
|
+
updateParticlePositions_(frameState) {
|
|
464
|
+
const helper = this.helper;
|
|
465
|
+
const gl = helper.getGL();
|
|
466
|
+
|
|
467
|
+
helper.useProgram(this.particlePositionProgram_);
|
|
468
|
+
gl.viewport(0, 0, this.particleCountSqrt_, this.particleCountSqrt_);
|
|
469
|
+
helper.bindFrameBuffer(this.framebuffer_, this.nextPositionTexture_);
|
|
470
|
+
|
|
471
|
+
helper.bindTexture(this.previousPositionTexture_, 0, U.POSITION_TEXTURE);
|
|
472
|
+
helper.bindTexture(this.velocityTexture_, 1, U.VELOCITY_TEXTURE);
|
|
473
|
+
helper.bindAttribute(this.quadBuffer_, A.POSITION, 2);
|
|
474
|
+
|
|
475
|
+
helper.setUniformFloatValue(U.RANDOM_SEED, Math.random());
|
|
476
|
+
helper.setUniformFloatValue(U.SPEED_FACTOR, this.speedFactor_);
|
|
477
|
+
helper.setUniformFloatValue(U.DROP_RATE, this.dropRate_);
|
|
478
|
+
helper.setUniformFloatValue(U.DROP_RATE_BUMP, this.dropRateBump_);
|
|
479
|
+
|
|
480
|
+
const rotation = this.tempVec2_;
|
|
481
|
+
rotation[0] = Math.cos(frameState.viewState.rotation);
|
|
482
|
+
rotation[1] = Math.sin(frameState.viewState.rotation);
|
|
483
|
+
this.helper.setUniformFloatVec2(U.ROTATION, rotation);
|
|
484
|
+
|
|
485
|
+
const size = frameState.size;
|
|
486
|
+
this.helper.setUniformFloatVec2(U.VIEWPORT_SIZE_PX, [size[0], size[1]]);
|
|
487
|
+
|
|
488
|
+
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
|
489
|
+
|
|
490
|
+
const current = this.nextPositionTexture_;
|
|
491
|
+
this.nextPositionTexture_ = this.previousPositionTexture_;
|
|
492
|
+
this.previousPositionTexture_ = current;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
export default FlowLayerRenderer;
|
|
@@ -44,8 +44,11 @@ export type Options = {
|
|
|
44
44
|
* The texture cache size.
|
|
45
45
|
*/
|
|
46
46
|
cacheSize?: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Post-processes definitions.
|
|
49
|
+
*/
|
|
50
|
+
postProcesses?: import("./Layer.js").PostProcessesOptions[] | undefined;
|
|
47
51
|
};
|
|
48
|
-
export type LayerType = import("../../layer/WebGLTile.js").default;
|
|
49
52
|
export type TileTextureType = import("../../webgl/TileTexture.js").TileType;
|
|
50
53
|
export type TileTextureRepresentation = import("../../webgl/TileTexture.js").default;
|
|
51
54
|
/**
|
|
@@ -56,9 +59,7 @@ export type TileTextureRepresentation = import("../../webgl/TileTexture.js").def
|
|
|
56
59
|
* made available to shaders.
|
|
57
60
|
* @property {Array<import("../../webgl/PaletteTexture.js").default>} [paletteTextures] Palette textures.
|
|
58
61
|
* @property {number} [cacheSize=512] The texture cache size.
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* @typedef {import("../../layer/WebGLTile.js").default} LayerType
|
|
62
|
+
* @property {Array<import('./Layer.js').PostProcessesOptions>} [postProcesses] Post-processes definitions.
|
|
62
63
|
*/
|
|
63
64
|
/**
|
|
64
65
|
* @typedef {import("../../webgl/TileTexture.js").TileType} TileTextureType
|
|
@@ -69,10 +70,11 @@ export type TileTextureRepresentation = import("../../webgl/TileTexture.js").def
|
|
|
69
70
|
/**
|
|
70
71
|
* @classdesc
|
|
71
72
|
* WebGL renderer for tile layers.
|
|
73
|
+
* @template {import("../../layer/WebGLTile.js").default|import("../../layer/Flow.js").default} LayerType
|
|
72
74
|
* @extends {WebGLBaseTileLayerRenderer<LayerType, TileTextureType, TileTextureRepresentation>}
|
|
73
75
|
* @api
|
|
74
76
|
*/
|
|
75
|
-
declare class WebGLTileLayerRenderer extends
|
|
77
|
+
declare class WebGLTileLayerRenderer<LayerType extends import("../../layer/WebGLTile.js").default | import("../../layer/Flow.js").default> extends WebGLBaseTileLayerRenderer<LayerType, import("../../webgl/TileTexture.js").TileType, TileTexture> {
|
|
76
78
|
/**
|
|
77
79
|
* @param {LayerType} tileLayer Tile layer.
|
|
78
80
|
* @param {Options} options Options.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;EAQE;;;;;;;;;kBAmBY,MAAM;;;;oBACN,MAAM
|
|
1
|
+
{"version":3,"file":"TileLayer.d.ts","sourceRoot":"","sources":["TileLayer.js"],"names":[],"mappings":"AAwBA;;;;;;;;;;;;;;;;;EAQE;;;;;;;;;kBAmBY,MAAM;;;;oBACN,MAAM;;;;;;;;;;;;;;;;;;;;;8BASP,OAAO,4BAA4B,EAAE,QAAQ;wCAI7C,OAAO,4BAA4B,EAAE,OAAO;AAhBzD;;;;;;;;;GASG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;;;GAMG;AACH,qCAJgG,SAAS,SAA3F,OAAO,0BAA0B,EAAE,OAAO,GAAC,OAAO,qBAAqB,EAAE,OAAQ;IAK7F;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EA8CjB;IAzCC;;;OAGG;IACH,iBAAa;IAEb;;OAEG;IACH,sBAAyC;IAEzC;;OAEG;IACH,wBAA6C;IAE7C;;;;;;;;;;;;;;;;OAgBG;IACH,iBAAuE;IAGvE;;;OAGG;IACH,yBAAqD;IAGvD;;;OAGG;IACH,wBAHW,OAAO,QA2BjB;IAmCD;;OAEG;IACH,6DAEC;IAED;;OAEG;IACH,uEAGC;IAED;;OAEG;IACH,+MA+FC;IAED;;;;OAIG;IACH,wBAJW,OAAO,gBAAgB,EAAE,KAAK,GAC7B,iBAAiB,GAAC,UAAU,GAAC,YAAY,GAAC,QAAQ,CA6F7D;CAsBF;wBA/ZuB,4BAA4B;uCAK7C,oBAAoB"}
|
|
@@ -55,14 +55,13 @@ const attributeDescriptions = [
|
|
|
55
55
|
* made available to shaders.
|
|
56
56
|
* @property {Array<import("../../webgl/PaletteTexture.js").default>} [paletteTextures] Palette textures.
|
|
57
57
|
* @property {number} [cacheSize=512] The texture cache size.
|
|
58
|
+
* @property {Array<import('./Layer.js').PostProcessesOptions>} [postProcesses] Post-processes definitions.
|
|
58
59
|
*/
|
|
59
60
|
|
|
60
|
-
/**
|
|
61
|
-
* @typedef {import("../../layer/WebGLTile.js").default} LayerType
|
|
62
|
-
*/
|
|
63
61
|
/**
|
|
64
62
|
* @typedef {import("../../webgl/TileTexture.js").TileType} TileTextureType
|
|
65
63
|
*/
|
|
64
|
+
|
|
66
65
|
/**
|
|
67
66
|
* @typedef {import("../../webgl/TileTexture.js").default} TileTextureRepresentation
|
|
68
67
|
*/
|
|
@@ -70,6 +69,7 @@ const attributeDescriptions = [
|
|
|
70
69
|
/**
|
|
71
70
|
* @classdesc
|
|
72
71
|
* WebGL renderer for tile layers.
|
|
72
|
+
* @template {import("../../layer/WebGLTile.js").default|import("../../layer/Flow.js").default} LayerType
|
|
73
73
|
* @extends {WebGLBaseTileLayerRenderer<LayerType, TileTextureType, TileTextureRepresentation>}
|
|
74
74
|
* @api
|
|
75
75
|
*/
|
|
@@ -146,6 +146,11 @@ class WebGLTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
146
146
|
this.fragmentShader_,
|
|
147
147
|
this.vertexShader_,
|
|
148
148
|
);
|
|
149
|
+
const gl = this.helper.getGL();
|
|
150
|
+
for (const paletteTexture of this.paletteTextures_) {
|
|
151
|
+
// upload the texture data
|
|
152
|
+
paletteTexture.getTexture(gl);
|
|
153
|
+
}
|
|
149
154
|
}
|
|
150
155
|
}
|
|
151
156
|
|
|
@@ -155,6 +160,12 @@ class WebGLTileLayerRenderer extends WebGLBaseTileLayerRenderer {
|
|
|
155
160
|
afterHelperCreated() {
|
|
156
161
|
super.afterHelperCreated();
|
|
157
162
|
|
|
163
|
+
const gl = this.helper.getGL();
|
|
164
|
+
for (const paletteTexture of this.paletteTextures_) {
|
|
165
|
+
// upload the texture data
|
|
166
|
+
paletteTexture.getTexture(gl);
|
|
167
|
+
}
|
|
168
|
+
|
|
158
169
|
this.program_ = this.helper.getProgram(
|
|
159
170
|
this.fragmentShader_,
|
|
160
171
|
this.vertexShader_,
|
|
@@ -188,6 +188,11 @@ declare class WebGLBaseTileLayerRenderer<LayerType extends BaseLayerType, TileTy
|
|
|
188
188
|
* @override
|
|
189
189
|
*/
|
|
190
190
|
override renderFrame(frameState: import("../../Map.js").FrameState): HTMLElement;
|
|
191
|
+
/**
|
|
192
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
193
|
+
* @protected
|
|
194
|
+
*/
|
|
195
|
+
protected beforeFinalize(frameState: import("../../Map.js").FrameState): void;
|
|
191
196
|
/**
|
|
192
197
|
* Look for tiles covering the provided tile coordinate at an alternate
|
|
193
198
|
* zoom level. Loaded tiles will be added to the provided tile representation lookup.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TileLayerBase.d.ts","sourceRoot":"","sources":["TileLayerBase.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH;;;;GAIG;AAEH;;GAEG;AACH,+CAFY,wBAAwB,CAInC;AA0DD,iEAEC;;;;;;;;;;;;;;yCAzEY,OAAO,uCAAuC,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC;;;;;aAIvF,GAAG,CAAC,MAAM,CAAC;;;;wBACX;YAAO,MAAM,GAAE,GAAG,CAAC,0BAA0B,CAAC;KAAC;;;;;;;;;;;;;;;;;;;4BA+EhD,mDAAyC;AATtD;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AACH,yCAL6B,SAAS,SAAxB,aAAc,EACmB,QAAQ,SAA1C,OAAQ,eAAe,EAAE,OAAQ,EACmC,kBAAkB,SAAtF,OAAQ,uCAAuC,EAAE,OAAO,CAAC,QAAQ,CAAE;IAI9E;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EA+DjB;IAvDC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OAIG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,oBAHU,KAAK,CAAC,MAAM,CAAC,CAGK;IAE5B;;;OAGG;IACH,uBAA+C;IAE/C;;;OAGG;IACH,uBAA8C;IAE9C;;;OAGG;IACH,kBAAuB;IAGvB;;;OAGG;IACH,mCAHU,OAAO,2BAA2B,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAGnB;IAEtD;;;OAGG;IACH,sBAFU,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CAE1B;IAEtB;;;OAGG;IACH,oBAA4B;IAG9B;;;OAGG;IACH,wBAHW,OAAO,QAOjB;IA4BD;;;;;OAKG;IACH,4CAJW,OAAO,uCAAuC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,GAClF,kBAAkB,CAK7B;IAED;;;;;;OAMG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,4BACN,wBAAwB,WACxB,MAAM,QAqHhB;IAED;;;;OAIG;IACH,wCAJW,OAAO,cAAc,EAAE,UAAU,kBACjC,OAAO,QAKjB;IAED;;;;OAIG;IACH,4CAJW,OAAO,cAAc,EAAE,UAAU,GAChC,OAAO,CAKlB;IAED;;;;;;;;;;;;;OAaG;IACH,yCAbW,kBAAkB,iBAClB,OAAO,oBAAoB,EAAE,SAAS,cACtC,OAAO,cAAc,EAAE,UAAU,gBACjC,OAAO,iBAAiB,EAAE,MAAM,kBAChC,MAAM,YACN,OAAO,eAAe,EAAE,IAAI,cAC5B,OAAO,qBAAqB,EAAE,UAAU,cACxC,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,UACN,MAAM,SACN,MAAM,QAeb;IAEJ;;;;;;OAMG;IACH,6CANW,kBAAkB,SAClB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,QAG0C;IAE3D,iIAuEC;IAED;;;;;OAKG;IACH,iCAJW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,
|
|
1
|
+
{"version":3,"file":"TileLayerBase.d.ts","sourceRoot":"","sources":["TileLayerBase.js"],"names":[],"mappings":"AAuDA;;GAEG;AACH;;;;GAIG;AAEH;;GAEG;AACH,+CAFY,wBAAwB,CAInC;AA0DD,iEAEC;;;;;;;;;;;;;;yCAzEY,OAAO,uCAAuC,EAAE,OAAO,CAAC,OAAO,eAAe,EAAE,OAAO,CAAC;;;;;aAIvF,GAAG,CAAC,MAAM,CAAC;;;;wBACX;YAAO,MAAM,GAAE,GAAG,CAAC,0BAA0B,CAAC;KAAC;;;;;;;;;;;;;;;;;;;4BA+EhD,mDAAyC;AATtD;;;;;;GAMG;AAEH;;GAEG;AAEH;;;;;;;GAOG;AACH,yCAL6B,SAAS,SAAxB,aAAc,EACmB,QAAQ,SAA1C,OAAQ,eAAe,EAAE,OAAQ,EACmC,kBAAkB,SAAtF,OAAQ,uCAAuC,EAAE,OAAO,CAAC,QAAQ,CAAE;IAI9E;;;OAGG;IACH,uBAHW,SAAS,WACT,OAAO,EA+DjB;IAvDC;;;OAGG;IACH,gBAFU,OAAO,CAEU;IAE3B;;;;OAIG;IACH,uBAAuC;IAEvC;;;OAGG;IACH,oBAHU,KAAK,CAAC,MAAM,CAAC,CAGK;IAE5B;;;OAGG;IACH,uBAA+C;IAE/C;;;OAGG;IACH,uBAA8C;IAE9C;;;OAGG;IACH,kBAAuB;IAGvB;;;OAGG;IACH,mCAHU,OAAO,2BAA2B,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAGnB;IAEtD;;;OAGG;IACH,sBAFU,OAAO,cAAc,EAAE,UAAU,GAAC,IAAI,CAE1B;IAEtB;;;OAGG;IACH,oBAA4B;IAG9B;;;OAGG;IACH,wBAHW,OAAO,QAOjB;IA4BD;;;;;OAKG;IACH,4CAJW,OAAO,uCAAuC,EAAE,yBAAyB,CAAC,QAAQ,CAAC,GAClF,kBAAkB,CAK7B;IAED;;;;;;OAMG;IACH,yBANW,OAAO,cAAc,EAAE,UAAU,UACjC,OAAO,iBAAiB,EAAE,MAAM,YAChC,MAAM,4BACN,wBAAwB,WACxB,MAAM,QAqHhB;IAED;;;;OAIG;IACH,wCAJW,OAAO,cAAc,EAAE,UAAU,kBACjC,OAAO,QAKjB;IAED;;;;OAIG;IACH,4CAJW,OAAO,cAAc,EAAE,UAAU,GAChC,OAAO,CAKlB;IAED;;;;;;;;;;;;;OAaG;IACH,yCAbW,kBAAkB,iBAClB,OAAO,oBAAoB,EAAE,SAAS,cACtC,OAAO,cAAc,EAAE,UAAU,gBACjC,OAAO,iBAAiB,EAAE,MAAM,kBAChC,MAAM,YACN,OAAO,eAAe,EAAE,IAAI,cAC5B,OAAO,qBAAqB,EAAE,UAAU,cACxC,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,UACN,MAAM,SACN,MAAM,QAeb;IAEJ;;;;;;OAMG;IACH,6CANW,kBAAkB,SAClB,MAAM,UACN,OAAO,iBAAiB,EAAE,MAAM,SAChC,MAAM,QAG0C;IAE3D,iIAuEC;IAED;;;;;OAKG;IACH,iCAJW,OAAO,cAAc,EAAE,UAAU,GAChC,WAAW,CA0NtB;IAED;;;OAGG;IACH,qCAHW,OAAO,cAAc,EAAE,UAAU,QAK3C;IAED;;;;;;;;;;OAUG;IACH,sBAsCC;CAkCF;+BAvzB8B,YAAY"}
|
|
@@ -706,6 +706,7 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
706
706
|
}
|
|
707
707
|
}
|
|
708
708
|
|
|
709
|
+
this.beforeFinalize(frameState);
|
|
709
710
|
this.helper.finalizeDraw(
|
|
710
711
|
frameState,
|
|
711
712
|
this.dispatchPreComposeEvent,
|
|
@@ -737,6 +738,14 @@ class WebGLBaseTileLayerRenderer extends WebGLLayerRenderer {
|
|
|
737
738
|
return canvas;
|
|
738
739
|
}
|
|
739
740
|
|
|
741
|
+
/**
|
|
742
|
+
* @param {import("../../Map.js").FrameState} frameState Frame state.
|
|
743
|
+
* @protected
|
|
744
|
+
*/
|
|
745
|
+
beforeFinalize(frameState) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
|
|
740
749
|
/**
|
|
741
750
|
* Look for tiles covering the provided tile coordinate at an alternate
|
|
742
751
|
* zoom level. Loaded tiles will be added to the provided tile representation lookup.
|
package/util.js
CHANGED
package/webgl/Buffer.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ declare class WebGLArrayBuffer {
|
|
|
37
37
|
/**
|
|
38
38
|
* @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.
|
|
39
39
|
* @param {number} [usage] Intended usage, either `STATIC_DRAW`, `STREAM_DRAW` or `DYNAMIC_DRAW`.
|
|
40
|
-
* Default is `
|
|
40
|
+
* Default is `STATIC_DRAW`.
|
|
41
41
|
*/
|
|
42
42
|
constructor(type: number, usage?: number | undefined);
|
|
43
43
|
/**
|
|
@@ -83,6 +83,10 @@ declare class WebGLArrayBuffer {
|
|
|
83
83
|
* @return {Float32Array|Uint32Array|null} Array.
|
|
84
84
|
*/
|
|
85
85
|
getArray(): Float32Array | Uint32Array | null;
|
|
86
|
+
/**
|
|
87
|
+
* @param {Float32Array|Uint32Array} array Array.
|
|
88
|
+
*/
|
|
89
|
+
setArray(array: Float32Array | Uint32Array): void;
|
|
86
90
|
/**
|
|
87
91
|
* @return {number} Usage.
|
|
88
92
|
*/
|
package/webgl/Buffer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Buffer.d.ts","sourceRoot":"","sources":["Buffer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Buffer.d.ts","sourceRoot":"","sources":["Buffer.js"],"names":[],"mappings":"AA8IA;;;;GAIG;AACH,2CAHW,MAAM,GACL,uBAAuB,GAAC,sBAAsB,CAWzD;;;;;0BA7IS,MAAM;;;;;;;4BANT,aAAa;4BAAb,aAAa;6BAAb,aAAa;AAcpB;;;;;;;;;;;;;;GAcG;AACH;IACE;;;;OAIG;IACH,kBAJW,MAAM,8BA2BhB;IAtBC;;;OAGG;IACH,eAAkB;IAElB;;;OAGG;IACH,cAAiB;IAOjB;;;OAGG;IACH,eAAmE;IAGrE;;;;OAIG;IACH,aAHW,MAAM,GACL,gBAAgB,CAK3B;IAED;;;;OAIG;IACH,iBAHW,KAAK,CAAC,MAAM,CAAC,GACZ,gBAAgB,CAK3B;IAED;;;;;OAKG;IACH,wBAJW,WAAW,GAEV,gBAAgB,CAK3B;IAED;;OAEG;IACH,WAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,YAFY,YAAY,GAAC,WAAW,GAAC,IAAI,CAIxC;IAED;;OAEG;IACH,gBAFW,YAAY,GAAC,WAAW,QAQlC;IAED;;OAEG;IACH,YAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,WAFY,MAAM,CAIjB;CACF"}
|
package/webgl/Buffer.js
CHANGED
|
@@ -40,7 +40,7 @@ class WebGLArrayBuffer {
|
|
|
40
40
|
/**
|
|
41
41
|
* @param {number} type Buffer type, either ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER.
|
|
42
42
|
* @param {number} [usage] Intended usage, either `STATIC_DRAW`, `STREAM_DRAW` or `DYNAMIC_DRAW`.
|
|
43
|
-
* Default is `
|
|
43
|
+
* Default is `STATIC_DRAW`.
|
|
44
44
|
*/
|
|
45
45
|
constructor(type, usage) {
|
|
46
46
|
/**
|
|
@@ -113,6 +113,17 @@ class WebGLArrayBuffer {
|
|
|
113
113
|
return this.array_;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* @param {Float32Array|Uint32Array} array Array.
|
|
118
|
+
*/
|
|
119
|
+
setArray(array) {
|
|
120
|
+
const ArrayType = getArrayClassForType(this.type_);
|
|
121
|
+
if (!(array instanceof ArrayType)) {
|
|
122
|
+
throw new Error(`Expected ${ArrayType}`);
|
|
123
|
+
}
|
|
124
|
+
this.array_ = array;
|
|
125
|
+
}
|
|
126
|
+
|
|
116
127
|
/**
|
|
117
128
|
* @return {number} Usage.
|
|
118
129
|
*/
|