Interface INeedleGLTFExtensionPlugin

Interface for registering custom glTF extensions to the Needle Engine GLTFLoaders.
Register your plugin using the addCustomExtensionPlugin method

interface INeedleGLTFExtensionPlugin {
    name: string;
    onExport?: OnExportCallback;
    onImport?: OnImportCallback;
    onLoaded?: (url: string, gltf: GLTF, context: Context) => void;
}

Properties

name: string

The Name of your plugin

onExport?: OnExportCallback

Called before starting to export a glTF file. This callback can be used to add custom extensions to the GLTFExporter

onExport: (exporter, context) => {
exporter.register((writer) => new MyCustomExportExtension(writer));
onImport?: OnImportCallback

Called before starting to load a glTF file. This callback can be used to add custom extensions to the GLTFLoader

onImport: (loader, url, context) => {
loader.register((parser) => new MyCustomExtension(parser));
}
onLoaded?: (url: string, gltf: GLTF, context: Context) => void

Called after a glTF file has been loaded