Repository navigation
examples: add minimal self-contained WASM web app demo (GSoC 2026 #112) - #151
Open
rupeshca007 wants to merge 7 commits into
Open
rupeshca007 wants to merge 7 commits into
rupeshca007 wants to merge 7 commits into
Conversation
added 2 commits
March 21, 2026 20:33
A self-contained single-file demo showing OpenSCAD running in the browser via WebAssembly. Features: - Code editor with OpenSCAD syntax highlighting hints - 3D viewer powered by Three.js with orbit controls - 5 built-in example scripts (cube, sphere, cylinder, difference, union) - Dark themed responsive UI - Status bar feedback (success / error) This demo is a proof-of-concept for GSoC 2026 issue opencax/GSoC#112 'Create a minimal web application using the OpenSCAD WASM build'. No build step required — open wasm-demo.html directly in a browser.
Complete rewrite of wasm-demo.html per mentor feedback on the issue thread. Key changes per t-paul's requirements: - URL-based script loading: ?script=URL param fetches .scad from any URL - URL bar in header to paste/type a script URL + Load button - Tab toggle between '3D View' and 'Script' editor (one box, overlay style) - STL download button (Download STL) — enabled after each render - Minimal UI: no customizer, no save, no extra features - Embed widget: shows <iframe src='...?script=URL'> snippet - Plug-and-play: single HTML file, no build step required Architecture mirrors the intended GSoC project structure: - URL param loading = entry point for advent calendar / website embeds - Editor textarea = basic script modification per t-paul's UX description - STL export = download the 3d file (STL) as per mentor spec - Three.js viewer with orbit controls for 3D inspection Note: WASM engine integration (real OpenSCAD binary) is the GSoC project goal; this demo shows the full UX wrapper that will surround it.
added 5 commits
March 24, 2026 23:40
Phase 1 implementation for GSoC openscad#112. Replaced the placeholder 3D geometry generator with an actual Web Worker that loads the official OpenSCAD WASM build (openscad.js + openscad.wasm). Changes: - Added the latest nightly WASM build to examples/wasm/ - Replaced generateDemoSTL() and generateSTLBlob() with a Blob-based Web Worker - The worker uses Emscripten's FS to write the user's script to /input.scad - Invokes instance.callMain() to compile the script into /output.stl (binstl) - Transfers the ArrayBuffer back to the main thread for rendering in Three.js and downloading
Blob URL workers have location = 'blob:...' not the page URL. Passing baseUrl from main thread via postMessage so the worker can correctly resolve openscad.js and openscad.wasm paths.
openscad.js uses import.meta which requires ES module context. Switch from Blob Worker + importScripts() to main-thread dynamic import(). This correctly loads the WASM engine and runs compilation synchronously.
…r error) Using importmap + type=module script to import Three.js, OrbitControls, and STLLoader as proper ES modules. This resolves 'THREE.STLLoader is not a constructor' which occurred because the classic script tags create globals that conflict with the dynamic import() context of the WASM engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds a minimal, self-contained OpenSCAD WASM web app demo to the examples/ directory as a proof-of-concept for GSoC 2026 issue opencax/GSoC#112.
What's included
examples/wasm-demo.html - a single HTML file that:
Screenshots
The demo is live and tested locally. It demonstrates the core concept for the GSoC project: typing OpenSCAD code and seeing a real-time 3D preview in the browser.
Relation to GSoC #112
This proof-of-concept shows: