@kirknock/node-openxr-babylonjs 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,8 +6,10 @@
6
6
  Plain browser-style Babylon.js WebXR helpers the node-openxr demo app is
7
7
  built from: `create-engine`, `xr` (WebXRDefaultExperience setup),
8
8
  `list-files`, `load-asset`, `asset-slideshow`, `dot-grid-floor`,
9
- `controller-visuals`, `controller-log`. Imports only `@babylonjs/*` (peer
10
- dependencies), so it runs in a browser unchanged.
9
+ `controller-visuals`, `controller-log`, and `babylon-namespace` (the UMD
10
+ bundles' `BABYLON` global, `BABYLON.Debug` and `BABYLON.GLTF2.Loader.Extensions`
11
+ included, built from the ES modules for snippet-style code). Imports only
12
+ `@babylonjs/*` (peer dependencies), so it runs in a browser unchanged.
11
13
 
12
14
  ## Install
13
15
 
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The `BABYLON` global of Babylon.js's UMD bundles (babylon.js plus
3
+ * babylonjs.loaders, .gui, .materials, ...), built from the ES module
4
+ * packages, for code written against the global: playground snippets,
5
+ * Babylon's own test scenes, older samples.
6
+ *
7
+ * Most of it is the packages' exports merged into one object. What the UMD
8
+ * entry points add on top, and the ES modules export flat instead:
9
+ * - BABYLON.Debug: AxesViewer, BoneAxesViewer, PhysicsViewer, RayHelper,
10
+ * SkeletonViewer, DirectionalLightFrustumViewer, ... (core Legacy/legacy.ts)
11
+ * - BABYLON.GLTF2.Loader and BABYLON.GLTF2.Loader.Extensions: the glTF 2.0
12
+ * loader's extension classes (loaders legacy/legacy-glTF2.ts)
13
+ * - BABYLON.GUI: @babylonjs/gui, when given
14
+ *
15
+ * Plain Babylon.js, usable in a browser as well. Pass the module namespaces:
16
+ *
17
+ * const BABYLON = createBabylonNamespace({ core, loaders, gui, materials, ... });
18
+ */
19
+ type Namespace = Record<string, unknown>;
20
+ export interface BabylonModules {
21
+ /** `import * as core from "@babylonjs/core"` */
22
+ core: Namespace;
23
+ /** `@babylonjs/loaders`: its GLTF2 namespace gains Loader and Loader.Extensions. */
24
+ loaders?: Namespace;
25
+ /** `@babylonjs/gui`, as BABYLON.GUI */
26
+ gui?: Namespace;
27
+ /** Packages merged flat, as their UMD bundles add to BABYLON: materials, procedural-textures, post-processes, serializers, ... */
28
+ others?: Namespace[];
29
+ }
30
+ export declare function createBabylonNamespace({ core, loaders, gui, others }: BabylonModules): Namespace;
31
+ export {};
@@ -0,0 +1,42 @@
1
+ /**
2
+ * The `BABYLON` global of Babylon.js's UMD bundles (babylon.js plus
3
+ * babylonjs.loaders, .gui, .materials, ...), built from the ES module
4
+ * packages, for code written against the global: playground snippets,
5
+ * Babylon's own test scenes, older samples.
6
+ *
7
+ * Most of it is the packages' exports merged into one object. What the UMD
8
+ * entry points add on top, and the ES modules export flat instead:
9
+ * - BABYLON.Debug: AxesViewer, BoneAxesViewer, PhysicsViewer, RayHelper,
10
+ * SkeletonViewer, DirectionalLightFrustumViewer, ... (core Legacy/legacy.ts)
11
+ * - BABYLON.GLTF2.Loader and BABYLON.GLTF2.Loader.Extensions: the glTF 2.0
12
+ * loader's extension classes (loaders legacy/legacy-glTF2.ts)
13
+ * - BABYLON.GUI: @babylonjs/gui, when given
14
+ *
15
+ * Plain Babylon.js, usable in a browser as well. Pass the module namespaces:
16
+ *
17
+ * const BABYLON = createBabylonNamespace({ core, loaders, gui, materials, ... });
18
+ */
19
+ /** The names core's Debug namespace holds in the UMD bundle (Debug/index.ts). */
20
+ const DEBUG_NAMES = ["AxesViewer", "BoneAxesViewer", "DebugLayer", "DebugLayerTab", "PhysicsViewer", "RayHelper", "SkeletonViewer", "DirectionalLightFrustumViewer"];
21
+ export function createBabylonNamespace({ core, loaders, gui, others = [] }) {
22
+ const BABYLON = { ...core, ...(loaders ?? {}) };
23
+ for (const module of others)
24
+ Object.assign(BABYLON, module);
25
+ if (gui !== undefined)
26
+ BABYLON.GUI = { ...gui };
27
+ const debug = {};
28
+ for (const name of DEBUG_NAMES)
29
+ if (core[name] !== undefined)
30
+ debug[name] = core[name];
31
+ BABYLON.Debug = debug;
32
+ const gltf2 = loaders?.GLTF2;
33
+ if (gltf2 !== undefined) {
34
+ // The UMD bundle's GLTF2.Loader.Extensions holds the extension classes
35
+ // (KHR_*, EXT_*, MSFT_*, ExtrasAsMetadata, ...); GLTF2 itself has them too,
36
+ // so the whole namespace serves for both lookups.
37
+ const extensions = { ...gltf2 };
38
+ BABYLON.GLTF2 = { ...gltf2, Loader: { ...gltf2, Extensions: extensions } };
39
+ }
40
+ return BABYLON;
41
+ }
42
+ //# sourceMappingURL=babylon-namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"babylon-namespace.js","sourceRoot":"","sources":["../src/babylon-namespace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,iFAAiF;AACjF,MAAM,WAAW,GAAG,CAAC,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,WAAW,EAAE,gBAAgB,EAAE,+BAA+B,CAAC,CAAC;AAarK,MAAM,UAAU,sBAAsB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,EAAkB;IACxF,MAAM,OAAO,GAAc,EAAE,GAAG,IAAI,EAAE,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;IAC3D,KAAK,MAAM,MAAM,IAAI,MAAM;QAAE,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC5D,IAAI,GAAG,KAAK,SAAS;QAAE,OAAO,CAAC,GAAG,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;IAEhD,MAAM,KAAK,GAAc,EAAE,CAAC;IAC5B,KAAK,MAAM,IAAI,IAAI,WAAW;QAAE,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,SAAS;YAAE,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACvF,OAAO,CAAC,KAAK,GAAG,KAAK,CAAC;IAEtB,MAAM,KAAK,GAAG,OAAO,EAAE,KAA8B,CAAC;IACtD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,uEAAuE;QACvE,4EAA4E;QAC5E,kDAAkD;QAClD,MAAM,UAAU,GAAc,EAAE,GAAG,KAAK,EAAE,CAAC;QAC3C,OAAO,CAAC,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,EAAE,GAAG,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,CAAC;IAC7E,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirknock/node-openxr-babylonjs",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "type": "module",
5
5
  "description": "Plain browser-style Babylon.js WebXR helpers (engine, default XR experience, asset loading and slideshow, floor, controller visuals and logging). Imports only @babylonjs/*.",
6
6
  "license": "MIT",
@@ -24,6 +24,7 @@
24
24
  ],
25
25
  "exports": {
26
26
  "./*.js": {
27
+ "source": "./src/*.ts",
27
28
  "types": "./dist/*.d.ts",
28
29
  "default": "./dist/*.js"
29
30
  },
@@ -42,7 +43,6 @@
42
43
  "lint": "eslint src tests",
43
44
  "test": "nodexr-test all",
44
45
  "test:pure": "nodexr-test pure",
45
- "push": "npm run build && npx --yes yalc@1.0.0-pre.53 publish --push",
46
46
  "smoke:controller-log": "tsx tests/controller-log-smoke.ts",
47
47
  "prepack": "npm run build"
48
48
  },
@@ -53,7 +53,7 @@
53
53
  "devDependencies": {
54
54
  "@babylonjs/core": "9.33.2",
55
55
  "@babylonjs/loaders": "9.33.2",
56
- "@kirknock/node-openxr-core": "^0.3.1",
56
+ "@kirknock/node-openxr-core": "^0.3.3",
57
57
  "@napi-rs/canvas": "1.0.11",
58
58
  "@types/node": "^24.0.0",
59
59
  "@types/webxr": "^0.5.14",