UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

33 lines (32 loc) 2.09 kB
import { Loader } from "three"; import { GLTFExporter } from "three/examples/jsm/exporters/GLTFExporter.js"; import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js"; import { Context } from "../engine_setup.js"; import { GLTF } from "../engine_types.js"; import { NEEDLE_components } from "./NEEDLE_components.js"; declare type OnImportCallback = (loader: GLTFLoader, url: string, context: Context) => void; declare type OnExportCallback = (exporter: GLTFExporter, context: Context) => void; /** * Interface for registering custom glTF extensions to the Needle Engine GLTFLoaders. Register your plugin via {@link addCustomExtensionPlugin} */ export interface INeedleGLTFExtensionPlugin { /** The Name of your plugin */ name: string; /** Called before starting to load a glTF file. This callback can be used to add custom extensions to the GLTFLoader */ onImport?: OnImportCallback; /** Called after the glTF has been loaded */ onLoaded?: (url: string, gltf: GLTF, context: Context) => void; /** Called before starting to export a glTF file. This callback can be used to add custom extensions to the GLTFExporter */ onExport?: OnExportCallback; } /** Register callbacks for registering custom gltf importer or exporter plugins */ export declare function addCustomExtensionPlugin(ext: INeedleGLTFExtensionPlugin): void; /** Unregister callbacks for registering custom gltf importer or exporter plugins */ export declare function removeCustomImportExtensionType(ext: INeedleGLTFExtensionPlugin): void; /** Registers the Needle Engine components extension */ export declare function registerComponentExtension(loader: GLTFLoader | Loader | object): NEEDLE_components | null; export declare function registerExtensions(loader: GLTFLoader, context: Context, url: string): Promise<void>; export declare function registerExportExtensions(exp: GLTFExporter, context: Context): void; /** @internal */ export declare function invokeLoadedImportPluginHooks(url: string, gltf: GLTF, context: Context): void; export {};