Skip to the content

Uchusen Rockets宇宙船

Rockets drawn from sourced sizes: line drawings and painted 3D views you drop into a page, take apart and turn round, and a typed model that checks whether a rocket really goes together.

Uchusen is the Japanese word 宇宙船 for spaceship. About the name

Contents

Reference · Build a mesh and a drawing

toGlbfunction

Writes parts into one small binary glTF file, in Node or a browser, with no dependency: one node for each part and one primitive for each material. The same parts always give the same bytes.

Import it

import { toGlb } from "@johnmorrisdotca/uchusen-rockets/build";

Definition

function toGlb(parts: readonly GlbPart[]): Glb

Parameters

NameTypeDescription
partsreadonly GlbPart[]

The parts to write: each has a node name, its mesh and where it stands in metres.

Returns

Glb

The file's bytes and its triangle count.

Examples

import { build, toGlb } from "@johnmorrisdotca/uchusen-rockets/build";

const rocket = build({ rocket: "falcon-9", variant: "block-5" });
const glb = toGlb(rocket.parts.map((part) => ({ name: part.slot, mesh: part.mesh, at: [0, 0, 0] as const })));
console.log(glb.bytes.length > 1000, glb.triangles > 0);
true true

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/uchusen-rockets 0.14.0.