Manager Module
The manager module is the backbone of the current app architecture. It organises functionality into focused manager classes instead of a monolithic app. This Manager-based Architecture provides clear separation of concerns, improved testability, and better extensibility.
Overview
Key managers provided by this module:
- ModelManager – stores model metadata, visibility, and provides unified model interface
- FileLoader – loads and parses multiple Gaussian formats (PLY, SPZ, KSplat, SPLAT, SOG, Compressed PLY) and FBX
- GaussianLoader – high-level convenience service that wraps FileLoader and ONNXManager to create GaussianModel instances
- ONNXManager – loads ONNX models and orchestrates GPU-side inference
- FBXLoaderManager – specialized loader for FBX mesh files
- CameraManager – manages view/projection state and controller switching (Orbit/FPS)
- AnimationManager – updates dynamic models (ONNX-driven or otherwise) with throttling and performance tracking
- RenderLoop – owns the render/update loop, frame scheduling, and FPS tracking
Architectural Principles
- Single Responsibility – each manager focuses on one functional area
- Dependency Injection – managers receive collaborators via constructors for testability
- Interface Separation – clear contracts keep coupling low
- Open/Closed – managers are easy to extend without modifying existing code
- Manager Coordination – App class orchestrates managers but doesn't own their logic
- Format Agnostic – FileLoader uses IO module's
defaultLoaderfor unified format handling
Usage
Basic
const modelManager = new ModelManager(10_000);
const cameraManager = new CameraManager();
const animationManager = new AnimationManager(modelManager);
const renderLoop = new RenderLoop(modelManager, animationManager, cameraManager);
// Setup loading callbacks
const loadingCallbacks = {
onProgress: (show, text, pct) => console.log(`Loading: ${pct}%`),
onError: (msg) => console.error(msg),
};
const fileLoader = new FileLoader(modelManager, loadingCallbacks);
const onnxManager = new ONNXManager(modelManager);
const gaussianLoader = new GaussianLoader(fileLoader, onnxManager);
const app = new App();
await app.init();
Advanced - Direct Manager Access
const app = new App();
await app.init();
// Access managers directly for advanced operations
const modelManager = app.getModelManager();
const fileLoader = app.getFileLoader();
const onnxManager = app.getONNXManager();
const cameraManager = app.getCameraManager();
const animationManager = app.getAnimationManager();
const renderLoop = app.getRenderLoop();
// Use GaussianLoader for high-level model creation
const gaussianLoader = new GaussianLoader(fileLoader, onnxManager);
const model = await gaussianLoader.createFromGaussian(renderer, 'model.spz');
Loading Different Formats
// Load Gaussian formats via FileLoader
await fileLoader.loadFile(file, device); // Auto-detects format
await fileLoader.loadSample('model.spz', device, 'gaussian');
// Load via GaussianLoader (creates GaussianModel)
const model = await gaussianLoader.createFromSPZ(renderer, 'model.spz');
const model2 = await gaussianLoader.createFromKSplat(renderer, 'model.ksplat');
const model3 = await gaussianLoader.createFromONNX(renderer, 'model.onnx', camMat, projMat);
Related Docs
- Architecture – Explains manager orchestration, dependency injection, and lifecycles.
- API Reference – Per-manager method surface plus shared interfaces.
- App Module – Shows how the managers are composed inside the runtime shell.