@openglobus/og 0.11.2 → 0.11.7
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 +13 -13
- package/src/og/Clock.js +10 -10
- package/src/og/Events.js +8 -6
- package/src/og/Extent.js +82 -41
- package/src/og/Globe.js +25 -13
- package/src/og/ImageCanvas.js +22 -16
- package/src/og/LonLat.js +16 -13
- package/src/og/Popup.js +21 -14
- package/src/og/QueueArray.js +6 -2
- package/src/og/Rectangle.js +11 -6
- package/src/og/Stack.js +5 -2
- package/src/og/ajax.js +21 -33
- package/src/og/astro/astro.js +5 -5
- package/src/og/astro/earth.js +22 -16
- package/src/og/astro/jd.js +23 -18
- package/src/og/astro/orbit.js +13 -11
- package/src/og/astro/rotation.js +17 -8
- package/src/og/bv/Box.js +7 -3
- package/src/og/bv/Sphere.js +14 -11
- package/src/og/camera/Camera.js +51 -54
- package/src/og/camera/Frustum.js +29 -18
- package/src/og/camera/PlanetCamera.js +32 -23
- package/src/og/control/CompassButton.js +5 -1
- package/src/og/control/Control.js +12 -10
- package/src/og/control/DebugInfo.js +4 -1
- package/src/og/control/EarthCoordinates.js +54 -33
- package/src/og/control/KeyboardNavigation.js +10 -10
- package/src/og/control/LayerSwitcher.js +22 -21
- package/src/og/control/Lighting.js +34 -3
- package/src/og/control/MouseNavigation.js +1 -1
- package/src/og/control/ScaleControl.js +1 -1
- package/src/og/control/SegmentBoundVisualization.js +6 -7
- package/src/og/control/ShowFps.js +13 -8
- package/src/og/control/SimpleNavigation.js +6 -8
- package/src/og/control/Sun.js +25 -15
- package/src/og/control/ToggleWireframe.js +4 -4
- package/src/og/control/TouchNavigation.js +44 -33
- package/src/og/control/ZoomControl.js +41 -25
- package/src/og/ellipsoid/Ellipsoid.js +162 -66
- package/src/og/ellipsoid/wgs84.js +4 -4
- package/src/og/entity/BaseBillboard.js +100 -56
- package/src/og/entity/Billboard.js +14 -10
- package/src/og/entity/BillboardHandler.js +317 -60
- package/src/og/entity/Entity.js +100 -68
- package/src/og/entity/EntityCollection.js +70 -47
- package/src/og/entity/GeoObject.js +228 -0
- package/src/og/entity/GeoObjectHandler.js +910 -0
- package/src/og/entity/Geometry.js +27 -24
- package/src/og/entity/GeometryHandler.js +596 -124
- package/src/og/entity/Label.js +80 -49
- package/src/og/entity/LabelHandler.js +45 -244
- package/src/og/entity/LabelWorker.js +218 -0
- package/src/og/entity/Object3d.js +504 -0
- package/src/og/entity/PointCloud.js +80 -32
- package/src/og/entity/PointCloudHandler.js +8 -8
- package/src/og/entity/Polyline.js +16 -16
- package/src/og/entity/Ray.js +60 -27
- package/src/og/entity/Strip.js +77 -48
- package/src/og/entity/StripHandler.js +26 -26
- package/src/og/entity/index.js +8 -16
- package/src/og/layer/BaseGeoImage.js +54 -23
- package/src/og/layer/CanvasTiles.js +24 -24
- package/src/og/layer/GeoImage.js +9 -9
- package/src/og/layer/GeoVideo.js +3 -3
- package/src/og/layer/KML.js +63 -37
- package/src/og/layer/Layer.js +44 -21
- package/src/og/layer/Material.js +23 -20
- package/src/og/layer/Vector.js +114 -68
- package/src/og/layer/WMS.js +34 -17
- package/src/og/layer/XYZ.js +48 -46
- package/src/og/light/LightSource.js +46 -39
- package/src/og/math/Mat3.js +34 -22
- package/src/og/math/Mat4.js +603 -459
- package/src/og/math/Plane.js +21 -20
- package/src/og/math/Quat.js +182 -139
- package/src/og/math/Ray.js +38 -33
- package/src/og/math/Vec2.js +85 -75
- package/src/og/math/Vec3.js +142 -112
- package/src/og/math/Vec4.js +27 -31
- package/src/og/math/coder.js +10 -10
- package/src/og/math.js +12 -12
- package/src/og/proj/EPSG3857.js +4 -4
- package/src/og/proj/EPSG4326.js +4 -4
- package/src/og/proj/Proj.js +4 -6
- package/src/og/quadTree/Node.js +8 -8
- package/src/og/renderer/Renderer.js +59 -52
- package/src/og/renderer/RendererEvents.js +50 -27
- package/src/og/scene/BaseNode.js +7 -8
- package/src/og/scene/Planet.js +102 -103
- package/src/og/scene/RenderNode.js +28 -21
- package/src/og/segment/Segment.js +26 -21
- package/src/og/segment/SegmentLonLat.js +5 -5
- package/src/og/shaders/drawnode.js +135 -142
- 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 +126 -54
- package/src/og/shapes/Icosphere.js +29 -14
- package/src/og/shapes/Sphere.js +12 -15
- package/src/og/terrain/BilTerrain.js +1 -0
- package/src/og/terrain/EmptyTerrain.js +2 -2
- package/src/og/terrain/GlobusTerrain.js +9 -9
- package/src/og/utils/FontAtlas.js +6 -2
- package/src/og/utils/TextureAtlas.js +22 -24
- package/src/og/utils/VectorTileCreator.js +1 -3
- package/src/og/utils/shared.js +16 -16
- package/src/og/webgl/Framebuffer.js +88 -40
- package/src/og/webgl/Handler.js +243 -169
- package/src/og/webgl/Multisample.js +47 -19
- package/src/og/webgl/Program.js +79 -34
- package/src/og/webgl/ProgramController.js +17 -13
- package/src/og/webgl/callbacks.js +8 -8
- package/src/og/inherits.js +0 -8
- package/src/og/utils/polylabel.js +0 -176
- package/types/Clock.d.ts +0 -90
- package/types/Deferred.d.ts +0 -6
- package/types/Events.d.ts +0 -73
- package/types/Extent.d.ts +0 -166
- package/types/Globe.d.ts +0 -75
- package/types/ImageCanvas.d.ts +0 -121
- package/types/Lock.d.ts +0 -12
- package/types/LonLat.d.ts +0 -108
- package/types/Popup.d.ts +0 -38
- package/types/QueueArray.d.ts +0 -15
- package/types/Rectangle.d.ts +0 -74
- package/types/Stack.d.ts +0 -15
- 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 -6
- package/types/astro/jd.d.ts +0 -254
- package/types/bv/Box.d.ts +0 -25
- package/types/bv/Sphere.d.ts +0 -38
- package/types/bv/index.d.ts +0 -3
- package/types/camera/Camera.d.ts +0 -303
- package/types/camera/Frustum.d.ts +0 -129
- package/types/camera/PlanetCamera.d.ts +0 -223
- package/types/camera/index.d.ts +0 -3
- package/types/cons.d.ts +0 -40
- package/types/control/CompassButton.d.ts +0 -18
- package/types/control/Control.d.ts +0 -101
- package/types/control/DebugInfo.d.ts +0 -16
- 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 -22
- package/types/control/LayerSwitcher.d.ts +0 -23
- package/types/control/Lighting.d.ts +0 -16
- package/types/control/MouseNavigation.d.ts +0 -51
- package/types/control/ScaleControl.d.ts +0 -22
- package/types/control/ShowFps.d.ts +0 -12
- package/types/control/SimpleNavigation.d.ts +0 -28
- package/types/control/Sun.d.ts +0 -52
- package/types/control/ToggleWireframe.d.ts +0 -12
- package/types/control/TouchNavigation.d.ts +0 -50
- package/types/control/ZoomControl.d.ts +0 -28
- package/types/control/index.d.ts +0 -17
- package/types/ellipsoid/Ellipsoid.d.ts +0 -142
- package/types/ellipsoid/index.d.ts +0 -3
- package/types/ellipsoid/wgs84.d.ts +0 -5
- package/types/entity/BaseBillboard.d.ts +0 -208
- package/types/entity/Billboard.d.ts +0 -94
- package/types/entity/BillboardHandler.d.ts +0 -74
- package/types/entity/Entity.d.ts +0 -331
- package/types/entity/EntityCollection.d.ts +0 -303
- package/types/entity/Geometry.d.ts +0 -73
- package/types/entity/GeometryHandler.d.ts +0 -76
- package/types/entity/Label.d.ts +0 -194
- package/types/entity/LabelHandler.d.ts +0 -24
- package/types/entity/PointCloud.d.ts +0 -174
- package/types/entity/PointCloudHandler.d.ts +0 -38
- package/types/entity/Polyline.d.ts +0 -304
- package/types/entity/PolylineHandler.d.ts +0 -18
- package/types/entity/Ray.d.ts +0 -123
- package/types/entity/RayHandler.d.ts +0 -67
- package/types/entity/ShapeHandler.d.ts +0 -22
- package/types/entity/Strip.d.ts +0 -118
- 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/inherits.d.ts +0 -4
- 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 -107
- package/types/layer/CanvasTiles.d.ts +0 -75
- package/types/layer/GeoImage.d.ts +0 -65
- package/types/layer/GeoTexture2d.d.ts +0 -8
- package/types/layer/GeoVideo.d.ts +0 -80
- package/types/layer/KML.d.ts +0 -58
- package/types/layer/Layer.d.ts +0 -321
- package/types/layer/Material.d.ts +0 -48
- package/types/layer/Vector.d.ts +0 -228
- package/types/layer/WMS.d.ts +0 -66
- package/types/layer/XYZ.d.ts +0 -130
- package/types/layer/index.d.ts +0 -10
- package/types/light/LightSource.d.ts +0 -177
- package/types/math/Line2.d.ts +0 -11
- package/types/math/Line3.d.ts +0 -10
- package/types/math/Mat3.d.ts +0 -63
- package/types/math/Mat4.d.ts +0 -173
- package/types/math/Plane.d.ts +0 -17
- package/types/math/Quat.d.ts +0 -376
- package/types/math/Ray.d.ts +0 -81
- package/types/math/Vec2.d.ts +0 -308
- package/types/math/Vec3.d.ts +0 -459
- package/types/math/Vec4.d.ts +0 -161
- package/types/math/coder.d.ts +0 -42
- 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 -5
- package/types/proj/EPSG4326.d.ts +0 -5
- 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 -296
- package/types/renderer/RendererEvents.d.ts +0 -230
- 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 -574
- package/types/scene/RenderNode.d.ts +0 -143
- package/types/scene/SkyBox.d.ts +0 -10
- package/types/scene/index.d.ts +0 -4
- package/types/segment/Segment.d.ts +0 -271
- package/types/segment/SegmentLonLat.d.ts +0 -62
- 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 -247
- package/types/shapes/Sphere.d.ts +0 -41
- package/types/terrain/BilTerrain.d.ts +0 -8
- package/types/terrain/EmptyTerrain.d.ts +0 -72
- package/types/terrain/Geoid.d.ts +0 -26
- package/types/terrain/GlobusTerrain.d.ts +0 -153
- package/types/terrain/MapboxTerrain.d.ts +0 -8
- 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 -230
- package/types/webgl/Framebuffer.d.ts +0 -135
- package/types/webgl/Handler.d.ts +0 -372
- package/types/webgl/Multisample.d.ts +0 -89
- package/types/webgl/Program.d.ts +0 -155
- package/types/webgl/ProgramController.d.ts +0 -84
- 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,20 +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
|
|
7
|
+
import * as utils from "../utils/shared.js";
|
|
8
|
+
import { Vec3 } from "../math/Vec3.js";
|
|
9
|
+
import { LOCK_FREE, LOCK_UPDATE } from "./LabelWorker.js";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* Base prototype for billboard and label classes.
|
|
12
13
|
* @class
|
|
13
14
|
* @param {Object} [options] - Options:
|
|
14
|
-
* @param {
|
|
15
|
+
* @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
|
|
15
16
|
* @param {number} [options.rotation] - Screen angle rotaion.
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
17
|
+
* @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
|
|
18
|
+
* @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
|
|
19
|
+
* @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
|
|
19
20
|
* @param {boolean} [options.visibility] - Visibility.
|
|
20
21
|
*/
|
|
21
22
|
class BaseBillboard {
|
|
@@ -33,14 +34,14 @@ class BaseBillboard {
|
|
|
33
34
|
/**
|
|
34
35
|
* Billboard center cartesian position.
|
|
35
36
|
* @protected
|
|
36
|
-
* @type {
|
|
37
|
+
* @type {Vec3}
|
|
37
38
|
*/
|
|
38
39
|
this._position = utils.createVector3(options.position);
|
|
39
40
|
|
|
40
41
|
this._positionHigh = new Vec3();
|
|
41
|
-
|
|
42
|
+
|
|
42
43
|
this._positionLow = new Vec3();
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
45
46
|
|
|
46
47
|
/**
|
|
@@ -53,21 +54,21 @@ class BaseBillboard {
|
|
|
53
54
|
/**
|
|
54
55
|
* RGBA color.
|
|
55
56
|
* @protected
|
|
56
|
-
* @type {
|
|
57
|
+
* @type {Vec4}
|
|
57
58
|
*/
|
|
58
59
|
this._color = utils.createColorRGBA(options.color);
|
|
59
60
|
|
|
60
61
|
/**
|
|
61
62
|
* Cartesian aligned axis vector.
|
|
62
63
|
* @protected
|
|
63
|
-
* @type {
|
|
64
|
+
* @type {Vec3}
|
|
64
65
|
*/
|
|
65
66
|
this._alignedAxis = utils.createVector3(options.alignedAxis);
|
|
66
67
|
|
|
67
68
|
/**
|
|
68
69
|
* Billboard center screen space offset. Where x,y - screen space offset and z - depth offset.
|
|
69
70
|
* @protected
|
|
70
|
-
* @type {
|
|
71
|
+
* @type {math.Vecto3}
|
|
71
72
|
*/
|
|
72
73
|
this._offset = utils.createVector3(options.offset);
|
|
73
74
|
|
|
@@ -81,14 +82,14 @@ class BaseBillboard {
|
|
|
81
82
|
/**
|
|
82
83
|
* Entity instance that holds this billboard.
|
|
83
84
|
* @protected
|
|
84
|
-
* @type {
|
|
85
|
+
* @type {Entity}
|
|
85
86
|
*/
|
|
86
87
|
this._entity = null;
|
|
87
88
|
|
|
88
89
|
/**
|
|
89
90
|
* Handler that stores and renders this billboard object.
|
|
90
91
|
* @protected
|
|
91
|
-
* @type {
|
|
92
|
+
* @type {BillboardHandler}
|
|
92
93
|
*/
|
|
93
94
|
this._handler = null;
|
|
94
95
|
|
|
@@ -98,6 +99,15 @@ class BaseBillboard {
|
|
|
98
99
|
* @type {number}
|
|
99
100
|
*/
|
|
100
101
|
this._handlerIndex = -1;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An indication that the object is ready to draw
|
|
105
|
+
* @protected
|
|
106
|
+
* @type {number}
|
|
107
|
+
*/
|
|
108
|
+
this._isReady = false;
|
|
109
|
+
|
|
110
|
+
this._lockId = LOCK_FREE;
|
|
101
111
|
}
|
|
102
112
|
|
|
103
113
|
static get _staticCounter() {
|
|
@@ -121,28 +131,36 @@ class BaseBillboard {
|
|
|
121
131
|
setPosition(x, y, z) {
|
|
122
132
|
this._position.x = x;
|
|
123
133
|
this._position.y = y;
|
|
124
|
-
this._position.z = z;
|
|
125
|
-
Vec3.doubleToTwoFloats(
|
|
126
|
-
|
|
134
|
+
this._position.z = z;
|
|
135
|
+
Vec3.doubleToTwoFloats(this._position, this._positionHigh, this._positionLow);
|
|
136
|
+
if (this._isReady) {
|
|
137
|
+
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
138
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
139
|
+
this._lockId = LOCK_UPDATE;
|
|
140
|
+
}
|
|
127
141
|
}
|
|
128
142
|
|
|
129
143
|
/**
|
|
130
144
|
* Sets billboard position.
|
|
131
145
|
* @public
|
|
132
|
-
* @param {
|
|
146
|
+
* @param {Vec3} position - Cartesian coordinates.
|
|
133
147
|
*/
|
|
134
148
|
setPosition3v(position) {
|
|
135
149
|
this._position.x = position.x;
|
|
136
150
|
this._position.y = position.y;
|
|
137
151
|
this._position.z = position.z;
|
|
138
152
|
Vec3.doubleToTwoFloats(position, this._positionHigh, this._positionLow);
|
|
139
|
-
|
|
153
|
+
if (this._isReady) {
|
|
154
|
+
this._handler.setPositionArr(this._handlerIndex, this._positionHigh, this._positionLow);
|
|
155
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
156
|
+
this._lockId = LOCK_UPDATE;
|
|
157
|
+
}
|
|
140
158
|
}
|
|
141
159
|
|
|
142
160
|
/**
|
|
143
161
|
* Returns billboard position.
|
|
144
162
|
* @public
|
|
145
|
-
* @returns {
|
|
163
|
+
* @returns {Vec3}
|
|
146
164
|
*/
|
|
147
165
|
getPosition() {
|
|
148
166
|
return this._position;
|
|
@@ -158,26 +176,27 @@ class BaseBillboard {
|
|
|
158
176
|
setOffset(x, y, z) {
|
|
159
177
|
this._offset.x = x;
|
|
160
178
|
this._offset.y = y;
|
|
161
|
-
|
|
162
|
-
|
|
179
|
+
z != undefined && (this._offset.z = z);
|
|
180
|
+
if (this._isReady) {
|
|
181
|
+
this._handler.setOffsetArr(this._handlerIndex, this._offset);
|
|
182
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
183
|
+
this._lockId = LOCK_UPDATE;
|
|
184
|
+
}
|
|
163
185
|
}
|
|
164
186
|
|
|
165
187
|
/**
|
|
166
188
|
* Sets screen space offset.
|
|
167
189
|
* @public
|
|
168
|
-
* @param {
|
|
190
|
+
* @param {Vec2} offset - Offset size.
|
|
169
191
|
*/
|
|
170
192
|
setOffset3v(offset) {
|
|
171
|
-
this.
|
|
172
|
-
this._offset.y = offset.y;
|
|
173
|
-
(offset.z != undefined) && (this._offset.z = offset.z);
|
|
174
|
-
this._handler && this._handler.setOffsetArr(this._handlerIndex, offset);
|
|
193
|
+
this.setOffset(offset.x, offset.y, offset.z);
|
|
175
194
|
}
|
|
176
195
|
|
|
177
196
|
/**
|
|
178
197
|
* Returns billboard screen space offset size.
|
|
179
198
|
* @public
|
|
180
|
-
* @returns {
|
|
199
|
+
* @returns {Vec3}
|
|
181
200
|
*/
|
|
182
201
|
getOffset() {
|
|
183
202
|
return this._offset;
|
|
@@ -189,8 +208,14 @@ class BaseBillboard {
|
|
|
189
208
|
* @param {number} rotation - Screen space rotation in radians.
|
|
190
209
|
*/
|
|
191
210
|
setRotation(rotation) {
|
|
192
|
-
this._rotation
|
|
193
|
-
|
|
211
|
+
if (rotation !== this._rotation) {
|
|
212
|
+
this._rotation = rotation;
|
|
213
|
+
if (this._isReady) {
|
|
214
|
+
this._handler.setRotationArr(this._handlerIndex, rotation);
|
|
215
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
216
|
+
this._lockId = LOCK_UPDATE;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
194
219
|
}
|
|
195
220
|
|
|
196
221
|
/**
|
|
@@ -208,8 +233,14 @@ class BaseBillboard {
|
|
|
208
233
|
* @param {number} a - Billboard opacity.
|
|
209
234
|
*/
|
|
210
235
|
setOpacity(a) {
|
|
211
|
-
this._color.w
|
|
212
|
-
|
|
236
|
+
if (a !== this._color.w) {
|
|
237
|
+
a != undefined && (this._color.w = a);
|
|
238
|
+
if (this._isReady) {
|
|
239
|
+
this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
240
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
241
|
+
this._lockId = LOCK_UPDATE;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
213
244
|
}
|
|
214
245
|
|
|
215
246
|
/**
|
|
@@ -221,24 +252,26 @@ class BaseBillboard {
|
|
|
221
252
|
* @param {number} a - Alpha.
|
|
222
253
|
*/
|
|
223
254
|
setColor(r, g, b, a) {
|
|
224
|
-
this._color.x
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
255
|
+
if (a !== this._color.w || r !== this._color.x || g !== this._color.y || this._color.z !== b) {
|
|
256
|
+
this._color.x = r;
|
|
257
|
+
this._color.y = g;
|
|
258
|
+
this._color.z = b;
|
|
259
|
+
a != undefined && (this._color.w = a);
|
|
260
|
+
if (this._isReady) {
|
|
261
|
+
this._handler.setRgbaArr(this._handlerIndex, this._color);
|
|
262
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
263
|
+
this._lockId = LOCK_UPDATE;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
229
266
|
}
|
|
230
267
|
|
|
231
268
|
/**
|
|
232
269
|
* Sets RGBA color. Each channel from 0.0 to 1.0.
|
|
233
270
|
* @public
|
|
234
|
-
* @param {
|
|
271
|
+
* @param {Vec4} color - RGBA vector.
|
|
235
272
|
*/
|
|
236
273
|
setColor4v(color) {
|
|
237
|
-
this.
|
|
238
|
-
this._color.y = color.y;
|
|
239
|
-
this._color.z = color.z;
|
|
240
|
-
(color.w != undefined) && (this._color.w = color.w);
|
|
241
|
-
this._handler && this._handler.setRgbaArr(this._handlerIndex, color);
|
|
274
|
+
this.setColor(color.x, color.y, color.z, color.w);
|
|
242
275
|
}
|
|
243
276
|
|
|
244
277
|
/**
|
|
@@ -253,7 +286,7 @@ class BaseBillboard {
|
|
|
253
286
|
/**
|
|
254
287
|
* Returns RGBA color.
|
|
255
288
|
* @public
|
|
256
|
-
* @returns {
|
|
289
|
+
* @returns {Vec4}
|
|
257
290
|
*/
|
|
258
291
|
getColor() {
|
|
259
292
|
return this._color;
|
|
@@ -265,8 +298,14 @@ class BaseBillboard {
|
|
|
265
298
|
* @param {boolean} visibility - Visibility flag.
|
|
266
299
|
*/
|
|
267
300
|
setVisibility(visibility) {
|
|
268
|
-
this._visibility
|
|
269
|
-
|
|
301
|
+
if (visibility !== this._visibility) {
|
|
302
|
+
this._visibility = visibility;
|
|
303
|
+
if (this._isReady) {
|
|
304
|
+
this._handler.setVisibility(this._handlerIndex, visibility);
|
|
305
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
306
|
+
this._lockId = LOCK_UPDATE;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
270
309
|
}
|
|
271
310
|
|
|
272
311
|
/**
|
|
@@ -289,25 +328,26 @@ class BaseBillboard {
|
|
|
289
328
|
this._alignedAxis.x = x;
|
|
290
329
|
this._alignedAxis.y = y;
|
|
291
330
|
this._alignedAxis.z = z;
|
|
292
|
-
|
|
331
|
+
if (this._isReady) {
|
|
332
|
+
this._handler.setAlignedAxisArr(this._handlerIndex, this._alignedAxis);
|
|
333
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
334
|
+
this._lockId = LOCK_UPDATE;
|
|
335
|
+
}
|
|
293
336
|
}
|
|
294
337
|
|
|
295
338
|
/**
|
|
296
339
|
* Sets billboard aligned vector.
|
|
297
340
|
* @public
|
|
298
|
-
* @param {
|
|
341
|
+
* @param {math.Vecto3} alignedAxis - Vector to align.
|
|
299
342
|
*/
|
|
300
343
|
setAlignedAxis3v(alignedAxis) {
|
|
301
|
-
this.
|
|
302
|
-
this._alignedAxis.y = alignedAxis.y;
|
|
303
|
-
this._alignedAxis.z = alignedAxis.z;
|
|
304
|
-
this._handler && this._handler.setAlignedAxisArr(this._handlerIndex, alignedAxis);
|
|
344
|
+
this.setAlignedAxis(alignedAxis.x, alignedAxis.y, alignedAxis.z);
|
|
305
345
|
}
|
|
306
346
|
|
|
307
347
|
/**
|
|
308
348
|
* Returns aligned vector.
|
|
309
349
|
* @public
|
|
310
|
-
* @returns {
|
|
350
|
+
* @returns {Vec3}
|
|
311
351
|
*/
|
|
312
352
|
getAlignedAxis() {
|
|
313
353
|
return this._alignedAxis;
|
|
@@ -325,10 +365,14 @@ class BaseBillboard {
|
|
|
325
365
|
/**
|
|
326
366
|
* Sets billboard picking color.
|
|
327
367
|
* @public
|
|
328
|
-
* @param {
|
|
368
|
+
* @param {Vec3} color - Picking color.
|
|
329
369
|
*/
|
|
330
370
|
setPickingColor3v(color) {
|
|
331
|
-
|
|
371
|
+
if (this._isReady) {
|
|
372
|
+
this._handler.setPickingColorArr(this._handlerIndex, color);
|
|
373
|
+
} else if (this._lockId !== LOCK_FREE) {
|
|
374
|
+
this._lockId = LOCK_UPDATE;
|
|
375
|
+
}
|
|
332
376
|
}
|
|
333
377
|
}
|
|
334
378
|
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
* @module og/entity/Billboard
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
"use strict";
|
|
6
6
|
|
|
7
|
-
import { BaseBillboard } from
|
|
7
|
+
import { BaseBillboard } from "./BaseBillboard.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Represents basic quad billboard image.
|
|
11
11
|
* @class
|
|
12
|
-
* @extends {
|
|
12
|
+
* @extends {BaseBillboard}
|
|
13
13
|
* @param {Object} [options] - Options:
|
|
14
|
-
* @param {
|
|
14
|
+
* @param {Vec3|Array.<number>} [options.position] - Billboard spatial position.
|
|
15
15
|
* @param {number} [options.rotation] - Screen angle rotaion.
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
16
|
+
* @param {Vec4|string|Array.<number>} [options.color] - Billboard color.
|
|
17
|
+
* @param {Vec3|Array.<number>} [options.alignedAxis] - Billboard aligned vector.
|
|
18
|
+
* @param {Vec3|Array.<number>} [options.offset] - Billboard center screen offset.
|
|
19
19
|
* @param {boolean} [options.visibility] - Visibility.
|
|
20
20
|
* @param {string} [options.src] - Billboard image url source.
|
|
21
21
|
* @param {Image} [options.image] - Billboard image object.
|
|
@@ -76,7 +76,10 @@ class Billboard extends BaseBillboard {
|
|
|
76
76
|
ta.loadImage(src, function (img) {
|
|
77
77
|
if (ta.nodes[img.__nodeIndex]) {
|
|
78
78
|
that._image = img;
|
|
79
|
-
bh.setTexCoordArr(
|
|
79
|
+
bh.setTexCoordArr(
|
|
80
|
+
that._handlerIndex,
|
|
81
|
+
ta.nodes[that._image.__nodeIndex].texCoords
|
|
82
|
+
);
|
|
80
83
|
} else {
|
|
81
84
|
ta.addImage(img);
|
|
82
85
|
ta.createTexture();
|
|
@@ -106,7 +109,8 @@ class Billboard extends BaseBillboard {
|
|
|
106
109
|
setSize(width, height) {
|
|
107
110
|
this._width = width;
|
|
108
111
|
this._height = height;
|
|
109
|
-
this._handler &&
|
|
112
|
+
this._handler &&
|
|
113
|
+
this._handler.setSizeArr(this._handlerIndex, width * this._scale, height * this._scale);
|
|
110
114
|
}
|
|
111
115
|
|
|
112
116
|
/**
|
|
@@ -158,4 +162,4 @@ class Billboard extends BaseBillboard {
|
|
|
158
162
|
}
|
|
159
163
|
}
|
|
160
164
|
|
|
161
|
-
export { Billboard };
|
|
165
|
+
export { Billboard };
|