Reference · How a body is drawn with three.js
registerLookfunction
Teach the package how to draw a body in three.js. Each body's entry point (@johnmorrisdotca/wakusei-planets/jupiter) calls this once as it loads; call it yourself to add or replace a look.
Import it
import { registerLook } from "@johnmorrisdotca/wakusei-planets/look";
Definition
function registerLook(look: BodyLook): BodyLook
Parameters
| Name | Type | Description |
|---|---|---|
look | BodyLook | The body's name and its shader code, atmosphere and map. |
Returns
BodyLook
The look, as it was given.
Examples
import { registerLook, lookOf } from "@johnmorrisdotca/wakusei-planets/look";
registerLook({ id: "moon", surface: "vec4 surface(vec3 p) { return vec4(vec3(0.6), 0.0); }" });
console.log(lookOf("moon")?.id);moonWhat it prints (run when this page was built)