@openglobus/og 0.16.2 → 0.17.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/README.md +1 -1
- package/css/og.css +24 -2
- package/dist/@openglobus/og.css +1 -1
- package/dist/@openglobus/og.esm.js +2 -2
- package/dist/@openglobus/og.esm.js.map +1 -1
- package/dist/@openglobus/og.umd.js +2 -2
- package/dist/@openglobus/og.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/og/Clock.js +1 -5
- package/src/og/Events.js +0 -4
- package/src/og/Extent.js +5 -9
- package/src/og/Globe.js +92 -55
- package/src/og/ImageCanvas.js +12 -5
- package/src/og/Lock.js +44 -48
- package/src/og/LonLat.js +0 -4
- package/src/og/Object3d.js +1 -1
- package/src/og/Stack.js +49 -53
- package/src/og/astro/earth.js +112 -116
- package/src/og/astro/jd.js +514 -518
- package/src/og/astro/orbit.js +119 -123
- package/src/og/astro/rotation.js +36 -40
- package/src/og/bv/Box.js +77 -81
- package/src/og/bv/Sphere.js +57 -61
- package/src/og/camera/Camera.js +20 -7
- package/src/og/camera/PlanetCamera.js +8 -15
- package/src/og/control/Atmosphere.js +0 -4
- package/src/og/control/Control.js +9 -8
- package/src/og/control/DebugInfo.js +0 -4
- package/src/og/control/DrawingSwitcher.js +117 -0
- package/src/og/control/EarthCoordinates.js +214 -214
- package/src/og/control/GeoImageDragControl.js +0 -4
- package/src/og/control/KeyboardNavigation.js +0 -4
- package/src/og/control/LayerAnimation.js +0 -4
- package/src/og/control/LayerSwitcher.js +2 -4
- package/src/og/control/Lighting.js +11 -15
- package/src/og/control/MouseNavigation.js +0 -4
- package/src/og/control/MouseWheelZoomControl.js +0 -4
- package/src/og/control/RulerSwitcher.js +0 -4
- package/src/og/control/ScaleControl.js +2 -6
- package/src/og/control/ShowFps.js +40 -44
- package/src/og/control/SimpleNavigation.js +10 -10
- package/src/og/control/SimpleSkyBackground.js +0 -4
- package/src/og/control/Sun.js +0 -4
- package/src/og/control/ToggleWireframe.js +35 -39
- package/src/og/control/ZoomControl.js +0 -4
- package/src/og/control/drawing/DrawingControl.js +51 -0
- package/src/og/control/drawing/LineStringDrawingScene.js +203 -0
- package/src/og/control/drawing/PolygonDrawingScene.js +785 -0
- package/src/og/control/elevationProfile/ElevationProfile.js +275 -0
- package/src/og/control/index.js +5 -1
- package/src/og/control/ruler/Ruler.js +0 -4
- package/src/og/control/ruler/RulerScene.js +3 -2
- package/src/og/control/selection/Selection.js +0 -4
- package/src/og/control/selection/SelectionScene.js +2 -4
- package/src/og/control/timeline/TimelineControl.js +4 -4
- package/src/og/control/timeline/TimelineModel.js +2 -2
- package/src/og/control/timeline/TimelineView.js +1 -0
- package/src/og/control/visibleExtent/Segment.js +5 -5
- package/src/og/control/visibleExtent/drawnode.js +0 -4
- package/src/og/ellipsoid/Ellipsoid.js +205 -275
- package/src/og/ellipsoid/wgs84.js +0 -4
- package/src/og/entity/BaseBillboard.js +375 -379
- package/src/og/entity/Billboard.js +0 -4
- package/src/og/entity/BillboardHandler.js +0 -4
- package/src/og/entity/Entity.js +22 -22
- package/src/og/entity/EntityCollection.js +7 -11
- package/src/og/entity/GeoObject.js +0 -4
- package/src/og/entity/GeoObjectHandler.js +0 -4
- package/src/og/entity/Geometry.js +5 -4
- package/src/og/entity/GeometryHandler.js +3 -4
- package/src/og/entity/Label.js +0 -4
- package/src/og/entity/LabelHandler.js +0 -4
- package/src/og/entity/PointCloud.js +0 -4
- package/src/og/entity/PointCloudHandler.js +122 -126
- package/src/og/entity/Polyline.js +4 -6
- package/src/og/entity/PolylineHandler.js +104 -108
- package/src/og/entity/Ray.js +29 -29
- package/src/og/entity/Strip.js +1 -1
- package/src/og/index.js +3 -1
- package/src/og/input/KeyboardHandler.js +128 -132
- package/src/og/input/MouseHandler.js +94 -98
- package/src/og/input/TouchHandler.js +59 -63
- package/src/og/input/input.js +44 -48
- package/src/og/layer/BaseGeoImage.js +5 -8
- package/src/og/layer/CanvasTiles.js +0 -4
- package/src/og/layer/GeoImage.js +0 -4
- package/src/og/layer/GeoTexture2d.js +0 -4
- package/src/og/layer/GeoVideo.js +0 -4
- package/src/og/layer/KML.js +2 -3
- package/src/og/layer/Layer.js +22 -26
- package/src/og/layer/Material.js +0 -4
- package/src/og/layer/Vector.js +23 -20
- package/src/og/layer/WMS.js +182 -186
- package/src/og/layer/XYZ.js +0 -4
- package/src/og/light/LightSource.js +0 -4
- package/src/og/math/Line2.js +28 -32
- package/src/og/math/Mat3.js +152 -156
- package/src/og/math/Ray.js +0 -4
- package/src/og/math/Vec2.js +0 -4
- package/src/og/math/Vec3.js +0 -4
- package/src/og/math/Vec4.js +0 -4
- package/src/og/math/coder.js +104 -104
- package/src/og/math.js +39 -7
- package/src/og/proj/EPSG3857.js +13 -13
- package/src/og/proj/Proj.js +59 -63
- package/src/og/quadTree/EPSG4326QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EarthQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/EntityCollectionNode.js +12 -16
- package/src/og/quadTree/MarsQuadTreeStrategy.js +1 -0
- package/src/og/quadTree/QuadTreeStrategy.js +1 -0
- package/src/og/quadTree/Wgs84QuadTreeStrategy.js +1 -0
- package/src/og/renderer/Renderer.js +109 -22
- package/src/og/renderer/RendererEvents.js +0 -4
- package/src/og/scene/Axes.js +74 -78
- package/src/og/scene/BaseNode.js +0 -4
- package/src/og/scene/Planet.js +114 -112
- package/src/og/scene/RenderNode.js +11 -3
- package/src/og/scene/SkyBox.js +104 -108
- package/src/og/segment/Segment.js +8 -4
- package/src/og/segment/SegmentLonLat.js +2 -6
- package/src/og/segment/segmentHelper.js +229 -225
- package/src/og/shaders/billboard.js +0 -4
- package/src/og/shaders/drawnode.js +5 -9
- package/src/og/shaders/geoObject.js +0 -4
- package/src/og/shaders/label.js +0 -4
- package/src/og/shaders/pickingMask.js +0 -4
- package/src/og/shaders/pointCloud.js +0 -4
- package/src/og/shaders/polyline.js +0 -4
- package/src/og/shaders/ray.js +0 -4
- package/src/og/shaders/skybox.js +0 -4
- package/src/og/terrain/EmptyTerrain.js +0 -4
- package/src/og/utils/FontAtlas.js +0 -4
- package/src/og/utils/GeoImageCreator.js +1 -2
- package/src/og/utils/NormalMapCreator.js +8 -9
- package/src/og/utils/VectorTileCreator.js +3 -9
- package/src/og/utils/shared.js +20 -1
- package/src/og/webgl/Framebuffer.js +0 -4
- package/src/og/webgl/Handler.js +45 -19
- package/src/og/webgl/Multisample.js +0 -4
- package/src/og/webgl/Program.js +0 -4
- package/src/og/webgl/ProgramController.js +2 -2
- package/types/Clock.d.ts +1 -1
- package/types/Extent.d.ts +5 -5
- package/types/Globe.d.ts +15 -1
- package/types/ImageCanvas.d.ts +5 -0
- package/types/bv/Box.d.ts +1 -1
- package/types/bv/Sphere.d.ts +3 -3
- package/types/camera/Camera.d.ts +3 -2
- package/types/camera/PlanetCamera.d.ts +4 -4
- package/types/control/DrawingSwitcher.d.ts +13 -0
- package/types/control/EarthCoordinates.d.ts +1 -1
- package/types/control/Lighting.d.ts +8 -8
- package/types/control/drawing/DrawingControl.d.ts +14 -0
- package/types/control/drawing/LineStringDrawingScene.d.ts +5 -0
- package/types/control/drawing/PolygonDrawingScene.d.ts +99 -0
- package/types/control/index.d.ts +3 -1
- package/types/control/ruler/RulerScene.d.ts +0 -1
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/ellipsoid/Ellipsoid.d.ts +50 -63
- package/types/entity/Entity.d.ts +3 -2
- package/types/entity/Geometry.d.ts +5 -0
- package/types/entity/Polyline.d.ts +1 -1
- package/types/entity/Ray.d.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +1 -1
- package/types/layer/CanvasTiles.d.ts +1 -1
- package/types/layer/Layer.d.ts +1 -1
- package/types/layer/Vector.d.ts +1 -0
- package/types/math.d.ts +7 -0
- package/types/renderer/Renderer.d.ts +7 -1
- package/types/scene/Axes.d.ts +0 -1
- package/types/scene/Planet.d.ts +26 -24
- package/types/scene/RenderNode.d.ts +2 -0
- package/types/scene/SkyBox.d.ts +0 -1
- package/types/segment/Segment.d.ts +3 -2
- package/types/segment/SegmentLonLat.d.ts +0 -1
- package/types/utils/GeoImageCreator.d.ts +1 -1
- package/types/utils/NormalMapCreator.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +2 -2
- package/types/utils/shared.d.ts +2 -0
- package/types/webgl/Handler.d.ts +6 -4
package/src/og/proj/Proj.js
CHANGED
|
@@ -1,63 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { Proj };
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Projection units: 'degrees', 'ft', 'm' or 'km'.
|
|
5
|
+
* @enum {string}
|
|
6
|
+
* @api
|
|
7
|
+
*/
|
|
8
|
+
export const Units = {
|
|
9
|
+
DEGREES: "degrees",
|
|
10
|
+
FEET: "ft",
|
|
11
|
+
METERS: "m",
|
|
12
|
+
KILOMETERS: "km"
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Meters per unit lookup table.
|
|
17
|
+
* @const
|
|
18
|
+
* @type {Object.<og.proj.Units, number>}
|
|
19
|
+
*/
|
|
20
|
+
export const METERS_PER_UNIT = {};
|
|
21
|
+
METERS_PER_UNIT[Units.FEET] = 0.3048;
|
|
22
|
+
METERS_PER_UNIT[Units.METERS] = 1;
|
|
23
|
+
METERS_PER_UNIT[Units.KILOMETERS] = 1000;
|
|
24
|
+
|
|
25
|
+
let _counter = 0;
|
|
26
|
+
class Proj {
|
|
27
|
+
constructor(options) {
|
|
28
|
+
/**
|
|
29
|
+
* @public
|
|
30
|
+
* @type {string}
|
|
31
|
+
*/
|
|
32
|
+
this.code = options.code;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @public
|
|
36
|
+
* @type {proj.Units}
|
|
37
|
+
*/
|
|
38
|
+
this.units = /** @type {Units} */ (options.units);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Projection identifier, especially usefull for comparison.
|
|
42
|
+
* @const
|
|
43
|
+
* @type {integer}
|
|
44
|
+
*/
|
|
45
|
+
this.id = _counter++;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Compare projections.
|
|
50
|
+
* @public
|
|
51
|
+
* @param {Proj} proj - Projetion object.
|
|
52
|
+
* @returns {boolean}
|
|
53
|
+
*/
|
|
54
|
+
equal(proj) {
|
|
55
|
+
return proj.id === this.id;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Proj };
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/quadTree/EntityCollectionNode
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
1
|
'use strict';
|
|
6
2
|
|
|
7
3
|
import { Sphere } from '../bv/Sphere.js';
|
|
@@ -75,16 +71,16 @@ class EntityCollectionNode {
|
|
|
75
71
|
|
|
76
72
|
__setLonLat__(entity) {
|
|
77
73
|
|
|
78
|
-
if (entity.
|
|
79
|
-
entity.
|
|
74
|
+
if (entity._lonLat.isZero() && !entity._cartesian.isZero()) {
|
|
75
|
+
entity._lonLat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
|
|
80
76
|
}
|
|
81
77
|
|
|
82
|
-
if (Math.abs(entity.
|
|
83
|
-
entity.
|
|
78
|
+
if (Math.abs(entity._lonLat.lat) < mercator.MAX_LAT) {
|
|
79
|
+
entity._lonLatMerc = entity._lonLat.forwardMercator();
|
|
84
80
|
} else {
|
|
85
|
-
entity.
|
|
81
|
+
entity._lonLatMerc = null;
|
|
86
82
|
}
|
|
87
|
-
return entity.
|
|
83
|
+
return entity._lonLatMerc;
|
|
88
84
|
}
|
|
89
85
|
|
|
90
86
|
buildTree(entities, rightNow) {
|
|
@@ -131,8 +127,8 @@ class EntityCollectionNode {
|
|
|
131
127
|
}
|
|
132
128
|
|
|
133
129
|
isInside(entity) {
|
|
134
|
-
if (entity.
|
|
135
|
-
return this.extent.isInside(entity.
|
|
130
|
+
if (entity._lonLatMerc) {
|
|
131
|
+
return this.extent.isInside(entity._lonLatMerc);
|
|
136
132
|
} else {
|
|
137
133
|
return false;
|
|
138
134
|
}
|
|
@@ -343,10 +339,10 @@ class EntityCollectionNodeWGS84 extends EntityCollectionNode {
|
|
|
343
339
|
}
|
|
344
340
|
|
|
345
341
|
__setLonLat__(entity) {
|
|
346
|
-
if (entity.
|
|
347
|
-
entity.
|
|
342
|
+
if (entity._lonLat.isZero()) {
|
|
343
|
+
entity._lonLat = this.layer._planet.ellipsoid.cartesianToLonLat(entity._cartesian);
|
|
348
344
|
}
|
|
349
|
-
return entity.
|
|
345
|
+
return entity._lonLat;
|
|
350
346
|
}
|
|
351
347
|
|
|
352
348
|
isVisible() {
|
|
@@ -359,7 +355,7 @@ class EntityCollectionNodeWGS84 extends EntityCollectionNode {
|
|
|
359
355
|
}
|
|
360
356
|
|
|
361
357
|
isInside(entity) {
|
|
362
|
-
return this.extent.isInside(entity.
|
|
358
|
+
return this.extent.isInside(entity._lonLat);
|
|
363
359
|
}
|
|
364
360
|
|
|
365
361
|
/**
|
|
@@ -230,11 +230,24 @@ class Renderer {
|
|
|
230
230
|
this.__useDistanceFramebuffer__ = true;
|
|
231
231
|
|
|
232
232
|
if (params.autoActivate || isEmpty(params.autoActivate)) {
|
|
233
|
-
this.initialize();
|
|
234
233
|
this.start();
|
|
235
234
|
}
|
|
236
235
|
}
|
|
237
236
|
|
|
237
|
+
enableBlendOneSrcAlpha() {
|
|
238
|
+
let gl = this.handler.gl;
|
|
239
|
+
gl.enable(gl.BLEND);
|
|
240
|
+
gl.blendEquation(gl.FUNC_ADD);
|
|
241
|
+
gl.blendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
enableBlendDefault() {
|
|
245
|
+
let gl = this.handler.gl;
|
|
246
|
+
gl.enable(gl.BLEND);
|
|
247
|
+
gl.blendEquation(gl.FUNC_ADD);
|
|
248
|
+
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
|
249
|
+
}
|
|
250
|
+
|
|
238
251
|
/**
|
|
239
252
|
* Sets renderer events activity.
|
|
240
253
|
* @param {Boolean} activity - Events activity.
|
|
@@ -414,17 +427,24 @@ class Renderer {
|
|
|
414
427
|
control.remove();
|
|
415
428
|
}
|
|
416
429
|
|
|
430
|
+
isInitialized() {
|
|
431
|
+
return this._initialized;
|
|
432
|
+
}
|
|
433
|
+
|
|
417
434
|
/**
|
|
418
435
|
* Renderer initialization.
|
|
419
436
|
* @public
|
|
420
437
|
*/
|
|
421
438
|
initialize() {
|
|
439
|
+
|
|
422
440
|
if (this._initialized) {
|
|
423
441
|
return;
|
|
424
442
|
} else {
|
|
425
443
|
this._initialized = true;
|
|
426
444
|
}
|
|
427
445
|
|
|
446
|
+
this.handler.initialize();
|
|
447
|
+
|
|
428
448
|
this.billboardsTextureAtlas.assignHandler(this.handler);
|
|
429
449
|
this.geoObjectsTextureAtlas.assignHandler(this.handler);
|
|
430
450
|
|
|
@@ -537,17 +557,24 @@ class Renderer {
|
|
|
537
557
|
|
|
538
558
|
this.screenFramePositionBuffer = this.handler.createArrayBuffer(new Float32Array([1, 1, -1, 1, 1, -1, -1, -1]), 2, 4);
|
|
539
559
|
|
|
540
|
-
let temp = this.controls;
|
|
541
|
-
this.controls = {};
|
|
542
|
-
for (let i in temp) {
|
|
543
|
-
this.addControl(temp[i]);
|
|
544
|
-
}
|
|
545
560
|
|
|
546
561
|
this.outputTexture = this.screenTexture.screen;
|
|
547
562
|
|
|
548
563
|
this.fontAtlas.initFont("arial", arial.data, arial.image);
|
|
549
564
|
|
|
550
565
|
this._pickingMaskCoordinatesBuffer = this.handler.createArrayBuffer(new Float32Array([0, 0]), 2, 1);
|
|
566
|
+
|
|
567
|
+
this._initializeRenderNodes();
|
|
568
|
+
|
|
569
|
+
this._initializeControls();
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
_initializeControls() {
|
|
573
|
+
let temp = this.controls;
|
|
574
|
+
this.controls = {};
|
|
575
|
+
for (let i in temp) {
|
|
576
|
+
this.addControl(temp[i]);
|
|
577
|
+
}
|
|
551
578
|
}
|
|
552
579
|
|
|
553
580
|
resize() {
|
|
@@ -616,6 +643,12 @@ class Renderer {
|
|
|
616
643
|
}
|
|
617
644
|
}
|
|
618
645
|
|
|
646
|
+
_initializeRenderNodes() {
|
|
647
|
+
for (let i = 0; i < this._renderNodesArr.length; i++) {
|
|
648
|
+
this._renderNodesArr[i].initialize();
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
|
|
619
652
|
/**
|
|
620
653
|
* Adds render node to the renderer before specific node.
|
|
621
654
|
* @public
|
|
@@ -674,10 +707,8 @@ class Renderer {
|
|
|
674
707
|
let ec = this._entityCollections;
|
|
675
708
|
|
|
676
709
|
if (ec.length) {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
680
|
-
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
|
710
|
+
|
|
711
|
+
this.enableBlendDefault();
|
|
681
712
|
|
|
682
713
|
//geoObject
|
|
683
714
|
let i = ec.length;
|
|
@@ -709,9 +740,7 @@ class Renderer {
|
|
|
709
740
|
if (ec.length) {
|
|
710
741
|
let gl = this.handler.gl;
|
|
711
742
|
|
|
712
|
-
|
|
713
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
714
|
-
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
|
743
|
+
this.enableBlendDefault();
|
|
715
744
|
|
|
716
745
|
// billboards pass
|
|
717
746
|
gl.activeTexture(gl.TEXTURE0);
|
|
@@ -775,10 +804,6 @@ class Renderer {
|
|
|
775
804
|
|
|
776
805
|
let h = this.handler, gl = h.gl;
|
|
777
806
|
|
|
778
|
-
gl.enable(gl.BLEND);
|
|
779
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
780
|
-
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
|
781
|
-
|
|
782
807
|
gl.clearColor(0.0, 0.0, 0.0, 1.0);
|
|
783
808
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
784
809
|
|
|
@@ -805,10 +830,7 @@ class Renderer {
|
|
|
805
830
|
|
|
806
831
|
i = rn.length;
|
|
807
832
|
while (i--) {
|
|
808
|
-
|
|
809
|
-
gl.blendEquation(gl.FUNC_ADD);
|
|
810
|
-
gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE);
|
|
811
|
-
|
|
833
|
+
this.enableBlendDefault();
|
|
812
834
|
rn[i].drawNode();
|
|
813
835
|
}
|
|
814
836
|
|
|
@@ -1087,12 +1109,77 @@ class Renderer {
|
|
|
1087
1109
|
}
|
|
1088
1110
|
|
|
1089
1111
|
/**
|
|
1090
|
-
* Function starts
|
|
1112
|
+
* Function starts renderer
|
|
1091
1113
|
* @public
|
|
1092
1114
|
*/
|
|
1093
1115
|
start() {
|
|
1116
|
+
if (!this._initialized) {
|
|
1117
|
+
this.initialize();
|
|
1118
|
+
}
|
|
1094
1119
|
this.handler.start();
|
|
1095
1120
|
}
|
|
1121
|
+
|
|
1122
|
+
destroy() {
|
|
1123
|
+
for (let i in this.controls) {
|
|
1124
|
+
this.controls[i].remove();
|
|
1125
|
+
}
|
|
1126
|
+
|
|
1127
|
+
for (let i = 0; i < this._renderNodesArr.length; i++) {
|
|
1128
|
+
this._renderNodesArr[i].remove();
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
this.div = null;
|
|
1132
|
+
|
|
1133
|
+
this._renderNodesArr = [];
|
|
1134
|
+
|
|
1135
|
+
this.renderNodes = {};
|
|
1136
|
+
|
|
1137
|
+
this.activeCamera = null;
|
|
1138
|
+
|
|
1139
|
+
this.controls = {};
|
|
1140
|
+
|
|
1141
|
+
this.controlsBag = {};
|
|
1142
|
+
|
|
1143
|
+
this.colorObjects = new Map();
|
|
1144
|
+
|
|
1145
|
+
this._pickingCallbacks = [];
|
|
1146
|
+
|
|
1147
|
+
this.pickingFramebuffer = null;
|
|
1148
|
+
|
|
1149
|
+
this._tempPickingPix_ = null;
|
|
1150
|
+
|
|
1151
|
+
this.distanceFramebuffer = null;
|
|
1152
|
+
|
|
1153
|
+
this._distanceCallbacks = [];
|
|
1154
|
+
|
|
1155
|
+
this._tempDistancePix_ = null;
|
|
1156
|
+
|
|
1157
|
+
this._depthCallbacks = [];
|
|
1158
|
+
|
|
1159
|
+
this.depthFramebuffer = null;
|
|
1160
|
+
|
|
1161
|
+
this.sceneFramebuffer = null;
|
|
1162
|
+
|
|
1163
|
+
this.blitFramebuffer = null;
|
|
1164
|
+
|
|
1165
|
+
this.toneMappingFramebuffer = null;
|
|
1166
|
+
|
|
1167
|
+
// todo
|
|
1168
|
+
//this.billboardsTextureAtlas.clear();
|
|
1169
|
+
//this.geoObjectsTextureAtlas.clear()
|
|
1170
|
+
//this.fontAtlas.clear();
|
|
1171
|
+
|
|
1172
|
+
this._entityCollections = [];
|
|
1173
|
+
|
|
1174
|
+
this.colorObjects = null;
|
|
1175
|
+
|
|
1176
|
+
this.handler.destroy();
|
|
1177
|
+
|
|
1178
|
+
this.handler = null;
|
|
1179
|
+
|
|
1180
|
+
this._initialized = false;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1096
1183
|
}
|
|
1097
1184
|
|
|
1098
1185
|
export { Renderer };
|
package/src/og/scene/Axes.js
CHANGED
|
@@ -1,78 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
0.0, 0.0, 0.0, 0.0, 0.0,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export { Axes };
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { Program } from '../webgl/Program.js';
|
|
4
|
+
import { RenderNode } from './RenderNode.js';
|
|
5
|
+
|
|
6
|
+
class Axes extends RenderNode {
|
|
7
|
+
constructor(size) {
|
|
8
|
+
super("Axes");
|
|
9
|
+
|
|
10
|
+
this.size = size || 100;
|
|
11
|
+
this.axesBuffer = null;
|
|
12
|
+
this.axesColorBuffer = null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
init() {
|
|
16
|
+
this.createAxisBuffer(this.size);
|
|
17
|
+
this.drawMode = this.renderer.handler.gl.LINES;
|
|
18
|
+
this.renderer.handler.addProgram(new Program("axesShader", {
|
|
19
|
+
uniforms: {
|
|
20
|
+
projectionViewMatrix: 'mat4'
|
|
21
|
+
},
|
|
22
|
+
attributes: {
|
|
23
|
+
aVertexPosition: 'vec3',
|
|
24
|
+
aVertexColor: 'vec4'
|
|
25
|
+
},
|
|
26
|
+
vertexShader:
|
|
27
|
+
`attribute vec3 aVertexPosition;
|
|
28
|
+
attribute vec4 aVertexColor;
|
|
29
|
+
uniform mat4 projectionViewMatrix;
|
|
30
|
+
varying vec4 vColor;
|
|
31
|
+
void main(void) {
|
|
32
|
+
gl_Position = projectionViewMatrix * vec4(aVertexPosition, 1.0);
|
|
33
|
+
vColor = aVertexColor;
|
|
34
|
+
}`,
|
|
35
|
+
fragmentShader:
|
|
36
|
+
`precision highp float;
|
|
37
|
+
varying vec4 vColor;
|
|
38
|
+
void main(void) {
|
|
39
|
+
gl_FragColor = vColor;
|
|
40
|
+
}`
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
frame() {
|
|
45
|
+
|
|
46
|
+
this.renderer.handler.programs.axesShader.activate().set({
|
|
47
|
+
projectionViewMatrix: this.renderer.activeCamera.getProjectionViewMatrix(),
|
|
48
|
+
aVertexPosition: this.axisBuffer,
|
|
49
|
+
aVertexColor: this.axisColorBuffer
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
this.renderer.handler.programs.axesShader.drawArrays(this.drawMode, this.axisBuffer.numItems);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
createAxisBuffer(gridSize) {
|
|
56
|
+
|
|
57
|
+
var vertices = [
|
|
58
|
+
0.0, 0.0, 0.0, gridSize - 1, 0.0, 0.0, // x - R
|
|
59
|
+
0.0, 0.0, 0.0, 0.0, gridSize - 1, 0.0, // y - B
|
|
60
|
+
0.0, 0.0, 0.0, 0.0, 0.0, gridSize - 1 // z - G
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
var colors = [
|
|
64
|
+
1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, // x - R
|
|
65
|
+
0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, // y - B
|
|
66
|
+
0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 0.0, 1.0 // z - G
|
|
67
|
+
];
|
|
68
|
+
|
|
69
|
+
this.axisBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(vertices), 3, 6);
|
|
70
|
+
this.axisColorBuffer = this.renderer.handler.createArrayBuffer(new Float32Array(colors), 4, 6);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export { Axes };
|