toGlb関数
リファレンスの説明と例は英語です。見出しと目次は日本語です。
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 { toGlb } from "@johnmorrisdotca/uchusen-rockets/build";
定義
function toGlb(parts: readonly GlbPart[]): Glb
引数
| 名前 | 型 | 説明 |
|---|---|---|
parts | readonly GlbPart[] | The parts to write: each has a node name, its mesh and where it stands in metres. |
戻り値
Glb
The file's bytes and its triangle count.
例
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出力(このページを作ったときに実行した結果)
この日本語は、まだ日本語を母語とする方の確認を受けていません。訂正を歓迎します。