@openglobus/og 0.11.1 → 0.11.6
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/package.json +18 -20
- package/src/og/Clock.js +11 -11
- package/src/og/Deferred.js +1 -1
- package/src/og/Events.js +9 -7
- package/src/og/Extent.js +117 -72
- package/src/og/Globe.js +35 -22
- package/src/og/ImageCanvas.js +24 -18
- package/src/og/Lock.js +2 -2
- package/src/og/LonLat.js +40 -37
- package/src/og/Popup.js +21 -15
- package/src/og/QueueArray.js +7 -3
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +8 -5
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +23 -17
- package/src/og/astro/jd.js +44 -39
- package/src/og/astro/orbit.js +20 -18
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +17 -9
- package/src/og/camera/Camera.js +137 -86
- package/src/og/camera/Frustum.js +30 -19
- package/src/og/camera/PlanetCamera.js +30 -26
- package/src/og/control/CompassButton.js +8 -2
- package/src/og/control/Control.js +13 -11
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +62 -41
- package/src/og/control/EarthNavigation.js +20 -22
- package/src/og/control/GeoImageDragControl.js +1 -1
- package/src/og/control/KeyboardNavigation.js +12 -12
- package/src/og/control/LayerSwitcher.js +24 -23
- package/src/og/control/Lighting.js +1 -1
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +8 -9
- package/src/og/control/ShowFps.js +15 -10
- package/src/og/control/SimpleNavigation.js +8 -10
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +5 -5
- package/src/og/control/TouchNavigation.js +58 -45
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/control/index.js +4 -0
- package/src/og/ellipsoid/Ellipsoid.js +181 -85
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +97 -44
- package/src/og/entity/Billboard.js +15 -11
- package/src/og/entity/BillboardHandler.js +314 -64
- package/src/og/entity/Entity.js +106 -74
- package/src/og/entity/EntityCollection.js +72 -49
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +29 -26
- package/src/og/entity/GeometryHandler.js +598 -126
- package/src/og/entity/Label.js +74 -40
- package/src/og/entity/LabelHandler.js +47 -246
- package/src/og/entity/LabelWorker.js +213 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +81 -33
- package/src/og/entity/PointCloudHandler.js +9 -9
- package/src/og/entity/Polyline.js +39 -39
- package/src/og/entity/Ray.js +61 -28
- package/src/og/entity/ShapeHandler.js +1 -1
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +27 -27
- package/src/og/entity/index.js +8 -16
- package/src/og/input/KeyboardHandler.js +107 -104
- package/src/og/input/MouseHandler.js +81 -78
- package/src/og/input/TouchHandler.js +55 -51
- package/src/og/layer/BaseGeoImage.js +61 -30
- package/src/og/layer/CanvasTiles.js +26 -24
- package/src/og/layer/GeoImage.js +10 -10
- package/src/og/layer/GeoTexture2d.js +1 -1
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +66 -40
- package/src/og/layer/Layer.js +27 -17
- package/src/og/layer/Material.js +93 -61
- package/src/og/layer/Vector.js +118 -72
- package/src/og/layer/WMS.js +36 -19
- package/src/og/layer/XYZ.js +55 -48
- package/src/og/light/LightSource.js +47 -40
- package/src/og/math/Line2.js +24 -24
- package/src/og/math/Line3.js +103 -102
- package/src/og/math/Mat3.js +134 -121
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +980 -927
- package/src/og/math/Ray.js +195 -187
- package/src/og/math/Vec2.js +127 -117
- package/src/og/math/Vec3.js +206 -176
- package/src/og/math/Vec4.js +49 -53
- package/src/og/math/coder.js +18 -18
- package/src/og/math.js +12 -12
- package/src/og/mercator.js +11 -11
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +31 -31
- package/src/og/quadTree/EntityCollectionNode.js +310 -300
- package/src/og/quadTree/Node.js +1008 -993
- package/src/og/renderer/Renderer.js +768 -747
- package/src/og/renderer/RendererEvents.js +9 -6
- package/src/og/scene/Axes.js +1 -1
- package/src/og/scene/BaseNode.js +8 -9
- package/src/og/scene/Planet.js +115 -87
- package/src/og/scene/RenderNode.js +29 -22
- package/src/og/scene/SkyBox.js +1 -1
- package/src/og/segment/Segment.js +1886 -1878
- package/src/og/segment/SegmentLonLat.js +298 -268
- package/src/og/segment/segmentHelper.js +11 -11
- package/src/og/shaders/bloom.js +1 -1
- package/src/og/shaders/blur.js +2 -2
- package/src/og/shaders/depth.js +1 -1
- package/src/og/shaders/geoObject.js +211 -0
- package/src/og/shaders/label.js +1 -1
- package/src/og/shaders/lumFilter.js +1 -1
- package/src/og/shaders/pointCloud.js +42 -42
- package/src/og/shaders/screenFrame.js +1 -1
- package/src/og/shaders/shape.js +15 -21
- package/src/og/shaders/skybox.js +37 -37
- package/src/og/shaders/toneMapping.js +1 -1
- package/src/og/shapes/BaseShape.js +129 -57
- package/src/og/shapes/Icosphere.js +30 -15
- package/src/og/shapes/Sphere.js +13 -16
- package/src/og/terrain/BilTerrain.js +2 -1
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/Geoid.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +10 -10
- package/src/og/terrain/MapboxTerrain.js +1 -1
- package/src/og/utils/GeoImageCreator.js +9 -9
- package/src/og/utils/Loader.js +6 -6
- package/src/og/utils/NormalMapCreator.js +13 -13
- package/src/og/utils/TerrainWorker.js +1 -1
- package/src/og/utils/TextureAtlas.js +20 -22
- package/src/og/utils/VectorTileCreator.js +5 -5
- package/src/og/utils/earcut.js +1 -1
- package/src/og/utils/shared.js +15 -15
- package/src/og/webgl/Framebuffer.js +101 -53
- package/src/og/webgl/Handler.js +125 -85
- package/src/og/webgl/Multisample.js +55 -27
- package/src/og/webgl/Program.js +80 -35
- package/src/og/webgl/ProgramController.js +27 -23
- package/src/og/webgl/callbacks.js +8 -8
- package/types/Clock.d.ts +6 -2
- package/types/Deferred.d.ts +1 -1
- package/types/Events.d.ts +8 -4
- package/types/Extent.d.ts +37 -33
- package/types/Globe.d.ts +15 -13
- package/types/ImageCanvas.d.ts +5 -3
- package/types/LonLat.d.ts +24 -24
- package/types/Popup.d.ts +4 -0
- package/types/QueueArray.d.ts +6 -2
- package/types/Rectangle.d.ts +10 -4
- package/types/Stack.d.ts +4 -0
- package/types/ajax.d.ts +1 -1
- package/types/astro/earth.d.ts +3 -2
- package/types/bv/Box.d.ts +10 -5
- package/types/bv/Sphere.d.ts +13 -7
- package/types/camera/Camera.d.ts +90 -81
- package/types/camera/Frustum.d.ts +26 -22
- package/types/camera/PlanetCamera.d.ts +49 -53
- package/types/control/CompassButton.d.ts +4 -4
- package/types/control/Control.d.ts +7 -4
- package/types/control/DebugInfo.d.ts +3 -4
- package/types/control/EarthCoordinates.d.ts +6 -6
- package/types/control/EarthNavigation.d.ts +42 -0
- package/types/control/KeyboardNavigation.d.ts +3 -4
- package/types/control/LayerSwitcher.d.ts +3 -5
- package/types/control/Lighting.d.ts +3 -3
- package/types/control/MouseNavigation.d.ts +47 -0
- package/types/control/ScaleControl.d.ts +3 -3
- package/types/control/ShowFps.d.ts +3 -4
- package/types/control/SimpleNavigation.d.ts +3 -6
- package/types/control/Sun.d.ts +8 -10
- package/types/control/ToggleWireframe.d.ts +3 -3
- package/types/control/TouchNavigation.d.ts +48 -0
- package/types/control/ZoomControl.d.ts +3 -4
- package/types/control/index.d.ts +3 -1
- package/types/ellipsoid/Ellipsoid.d.ts +47 -43
- package/types/ellipsoid/wgs84.d.ts +3 -2
- package/types/entity/BaseBillboard.d.ts +41 -34
- package/types/entity/Billboard.d.ts +7 -7
- package/types/entity/BillboardHandler.d.ts +4 -0
- package/types/entity/Entity.d.ts +101 -83
- package/types/entity/EntityCollection.d.ts +57 -43
- package/types/entity/GeoObject.d.ts +111 -0
- package/types/entity/GeoObjectHandler.d.ts +77 -0
- package/types/entity/Geometry.d.ts +9 -7
- package/types/entity/GeometryHandler.d.ts +2 -2
- package/types/entity/Label.d.ts +24 -29
- package/types/entity/LabelHandler.d.ts +9 -2
- package/types/entity/LabelWorker.d.ts +9 -0
- package/types/entity/PointCloud.d.ts +8 -8
- package/types/entity/PointCloudHandler.d.ts +3 -3
- package/types/entity/Polyline.d.ts +58 -55
- package/types/entity/Ray.d.ts +19 -18
- package/types/entity/Strip.d.ts +8 -7
- package/types/entity/StripHandler.d.ts +3 -3
- package/types/entity/index.d.ts +7 -7
- package/types/input/KeyboardHandler.d.ts +10 -0
- package/types/input/MouseHandler.d.ts +5 -0
- package/types/input/TouchHandler.d.ts +5 -0
- package/types/layer/BaseGeoImage.d.ts +23 -35
- package/types/layer/CanvasTiles.d.ts +15 -22
- package/types/layer/GeoImage.d.ts +5 -18
- package/types/layer/GeoVideo.d.ts +5 -30
- package/types/layer/KML.d.ts +20 -15
- package/types/layer/Layer.d.ts +326 -0
- package/types/layer/Material.d.ts +45 -0
- package/types/layer/Vector.d.ts +208 -0
- package/types/layer/WMS.d.ts +4 -7
- package/types/layer/XYZ.d.ts +19 -25
- package/types/light/LightSource.d.ts +54 -53
- package/types/math/Line2.d.ts +11 -0
- package/types/math/Line3.d.ts +10 -0
- package/types/math/Mat3.d.ts +30 -18
- package/types/math/Mat4.d.ts +71 -52
- package/types/math/Plane.d.ts +5 -4
- package/types/math/Quat.d.ts +379 -0
- package/types/math/Ray.d.ts +82 -0
- package/types/math/Vec2.d.ts +102 -101
- package/types/math/Vec3.d.ts +143 -142
- package/types/math/Vec4.d.ts +40 -39
- package/types/math/coder.d.ts +12 -11
- package/types/math.d.ts +8 -8
- package/types/mercator.d.ts +3 -3
- package/types/proj/EPSG3857.d.ts +3 -2
- package/types/proj/EPSG4326.d.ts +3 -2
- package/types/proj/Proj.d.ts +42 -0
- package/types/quadTree/EntityCollectionNode.d.ts +34 -0
- package/types/quadTree/Node.d.ts +61 -0
- package/types/renderer/Renderer.d.ts +300 -0
- package/types/renderer/RendererEvents.d.ts +10 -7
- package/types/scene/BaseNode.d.ts +9 -9
- package/types/scene/Planet.d.ts +131 -126
- package/types/scene/RenderNode.d.ts +22 -23
- package/types/segment/Segment.d.ts +279 -0
- package/types/segment/SegmentLonLat.d.ts +16 -0
- package/types/shaders/geoObject.d.ts +3 -0
- package/types/shapes/BaseShape.d.ts +43 -40
- package/types/shapes/Sphere.d.ts +7 -7
- package/types/terrain/BilTerrain.d.ts +0 -1
- package/types/terrain/EmptyTerrain.d.ts +4 -4
- package/types/terrain/GlobusTerrain.d.ts +17 -54
- package/types/terrain/MapboxTerrain.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +3 -2
- package/types/utils/TextureAtlas.d.ts +8 -8
- package/types/utils/shared.d.ts +25 -24
- package/types/webgl/Framebuffer.d.ts +5 -5
- package/types/webgl/Handler.d.ts +68 -43
- package/types/webgl/Multisample.d.ts +5 -5
- package/types/webgl/Program.d.ts +8 -2
- package/types/webgl/ProgramController.d.ts +18 -13
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/inherits.d.ts +0 -4
package/src/og/entity/Ray.js
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
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.
|
|
14
14
|
* @class
|
|
15
15
|
* @param {Object} [options] - Options:
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
16
|
+
* @param {Vec3|Array.<number>} [options.startPosition] - Ray start point position.
|
|
17
|
+
* @param {Vec3|Array.<number>} [options.endPosition] - Ray end point position.
|
|
18
|
+
* @param {Vec3|Array.<number>} [options.startColor] - Ray start point color.
|
|
19
|
+
* @param {Vec3|Array.<number>} [options.endColor] - Ray end point color.
|
|
20
20
|
* @param {boolean} [options.visibility] - Visibility.
|
|
21
21
|
*/
|
|
22
22
|
class Ray {
|
|
@@ -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);
|
|
@@ -65,14 +69,14 @@ class Ray {
|
|
|
65
69
|
/**
|
|
66
70
|
* Entity instance that holds this billboard.
|
|
67
71
|
* @protected
|
|
68
|
-
* @type {
|
|
72
|
+
* @type {Entity}
|
|
69
73
|
*/
|
|
70
74
|
this._entity = null;
|
|
71
75
|
|
|
72
76
|
/**
|
|
73
77
|
* Handler that stores and renders this billboard object.
|
|
74
78
|
* @protected
|
|
75
|
-
* @type {
|
|
79
|
+
* @type {BillboardHandler}
|
|
76
80
|
*/
|
|
77
81
|
this._handler = null;
|
|
78
82
|
|
|
@@ -95,21 +99,39 @@ 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
|
/**
|
|
103
116
|
* Sets ray start position.
|
|
104
117
|
* @public
|
|
105
|
-
* @param {
|
|
118
|
+
* @param {Vec3} position - Cartesian coordinates.
|
|
106
119
|
*/
|
|
107
120
|
setStartPosition3v(position) {
|
|
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,20 +146,30 @@ 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
|
/**
|
|
131
158
|
* Sets ray end position.
|
|
132
159
|
* @public
|
|
133
|
-
* @param {
|
|
160
|
+
* @param {Vec3} position - Cartesian coordinates.
|
|
134
161
|
*/
|
|
135
162
|
setEndPosition3v(position) {
|
|
136
163
|
this._endPosition.x = position.x;
|
|
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,13 +210,14 @@ 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
|
/**
|
|
185
218
|
* Returns ray start position.
|
|
186
219
|
* @public
|
|
187
|
-
* @returns {
|
|
220
|
+
* @returns {Vec3}
|
|
188
221
|
*/
|
|
189
222
|
getStartPosition() {
|
|
190
223
|
return this._startPosition;
|
|
@@ -193,7 +226,7 @@ class Ray {
|
|
|
193
226
|
/**
|
|
194
227
|
* Returns ray end position.
|
|
195
228
|
* @public
|
|
196
|
-
* @returns {
|
|
229
|
+
* @returns {Vec3}
|
|
197
230
|
*/
|
|
198
231
|
getEndPosition() {
|
|
199
232
|
return this._endPosition;
|
|
@@ -230,11 +263,11 @@ class Ray {
|
|
|
230
263
|
/**
|
|
231
264
|
* Sets billboard picking color.
|
|
232
265
|
* @public
|
|
233
|
-
* @param {
|
|
266
|
+
* @param {Vec3} color - Picking color.
|
|
234
267
|
*/
|
|
235
268
|
setPickingColor3v(color) {
|
|
236
269
|
this._handler && this._handler.setPickingColorArr(this._handlerIndex, color);
|
|
237
270
|
}
|
|
238
|
-
}
|
|
271
|
+
}
|
|
239
272
|
|
|
240
|
-
export { Ray };
|
|
273
|
+
export { Ray };
|
package/src/og/entity/Strip.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import * as utils from
|
|
4
|
-
import { Vec3 } from
|
|
5
|
-
import { Line3 } from
|
|
3
|
+
import * as utils from "../utils/shared.js";
|
|
4
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
5
|
+
import { Line3 } from "../math/Line3.js";
|
|
6
6
|
|
|
7
7
|
let _tempHigh = new Vec3(),
|
|
8
8
|
_tempLow = new Vec3();
|
|
@@ -25,7 +25,6 @@ let _tempHigh = new Vec3(),
|
|
|
25
25
|
*/
|
|
26
26
|
class Strip {
|
|
27
27
|
constructor(options) {
|
|
28
|
-
|
|
29
28
|
options = options || {};
|
|
30
29
|
|
|
31
30
|
/**
|
|
@@ -41,7 +40,7 @@ class Strip {
|
|
|
41
40
|
* @public
|
|
42
41
|
* @type {boolean}
|
|
43
42
|
*/
|
|
44
|
-
this.visibility =
|
|
43
|
+
this.visibility = options.visibility != undefined ? options.visibility : true;
|
|
45
44
|
|
|
46
45
|
this.color = new Float32Array([1.0, 1.0, 1.0, 0.5]);
|
|
47
46
|
|
|
@@ -57,14 +56,14 @@ class Strip {
|
|
|
57
56
|
/**
|
|
58
57
|
* Parent collection render node.
|
|
59
58
|
* @private
|
|
60
|
-
* @type {
|
|
59
|
+
* @type {RenderNode}
|
|
61
60
|
*/
|
|
62
61
|
this._renderNode = null;
|
|
63
62
|
|
|
64
63
|
/**
|
|
65
64
|
* Entity instance that holds this strip.
|
|
66
65
|
* @private
|
|
67
|
-
* @type {
|
|
66
|
+
* @type {Entity}
|
|
68
67
|
*/
|
|
69
68
|
this._entity = null;
|
|
70
69
|
|
|
@@ -87,7 +86,7 @@ class Strip {
|
|
|
87
86
|
/**
|
|
88
87
|
* Handler that stores and renders this object.
|
|
89
88
|
* @private
|
|
90
|
-
* @type {
|
|
89
|
+
* @type {StripHandler}
|
|
91
90
|
*/
|
|
92
91
|
this._handler = null;
|
|
93
92
|
this._handlerIndex = -1;
|
|
@@ -111,7 +110,7 @@ class Strip {
|
|
|
111
110
|
/**
|
|
112
111
|
* Assign picking color.
|
|
113
112
|
* @protected
|
|
114
|
-
* @param {
|
|
113
|
+
* @param {Vec3} color - Picking RGB color.
|
|
115
114
|
*/
|
|
116
115
|
setPickingColor3v(color) {
|
|
117
116
|
this._pickingColor[0] = color.x / 255.0;
|
|
@@ -125,7 +124,6 @@ class Strip {
|
|
|
125
124
|
* @public
|
|
126
125
|
*/
|
|
127
126
|
clear() {
|
|
128
|
-
|
|
129
127
|
this._path.length = 0;
|
|
130
128
|
this._path = [];
|
|
131
129
|
|
|
@@ -177,7 +175,7 @@ class Strip {
|
|
|
177
175
|
/**
|
|
178
176
|
* Assign rendering scene node.
|
|
179
177
|
* @public
|
|
180
|
-
* @param {
|
|
178
|
+
* @param {RenderNode} renderNode - Assigned render node.
|
|
181
179
|
*/
|
|
182
180
|
setRenderNode(renderNode) {
|
|
183
181
|
this._renderNode = renderNode;
|
|
@@ -219,11 +217,30 @@ class Strip {
|
|
|
219
217
|
gl.uniform4fv(shu.uColor, this.color);
|
|
220
218
|
gl.uniform1f(shu.uOpacity, this._entity._entityCollection._fadingOpacity);
|
|
221
219
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
|
|
222
|
-
gl.vertexAttribPointer(
|
|
220
|
+
gl.vertexAttribPointer(
|
|
221
|
+
sha.aVertexPositionHigh,
|
|
222
|
+
this._verticesHighBuffer.itemSize,
|
|
223
|
+
gl.FLOAT,
|
|
224
|
+
false,
|
|
225
|
+
0,
|
|
226
|
+
0
|
|
227
|
+
);
|
|
223
228
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
|
|
224
|
-
gl.vertexAttribPointer(
|
|
229
|
+
gl.vertexAttribPointer(
|
|
230
|
+
sha.aVertexPositionLow,
|
|
231
|
+
this._verticesLowBuffer.itemSize,
|
|
232
|
+
gl.FLOAT,
|
|
233
|
+
false,
|
|
234
|
+
0,
|
|
235
|
+
0
|
|
236
|
+
);
|
|
225
237
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
226
|
-
gl.drawElements(
|
|
238
|
+
gl.drawElements(
|
|
239
|
+
r.handler.gl.TRIANGLE_STRIP,
|
|
240
|
+
this._indexBuffer.numItems,
|
|
241
|
+
gl.UNSIGNED_INT,
|
|
242
|
+
0
|
|
243
|
+
);
|
|
227
244
|
gl.enable(gl.CULL_FACE);
|
|
228
245
|
}
|
|
229
246
|
}
|
|
@@ -254,11 +271,30 @@ class Strip {
|
|
|
254
271
|
|
|
255
272
|
gl.uniform4fv(shu.uColor, this._pickingColor);
|
|
256
273
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesHighBuffer);
|
|
257
|
-
gl.vertexAttribPointer(
|
|
274
|
+
gl.vertexAttribPointer(
|
|
275
|
+
sha.aVertexPositionHigh,
|
|
276
|
+
this._verticesHighBuffer.itemSize,
|
|
277
|
+
gl.FLOAT,
|
|
278
|
+
false,
|
|
279
|
+
0,
|
|
280
|
+
0
|
|
281
|
+
);
|
|
258
282
|
gl.bindBuffer(gl.ARRAY_BUFFER, this._verticesLowBuffer);
|
|
259
|
-
gl.vertexAttribPointer(
|
|
283
|
+
gl.vertexAttribPointer(
|
|
284
|
+
sha.aVertexPositionLow,
|
|
285
|
+
this._verticesLowBuffer.itemSize,
|
|
286
|
+
gl.FLOAT,
|
|
287
|
+
false,
|
|
288
|
+
0,
|
|
289
|
+
0
|
|
290
|
+
);
|
|
260
291
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this._indexBuffer);
|
|
261
|
-
gl.drawElements(
|
|
292
|
+
gl.drawElements(
|
|
293
|
+
r.handler.gl.TRIANGLE_STRIP,
|
|
294
|
+
this._indexBuffer.numItems,
|
|
295
|
+
gl.UNSIGNED_INT,
|
|
296
|
+
0
|
|
297
|
+
);
|
|
262
298
|
gl.enable(gl.CULL_FACE);
|
|
263
299
|
}
|
|
264
300
|
}
|
|
@@ -289,9 +325,21 @@ class Strip {
|
|
|
289
325
|
gl.deleteBuffer(this._verticesHighBuffer);
|
|
290
326
|
gl.deleteBuffer(this._verticesLowBuffer);
|
|
291
327
|
|
|
292
|
-
this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
293
|
-
|
|
294
|
-
|
|
328
|
+
this._verticesHighBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
329
|
+
new Float32Array(this._verticesHigh),
|
|
330
|
+
3,
|
|
331
|
+
this._verticesHigh.length / 3
|
|
332
|
+
);
|
|
333
|
+
this._verticesLowBuffer = this._renderNode.renderer.handler.createArrayBuffer(
|
|
334
|
+
new Float32Array(this._verticesLow),
|
|
335
|
+
3,
|
|
336
|
+
this._verticesLow.length / 3
|
|
337
|
+
);
|
|
338
|
+
this._indexBuffer = this._renderNode.renderer.handler.createElementArrayBuffer(
|
|
339
|
+
new Uint32Array(this._indexes),
|
|
340
|
+
1,
|
|
341
|
+
this._indexes.length
|
|
342
|
+
);
|
|
295
343
|
}
|
|
296
344
|
}
|
|
297
345
|
|
|
@@ -299,11 +347,8 @@ class Strip {
|
|
|
299
347
|
let length = this._path.length;
|
|
300
348
|
|
|
301
349
|
if (length === 0) {
|
|
302
|
-
|
|
303
350
|
this._path.push([p2.clone(), p3.clone()]);
|
|
304
|
-
|
|
305
351
|
} else {
|
|
306
|
-
|
|
307
352
|
let p0 = this._path[length - 1][0],
|
|
308
353
|
p1 = this._path[length - 1][1];
|
|
309
354
|
|
|
@@ -323,19 +368,17 @@ class Strip {
|
|
|
323
368
|
let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
|
|
324
369
|
|
|
325
370
|
for (let i = 0; i < gs1; i++) {
|
|
326
|
-
|
|
327
371
|
let di = i / gs;
|
|
328
372
|
let p02 = p0.lerp(p2, di),
|
|
329
373
|
p13 = p1.lerp(p3, di);
|
|
330
374
|
|
|
331
375
|
for (let j = 0; j < gs1; j++) {
|
|
332
|
-
|
|
333
376
|
let dj = j / gs;
|
|
334
377
|
let p01 = p0.lerp(p1, dj),
|
|
335
378
|
p23 = p2.lerp(p3, dj);
|
|
336
379
|
|
|
337
380
|
if (d !== 1.0) {
|
|
338
|
-
|
|
381
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
339
382
|
} else {
|
|
340
383
|
p = p23;
|
|
341
384
|
}
|
|
@@ -369,17 +412,15 @@ class Strip {
|
|
|
369
412
|
}
|
|
370
413
|
|
|
371
414
|
setEdge3v(p2, p3, index) {
|
|
372
|
-
|
|
373
415
|
if (index === this._path.length) {
|
|
374
416
|
this.addEdge3v(p2, p3);
|
|
375
417
|
return;
|
|
376
|
-
}
|
|
377
|
-
|
|
418
|
+
}
|
|
419
|
+
if (this._path[index]) {
|
|
378
420
|
this._path[index][0] = p2;
|
|
379
421
|
this._path[index][1] = p3;
|
|
380
422
|
|
|
381
423
|
if (this._path.length > 1) {
|
|
382
|
-
|
|
383
424
|
let gs = this._gridSize,
|
|
384
425
|
gs1 = gs + 1;
|
|
385
426
|
|
|
@@ -391,7 +432,6 @@ class Strip {
|
|
|
391
432
|
vLow = this._verticesLow;
|
|
392
433
|
|
|
393
434
|
if (index === this._path.length - 1) {
|
|
394
|
-
|
|
395
435
|
let p0 = this._path[index - 1][0],
|
|
396
436
|
p1 = this._path[index - 1][1];
|
|
397
437
|
|
|
@@ -401,19 +441,17 @@ class Strip {
|
|
|
401
441
|
let d = Math.abs(p0.sub(p1).normal().dot(p2.sub(p0).normal()));
|
|
402
442
|
|
|
403
443
|
for (let i = 0; i < gs1; i++) {
|
|
404
|
-
|
|
405
444
|
let di = i / gs;
|
|
406
445
|
let p02 = p0.lerp(p2, di),
|
|
407
446
|
p13 = p1.lerp(p3, di);
|
|
408
447
|
|
|
409
448
|
for (let j = 0; j < gs1; j++) {
|
|
410
|
-
|
|
411
449
|
let dj = j / gs;
|
|
412
450
|
let p01 = p0.lerp(p1, dj),
|
|
413
451
|
p23 = p2.lerp(p3, dj);
|
|
414
452
|
|
|
415
453
|
if (d !== 1.0) {
|
|
416
|
-
|
|
454
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
417
455
|
} else {
|
|
418
456
|
p = p23;
|
|
419
457
|
}
|
|
@@ -433,9 +471,7 @@ class Strip {
|
|
|
433
471
|
vLow[ind3 + 2] = _tempLow.z;
|
|
434
472
|
}
|
|
435
473
|
}
|
|
436
|
-
|
|
437
474
|
} else if (index === 0) {
|
|
438
|
-
|
|
439
475
|
let ind = 0;
|
|
440
476
|
|
|
441
477
|
let p0 = p2,
|
|
@@ -445,18 +481,16 @@ class Strip {
|
|
|
445
481
|
p3 = this._path[1][1];
|
|
446
482
|
|
|
447
483
|
for (let i = 0; i < gs1; i++) {
|
|
448
|
-
|
|
449
484
|
let di = i / gs;
|
|
450
485
|
let p02 = p0.lerp(p2, di),
|
|
451
486
|
p13 = p1.lerp(p3, di);
|
|
452
487
|
|
|
453
488
|
for (let j = 0; j < gs1; j++) {
|
|
454
|
-
|
|
455
489
|
let dj = j / gs;
|
|
456
490
|
let p01 = p0.lerp(p1, dj),
|
|
457
491
|
p23 = p2.lerp(p3, dj);
|
|
458
492
|
|
|
459
|
-
|
|
493
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
460
494
|
|
|
461
495
|
ind = i * gs1 + j;
|
|
462
496
|
|
|
@@ -474,7 +508,6 @@ class Strip {
|
|
|
474
508
|
}
|
|
475
509
|
}
|
|
476
510
|
} else if (index > 0 && index < this._path.length) {
|
|
477
|
-
|
|
478
511
|
let p0 = this._path[index - 1][0],
|
|
479
512
|
p1 = this._path[index - 1][1];
|
|
480
513
|
|
|
@@ -486,7 +519,6 @@ class Strip {
|
|
|
486
519
|
ind = prev;
|
|
487
520
|
|
|
488
521
|
for (let i = 0; i < gs1; i++) {
|
|
489
|
-
|
|
490
522
|
let di = i / gs;
|
|
491
523
|
let p02 = p0.lerp(p2, di),
|
|
492
524
|
p35 = p3.lerp(p5, di),
|
|
@@ -494,13 +526,12 @@ class Strip {
|
|
|
494
526
|
p13 = p1.lerp(p3, di);
|
|
495
527
|
|
|
496
528
|
for (let j = 0; j < gs1; j++) {
|
|
497
|
-
|
|
498
529
|
let dj = j / gs;
|
|
499
530
|
let p01 = p0.lerp(p1, dj),
|
|
500
531
|
p23 = p2.lerp(p3, dj);
|
|
501
532
|
|
|
502
533
|
// prev
|
|
503
|
-
|
|
534
|
+
new Line3(p02, p13).intersects(new Line3(p01, p23), p);
|
|
504
535
|
|
|
505
536
|
let ij = i * gs1 + j;
|
|
506
537
|
|
|
@@ -523,7 +554,7 @@ class Strip {
|
|
|
523
554
|
|
|
524
555
|
p23 = p2.lerp(p3, dj);
|
|
525
556
|
|
|
526
|
-
|
|
557
|
+
new Line3(p24, p35).intersects(new Line3(p23, p45), p);
|
|
527
558
|
|
|
528
559
|
ind = next + ij;
|
|
529
560
|
|
|
@@ -564,14 +595,12 @@ class Strip {
|
|
|
564
595
|
}
|
|
565
596
|
|
|
566
597
|
setPath(path) {
|
|
567
|
-
|
|
568
598
|
this._verticesHigh = [];
|
|
569
599
|
this._verticesLow = [];
|
|
570
600
|
this._indexes = [];
|
|
571
601
|
this._path = [];
|
|
572
602
|
|
|
573
603
|
for (let i = 0; i < path.length; i++) {
|
|
574
|
-
|
|
575
604
|
let p0 = path[i][0],
|
|
576
605
|
p1 = path[i][1];
|
|
577
606
|
|
|
@@ -598,4 +627,4 @@ class Strip {
|
|
|
598
627
|
}
|
|
599
628
|
}
|
|
600
629
|
|
|
601
|
-
export { Strip };
|
|
630
|
+
export { Strip };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
import { Program } from
|
|
3
|
+
import { Program } from "../webgl/Program.js";
|
|
4
4
|
|
|
5
5
|
class StripHandler {
|
|
6
6
|
constructor(entityCollection) {
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* Picking rendering option.
|
|
10
9
|
* @public
|
|
@@ -15,21 +14,21 @@ class StripHandler {
|
|
|
15
14
|
/**
|
|
16
15
|
* Parent collection
|
|
17
16
|
* @private
|
|
18
|
-
* @type {
|
|
17
|
+
* @type {EntityCollection}
|
|
19
18
|
*/
|
|
20
19
|
this._entityCollection = entityCollection;
|
|
21
20
|
|
|
22
21
|
/**
|
|
23
22
|
* Renderer
|
|
24
23
|
* @private
|
|
25
|
-
* @type {
|
|
24
|
+
* @type {Renderer}
|
|
26
25
|
*/
|
|
27
26
|
this._renderer = null;
|
|
28
27
|
|
|
29
28
|
/**
|
|
30
29
|
* Point cloud array
|
|
31
30
|
* @private
|
|
32
|
-
* @type {Array.<
|
|
31
|
+
* @type {Array.<Strip>}
|
|
33
32
|
*/
|
|
34
33
|
this._strips = [];
|
|
35
34
|
|
|
@@ -50,21 +49,21 @@ class StripHandler {
|
|
|
50
49
|
_initProgram() {
|
|
51
50
|
if (this._renderer.handler) {
|
|
52
51
|
!this._renderer.handler.programs.strip &&
|
|
53
|
-
this._renderer.handler.addProgram(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
`attribute vec3 aVertexPositionHigh;
|
|
52
|
+
this._renderer.handler.addProgram(
|
|
53
|
+
new Program("strip", {
|
|
54
|
+
uniforms: {
|
|
55
|
+
projectionMatrix: { type: "mat4" },
|
|
56
|
+
viewMatrix: { type: "mat4" },
|
|
57
|
+
eyePositionHigh: "vec3",
|
|
58
|
+
eyePositionLow: "vec3",
|
|
59
|
+
uColor: { type: "vec4" },
|
|
60
|
+
uOpacity: { type: "float" }
|
|
61
|
+
},
|
|
62
|
+
attributes: {
|
|
63
|
+
aVertexPositionHigh: { type: "vec3" },
|
|
64
|
+
aVertexPositionLow: { type: "vec3" }
|
|
65
|
+
},
|
|
66
|
+
vertexShader: `attribute vec3 aVertexPositionHigh;
|
|
68
67
|
attribute vec3 aVertexPositionLow;
|
|
69
68
|
uniform mat4 projectionMatrix;
|
|
70
69
|
uniform mat4 viewMatrix;
|
|
@@ -80,14 +79,14 @@ class StripHandler {
|
|
|
80
79
|
|
|
81
80
|
gl_Position = projectionMatrix * viewMatrixRTE * vec4(highDiff + lowDiff, 1.0);
|
|
82
81
|
}`,
|
|
83
|
-
|
|
84
|
-
`precision highp float;
|
|
82
|
+
fragmentShader: `precision highp float;
|
|
85
83
|
uniform vec4 uColor;
|
|
86
84
|
uniform float uOpacity;
|
|
87
85
|
void main(void) {
|
|
88
86
|
gl_FragColor = vec4(uColor.rgb, uColor.a * uOpacity);
|
|
89
87
|
}`
|
|
90
|
-
|
|
88
|
+
})
|
|
89
|
+
);
|
|
91
90
|
}
|
|
92
91
|
}
|
|
93
92
|
|
|
@@ -104,7 +103,8 @@ class StripHandler {
|
|
|
104
103
|
strip._handler = this;
|
|
105
104
|
strip._handlerIndex = this._strips.length;
|
|
106
105
|
this._strips.push(strip);
|
|
107
|
-
this._entityCollection &&
|
|
106
|
+
this._entityCollection &&
|
|
107
|
+
this._entityCollection.renderNode &&
|
|
108
108
|
strip.setRenderNode(this._entityCollection.renderNode);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -153,6 +153,6 @@ class StripHandler {
|
|
|
153
153
|
this._strips.length = 0;
|
|
154
154
|
this._strips = [];
|
|
155
155
|
}
|
|
156
|
-
}
|
|
156
|
+
}
|
|
157
157
|
|
|
158
|
-
export { StripHandler };
|
|
158
|
+
export { StripHandler };
|
package/src/og/entity/index.js
CHANGED
|
@@ -1,17 +1,9 @@
|
|
|
1
|
-
import { Entity } from
|
|
2
|
-
import { EntityCollection } from
|
|
3
|
-
import { Billboard } from
|
|
4
|
-
import { Geometry } from
|
|
5
|
-
import { Label } from
|
|
6
|
-
import { PointCloud } from
|
|
7
|
-
import { Polyline } from
|
|
1
|
+
import { Entity } from "./Entity.js";
|
|
2
|
+
import { EntityCollection } from "./EntityCollection.js";
|
|
3
|
+
import { Billboard } from "./Billboard.js";
|
|
4
|
+
import { Geometry } from "./Geometry.js";
|
|
5
|
+
import { Label } from "./Label.js";
|
|
6
|
+
import { PointCloud } from "./PointCloud.js";
|
|
7
|
+
import { Polyline } from "./Polyline.js";
|
|
8
8
|
|
|
9
|
-
export {
|
|
10
|
-
Entity,
|
|
11
|
-
EntityCollection,
|
|
12
|
-
Billboard,
|
|
13
|
-
Geometry,
|
|
14
|
-
Label,
|
|
15
|
-
PointCloud,
|
|
16
|
-
Polyline
|
|
17
|
-
};
|
|
9
|
+
export { Entity, EntityCollection, Billboard, Geometry, Label, PointCloud, Polyline };
|