@openglobus/og 0.11.5 → 0.12.0
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 +5 -2
- package/package.json +12 -14
- package/src/og/Clock.js +6 -10
- package/src/og/Events.js +5 -7
- package/src/og/Extent.js +73 -32
- package/src/og/Globe.js +25 -10
- package/src/og/ImageCanvas.js +18 -15
- package/src/og/LonLat.js +13 -10
- package/src/og/Popup.js +19 -17
- package/src/og/QueueArray.js +3 -4
- package/src/og/Rectangle.js +4 -6
- package/src/og/Stack.js +2 -4
- package/src/og/ajax.js +20 -14
- package/src/og/astro/earth.js +21 -15
- package/src/og/bv/Box.js +2 -3
- package/src/og/bv/Sphere.js +10 -7
- package/src/og/camera/Camera.js +70 -79
- package/src/og/camera/Frustum.js +19 -12
- package/src/og/camera/PlanetCamera.js +33 -34
- package/src/og/control/CompassButton.js +1 -2
- package/src/og/control/Control.js +7 -9
- package/src/og/control/DebugInfo.js +2 -3
- package/src/og/control/EarthNavigation.js +26 -17
- package/src/og/control/KeyboardNavigation.js +9 -9
- package/src/og/control/LayerSwitcher.js +21 -20
- package/src/og/control/Lighting.js +74 -64
- package/src/og/control/MouseNavigation.js +30 -29
- package/src/og/control/MouseWheelZoomControl.js +257 -0
- package/src/og/control/SegmentBoundVisualization.js +5 -6
- package/src/og/control/ShowFps.js +12 -7
- package/src/og/control/SimpleNavigation.js +5 -7
- package/src/og/control/Sun.js +24 -14
- package/src/og/control/ToggleWireframe.js +3 -3
- package/src/og/control/TouchNavigation.js +43 -32
- package/src/og/control/ZoomControl.js +40 -24
- package/src/og/control/index.js +2 -0
- package/src/og/control/visibleExtent/Segment.js +1862 -0
- package/src/og/control/visibleExtent/VisibleExtent.js +80 -0
- package/src/og/control/visibleExtent/drawnode.js +751 -0
- package/src/og/ellipsoid/Ellipsoid.js +149 -57
- package/src/og/ellipsoid/wgs84.js +3 -3
- package/src/og/entity/BaseBillboard.js +72 -30
- package/src/og/entity/Billboard.js +9 -5
- package/src/og/entity/BillboardHandler.js +315 -62
- package/src/og/entity/Entity.js +742 -704
- package/src/og/entity/EntityCollection.js +47 -24
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +895 -0
- package/src/og/entity/GeometryHandler.js +595 -123
- package/src/og/entity/Label.js +62 -30
- package/src/og/entity/LabelHandler.js +42 -243
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +76 -28
- package/src/og/entity/PointCloudHandler.js +5 -5
- package/src/og/entity/Ray.js +49 -16
- package/src/og/entity/Strip.js +72 -43
- package/src/og/entity/StripHandler.js +23 -23
- package/src/og/layer/BaseGeoImage.js +50 -19
- package/src/og/layer/CanvasTiles.js +16 -17
- package/src/og/layer/GeoImage.js +8 -16
- package/src/og/layer/GeoTexture2d.js +2 -10
- package/src/og/layer/GeoVideo.js +2 -10
- package/src/og/layer/KML.js +55 -33
- package/src/og/layer/Layer.js +24 -33
- package/src/og/layer/Material.js +1 -1
- package/src/og/layer/Vector.js +94 -48
- package/src/og/layer/WMS.js +33 -18
- package/src/og/layer/XYZ.js +24 -26
- package/src/og/light/LightSource.js +19 -12
- package/src/og/math/Mat3.js +24 -12
- package/src/og/math/Mat4.js +603 -603
- package/src/og/math/Plane.js +19 -18
- package/src/og/math/Ray.js +17 -12
- package/src/og/math/Vec2.js +24 -14
- package/src/og/math/Vec3.js +78 -32
- package/src/og/math/coder.js +7 -7
- package/src/og/proj/EPSG3857.js +3 -3
- package/src/og/proj/EPSG4326.js +3 -3
- package/src/og/proj/Proj.js +2 -4
- package/src/og/quadTree/Node.js +50 -95
- package/src/og/quadTree/quadTree.js +1 -1
- package/src/og/renderer/Renderer.js +106 -126
- package/src/og/renderer/RendererEvents.js +45 -23
- package/src/og/scene/BaseNode.js +2 -3
- package/src/og/scene/Planet.js +139 -191
- package/src/og/scene/RenderNode.js +15 -8
- package/src/og/segment/Segment.js +93 -268
- package/src/og/segment/Slice.js +45 -0
- package/src/og/shaders/drawnode.js +174 -360
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/pointCloud.js +41 -41
- package/src/og/shaders/shape.js +12 -18
- package/src/og/shaders/skybox.js +36 -36
- package/src/og/shaders/toneMapping.js +1 -0
- package/src/og/shapes/BaseShape.js +108 -36
- package/src/og/shapes/Icosphere.js +25 -10
- package/src/og/shapes/Sphere.js +8 -11
- package/src/og/terrain/EmptyTerrain.js +3 -2
- package/src/og/terrain/GlobusTerrain.js +2 -0
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/GeoImageCreator.js +5 -1
- package/src/og/utils/Loader.js +1 -1
- package/src/og/utils/PlainSegmentWorker.js +0 -13
- package/src/og/utils/TextureAtlas.js +18 -20
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +2 -2
- package/src/og/webgl/Handler.js +219 -162
- package/src/og/webgl/Multisample.js +44 -16
- package/src/og/webgl/Program.js +78 -33
- package/src/og/webgl/callbacks.js +3 -3
- package/types/Clock.d.ts +0 -94
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -77
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -82
- package/types/ImageCanvas.d.ts +0 -123
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -42
- package/types/QueueArray.d.ts +0 -19
- package/types/Rectangle.d.ts +0 -80
- package/types/Stack.d.ts +0 -19
- package/types/ajax.d.ts +0 -24
- package/types/arial.d.ts +0 -48
- package/types/astro/astro.d.ts +0 -38
- package/types/astro/earth.d.ts +0 -7
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -30
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -312
- package/types/camera/Frustum.d.ts +0 -133
- package/types/camera/PlanetCamera.d.ts +0 -218
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -17
- package/types/control/Control.d.ts +0 -104
- package/types/control/DebugInfo.d.ts +0 -15
- package/types/control/EarthCoordinates.d.ts +0 -47
- package/types/control/EarthNavigation.d.ts +0 -42
- package/types/control/GeoImageDragControl.d.ts +0 -6
- package/types/control/KeyboardNavigation.d.ts +0 -21
- package/types/control/LayerSwitcher.d.ts +0 -21
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -47
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -11
- package/types/control/SimpleNavigation.d.ts +0 -25
- package/types/control/Sun.d.ts +0 -50
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -48
- package/types/control/ZoomControl.d.ts +0 -27
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -146
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -6
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -78
- package/types/entity/Entity.d.ts +0 -333
- package/types/entity/EntityCollection.d.ts +0 -311
- package/types/entity/Geometry.d.ts +0 -74
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -189
- package/types/entity/LabelHandler.d.ts +0 -29
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -306
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -124
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -119
- package/types/entity/StripHandler.d.ts +0 -38
- package/types/entity/index.d.ts +0 -8
- package/types/index.core.d.ts +0 -65
- package/types/index.d.ts +0 -45
- package/types/index.webgl.d.ts +0 -7
- package/types/input/KeyboardHandler.d.ts +0 -10
- package/types/input/MouseHandler.d.ts +0 -5
- package/types/input/TouchHandler.d.ts +0 -5
- package/types/input/input.d.ts +0 -34
- package/types/layer/BaseGeoImage.d.ts +0 -94
- package/types/layer/CanvasTiles.d.ts +0 -68
- package/types/layer/GeoImage.d.ts +0 -52
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -55
- package/types/layer/KML.d.ts +0 -63
- package/types/layer/Layer.d.ts +0 -326
- package/types/layer/Material.d.ts +0 -45
- package/types/layer/Vector.d.ts +0 -208
- package/types/layer/WMS.d.ts +0 -63
- package/types/layer/XYZ.d.ts +0 -120
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -178
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -65
- package/types/math/Mat4.d.ts +0 -176
- package/types/math/Plane.d.ts +0 -18
- package/types/math/Quat.d.ts +0 -379
- package/types/math/Ray.d.ts +0 -82
- package/types/math/Vec2.d.ts +0 -309
- package/types/math/Vec3.d.ts +0 -460
- package/types/math/Vec4.d.ts +0 -162
- package/types/math/coder.d.ts +0 -43
- package/types/math/index.d.ts +0 -11
- package/types/math.d.ts +0 -261
- package/types/mercator.d.ts +0 -92
- package/types/proj/EPSG3857.d.ts +0 -6
- package/types/proj/EPSG4326.d.ts +0 -6
- package/types/proj/Proj.d.ts +0 -42
- package/types/quadTree/EntityCollectionNode.d.ts +0 -34
- package/types/quadTree/Node.d.ts +0 -61
- package/types/quadTree/quadTree.d.ts +0 -40
- package/types/renderer/Renderer.d.ts +0 -298
- package/types/renderer/RendererEvents.d.ts +0 -233
- package/types/res/images.d.ts +0 -3
- package/types/scene/Axes.d.ts +0 -11
- package/types/scene/BaseNode.d.ts +0 -60
- package/types/scene/Planet.d.ts +0 -577
- package/types/scene/RenderNode.d.ts +0 -142
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -279
- package/types/segment/SegmentLonLat.d.ts +0 -16
- package/types/segment/segmentHelper.d.ts +0 -13
- package/types/shaders/billboard.d.ts +0 -3
- package/types/shaders/depth.d.ts +0 -2
- package/types/shaders/drawnode.d.ts +0 -7
- package/types/shaders/label.d.ts +0 -4
- package/types/shaders/pointCloud.d.ts +0 -2
- package/types/shaders/polyline.d.ts +0 -3
- package/types/shaders/ray.d.ts +0 -2
- package/types/shaders/screenFrame.d.ts +0 -2
- package/types/shaders/shape.d.ts +0 -4
- package/types/shaders/skybox.d.ts +0 -2
- package/types/shaders/toneMapping.d.ts +0 -2
- package/types/shapes/BaseShape.d.ts +0 -250
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -7
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -116
- package/types/terrain/MapboxTerrain.d.ts +0 -7
- package/types/terrain/index.d.ts +0 -5
- package/types/utils/FontAtlas.d.ts +0 -14
- package/types/utils/GeoImageCreator.d.ts +0 -30
- package/types/utils/ImagesCacheManager.d.ts +0 -10
- package/types/utils/Loader.d.ts +0 -25
- package/types/utils/NormalMapCreator.d.ts +0 -39
- package/types/utils/PlainSegmentWorker.d.ts +0 -10
- package/types/utils/TerrainWorker.d.ts +0 -9
- package/types/utils/TextureAtlas.d.ts +0 -111
- package/types/utils/VectorTileCreator.d.ts +0 -16
- package/types/utils/colorTable.d.ts +0 -143
- package/types/utils/earcut.d.ts +0 -6
- package/types/utils/shared.d.ts +0 -231
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -388
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -89
- package/types/webgl/callbacks.d.ts +0 -1
- package/types/webgl/index.d.ts +0 -6
- package/types/webgl/types.d.ts +0 -2
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
* @module og/entity/PointCloud
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { Vec3 } from
|
|
8
|
-
import { Vec4 } from
|
|
7
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
8
|
+
import { Vec4 } from "../math/Vec4.js";
|
|
9
9
|
|
|
10
10
|
const COORDINATES_BUFFER = 0;
|
|
11
11
|
const COLOR_BUFFER = 1;
|
|
@@ -15,7 +15,7 @@ const PICKING_COLOR_BUFFER = 2;
|
|
|
15
15
|
* PointCloud object.
|
|
16
16
|
* @class
|
|
17
17
|
* @param {*} [options] - Point cloud options:
|
|
18
|
-
* @param {Array.<Array.<number>>} [options.points] - Points cartesian coordinates array,
|
|
18
|
+
* @param {Array.<Array.<number>>} [options.points] - Points cartesian coordinates array,
|
|
19
19
|
* where first three is cartesian coordinates, next fourth is a RGBA color, and last is an point properties.
|
|
20
20
|
* @param {number} [options.pointSize] - Point screen size in pixels.
|
|
21
21
|
* @param {number} [options.pickingDistance] - Point border picking size in screen pixels.
|
|
@@ -33,7 +33,6 @@ const PICKING_COLOR_BUFFER = 2;
|
|
|
33
33
|
*/
|
|
34
34
|
class PointCloud {
|
|
35
35
|
constructor(options) {
|
|
36
|
-
|
|
37
36
|
options = options || {};
|
|
38
37
|
|
|
39
38
|
/**
|
|
@@ -49,7 +48,7 @@ class PointCloud {
|
|
|
49
48
|
* @public
|
|
50
49
|
* @type {boolean}
|
|
51
50
|
*/
|
|
52
|
-
this.visibility =
|
|
51
|
+
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
53
52
|
|
|
54
53
|
/**
|
|
55
54
|
* Point screen size in pixels.
|
|
@@ -145,7 +144,6 @@ class PointCloud {
|
|
|
145
144
|
* @public
|
|
146
145
|
*/
|
|
147
146
|
clear() {
|
|
148
|
-
|
|
149
147
|
this._points.length = 0;
|
|
150
148
|
this._points = [];
|
|
151
149
|
|
|
@@ -217,7 +215,7 @@ class PointCloud {
|
|
|
217
215
|
for (var i = 0; i < points.length; i++) {
|
|
218
216
|
var pi = points[i];
|
|
219
217
|
var pos = new Vec3(pi[0], pi[1], pi[2]),
|
|
220
|
-
col = new Vec4(pi[3], pi[4], pi[5],
|
|
218
|
+
col = new Vec4(pi[3], pi[4], pi[5], pi[6] == undefined ? 255.0 : pi[6]);
|
|
221
219
|
this._coordinatesData.push(pos.x, pos.y, pos.z);
|
|
222
220
|
this._colorData.push(col.x / 255.0, col.y / 255.0, col.z / 255.0, col.w / 255.0);
|
|
223
221
|
var p = {
|
|
@@ -233,7 +231,12 @@ class PointCloud {
|
|
|
233
231
|
|
|
234
232
|
if (this._renderNode) {
|
|
235
233
|
this._renderNode.renderer.assignPickingColor(p);
|
|
236
|
-
this._pickingColorData.push(
|
|
234
|
+
this._pickingColorData.push(
|
|
235
|
+
p._pickingColor.x / 255.0,
|
|
236
|
+
p._pickingColor.y / 255.0,
|
|
237
|
+
p._pickingColor.z / 255.0,
|
|
238
|
+
1.0
|
|
239
|
+
);
|
|
237
240
|
}
|
|
238
241
|
}
|
|
239
242
|
|
|
@@ -243,21 +246,18 @@ class PointCloud {
|
|
|
243
246
|
}
|
|
244
247
|
|
|
245
248
|
setPointPosition(index, x, y, z) {
|
|
246
|
-
|
|
247
249
|
// TODO: ...
|
|
248
250
|
|
|
249
251
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
setPointColor(index, r, g, b, a) {
|
|
253
|
-
|
|
254
255
|
// TODO: ...
|
|
255
256
|
|
|
256
257
|
this._changedBuffers[COLOR_BUFFER] = true;
|
|
257
258
|
}
|
|
258
259
|
|
|
259
260
|
addPoints(points) {
|
|
260
|
-
|
|
261
261
|
// TODO: ...
|
|
262
262
|
|
|
263
263
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -266,7 +266,6 @@ class PointCloud {
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
addPoint(index, point) {
|
|
269
|
-
|
|
270
269
|
// TODO: ...
|
|
271
270
|
|
|
272
271
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -285,7 +284,6 @@ class PointCloud {
|
|
|
285
284
|
}
|
|
286
285
|
|
|
287
286
|
removePoint(index) {
|
|
288
|
-
|
|
289
287
|
// TODO: ...
|
|
290
288
|
|
|
291
289
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -294,7 +292,6 @@ class PointCloud {
|
|
|
294
292
|
}
|
|
295
293
|
|
|
296
294
|
insertPoint(index, point) {
|
|
297
|
-
|
|
298
295
|
// TODO: ...
|
|
299
296
|
|
|
300
297
|
this._changedBuffers[COORDINATES_BUFFER] = true;
|
|
@@ -316,7 +313,6 @@ class PointCloud {
|
|
|
316
313
|
|
|
317
314
|
draw() {
|
|
318
315
|
if (this.visibility && this._coordinatesData.length) {
|
|
319
|
-
|
|
320
316
|
this._update();
|
|
321
317
|
|
|
322
318
|
var rn = this._renderNode;
|
|
@@ -327,18 +323,32 @@ class PointCloud {
|
|
|
327
323
|
sha = p.attributes,
|
|
328
324
|
shu = p.uniforms;
|
|
329
325
|
|
|
330
|
-
gl.polygonOffset(
|
|
326
|
+
gl.polygonOffset(
|
|
327
|
+
this._handler._entityCollection.polygonOffsetFactor,
|
|
328
|
+
this._handler._entityCollection.polygonOffsetUnits
|
|
329
|
+
);
|
|
331
330
|
|
|
332
331
|
sh.activate();
|
|
333
332
|
|
|
334
|
-
gl.uniformMatrix4fv(
|
|
333
|
+
gl.uniformMatrix4fv(
|
|
334
|
+
shu.projectionViewMatrix,
|
|
335
|
+
false,
|
|
336
|
+
r.activeCamera._projectionViewMatrix._m
|
|
337
|
+
);
|
|
335
338
|
|
|
336
339
|
gl.uniform1f(shu.opacity, this._handler._entityCollection._fadingOpacity);
|
|
337
340
|
|
|
338
341
|
gl.uniform1f(shu.pointSize, this.pointSize);
|
|
339
342
|
|
|
340
343
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._coordinatesBuffer);
|
|
341
|
-
gl.vertexAttribPointer(
|
|
344
|
+
gl.vertexAttribPointer(
|
|
345
|
+
sha.coordinates,
|
|
346
|
+
this._coordinatesBuffer.itemSize,
|
|
347
|
+
gl.FLOAT,
|
|
348
|
+
false,
|
|
349
|
+
0,
|
|
350
|
+
0
|
|
351
|
+
);
|
|
342
352
|
|
|
343
353
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._colorBuffer);
|
|
344
354
|
gl.vertexAttribPointer(sha.colors, this._colorBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
@@ -359,19 +369,40 @@ class PointCloud {
|
|
|
359
369
|
|
|
360
370
|
sh.activate();
|
|
361
371
|
|
|
362
|
-
gl.polygonOffset(
|
|
372
|
+
gl.polygonOffset(
|
|
373
|
+
this._handler._entityCollection.polygonOffsetFactor,
|
|
374
|
+
this._handler._entityCollection.polygonOffsetUnits
|
|
375
|
+
);
|
|
363
376
|
|
|
364
|
-
gl.uniformMatrix4fv(
|
|
377
|
+
gl.uniformMatrix4fv(
|
|
378
|
+
shu.projectionViewMatrix,
|
|
379
|
+
false,
|
|
380
|
+
r.activeCamera._projectionViewMatrix._m
|
|
381
|
+
);
|
|
365
382
|
|
|
366
383
|
gl.uniform1f(shu.opacity, this._handler._entityCollection._fadingOpacity);
|
|
367
384
|
|
|
368
385
|
gl.uniform1f(shu.pointSize, this.pointSize + this.pickingDistance);
|
|
369
386
|
|
|
370
387
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._coordinatesBuffer);
|
|
371
|
-
gl.vertexAttribPointer(
|
|
388
|
+
gl.vertexAttribPointer(
|
|
389
|
+
sha.coordinates,
|
|
390
|
+
this._coordinatesBuffer.itemSize,
|
|
391
|
+
gl.FLOAT,
|
|
392
|
+
false,
|
|
393
|
+
0,
|
|
394
|
+
0
|
|
395
|
+
);
|
|
372
396
|
|
|
373
397
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._pickingColorBuffer);
|
|
374
|
-
gl.vertexAttribPointer(
|
|
398
|
+
gl.vertexAttribPointer(
|
|
399
|
+
sha.colors,
|
|
400
|
+
this._pickingColorBuffer.itemSize,
|
|
401
|
+
gl.FLOAT,
|
|
402
|
+
false,
|
|
403
|
+
0,
|
|
404
|
+
0
|
|
405
|
+
);
|
|
375
406
|
|
|
376
407
|
gl.drawArrays(gl.POINTS, 0, this._coordinatesBuffer.numItems);
|
|
377
408
|
}
|
|
@@ -415,19 +446,31 @@ class PointCloud {
|
|
|
415
446
|
_createCoordinatesBuffer() {
|
|
416
447
|
var h = this._renderNode.renderer.handler;
|
|
417
448
|
h.gl.deleteBuffer(this._coordinatesBuffer);
|
|
418
|
-
this._coordinatesBuffer = h.createArrayBuffer(
|
|
449
|
+
this._coordinatesBuffer = h.createArrayBuffer(
|
|
450
|
+
new Float32Array(this._coordinatesData),
|
|
451
|
+
3,
|
|
452
|
+
this._coordinatesData.length / 3
|
|
453
|
+
);
|
|
419
454
|
}
|
|
420
455
|
|
|
421
456
|
_createColorBuffer() {
|
|
422
457
|
var h = this._renderNode.renderer.handler;
|
|
423
458
|
h.gl.deleteBuffer(this._colorBuffer);
|
|
424
|
-
this._colorBuffer = h.createArrayBuffer(
|
|
459
|
+
this._colorBuffer = h.createArrayBuffer(
|
|
460
|
+
new Float32Array(this._colorData),
|
|
461
|
+
4,
|
|
462
|
+
this._colorData.length / 4
|
|
463
|
+
);
|
|
425
464
|
}
|
|
426
465
|
|
|
427
466
|
_createPickingColorBuffer() {
|
|
428
467
|
var h = this._renderNode.renderer.handler;
|
|
429
468
|
h.gl.deleteBuffer(this._pickingColorBuffer);
|
|
430
|
-
this._pickingColorBuffer = h.createArrayBuffer(
|
|
469
|
+
this._pickingColorBuffer = h.createArrayBuffer(
|
|
470
|
+
new Float32Array(this._pickingColorData),
|
|
471
|
+
4,
|
|
472
|
+
this._pickingColorData.length / 4
|
|
473
|
+
);
|
|
431
474
|
}
|
|
432
475
|
|
|
433
476
|
_setPickingColors() {
|
|
@@ -437,11 +480,16 @@ class PointCloud {
|
|
|
437
480
|
p._entity = this._entity;
|
|
438
481
|
p._entityCollection = this._entity._entityCollection;
|
|
439
482
|
this._renderNode.renderer.assignPickingColor(p);
|
|
440
|
-
this._pickingColorData.push(
|
|
483
|
+
this._pickingColorData.push(
|
|
484
|
+
p._pickingColor.x / 255.0,
|
|
485
|
+
p._pickingColor.y / 255.0,
|
|
486
|
+
p._pickingColor.z / 255.0,
|
|
487
|
+
1.0
|
|
488
|
+
);
|
|
441
489
|
}
|
|
442
490
|
this._changedBuffers[PICKING_COLOR_BUFFER] = true;
|
|
443
491
|
}
|
|
444
492
|
}
|
|
445
493
|
}
|
|
446
494
|
|
|
447
|
-
export { PointCloud };
|
|
495
|
+
export { PointCloud };
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
* @module og/entity/PointCloudHandler
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as shaders from
|
|
7
|
+
import * as shaders from "../shaders/pointCloud.js";
|
|
8
8
|
|
|
9
9
|
class PointCloudHandler {
|
|
10
10
|
constructor(entityCollection) {
|
|
11
|
-
|
|
12
11
|
/**
|
|
13
12
|
* Picking rendering option.
|
|
14
13
|
* @public
|
|
@@ -72,7 +71,8 @@ class PointCloudHandler {
|
|
|
72
71
|
pointCloud._handler = this;
|
|
73
72
|
pointCloud._handlerIndex = this._pointClouds.length;
|
|
74
73
|
this._pointClouds.push(pointCloud);
|
|
75
|
-
this._entityCollection &&
|
|
74
|
+
this._entityCollection &&
|
|
75
|
+
this._entityCollection.renderNode &&
|
|
76
76
|
pointCloud.setRenderNode(this._entityCollection.renderNode);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -123,4 +123,4 @@ class PointCloudHandler {
|
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
export { PointCloudHandler };
|
|
126
|
+
export { PointCloudHandler };
|
package/src/og/entity/Ray.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* @module og/entity/BaseBillboard
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import * as utils from
|
|
8
|
-
import { Vec3 } from
|
|
9
|
-
import { Entity } from
|
|
10
|
-
import { doubleToTwoFloats2 } from
|
|
7
|
+
import * as utils from "../utils/shared.js";
|
|
8
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
9
|
+
import { Entity } from "./Entity.js";
|
|
10
|
+
import { doubleToTwoFloats2 } from "../math/coder.js";
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Ray class.
|
|
@@ -43,7 +43,11 @@ class Ray {
|
|
|
43
43
|
this._startPosition = utils.createVector3(options.startPosition);
|
|
44
44
|
this._startPositionHigh = new Vec3();
|
|
45
45
|
this._startPositionLow = new Vec3();
|
|
46
|
-
Vec3.doubleToTwoFloats(
|
|
46
|
+
Vec3.doubleToTwoFloats(
|
|
47
|
+
this._startPosition,
|
|
48
|
+
this._startPositionHigh,
|
|
49
|
+
this._startPositionLow
|
|
50
|
+
);
|
|
47
51
|
|
|
48
52
|
// RTE end position
|
|
49
53
|
this._endPosition = utils.createVector3(options.endPosition);
|
|
@@ -95,8 +99,17 @@ class Ray {
|
|
|
95
99
|
this._startPosition.x = x;
|
|
96
100
|
this._startPosition.y = y;
|
|
97
101
|
this._startPosition.z = z;
|
|
98
|
-
Vec3.doubleToTwoFloats(
|
|
99
|
-
|
|
102
|
+
Vec3.doubleToTwoFloats(
|
|
103
|
+
this._startPosition,
|
|
104
|
+
this._startPositionHigh,
|
|
105
|
+
this._startPositionLow
|
|
106
|
+
);
|
|
107
|
+
this._handler &&
|
|
108
|
+
this._handler.setStartPositionArr(
|
|
109
|
+
this._handlerIndex,
|
|
110
|
+
this._startPositionHigh,
|
|
111
|
+
this._startPositionLow
|
|
112
|
+
);
|
|
100
113
|
}
|
|
101
114
|
|
|
102
115
|
/**
|
|
@@ -108,8 +121,17 @@ class Ray {
|
|
|
108
121
|
this._startPosition.x = position.x;
|
|
109
122
|
this._startPosition.y = position.y;
|
|
110
123
|
this._startPosition.z = position.z;
|
|
111
|
-
Vec3.doubleToTwoFloats(
|
|
112
|
-
|
|
124
|
+
Vec3.doubleToTwoFloats(
|
|
125
|
+
this._startPosition,
|
|
126
|
+
this._startPositionHigh,
|
|
127
|
+
this._startPositionLow
|
|
128
|
+
);
|
|
129
|
+
this._handler &&
|
|
130
|
+
this._handler.setStartPositionArr(
|
|
131
|
+
this._handlerIndex,
|
|
132
|
+
this._startPositionHigh,
|
|
133
|
+
this._startPositionLow
|
|
134
|
+
);
|
|
113
135
|
}
|
|
114
136
|
|
|
115
137
|
/**
|
|
@@ -124,7 +146,12 @@ class Ray {
|
|
|
124
146
|
this._endPosition.y = y;
|
|
125
147
|
this._endPosition.z = z;
|
|
126
148
|
Vec3.doubleToTwoFloats(this._endPosition, this._endPositionHigh, this._endPositionLow);
|
|
127
|
-
this._handler &&
|
|
149
|
+
this._handler &&
|
|
150
|
+
this._handler.setEndPositionArr(
|
|
151
|
+
this._handlerIndex,
|
|
152
|
+
this._endPositionHigh,
|
|
153
|
+
this._endPositionLow
|
|
154
|
+
);
|
|
128
155
|
}
|
|
129
156
|
|
|
130
157
|
/**
|
|
@@ -137,7 +164,12 @@ class Ray {
|
|
|
137
164
|
this._endPosition.y = position.y;
|
|
138
165
|
this._endPosition.z = position.z;
|
|
139
166
|
Vec3.doubleToTwoFloats(this._endPosition, this._endPositionHigh, this._endPositionLow);
|
|
140
|
-
this._handler &&
|
|
167
|
+
this._handler &&
|
|
168
|
+
this._handler.setEndPositionArr(
|
|
169
|
+
this._handlerIndex,
|
|
170
|
+
this._endPositionHigh,
|
|
171
|
+
this._endPositionLow
|
|
172
|
+
);
|
|
141
173
|
}
|
|
142
174
|
|
|
143
175
|
setLength(length) {
|
|
@@ -165,11 +197,11 @@ class Ray {
|
|
|
165
197
|
this._endColor.w = endColor.w;
|
|
166
198
|
}
|
|
167
199
|
|
|
168
|
-
this._handler &&
|
|
200
|
+
this._handler &&
|
|
201
|
+
this._handler.setRgbaArr(this._handlerIndex, this._startColor, this._endColor);
|
|
169
202
|
}
|
|
170
203
|
|
|
171
204
|
setColorsHTML(startColor, endColor) {
|
|
172
|
-
|
|
173
205
|
if (startColor) {
|
|
174
206
|
this._startColor = utils.htmlColorToRgba(startColor);
|
|
175
207
|
}
|
|
@@ -178,7 +210,8 @@ class Ray {
|
|
|
178
210
|
this._endColor = utils.htmlColorToRgba(endColor);
|
|
179
211
|
}
|
|
180
212
|
|
|
181
|
-
this._handler &&
|
|
213
|
+
this._handler &&
|
|
214
|
+
this._handler.setRgbaArr(this._handlerIndex, this._startColor, this._endColor);
|
|
182
215
|
}
|
|
183
216
|
|
|
184
217
|
/**
|
|
@@ -237,4 +270,4 @@ class Ray {
|
|
|
237
270
|
}
|
|
238
271
|
}
|
|
239
272
|
|
|
240
|
-
export { Ray };
|
|
273
|
+
export { Ray };
|