@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
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  English | [简体中文](README_CN.md) | [Portuguese-BR](README_pt-BR.md)
7
7
 
8
- [Openglobus](https://www.openglobus.org/) is a typescript/javascript library designed to display interactive 3D maps and other geospatial data at a
8
+ [openglobus](https://www.openglobus.org/) is a typescript/javascript library designed to display interactive 3D maps and other geospatial data at a
9
9
  scale from planet to bee.
10
10
 
11
11
  It supports various high-resolution terrain providers, imagery layers, renders thousands of 3D objects, provides
package/css/og.css CHANGED
@@ -140,19 +140,33 @@ input {
140
140
  visibility: hidden !important;
141
141
  }
142
142
 
143
- /*.og-dialog {
144
- position: absolute;
145
- right: 52px;
146
- width: 13em;
147
- border-radius: 4px;
148
- box-shadow: 3px 3px 4px rgba(15, 15, 15, 0.17);
149
- background-color: rgba(64, 59, 59, 0.85);
150
- z-index: 25000;
151
- padding: 0;
152
- margin: 0;
153
- font-family: "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif;
154
- overflow: hidden;
155
- }*/
143
+ .og-options-container {
144
+ position: relative;
145
+ padding: 12px;
146
+ height: calc(100% - 30px);
147
+ color: #b6b6b6;
148
+ }
149
+
150
+ .og-option {
151
+ width: 100%;
152
+ position: relative;
153
+ display: inline-block;
154
+ flex-direction: row;
155
+ padding-bottom: 7px;
156
+ text-overflow: ellipsis;
157
+ align-items: center;
158
+ justify-content: left;
159
+ }
160
+
161
+ .og-option .og-slider {
162
+ width: 100%;
163
+ }
164
+
165
+ .og-option .og-slider .og-slider-label,
166
+ .og-option .og-color-label {
167
+ width: 100px;
168
+ font-size: 12px;
169
+ }
156
170
 
157
171
  .og-ddialog {
158
172
  position: absolute;
@@ -620,20 +634,15 @@ input {
620
634
  position: relative;
621
635
  }
622
636
 
637
+ .og-emptyline,
623
638
  .og-lighing .og-lighting-emptyline {
624
639
  width: 100%;
625
640
  padding: 3px;
626
641
  }
627
642
 
628
- .og-lighing .og-option {
643
+ .og-emptyline-2 {
629
644
  width: 100%;
630
- position: relative;
631
- display: inline-block;
632
- flex-direction: row;
633
- padding-bottom: 7px;
634
- text-overflow: ellipsis;
635
- align-items: center;
636
- justify-content: left;
645
+ padding: 5px;
637
646
  }
638
647
 
639
648
  .og-lighing .og-slider {
@@ -717,6 +726,28 @@ input {
717
726
  pointer-events: none;
718
727
  }
719
728
 
729
+
730
+ /*
731
+ ==========================
732
+ Atmosphere Config
733
+ ==========================
734
+ */
735
+ .og-atmosphere_button {
736
+ position: absolute;
737
+ left: 10px;
738
+ top: 230px;
739
+ }
740
+
741
+ .og-atmosphere.og-options-container .og-slider-label {
742
+ width: 300px;
743
+ overflow: hidden;
744
+ height: 20px;
745
+ }
746
+
747
+ .og-atmosphere.og-options-container .og-slider input{
748
+ width: 87px;
749
+ }
750
+
720
751
  /*
721
752
  ==========================
722
753
  TIMELINE
@@ -838,7 +869,7 @@ TIMELINE
838
869
  display: flex;
839
870
  flex-direction: row;
840
871
  width: 200px;
841
- height: 20px;
872
+ /*height: 20px;*/
842
873
  }
843
874
 
844
875
  .og-slider .og-slider-label {
@@ -850,12 +881,13 @@ TIMELINE
850
881
  display: flex;
851
882
  align-items: center;
852
883
  text-align: left;
884
+ margin-right: 5px;
853
885
  }
854
886
 
855
887
  .og-slider .og-slider-panel {
856
888
  position: relative;
857
889
  width: 100%;
858
- height: 100%;
890
+ height: 20px;
859
891
  background-color: var(--grey1);
860
892
  z-index: 1;
861
893
  }
@@ -9,6 +9,7 @@ import { Sun } from "./control/Sun";
9
9
  import { HTMLDivElementExt, Renderer } from "./renderer/Renderer";
10
10
  import { RenderNode } from "./scene/RenderNode";
11
11
  import { Extent } from "./Extent";
12
+ import { IAtmosphereParams } from "./control/Atmosphere";
12
13
  export interface IGlobeParams {
13
14
  attributionContainer?: HTMLElement;
14
15
  target?: string | HTMLElement;
@@ -43,6 +44,7 @@ export interface IGlobeParams {
43
44
  autoActivate?: boolean;
44
45
  fontsSrc?: string;
45
46
  resourcesSrc?: string;
47
+ atmosphereParameters?: IAtmosphereParams;
46
48
  }
47
49
  /**
48
50
  * Creates a WebGL context with globe.
@@ -94,6 +96,7 @@ export interface IGlobeParams {
94
96
  * @param {number} [options.dpi] - Device pixel ratio. Default is current screen DPI.
95
97
  * @param {boolean} [options.atmosphereEnabled] - Enables atmosphere effect.
96
98
  * @param {boolean} [options.transtitionOpacityEnabled] - Enables terrain smooth opacity transition effect.
99
+ * @param {IAtmosphereParams} [options.atmosphereParameters] - Atmosphere model parameters.
97
100
  */
98
101
  declare class Globe {
99
102
  static __counter__: number;
@@ -1,16 +1,40 @@
1
+ import { AtmosphereParameters } from "../shaders/atmos";
1
2
  import { Framebuffer } from "../webgl/Framebuffer";
2
3
  import { Control, IControlParams } from "./Control";
3
- interface IAtmosphereParams extends IControlParams {
4
+ import { NumberArray3 } from '../math/Vec3';
5
+ export interface IAtmosphereParams extends IControlParams {
6
+ height?: number;
7
+ rayleighScale?: number;
8
+ mieScale?: number;
9
+ groundAlbedo?: number;
10
+ bottomRadius?: number;
11
+ rayleighScatteringCoefficient?: NumberArray3;
12
+ mieScatteringCoefficient?: number;
13
+ mieExtinctionCoefficient?: number;
14
+ ozoneAbsorptionCoefficient?: NumberArray3;
15
+ sunAngularRadius?: number;
16
+ sunIntensity?: number;
17
+ ozoneDensityHeight?: number;
18
+ ozoneDensityWide?: number;
4
19
  }
5
20
  export declare class Atmosphere extends Control {
6
21
  _transmittanceBuffer: Framebuffer | null;
7
22
  _scatteringBuffer: Framebuffer | null;
8
23
  opacity: number;
24
+ protected _parameters: AtmosphereParameters;
9
25
  constructor(options?: IAtmosphereParams);
26
+ setParameters(parameters: AtmosphereParameters): void;
27
+ get parameters(): AtmosphereParameters;
28
+ initPlanetAtmosphereShader(): void;
10
29
  oninit(): void;
30
+ initLookupTexturesShaders(): void;
31
+ initBackgroundShader(): void;
32
+ removeBackgroundShader(): void;
33
+ removeLookupTexturesShaders(): void;
11
34
  onactivate(): void;
12
35
  ondeactivate(): void;
13
- protected _drawAtmosphereTextures(): void;
36
+ protected _initLookupTextures(): void;
37
+ protected _renderLookupTextures(): void;
38
+ drawLookupTextures(): void;
14
39
  protected _drawBackground(): void;
15
40
  }
16
- export {};
@@ -0,0 +1,59 @@
1
+ import { Control, IControlParams } 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
+ import { AtmosphereParameters } from "../shaders/atmos";
7
+ interface IAtmosphereConfigParams extends IControlParams {
8
+ }
9
+ /**
10
+ * Helps to set up atmosphere parameters.
11
+ */
12
+ export declare class AtmosphereConfig extends Control {
13
+ protected _toggleBtn: ToggleButton;
14
+ protected _dialog: Dialog<null>;
15
+ protected _panel: View<null>;
16
+ $maxOpacity: HTMLElement | null;
17
+ $minOpacity: HTMLElement | null;
18
+ $rayleight: HTMLElement | null;
19
+ $mie: HTMLElement | null;
20
+ $height: HTMLElement | null;
21
+ $bottomRadius: HTMLElement | null;
22
+ $mieScatteringCoefficient: HTMLElement | null;
23
+ $mieExtinctionCoefficient: HTMLElement | null;
24
+ $rayleighScatteringCoefficientA: HTMLElement | null;
25
+ $rayleighScatteringCoefficientB: HTMLElement | null;
26
+ $rayleighScatteringCoefficientC: HTMLElement | null;
27
+ $ozoneAbsorptionCoefficientA: HTMLElement | null;
28
+ $ozoneAbsorptionCoefficientB: HTMLElement | null;
29
+ $ozoneAbsorptionCoefficientC: HTMLElement | null;
30
+ $sunAngularRadius: HTMLElement | null;
31
+ $sunIntensity: HTMLElement | null;
32
+ $groundAlbedo: HTMLElement | null;
33
+ $ozoneDensityHeight: HTMLElement | null;
34
+ $ozoneDensityWide: HTMLElement | null;
35
+ protected _maxOpacity: Slider;
36
+ protected _minOpacity: Slider;
37
+ protected _rayleight: Slider;
38
+ protected _mie: Slider;
39
+ protected _height: Slider;
40
+ protected _bottomRadius: Slider;
41
+ protected _mieScatteringCoefficient: Slider;
42
+ protected _mieExtinctionCoefficient: Slider;
43
+ protected _rayleighScatteringCoefficientA: Slider;
44
+ protected _rayleighScatteringCoefficientB: Slider;
45
+ protected _rayleighScatteringCoefficientC: Slider;
46
+ protected _ozoneAbsorptionCoefficientA: Slider;
47
+ protected _ozoneAbsorptionCoefficientB: Slider;
48
+ protected _ozoneAbsorptionCoefficientC: Slider;
49
+ protected _sunAngularRadius: Slider;
50
+ protected _sunIntensity: Slider;
51
+ protected _groundAlbedo: Slider;
52
+ protected _ozoneDensityHeight: Slider;
53
+ protected _ozoneDensityWide: Slider;
54
+ protected _parameters: AtmosphereParameters;
55
+ constructor(options?: IAtmosphereConfigParams);
56
+ oninit(): void;
57
+ protected _update(): void;
58
+ }
59
+ export {};
@@ -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.
@@ -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 };
@@ -4,6 +4,7 @@ import { GeoObject } from "./GeoObject";
4
4
  import { Planet } from "../scene/Planet";
5
5
  import { Vec3 } from "../math/Vec3";
6
6
  import { Vec4 } from "../math/Vec4";
7
+ import { Quat } from "../math/Quat";
7
8
  import { WebGLBufferExt, WebGLTextureExt } from "../webgl/Handler";
8
9
  import { Object3d } from "../Object3d";
9
10
  declare class InstanceData {
@@ -14,24 +15,22 @@ declare class InstanceData {
14
15
  _texture: WebGLTextureExt | null;
15
16
  _textureSrc: string | null;
16
17
  _objectSrc?: string;
17
- _pitchRollArr: number[] | TypedArray;
18
18
  _sizeArr: number[] | TypedArray;
19
19
  _vertexArr: number[] | TypedArray;
20
20
  _positionHighArr: number[] | TypedArray;
21
21
  _positionLowArr: number[] | TypedArray;
22
- _directionArr: number[] | TypedArray;
22
+ _qRotArr: number[] | TypedArray;
23
23
  _rgbaArr: number[] | TypedArray;
24
24
  _normalsArr: number[] | TypedArray;
25
25
  _indicesArr: number[] | TypedArray;
26
26
  _pickingColorArr: number[] | TypedArray;
27
27
  _visibleArr: number[] | TypedArray;
28
28
  _texCoordArr: number[] | TypedArray;
29
- _pitchRollBuffer: WebGLBufferExt | null;
30
29
  _sizeBuffer: WebGLBufferExt | null;
31
30
  _vertexBuffer: WebGLBufferExt | null;
32
31
  _positionHighBuffer: WebGLBufferExt | null;
33
32
  _positionLowBuffer: WebGLBufferExt | null;
34
- _directionBuffer: WebGLBufferExt | null;
33
+ _qRotBuffer: WebGLBufferExt | null;
35
34
  _rgbaBuffer: WebGLBufferExt | null;
36
35
  _normalsBuffer: WebGLBufferExt | null;
37
36
  _indicesBuffer: WebGLBufferExt | null;
@@ -45,13 +44,12 @@ declare class InstanceData {
45
44
  clear(): void;
46
45
  _deleteBuffers(): void;
47
46
  createVertexBuffer(): void;
48
- createPitchRollBuffer(): void;
49
47
  createVisibleBuffer(): void;
50
48
  createSizeBuffer(): void;
51
49
  createTexCoordBuffer(): void;
52
50
  createPositionBuffer(): void;
53
51
  createRgbaBuffer(): void;
54
- createDirectionBuffer(): void;
52
+ createQRotBuffer(): void;
55
53
  createNormalsBuffer(): void;
56
54
  createIndicesBuffer(): void;
57
55
  createPickingColorBuffer(): void;
@@ -84,12 +82,11 @@ declare class GeoObjectHandler {
84
82
  drawPicking(): void;
85
83
  protected _pickingPASS(): void;
86
84
  _loadDataTagTexture(tagData: InstanceData): Promise<void>;
87
- setDirectionArr(tagData: InstanceData, tagDataIndex: number, direction: Vec3): void;
85
+ setQRotArr(tagData: InstanceData, tagDataIndex: number, qRot: Quat): void;
88
86
  setVisibility(tagData: InstanceData, tagDataIndex: number, visibility: boolean): void;
89
87
  setPositionArr(tagData: InstanceData, tagDataIndex: number, positionHigh: Vec3, positionLow: Vec3): void;
90
88
  setRgbaArr(tagData: InstanceData, tagDataIndex: number, rgba: Vec4): void;
91
89
  setPickingColorArr(tagData: InstanceData, tagDataIndex: number, color: Vec3): void;
92
- setPitchRollArr(tagData: InstanceData, tagDataIndex: number, pitch: number, roll: number): void;
93
90
  setScaleArr(tagData: InstanceData, tagDataIndex: number, scale: Vec3): void;
94
91
  protected _updateTag(dataTag: InstanceData): void;
95
92
  update(): void;
@@ -19,6 +19,7 @@ export interface IVectorParams extends ILayerParams {
19
19
  pickingScale?: number;
20
20
  scaleByDistance?: NumberArray3;
21
21
  labelMaxLetters?: number;
22
+ useLighting?: boolean;
22
23
  }
23
24
  type VectorEventsList = [
24
25
  "draw",
@@ -44,6 +45,7 @@ export type VectorEventsType = EventsHandler<VectorEventsList> & EventsHandler<L
44
45
  * First index - near distance to the entity, after entity becomes full scale.
45
46
  * Second index - far distance to the entity, when entity becomes zero scale.
46
47
  * Third index - far distance to the entity, when entity becomes invisible.
48
+ * Use [1.0, 1.0, 1.0] for real sized objects
47
49
  * @param {number} [options.nodeCapacity=30] - Maximum entities quantity in the tree node. Rendering optimization parameter. 30 is default.
48
50
  * @param {boolean} [options.async=true] - Asynchronous vector data handling before rendering. True for optimization huge data.
49
51
  * @param {boolean} [options.clampToGround = false] - Clamp vector data to the ground.
@@ -121,7 +123,10 @@ declare class Vector extends Layer {
121
123
  polygonOffsetUnits: number;
122
124
  _secondPASS: EntityCollectionNode[];
123
125
  protected _labelMaxLetters: number;
126
+ protected _useLighting: boolean;
124
127
  constructor(name?: string | null, options?: IVectorParams);
128
+ get useLighting(): boolean;
129
+ set useLighting(f: boolean);
125
130
  get labelMaxLetters(): number;
126
131
  get instanceName(): string;
127
132
  protected _bindPicking(): void;
@@ -118,6 +118,7 @@ export declare class Quat {
118
118
  * @returns {Quat} -
119
119
  */
120
120
  static getRotationBetweenVectorsUp(source: Vec3, dest: Vec3, up: Vec3): Quat;
121
+ static setFromEulerAngles(pitch: number, yaw: number, roll: number): Quat;
121
122
  /**
122
123
  * Returns true if the components are zero.
123
124
  * @public
@@ -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;
@@ -1,4 +1,20 @@
1
1
  import { Program } from '../webgl/Program';
2
- export declare const COMMON = "\n \n \n float getLerpValue(in float min, in float max, in float between)\n {\n return (clamp(between, min, max) - min) / (max - min);\n }\n \n vec3 aces(vec3 color) \n {\n float a = 2.51;\n float b = 0.03;\n float c = 2.43;\n float d = 0.59;\n float e = 0.14;\n return clamp((color * (a * color + b)) / (color * (c * color + d ) + e), 0.0, 1.0);\n }\n \n bool intersectSphere(vec3 rayOrigin, vec3 rayDirection, float radius, inout float t1, inout float t2) \n {\n float b = dot(rayDirection, rayOrigin);\n float c = dot(rayOrigin, rayOrigin) - radius * radius;\n float d = b * b - c;\n if (d < 0.0) {\n return false;\n }\n t1 = -b - sqrt(d);\n t2 = -b + sqrt(d);\n return true;\n }\n \n bool intersectSphere(vec3 rayOrigin, vec3 rayDirection, float radius, inout float t) \n {\n float b = dot(rayDirection, rayOrigin);\n float c = dot(rayOrigin, rayOrigin) - radius * radius;\n float d = b * b - c;\n if (d < 0.0) {\n return false;\n }\n t = -b - sqrt(d);\n return true;\n }\n \n bool intersectEllipsoid( in vec3 ro, in vec3 rd, in vec3 ra, inout float t )\n {\n vec3 ocn = ro/ra;\n vec3 rdn = rd/ra;\n float a = dot( rdn, rdn );\n float b = dot( ocn, rdn );\n float c = dot( ocn, ocn );\n float h = b*b - a*(c-1.0);\n \n if (h < 0.0) \n { \n return false; \n }\n \n t = (-b-sqrt(h))/a;\n \n return true;\n }\n \n bool intersectEllipsoid( in vec3 ro, in vec3 rd, in vec3 ra, inout float t1, inout float t2)\n {\n vec3 ocn = ro/ra;\n vec3 rdn = rd/ra;\n float a = dot( rdn, rdn );\n float b = dot( ocn, rdn );\n float c = dot( ocn, ocn );\n float h = b*b - a*(c-1.0);\n \n if (h < 0.0) \n { \n return false; \n }\n \n h = sqrt(h);\n t1 = (-b-h)/a;\n t2 = (-b+h)/a;\n \n return true;\n }\n \n vec3 normalEllipsoid( in vec3 pos, in vec3 ra )\n {\n return normalize( pos/(ra*ra) );\n }\n\n \n #define PI 3.1415926538\n #define ATMOS_HEIGHT 100000.0\n #define RAYLEIGH_SCALE 0.08\n #define MIE_SCALE 0.012\n \n #define SAMPLE_COUNT 16\n #define SQRT_SAMPLE_COUNT 4\n \n const float GROUND_ALBEDO = 0.05 / PI;\n\n // Sphere\n const float BOTTOM_RADIUS = 6356752.3142451793;\n const float TOP_RADIUS = 6356752.3142451793 + ATMOS_HEIGHT;\n \n // Ellipsoid\n const vec3 bottomRadii = vec3(6378137.0, 6378137.0, 6356752.3142451793); \n const vec3 topRadii = bottomRadii + ATMOS_HEIGHT;\n \n const vec3 SPHERE_TO_ELLIPSOID_SCALE = vec3(BOTTOM_RADIUS) / bottomRadii; \n \n const vec2 rayleighMieHeights = vec2(RAYLEIGH_SCALE, MIE_SCALE) * ATMOS_HEIGHT;\n \n const vec3 rayleighScatteringCoefficient = vec3(5.802, 13.558, 33.100) * 1e-6;\n \n const float mieScatteringCoefficient = 3.996e-06;\n const float mieExtinctionCoefficient = 4.440e-06;\n const vec3 ozoneAbsorptionCoefficient = vec3(0.650, 1.881, 0.085) * 1e-6;\n \n const float SUN_ANGULAR_RADIUS = 0.004685;\n const float SUN_INTENSITY = 1.0; \n \n vec3 sunWithBloom(vec3 rayDir, vec3 sunDir) \n {\n float minSunCosTheta = cos(SUN_ANGULAR_RADIUS); \n float cosTheta = dot(rayDir, sunDir);\n if (cosTheta >= minSunCosTheta) return vec3(1.0); \n float offset = minSunCosTheta - cosTheta;\n float gaussianBloom = exp(-offset*15000.0)*0.7;\n float invBloom = 1.0/(0.09 + offset*200.0)*0.01;\n return vec3(gaussianBloom + invBloom);\n }\n \n float rayleighPhase(float angle) \n {\n return 3.0 / (16.0 * PI) * (1.0 + (angle * angle));\n }\n \n float miePhase(float angle) \n {\n float g = 0.8;\n return 3.0 / (8.0 * PI) * ((1.0 - g * g) * (1.0 + angle * angle)) / ((2.0 + g * g) * pow(1.0 + g * g - 2.0 * g * angle, 1.5));\n }\n \n vec3 opticalDepth(float height, float angle) \n {\n vec3 rayOrigin = vec3(0.0, BOTTOM_RADIUS + height, 0.0);\n vec3 rayDirection = vec3(sqrt(1.0 - angle * angle), angle, 0.0);\n float t1, t2;\n intersectSphere(rayOrigin, rayDirection, TOP_RADIUS, t1, t2);\n float segmentLength = t2 / float(SAMPLE_COUNT);\n \n float t = segmentLength * 0.5;\n vec3 opticalDepth = vec3(0.0);\n \n for (int i = 0; i < SAMPLE_COUNT; i++) \n {\n vec3 position = rayOrigin + t * rayDirection;\n float height = length(position) - BOTTOM_RADIUS;\n opticalDepth.xy += exp(-height / rayleighMieHeights) * segmentLength;\n \n // density of the ozone layer is modeled as a triangular \n // function that is 30 km wide and centered at 25 km altitude\n opticalDepth.z += (1.0 - min(abs(height - 25e3) / 15e3, 1.0)) * segmentLength; \n t += segmentLength;\n }\n \n return opticalDepth;\n }\n \n vec3 transmittance(float height, float angle) \n {\n vec3 opticalDepth = opticalDepth(height, angle);\n return exp(-(rayleighScatteringCoefficient * opticalDepth.x + mieExtinctionCoefficient * opticalDepth.y + ozoneAbsorptionCoefficient * opticalDepth.z));\n }";
3
- export declare function transmittance(): Program;
4
- export declare function scattering(): Program;
2
+ import { NumberArray3 } from "../math/Vec3";
3
+ export interface AtmosphereParameters {
4
+ ATMOS_HEIGHT: number;
5
+ RAYLEIGH_SCALE: number;
6
+ MIE_SCALE: number;
7
+ GROUND_ALBEDO: number;
8
+ BOTTOM_RADIUS: number;
9
+ rayleighScatteringCoefficient: NumberArray3;
10
+ mieScatteringCoefficient: number;
11
+ mieExtinctionCoefficient: number;
12
+ ozoneAbsorptionCoefficient: NumberArray3;
13
+ SUN_ANGULAR_RADIUS: number;
14
+ SUN_INTENSITY: number;
15
+ ozoneDensityHeight: number;
16
+ ozoneDensityWide: number;
17
+ }
18
+ export declare const COMMON: (atmosParams?: AtmosphereParameters) => string;
19
+ export declare function transmittance(atmosParams?: AtmosphereParameters): Program;
20
+ export declare function scattering(atmosParams?: AtmosphereParameters): Program;
@@ -1,8 +1,9 @@
1
+ import { AtmosphereParameters } from "./atmos";
1
2
  import { Program } from "../webgl/Program";
2
3
  export declare function drawnode_screen_nl(): Program;
3
4
  export declare function drawnode_screen_wl_webgl1NoAtmos(): Program;
4
5
  export declare function drawnode_screen_wl_webgl2NoAtmos(): Program;
5
- export declare function drawnode_screen_wl_webgl2Atmos(): Program;
6
+ export declare function drawnode_screen_wl_webgl2Atmos(atmosParams?: AtmosphereParameters): Program;
6
7
  export declare function drawnode_colorPicking(): Program;
7
8
  export declare function drawnode_heightPicking(): Program;
8
9
  export declare function drawnode_depth(): Program;
@@ -19,6 +19,8 @@ type TileData = {
19
19
  extent: Extent | null;
20
20
  };
21
21
  /**
22
+ * @deprecated
23
+ * Use GlobusRgbTerrain
22
24
  * Class that loads segment elevation data, converts it to the array and passes it to the planet segment.
23
25
  * @class
24
26
  * @extends {GlobusTerrain}
@@ -56,6 +56,7 @@ export interface IDefaultTextureParams {
56
56
  * @param {Array.<string>} [params.extensions] - Additional WebGL extension list. Available by default: EXT_texture_filter_anisotropic.
57
57
  */
58
58
  declare class Handler {
59
+ protected _throttledDrawFrame: () => void;
59
60
  /**
60
61
  * Events.
61
62
  * @public
@@ -158,6 +159,7 @@ declare class Handler {
158
159
  resizeObserver?: ResizeObserver;
159
160
  protected _requestAnimationFrameId: number;
160
161
  constructor(canvasTarget: string | HTMLCanvasElement | undefined, params?: IHandlerParameters);
162
+ set frameDelay(delay: number);
161
163
  isInitialized(): boolean;
162
164
  protected _createCanvas(): void;
163
165
  /**
@@ -431,7 +433,7 @@ declare class Handler {
431
433
  * Draw single frame.
432
434
  * @public
433
435
  */
434
- drawFrame(): void;
436
+ drawFrame: () => void;
435
437
  /**
436
438
  * Clearing gl frame.
437
439
  * @public