plainPainter定数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
The default look: a sphere in the planet's colour, lit by the Sun, and for the Sun a glowing disc.
インポート
import { plainPainter } from "@johnmorrisdotca/chikyu-earth/space";
定義
const plainPainter: { make(three: ThreeParts, name: string): BodyDrawing; } & BodyPainter = {
make(three, name) {
if (name === "Sun") {
const geometry = quad(three);
const material = new three.ShaderMaterial({ vertexShader: GLOW_VERT, fragmentShader: GLOW_FRAG, uniforms: { tint: { value: new three.Color(PLAIN_COLOR(name)) } }, transparent: true, depthWrite: false });
const mesh = new three.Mesh(geometry, material);
mesh.renderOrder = 4;
mesh.frustumCulled = false;
mesh.scale.setScalar(3.2);
const group = new three.Group();
group.add(mesh);
return {
object: group,
billboard: true,
dispose() {
geometry.dispose();
material.dispose();
},
};
}
const geometry = sphere(three, 48, 24);
const sun = { value: new three.Vector3(1, 0, 0) };
const material = new three.ShaderMaterial({ vertexShader: SURFACE_VERT, fragmentShader: BODY_FRAG, uniforms: { map: { value: null }, tint: { value: new three.Color(PLAIN_COLOR(name)) }, textured: { value: 0 }, sunDir: sun, ambient: { value: 0.2 } } });
return {
object: new three.Mesh(geometry, material),
light(toSun) {
sun.value.set(toSun[0], toSun[1], toSun[2]);
},
dispose() {
geometry.dispose();
material.dispose();
},
};
},
}
メンバー
| 名前 | 型 | 説明 |
|---|---|---|
make | ((three: ThreeParts, name: string) => BodyDrawing) & ((three: ThreeParts, name: string, context?: PaintContext) => BodyDrawing | Promise<BodyDrawing>) | |
moons (省略可) | ((planet: PlanetName, ms: number) => readonly BodyMoon[]) | undefined | |
looks (省略可) | readonly string[] | undefined |
例
import { plainPainter } from "@johnmorrisdotca/chikyu-earth/space";
console.log(typeof plainPainter.make);この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。