本文へ移動

Chikyu Earth地球

世界の国の輪郭を線で描いた地球儀です。地球と同じ速さで回ります。宇宙から見たような地球と、好きな場所の目印も使えます。

「地球」(ちきゅう) は、私たちが住む星の名前です。 名前について(英語)

目次

リファレンス · 太陽、月、惑星: 計算部分

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);

ソースを見るGitHub で編集@johnmorrisdotca/chikyu-earth 0.11.0 のソースから作成しました。

この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。