@openglobus/og 0.20.2 → 0.20.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.
Files changed (57) hide show
  1. package/README.md +1 -1
  2. package/css/og.css +55 -23
  3. package/lib/@openglobus/js/Globe.d.ts +3 -0
  4. package/lib/@openglobus/js/control/Atmosphere.d.ts +27 -3
  5. package/lib/@openglobus/js/control/AtmosphereConfig.d.ts +59 -0
  6. package/lib/@openglobus/js/control/index.d.ts +29 -29
  7. package/lib/@openglobus/js/entity/EntityCollection.d.ts +4 -0
  8. package/lib/@openglobus/js/entity/GeoObject.d.ts +7 -3
  9. package/lib/@openglobus/js/entity/GeoObjectHandler.d.ts +5 -8
  10. package/lib/@openglobus/js/layer/Vector.d.ts +5 -0
  11. package/lib/@openglobus/js/math/Quat.d.ts +1 -0
  12. package/lib/@openglobus/js/scene/Planet.d.ts +6 -0
  13. package/lib/@openglobus/js/shaders/atmos.d.ts +19 -3
  14. package/lib/@openglobus/js/shaders/drawnode.d.ts +2 -1
  15. package/lib/@openglobus/js/terrain/GlobusTerrain.d.ts +2 -0
  16. package/lib/@openglobus/js/webgl/Handler.d.ts +3 -1
  17. package/lib/@openglobus/og.css +1 -1
  18. package/lib/@openglobus/og.esm.js +1 -1
  19. package/lib/@openglobus/og.esm.js.map +1 -1
  20. package/lib/@openglobus/og.umd.js +1 -1
  21. package/lib/@openglobus/og.umd.js.map +1 -1
  22. package/lib/js/Globe.d.ts +3 -0
  23. package/lib/js/Globe.js +4 -1
  24. package/lib/js/control/Atmosphere.d.ts +27 -3
  25. package/lib/js/control/Atmosphere.js +109 -43
  26. package/lib/js/control/AtmosphereConfig.d.ts +59 -0
  27. package/lib/js/control/AtmosphereConfig.js +348 -0
  28. package/lib/js/control/DebugInfo.js +5 -4
  29. package/lib/js/control/Lighting.js +13 -5
  30. package/lib/js/control/index.d.ts +29 -29
  31. package/lib/js/control/index.js +29 -29
  32. package/lib/js/entity/EntityCollection.d.ts +4 -0
  33. package/lib/js/entity/EntityCollection.js +7 -0
  34. package/lib/js/entity/GeoObject.d.ts +7 -3
  35. package/lib/js/entity/GeoObject.js +31 -16
  36. package/lib/js/entity/GeoObjectHandler.d.ts +5 -8
  37. package/lib/js/entity/GeoObjectHandler.js +34 -63
  38. package/lib/js/layer/Layer.js +2 -2
  39. package/lib/js/layer/Vector.d.ts +5 -0
  40. package/lib/js/layer/Vector.js +16 -1
  41. package/lib/js/math/Quat.d.ts +1 -0
  42. package/lib/js/math/Quat.js +4 -0
  43. package/lib/js/renderer/RendererEvents.js +1 -3
  44. package/lib/js/scene/Planet.d.ts +6 -0
  45. package/lib/js/scene/Planet.js +25 -11
  46. package/lib/js/shaders/atmos.d.ts +19 -3
  47. package/lib/js/shaders/atmos.js +40 -26
  48. package/lib/js/shaders/drawnode.d.ts +2 -1
  49. package/lib/js/shaders/drawnode.js +15 -12
  50. package/lib/js/shaders/geoObject.js +22 -71
  51. package/lib/js/terrain/GlobusRgbTerrain.js +2 -2
  52. package/lib/js/terrain/GlobusTerrain.d.ts +2 -0
  53. package/lib/js/terrain/GlobusTerrain.js +2 -0
  54. package/lib/js/ui/Slider.js +3 -3
  55. package/lib/js/webgl/Handler.d.ts +3 -1
  56. package/lib/js/webgl/Handler.js +38 -28
  57. package/package.json +1 -1
@@ -0,0 +1,348 @@
1
+ import { Control } from "./Control";
2
+ import { Dialog } from '../ui/Dialog';
3
+ import { Slider } from "../ui/Slider";
4
+ import { ToggleButton } from "../ui/ToggleButton";
5
+ import { View } from '../ui/View';
6
+ const TEMPLATE = `<div class="og-atmosphere og-options-container">
7
+
8
+ <div class="og-option og-atmosphere-maxOpacity"></div>
9
+ <div class="og-option og-atmosphere-minOpacity"></div>
10
+
11
+ <div class="og-emptyline-2"></div>
12
+
13
+ <div class="og-option og-atmosphere-rayleight"></div>
14
+ <div class="og-option og-atmosphere-mie"></div>
15
+
16
+ <div class="og-emptyline-2"></div>
17
+
18
+ <div class="og-option og-atmosphere-height"></div>
19
+ <div class="og-option og-atmosphere-bottomRadius"></div>
20
+
21
+ <div class="og-emptyline-2"></div>
22
+
23
+ <div class="og-option og-atmosphere-mieScatteringCoefficient"></div>
24
+ <div class="og-option og-atmosphere-mieExtinctionCoefficient"></div>
25
+
26
+ <div class="og-emptyline-2"></div>
27
+
28
+ <div class="og-option og-atmosphere-rayleighScatteringCoefficientA"></div>
29
+ <div class="og-option og-atmosphere-rayleighScatteringCoefficientB"></div>
30
+ <div class="og-option og-atmosphere-rayleighScatteringCoefficientC"></div>
31
+
32
+ <div class="og-emptyline-2"></div>
33
+
34
+ <div class="og-option og-atmosphere-ozoneAbsorptionCoefficientA"></div>
35
+ <div class="og-option og-atmosphere-ozoneAbsorptionCoefficientB"></div>
36
+ <div class="og-option og-atmosphere-ozoneAbsorptionCoefficientC"></div>
37
+
38
+ <div class="og-emptyline-2"></div>
39
+
40
+ <div class="og-option og-atmosphere-ozoneDensityHeight"></div>
41
+ <div class="og-option og-atmosphere-ozoneDensityWide"></div>
42
+
43
+ <div class="og-emptyline-2"></div>
44
+
45
+ <div class="og-option og-atmosphere-sunAngularRadius"></div>
46
+ <div class="og-option og-atmosphere-sunIntensity"></div>
47
+ <div class="og-option og-atmosphere-earthAlbedo"></div>
48
+
49
+ </div>`;
50
+ const ICON_BUTTON_SVG = `<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
51
+ <svg width="800px" height="800px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#000000" d="M135.688 18.5c-6.798 74.842-23.842 85.39-107.907 59.656 84.85 52.022 73.57 64.954-6.843 96.938 87.743-10.27 103.29 4.89 70.75 87.594 17.805-27.56 32.5-44.498 46.282-54.47-11.813 28.26-18.345 59.274-18.345 91.813 0 84.184 43.71 157.96 109.656 200.376-41.624-43.834-67.686-102.7-67.686-167.875 0-134.923 109.45-244.405 244.375-244.405 30.92 0 60.76 5.762 88 16.25-38.584-26.87-85.517-42.625-136.064-42.625-55.257 0-106.14 18.802-146.562 50.375 4.627-18.783 17.39-38.073 41.03-60.906C190.18 90.942 153.53 95.634 135.69 18.5zm10.03 77.188c5.67.002 11.428 1.247 16.876 3.874 14.506 6.998 22.72 21.81 22 36.938-10.26 10.87-19.507 22.696-27.594 35.344-9.035 2.753-19.075 2.27-28.25-2.156-19.37-9.343-27.5-32.6-18.156-51.97 6.715-13.92 20.638-22.036 35.125-22.03z"/></svg>`;
52
+ /**
53
+ * Helps to set up atmosphere parameters.
54
+ */
55
+ export class AtmosphereConfig extends Control {
56
+ constructor(options = {}) {
57
+ super(options);
58
+ this.$maxOpacity = null;
59
+ this.$minOpacity = null;
60
+ this.$rayleight = null;
61
+ this.$mie = null;
62
+ this.$height = null;
63
+ this.$bottomRadius = null;
64
+ this.$mieScatteringCoefficient = null;
65
+ this.$mieExtinctionCoefficient = null;
66
+ this.$rayleighScatteringCoefficientA = null;
67
+ this.$rayleighScatteringCoefficientB = null;
68
+ this.$rayleighScatteringCoefficientC = null;
69
+ this.$ozoneAbsorptionCoefficientA = null;
70
+ this.$ozoneAbsorptionCoefficientB = null;
71
+ this.$ozoneAbsorptionCoefficientC = null;
72
+ this.$sunAngularRadius = null;
73
+ this.$sunIntensity = null;
74
+ this.$groundAlbedo = null;
75
+ this.$ozoneDensityHeight = null;
76
+ this.$ozoneDensityWide = null;
77
+ this._toggleBtn = new ToggleButton({
78
+ classList: ["og-map-button", "og-atmosphere_button"],
79
+ icon: ICON_BUTTON_SVG
80
+ });
81
+ this._dialog = new Dialog({
82
+ title: "Atmosphere Parameters",
83
+ visible: false,
84
+ useHide: true,
85
+ top: 60,
86
+ left: 60,
87
+ width: 720
88
+ });
89
+ this._dialog.events.on("visibility", (v) => {
90
+ this._toggleBtn.setActive(v);
91
+ });
92
+ this._panel = new View({
93
+ template: TEMPLATE
94
+ });
95
+ this._maxOpacity = new Slider({
96
+ label: "Max.opacity",
97
+ max: 5
98
+ });
99
+ this._minOpacity = new Slider({
100
+ label: "Min.opacity",
101
+ max: 5
102
+ });
103
+ this._rayleight = new Slider({
104
+ label: "Rayleight Scale",
105
+ min: -10.0,
106
+ max: 10.0
107
+ });
108
+ this._mie = new Slider({
109
+ label: "Mie Scale",
110
+ min: -10.0,
111
+ max: 10.0
112
+ });
113
+ this._height = new Slider({
114
+ label: "Height",
115
+ max: 1000000.0
116
+ });
117
+ this._bottomRadius = new Slider({
118
+ label: "Planet Radius",
119
+ max: 5 * 6356752.3142451793
120
+ });
121
+ this._mieScatteringCoefficient = new Slider({
122
+ label: "Mie Scattering Coefficient e-6",
123
+ min: -10 * 3.996,
124
+ max: 10 * 3.996
125
+ });
126
+ this._mieExtinctionCoefficient = new Slider({
127
+ label: "Mie Extinction Coef.e-6",
128
+ min: -10 * 4.440,
129
+ max: 10 * 4.440
130
+ });
131
+ this._rayleighScatteringCoefficientA = new Slider({
132
+ label: "Rayleight Scattering Coef A.e-6",
133
+ min: -10 * 5.802,
134
+ max: 10 * 5.802
135
+ });
136
+ this._rayleighScatteringCoefficientB = new Slider({
137
+ label: "Rayleight Scattering Coef B.e-6",
138
+ min: -10 * 13.558,
139
+ max: 10 * 13.558
140
+ });
141
+ this._rayleighScatteringCoefficientC = new Slider({
142
+ label: "Rayleight Scattering Coef C.e-6",
143
+ min: -10 * 33.100,
144
+ max: 10 * 33.100
145
+ });
146
+ this._ozoneAbsorptionCoefficientA = new Slider({
147
+ label: "Ozone absorbtion Coef A.e-6",
148
+ min: -10 * 0.650,
149
+ max: 10 * 0.650
150
+ });
151
+ this._ozoneAbsorptionCoefficientB = new Slider({
152
+ label: "Ozone absorbtion Coef B.e-6",
153
+ min: -10 * 0.650,
154
+ max: 10 * 1.881
155
+ });
156
+ this._ozoneAbsorptionCoefficientC = new Slider({
157
+ label: "Ozone absorbtion Coef C.e-6",
158
+ min: -10 * 0.085,
159
+ max: 10 * 0.085
160
+ });
161
+ this._ozoneDensityHeight = new Slider({
162
+ label: "Ozone Density Height",
163
+ max: 100 * 25000
164
+ });
165
+ this._ozoneDensityWide = new Slider({
166
+ label: "Ozone Density Wide",
167
+ max: 100 * 25000
168
+ });
169
+ this._sunAngularRadius = new Slider({
170
+ label: "Sun Angular Radius",
171
+ max: 1000 * 0.004685
172
+ });
173
+ this._sunIntensity = new Slider({
174
+ label: "Sun Intensity",
175
+ max: 10 * 1.0
176
+ });
177
+ this._groundAlbedo = new Slider({
178
+ label: "Earth Albedo",
179
+ max: 10 * 0.05
180
+ });
181
+ this._parameters = {
182
+ ATMOS_HEIGHT: 0,
183
+ RAYLEIGH_SCALE: 0,
184
+ MIE_SCALE: 0,
185
+ GROUND_ALBEDO: 0,
186
+ BOTTOM_RADIUS: 0,
187
+ rayleighScatteringCoefficient: [0, 0, 0],
188
+ mieScatteringCoefficient: 0,
189
+ mieExtinctionCoefficient: 0,
190
+ ozoneAbsorptionCoefficient: [0, 0, 0],
191
+ SUN_ANGULAR_RADIUS: 0,
192
+ SUN_INTENSITY: 0,
193
+ ozoneDensityHeight: 0,
194
+ ozoneDensityWide: 0,
195
+ };
196
+ }
197
+ oninit() {
198
+ this._toggleBtn.appendTo(this.renderer.div);
199
+ this._dialog.appendTo(this.renderer.div);
200
+ this._panel.appendTo(this._dialog.container);
201
+ if (this._panel.el) {
202
+ this.$height = this._panel.el.querySelector(".og-option.og-atmosphere-height");
203
+ this.$maxOpacity = this._panel.el.querySelector(".og-option.og-atmosphere-maxOpacity");
204
+ this.$minOpacity = this._panel.el.querySelector(".og-option.og-atmosphere-minOpacity");
205
+ this.$rayleight = this._panel.el.querySelector(".og-option.og-atmosphere-rayleight");
206
+ this.$mie = this._panel.el.querySelector(".og-option.og-atmosphere-mie");
207
+ this.$bottomRadius = this._panel.el.querySelector(".og-option.og-atmosphere-bottomRadius");
208
+ this.$mieScatteringCoefficient = this._panel.el.querySelector(".og-option.og-atmosphere-mieScatteringCoefficient");
209
+ this.$mieExtinctionCoefficient = this._panel.el.querySelector(".og-option.og-atmosphere-mieExtinctionCoefficient");
210
+ this.$rayleighScatteringCoefficientA = this._panel.el.querySelector(".og-option.og-atmosphere-rayleighScatteringCoefficientA");
211
+ this.$rayleighScatteringCoefficientB = this._panel.el.querySelector(".og-option.og-atmosphere-rayleighScatteringCoefficientB");
212
+ this.$rayleighScatteringCoefficientC = this._panel.el.querySelector(".og-option.og-atmosphere-rayleighScatteringCoefficientC");
213
+ this.$ozoneAbsorptionCoefficientA = this._panel.el.querySelector(".og-option.og-atmosphere-ozoneAbsorptionCoefficientA");
214
+ this.$ozoneAbsorptionCoefficientB = this._panel.el.querySelector(".og-option.og-atmosphere-ozoneAbsorptionCoefficientB");
215
+ this.$ozoneAbsorptionCoefficientC = this._panel.el.querySelector(".og-option.og-atmosphere-ozoneAbsorptionCoefficientC");
216
+ this.$sunAngularRadius = this._panel.el.querySelector(".og-option.og-atmosphere-sunAngularRadius");
217
+ this.$sunIntensity = this._panel.el.querySelector(".og-option.og-atmosphere-sunIntensity");
218
+ this.$groundAlbedo = this._panel.el.querySelector(".og-option.og-atmosphere-earthAlbedo");
219
+ this.$ozoneDensityHeight = this._panel.el.querySelector(".og-option.og-atmosphere-ozoneDensityHeight");
220
+ this.$ozoneDensityWide = this._panel.el.querySelector(".og-option.og-atmosphere-ozoneDensityWide");
221
+ }
222
+ this._toggleBtn.events.on("change", (isActive) => {
223
+ this._dialog.setVisibility(isActive);
224
+ });
225
+ this._maxOpacity.appendTo(this.$maxOpacity);
226
+ this._minOpacity.appendTo(this.$minOpacity);
227
+ this._height.appendTo(this.$height);
228
+ this._rayleight.appendTo(this.$rayleight);
229
+ this._mie.appendTo(this.$mie);
230
+ this._bottomRadius.appendTo(this.$bottomRadius);
231
+ this._mieScatteringCoefficient.appendTo(this.$mieScatteringCoefficient);
232
+ this._mieExtinctionCoefficient.appendTo(this.$mieExtinctionCoefficient);
233
+ this._rayleighScatteringCoefficientA.appendTo(this.$rayleighScatteringCoefficientA);
234
+ this._rayleighScatteringCoefficientB.appendTo(this.$rayleighScatteringCoefficientB);
235
+ this._rayleighScatteringCoefficientC.appendTo(this.$rayleighScatteringCoefficientC);
236
+ this._ozoneAbsorptionCoefficientA.appendTo(this.$ozoneAbsorptionCoefficientA);
237
+ this._ozoneAbsorptionCoefficientB.appendTo(this.$ozoneAbsorptionCoefficientB);
238
+ this._ozoneAbsorptionCoefficientC.appendTo(this.$ozoneAbsorptionCoefficientC);
239
+ this._sunAngularRadius.appendTo(this.$sunAngularRadius);
240
+ this._sunIntensity.appendTo(this.$sunIntensity);
241
+ this._groundAlbedo.appendTo(this.$groundAlbedo);
242
+ this._ozoneDensityHeight.appendTo(this.$ozoneDensityHeight);
243
+ this._ozoneDensityWide.appendTo(this.$ozoneDensityWide);
244
+ if (this.planet) {
245
+ this._parameters = this.planet.atmosphereControl.parameters;
246
+ this._height.value = this._parameters.ATMOS_HEIGHT;
247
+ this._rayleight.value = this._parameters.RAYLEIGH_SCALE;
248
+ this._mie.value = this._parameters.MIE_SCALE;
249
+ this._bottomRadius.value = this._parameters.BOTTOM_RADIUS;
250
+ this._mieScatteringCoefficient.value = this._parameters.mieScatteringCoefficient;
251
+ this._mieExtinctionCoefficient.value = this._parameters.mieExtinctionCoefficient;
252
+ this._rayleighScatteringCoefficientA.value = this._parameters.rayleighScatteringCoefficient[0];
253
+ this._rayleighScatteringCoefficientB.value = this._parameters.rayleighScatteringCoefficient[1];
254
+ this._rayleighScatteringCoefficientC.value = this._parameters.rayleighScatteringCoefficient[2];
255
+ this._ozoneAbsorptionCoefficientA.value = this._parameters.ozoneAbsorptionCoefficient[0];
256
+ this._ozoneAbsorptionCoefficientB.value = this._parameters.ozoneAbsorptionCoefficient[1];
257
+ this._ozoneAbsorptionCoefficientC.value = this._parameters.ozoneAbsorptionCoefficient[2];
258
+ this._sunAngularRadius.value = this._parameters.SUN_ANGULAR_RADIUS;
259
+ this._sunIntensity.value = this._parameters.SUN_INTENSITY;
260
+ this._groundAlbedo.value = this._parameters.GROUND_ALBEDO;
261
+ this._ozoneDensityHeight.value = this._parameters.ozoneDensityHeight;
262
+ this._ozoneDensityWide.value = this._parameters.ozoneDensityWide;
263
+ }
264
+ this._minOpacity.value = this.planet.atmosphereMinOpacity;
265
+ this._minOpacity.events.on("change", (val) => {
266
+ this.planet.atmosphereMinOpacity = val;
267
+ });
268
+ this._maxOpacity.value = this.planet.atmosphereMaxOpacity;
269
+ this._maxOpacity.events.on("change", (val) => {
270
+ this.planet.atmosphereMaxOpacity = val;
271
+ //let atmos = this.planet!.renderer!.controls.Atmosphere as Atmosphere;
272
+ //atmos.opacity = val;
273
+ });
274
+ this._rayleight.events.on("change", (val) => {
275
+ this._parameters.RAYLEIGH_SCALE = val;
276
+ this._update();
277
+ });
278
+ this._mie.events.on("change", (val) => {
279
+ this._parameters.MIE_SCALE = val;
280
+ this._update();
281
+ });
282
+ this._height.events.on("change", (val) => {
283
+ this._parameters.ATMOS_HEIGHT = val;
284
+ this._update();
285
+ });
286
+ this._bottomRadius.events.on("change", (val) => {
287
+ this._parameters.BOTTOM_RADIUS = val;
288
+ this._update();
289
+ });
290
+ this._mieScatteringCoefficient.events.on("change", (val) => {
291
+ this._parameters.mieScatteringCoefficient = val;
292
+ this._update();
293
+ });
294
+ this._mieExtinctionCoefficient.events.on("change", (val) => {
295
+ this._parameters.mieExtinctionCoefficient = val;
296
+ this._update();
297
+ });
298
+ this._rayleighScatteringCoefficientA.events.on("change", (val) => {
299
+ this._parameters.rayleighScatteringCoefficient[0] = val;
300
+ this._update();
301
+ });
302
+ this._rayleighScatteringCoefficientB.events.on("change", (val) => {
303
+ this._parameters.rayleighScatteringCoefficient[1] = val;
304
+ this._update();
305
+ });
306
+ this._rayleighScatteringCoefficientC.events.on("change", (val) => {
307
+ this._parameters.rayleighScatteringCoefficient[2] = val;
308
+ this._update();
309
+ });
310
+ this._ozoneAbsorptionCoefficientA.events.on("change", (val) => {
311
+ this._parameters.ozoneAbsorptionCoefficient[0] = val;
312
+ this._update();
313
+ });
314
+ this._ozoneAbsorptionCoefficientB.events.on("change", (val) => {
315
+ this._parameters.ozoneAbsorptionCoefficient[1] = val;
316
+ this._update();
317
+ });
318
+ this._ozoneAbsorptionCoefficientC.events.on("change", (val) => {
319
+ this._parameters.ozoneAbsorptionCoefficient[2] = val;
320
+ this._update();
321
+ });
322
+ this._sunAngularRadius.events.on("change", (val) => {
323
+ this._parameters.SUN_ANGULAR_RADIUS = val;
324
+ this._update();
325
+ });
326
+ this._sunIntensity.events.on("change", (val) => {
327
+ this._parameters.SUN_INTENSITY = val;
328
+ this._update();
329
+ });
330
+ this._groundAlbedo.events.on("change", (val) => {
331
+ this._parameters.GROUND_ALBEDO = val;
332
+ this._update();
333
+ });
334
+ this._ozoneDensityHeight.events.on("change", (val) => {
335
+ this._parameters.ozoneDensityHeight = val;
336
+ this._update();
337
+ });
338
+ this._ozoneDensityWide.events.on("change", (val) => {
339
+ this._parameters.ozoneDensityWide = val;
340
+ this._update();
341
+ });
342
+ }
343
+ _update() {
344
+ if (this.planet) {
345
+ this.planet.atmosphereControl.setParameters(this._parameters);
346
+ }
347
+ }
348
+ }
@@ -279,9 +279,10 @@ export class DebugInfo extends Control {
279
279
  });
280
280
  }
281
281
  _frame() {
282
- for (let i = 0; i < this._watch.length; i++) {
283
- let w = this._watch[i];
284
- w.valEl.innerHTML = w.frame ? String(w.frame()) : "";
285
- }
282
+ this._watch.forEach((w) => {
283
+ if (w.valEl) {
284
+ w.valEl.innerHTML = w.frame ? String(w.frame()) : "";
285
+ }
286
+ });
286
287
  }
287
288
  }
@@ -28,7 +28,7 @@ const LIGHTING_ENABLED_SVG_ICON = `<?xml version="1.0" encoding="utf-8"?>
28
28
  </svg>`;
29
29
  const ATMOSPHERE_SVG_ICON = `<?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
30
30
  <svg width="800px" height="800px" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#000000" d="M135.688 18.5c-6.798 74.842-23.842 85.39-107.907 59.656 84.85 52.022 73.57 64.954-6.843 96.938 87.743-10.27 103.29 4.89 70.75 87.594 17.805-27.56 32.5-44.498 46.282-54.47-11.813 28.26-18.345 59.274-18.345 91.813 0 84.184 43.71 157.96 109.656 200.376-41.624-43.834-67.686-102.7-67.686-167.875 0-134.923 109.45-244.405 244.375-244.405 30.92 0 60.76 5.762 88 16.25-38.584-26.87-85.517-42.625-136.064-42.625-55.257 0-106.14 18.802-146.562 50.375 4.627-18.783 17.39-38.073 41.03-60.906C190.18 90.942 153.53 95.634 135.69 18.5zm10.03 77.188c5.67.002 11.428 1.247 16.876 3.874 14.506 6.998 22.72 21.81 22 36.938-10.26 10.87-19.507 22.696-27.594 35.344-9.035 2.753-19.075 2.27-28.25-2.156-19.37-9.343-27.5-32.6-18.156-51.97 6.715-13.92 20.638-22.036 35.125-22.03z"/></svg>`;
31
- const TEMPLATE = `<div class="og-lighing">
31
+ const TEMPLATE = `<div class="og-lighing og-options-container">
32
32
 
33
33
  <div class="og-option">
34
34
  <div class="og-suncontrol"></div>
@@ -341,13 +341,21 @@ export class Lighting extends Control {
341
341
  // Simple Sky Background parameters
342
342
  //
343
343
  let simpleSkyBackgroundControl = this.planet.renderer.controls.SimpleSkyBackground;
344
- this._simpleSkyBackgroundColorOne.value = simpleSkyBackgroundControl.colorOne;
344
+ if (simpleSkyBackgroundControl) {
345
+ this._simpleSkyBackgroundColorOne.value = simpleSkyBackgroundControl.colorOne;
346
+ this._simpleSkyBackgroundColorTwo.value = simpleSkyBackgroundControl.colorTwo;
347
+ }
345
348
  this._simpleSkyBackgroundColorOne.events.on("input", (val) => {
346
- simpleSkyBackgroundControl.colorOne = val;
349
+ let simpleSkyBackgroundControl = this.planet.renderer.controls.SimpleSkyBackground;
350
+ if (simpleSkyBackgroundControl) {
351
+ simpleSkyBackgroundControl.colorOne = val;
352
+ }
347
353
  });
348
- this._simpleSkyBackgroundColorTwo.value = simpleSkyBackgroundControl.colorTwo;
349
354
  this._simpleSkyBackgroundColorTwo.events.on("input", (val) => {
350
- simpleSkyBackgroundControl.colorTwo = val;
355
+ let simpleSkyBackgroundControl = this.planet.renderer.controls.SimpleSkyBackground;
356
+ if (simpleSkyBackgroundControl) {
357
+ simpleSkyBackgroundControl.colorTwo = val;
358
+ }
351
359
  });
352
360
  //
353
361
  // Planet options
@@ -1,29 +1,29 @@
1
- import { CompassButton } from "./CompassButton";
2
- import { Control } from "./Control";
3
- import { DebugInfo } from "./DebugInfo";
4
- import { DrawingSwitcher } from "./DrawingSwitcher";
5
- import { EarthCoordinates } from "./EarthCoordinates";
6
- import { EarthNavigation } from "./EarthNavigation";
7
- import { GeoImageDragControl } from "./GeoImageDragControl";
8
- import { KeyboardNavigation } from "./KeyboardNavigation";
9
- import { LayerAnimation } from "./LayerAnimation";
10
- import { LayerSwitcher } from "./LayerSwitcher";
11
- import { Lighting } from "./Lighting";
12
- import { MouseNavigation } from "./MouseNavigation";
13
- import { MouseWheelZoomControl } from "./MouseWheelZoomControl";
14
- import { RulerSwitcher } from "./RulerSwitcher";
15
- import { ScaleControl } from "./ScaleControl";
16
- import { ShowFps } from "./ShowFps";
17
- import { SimpleNavigation } from "./SimpleNavigation";
18
- import { SimpleSkyBackground } from "./SimpleSkyBackground";
19
- import { Sun } from "./Sun";
20
- import { ToggleWireframe } from "./ToggleWireframe";
21
- import { TouchNavigation } from "./TouchNavigation";
22
- import { ZoomControl } from "./ZoomControl";
23
- import { DrawingControl } from "./drawing/DrawingControl";
24
- import { HeightRuler } from "./heightRuler/HeightRuler";
25
- import { Ruler } from "./ruler/Ruler";
26
- import { Selection } from "./selection/Selection";
27
- import { TimelineControl } from "./timeline/TimelineControl";
28
- import { ElevationProfileControl } from "./elevationProfile/ElevationProfileControl";
29
- export { CompassButton, Control, DebugInfo, DrawingControl, DrawingSwitcher, EarthCoordinates, EarthNavigation, GeoImageDragControl, HeightRuler, KeyboardNavigation, LayerAnimation, LayerSwitcher, Lighting, MouseNavigation, MouseWheelZoomControl, Ruler, RulerSwitcher, ScaleControl, Selection, ShowFps, SimpleNavigation, SimpleSkyBackground, Sun, TimelineControl, ToggleWireframe, TouchNavigation, ZoomControl, ElevationProfileControl };
1
+ export * from "./CompassButton";
2
+ export * from "./Control";
3
+ export * from "./DebugInfo";
4
+ export * from "./DrawingSwitcher";
5
+ export * from "./EarthCoordinates";
6
+ export * from "./EarthNavigation";
7
+ export * from "./GeoImageDragControl";
8
+ export * from "./KeyboardNavigation";
9
+ export * from "./LayerAnimation";
10
+ export * from "./LayerSwitcher";
11
+ export * from "./Lighting";
12
+ export * from "./MouseNavigation";
13
+ export * from "./MouseWheelZoomControl";
14
+ export * from "./RulerSwitcher";
15
+ export * from "./ScaleControl";
16
+ export * from "./ShowFps";
17
+ export * from "./SimpleNavigation";
18
+ export * from "./SimpleSkyBackground";
19
+ export * from "./Sun";
20
+ export * from "./ToggleWireframe";
21
+ export * from "./TouchNavigation";
22
+ export * from "./ZoomControl";
23
+ export * from "./drawing/DrawingControl";
24
+ export * from "./heightRuler/HeightRuler";
25
+ export * from "./ruler/Ruler";
26
+ export * from "./selection/Selection";
27
+ export * from "./timeline/TimelineControl";
28
+ export * from "./elevationProfile/ElevationProfileControl";
29
+ export * from "./AtmosphereConfig";
@@ -1,29 +1,29 @@
1
- import { CompassButton } from "./CompassButton";
2
- import { Control } from "./Control";
3
- import { DebugInfo } from "./DebugInfo";
4
- import { DrawingSwitcher } from "./DrawingSwitcher";
5
- import { EarthCoordinates } from "./EarthCoordinates";
6
- import { EarthNavigation } from "./EarthNavigation";
7
- import { GeoImageDragControl } from "./GeoImageDragControl";
8
- import { KeyboardNavigation } from "./KeyboardNavigation";
9
- import { LayerAnimation } from "./LayerAnimation";
10
- import { LayerSwitcher } from "./LayerSwitcher";
11
- import { Lighting } from "./Lighting";
12
- import { MouseNavigation } from "./MouseNavigation";
13
- import { MouseWheelZoomControl } from "./MouseWheelZoomControl";
14
- import { RulerSwitcher } from "./RulerSwitcher";
15
- import { ScaleControl } from "./ScaleControl";
16
- import { ShowFps } from "./ShowFps";
17
- import { SimpleNavigation } from "./SimpleNavigation";
18
- import { SimpleSkyBackground } from "./SimpleSkyBackground";
19
- import { Sun } from "./Sun";
20
- import { ToggleWireframe } from "./ToggleWireframe";
21
- import { TouchNavigation } from "./TouchNavigation";
22
- import { ZoomControl } from "./ZoomControl";
23
- import { DrawingControl } from "./drawing/DrawingControl";
24
- import { HeightRuler } from "./heightRuler/HeightRuler";
25
- import { Ruler } from "./ruler/Ruler";
26
- import { Selection } from "./selection/Selection";
27
- import { TimelineControl } from "./timeline/TimelineControl";
28
- import { ElevationProfileControl } from "./elevationProfile/ElevationProfileControl";
29
- export { CompassButton, Control, DebugInfo, DrawingControl, DrawingSwitcher, EarthCoordinates, EarthNavigation, GeoImageDragControl, HeightRuler, KeyboardNavigation, LayerAnimation, LayerSwitcher, Lighting, MouseNavigation, MouseWheelZoomControl, Ruler, RulerSwitcher, ScaleControl, Selection, ShowFps, SimpleNavigation, SimpleSkyBackground, Sun, TimelineControl, ToggleWireframe, TouchNavigation, ZoomControl, ElevationProfileControl };
1
+ export * from "./CompassButton";
2
+ export * from "./Control";
3
+ export * from "./DebugInfo";
4
+ export * from "./DrawingSwitcher";
5
+ export * from "./EarthCoordinates";
6
+ export * from "./EarthNavigation";
7
+ export * from "./GeoImageDragControl";
8
+ export * from "./KeyboardNavigation";
9
+ export * from "./LayerAnimation";
10
+ export * from "./LayerSwitcher";
11
+ export * from "./Lighting";
12
+ export * from "./MouseNavigation";
13
+ export * from "./MouseWheelZoomControl";
14
+ export * from "./RulerSwitcher";
15
+ export * from "./ScaleControl";
16
+ export * from "./ShowFps";
17
+ export * from "./SimpleNavigation";
18
+ export * from "./SimpleSkyBackground";
19
+ export * from "./Sun";
20
+ export * from "./ToggleWireframe";
21
+ export * from "./TouchNavigation";
22
+ export * from "./ZoomControl";
23
+ export * from "./drawing/DrawingControl";
24
+ export * from "./heightRuler/HeightRuler";
25
+ export * from "./ruler/Ruler";
26
+ export * from "./selection/Selection";
27
+ export * from "./timeline/TimelineControl";
28
+ export * from "./elevationProfile/ElevationProfileControl";
29
+ export * from "./AtmosphereConfig";
@@ -21,6 +21,7 @@ interface IEntityCollectionParams {
21
21
  scaleByDistance?: NumberArray3;
22
22
  pickingScale?: number;
23
23
  opacity?: number;
24
+ useLighting?: boolean;
24
25
  entities?: Entity[];
25
26
  }
26
27
  /**
@@ -184,8 +185,11 @@ declare class EntityCollection {
184
185
  */
185
186
  _layer?: Vector;
186
187
  _quadNode?: EntityCollectionNode;
188
+ _useLighting: number;
187
189
  constructor(options?: IEntityCollectionParams);
188
190
  get id(): number;
191
+ get useLighting(): boolean;
192
+ set useLighting(f: boolean);
189
193
  isEqual(ec: EntityCollection): boolean;
190
194
  /**
191
195
  * Sets collection visibility.
@@ -79,6 +79,7 @@ class EntityCollection {
79
79
  this._opacity = options.opacity == undefined ? 1.0 : options.opacity;
80
80
  this._fadingOpacity = this._opacity;
81
81
  this.events = this.rendererEvents = createEvents(ENTITYCOLLECTION_EVENTS, this);
82
+ this._useLighting = options.useLighting != undefined ? (options.useLighting ? 1.0 : 0.0) : 1.0;
82
83
  // initialize current entities
83
84
  if (options.entities) {
84
85
  this.addEntities(options.entities);
@@ -87,6 +88,12 @@ class EntityCollection {
87
88
  get id() {
88
89
  return this.__id;
89
90
  }
91
+ get useLighting() {
92
+ return Boolean(this._useLighting);
93
+ }
94
+ set useLighting(f) {
95
+ this._useLighting = Number(f);
96
+ }
90
97
  isEqual(ec) {
91
98
  return this.__id === ec.__id;
92
99
  }
@@ -45,6 +45,9 @@ declare class GeoObject {
45
45
  protected _pitch: number;
46
46
  protected _yaw: number;
47
47
  protected _roll: number;
48
+ protected _pitchRad: number;
49
+ protected _yawRad: number;
50
+ protected _rollRad: number;
48
51
  protected _scale: Vec3;
49
52
  /**
50
53
  * RGBA color.
@@ -52,7 +55,8 @@ declare class GeoObject {
52
55
  * @type {Vec4}
53
56
  */
54
57
  _color: Vec4;
55
- _direction: Vec3;
58
+ _qRot: Quat;
59
+ protected _direction: Vec3;
56
60
  _handler: GeoObjectHandler | null;
57
61
  _handlerIndex: number;
58
62
  _tagData: InstanceData | null;
@@ -68,7 +72,6 @@ declare class GeoObject {
68
72
  getPitch(): number;
69
73
  getYaw(): number;
70
74
  getRoll(): number;
71
- getDirection(): Vec3;
72
75
  get object3d(): Object3d;
73
76
  get vertices(): number[];
74
77
  get normals(): number[];
@@ -147,6 +150,7 @@ declare class GeoObject {
147
150
  * @param {Vec3} color - Picking color.
148
151
  */
149
152
  setPickingColor3v(color: Vec3): void;
150
- updateDirection(): void;
153
+ updateRotation(): void;
154
+ getDirection(): Vec3;
151
155
  }
152
156
  export { GeoObject };