@nanoforge-dev/graphics-3d
v3.0.0
Published
NanoForge Engine - Graphics 3D
Readme
About
@nanoforge-dev/graphics-3d is NanoForge's built-in 3D rendering library, powered by Three.js. It renders a Scene with a camera on a WebGPU canvas (WebGL2 fallback), once per engine tick, and exposes them on Context.graphics. Client-only. An app uses either graphics-2d or graphics-3d, not both.
Installation
Node.js 26 or newer is required. three is a peer dependency: install it next to the library, so the game and Three.js add-ons share one copy.
npm install @nanoforge-dev/graphics-3d three
yarn add @nanoforge-dev/graphics-3d three
pnpm add @nanoforge-dev/graphics-3d three
bun add @nanoforge-dev/graphics-3d threeExample usage
Register Graphics3DLibrary on your client app:
import { Graphics3DLibrary } from "@nanoforge-dev/graphics-3d";
app.use(new Graphics3DLibrary());Add Three.js objects to Context.graphics.scene. Three.js is re-exported from @nanoforge-dev/graphics-3d/three:
import {
BoxGeometry,
DirectionalLight,
Mesh,
MeshStandardMaterial,
} from "@nanoforge-dev/graphics-3d/three";
const cube = new Mesh(new BoxGeometry(1, 1, 1), new MeshStandardMaterial({ color: "#44aa88" }));
graphics.scene.add(cube, new DirectionalLight("white", 3));Links
Contributing
Before creating an issue, please ensure that it hasn't already been reported/suggested, and double-check the
documentation.
See the contribution guide if you'd like to submit a PR.
Help
If you don't understand something in the documentation, you are experiencing problems, or you just need a gentle nudge in the right direction, please don't hesitate to ask questions in discussions.
