@openglobus/og 0.15.4 → 0.15.5

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.
@@ -1,169 +1,153 @@
1
- /**
2
- * @module og/control/KeyboardNavigation
3
- */
4
-
5
- "use strict";
6
-
7
- import { input } from "../input/input.js";
8
- import * as math from "../math.js";
9
- import { Vec3 } from "../math/Vec3.js";
10
- import { Control } from "./Control.js";
11
-
12
- /**
13
- * Planet camera keyboard navigation. Use W,S,A,D and left shift key for fly around a planet.
14
- * @class
15
- * @extends {Control}
16
- * @param {Object} [options] - Control options.
17
- */
18
-
19
- class KeyboardNavigation extends Control {
20
- constructor(options) {
21
- options = options || {};
22
- super(options);
23
- this.step = options.step || 250;
24
- }
25
-
26
- oninit() {
27
- this.renderer.events.on("keypress", input.KEY_PGUP, this.onCameraMoveForward, this);
28
- this.renderer.events.on("keypress", input.KEY_PGDN, this.onCameraMoveBackward, this);
29
- this.renderer.events.on("keypress", input.KEY_PLUS, this.onCameraMoveForward, this);
30
- this.renderer.events.on("keypress", input.KEY_EQUALS, this.onCameraMoveForward, this);
31
- this.renderer.events.on("keypress", input.KEY_MINUS, this.onCameraMoveBackward, this);
32
- this.renderer.events.on("keypress", input.KEY_W, this.onCameraMoveForward, this);
33
- this.renderer.events.on("keypress", input.KEY_S, this.onCameraMoveBackward, this);
34
- this.renderer.events.on("keypress", input.KEY_A, this.onCameraStrifeLeft, this);
35
- this.renderer.events.on("keypress", input.KEY_D, this.onCameraStrifeRight, this);
36
- this.renderer.events.on("keypress", input.KEY_UP, this.onCameraLookUp, this);
37
- this.renderer.events.on("keypress", input.KEY_DOWN, this.onCameraLookDown, this);
38
- this.renderer.events.on("keypress", input.KEY_LEFT, this.onCameraLookLeft, this);
39
- this.renderer.events.on("keypress", input.KEY_RIGHT, this.onCameraLookRight, this);
40
- this.renderer.events.on("keypress", input.KEY_Q, this.onCameraRollLeft, this);
41
- this.renderer.events.on("keypress", input.KEY_E, this.onCameraRollRight, this);
42
- this.renderer.events.on("keypress", input.KEY_N, this.onCameraRollNorth, this);
43
- }
44
-
45
- onCameraMoveForward(event) {
46
- var cam = this.renderer.activeCamera;
47
- cam.slide(0, 0, -cam._lonLat.height / this.step);
48
- cam.checkTerrainCollision();
49
- cam.update();
50
- }
51
-
52
- onCameraMoveBackward(event) {
53
- var cam = this.renderer.activeCamera;
54
- cam.slide(0, 0, cam._lonLat.height / this.step);
55
- cam.checkTerrainCollision();
56
- cam.update();
57
- }
58
-
59
- onCameraStrifeLeft(event) {
60
- var cam = this.renderer.activeCamera;
61
- cam.slide(-cam._lonLat.height / this.step, 0, 0);
62
- cam.checkTerrainCollision();
63
- cam.update();
64
- }
65
-
66
- onCameraStrifeRight(event) {
67
- var cam = this.renderer.activeCamera;
68
- cam.slide(cam._lonLat.height / this.step, 0, 0);
69
- cam.checkTerrainCollision();
70
- cam.update();
71
- }
72
-
73
- onCameraLookUp(event) {
74
- var cam = this.renderer.activeCamera;
75
- if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
76
- cam.pitch(15 / this.renderer.handler.deltaTime);
77
- } else {
78
- cam.rotateVertical((cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
79
- }
80
- cam.update();
81
- }
82
-
83
- onCameraLookDown(event) {
84
- var cam = this.renderer.activeCamera;
85
- if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
86
- cam.pitch(-15 / this.renderer.handler.deltaTime);
87
- } else {
88
- cam.rotateVertical((-cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
89
- }
90
- cam.update();
91
- }
92
-
93
- onCameraLookLeft(event) {
94
- var cam = this.renderer.activeCamera;
95
- if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
96
- cam.roll(15 / this.renderer.handler.deltaTime);
97
- } else {
98
- cam.rotateHorizontal((cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
99
- }
100
- cam.update();
101
- }
102
-
103
- onCameraLookRight(event) {
104
- var cam = this.renderer.activeCamera;
105
- if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
106
- cam.roll(-15 / this.renderer.handler.deltaTime);
107
- } else {
108
- cam.rotateHorizontal((-cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
109
- }
110
- cam.update();
111
- }
112
-
113
- onCameraTurnLeft(event) {
114
- var cam = this.renderer.activeCamera;
115
- if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
116
- cam.yaw(15 / this.renderer.handler.deltaTime);
117
- } else {
118
- cam.rotateHorizontal((cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
119
- }
120
- cam.update();
121
- }
122
-
123
- onCameraTurnRight(event) {
124
- var cam = this.renderer.activeCamera;
125
- if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
126
- cam.yaw(-15 / this.renderer.handler.deltaTime);
127
- } else {
128
- cam.rotateHorizontal((-cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
129
- }
130
- cam.update();
131
- }
132
-
133
- // from CompassButton._onClick()
134
- onCameraRollNorth(event) {
135
- let c = this.planet.getCartesianFromPixelTerrain(this.renderer.handler.getCenter());
136
- if (c) {
137
- this.planet.flyCartesian(
138
- c.normal().scaleTo(c.length() + c.distance(this.planet.camera.eye)),
139
- null,
140
- null,
141
- 0,
142
- null,
143
- null,
144
- () => {
145
- this.planet.camera.look(c);
146
- }
147
- );
148
- } else {
149
- this.planet.flyCartesian(this.planet.camera.eye);
150
- }
151
- }
152
-
153
- onCameraRollLeft(event) {
154
- this.renderer.activeCamera.roll(-15 / this.renderer.handler.deltaTime);
155
- this.renderer.activeCamera.update();
156
- }
157
-
158
- onCameraRollRight(event) {
159
- this.renderer.activeCamera.roll(15 / this.renderer.handler.deltaTime);
160
- this.renderer.activeCamera.update();
161
- }
162
- }
163
-
164
- export function keyboardNavigation(options) {
165
- return new KeyboardNavigation(options);
166
- }
167
-
168
- export { KeyboardNavigation };
169
-
1
+ /**
2
+ * @module og/control/KeyboardNavigation
3
+ */
4
+
5
+ "use strict";
6
+
7
+ import { input } from "../input/input.js";
8
+ import * as math from "../math.js";
9
+ import { Vec3 } from "../math/Vec3.js";
10
+ import { Control } from "./Control.js";
11
+
12
+ /**
13
+ * Planet camera keyboard navigation. Use W,S,A,D and left shift key for fly around a planet.
14
+ * @class
15
+ * @extends {Control}
16
+ * @param {Object} [options] - Control options.
17
+ */
18
+
19
+ class KeyboardNavigation extends Control {
20
+ constructor(options) {
21
+ options = options || {};
22
+ super(options);
23
+ this.step = options.step || 250;
24
+ }
25
+
26
+ oninit() {
27
+ this.renderer.events.on("keypress", input.KEY_PGUP, this.onCameraMoveForward, this);
28
+ this.renderer.events.on("keypress", input.KEY_PGDN, this.onCameraMoveBackward, this);
29
+ this.renderer.events.on("keypress", input.KEY_PLUS, this.onCameraMoveForward, this);
30
+ this.renderer.events.on("keypress", input.KEY_EQUALS, this.onCameraMoveForward, this);
31
+ this.renderer.events.on("keypress", input.KEY_MINUS, this.onCameraMoveBackward, this);
32
+ this.renderer.events.on("keypress", input.KEY_W, this.onCameraMoveForward, this);
33
+ this.renderer.events.on("keypress", input.KEY_S, this.onCameraMoveBackward, this);
34
+ this.renderer.events.on("keypress", input.KEY_A, this.onCameraStrifeLeft, this);
35
+ this.renderer.events.on("keypress", input.KEY_D, this.onCameraStrifeRight, this);
36
+ this.renderer.events.on("keypress", input.KEY_UP, this.onCameraLookUp, this);
37
+ this.renderer.events.on("keypress", input.KEY_DOWN, this.onCameraLookDown, this);
38
+ this.renderer.events.on("keypress", input.KEY_LEFT, this.onCameraLookLeft, this);
39
+ this.renderer.events.on("keypress", input.KEY_RIGHT, this.onCameraLookRight, this);
40
+ this.renderer.events.on("keypress", input.KEY_Q, this.onCameraRollLeft, this);
41
+ this.renderer.events.on("keypress", input.KEY_E, this.onCameraRollRight, this);
42
+ this.renderer.events.on("keypress", input.KEY_N, this.onCameraRollNorth, this);
43
+ }
44
+
45
+ onCameraMoveForward(event) {
46
+ var cam = this.renderer.activeCamera;
47
+ cam.slide(0, 0, -cam._lonLat.height / this.step);
48
+ }
49
+
50
+ onCameraMoveBackward(event) {
51
+ var cam = this.renderer.activeCamera;
52
+ cam.slide(0, 0, cam._lonLat.height / this.step);
53
+ }
54
+
55
+ onCameraStrifeLeft(event) {
56
+ var cam = this.renderer.activeCamera;
57
+ cam.slide(-cam._lonLat.height / this.step, 0, 0);
58
+ }
59
+
60
+ onCameraStrifeRight(event) {
61
+ var cam = this.renderer.activeCamera;
62
+ cam.slide(cam._lonLat.height / this.step, 0, 0);
63
+ }
64
+
65
+ onCameraLookUp(event) {
66
+ var cam = this.renderer.activeCamera;
67
+ if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
68
+ cam.pitch(15 / this.renderer.handler.deltaTime);
69
+ } else {
70
+ cam.rotateVertical((cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
71
+ }
72
+ }
73
+
74
+ onCameraLookDown(event) {
75
+ var cam = this.renderer.activeCamera;
76
+ if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
77
+ cam.pitch(-15 / this.renderer.handler.deltaTime);
78
+ } else {
79
+ cam.rotateVertical((-cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
80
+ }
81
+ }
82
+
83
+ onCameraLookLeft(event) {
84
+ var cam = this.renderer.activeCamera;
85
+ if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
86
+ cam.roll(15 / this.renderer.handler.deltaTime);
87
+ } else {
88
+ cam.rotateHorizontal((cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
89
+ }
90
+ }
91
+
92
+ onCameraLookRight(event) {
93
+ var cam = this.renderer.activeCamera;
94
+ if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
95
+ cam.roll(-15 / this.renderer.handler.deltaTime);
96
+ } else {
97
+ cam.rotateHorizontal((-cam._lonLat.height / 3000000) * math.RADIANS, Vec3.ZERO);
98
+ }
99
+ }
100
+
101
+ onCameraTurnLeft(event) {
102
+ var cam = this.renderer.activeCamera;
103
+ if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
104
+ cam.yaw(15 / this.renderer.handler.deltaTime);
105
+ } else {
106
+ cam.rotateHorizontal((cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
107
+ }
108
+ }
109
+
110
+ onCameraTurnRight(event) {
111
+ var cam = this.renderer.activeCamera;
112
+ if (this.renderer.events.isKeyPressed(input.KEY_SHIFT)) {
113
+ cam.yaw(-15 / this.renderer.handler.deltaTime);
114
+ } else {
115
+ cam.rotateHorizontal((-cam._lonLat.height / 3000000) * math.RADIANS, false, Vec3.ZERO);
116
+ }
117
+ }
118
+
119
+ // from CompassButton._onClick()
120
+ onCameraRollNorth(event) {
121
+ let c = this.planet.getCartesianFromPixelTerrain(this.renderer.handler.getCenter());
122
+ if (c) {
123
+ this.planet.flyCartesian(
124
+ c.normal().scaleTo(c.length() + c.distance(this.planet.camera.eye)),
125
+ null,
126
+ null,
127
+ 0,
128
+ null,
129
+ null,
130
+ () => {
131
+ this.planet.camera.look(c);
132
+ }
133
+ );
134
+ } else {
135
+ this.planet.flyCartesian(this.planet.camera.eye);
136
+ }
137
+ }
138
+
139
+ onCameraRollLeft(event) {
140
+ this.renderer.activeCamera.roll(-15 / this.renderer.handler.deltaTime);
141
+ }
142
+
143
+ onCameraRollRight(event) {
144
+ this.renderer.activeCamera.roll(15 / this.renderer.handler.deltaTime);
145
+ }
146
+ }
147
+
148
+ export function keyboardNavigation(options) {
149
+ return new KeyboardNavigation(options);
150
+ }
151
+
152
+ export { KeyboardNavigation };
153
+
@@ -319,10 +319,6 @@ class MouseNavigation extends Control {
319
319
  cam._u = rot.mulVec3(cam._u);
320
320
  cam._r = rot.mulVec3(cam._r);
321
321
  cam._b = rot.mulVec3(cam._b);
322
-
323
- cam.checkTerrainCollision();
324
-
325
- cam.update();
326
322
  }
327
323
  } else {
328
324
  var p0 = this.grabbedPoint,
@@ -332,10 +328,6 @@ class MouseNavigation extends Control {
332
328
  var px = new Vec3();
333
329
  if (new Ray(cam.eye, e.direction).hitPlane(p0, p1, p2, px) === Ray.INSIDE) {
334
330
  cam.eye = this._eye0.addA(px.subA(p0).negate());
335
-
336
- cam.checkTerrainCollision();
337
-
338
- cam.update();
339
331
  }
340
332
  }
341
333
  }
@@ -361,10 +353,6 @@ class MouseNavigation extends Control {
361
353
  cam.rotateHorizontal(l * (e.x - e.prev_x), false, this.pointOnEarth, this.earthUp);
362
354
 
363
355
  cam.rotateVertical(l * (e.y - e.prev_y), this.pointOnEarth, this.minSlope);
364
-
365
- cam.checkTerrainCollision();
366
-
367
- cam.update();
368
356
  }
369
357
  }
370
358
 
@@ -405,10 +393,6 @@ class MouseNavigation extends Control {
405
393
  cam._u = sf.v;
406
394
  cam._r = sf.u;
407
395
  cam._b = sf.n;
408
-
409
- cam.checkTerrainCollision();
410
-
411
- cam.update();
412
396
  } else {
413
397
  if (this._deactivate) {
414
398
  this._deactivate = false;
@@ -438,10 +422,6 @@ class MouseNavigation extends Control {
438
422
  cam._u = rot.mulVec3(cam._u);
439
423
  cam._r = rot.mulVec3(cam._r);
440
424
  cam._b = rot.mulVec3(cam._b);
441
-
442
- cam.checkTerrainCollision();
443
-
444
- cam.update();
445
425
  }
446
426
 
447
427
  if (cam.eye.distance(prevEye) / cam._terrainAltitude > 0.01) {
@@ -35,7 +35,7 @@ class SimpleNavigation extends Control {
35
35
  if (this._active) {
36
36
  var camera = this.camera;
37
37
  camera.slide(0, 0, -this.speed);
38
- camera.update();
38
+ //camera.update();
39
39
  }
40
40
  }
41
41
 
@@ -43,7 +43,7 @@ class SimpleNavigation extends Control {
43
43
  if (this._active) {
44
44
  var camera = this.camera;
45
45
  camera.slide(0, 0, this.speed);
46
- camera.update();
46
+ //camera.update();
47
47
  }
48
48
  }
49
49
 
@@ -51,7 +51,7 @@ class SimpleNavigation extends Control {
51
51
  if (this._active) {
52
52
  var camera = this.camera;
53
53
  camera.slide(-this.speed, 0, 0);
54
- camera.update();
54
+ //camera.update();
55
55
  }
56
56
  }
57
57
 
@@ -59,7 +59,7 @@ class SimpleNavigation extends Control {
59
59
  if (this._active) {
60
60
  var camera = this.camera;
61
61
  camera.slide(this.speed, 0, 0);
62
- camera.update();
62
+ //camera.update();
63
63
  }
64
64
  }
65
65
 
@@ -67,7 +67,7 @@ class SimpleNavigation extends Control {
67
67
  if (this._active) {
68
68
  var cam = this.camera;
69
69
  cam.pitch(0.5);
70
- cam.update();
70
+ //cam.update();
71
71
  }
72
72
  }
73
73
 
@@ -75,7 +75,7 @@ class SimpleNavigation extends Control {
75
75
  if (this._active) {
76
76
  var cam = this.camera;
77
77
  cam.pitch(-0.5);
78
- cam.update();
78
+ //cam.update();
79
79
  }
80
80
  }
81
81
 
@@ -83,7 +83,7 @@ class SimpleNavigation extends Control {
83
83
  if (this._active) {
84
84
  var cam = this.camera;
85
85
  cam.yaw(0.5);
86
- cam.update();
86
+ //cam.update();
87
87
  }
88
88
  }
89
89
 
@@ -91,7 +91,7 @@ class SimpleNavigation extends Control {
91
91
  if (this._active) {
92
92
  var cam = this.camera;
93
93
  cam.yaw(-0.5);
94
- cam.update();
94
+ //cam.update();
95
95
  }
96
96
  }
97
97
 
@@ -99,7 +99,7 @@ class SimpleNavigation extends Control {
99
99
  if (this._active) {
100
100
  var cam = this.camera;
101
101
  cam.roll(-0.5);
102
- cam.update();
102
+ //cam.update();
103
103
  }
104
104
  }
105
105
 
@@ -107,7 +107,7 @@ class SimpleNavigation extends Control {
107
107
  if (this._active) {
108
108
  var cam = this.camera;
109
109
  cam.roll(0.5);
110
- cam.update();
110
+ //cam.update();
111
111
  }
112
112
  }
113
113
  }
@@ -409,19 +409,36 @@ class Ellipsoid {
409
409
  return new Vec3(pX * m_X, pY * m_Y, pZ * m_Z);
410
410
  }
411
411
 
412
+ /**
413
+ * Converts 3d cartesian coordinates to geodetic
414
+ * @param {Vec3} cart - Cartesian coordiantes
415
+ * @returns {LonLat} - Geodetic coordinates
416
+ */
412
417
  cartesianToLonLat(cart) {
413
-
414
418
  let p = this.projToSurface(cart);
415
-
416
419
  let n = this.getSurfaceNormal3v(p),
417
420
  h = cart.sub(p);
418
-
419
421
  return new LonLat(
420
422
  Math.atan2(n.x, n.z) * DEGREES,
421
423
  Math.asin(n.y) * DEGREES,
422
424
  Math.sign(h.dot(cart)) * h.length()
423
425
  );
424
426
  }
427
+ /**
428
+ * Converts 3d cartesian coordinates to geodetic
429
+ * @param {Vec3} cart - Cartesian coordiantes
430
+ * @param {LonLat} res - Link geodetic coordinates variable
431
+ * @returns {LonLat} - Geodetic coordinates
432
+ */
433
+ cartesianToLonLatRes(cart, res) {
434
+ let p = this.projToSurface(cart);
435
+ let n = this.getSurfaceNormal3v(p),
436
+ h = cart.sub(p);
437
+ res.lon = Math.atan2(n.x, n.z) * DEGREES;
438
+ res.lat = Math.asin(n.y) * DEGREES;
439
+ res.height = Math.sign(h.dot(cart)) * h.length();
440
+ return res;
441
+ }
425
442
 
426
443
  /**
427
444
  * Gets ellipsoid surface normal.
@@ -757,12 +757,13 @@ class Vector extends Layer {
757
757
  if (seg._extent.isInside(ll)) {
758
758
  let cart = p._path3v[c_j][c_j_h];
759
759
  seg.getTerrainPoint(cart, ll, res);
760
- p.setPoint3v(
761
- res.addA(res.normal().scale((rtg && p.altitude) || 0.0)),
762
- c_j_h,
763
- c_j,
764
- true
765
- );
760
+ let alt = (rtg && p.altitude) || 0.0;
761
+ if (alt) {
762
+ let n = this._planet.ellipsoid.getSurfaceNormal3v(res);
763
+ p.setPoint3v(res.addA(n.scale(alt)), c_j_h, c_j, true);
764
+ } else {
765
+ p.setPoint3v(res, c_j_h, c_j, true);
766
+ }
766
767
  break;
767
768
  }
768
769
  }
@@ -44,7 +44,7 @@ class XYZ extends Layer {
44
44
  * @param {string} name - Layer name.
45
45
  * @param {*} options
46
46
  */
47
- constructor(name, options) {
47
+ constructor(name, options = {}) {
48
48
  super(name, options);
49
49
 
50
50
  this.events.registerNames(EVENT_NAMES);
@@ -316,7 +316,7 @@ class XYZ extends Layer {
316
316
  clearMaterial(material) {
317
317
  if (material.isReady && material.textureExists) {
318
318
  !material.texture.default &&
319
- material.segment.handler.gl.deleteTexture(material.texture);
319
+ material.segment.handler.gl.deleteTexture(material.texture);
320
320
  material.texture = null;
321
321
 
322
322
  if (material.image) {
@@ -282,9 +282,15 @@ class EntityCollectionNode {
282
282
  }
283
283
 
284
284
  alignEntityToTheGround(entity, segment) {
285
- var res = new Vec3();
285
+ let res = new Vec3();
286
286
  segment.getEntityTerrainPoint(entity, res);
287
- entity._setCartesian3vSilent(res.addA(res.normal().scale((Number(this.layer.relativeToGround) && entity._altitude) || 0.0)));
287
+ let alt = (Number(this.layer.relativeToGround) && entity._altitude) || 0.0;
288
+ if (alt) {
289
+ let n = this.layer._planet.ellipsoid.getSurfaceNormal3v(res);
290
+ entity._setCartesian3vSilent(res.addA(n.scale(alt)));
291
+ } else {
292
+ entity._setCartesian3vSilent(res);
293
+ }
288
294
  }
289
295
 
290
296
  isVisible() {
@@ -783,6 +783,7 @@ class Renderer {
783
783
  // Rendering scene nodes and entityCollections
784
784
  let rn = this._renderNodesArr;
785
785
  let k = frustums.length;
786
+
786
787
  while (k--) {
787
788
  this.activeCamera.setCurrentFrustum(k);
788
789
  gl.clear(gl.DEPTH_BUFFER_BIT);
@@ -1142,7 +1142,14 @@ export class Planet extends RenderNode {
1142
1142
  }
1143
1143
 
1144
1144
  if (this.camera.isFirstPass) {
1145
+ this.camera.updateGeodeticPosition();
1145
1146
  this._firstPASS();
1147
+ this.camera.checkTerrainCollision();
1148
+ this.camera.update();
1149
+
1150
+ // Here is the planet node dispatches a draw event before
1151
+ // rendering begins and we have got render nodes.
1152
+ this.events.dispatch(this.events.draw, this);
1146
1153
  }
1147
1154
 
1148
1155
  this.drawEntityCollections(this._frustumEntityCollections);
@@ -1196,10 +1203,6 @@ export class Planet extends RenderNode {
1196
1203
  }
1197
1204
  this._skipPreRender = true;
1198
1205
 
1199
- // Here is the planet node dispatches a draw event before
1200
- // rendering begins and we have got render nodes.
1201
- this.events.dispatch(this.events.draw, this);
1202
-
1203
1206
  this.transformLights();
1204
1207
 
1205
1208
  this._normalMapCreator.frame();
@@ -1546,7 +1549,8 @@ export class Planet extends RenderNode {
1546
1549
  gl.uniform3fv(shu.frustumPickingColor, cam.frustum._pickingColorU);
1547
1550
 
1548
1551
  // drawing planet nodes
1549
- var rn = this._renderedNodesInFrustum[cam.getCurrentFrustum()], sl = this._visibleTileLayerSlices;
1552
+ let rn = this._renderedNodesInFrustum[cam.getCurrentFrustum()],
1553
+ sl = this._visibleTileLayerSlices;
1550
1554
 
1551
1555
  let i = rn.length;
1552
1556
  while (i--) {