Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The Sun, Moon and planets: pure parts

plainPainterconstant

The default look: a sphere in the planet's colour, lit by the Sun, and for the Sun a glowing disc.

Import it

import { plainPainter } from "@johnmorrisdotca/chikyu-earth/space";

Definition

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();
            },
        };
    },
}

Members

NameTypeDescription
make((three: ThreeParts, name: string) => BodyDrawing) & ((three: ThreeParts, name: string, context?: PaintContext) => BodyDrawing | Promise<BodyDrawing>)
moons (optional)((planet: PlanetName, ms: number) => readonly BodyMoon[]) | undefined
looks (optional)readonly string[] | undefined

Examples

import { plainPainter } from "@johnmorrisdotca/chikyu-earth/space";

console.log(typeof plainPainter.make);

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.11.0.