Start Here
Three.js Provider
How the ThreeJSProvider bridges StringTune-3D to Three.js and where you can swap loaders or engine features.
Three.js Provider
ThreeJSProvider is the default engine bridge shipped by the package. It adapts three to the I3DEngineProvider and I3DEngine contracts used by the runtime.
Base setup
TypeScript
import { String3D, ThreeJSProvider } from 'string-tune-3d';
import * as THREE from 'three';
String3D.setProvider(new ThreeJSProvider(THREE));
Optional loader map
If you need custom loaders, pass them to the provider constructor.
TypeScript
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
import { FontLoader } from 'three/examples/jsm/loaders/FontLoader.js';
String3D.setProvider(
new ThreeJSProvider(THREE, {
gltf: GLTFLoader,
font: FontLoader,
}),
);
What the provider supplies
- scene creation
- camera creation
- geometry factories
- material factories
- texture loading
- model loading
- font loading
- post-process runtime hooks
- capability reporting
When to look deeper
Use the provider page as the boundary line:
- if you only need normal Three.js usage,
ThreeJSProvideris enough - if you want another backend, you implement
I3DEngineProvider - if you want custom materials or custom filters on top of Three.js, stay in the registry APIs instead of rewriting the provider