create3dApp
Creates a Three.js WebGPU application instance. Each call returns an independent instance, supporting multiple instances on the same page.
Usage
ts
import { create3dApp } from '@threeuse/core'
const app = create3dApp({
antialias: true,
camera: { fov: 75, position: [0, 0, 5] },
})
app.mount('#canvas-container')Options
| Option | Type | Default | Description |
|---|---|---|---|
antialias | boolean | true | Enable antialiasing |
alpha | boolean | false | Transparent background |
camera | Partial<CameraOptions> | — | Initial camera parameters |
autoResize | boolean | true | Auto-observe container resize |
Return Value
ThreeUseApp object containing:
renderer— WebGPURenderer instancescene— Three.js Scenecamera— PerspectiveCameracanvas— renderer.domElementmount(container)— Mount to DOM and start render loopunmount()— Stop loop and clean up resourcesuse(plugin)— Install plugin, supports chainingon/emit/off— Pub/Sub eventsonBeforeRender/onAfterRender— Render callbacksglobalProperties— Plugin mount point (app.$xxx)config.errorHandler/config.warnHandler— Custom error/warning handlers