@openglobus/og 0.20.2 → 0.20.3

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 (35) hide show
  1. package/css/og.css +55 -23
  2. package/lib/@openglobus/js/Globe.d.ts +3 -0
  3. package/lib/@openglobus/js/control/Atmosphere.d.ts +27 -3
  4. package/lib/@openglobus/js/control/AtmosphereConfig.d.ts +59 -0
  5. package/lib/@openglobus/js/control/index.d.ts +29 -29
  6. package/lib/@openglobus/js/scene/Planet.d.ts +6 -0
  7. package/lib/@openglobus/js/shaders/atmos.d.ts +19 -3
  8. package/lib/@openglobus/js/shaders/drawnode.d.ts +2 -1
  9. package/lib/@openglobus/js/webgl/Handler.d.ts +3 -1
  10. package/lib/@openglobus/og.css +1 -1
  11. package/lib/@openglobus/og.esm.js +1 -1
  12. package/lib/@openglobus/og.esm.js.map +1 -1
  13. package/lib/@openglobus/og.umd.js +1 -1
  14. package/lib/@openglobus/og.umd.js.map +1 -1
  15. package/lib/js/Globe.d.ts +3 -0
  16. package/lib/js/Globe.js +3 -1
  17. package/lib/js/control/Atmosphere.d.ts +27 -3
  18. package/lib/js/control/Atmosphere.js +109 -43
  19. package/lib/js/control/AtmosphereConfig.d.ts +59 -0
  20. package/lib/js/control/AtmosphereConfig.js +348 -0
  21. package/lib/js/control/DebugInfo.js +5 -4
  22. package/lib/js/control/Lighting.js +13 -5
  23. package/lib/js/control/index.d.ts +29 -29
  24. package/lib/js/control/index.js +29 -29
  25. package/lib/js/layer/Layer.js +2 -2
  26. package/lib/js/scene/Planet.d.ts +6 -0
  27. package/lib/js/scene/Planet.js +24 -10
  28. package/lib/js/shaders/atmos.d.ts +19 -3
  29. package/lib/js/shaders/atmos.js +40 -26
  30. package/lib/js/shaders/drawnode.d.ts +2 -1
  31. package/lib/js/shaders/drawnode.js +15 -12
  32. package/lib/js/ui/Slider.js +3 -3
  33. package/lib/js/webgl/Handler.d.ts +3 -1
  34. package/lib/js/webgl/Handler.js +38 -28
  35. 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";
@@ -62,9 +62,9 @@ class Layer {
62
62
  this.properties = options.properties || {};
63
63
  this.hideInLayerSwitcher = options.hideInLayerSwitcher || false;
64
64
  this._hasImageryTiles = true;
65
- this._opacity = options.opacity || 1.0;
65
+ this._opacity = options.opacity != undefined ? options.opacity : 1.0;
66
66
  this.minZoom = options.minZoom || 0;
67
- this.maxZoom = options.maxZoom || 50;
67
+ this.maxZoom = options.maxZoom != undefined ? options.maxZoom : 50;
68
68
  this._planet = null;
69
69
  this.isVector = false;
70
70
  this._attribution = options.attribution || "";
@@ -1,3 +1,4 @@
1
+ import { Atmosphere, IAtmosphereParams } from "../control/Atmosphere";
1
2
  import { Control } from "../control/Control";
2
3
  import { EventsHandler } from "../Events";
3
4
  import { EmptyTerrain } from "../terrain/EmptyTerrain";
@@ -25,6 +26,7 @@ import { VectorTileCreator } from "../utils/VectorTileCreator";
25
26
  import { WebGLBufferExt, WebGLTextureExt, IDefaultTextureParams } from "../webgl/Handler";
26
27
  import { Program } from "../webgl/Program";
27
28
  import { Segment } from "../segment/Segment";
29
+ import { AtmosphereParameters } from "../shaders/atmos";
28
30
  export interface IPlanetParams {
29
31
  name?: string;
30
32
  ellipsoid?: Ellipsoid;
@@ -45,6 +47,7 @@ export interface IPlanetParams {
45
47
  maxLoadingRequests?: number;
46
48
  atmosphereEnabled?: boolean;
47
49
  transitionOpacityEnabled?: boolean;
50
+ atmosphereParameters?: IAtmosphereParams;
48
51
  }
49
52
  export type PlanetEventsList = [
50
53
  "draw",
@@ -324,6 +327,7 @@ export declare class Planet extends RenderNode {
324
327
  _prevNodes: Map<number, Node>;
325
328
  _currNodes: Map<number, Node>;
326
329
  protected _transitionOpacityEnabled: boolean;
330
+ protected _atmosphere: Atmosphere;
327
331
  constructor(options?: IPlanetParams);
328
332
  /**
329
333
  * Returns true if current terrain data set is loaded
@@ -422,6 +426,8 @@ export declare class Planet extends RenderNode {
422
426
  * @param {EmptyTerrain} terrain - Terrain provider.
423
427
  */
424
428
  setTerrain(terrain: EmptyTerrain): void;
429
+ initAtmosphereShader(atmosParams?: AtmosphereParameters): void;
430
+ get atmosphereControl(): Atmosphere;
425
431
  protected _initializeAtmosphere(): void;
426
432
  protected _initializeShaders(): void;
427
433
  protected _onLayerLoadend(layer: Layer): void;
@@ -102,6 +102,7 @@ export class Planet extends RenderNode {
102
102
  }
103
103
  gl.enable(gl.DEPTH_TEST);
104
104
  };
105
+ this._atmosphere = new Atmosphere(options.atmosphereParameters);
105
106
  this._prevNodes = new Map();
106
107
  this._currNodes = new Map();
107
108
  this.transitionTime = 580;
@@ -424,24 +425,39 @@ export class Planet extends RenderNode {
424
425
  });
425
426
  }
426
427
  }
428
+ initAtmosphereShader(atmosParams) {
429
+ if (this.renderer && this.renderer.handler && this._atmosphereEnabled) {
430
+ let h = this.renderer.handler;
431
+ if (h.isWebGl2()) {
432
+ h.removeProgram("drawnode_screen_wl");
433
+ h.addProgram(shaders.drawnode_screen_wl_webgl2Atmos(atmosParams), true);
434
+ }
435
+ else {
436
+ console.warn("Atmosphere WebGL2 only");
437
+ }
438
+ }
439
+ }
440
+ get atmosphereControl() {
441
+ return this._atmosphere;
442
+ }
427
443
  _initializeAtmosphere() {
444
+ if (!this.renderer)
445
+ return;
428
446
  let h = this.renderer.handler;
429
447
  h.removeProgram("drawnode_screen_wl");
430
448
  if (this._atmosphereEnabled) {
431
449
  this._renderScreenNodesPASS = this._renderScreenNodesPASSAtmos;
432
450
  this._renderScreenNodesWithHeightPASS = this._renderScreenNodesWithHeightPASSAtmos;
451
+ if (!this.renderer.controls.Atmosphere) {
452
+ this.addControl(this._atmosphere);
453
+ }
454
+ this._atmosphere.activate();
433
455
  if (h.isWebGl2()) {
434
- h.addProgram(shaders.drawnode_screen_wl_webgl2Atmos(), true);
456
+ h.addProgram(shaders.drawnode_screen_wl_webgl2Atmos(this._atmosphere.parameters), true);
435
457
  }
436
458
  else {
437
459
  h.addProgram(shaders.drawnode_screen_wl_webgl1NoAtmos(), true);
438
460
  }
439
- if (!this.renderer.controls.Atmosphere) {
440
- this.addControl(new Atmosphere());
441
- }
442
- else {
443
- this.renderer.controls.Atmosphere.activate();
444
- }
445
461
  if (this.renderer.controls.SimpleSkyBackground) {
446
462
  this.renderer.controls.SimpleSkyBackground.deactivate();
447
463
  }
@@ -449,9 +465,7 @@ export class Planet extends RenderNode {
449
465
  else {
450
466
  this._renderScreenNodesPASS = this._renderScreenNodesPASSNoAtmos;
451
467
  this._renderScreenNodesWithHeightPASS = this._renderScreenNodesWithHeightPASSNoAtmos;
452
- if (this.renderer.controls.Atmosphere) {
453
- this.renderer.controls.Atmosphere.deactivate();
454
- }
468
+ this._atmosphere.deactivate();
455
469
  if (!this.renderer.controls.SimpleSkyBackground) {
456
470
  this.addControl(new SimpleSkyBackground());
457
471
  }