@openglobus/og 1.0.0-rc10 → 1.0.0-rc11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/Globe.d.ts CHANGED
@@ -42,6 +42,7 @@ export interface IGlobeParams {
42
42
  sun?: {
43
43
  active?: boolean;
44
44
  stopped?: boolean;
45
+ localDateTime?: Date | null;
45
46
  };
46
47
  navigation?: {
47
48
  active?: boolean;
@@ -128,7 +128,7 @@ declare class PlanetCamera extends Camera {
128
128
  * @public
129
129
  * @param {LonLat} lonlat - New camera and camera view position.
130
130
  * @param {LonLat} [lookLonLat] - Look up coordinates.
131
- * @param {Vec3} [up] - Camera UP vector. Default (0,1,0)
131
+ * @param {Vec3} [up] - Camera UP vector. Defaults to the local surface normal for an explicit look point.
132
132
  */
133
133
  setLonLat(lonlat: LonLat, lookLonLat?: LonLat, up?: Vec3): void;
134
134
  /**
@@ -1,20 +1,44 @@
1
1
  import { Control } from "./Control";
2
2
  import type { IControlParams } from "./Control";
3
3
  import { Clock } from "../Clock";
4
+ import type { JulianDate } from "../astro/jd";
4
5
  import { Vec3 } from "../math/Vec3";
6
+ import type { PlanetCamera } from "../camera/PlanetCamera";
5
7
  interface ISunParams extends IControlParams {
6
8
  activationHeight?: number;
7
9
  offsetVertical?: number;
8
10
  offsetHorizontal?: number;
9
11
  stopped?: boolean;
12
+ localDateTime?: Date | null;
10
13
  }
11
14
  /**
12
15
  * Real Sun geocentric position control that place the Sun on the right place by the Earth.
16
+ * @class
17
+ *
18
+ * @example <caption>Lighting frozen at 21:30 local solar time under the camera</caption>
19
+ * new Sun({ localDateTime: new Date(2026, 7, 3, 21, 30) })
20
+ *
21
+ * @param {ISunParams} [options] - Options:
22
+ * @param {number} [options.activationHeight=12079000.0] - Camera height above which the Sun takes its real position by the clock.
23
+ * @param {number} [options.offsetVertical=-5000000] - Vertical offset of the camera following light.
24
+ * @param {number} [options.offsetHorizontal=5000000] - Horizontal offset of the camera following light.
25
+ * @param {boolean} [options.stopped=false] - Stops the control, leaving the Sun on its real position by the clock.
26
+ * @param {Date} [options.localDateTime] - Lights the scene by a fixed local apparent solar time under the camera
27
+ * instead of the camera following light, below activationHeight. At 12:00 the Sun stands on the meridian there,
28
+ * while the date sets the season. Read for the wall clock numbers it shows locally, so it is not an instant in
29
+ * time: one parsed from an absolute timestamp reads as the machine's time zone renders it. The Clock is left
30
+ * untouched, and while the control is stopped this is ignored.
13
31
  */
14
32
  export declare class Sun extends Control {
15
33
  activationHeight: number;
16
34
  offsetVertical: number;
17
35
  offsetHorizontal: number;
36
+ /**
37
+ * Fixed local apparent solar time under the camera, or null for the camera following light.
38
+ * @public
39
+ * @type {Date | null}
40
+ */
41
+ localDateTime: Date | null;
18
42
  protected _currDate: number;
19
43
  protected _prevDate: number;
20
44
  protected _clockPtr: Clock | null;
@@ -30,7 +54,37 @@ export declare class Sun extends Control {
30
54
  onactivate(): void;
31
55
  bindClock(clock: Clock): void;
32
56
  getPosition(): Vec3;
57
+ /**
58
+ * Sets a fixed local apparent solar time under the camera.
59
+ * @public
60
+ * @param {Date | null} localDateTime - Local date and time, or null to restore the camera following light.
61
+ */
62
+ setLocalDateTime(localDateTime: Date | null): void;
33
63
  protected _setSunPosition3v(position: Vec3): void;
64
+ /**
65
+ * Returns a light position offset from the camera along its own up and right axes,
66
+ * so that nearby terrain is lit regardless of the real Sun direction.
67
+ * @protected
68
+ * @param {PlanetCamera} cam - Planet camera.
69
+ * @returns {Vec3} -
70
+ */
71
+ protected _getCameraFollowingPosition(cam: PlanetCamera): Vec3;
72
+ /**
73
+ * Returns the julian date at which localDateTime is the local apparent solar time at lon.
74
+ * Local mean solar time is the first guess, then the measured subsolar longitude corrects it;
75
+ * that point drifts -360 degrees a day, so a residual of d degrees is worth -d / 360 of a day.
76
+ * @protected
77
+ * @param {number} lon - Longitude under the camera, degrees.
78
+ * @returns {JulianDate} -
79
+ */
80
+ protected _getLocalDateTimeJulian(lon: number): JulianDate;
81
+ /**
82
+ * Returns the Sun position for localDateTime at the location under the camera.
83
+ * @protected
84
+ * @param {PlanetCamera} cam - Planet camera.
85
+ * @returns {Vec3} -
86
+ */
87
+ protected _getLocalDateTimePosition(cam: PlanetCamera): Vec3;
34
88
  protected _draw(): void;
35
89
  }
36
90
  export {};