@babylonjs/loaders 9.26.1 → 9.27.0
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/SPLAT/gaussianSplattingStream.d.ts +79 -25
- package/SPLAT/gaussianSplattingStream.js +320 -95
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.js +1 -1
- package/glTF/2.0/Extensions/EXT_texture_avif.pure.js.map +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.js +1 -1
- package/glTF/2.0/Extensions/EXT_texture_webp.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +143 -3
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +622 -99
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.d.ts +47 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js +68 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphEventReferenceBlock.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.d.ts +2 -2
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js +38 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.d.ts +41 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js +63 -0
- package/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.d.ts +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.d.ts +243 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.js +2335 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphExporter.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.d.ts +193 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js +919 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +30 -10
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +485 -54
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.d.ts +2 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js +7 -2
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.d.ts +24 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js +89 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityNodeState.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.d.ts +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js +6 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +59 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +129 -77
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.types.d.ts +18 -1
- package/glTF/2.0/Extensions/KHR_interactivity.types.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.d.ts +2 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +114 -56
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.d.ts +2 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +80 -35
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js +1 -1
- package/glTF/2.0/Extensions/KHR_texture_basisu.pure.js.map +1 -1
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js +3 -2
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js.map +1 -1
- package/glTF/2.0/Extensions/objectModelMapping.d.ts +4 -2
- package/glTF/2.0/Extensions/objectModelMapping.js +33 -4
- package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
- package/glTF/2.0/glTFLoader.pure.d.ts +3 -2
- package/glTF/2.0/glTFLoader.pure.js +50 -8
- package/glTF/2.0/glTFLoader.pure.js.map +1 -1
- package/glTF/2.0/glTFLoaderExtension.d.ts +2 -1
- package/glTF/2.0/glTFLoaderExtension.js.map +1 -1
- package/glTF/2.0/glTFLoaderInterfaces.d.ts +9 -0
- package/glTF/2.0/glTFLoaderInterfaces.js.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KHR_texture_basisu.pure.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_texture_basisu.pure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAK3D,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAElC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,kBAAkB;IAS3B;;OAEG;IACH,YAAY,MAAkB;QAX9B,kCAAkC;QAClB,SAAI,GAAG,IAAI,CAAC;QAWxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,gDAAgD;IACzC,iBAAiB,CAAC,OAAe,EAAE,OAAiB,EAAE,MAA6C;QACtG,OAAO,UAAU,CAAC,kBAAkB,CAAiC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE;YACpI,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5J,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,gBAAgB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YACtG,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CACzC,OAAO,EACP,OAAO,EACP,KAAK,EACL,CAAC,cAAc,EAAE,EAAE;gBACf,MAAM,CAAC,cAAc,CAAC,CAAC;YAC3B,CAAC,EACD,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,qCAAqC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,EAC/F,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"KHR_texture_basisu.pure.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_texture_basisu.pure.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAK3D,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAEhG,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAElC;;GAEG;AACH,gEAAgE;AAChE,MAAM,OAAO,kBAAkB;IAS3B;;OAEG;IACH,YAAY,MAAkB;QAX9B,kCAAkC;QAClB,SAAI,GAAG,IAAI,CAAC;QAWxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,gBAAgB;IACT,OAAO;QACT,IAAI,CAAC,OAAe,GAAG,IAAI,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,gDAAgD;IACzC,iBAAiB,CAAC,OAAe,EAAE,OAAiB,EAAE,MAA6C;QACtG,OAAO,UAAU,CAAC,kBAAkB,CAAiC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,EAAE;YACpI,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,OAAO,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YAC5J,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,gBAAgB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;YACtG,OAAO,MAAM,IAAI,CAAC,OAAO,CAAC,mBAAmB,CACzC,OAAO,EACP,OAAO,EACP,KAAK,EACL,CAAC,cAAc,EAAE,EAAE;gBACf,MAAM,CAAC,cAAc,CAAC,CAAC;YAC3B,CAAC,EACD,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,qCAAqC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,EAC/F,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAClC,OAAO,CACV,CAAC;QACN,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,gEAAgE;AAChE,MAAM,UAAU,0BAA0B;IACtC,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAE9B,qBAAqB,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;AAClF,CAAC","sourcesContent":["import { type IGLTFLoaderExtension } from \"../glTFLoaderExtension\";\r\nimport { GLTFLoader, ArrayItem } from \"../glTFLoader.pure\";\r\nimport { type ITexture } from \"../glTFLoaderInterfaces\";\r\nimport { type BaseTexture } from \"core/Materials/Textures/baseTexture\";\r\nimport { type Nullable } from \"core/types\";\r\nimport { type IKHRTextureBasisU } from \"babylonjs-gltf2interface\";\r\nimport { registerGLTFExtension, unregisterGLTFExtension } from \"../glTFLoaderExtensionRegistry\";\r\n\r\nconst NAME = \"KHR_texture_basisu\";\r\n\r\n/**\r\n * [Specification](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Khronos/KHR_texture_basisu/README.md)\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport class KHR_texture_basisu implements IGLTFLoaderExtension {\r\n /** The name of this extension. */\r\n public readonly name = NAME;\r\n\r\n /** Defines whether this extension is enabled. */\r\n public enabled: boolean;\r\n\r\n private _loader: GLTFLoader;\r\n\r\n /**\r\n * @internal\r\n */\r\n constructor(loader: GLTFLoader) {\r\n this._loader = loader;\r\n this.enabled = loader.isExtensionUsed(NAME);\r\n }\r\n\r\n /** @internal */\r\n public dispose() {\r\n (this._loader as any) = null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n // eslint-disable-next-line no-restricted-syntax\r\n public _loadTextureAsync(context: string, texture: ITexture, assign: (babylonTexture: BaseTexture) => void): Nullable<Promise<BaseTexture>> {\r\n return GLTFLoader.LoadExtensionAsync<IKHRTextureBasisU, BaseTexture>(context, texture, this.name, async (extensionContext, extension) => {\r\n const sampler = texture.sampler == undefined ? GLTFLoader.DefaultSampler : ArrayItem.Get(`${context}/sampler`, this._loader.gltf.samplers, texture.sampler);\r\n const image = ArrayItem.Get(`${extensionContext}/source`, this._loader.gltf.images, extension.source);\r\n return await this._loader._createTextureAsync(\r\n context,\r\n sampler,\r\n image,\r\n (babylonTexture) => {\r\n assign(babylonTexture);\r\n },\r\n texture._textureInfo.nonColorData ? { useRGBAIfASTCBC7NotAvailableWhenUASTC: true } : undefined,\r\n !texture._textureInfo.nonColorData,\r\n texture\r\n );\r\n });\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the KHR_texture_basisu glTF loader extension.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport function RegisterKHR_texture_basisu(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n unregisterGLTFExtension(NAME);\r\n\r\n registerGLTFExtension(NAME, true, (loader) => new KHR_texture_basisu(loader));\r\n}\r\n"]}
|
|
@@ -32,8 +32,9 @@ export class InteractivityRefPathToObjectConverter {
|
|
|
32
32
|
* @returns an object accessor whose `get` validates the reference
|
|
33
33
|
*/
|
|
34
34
|
convert(path) {
|
|
35
|
+
const isEmptyEventReference = path === EventReferencePrefix;
|
|
35
36
|
const normalized = path.endsWith("/") ? path.slice(0, -1) : path;
|
|
36
|
-
if (normalized.startsWith(EventReferencePrefix)) {
|
|
37
|
+
if (isEmptyEventReference || normalized.startsWith(EventReferencePrefix)) {
|
|
37
38
|
const key = normalized.substring(EventReferencePrefix.length);
|
|
38
39
|
return {
|
|
39
40
|
object: RefValidityTarget,
|
|
@@ -42,7 +43,7 @@ export class InteractivityRefPathToObjectConverter {
|
|
|
42
43
|
isReadOnly: true,
|
|
43
44
|
// A non-empty key means a real event reference was supplied (the
|
|
44
45
|
// template substitution rejects null refs before we get here).
|
|
45
|
-
get: () => (key.length > 0 ? normalized : undefined),
|
|
46
|
+
get: () => (isEmptyEventReference ? path : key.length > 0 ? normalized : undefined),
|
|
46
47
|
getTarget: () => RefValidityTarget,
|
|
47
48
|
},
|
|
48
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interactivityRefPathToObjectConverter.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,qCAAqC;IAC9C;;;OAGG;IACI,OAAO,CAAC,IAAY;QACvB,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEjE,IAAI,UAAU,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"interactivityRefPathToObjectConverter.js","sourceRoot":"","sources":["../../../../../../dev/loaders/src/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AAEtE;;;;GAIG;AACH,MAAM,iBAAiB,GAAG,EAAE,qBAAqB,EAAE,IAAI,EAAE,CAAC;AAE1D;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,qCAAqC;IAC9C;;;OAGG;IACI,OAAO,CAAC,IAAY;QACvB,MAAM,qBAAqB,GAAG,IAAI,KAAK,oBAAoB,CAAC;QAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAEjE,IAAI,qBAAqB,IAAI,UAAU,CAAC,UAAU,CAAC,oBAAoB,CAAC,EAAE,CAAC;YACvE,MAAM,GAAG,GAAG,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;YAC9D,OAAO;gBACH,MAAM,EAAE,iBAAiB;gBACzB,IAAI,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,IAAI;oBAChB,iEAAiE;oBACjE,+DAA+D;oBAC/D,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;oBACnF,SAAS,EAAE,GAAG,EAAE,CAAC,iBAAiB;iBACrC;aACJ,CAAC;QACN,CAAC;QAED,+FAA+F;QAC/F,qFAAqF;QACrF,MAAM,QAAQ,GAAG,UAAU,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QACpE,OAAO;YACH,MAAM,EAAE,iBAAiB;YACzB,IAAI,EAAE;gBACF,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,IAAI;gBAChB,GAAG,EAAE,CAAC,OAAgB,EAAE,MAAe,EAAE,OAAiB,EAAE,EAAE;oBAC1D,MAAM,OAAO,GAAG,OAAuC,CAAC;oBACxD,IAAI,CAAC,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;wBACxC,OAAO,SAAS,CAAC;oBACrB,CAAC;oBACD,OAAO,aAAa,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;gBACnF,CAAC;gBACD,SAAS,EAAE,GAAG,EAAE,CAAC,iBAAiB;aACrC;SACJ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import { type IObjectInfo, type IPathToObjectConverter } from \"core/ObjectModel/objectModelInterfaces\";\r\nimport { type IObjectAccessor } from \"core/FlowGraph/typeDefinitions\";\r\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\r\nimport { FlowGraphInteger } from \"core/FlowGraph/CustomTypes/flowGraphInteger\";\r\nimport { EventReferencePrefix, DelayReferencePrefix } from \"./KHR_interactivity/interactivityReferences\";\r\nimport { IsDelayActive } from \"core/FlowGraph/flowGraphDelayRegistry\";\r\n\r\n/**\r\n * Sentinel target returned by the validity accessors. The KHR_interactivity\r\n * ref-validity pointers are not backed by a glTF object, so the accessor uses a\r\n * non-null sentinel to satisfy callers that expect a truthy target.\r\n */\r\nconst RefValidityTarget = { isKhrInteractivityRef: true };\r\n\r\n/**\r\n * Path-to-object converter that resolves the KHR_interactivity ref-validity\r\n * pointers `pointer/get` can query (KHR_interactivity spec §4.2.3 Event\r\n * References and §4.2.4 Delay References):\r\n *\r\n * - `/extensions/KHR_interactivity/events/{}` — valid when the input reference\r\n * was produced by an event operation (an event reference). Stateless: any\r\n * event-reference path that reaches this converter is valid; a null ref is\r\n * rejected earlier by the path-template substitution.\r\n * - `/extensions/KHR_interactivity/delays/{}` — valid only while the referenced\r\n * delay index is in the runtime active-delay set (i.e. the delay is scheduled\r\n * and has not yet fired or been cancelled). This requires the runtime\r\n * {@link FlowGraphContext}, which is supplied to the accessor `get` as its\r\n * payload argument by `FlowGraphJsonPointerParserBlock`.\r\n *\r\n * On success `get` returns the input reference value (matching the spec, which\r\n * sets the `value` output to the input reference); on failure it returns\r\n * `undefined`, which the `pointer/get` block surfaces as `isValid = false`.\r\n */\r\nexport class InteractivityRefPathToObjectConverter implements IPathToObjectConverter<IObjectAccessor> {\r\n /**\r\n * @param path the (template-substituted) JSON Pointer to resolve\r\n * @returns an object accessor whose `get` validates the reference\r\n */\r\n public convert(path: string): IObjectInfo<IObjectAccessor> {\r\n const isEmptyEventReference = path === EventReferencePrefix;\r\n const normalized = path.endsWith(\"/\") ? path.slice(0, -1) : path;\r\n\r\n if (isEmptyEventReference || normalized.startsWith(EventReferencePrefix)) {\r\n const key = normalized.substring(EventReferencePrefix.length);\r\n return {\r\n object: RefValidityTarget,\r\n info: {\r\n type: \"object\",\r\n isReadOnly: true,\r\n // A non-empty key means a real event reference was supplied (the\r\n // template substitution rejects null refs before we get here).\r\n get: () => (isEmptyEventReference ? path : key.length > 0 ? normalized : undefined),\r\n getTarget: () => RefValidityTarget,\r\n },\r\n };\r\n }\r\n\r\n // Delay reference: the substituted segment is the integer delay index. parseInt is too lenient\r\n // (it would accept \"1abc\" as 1), so require an all-digits segment before converting.\r\n const rawIndex = normalized.substring(DelayReferencePrefix.length);\r\n const index = /^\\d+$/.test(rawIndex) ? parseInt(rawIndex, 10) : NaN;\r\n return {\r\n object: RefValidityTarget,\r\n info: {\r\n type: \"object\",\r\n isReadOnly: true,\r\n get: (_target: unknown, _index?: number, payload?: unknown) => {\r\n const context = payload as FlowGraphContext | undefined;\r\n if (!context || isNaN(index) || index < 0) {\r\n return undefined;\r\n }\r\n return IsDelayActive(context, index) ? new FlowGraphInteger(index) : undefined;\r\n },\r\n getTarget: () => RefValidityTarget,\r\n },\r\n };\r\n }\r\n}\r\n"]}
|
|
@@ -395,9 +395,10 @@ export interface IGLTFObjectModelTreeExtensionsObject {
|
|
|
395
395
|
/**
|
|
396
396
|
* get a path-to-object converter for the given glTF tree
|
|
397
397
|
* @param gltf the glTF tree to use
|
|
398
|
+
* @param configure optional callback for adding asset-local accessors to this converter
|
|
398
399
|
* @returns a path-to-object converter for the given glTF tree
|
|
399
400
|
*/
|
|
400
|
-
export declare function GetPathToObjectConverter(gltf: IGLTF): GLTFPathToObjectConverter<unknown, unknown, unknown>;
|
|
401
|
+
export declare function GetPathToObjectConverter(gltf: IGLTF, configure?: (mapping: object) => void): GLTFPathToObjectConverter<unknown, unknown, unknown>;
|
|
401
402
|
/**
|
|
402
403
|
* This function will return the object accessor for the given key in the object model
|
|
403
404
|
* If the key is not found, it will return undefined
|
|
@@ -416,6 +417,7 @@ export declare function SetInterpolationForKey(key: string, interpolation?: IInt
|
|
|
416
417
|
* Note that this will NOT change the typescript types. To do that you will need to change the interface itself (extending it in the module that uses it)
|
|
417
418
|
* @param key the key to add the object accessor at. For example /cameras/\{\}/perspective/aspectRatio
|
|
418
419
|
* @param accessor the object accessor to add
|
|
420
|
+
* @param mapping object-model mapping to update; defaults to the process-wide mapping used as the template for new converters
|
|
419
421
|
*/
|
|
420
|
-
export declare function AddObjectAccessorToKey<GLTFTargetType = any, BabylonTargetType = any, BabylonValueType = any>(key: string, accessor: IObjectAccessor<GLTFTargetType, BabylonTargetType, BabylonValueType
|
|
422
|
+
export declare function AddObjectAccessorToKey<GLTFTargetType = any, BabylonTargetType = any, BabylonValueType = any>(key: string, accessor: IObjectAccessor<GLTFTargetType, BabylonTargetType, BabylonValueType>, mapping?: object): void;
|
|
421
423
|
export {};
|
|
@@ -1202,13 +1202,41 @@ const objectModelMapping = {
|
|
|
1202
1202
|
scenes: scenesTree,
|
|
1203
1203
|
skins: skinsTree,
|
|
1204
1204
|
};
|
|
1205
|
+
/**
|
|
1206
|
+
* Creates a detached copy so asset-local accessors cannot mutate other converters.
|
|
1207
|
+
* @param value mapping value to clone
|
|
1208
|
+
* @returns the cloned mapping value
|
|
1209
|
+
*/
|
|
1210
|
+
function _cloneObjectModelMapping(value) {
|
|
1211
|
+
if (Array.isArray(value)) {
|
|
1212
|
+
return value.map((entry) => _cloneObjectModelMapping(entry));
|
|
1213
|
+
}
|
|
1214
|
+
if (value !== null && typeof value === "object") {
|
|
1215
|
+
const prototype = Object.getPrototypeOf(value);
|
|
1216
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
1217
|
+
return value;
|
|
1218
|
+
}
|
|
1219
|
+
const clone = {};
|
|
1220
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
1221
|
+
clone[key] = _cloneObjectModelMapping(entry);
|
|
1222
|
+
}
|
|
1223
|
+
return clone;
|
|
1224
|
+
}
|
|
1225
|
+
return value;
|
|
1226
|
+
}
|
|
1205
1227
|
/**
|
|
1206
1228
|
* get a path-to-object converter for the given glTF tree
|
|
1207
1229
|
* @param gltf the glTF tree to use
|
|
1230
|
+
* @param configure optional callback for adding asset-local accessors to this converter
|
|
1208
1231
|
* @returns a path-to-object converter for the given glTF tree
|
|
1209
1232
|
*/
|
|
1210
|
-
export function GetPathToObjectConverter(gltf) {
|
|
1211
|
-
|
|
1233
|
+
export function GetPathToObjectConverter(gltf, configure) {
|
|
1234
|
+
if (!configure) {
|
|
1235
|
+
return new GLTFPathToObjectConverter(gltf, objectModelMapping);
|
|
1236
|
+
}
|
|
1237
|
+
const assetMapping = _cloneObjectModelMapping(objectModelMapping);
|
|
1238
|
+
configure(assetMapping);
|
|
1239
|
+
return new GLTFPathToObjectConverter(gltf, assetMapping);
|
|
1212
1240
|
}
|
|
1213
1241
|
/**
|
|
1214
1242
|
* This function will return the object accessor for the given key in the object model
|
|
@@ -1259,11 +1287,12 @@ export function SetInterpolationForKey(key, interpolation) {
|
|
|
1259
1287
|
* Note that this will NOT change the typescript types. To do that you will need to change the interface itself (extending it in the module that uses it)
|
|
1260
1288
|
* @param key the key to add the object accessor at. For example /cameras/\{\}/perspective/aspectRatio
|
|
1261
1289
|
* @param accessor the object accessor to add
|
|
1290
|
+
* @param mapping object-model mapping to update; defaults to the process-wide mapping used as the template for new converters
|
|
1262
1291
|
*/
|
|
1263
|
-
export function AddObjectAccessorToKey(key, accessor) {
|
|
1292
|
+
export function AddObjectAccessorToKey(key, accessor, mapping = objectModelMapping) {
|
|
1264
1293
|
// replace every `{}` in key with __array__ to match the object model
|
|
1265
1294
|
const keyParts = key.split("/").map((part) => part.replace(/{}/g, "__array__"));
|
|
1266
|
-
let current =
|
|
1295
|
+
let current = mapping;
|
|
1267
1296
|
for (const part of keyParts) {
|
|
1268
1297
|
// make sure part is not empty
|
|
1269
1298
|
if (!part) {
|