Skip to content

Interface: BodyBase ​

Fields common to every body handle — identity, state, lifecycle, radii, interactive + hover namespaces. Both PlanetBody and StarBody extend this base; the union Body is what useBody() actually returns.

Extended by ​

Properties ​

group ​

ts
group: Group;

config ​

ts
config: BodyConfig;

sim ​

ts
sim: BodySimulation;

palette ​

ts
palette: TerrainLevel[];

variation ​

ts
variation: BodyVariation;

tileCount ​

ts
tileCount: number;

Number of sol tiles generated by the hexasphere.


shadowUniforms ​

ts
shadowUniforms: ShadowUniforms;

occluderUniforms ​

ts
occluderUniforms: OccluderUniforms;

planetMaterial ​

ts
planetMaterial: BodyMaterial;

hoverChannel ​

ts
hoverChannel: HoverChannel;

graphicsUniforms ​

ts
graphicsUniforms: GraphicsUniforms;

interactive ​

ts
interactive: BodyInteractive;

hover ​

ts
hover: BodyHover;

Methods ​

tick() ​

ts
tick(dt): void;

Parameters ​

ParameterType
dtnumber

Returns ​

void


dispose() ​

ts
dispose(): void;

Returns ​

void


warmup() ​

ts
warmup(
   renderer, 
   camera, 
options?): Promise<void>;

Pre-compiles every shader the body relies on, exploiting KHR_parallel_shader_compile when available so the CPU stays responsive while the GPU driver links programs in the background.

Call once after useBody() and before the first render — the caller is expected to keep a loader / skeleton visible until the promise resolves. Subsequent calls are inexpensive (Three.js caches compiled programs by material identity).

onProgress fires at each phase boundary — at the start (collecting), after every compile resolves, and at the end (done). Use it to drive a loading bar or a status string. Phase codes are stable across lib versions; see WarmupPhase.

Multi-camera scenes only need a single warmup pass — Three.js compiled programs are not bound to a specific camera matrix.

Parameters ​

ParameterTypeDescription
rendererWebGLRendererRenderer that owns the WebGL context. Programs are compiled into this renderer's program cache.
cameraCameraCamera used to derive view-dependent uniforms during compilation. Any scene camera works.
options?WarmupOptionsOptional progress hook.

Returns ​

Promise<void>


getCoreRadius() ​

ts
getCoreRadius(): number;

World radius of the opaque inner core sphere (radius * coreRadiusRatio).

Returns ​

number


getSurfaceRadius() ​

ts
getSurfaceRadius(): number;

World radius of the outer surface (= config.radius).

Returns ​

number

Distribué sous la licence indiquée dans le dépôt.