Reference · The Sun, Moon and planets: pure parts
BodyDrawingtype
One body as drawn by a painter: an object of radius 1 at the origin, which the scene places, scales and (for the Sun) turns to face the camera.
Import it
import type { BodyDrawing } from "@johnmorrisdotca/chikyu-earth/space";
Definition
interface BodyDrawing {
object: THREE.Object3D;
light?(toSun: Vec3): void;
update?(info: {
toSun: Vec3;
ms: number;
radiusPx: number;
}): void;
billboard?: boolean;
dispose(): void;
}
Members
| Name | Type | Description |
|---|---|---|
object | THREE.Object3D<THREE.Object3DEventMap> | |
light (optional) | ((toSun: Vec3) => void) | undefined | Told at each draw the unit direction from the body to the Sun, in scene axes (x to the vernal equinox, y north). |
update (optional) | ((info: { toSun: Vec3; ms: number; radiusPx: number; }) => void) | undefined | Told at each draw, after the object is placed and scaled: the direction to the Sun, the moment shown, and how many CSS pixels across its radius the body is (a sharper picture is worth fetching only for a big one). |
billboard (optional) | boolean | undefined | True to have the scene turn the object to face the camera (a disc or a glow). |
dispose | (): void |
Examples
import type { BodyDrawing } from "@johnmorrisdotca/chikyu-earth/space";
const drawing = { object: undefined as never, dispose: () => undefined } satisfies BodyDrawing;
console.log(typeof drawing.dispose);