@openglobus/og 0.15.2 → 0.15.4
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 +24 -15
- 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/Globe.js +4 -0
- package/src/og/Object3d.js +1 -1
- package/src/og/control/DebugInfo.js +263 -165
- package/src/og/control/RulerSwitcher.js +4 -1
- package/src/og/control/SimpleNavigation.js +123 -128
- package/src/og/control/heightRuler/HeightRuler.js +12 -0
- package/src/og/control/heightRuler/HeightRulerScene.js +224 -0
- package/src/og/control/heightRuler/HeightRulerSwitcher.js +15 -0
- package/src/og/control/index.js +2 -0
- package/src/og/control/ruler/RulerScene.js +106 -79
- package/src/og/entity/Entity.js +6 -6
- package/src/og/entity/EntityCollection.js +4 -0
- package/src/og/entity/GeoObjectHandler.js +3 -0
- package/src/og/layer/BaseGeoImage.js +152 -16
- package/src/og/layer/GeoImage.js +0 -91
- package/src/og/layer/GeoTexture2d.js +54 -143
- package/src/og/layer/GeoVideo.js +6 -107
- package/src/og/layer/Material.js +1 -1
- package/src/og/layer/Vector.js +1 -0
- package/src/og/renderer/Renderer.js +92 -96
- package/src/og/renderer/RendererEvents.js +39 -23
- package/src/og/scene/BaseNode.js +113 -113
- package/src/og/scene/Planet.js +11 -8
- package/src/og/scene/RenderNode.js +42 -9
- package/src/og/segment/Segment.js +3 -3
- package/src/og/shaders/geoObject.js +12 -10
- package/src/og/shaders/pickingMask.js +1 -1
- package/src/og/shaders/polyline.js +212 -212
- package/src/og/utils/GeoImageCreator.js +61 -21
- package/src/og/utils/VectorTileCreator.js +32 -49
- package/src/og/webgl/Framebuffer.js +5 -0
- package/types/control/DebugInfo.d.ts +4 -0
- package/types/control/SimpleNavigation.d.ts +1 -0
- package/types/control/heightRuler/HeightRuler.d.ts +6 -0
- package/types/control/heightRuler/HeightRulerScene.d.ts +23 -0
- package/types/control/index.d.ts +2 -1
- package/types/control/ruler/RulerScene.d.ts +8 -5
- package/types/control/selection/SelectionScene.d.ts +0 -1
- package/types/entity/EntityCollection.d.ts +1 -0
- package/types/layer/BaseGeoImage.d.ts +17 -3
- package/types/layer/GeoImage.d.ts +0 -8
- package/types/layer/GeoTexture2d.d.ts +0 -2
- package/types/layer/GeoVideo.d.ts +0 -8
- package/types/renderer/Renderer.d.ts +12 -3
- package/types/scene/Axes.d.ts +1 -1
- package/types/scene/BaseNode.d.ts +2 -2
- package/types/scene/Planet.d.ts +0 -5
- package/types/scene/RenderNode.d.ts +16 -9
- package/types/scene/SkyBox.d.ts +1 -1
- package/types/utils/VectorTileCreator.d.ts +1 -3
- package/types/webgl/Framebuffer.d.ts +1 -0
|
@@ -1,143 +1,54 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module og/layer/GeoTexture2d
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
'use strict';
|
|
6
|
-
|
|
7
|
-
import * as math from '../math.js';
|
|
8
|
-
import { BaseGeoImage } from './BaseGeoImage.js';
|
|
9
|
-
|
|
10
|
-
class GeoTexture2d extends BaseGeoImage {
|
|
11
|
-
constructor(name, options) {
|
|
12
|
-
super(name, options);
|
|
13
|
-
|
|
14
|
-
this._sourceTexture = options.texture || null;
|
|
15
|
-
|
|
16
|
-
if (options.texture) {
|
|
17
|
-
this._sourceReady = true;
|
|
18
|
-
this._sourceCreated = true;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
this._frameWidth = options.frameWidth ? math.nextHighestPowerOfTwo(options.frameWidth) : 256;
|
|
22
|
-
this._frameHeight = options.frameHeight ? math.nextHighestPowerOfTwo(options.frameHeight) : 256;
|
|
23
|
-
|
|
24
|
-
this._animate = true;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
get instanceName() {
|
|
28
|
-
return "GeoTexture2d";
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
loadMaterial(material) {
|
|
32
|
-
this._planet._geoImageCreator.add(this);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
bindTexture(texture) {
|
|
36
|
-
this._sourceReady = true;
|
|
37
|
-
this._sourceCreated = true;
|
|
38
|
-
this._sourceTexture = texture;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
setSize(width, height) {
|
|
42
|
-
this._frameWidth = width;
|
|
43
|
-
this._frameHeight = height;
|
|
44
|
-
this._frameCreated = false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
abortMaterialLoading(material) {
|
|
48
|
-
this._creationProceeding = false;
|
|
49
|
-
material.isLoading = false;
|
|
50
|
-
material.isReady = false;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
h = p.renderer.handler,
|
|
56
|
-
gl = h.gl,
|
|
57
|
-
creator = p._geoImageCreator;
|
|
58
|
-
|
|
59
|
-
this._refreshFrame && this._createFrame();
|
|
60
|
-
|
|
61
|
-
var f = creator._framebuffer;
|
|
62
|
-
f.setSize(this._frameWidth, this._frameHeight);
|
|
63
|
-
f.activate();
|
|
64
|
-
|
|
65
|
-
h.programs.geoImageTransform.activate();
|
|
66
|
-
var sh = h.programs.geoImageTransform._program;
|
|
67
|
-
var sha = sh.attributes,
|
|
68
|
-
shu = sh.uniforms;
|
|
69
|
-
|
|
70
|
-
gl.disable(gl.CULL_FACE);
|
|
71
|
-
|
|
72
|
-
f.bindOutputTexture(this._materialTexture);
|
|
73
|
-
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
74
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
75
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
76
|
-
|
|
77
|
-
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
78
|
-
|
|
79
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBuffer);
|
|
80
|
-
gl.vertexAttribPointer(sha.corners, this._gridBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
81
|
-
gl.uniform4fv(shu.extentParams, this._extentMercParams);
|
|
82
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
83
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
84
|
-
gl.uniform1i(shu.sourceTexture, 0);
|
|
85
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
86
|
-
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
87
|
-
f.deactivate();
|
|
88
|
-
|
|
89
|
-
gl.enable(gl.CULL_FACE);
|
|
90
|
-
|
|
91
|
-
this._ready = true;
|
|
92
|
-
|
|
93
|
-
this._creationProceeding = false;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
_renderingProjType0() {
|
|
97
|
-
var p = this._planet,
|
|
98
|
-
h = p.renderer.handler,
|
|
99
|
-
gl = h.gl,
|
|
100
|
-
creator = p._geoImageCreator;
|
|
101
|
-
|
|
102
|
-
var width = this._frameWidth,
|
|
103
|
-
height = this._frameHeight;
|
|
104
|
-
|
|
105
|
-
this._refreshFrame && this._createFrame();
|
|
106
|
-
|
|
107
|
-
var f = creator._framebuffer;
|
|
108
|
-
f.setSize(width, height);
|
|
109
|
-
f.activate();
|
|
110
|
-
|
|
111
|
-
h.programs.geoImageTransform.activate();
|
|
112
|
-
var sh = h.programs.geoImageTransform._program;
|
|
113
|
-
var sha = sh.attributes,
|
|
114
|
-
shu = sh.uniforms;
|
|
115
|
-
|
|
116
|
-
gl.disable(gl.CULL_FACE);
|
|
117
|
-
|
|
118
|
-
f.bindOutputTexture(this._materialTexture);
|
|
119
|
-
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
120
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
121
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
122
|
-
|
|
123
|
-
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
124
|
-
|
|
125
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBuffer);
|
|
126
|
-
gl.vertexAttribPointer(sha.corners, this._gridBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
127
|
-
gl.uniform4fv(shu.extentParams, this._extentWgs84Params);
|
|
128
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
129
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
130
|
-
gl.uniform1i(shu.sourceTexture, 0);
|
|
131
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
132
|
-
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
133
|
-
f.deactivate();
|
|
134
|
-
|
|
135
|
-
gl.enable(gl.CULL_FACE);
|
|
136
|
-
|
|
137
|
-
this._ready = true;
|
|
138
|
-
|
|
139
|
-
this._creationProceeding = false;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
export { GeoTexture2d };
|
|
1
|
+
/**
|
|
2
|
+
* @module og/layer/GeoTexture2d
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
import * as math from '../math.js';
|
|
8
|
+
import { BaseGeoImage } from './BaseGeoImage.js';
|
|
9
|
+
|
|
10
|
+
class GeoTexture2d extends BaseGeoImage {
|
|
11
|
+
constructor(name, options) {
|
|
12
|
+
super(name, options);
|
|
13
|
+
|
|
14
|
+
this._sourceTexture = options.texture || null;
|
|
15
|
+
|
|
16
|
+
if (options.texture) {
|
|
17
|
+
this._sourceReady = true;
|
|
18
|
+
this._sourceCreated = true;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
this._frameWidth = options.frameWidth ? math.nextHighestPowerOfTwo(options.frameWidth) : 256;
|
|
22
|
+
this._frameHeight = options.frameHeight ? math.nextHighestPowerOfTwo(options.frameHeight) : 256;
|
|
23
|
+
|
|
24
|
+
this._animate = true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
get instanceName() {
|
|
28
|
+
return "GeoTexture2d";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
loadMaterial(material) {
|
|
32
|
+
this._planet._geoImageCreator.add(this);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
bindTexture(texture) {
|
|
36
|
+
this._sourceReady = true;
|
|
37
|
+
this._sourceCreated = true;
|
|
38
|
+
this._sourceTexture = texture;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
setSize(width, height) {
|
|
42
|
+
this._frameWidth = width;
|
|
43
|
+
this._frameHeight = height;
|
|
44
|
+
this._frameCreated = false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
abortMaterialLoading(material) {
|
|
48
|
+
this._creationProceeding = false;
|
|
49
|
+
material.isLoading = false;
|
|
50
|
+
material.isReady = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { GeoTexture2d };
|
package/src/og/layer/GeoVideo.js
CHANGED
|
@@ -90,13 +90,13 @@ class GeoVideo extends BaseGeoImage {
|
|
|
90
90
|
* @protected
|
|
91
91
|
*/
|
|
92
92
|
_createSourceTexture() {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this._sourceCreated = true;
|
|
96
|
-
} else {
|
|
97
|
-
var gl = this._planet.renderer.handler.gl;
|
|
93
|
+
let gl = this._planet.renderer.handler.gl;
|
|
94
|
+
if (this._sourceCreated) {
|
|
98
95
|
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
99
96
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this._video);
|
|
97
|
+
} else {
|
|
98
|
+
this._sourceTexture = this._planet.renderer.handler.createTexture_n_webgl1(this._video);
|
|
99
|
+
this._sourceCreated = true;
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -117,7 +117,7 @@ class GeoVideo extends BaseGeoImage {
|
|
|
117
117
|
* @private
|
|
118
118
|
*/
|
|
119
119
|
_onError(video) {
|
|
120
|
-
|
|
120
|
+
let err = "unknown error";
|
|
121
121
|
switch (video.error.code) {
|
|
122
122
|
case 1:
|
|
123
123
|
err = "video loading aborted";
|
|
@@ -186,107 +186,6 @@ class GeoVideo extends BaseGeoImage {
|
|
|
186
186
|
material.isLoading = false;
|
|
187
187
|
material.isReady = false;
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
_renderingProjType1() {
|
|
191
|
-
var p = this._planet,
|
|
192
|
-
h = p.renderer.handler,
|
|
193
|
-
gl = h.gl,
|
|
194
|
-
creator = p._geoImageCreator;
|
|
195
|
-
|
|
196
|
-
this._refreshFrame && this._createFrame();
|
|
197
|
-
|
|
198
|
-
if (this._sourceCreated) {
|
|
199
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
200
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this._video);
|
|
201
|
-
} else {
|
|
202
|
-
this._sourceTexture = this._planet.renderer.handler.createTexture_n_webgl1(this._video);
|
|
203
|
-
this._sourceCreated = true;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
var f = creator._framebuffer;
|
|
207
|
-
f.setSize(this._frameWidth, this._frameHeight);
|
|
208
|
-
f.activate();
|
|
209
|
-
|
|
210
|
-
h.programs.geoImageTransform.activate();
|
|
211
|
-
var sh = h.programs.geoImageTransform._program;
|
|
212
|
-
var sha = sh.attributes,
|
|
213
|
-
shu = sh.uniforms;
|
|
214
|
-
|
|
215
|
-
gl.disable(gl.CULL_FACE);
|
|
216
|
-
|
|
217
|
-
f.bindOutputTexture(this._materialTexture);
|
|
218
|
-
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
219
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
220
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
221
|
-
|
|
222
|
-
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
223
|
-
|
|
224
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBuffer);
|
|
225
|
-
gl.vertexAttribPointer(sha.corners, this._gridBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
226
|
-
gl.uniform4fv(shu.extentParams, this._extentMercParams);
|
|
227
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
228
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
229
|
-
gl.uniform1i(shu.sourceTexture, 0);
|
|
230
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
231
|
-
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
232
|
-
f.deactivate();
|
|
233
|
-
|
|
234
|
-
gl.enable(gl.CULL_FACE);
|
|
235
|
-
|
|
236
|
-
this._ready = true;
|
|
237
|
-
|
|
238
|
-
this._creationProceeding = false;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
_renderingProjType0() {
|
|
242
|
-
var p = this._planet,
|
|
243
|
-
h = p.renderer.handler,
|
|
244
|
-
gl = h.gl,
|
|
245
|
-
creator = p._geoImageCreator;
|
|
246
|
-
|
|
247
|
-
this._refreshFrame && this._createFrame();
|
|
248
|
-
if (!this._sourceCreated) {
|
|
249
|
-
this._sourceTexture = this._planet.renderer.handler.createTexture_n_webgl1(this._video);
|
|
250
|
-
this._sourceCreated = true;
|
|
251
|
-
} else {
|
|
252
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
253
|
-
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this._video);
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
var f = creator._framebuffer;
|
|
257
|
-
f.setSize(this._frameWidth, this._frameHeight);
|
|
258
|
-
f.activate();
|
|
259
|
-
|
|
260
|
-
h.programs.geoImageTransform.activate();
|
|
261
|
-
var sh = h.programs.geoImageTransform._program;
|
|
262
|
-
var sha = sh.attributes,
|
|
263
|
-
shu = sh.uniforms;
|
|
264
|
-
|
|
265
|
-
gl.disable(gl.CULL_FACE);
|
|
266
|
-
|
|
267
|
-
f.bindOutputTexture(this._materialTexture);
|
|
268
|
-
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
269
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
270
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
271
|
-
|
|
272
|
-
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
273
|
-
|
|
274
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBuffer);
|
|
275
|
-
gl.vertexAttribPointer(sha.corners, this._gridBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
276
|
-
gl.uniform4fv(shu.extentParams, this._extentWgs84Params);
|
|
277
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
278
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
279
|
-
gl.uniform1i(shu.sourceTexture, 0);
|
|
280
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
281
|
-
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
282
|
-
f.deactivate();
|
|
283
|
-
|
|
284
|
-
gl.enable(gl.CULL_FACE);
|
|
285
|
-
|
|
286
|
-
this._ready = true;
|
|
287
|
-
|
|
288
|
-
this._creationProceeding = false;
|
|
289
|
-
}
|
|
290
189
|
}
|
|
291
190
|
|
|
292
191
|
export { GeoVideo };
|
package/src/og/layer/Material.js
CHANGED
|
@@ -49,11 +49,11 @@ class Material {
|
|
|
49
49
|
this._updateTexture = null;
|
|
50
50
|
//this.image = img;
|
|
51
51
|
this.texture = this._createTexture(img);
|
|
52
|
-
this.appliedNodeId = this.segment.node.nodeId;
|
|
53
52
|
this.isReady = true;
|
|
54
53
|
this.pickingReady = true;
|
|
55
54
|
this.textureExists = true;
|
|
56
55
|
this.isLoading = false;
|
|
56
|
+
this.appliedNodeId = this.segment.node.nodeId;
|
|
57
57
|
this.texOffset = [0.0, 0.0, 1.0, 1.0];
|
|
58
58
|
}
|
|
59
59
|
}
|
package/src/og/layer/Vector.js
CHANGED