marti
v0.0.2
Published
An open-source 3D engine for WebGPU.
Downloads
140
Readme
Marti
An open-source 3D engine for WebGPU.
Features
- WebGPU-based rendering
- Modular architecture
- 3D primitives and custom geometries
- Material system with shader customization
- Texture and video texture support
- Scene graph management
- Camera controls
Installation
npm install marti
Basic Usage
import {
Renderer,
Scene,
Camera,
Mesh,
BoxGeometry,
Material,
} from 'marti';
const renderer = new Renderer();
await renderer.initialize();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
const scene = new Scene();
const camera = new Camera(75, 0.1, 100, window.innerWidth / window.innerHeight);
camera.position.z = 5;
const geometry = new BoxGeometry(1, 1, 1);
const material = new Material(shaderCode);
const mesh = new Mesh(geometry, material);
scene.add(mesh);
function animate() {
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.01;
renderer.render(scene, camera);
requestAnimationFrame(animate);
}
animate();
Core Components
- Renderer: Handles WebGPU rendering and compute operations
- Scene: Manages the 3D scene graph
- Camera: Defines view and projection
- Mesh: Combines geometry and material
- Geometry: Defines vertex data
- Material: Manages shaders and uniforms
- Texture: Handles 2D textures
- VideoTexture: Supports video textures
- Vector3 and Vector4: Represent 3D and 4D vectors
- Matrix4: Handles 4x4 matrix operations
- TextureLoader: Loads textures from URLs
- Compute: Manages compute shader operations
- ComputeBuffer: Handles data for compute shaders
Development
- Clone the repository
- Install dependencies:
npm install
- Build:
npm run build
Contributing
See CONTRIBUTING.md for details.
Documentation
For detailed documentation on each component, please refer to the documentation file.
Examples
Check out our example implementations:
License
MIT License