@openglobus/og 0.15.3 → 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 +90 -94
- 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/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
|
@@ -10,7 +10,7 @@ import { RenderNode } from '../../scene/RenderNode.js';
|
|
|
10
10
|
|
|
11
11
|
const OUTLINE_COUNT = 120;
|
|
12
12
|
|
|
13
|
-
function distanceFormat(v) {
|
|
13
|
+
export function distanceFormat(v) {
|
|
14
14
|
if (v > 1000) {
|
|
15
15
|
return `${(v / 1000).toFixed(1)} km`;
|
|
16
16
|
} else if (v > 9) {
|
|
@@ -19,6 +19,24 @@ function distanceFormat(v) {
|
|
|
19
19
|
return `${v.toFixed(1)} m`;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
+
let obj3d = Object3d.createCylinder(1.1, 0, 2.7, 20, 1, true, false, 0, 0, 0)
|
|
23
|
+
|
|
24
|
+
const LABEL_OPTIONS = {
|
|
25
|
+
text: "",
|
|
26
|
+
size: 11,
|
|
27
|
+
color: "rgba(455,455,455,1.0)",
|
|
28
|
+
outlineColor: "rgba(0,0,0,0.34)",
|
|
29
|
+
outline: 0.23,
|
|
30
|
+
align: "center",
|
|
31
|
+
offset: [0, 20]
|
|
32
|
+
};
|
|
33
|
+
const RULER_CORNER_OPTIONS = {
|
|
34
|
+
scale: 1,
|
|
35
|
+
instanced: true,
|
|
36
|
+
tag: "ruler",
|
|
37
|
+
color: "rgb(0,305,0)",
|
|
38
|
+
object3d: obj3d
|
|
39
|
+
};
|
|
22
40
|
|
|
23
41
|
class RulerScene extends RenderNode {
|
|
24
42
|
constructor(options = {}) {
|
|
@@ -40,71 +58,23 @@ class RulerScene extends RenderNode {
|
|
|
40
58
|
|
|
41
59
|
this._heading = 0;
|
|
42
60
|
|
|
43
|
-
this._propsLabel = new Entity({
|
|
44
|
-
'name': 'propsLabel',
|
|
45
|
-
'label': {
|
|
46
|
-
text: "",
|
|
47
|
-
size: 11,
|
|
48
|
-
color: "rgba(455,455,455,1.0)",
|
|
49
|
-
outlineColor: "rgba(0,0,0,0.34)",
|
|
50
|
-
outline: 0.23,
|
|
51
|
-
align: "center",
|
|
52
|
-
offset: [0, 18]
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
this._propsLabel.label.setVisibility(false);
|
|
57
|
-
|
|
58
|
-
this._trackEntity = new Entity({
|
|
59
|
-
polyline: {
|
|
60
|
-
path3v: [],
|
|
61
|
-
thickness: 4.8,
|
|
62
|
-
color: "rgb(255,131,0)",
|
|
63
|
-
isClosed: false
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
this._trackEntity.polyline.altitude = 0.01;
|
|
68
|
-
|
|
69
|
-
let obj3d = Object3d.createCylinder(1.1, 0, 2.7, 20, 1, true, false, 0, 0, 0)
|
|
70
|
-
|
|
71
|
-
this._cornerEntity = [
|
|
72
|
-
new Entity({
|
|
73
|
-
geoObject: {
|
|
74
|
-
scale: 1,
|
|
75
|
-
instanced: true,
|
|
76
|
-
tag: "ruler",
|
|
77
|
-
color: "rgb(0,305,0)",
|
|
78
|
-
object3d: obj3d
|
|
79
|
-
},
|
|
80
|
-
properties: {
|
|
81
|
-
name: "start"
|
|
82
|
-
}
|
|
83
|
-
}),
|
|
84
|
-
new Entity({
|
|
85
|
-
geoObject: {
|
|
86
|
-
scale: 1,
|
|
87
|
-
instanced: true,
|
|
88
|
-
tag: "ruler",
|
|
89
|
-
color: "rgb(455,0,0)",
|
|
90
|
-
object3d: obj3d
|
|
91
|
-
},
|
|
92
|
-
properties: {
|
|
93
|
-
name: "end"
|
|
94
|
-
}
|
|
95
|
-
})
|
|
96
|
-
];
|
|
97
|
-
|
|
98
61
|
this._trackLayer = new Vector("track", {
|
|
99
|
-
entities: [
|
|
62
|
+
entities: [],
|
|
100
63
|
pickingEnabled: false,
|
|
101
64
|
polygonOffsetUnits: -1.0,
|
|
102
65
|
relativeToGround: true,
|
|
103
66
|
displayInLayerSwitcher: false
|
|
104
67
|
});
|
|
68
|
+
this._labelLayer = new Vector("ruler-label", {
|
|
69
|
+
entities: [],
|
|
70
|
+
pickingEnabled: false,
|
|
71
|
+
polygonOffsetUnits: -100.0,
|
|
72
|
+
relativeToGround: true,
|
|
73
|
+
displayInLayerSwitcher: false
|
|
74
|
+
});
|
|
105
75
|
|
|
106
76
|
this._cornersLayer = new Vector("corners", {
|
|
107
|
-
entities: [
|
|
77
|
+
entities: [],
|
|
108
78
|
pickingEnabled: true,
|
|
109
79
|
displayInLayerSwitcher: false,
|
|
110
80
|
scaleByDistance: [100, 4000000, 1.0],
|
|
@@ -123,7 +93,50 @@ class RulerScene extends RenderNode {
|
|
|
123
93
|
this._planet = planet;
|
|
124
94
|
}
|
|
125
95
|
|
|
96
|
+
_createCorners() {
|
|
97
|
+
this._cornerEntity = [
|
|
98
|
+
new Entity({
|
|
99
|
+
geoObject: RULER_CORNER_OPTIONS,
|
|
100
|
+
properties: {
|
|
101
|
+
name: "start"
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
new Entity({
|
|
105
|
+
geoObject: RULER_CORNER_OPTIONS,
|
|
106
|
+
properties: {
|
|
107
|
+
name: "end"
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
];
|
|
111
|
+
this._cornersLayer.addEntities(this._cornerEntity)
|
|
112
|
+
}
|
|
113
|
+
|
|
126
114
|
init() {
|
|
115
|
+
|
|
116
|
+
this._propsLabel = new Entity({
|
|
117
|
+
'name': 'propsLabel',
|
|
118
|
+
'label': LABEL_OPTIONS
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// this._propsLabel.label.setVisibility(false);
|
|
122
|
+
|
|
123
|
+
this._trackEntity = new Entity({
|
|
124
|
+
polyline: {
|
|
125
|
+
path3v: [],
|
|
126
|
+
thickness: 4.8,
|
|
127
|
+
color: "rgb(255,131,0)",
|
|
128
|
+
isClosed: false
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
this._trackEntity.polyline.altitude = 0.01;
|
|
133
|
+
|
|
134
|
+
this._createCorners();
|
|
135
|
+
this._trackLayer.addEntities([this._trackEntity]);
|
|
136
|
+
this._labelLayer.addEntities([ this._propsLabel]);
|
|
137
|
+
this._planet.addLayer(this._labelLayer);
|
|
138
|
+
this._planet.addLayer(this._trackLayer);
|
|
139
|
+
this._planet.addLayer(this._cornersLayer);
|
|
127
140
|
this._activate();
|
|
128
141
|
}
|
|
129
142
|
|
|
@@ -156,8 +169,6 @@ class RulerScene extends RenderNode {
|
|
|
156
169
|
this._onCornerLup_ = this._onCornerLup.bind(this);
|
|
157
170
|
this._cornersLayer.events.on("lup", this._onCornerLup, this);
|
|
158
171
|
|
|
159
|
-
this._planet.addLayer(this._trackLayer);
|
|
160
|
-
this._planet.addLayer(this._cornersLayer);
|
|
161
172
|
|
|
162
173
|
}
|
|
163
174
|
|
|
@@ -166,8 +177,8 @@ class RulerScene extends RenderNode {
|
|
|
166
177
|
this._preventClick = false;
|
|
167
178
|
this._stopDrawing = false;
|
|
168
179
|
this._pickedCorner = null;
|
|
169
|
-
this._trackLayer.remove();
|
|
170
|
-
this._cornersLayer.remove();
|
|
180
|
+
// this._trackLayer.remove();
|
|
181
|
+
// this._cornersLayer.remove();
|
|
171
182
|
|
|
172
183
|
this.renderer.events.off("lclick", this._onLclick_);
|
|
173
184
|
this.renderer.events.off("mousemove", this._onMouseMove_);
|
|
@@ -234,10 +245,10 @@ class RulerScene extends RenderNode {
|
|
|
234
245
|
if (!this._preventClick) {
|
|
235
246
|
if (!this._startLonLat) {
|
|
236
247
|
this._stopDrawing = false;
|
|
237
|
-
this._propsLabel.
|
|
248
|
+
this._propsLabel.setVisibility(false);
|
|
238
249
|
this._trackEntity.polyline.setPath3v([]);
|
|
239
|
-
this._cornerEntity[0].
|
|
240
|
-
this._cornerEntity[1].
|
|
250
|
+
this._cornerEntity[0].setVisibility(true);
|
|
251
|
+
this._cornerEntity[1].setVisibility(true);
|
|
241
252
|
this._startLonLat = startLonLat;
|
|
242
253
|
} else {
|
|
243
254
|
this._startLonLat = null;
|
|
@@ -302,26 +313,42 @@ class RulerScene extends RenderNode {
|
|
|
302
313
|
}
|
|
303
314
|
|
|
304
315
|
clear() {
|
|
305
|
-
|
|
306
|
-
this.
|
|
307
|
-
this._cornerEntity[
|
|
308
|
-
this.
|
|
316
|
+
this._trackEntity.remove();
|
|
317
|
+
this._cornerEntity[0].remove();
|
|
318
|
+
this._cornerEntity[1].remove();
|
|
319
|
+
this._propsLabel.remove();
|
|
320
|
+
this._planet.removeLayer(this._trackLayer);
|
|
321
|
+
this._planet.removeLayer(this._cornersLayer);
|
|
309
322
|
}
|
|
310
323
|
|
|
311
|
-
|
|
324
|
+
isCornersPositionChanged() {
|
|
312
325
|
let t = this._trackEntity.polyline.getPath3v()[0];
|
|
313
326
|
if (t) {
|
|
314
|
-
|
|
315
|
-
|
|
327
|
+
const startPos = t[0].clone(),
|
|
328
|
+
endPos = t[t.length - 1].clone();
|
|
329
|
+
return this._cornerEntity[0].getCartesian().equal(startPos) &&
|
|
330
|
+
this._cornerEntity[1].getCartesian().equal(endPos)
|
|
331
|
+
}
|
|
332
|
+
return false
|
|
333
|
+
}
|
|
316
334
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
335
|
+
frame() {
|
|
336
|
+
let t = this._trackEntity.polyline.getPath3v()[0];
|
|
337
|
+
if (t) {
|
|
338
|
+
const startPos = t[0].clone(),
|
|
339
|
+
endPos = t[t.length - 1].clone();
|
|
340
|
+
|
|
341
|
+
if (!this.isCornersPositionChanged()) {
|
|
342
|
+
this._cornerEntity[0].setCartesian3v(startPos);
|
|
343
|
+
this._cornerEntity[1].setCartesian3v(endPos);
|
|
344
|
+
if (!this._ignoreTerrain) {
|
|
345
|
+
let res = 0;
|
|
346
|
+
for (let i = 0, len = t.length - 1; i < len; i++) {
|
|
347
|
+
res += t[i + 1].distance(t[i]);
|
|
348
|
+
}
|
|
349
|
+
this._propsLabel.setCartesian3v(t[Math.floor(t.length / 2)]);
|
|
350
|
+
this._propsLabel.label.setText(`${distanceFormat(res)}, ${Math.round(this._heading)} deg`);
|
|
321
351
|
}
|
|
322
|
-
|
|
323
|
-
this._propsLabel.setCartesian3v(t[Math.floor(t.length / 2)]);
|
|
324
|
-
this._propsLabel.label.setText(`${distanceFormat(res)}, ${Math.round(this._heading)} deg`);
|
|
325
352
|
}
|
|
326
353
|
}
|
|
327
354
|
}
|
package/src/og/entity/Entity.js
CHANGED
|
@@ -531,7 +531,7 @@ class Entity {
|
|
|
531
531
|
this.ray = ray;
|
|
532
532
|
this.ray._entity = this;
|
|
533
533
|
this.ray.setVisibility(this._visibility);
|
|
534
|
-
this._entityCollection && this._entityCollection.
|
|
534
|
+
this._entityCollection && this._entityCollection.rayHandler.add(ray);
|
|
535
535
|
return ray;
|
|
536
536
|
}
|
|
537
537
|
|
|
@@ -548,7 +548,7 @@ class Entity {
|
|
|
548
548
|
this.polyline = polyline;
|
|
549
549
|
this.polyline._entity = this;
|
|
550
550
|
this.polyline.setVisibility(this._visibility);
|
|
551
|
-
this._entityCollection && this._entityCollection.
|
|
551
|
+
this._entityCollection && this._entityCollection.polylineHandler.add(polyline);
|
|
552
552
|
return polyline;
|
|
553
553
|
}
|
|
554
554
|
|
|
@@ -565,7 +565,7 @@ class Entity {
|
|
|
565
565
|
this.pointCloud = pointCloud;
|
|
566
566
|
this.pointCloud._entity = this;
|
|
567
567
|
this.pointCloud.setVisibility(this._visibility);
|
|
568
|
-
this._entityCollection && this._entityCollection.
|
|
568
|
+
this._entityCollection && this._entityCollection.pointCloudHandler.add(pointCloud);
|
|
569
569
|
return pointCloud;
|
|
570
570
|
}
|
|
571
571
|
|
|
@@ -600,7 +600,7 @@ class Entity {
|
|
|
600
600
|
this.geoObject._entity = this;
|
|
601
601
|
this.geoObject.setPosition3v(this._cartesian);
|
|
602
602
|
this.geoObject.setVisibility(this._visibility);
|
|
603
|
-
this._entityCollection && this._entityCollection.
|
|
603
|
+
this._entityCollection && this._entityCollection.geoObjectHandler.add(geoObject);
|
|
604
604
|
return geoObject;
|
|
605
605
|
}
|
|
606
606
|
|
|
@@ -617,7 +617,7 @@ class Entity {
|
|
|
617
617
|
this.strip = strip;
|
|
618
618
|
this.strip._entity = this;
|
|
619
619
|
this.strip.setVisibility(this._visibility);
|
|
620
|
-
this._entityCollection && this._entityCollection.
|
|
620
|
+
this._entityCollection && this._entityCollection.stripHandler.add(strip);
|
|
621
621
|
return strip;
|
|
622
622
|
}
|
|
623
623
|
|
|
@@ -644,7 +644,7 @@ class Entity {
|
|
|
644
644
|
entity._pickingColor = this._pickingColor;
|
|
645
645
|
entity.parent = this;
|
|
646
646
|
this.childrenNodes.push(entity);
|
|
647
|
-
this._entityCollection && this._entityCollection.
|
|
647
|
+
this._entityCollection && this._entityCollection.appendChildEntity(entity);
|
|
648
648
|
}
|
|
649
649
|
|
|
650
650
|
/**
|
|
@@ -283,6 +283,10 @@ class EntityCollection {
|
|
|
283
283
|
this.scaleByDistance[2] = farInvisible || math.MAX32;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
+
appendChildEntity(entity) {
|
|
287
|
+
this._addRecursively(entity);
|
|
288
|
+
}
|
|
289
|
+
|
|
286
290
|
_addRecursively(entity) {
|
|
287
291
|
// billboard
|
|
288
292
|
entity.billboard && this.billboardHandler.add(entity.billboard);
|
|
@@ -348,6 +348,8 @@ class GeoObjectHandler {
|
|
|
348
348
|
for (let i = 0; i < this._instanceDataMapValues.length; i++) {
|
|
349
349
|
this._loadDataTagTexture(this._instanceDataMapValues[i]);
|
|
350
350
|
}
|
|
351
|
+
|
|
352
|
+
this.update();
|
|
351
353
|
}
|
|
352
354
|
|
|
353
355
|
_addGeoObjectToArray(geoObject) {
|
|
@@ -489,6 +491,7 @@ class GeoObjectHandler {
|
|
|
489
491
|
|
|
490
492
|
drawPicking() {
|
|
491
493
|
if (this._geoObjects.length && this.pickingEnabled) {
|
|
494
|
+
this.update();
|
|
492
495
|
this._pickingPASS();
|
|
493
496
|
}
|
|
494
497
|
}
|
|
@@ -8,6 +8,7 @@ import { Extent } from "../Extent.js";
|
|
|
8
8
|
import { LonLat } from "../LonLat.js";
|
|
9
9
|
import * as mercator from "../mercator.js";
|
|
10
10
|
import { Layer } from "./Layer.js";
|
|
11
|
+
import { doubleToTwoFloats2 } from "../math/coder.js";
|
|
11
12
|
|
|
12
13
|
const EVENT_NAMES = [
|
|
13
14
|
/**
|
|
@@ -37,6 +38,12 @@ class BaseGeoImage extends Layer {
|
|
|
37
38
|
|
|
38
39
|
this._gridBuffer = null;
|
|
39
40
|
this._extentWgs84Params = null;
|
|
41
|
+
this._extentWgs84ParamsHigh = new Float32Array(4);
|
|
42
|
+
this._extentWgs84ParamsLow = new Float32Array(4);
|
|
43
|
+
|
|
44
|
+
this._extentMercParams = null;
|
|
45
|
+
this._extentMercParamsHigh = new Float32Array(4);
|
|
46
|
+
this._extentMercParamsLow = new Float32Array(4);
|
|
40
47
|
|
|
41
48
|
this._refreshFrame = true;
|
|
42
49
|
this._frameCreated = false;
|
|
@@ -186,20 +193,33 @@ class BaseGeoImage extends Layer {
|
|
|
186
193
|
this._extentWgs84.northEast.forwardMercatorEPS01()
|
|
187
194
|
);
|
|
188
195
|
|
|
196
|
+
let tempArr = new Float32Array(2);
|
|
197
|
+
|
|
189
198
|
if (this._projType === 0) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
199
|
+
|
|
200
|
+
doubleToTwoFloats2(this._extentWgs84.southWest.lon, tempArr);
|
|
201
|
+
this._extentWgs84ParamsHigh[0] = tempArr[0];
|
|
202
|
+
this._extentWgs84ParamsLow[0] = tempArr[1];
|
|
203
|
+
|
|
204
|
+
doubleToTwoFloats2(this._extentWgs84.southWest.lat, tempArr);
|
|
205
|
+
this._extentWgs84ParamsHigh[1] = tempArr[0];
|
|
206
|
+
this._extentWgs84ParamsLow[1] = tempArr[1];
|
|
207
|
+
|
|
208
|
+
this._extentWgs84ParamsHigh[2] = 2.0 / this._extentWgs84.getWidth();
|
|
209
|
+
this._extentWgs84ParamsHigh[3] = 2.0 / this._extentWgs84.getHeight();
|
|
210
|
+
|
|
196
211
|
} else {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
212
|
+
|
|
213
|
+
doubleToTwoFloats2(this._extentMerc.southWest.lon, tempArr);
|
|
214
|
+
this._extentMercParamsHigh[0] = tempArr[0];
|
|
215
|
+
this._extentMercParamsLow[0] = tempArr[1];
|
|
216
|
+
|
|
217
|
+
doubleToTwoFloats2(this._extentMerc.southWest.lat, tempArr);
|
|
218
|
+
this._extentMercParamsHigh[1] = tempArr[0];
|
|
219
|
+
this._extentMercParamsLow[1] = tempArr[1];
|
|
220
|
+
|
|
221
|
+
this._extentMercParamsHigh[2] = 2.0 / this._extentMerc.getWidth();
|
|
222
|
+
this._extentMercParamsHigh[3] = 2.0 / this._extentMerc.getHeight();
|
|
203
223
|
}
|
|
204
224
|
|
|
205
225
|
// creates material frame textures
|
|
@@ -211,11 +231,14 @@ class BaseGeoImage extends Layer {
|
|
|
211
231
|
gl.deleteTexture(this._materialTexture);
|
|
212
232
|
this._materialTexture = h.createEmptyTexture_l(this._frameWidth, this._frameHeight);
|
|
213
233
|
|
|
214
|
-
|
|
234
|
+
let gridBufferArr = this._planet._geoImageCreator.createGridBuffer(
|
|
215
235
|
this._cornersWgs84,
|
|
216
236
|
this._projType
|
|
217
237
|
);
|
|
218
238
|
|
|
239
|
+
this._gridBufferHigh = gridBufferArr[0];
|
|
240
|
+
this._gridBufferLow = gridBufferArr[1];
|
|
241
|
+
|
|
219
242
|
this._refreshFrame = false;
|
|
220
243
|
}
|
|
221
244
|
}
|
|
@@ -235,10 +258,10 @@ class BaseGeoImage extends Layer {
|
|
|
235
258
|
* @virtual
|
|
236
259
|
*/
|
|
237
260
|
clear() {
|
|
238
|
-
|
|
261
|
+
let p = this._planet;
|
|
239
262
|
|
|
240
263
|
if (p) {
|
|
241
|
-
|
|
264
|
+
let gl = p.renderer.handler.gl;
|
|
242
265
|
this._creationProceeding && p._geoImageCreator.remove(this);
|
|
243
266
|
p._clearLayerMaterial(this);
|
|
244
267
|
|
|
@@ -307,7 +330,7 @@ class BaseGeoImage extends Layer {
|
|
|
307
330
|
!this._creationProceeding && this.loadMaterial(material);
|
|
308
331
|
}
|
|
309
332
|
|
|
310
|
-
|
|
333
|
+
let v0s, v0t;
|
|
311
334
|
if (this._projType === 0) {
|
|
312
335
|
v0s = this._extentWgs84;
|
|
313
336
|
v0t = segment._extent;
|
|
@@ -342,6 +365,119 @@ class BaseGeoImage extends Layer {
|
|
|
342
365
|
get getFrameHeight() {
|
|
343
366
|
return this._frameHeight;
|
|
344
367
|
}
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* Method depends on GeoImage instance
|
|
371
|
+
* @virtual
|
|
372
|
+
* @private
|
|
373
|
+
*/
|
|
374
|
+
_createSourceTexture() {
|
|
375
|
+
//empty
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
_renderingProjType1() {
|
|
379
|
+
let p = this._planet,
|
|
380
|
+
h = p.renderer.handler,
|
|
381
|
+
gl = h.gl,
|
|
382
|
+
creator = p._geoImageCreator;
|
|
383
|
+
|
|
384
|
+
this._refreshFrame && this._createFrame();
|
|
385
|
+
this._createSourceTexture();
|
|
386
|
+
|
|
387
|
+
let f = creator._framebuffer;
|
|
388
|
+
f.setSize(this._frameWidth, this._frameHeight);
|
|
389
|
+
f.activate();
|
|
390
|
+
|
|
391
|
+
h.programs.geoImageTransform.activate();
|
|
392
|
+
var sh = h.programs.geoImageTransform._program;
|
|
393
|
+
var sha = sh.attributes,
|
|
394
|
+
shu = sh.uniforms;
|
|
395
|
+
|
|
396
|
+
gl.disable(gl.CULL_FACE);
|
|
397
|
+
|
|
398
|
+
f.bindOutputTexture(this._materialTexture);
|
|
399
|
+
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
400
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
401
|
+
|
|
402
|
+
gl.uniform1i(shu.isFullExtent, this._isFullExtent);
|
|
403
|
+
|
|
404
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
405
|
+
|
|
406
|
+
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
407
|
+
|
|
408
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBufferHigh);
|
|
409
|
+
gl.vertexAttribPointer(sha.cornersHigh, this._gridBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
410
|
+
|
|
411
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBufferLow);
|
|
412
|
+
gl.vertexAttribPointer(sha.cornersLow, this._gridBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
413
|
+
|
|
414
|
+
gl.uniform4fv(shu.extentParamsHigh, this._extentMercParamsHigh);
|
|
415
|
+
gl.uniform4fv(shu.extentParamsLow, this._extentMercParamsLow);
|
|
416
|
+
|
|
417
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
418
|
+
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
419
|
+
gl.uniform1i(shu.sourceTexture, 0);
|
|
420
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
421
|
+
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
422
|
+
f.deactivate();
|
|
423
|
+
|
|
424
|
+
gl.enable(gl.CULL_FACE);
|
|
425
|
+
|
|
426
|
+
this._ready = true;
|
|
427
|
+
|
|
428
|
+
this._creationProceeding = false;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
_renderingProjType0() {
|
|
432
|
+
let p = this._planet,
|
|
433
|
+
h = p.renderer.handler,
|
|
434
|
+
gl = h.gl,
|
|
435
|
+
creator = p._geoImageCreator;
|
|
436
|
+
|
|
437
|
+
this._refreshFrame && this._createFrame();
|
|
438
|
+
this._createSourceTexture();
|
|
439
|
+
|
|
440
|
+
let f = creator._framebuffer;
|
|
441
|
+
f.setSize(this._frameWidth, this._frameHeight);
|
|
442
|
+
f.activate();
|
|
443
|
+
|
|
444
|
+
h.programs.geoImageTransform.activate();
|
|
445
|
+
let sh = h.programs.geoImageTransform._program;
|
|
446
|
+
let sha = sh.attributes,
|
|
447
|
+
shu = sh.uniforms;
|
|
448
|
+
|
|
449
|
+
gl.disable(gl.CULL_FACE);
|
|
450
|
+
|
|
451
|
+
f.bindOutputTexture(this._materialTexture);
|
|
452
|
+
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
453
|
+
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
454
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
455
|
+
|
|
456
|
+
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
457
|
+
|
|
458
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBufferHigh);
|
|
459
|
+
gl.vertexAttribPointer(sha.cornersHigh, this._gridBufferHigh.itemSize, gl.FLOAT, false, 0, 0);
|
|
460
|
+
|
|
461
|
+
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBufferLow);
|
|
462
|
+
gl.vertexAttribPointer(sha.cornersLow, this._gridBufferLow.itemSize, gl.FLOAT, false, 0, 0);
|
|
463
|
+
|
|
464
|
+
gl.uniform4fv(shu.extentParamsHigh, this._extentWgs84ParamsHigh);
|
|
465
|
+
gl.uniform4fv(shu.extentParamsLow, this._extentWgs84ParamsLow);
|
|
466
|
+
|
|
467
|
+
gl.activeTexture(gl.TEXTURE0);
|
|
468
|
+
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
469
|
+
gl.uniform1i(shu.sourceTexture, 0);
|
|
470
|
+
|
|
471
|
+
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
472
|
+
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
473
|
+
f.deactivate();
|
|
474
|
+
|
|
475
|
+
gl.enable(gl.CULL_FACE);
|
|
476
|
+
|
|
477
|
+
this._ready = true;
|
|
478
|
+
|
|
479
|
+
this._creationProceeding = false;
|
|
480
|
+
}
|
|
345
481
|
}
|
|
346
482
|
|
|
347
483
|
export { BaseGeoImage };
|
package/src/og/layer/GeoImage.js
CHANGED
|
@@ -127,97 +127,6 @@ class GeoImage extends BaseGeoImage {
|
|
|
127
127
|
material.isLoading = false;
|
|
128
128
|
material.isReady = false;
|
|
129
129
|
}
|
|
130
|
-
|
|
131
|
-
_renderingProjType1() {
|
|
132
|
-
var p = this._planet,
|
|
133
|
-
h = p.renderer.handler,
|
|
134
|
-
gl = h.gl,
|
|
135
|
-
creator = p._geoImageCreator;
|
|
136
|
-
|
|
137
|
-
this._refreshFrame && this._createFrame();
|
|
138
|
-
this._createSourceTexture();
|
|
139
|
-
|
|
140
|
-
var f = creator._framebuffer;
|
|
141
|
-
f.setSize(this._frameWidth, this._frameHeight);
|
|
142
|
-
f.activate();
|
|
143
|
-
|
|
144
|
-
h.programs.geoImageTransform.activate();
|
|
145
|
-
var sh = h.programs.geoImageTransform._program;
|
|
146
|
-
var sha = sh.attributes,
|
|
147
|
-
shu = sh.uniforms;
|
|
148
|
-
|
|
149
|
-
gl.disable(gl.CULL_FACE);
|
|
150
|
-
|
|
151
|
-
f.bindOutputTexture(this._materialTexture);
|
|
152
|
-
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
153
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
154
|
-
|
|
155
|
-
gl.uniform1i(shu.isFullExtent, this._isFullExtent);
|
|
156
|
-
|
|
157
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
158
|
-
|
|
159
|
-
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
160
|
-
|
|
161
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBuffer);
|
|
162
|
-
gl.vertexAttribPointer(sha.corners, this._gridBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
163
|
-
gl.uniform4fv(shu.extentParams, this._extentMercParams);
|
|
164
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
165
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
166
|
-
gl.uniform1i(shu.sourceTexture, 0);
|
|
167
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
168
|
-
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
169
|
-
f.deactivate();
|
|
170
|
-
|
|
171
|
-
gl.enable(gl.CULL_FACE);
|
|
172
|
-
|
|
173
|
-
this._ready = true;
|
|
174
|
-
|
|
175
|
-
this._creationProceeding = false;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
_renderingProjType0() {
|
|
179
|
-
var p = this._planet,
|
|
180
|
-
h = p.renderer.handler,
|
|
181
|
-
gl = h.gl,
|
|
182
|
-
creator = p._geoImageCreator;
|
|
183
|
-
|
|
184
|
-
this._refreshFrame && this._createFrame();
|
|
185
|
-
this._createSourceTexture();
|
|
186
|
-
|
|
187
|
-
var f = creator._framebuffer;
|
|
188
|
-
f.setSize(this._frameWidth, this._frameHeight);
|
|
189
|
-
f.activate();
|
|
190
|
-
|
|
191
|
-
h.programs.geoImageTransform.activate();
|
|
192
|
-
var sh = h.programs.geoImageTransform._program;
|
|
193
|
-
var sha = sh.attributes,
|
|
194
|
-
shu = sh.uniforms;
|
|
195
|
-
|
|
196
|
-
gl.disable(gl.CULL_FACE);
|
|
197
|
-
|
|
198
|
-
f.bindOutputTexture(this._materialTexture);
|
|
199
|
-
gl.clearColor(0.0, 0.0, 0.0, 0.0);
|
|
200
|
-
gl.clear(gl.COLOR_BUFFER_BIT);
|
|
201
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, creator._texCoordsBuffer);
|
|
202
|
-
|
|
203
|
-
gl.vertexAttribPointer(sha.texCoords, 2, gl.UNSIGNED_SHORT, true, 0, 0);
|
|
204
|
-
|
|
205
|
-
gl.bindBuffer(gl.ARRAY_BUFFER, this._gridBuffer);
|
|
206
|
-
gl.vertexAttribPointer(sha.corners, this._gridBuffer.itemSize, gl.FLOAT, false, 0, 0);
|
|
207
|
-
gl.uniform4fv(shu.extentParams, this._extentWgs84Params);
|
|
208
|
-
gl.activeTexture(gl.TEXTURE0);
|
|
209
|
-
gl.bindTexture(gl.TEXTURE_2D, this._sourceTexture);
|
|
210
|
-
gl.uniform1i(shu.sourceTexture, 0);
|
|
211
|
-
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, creator._indexBuffer);
|
|
212
|
-
gl.drawElements(gl.TRIANGLE_STRIP, creator._indexBuffer.numItems, gl.UNSIGNED_INT, 0);
|
|
213
|
-
f.deactivate();
|
|
214
|
-
|
|
215
|
-
gl.enable(gl.CULL_FACE);
|
|
216
|
-
|
|
217
|
-
this._ready = true;
|
|
218
|
-
|
|
219
|
-
this._creationProceeding = false;
|
|
220
|
-
}
|
|
221
130
|
}
|
|
222
131
|
|
|
223
132
|
export { GeoImage };
|