Skip to content
loclvPublic

About

gs3d — a 3D engine for Goose, on the web. Three.js-compatible interface.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

goose-3d — a 3D engine for Goose, on the web

A small 3D engine written in Goose, a memory-safe systems language without a heap or garbage collector. It runs in the browser through WebGPU or WebGL2, and headlessly through a CPU reference renderer.

./build_web.sh --serve # build and open http://localhost:8080/
./build_native.sh --test # build and run native checks

See Getting started for prerequisites, native rendering, and tests. The browser build prefers WebGPU and falls back to WebGL2; Browser examples and benchmarks covers the viewer, games, supported renderer features, and measurements.

Three.js-compatible interface

The browser package provides a Three.js-style facade at gs3d/three (also available as gs3d/webgpu). For applications using the supported subset, change the import and initialize the renderer before rendering:

import * as THREE from 'gs3d/three';

const canvas = document.createElement('canvas');
const renderer = new THREE.WebGLRenderer({ canvas, antialias: true });
await renderer.init();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

const scene = new THREE.Scene();
const camera = new THREE.PerspectiveCamera(50, window.innerWidth / window.innerHeight, 0.1, 100);
camera.position.z = 5;
scene.add(new THREE.Mesh(new THREE.BoxGeometry(), new THREE.MeshBasicMaterial({ color: 0x44aa88 })));
renderer.setAnimationLoop(() => renderer.render(scene, camera));

The facade includes scene graphs, cameras, common geometries and materials, lights, textures, raycasting, and orbit controls. It is a subset, not a complete drop-in implementation of Three.js: some APIs, addons, shader and material behavior, and rendering results differ. Both renderer classes require an explicit canvas and await renderer.init() before rendering. The package also exposes its own gs3d/gltf-loader asset API, which is not Three.js's GLTFLoader interface. See the Three.js roadmap and browser documentation for current capabilities and limits.

Documentation

Repository-specific agent guides live in .agents/skills.

About

gs3d — a 3D engine for Goose, on the web. Three.js-compatible interface.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages