mirror of
https://github.com/syoyo/tinygltf.git
synced 2026-08-13 08:49:35 +00:00
web/ compiles the v3 C runtime with emcc (Emscripten SDK from ~/work/emsdk by default) and ships a simple browser demo that loads glTF/GLB files via drag & drop and renders them with three.js: - loader.c: C bridge exporting flattened primitives, materials, textures (bufferView + data-URI paths) and the scene graph to JS - main.js/index.html/style.css: three.js viewer (OrbitControls, PBR materials, textures, node hierarchy, primitive modes) - gen_sample.py: generates a small self-contained textured Cube.glb sample from tracked assets (no large binaries committed) - Makefile: emcc build (MODULARIZE + ES6, no filesystem), sample generation and local http server targets Verified end-to-end: native bridge tests, Node harness exercising the WASM exports (parse, geometry, images, clear) and HTTP serving.
29 lines
961 B
HTML
29 lines
961 B
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>tinygltf v3 — three.js WASM demo</title>
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<h1>tinygltf v3 (C) + three.js</h1>
|
|
<div class="controls">
|
|
<label class="btn" for="file-input">Open glTF/GLB…</label>
|
|
<input type="file" id="file-input" accept=".gltf,.glb,model/gltf+json,model/gltf-binary" hidden>
|
|
<button class="btn" id="sample-btn" hidden>Load sample (Cube.glb)</button>
|
|
</div>
|
|
</header>
|
|
<main>
|
|
<div id="drop-zone">
|
|
<p>Drop a <code>.glb</code> / <code>.gltf</code> file here, or use <b>Open glTF/GLB…</b></p>
|
|
<p class="hint">Note: assets must be self-contained (GLB chunk or embedded data URI).</p>
|
|
</div>
|
|
<div id="viewer" hidden></div>
|
|
</main>
|
|
<footer id="status">Loading WASM module…</footer>
|
|
<script type="module" src="main.js"></script>
|
|
</body>
|
|
</html>
|