🚀
GPU-Driven Rendering
Utilizes storage buffers, indirect drawing, and compute shader culling for efficient rendering of complex scenes.
A lightweight, GPU-driven 3D rendering library built on WebGPU
npm install gfxliteimport {
Renderer,
Scene,
Mesh,
BoxGeometry,
BasicMaterial,
PerspectiveCamera,
Vector3,
} from "gfxlite";
// Create renderer with canvas
const renderer = new Renderer(canvas);
// Create scene and camera
const scene = new Scene();
const camera = new PerspectiveCamera(60, 800 / 600, 0.1, 1000);
camera.position = new Vector3(0, 0, 3);
// Create a mesh
const cube = new Mesh(
new BoxGeometry({
width: 1,
height: 1,
depth: 1,
}),
new BasicMaterial({ color: new Vector3(0.2, 0.5, 1.0) }),
);
scene.add(cube);
// Render loop
function animate() {
cube.rotateX(0.01);
cube.rotateY(0.01);
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();