@openglobus/og 0.10.4 → 0.11.1
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/css/og.css +1 -1
- package/package.json +11 -9
- package/src/og/Extent.js +274 -273
- package/src/og/Globe.js +11 -3
- package/src/og/LonLat.js +152 -146
- package/src/og/Popup.js +2 -1
- package/src/og/camera/PlanetCamera.js +112 -38
- package/src/og/control/EarthNavigation.js +259 -0
- package/src/og/control/MouseNavigation.js +68 -40
- package/src/og/entity/EntityCollection.js +1 -1
- package/src/og/entity/LabelHandler.js +366 -74
- package/src/og/entity/Polyline.js +3 -2
- package/src/og/layer/CanvasTiles.js +32 -30
- package/src/og/layer/KML.js +159 -0
- package/src/og/layer/Vector.js +5 -0
- package/src/og/layer/index.js +2 -1
- package/src/og/math/Vec2.js +448 -448
- package/src/og/math/Vec3.js +759 -757
- package/src/og/math/Vec4.js +216 -215
- package/src/og/quadTree/Node.js +67 -13
- package/src/og/renderer/RendererEvents.js +21 -16
- package/src/og/scene/Planet.js +25 -10
- package/src/og/segment/Segment.js +3 -3
- package/src/og/segment/SegmentLonLat.js +7 -0
- package/src/og/terrain/GlobusTerrain.js +4 -0
- package/src/og/utils/FontAtlas.js +1 -0
- package/src/og/utils/GeoImageCreator.js +123 -121
- package/src/og/utils/Loader.js +81 -80
- package/src/og/utils/NormalMapCreator.js +320 -318
- package/src/og/utils/VectorTileCreator.js +251 -250
- package/src/og/webgl/Framebuffer.js +265 -264
- package/src/og/webgl/Handler.js +1022 -1001
- package/src/og/webgl/Multisample.js +169 -168
- package/src/og/webgl/ProgramController.js +113 -112
- package/types/Clock.d.ts +90 -0
- package/types/Deferred.d.ts +6 -0
- package/types/Events.d.ts +73 -0
- package/types/Extent.d.ts +162 -0
- package/types/Globe.d.ts +80 -0
- package/types/ImageCanvas.d.ts +121 -0
- package/types/Lock.d.ts +12 -0
- package/types/LonLat.d.ts +108 -0
- package/types/Popup.d.ts +38 -0
- package/types/QueueArray.d.ts +15 -0
- package/types/Rectangle.d.ts +74 -0
- package/types/Stack.d.ts +15 -0
- package/types/ajax.d.ts +24 -0
- package/types/arial.d.ts +48 -0
- package/types/astro/astro.d.ts +38 -0
- package/types/astro/earth.d.ts +6 -0
- package/types/astro/jd.d.ts +254 -0
- package/types/bv/Box.d.ts +25 -0
- package/types/bv/Sphere.d.ts +32 -0
- package/types/bv/index.d.ts +3 -0
- package/types/camera/Camera.d.ts +303 -0
- package/types/camera/Frustum.d.ts +129 -0
- package/types/camera/PlanetCamera.d.ts +222 -0
- package/types/camera/index.d.ts +3 -0
- package/types/cons.d.ts +40 -0
- package/types/control/CompassButton.d.ts +17 -0
- package/types/control/Control.d.ts +101 -0
- package/types/control/DebugInfo.d.ts +16 -0
- package/types/control/EarthCoordinates.d.ts +47 -0
- package/types/control/GeoImageDragControl.d.ts +6 -0
- package/types/control/KeyboardNavigation.d.ts +22 -0
- package/types/control/LayerSwitcher.d.ts +23 -0
- package/types/control/Lighting.d.ts +16 -0
- package/types/control/ScaleControl.d.ts +22 -0
- package/types/control/ShowFps.d.ts +12 -0
- package/types/control/SimpleNavigation.d.ts +28 -0
- package/types/control/Sun.d.ts +52 -0
- package/types/control/ToggleWireframe.d.ts +12 -0
- package/types/control/ZoomControl.d.ts +28 -0
- package/types/control/index.d.ts +15 -0
- package/types/ellipsoid/Ellipsoid.d.ts +142 -0
- package/types/ellipsoid/index.d.ts +3 -0
- package/types/ellipsoid/wgs84.d.ts +5 -0
- package/types/entity/BaseBillboard.d.ts +208 -0
- package/types/entity/Billboard.d.ts +94 -0
- package/types/entity/BillboardHandler.d.ts +74 -0
- package/types/entity/Entity.d.ts +330 -0
- package/types/entity/EntityCollection.d.ts +303 -0
- package/types/entity/Geometry.d.ts +72 -0
- package/types/entity/GeometryHandler.d.ts +76 -0
- package/types/entity/Label.d.ts +194 -0
- package/types/entity/LabelHandler.d.ts +24 -0
- package/types/entity/PointCloud.d.ts +174 -0
- package/types/entity/PointCloudHandler.d.ts +38 -0
- package/types/entity/Polyline.d.ts +303 -0
- package/types/entity/PolylineHandler.d.ts +18 -0
- package/types/entity/Ray.d.ts +123 -0
- package/types/entity/RayHandler.d.ts +67 -0
- package/types/entity/ShapeHandler.d.ts +22 -0
- package/types/entity/Strip.d.ts +118 -0
- package/types/entity/StripHandler.d.ts +38 -0
- package/types/entity/index.d.ts +8 -0
- package/types/index.core.d.ts +65 -0
- package/types/index.d.ts +45 -0
- package/types/index.webgl.d.ts +7 -0
- package/types/inherits.d.ts +4 -0
- package/types/input/input.d.ts +34 -0
- package/types/layer/BaseGeoImage.d.ts +106 -0
- package/types/layer/CanvasTiles.d.ts +75 -0
- package/types/layer/GeoImage.d.ts +65 -0
- package/types/layer/GeoTexture2d.d.ts +8 -0
- package/types/layer/GeoVideo.d.ts +80 -0
- package/types/layer/KML.d.ts +58 -0
- package/types/layer/WMS.d.ts +66 -0
- package/types/layer/XYZ.d.ts +126 -0
- package/types/layer/index.d.ts +10 -0
- package/types/light/LightSource.d.ts +177 -0
- package/types/math/Mat3.d.ts +53 -0
- package/types/math/Mat4.d.ts +157 -0
- package/types/math/Plane.d.ts +17 -0
- package/types/math/Vec2.d.ts +308 -0
- package/types/math/Vec3.d.ts +459 -0
- package/types/math/Vec4.d.ts +161 -0
- package/types/math/coder.d.ts +42 -0
- package/types/math/index.d.ts +11 -0
- package/types/math.d.ts +261 -0
- package/types/mercator.d.ts +92 -0
- package/types/proj/EPSG3857.d.ts +5 -0
- package/types/proj/EPSG4326.d.ts +5 -0
- package/types/quadTree/quadTree.d.ts +40 -0
- package/types/renderer/RendererEvents.d.ts +230 -0
- package/types/res/images.d.ts +3 -0
- package/types/scene/Axes.d.ts +11 -0
- package/types/scene/BaseNode.d.ts +60 -0
- package/types/scene/Planet.d.ts +572 -0
- package/types/scene/RenderNode.d.ts +143 -0
- package/types/scene/SkyBox.d.ts +10 -0
- package/types/scene/index.d.ts +4 -0
- package/types/segment/segmentHelper.d.ts +13 -0
- package/types/shaders/billboard.d.ts +3 -0
- package/types/shaders/depth.d.ts +2 -0
- package/types/shaders/drawnode.d.ts +7 -0
- package/types/shaders/label.d.ts +4 -0
- package/types/shaders/pointCloud.d.ts +2 -0
- package/types/shaders/polyline.d.ts +3 -0
- package/types/shaders/ray.d.ts +2 -0
- package/types/shaders/screenFrame.d.ts +2 -0
- package/types/shaders/shape.d.ts +4 -0
- package/types/shaders/skybox.d.ts +2 -0
- package/types/shaders/toneMapping.d.ts +2 -0
- package/types/shapes/BaseShape.d.ts +247 -0
- package/types/shapes/Sphere.d.ts +41 -0
- package/types/terrain/BilTerrain.d.ts +8 -0
- package/types/terrain/EmptyTerrain.d.ts +72 -0
- package/types/terrain/Geoid.d.ts +26 -0
- package/types/terrain/GlobusTerrain.d.ts +153 -0
- package/types/terrain/MapboxTerrain.d.ts +8 -0
- package/types/terrain/index.d.ts +5 -0
- package/types/utils/FontAtlas.d.ts +14 -0
- package/types/utils/GeoImageCreator.d.ts +29 -0
- package/types/utils/ImagesCacheManager.d.ts +10 -0
- package/types/utils/Loader.d.ts +25 -0
- package/types/utils/NormalMapCreator.d.ts +39 -0
- package/types/utils/PlainSegmentWorker.d.ts +10 -0
- package/types/utils/TerrainWorker.d.ts +9 -0
- package/types/utils/TextureAtlas.d.ts +111 -0
- package/types/utils/VectorTileCreator.d.ts +16 -0
- package/types/utils/colorTable.d.ts +143 -0
- package/types/utils/earcut.d.ts +6 -0
- package/types/utils/shared.d.ts +230 -0
- package/types/webgl/Framebuffer.d.ts +135 -0
- package/types/webgl/Handler.d.ts +372 -0
- package/types/webgl/Multisample.d.ts +89 -0
- package/types/webgl/Program.d.ts +155 -0
- package/types/webgl/ProgramController.d.ts +84 -0
- package/types/webgl/callbacks.d.ts +1 -0
- package/types/webgl/index.d.ts +6 -0
- package/types/webgl/types.d.ts +2 -0
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module og/entity/LabelHandler
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as shaders from
|
|
8
|
-
import { ALIGN } from
|
|
9
|
-
import { BillboardHandler } from
|
|
10
|
-
import { concatTypedArrays, spliceTypedArray } from
|
|
7
|
+
import * as shaders from "../shaders/label.js";
|
|
8
|
+
import { ALIGN } from "./Label.js";
|
|
9
|
+
import { BillboardHandler } from "./BillboardHandler.js";
|
|
10
|
+
import { concatTypedArrays, spliceTypedArray } from "../utils/shared.js";
|
|
11
11
|
|
|
12
12
|
const PICKINGCOLOR_BUFFER = 0;
|
|
13
13
|
const POSITION_BUFFER = 1;
|
|
@@ -23,7 +23,7 @@ const OUTLINE_BUFFER = 10;
|
|
|
23
23
|
const OUTLINECOLOR_BUFFER = 11;
|
|
24
24
|
|
|
25
25
|
window.uZ = -2.0;
|
|
26
|
-
window.dZ =
|
|
26
|
+
window.dZ = 1.1;
|
|
27
27
|
/*
|
|
28
28
|
* og.LabelHandler
|
|
29
29
|
*
|
|
@@ -31,7 +31,6 @@ window.dZ = 0.1;
|
|
|
31
31
|
*/
|
|
32
32
|
class LabelHandler extends BillboardHandler {
|
|
33
33
|
constructor(entityCollection, maxLetters = 21) {
|
|
34
|
-
|
|
35
34
|
super(entityCollection);
|
|
36
35
|
|
|
37
36
|
this._gliphParamBuffer = null;
|
|
@@ -57,7 +56,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
57
56
|
|
|
58
57
|
initProgram() {
|
|
59
58
|
if (this._renderer.handler) {
|
|
60
|
-
|
|
61
59
|
if (!this._renderer.handler.programs.label) {
|
|
62
60
|
if (this._renderer.handler.gl.type === "webgl2") {
|
|
63
61
|
this._renderer.handler.addProgram(shaders.label_webgl2());
|
|
@@ -90,7 +88,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
clear() {
|
|
93
|
-
|
|
94
91
|
this._texCoordArr = null;
|
|
95
92
|
this._gliphParamArr = null;
|
|
96
93
|
this._vertexArr = null;
|
|
@@ -169,41 +166,159 @@ class LabelHandler extends BillboardHandler {
|
|
|
169
166
|
_addBillboardToArrays(label) {
|
|
170
167
|
for (var i = 0; i < this._maxLetters; i++) {
|
|
171
168
|
if (label._visibility) {
|
|
172
|
-
this._vertexArr = concatTypedArrays(
|
|
173
|
-
|
|
174
|
-
0, -1,
|
|
175
|
-
|
|
176
|
-
1, -1,
|
|
177
|
-
1, 0,
|
|
178
|
-
0, 0
|
|
179
|
-
]);
|
|
169
|
+
this._vertexArr = concatTypedArrays(
|
|
170
|
+
this._vertexArr,
|
|
171
|
+
[0, 0, 0, -1, 1, -1, 1, -1, 1, 0, 0, 0]
|
|
172
|
+
);
|
|
180
173
|
} else {
|
|
181
|
-
this._vertexArr = concatTypedArrays(
|
|
174
|
+
this._vertexArr = concatTypedArrays(
|
|
175
|
+
this._vertexArr,
|
|
176
|
+
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
177
|
+
);
|
|
182
178
|
}
|
|
183
179
|
|
|
184
|
-
this._texCoordArr = concatTypedArrays(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
this.
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
180
|
+
this._texCoordArr = concatTypedArrays(
|
|
181
|
+
this._texCoordArr,
|
|
182
|
+
[0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 0]
|
|
183
|
+
);
|
|
184
|
+
this._gliphParamArr = concatTypedArrays(
|
|
185
|
+
this._gliphParamArr,
|
|
186
|
+
[1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]
|
|
187
|
+
);
|
|
188
|
+
|
|
189
|
+
var x = label._positionHigh.x,
|
|
190
|
+
y = label._positionHigh.y,
|
|
191
|
+
z = label._positionHigh.z,
|
|
192
|
+
w;
|
|
193
|
+
this._positionHighArr = concatTypedArrays(this._positionHighArr, [
|
|
194
|
+
x,
|
|
195
|
+
y,
|
|
196
|
+
z,
|
|
197
|
+
x,
|
|
198
|
+
y,
|
|
199
|
+
z,
|
|
200
|
+
x,
|
|
201
|
+
y,
|
|
202
|
+
z,
|
|
203
|
+
x,
|
|
204
|
+
y,
|
|
205
|
+
z,
|
|
206
|
+
x,
|
|
207
|
+
y,
|
|
208
|
+
z,
|
|
209
|
+
x,
|
|
210
|
+
y,
|
|
211
|
+
z
|
|
212
|
+
]);
|
|
213
|
+
|
|
214
|
+
x = label._positionLow.x;
|
|
215
|
+
y = label._positionLow.y;
|
|
216
|
+
z = label._positionLow.z;
|
|
217
|
+
this._positionLowArr = concatTypedArrays(this._positionLowArr, [
|
|
218
|
+
x,
|
|
219
|
+
y,
|
|
220
|
+
z,
|
|
221
|
+
x,
|
|
222
|
+
y,
|
|
223
|
+
z,
|
|
224
|
+
x,
|
|
225
|
+
y,
|
|
226
|
+
z,
|
|
227
|
+
x,
|
|
228
|
+
y,
|
|
229
|
+
z,
|
|
230
|
+
x,
|
|
231
|
+
y,
|
|
232
|
+
z,
|
|
233
|
+
x,
|
|
234
|
+
y,
|
|
235
|
+
z
|
|
236
|
+
]);
|
|
192
237
|
|
|
193
238
|
x = label._size;
|
|
194
239
|
this._sizeArr = concatTypedArrays(this._sizeArr, [x, x, x, x, x, x]);
|
|
195
240
|
|
|
196
|
-
x = label._offset.x;
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
241
|
+
x = label._offset.x;
|
|
242
|
+
y = label._offset.y;
|
|
243
|
+
z = label._offset.z;
|
|
244
|
+
this._offsetArr = concatTypedArrays(this._offsetArr, [
|
|
245
|
+
x,
|
|
246
|
+
y,
|
|
247
|
+
z,
|
|
248
|
+
x,
|
|
249
|
+
y,
|
|
250
|
+
z,
|
|
251
|
+
x,
|
|
252
|
+
y,
|
|
253
|
+
z,
|
|
254
|
+
x,
|
|
255
|
+
y,
|
|
256
|
+
z,
|
|
257
|
+
x,
|
|
258
|
+
y,
|
|
259
|
+
z,
|
|
260
|
+
x,
|
|
261
|
+
y,
|
|
262
|
+
z
|
|
263
|
+
]);
|
|
264
|
+
|
|
265
|
+
x = label._color.x;
|
|
266
|
+
y = label._color.y;
|
|
267
|
+
z = label._color.z;
|
|
268
|
+
w = label._color.w;
|
|
269
|
+
this._rgbaArr = concatTypedArrays(this._rgbaArr, [
|
|
270
|
+
x,
|
|
271
|
+
y,
|
|
272
|
+
z,
|
|
273
|
+
w,
|
|
274
|
+
x,
|
|
275
|
+
y,
|
|
276
|
+
z,
|
|
277
|
+
w,
|
|
278
|
+
x,
|
|
279
|
+
y,
|
|
280
|
+
z,
|
|
281
|
+
w,
|
|
282
|
+
x,
|
|
283
|
+
y,
|
|
284
|
+
z,
|
|
285
|
+
w,
|
|
286
|
+
x,
|
|
287
|
+
y,
|
|
288
|
+
z,
|
|
289
|
+
w,
|
|
290
|
+
x,
|
|
291
|
+
y,
|
|
292
|
+
z,
|
|
293
|
+
w
|
|
294
|
+
]);
|
|
201
295
|
|
|
202
296
|
x = label._rotation;
|
|
203
297
|
this._rotationArr = concatTypedArrays(this._rotationArr, [x, x, x, x, x, x]);
|
|
204
298
|
|
|
205
|
-
x = label._alignedAxis.x;
|
|
206
|
-
|
|
299
|
+
x = label._alignedAxis.x;
|
|
300
|
+
y = label._alignedAxis.y;
|
|
301
|
+
z = label._alignedAxis.z;
|
|
302
|
+
this._alignedAxisArr = concatTypedArrays(this._alignedAxisArr, [
|
|
303
|
+
x,
|
|
304
|
+
y,
|
|
305
|
+
z,
|
|
306
|
+
x,
|
|
307
|
+
y,
|
|
308
|
+
z,
|
|
309
|
+
x,
|
|
310
|
+
y,
|
|
311
|
+
z,
|
|
312
|
+
x,
|
|
313
|
+
y,
|
|
314
|
+
z,
|
|
315
|
+
x,
|
|
316
|
+
y,
|
|
317
|
+
z,
|
|
318
|
+
x,
|
|
319
|
+
y,
|
|
320
|
+
z
|
|
321
|
+
]);
|
|
207
322
|
|
|
208
323
|
x = label._fontIndex;
|
|
209
324
|
this._fontIndexArr = concatTypedArrays(this._fontIndexArr, [x, x, x, x, x, x]);
|
|
@@ -212,15 +327,71 @@ class LabelHandler extends BillboardHandler {
|
|
|
212
327
|
this._outlineArr = concatTypedArrays(this._outlineArr, [x, x, x, x, x, x]);
|
|
213
328
|
|
|
214
329
|
const weight = 0.001;
|
|
215
|
-
this._noOutlineArr = concatTypedArrays(this._noOutlineArr, [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
330
|
+
this._noOutlineArr = concatTypedArrays(this._noOutlineArr, [
|
|
331
|
+
weight,
|
|
332
|
+
weight,
|
|
333
|
+
weight,
|
|
334
|
+
weight,
|
|
335
|
+
weight,
|
|
336
|
+
weight
|
|
337
|
+
]);
|
|
338
|
+
|
|
339
|
+
x = label._outlineColor.x;
|
|
340
|
+
y = label._outlineColor.y;
|
|
341
|
+
z = label._outlineColor.z;
|
|
342
|
+
w = label._outlineColor.w;
|
|
343
|
+
this._outlineColorArr = concatTypedArrays(this._outlineColorArr, [
|
|
344
|
+
x,
|
|
345
|
+
y,
|
|
346
|
+
z,
|
|
347
|
+
w,
|
|
348
|
+
x,
|
|
349
|
+
y,
|
|
350
|
+
z,
|
|
351
|
+
w,
|
|
352
|
+
x,
|
|
353
|
+
y,
|
|
354
|
+
z,
|
|
355
|
+
w,
|
|
356
|
+
x,
|
|
357
|
+
y,
|
|
358
|
+
z,
|
|
359
|
+
w,
|
|
360
|
+
x,
|
|
361
|
+
y,
|
|
362
|
+
z,
|
|
363
|
+
w,
|
|
364
|
+
x,
|
|
365
|
+
y,
|
|
366
|
+
z,
|
|
367
|
+
w
|
|
368
|
+
]);
|
|
369
|
+
|
|
370
|
+
x = label._entity._pickingColor.x / 255;
|
|
371
|
+
y = label._entity._pickingColor.y / 255;
|
|
372
|
+
z = label._entity._pickingColor.z / 255;
|
|
373
|
+
this._pickingColorArr = concatTypedArrays(this._pickingColorArr, [
|
|
374
|
+
x,
|
|
375
|
+
y,
|
|
376
|
+
z,
|
|
377
|
+
x,
|
|
378
|
+
y,
|
|
379
|
+
z,
|
|
380
|
+
x,
|
|
381
|
+
y,
|
|
382
|
+
z,
|
|
383
|
+
x,
|
|
384
|
+
y,
|
|
385
|
+
z,
|
|
386
|
+
x,
|
|
387
|
+
y,
|
|
388
|
+
z,
|
|
389
|
+
x,
|
|
390
|
+
y,
|
|
391
|
+
z
|
|
392
|
+
]);
|
|
222
393
|
}
|
|
223
|
-
}
|
|
394
|
+
}
|
|
224
395
|
|
|
225
396
|
_displayPASS() {
|
|
226
397
|
var r = this._renderer;
|
|
@@ -254,19 +425,47 @@ class LabelHandler extends BillboardHandler {
|
|
|
254
425
|
gl.uniform2fv(shu.viewport, [h.canvas.width, h.canvas.height]);
|
|
255
426
|
|
|
256
427
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._texCoordBuffer);
|
|
257
|
-
gl.vertexAttribPointer(
|
|
428
|
+
gl.vertexAttribPointer(
|
|
429
|
+
sha.a_texCoord,
|
|
430
|
+
this._texCoordBuffer.itemSize,
|
|
431
|
+
gl.FLOAT,
|
|
432
|
+
false,
|
|
433
|
+
0,
|
|
434
|
+
0
|
|
435
|
+
);
|
|
258
436
|
|
|
259
437
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._gliphParamBuffer);
|
|
260
|
-
gl.vertexAttribPointer(
|
|
438
|
+
gl.vertexAttribPointer(
|
|
439
|
+
sha.a_gliphParam,
|
|
440
|
+
this._gliphParamBuffer.itemSize,
|
|
441
|
+
gl.FLOAT,
|
|
442
|
+
false,
|
|
443
|
+
0,
|
|
444
|
+
0
|
|
445
|
+
);
|
|
261
446
|
|
|
262
447
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
|
|
263
448
|
gl.vertexAttribPointer(sha.a_vertices, this._vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
264
449
|
|
|
265
450
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._positionHighBuffer);
|
|
266
|
-
gl.vertexAttribPointer(
|
|
451
|
+
gl.vertexAttribPointer(
|
|
452
|
+
sha.a_positionsHigh,
|
|
453
|
+
this._positionHighBuffer.itemSize,
|
|
454
|
+
gl.FLOAT,
|
|
455
|
+
false,
|
|
456
|
+
0,
|
|
457
|
+
0
|
|
458
|
+
);
|
|
267
459
|
|
|
268
460
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._positionLowBuffer);
|
|
269
|
-
gl.vertexAttribPointer(
|
|
461
|
+
gl.vertexAttribPointer(
|
|
462
|
+
sha.a_positionsLow,
|
|
463
|
+
this._positionLowBuffer.itemSize,
|
|
464
|
+
gl.FLOAT,
|
|
465
|
+
false,
|
|
466
|
+
0,
|
|
467
|
+
0
|
|
468
|
+
);
|
|
270
469
|
|
|
271
470
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._sizeBuffer);
|
|
272
471
|
gl.vertexAttribPointer(sha.a_size, this._sizeBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
@@ -281,12 +480,26 @@ class LabelHandler extends BillboardHandler {
|
|
|
281
480
|
gl.vertexAttribPointer(sha.a_offset, this._offsetBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
282
481
|
|
|
283
482
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._fontIndexBuffer);
|
|
284
|
-
gl.vertexAttribPointer(
|
|
483
|
+
gl.vertexAttribPointer(
|
|
484
|
+
sha.a_fontIndex,
|
|
485
|
+
this._fontIndexBuffer.itemSize,
|
|
486
|
+
gl.FLOAT,
|
|
487
|
+
false,
|
|
488
|
+
0,
|
|
489
|
+
0
|
|
490
|
+
);
|
|
285
491
|
|
|
286
492
|
//
|
|
287
493
|
// outline
|
|
288
494
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._outlineColorBuffer);
|
|
289
|
-
gl.vertexAttribPointer(
|
|
495
|
+
gl.vertexAttribPointer(
|
|
496
|
+
sha.a_rgba,
|
|
497
|
+
this._outlineColorBuffer.itemSize,
|
|
498
|
+
gl.FLOAT,
|
|
499
|
+
false,
|
|
500
|
+
0,
|
|
501
|
+
0
|
|
502
|
+
);
|
|
290
503
|
|
|
291
504
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._outlineBuffer);
|
|
292
505
|
gl.vertexAttribPointer(sha.a_outline, this._outlineBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
@@ -300,7 +513,14 @@ class LabelHandler extends BillboardHandler {
|
|
|
300
513
|
gl.vertexAttribPointer(sha.a_rgba, this._rgbaBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
301
514
|
|
|
302
515
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._noOutlineBuffer);
|
|
303
|
-
gl.vertexAttribPointer(
|
|
516
|
+
gl.vertexAttribPointer(
|
|
517
|
+
sha.a_outline,
|
|
518
|
+
this._noOutlineBuffer.itemSize,
|
|
519
|
+
gl.FLOAT,
|
|
520
|
+
false,
|
|
521
|
+
0,
|
|
522
|
+
0
|
|
523
|
+
);
|
|
304
524
|
|
|
305
525
|
gl.uniform1f(shu.uZ, window.uZ);
|
|
306
526
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
@@ -336,19 +556,47 @@ class LabelHandler extends BillboardHandler {
|
|
|
336
556
|
gl.uniform2fv(shu.viewport, [h.canvas.width, h.canvas.height]);
|
|
337
557
|
|
|
338
558
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._texCoordBuffer);
|
|
339
|
-
gl.vertexAttribPointer(
|
|
559
|
+
gl.vertexAttribPointer(
|
|
560
|
+
sha.a_texCoord,
|
|
561
|
+
this._texCoordBuffer.itemSize,
|
|
562
|
+
gl.FLOAT,
|
|
563
|
+
false,
|
|
564
|
+
0,
|
|
565
|
+
0
|
|
566
|
+
);
|
|
340
567
|
|
|
341
568
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._gliphParamBuffer);
|
|
342
|
-
gl.vertexAttribPointer(
|
|
569
|
+
gl.vertexAttribPointer(
|
|
570
|
+
sha.a_gliphParam,
|
|
571
|
+
this._gliphParamBuffer.itemSize,
|
|
572
|
+
gl.FLOAT,
|
|
573
|
+
false,
|
|
574
|
+
0,
|
|
575
|
+
0
|
|
576
|
+
);
|
|
343
577
|
|
|
344
578
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._vertexBuffer);
|
|
345
579
|
gl.vertexAttribPointer(sha.a_vertices, this._vertexBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
346
580
|
|
|
347
581
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._positionHighBuffer);
|
|
348
|
-
gl.vertexAttribPointer(
|
|
582
|
+
gl.vertexAttribPointer(
|
|
583
|
+
sha.a_positionsHigh,
|
|
584
|
+
this._positionHighBuffer.itemSize,
|
|
585
|
+
gl.FLOAT,
|
|
586
|
+
false,
|
|
587
|
+
0,
|
|
588
|
+
0
|
|
589
|
+
);
|
|
349
590
|
|
|
350
591
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._positionLowBuffer);
|
|
351
|
-
gl.vertexAttribPointer(
|
|
592
|
+
gl.vertexAttribPointer(
|
|
593
|
+
sha.a_positionsLow,
|
|
594
|
+
this._positionLowBuffer.itemSize,
|
|
595
|
+
gl.FLOAT,
|
|
596
|
+
false,
|
|
597
|
+
0,
|
|
598
|
+
0
|
|
599
|
+
);
|
|
352
600
|
|
|
353
601
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._sizeBuffer);
|
|
354
602
|
gl.vertexAttribPointer(sha.a_size, this._sizeBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
@@ -364,7 +612,14 @@ class LabelHandler extends BillboardHandler {
|
|
|
364
612
|
|
|
365
613
|
// no outline
|
|
366
614
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._pickingColorBuffer);
|
|
367
|
-
gl.vertexAttribPointer(
|
|
615
|
+
gl.vertexAttribPointer(
|
|
616
|
+
sha.a_rgba,
|
|
617
|
+
this._pickingColorBuffer.itemSize,
|
|
618
|
+
gl.FLOAT,
|
|
619
|
+
false,
|
|
620
|
+
0,
|
|
621
|
+
0
|
|
622
|
+
);
|
|
368
623
|
|
|
369
624
|
gl.drawArrays(gl.TRIANGLES, 0, this._vertexBuffer.numItems);
|
|
370
625
|
}
|
|
@@ -406,10 +661,9 @@ class LabelHandler extends BillboardHandler {
|
|
|
406
661
|
|
|
407
662
|
label._handlerIndex = -1;
|
|
408
663
|
label._handler = null;
|
|
409
|
-
}
|
|
664
|
+
}
|
|
410
665
|
|
|
411
666
|
setText(index, text, fontIndex, align) {
|
|
412
|
-
|
|
413
667
|
var fa = this._renderer.fontAtlas.atlasesArr[fontIndex];
|
|
414
668
|
|
|
415
669
|
if (!fa) return;
|
|
@@ -554,8 +808,14 @@ class LabelHandler extends BillboardHandler {
|
|
|
554
808
|
|
|
555
809
|
setPositionArr(index, positionHigh, positionLow) {
|
|
556
810
|
var i = index * 18 * this._maxLetters;
|
|
557
|
-
var a = this._positionHighArr,
|
|
558
|
-
|
|
811
|
+
var a = this._positionHighArr,
|
|
812
|
+
x = positionHigh.x,
|
|
813
|
+
y = positionHigh.y,
|
|
814
|
+
z = positionHigh.z,
|
|
815
|
+
b = this._positionLowArr,
|
|
816
|
+
xl = positionLow.x,
|
|
817
|
+
yl = positionLow.y,
|
|
818
|
+
zl = positionLow.z;
|
|
559
819
|
|
|
560
820
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
561
821
|
var j = i + q * 18;
|
|
@@ -614,7 +874,10 @@ class LabelHandler extends BillboardHandler {
|
|
|
614
874
|
|
|
615
875
|
setPickingColorArr(index, color) {
|
|
616
876
|
var i = index * 18 * this._maxLetters;
|
|
617
|
-
var a = this._pickingColorArr,
|
|
877
|
+
var a = this._pickingColorArr,
|
|
878
|
+
x = color.x / 255,
|
|
879
|
+
y = color.y / 255,
|
|
880
|
+
z = color.z / 255;
|
|
618
881
|
|
|
619
882
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
620
883
|
var j = i + q * 18;
|
|
@@ -647,7 +910,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
647
910
|
}
|
|
648
911
|
|
|
649
912
|
setSizeArr(index, size) {
|
|
650
|
-
|
|
651
913
|
var i = index * 6 * this._maxLetters;
|
|
652
914
|
var a = this._sizeArr;
|
|
653
915
|
|
|
@@ -665,9 +927,11 @@ class LabelHandler extends BillboardHandler {
|
|
|
665
927
|
}
|
|
666
928
|
|
|
667
929
|
setOffsetArr(index, offset) {
|
|
668
|
-
|
|
669
930
|
var i = index * 18 * this._maxLetters;
|
|
670
|
-
var a = this._offsetArr,
|
|
931
|
+
var a = this._offsetArr,
|
|
932
|
+
x = offset.x,
|
|
933
|
+
y = offset.y,
|
|
934
|
+
z = offset.z;
|
|
671
935
|
|
|
672
936
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
673
937
|
var j = i + q * 18;
|
|
@@ -701,7 +965,11 @@ class LabelHandler extends BillboardHandler {
|
|
|
701
965
|
|
|
702
966
|
setRgbaArr(index, rgba) {
|
|
703
967
|
var i = index * 24 * this._maxLetters;
|
|
704
|
-
var a = this._rgbaArr,
|
|
968
|
+
var a = this._rgbaArr,
|
|
969
|
+
x = rgba.x,
|
|
970
|
+
y = rgba.y,
|
|
971
|
+
z = rgba.z,
|
|
972
|
+
w = rgba.w;
|
|
705
973
|
|
|
706
974
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
707
975
|
var j = i + q * 24;
|
|
@@ -742,7 +1010,11 @@ class LabelHandler extends BillboardHandler {
|
|
|
742
1010
|
|
|
743
1011
|
setOutlineColorArr(index, rgba) {
|
|
744
1012
|
var i = index * 24 * this._maxLetters;
|
|
745
|
-
var a = this._outlineColorArr,
|
|
1013
|
+
var a = this._outlineColorArr,
|
|
1014
|
+
x = rgba.x,
|
|
1015
|
+
y = rgba.y,
|
|
1016
|
+
z = rgba.z,
|
|
1017
|
+
w = rgba.w;
|
|
746
1018
|
|
|
747
1019
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
748
1020
|
var j = i + q * 24;
|
|
@@ -799,7 +1071,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
799
1071
|
}
|
|
800
1072
|
|
|
801
1073
|
setRotationArr(index, rotation) {
|
|
802
|
-
|
|
803
1074
|
var i = index * 6 * this._maxLetters;
|
|
804
1075
|
var a = this._rotationArr;
|
|
805
1076
|
|
|
@@ -817,7 +1088,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
817
1088
|
}
|
|
818
1089
|
|
|
819
1090
|
setVertexArr(index, vertexArr) {
|
|
820
|
-
|
|
821
1091
|
var i = index * 12 * this._maxLetters;
|
|
822
1092
|
var a = this._vertexArr;
|
|
823
1093
|
|
|
@@ -845,7 +1115,10 @@ class LabelHandler extends BillboardHandler {
|
|
|
845
1115
|
|
|
846
1116
|
setAlignedAxisArr(index, alignedAxis) {
|
|
847
1117
|
var i = index * 18 * this._maxLetters;
|
|
848
|
-
var a = this._alignedAxisArr,
|
|
1118
|
+
var a = this._alignedAxisArr,
|
|
1119
|
+
x = alignedAxis.x,
|
|
1120
|
+
y = alignedAxis.y,
|
|
1121
|
+
z = alignedAxis.z;
|
|
849
1122
|
|
|
850
1123
|
for (var q = 0; q < this._maxLetters; q++) {
|
|
851
1124
|
var j = i + q * 18;
|
|
@@ -878,7 +1151,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
878
1151
|
}
|
|
879
1152
|
|
|
880
1153
|
setFontIndexArr(index, fontIndex) {
|
|
881
|
-
|
|
882
1154
|
fontIndex = fontIndex;
|
|
883
1155
|
|
|
884
1156
|
var i = index * 6 * this._maxLetters;
|
|
@@ -906,16 +1178,28 @@ class LabelHandler extends BillboardHandler {
|
|
|
906
1178
|
createFontIndexBuffer() {
|
|
907
1179
|
var h = this._renderer.handler;
|
|
908
1180
|
h.gl.deleteBuffer(this._fontIndexBuffer);
|
|
909
|
-
this._fontIndexBuffer = h.createArrayBuffer(
|
|
1181
|
+
this._fontIndexBuffer = h.createArrayBuffer(
|
|
1182
|
+
this._fontIndexArr,
|
|
1183
|
+
1,
|
|
1184
|
+
this._fontIndexArr.length
|
|
1185
|
+
);
|
|
910
1186
|
}
|
|
911
1187
|
|
|
912
1188
|
createTexCoordBuffer() {
|
|
913
1189
|
var h = this._renderer.handler;
|
|
914
1190
|
h.gl.deleteBuffer(this._texCoordBuffer);
|
|
915
|
-
this._texCoordBuffer = h.createArrayBuffer(
|
|
1191
|
+
this._texCoordBuffer = h.createArrayBuffer(
|
|
1192
|
+
this._texCoordArr,
|
|
1193
|
+
4,
|
|
1194
|
+
this._texCoordArr.length / 4
|
|
1195
|
+
);
|
|
916
1196
|
|
|
917
1197
|
h.gl.deleteBuffer(this._gliphParamBuffer);
|
|
918
|
-
this._gliphParamBuffer = h.createArrayBuffer(
|
|
1198
|
+
this._gliphParamBuffer = h.createArrayBuffer(
|
|
1199
|
+
this._gliphParamArr,
|
|
1200
|
+
4,
|
|
1201
|
+
this._gliphParamArr.length / 4
|
|
1202
|
+
);
|
|
919
1203
|
}
|
|
920
1204
|
|
|
921
1205
|
createOutlineBuffer() {
|
|
@@ -925,13 +1209,21 @@ class LabelHandler extends BillboardHandler {
|
|
|
925
1209
|
this._outlineBuffer = h.createArrayBuffer(this._outlineArr, 1, this._outlineArr.length);
|
|
926
1210
|
|
|
927
1211
|
h.gl.deleteBuffer(this._noOutlineBuffer);
|
|
928
|
-
this._noOutlineBuffer = h.createArrayBuffer(
|
|
1212
|
+
this._noOutlineBuffer = h.createArrayBuffer(
|
|
1213
|
+
this._noOutlineArr,
|
|
1214
|
+
1,
|
|
1215
|
+
this._noOutlineArr.length
|
|
1216
|
+
);
|
|
929
1217
|
}
|
|
930
1218
|
|
|
931
1219
|
createOutlineColorBuffer() {
|
|
932
1220
|
var h = this._renderer.handler;
|
|
933
1221
|
h.gl.deleteBuffer(this._outlineColorBuffer);
|
|
934
|
-
this._outlineColorBuffer = h.createArrayBuffer(
|
|
1222
|
+
this._outlineColorBuffer = h.createArrayBuffer(
|
|
1223
|
+
this._outlineColorArr,
|
|
1224
|
+
4,
|
|
1225
|
+
this._outlineColorArr.length / 4
|
|
1226
|
+
);
|
|
935
1227
|
}
|
|
936
1228
|
|
|
937
1229
|
setMaxLetters(c) {
|
|
@@ -943,6 +1235,6 @@ class LabelHandler extends BillboardHandler {
|
|
|
943
1235
|
// it is empty
|
|
944
1236
|
return null;
|
|
945
1237
|
}
|
|
946
|
-
}
|
|
1238
|
+
}
|
|
947
1239
|
|
|
948
|
-
export { LabelHandler };
|
|
1240
|
+
export { LabelHandler };
|
|
@@ -187,7 +187,8 @@ class Polyline {
|
|
|
187
187
|
* @param {Array.<Array.<og.LonLat>>} [outTransformedPathLonLat] - Geodetic coordinates out array.
|
|
188
188
|
* @param {Array.<Array.<og.LonLat>>} [outPath3v] - Cartesian coordinates out array.
|
|
189
189
|
* @param {Array.<Array.<og.LonLat>>} [outTransformedPathMerc] - Mercator coordinates out array.
|
|
190
|
-
* @param {og.Extent} outExtent - Geodetic line extent.
|
|
190
|
+
* @param {og.Extent} [outExtent] - Geodetic line extent.
|
|
191
|
+
* @param {Array} [outColors]
|
|
191
192
|
* @static
|
|
192
193
|
*/
|
|
193
194
|
static appendLineData3v(
|
|
@@ -457,7 +458,7 @@ class Polyline {
|
|
|
457
458
|
* @param {Array.<Array.<og.LonLat>>} [outTransformedPathLonLat] - Geodetic coordinates out array.
|
|
458
459
|
* @param {Array.<Array.<og.LonLat>>} [outPath3v] - Cartesian coordinates out array.
|
|
459
460
|
* @param {Array.<Array.<og.LonLat>>} [outTransformedPathMerc] - Mercator coordinates out array.
|
|
460
|
-
* @param {og.Extent} outExtent - Geodetic line extent.
|
|
461
|
+
* @param {og.Extent} [outExtent] - Geodetic line extent.
|
|
461
462
|
* @static
|
|
462
463
|
*/
|
|
463
464
|
static appendPoint3v(
|