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

58 lines (51 loc) 1.69 kB
import "./engine/engine_element.js"; import "./engine/engine_setup.js"; import "./engine/engine_audio.js"; export * from "./engine/api.js"; export * from "./engine-components/api.js"; export * from "./engine-components-experimental/api.js"; export * from "./engine-schemes/api.js"; // make accessible for external javascript import { Context, loadSync, NeedleXRSession, onBeforeRender, onStart, onUpdate } from "./engine/api.js"; const Needle = { Context: Context, glTF: { loadFromURL: loadSync, } }; if (globalThis["Needle"] !== undefined) { console.warn("Needle Engine is already imported"); } globalThis["Needle"] = Needle; function registerGlobal(obj: object) { for (const key in obj) { Needle[key] = obj[key]; } } import * as Component from "./engine-components/Component.js"; registerGlobal(Component); import * as Components from "./engine-components/codegen/components.js"; registerGlobal(Components); Needle["onStart"] = onStart; Needle["onUpdate"] = onUpdate; Needle["onBeforeRender"] = onBeforeRender; Needle["NeedleXRSession"] = NeedleXRSession; import { GameObject } from "./engine-components/Component.js"; for (const method of Object.getOwnPropertyNames(GameObject)) { switch (method) { case "prototype": case "constructor": case "length": case "name": continue; default: Needle[method] = GameObject[method]; break; } } // make three accessible import * as THREE from "three"; if (!globalThis["THREE"]) { globalThis["THREE"] = THREE; } else console.warn("Threejs is already imported");