@babylonjs/loaders 9.26.1 → 9.26.2
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/KHR_interactivity/declarationMapper.d.ts +110 -3
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +468 -74
- 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 +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity/index.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.d.ts +112 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js +773 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphModel.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +18 -10
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +299 -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 +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js +5 -0
- package/glTF/2.0/Extensions/KHR_interactivity/pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +55 -1
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +124 -76
- 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/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 +1 -1
- package/glTF/2.0/glTFLoader.pure.js +9 -4
- 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/package.json +3 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type IFlowGraphBlockConfiguration } from "@babylonjs/core/FlowGraph/flowGraphBlock.js";
|
|
2
|
+
import { type FlowGraphContext } from "@babylonjs/core/FlowGraph/flowGraphContext.js";
|
|
3
|
+
import { type FlowGraphDataConnection } from "@babylonjs/core/FlowGraph/flowGraphDataConnection.pure.js";
|
|
4
|
+
import { FlowGraphExecutionBlock } from "@babylonjs/core/FlowGraph/flowGraphExecutionBlock.js";
|
|
5
|
+
import { Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
|
|
6
|
+
import { type FlowGraphSignalConnection } from "@babylonjs/core/FlowGraph/flowGraphSignalConnection.pure.js";
|
|
7
|
+
/**
|
|
8
|
+
* Configuration for a KHR event reference output.
|
|
9
|
+
*/
|
|
10
|
+
export interface IFlowGraphEventReferenceBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
11
|
+
/** Stable key shared by equivalent event operations. */
|
|
12
|
+
eventKey?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Produces the opaque reference associated with a KHR event operation.
|
|
16
|
+
*/
|
|
17
|
+
export declare class FlowGraphEventReferenceBlock extends FlowGraphExecutionBlock {
|
|
18
|
+
config: IFlowGraphEventReferenceBlockConfiguration;
|
|
19
|
+
private readonly _assetInverse;
|
|
20
|
+
private readonly _selectionPointValue;
|
|
21
|
+
private readonly _selectionRayOriginValue;
|
|
22
|
+
/** Output flow activated after event values are captured. */
|
|
23
|
+
readonly out: FlowGraphSignalConnection;
|
|
24
|
+
/** Runtime node associated with the event. */
|
|
25
|
+
readonly node: FlowGraphDataConnection<object | undefined>;
|
|
26
|
+
/** Controller index associated with the event. */
|
|
27
|
+
readonly controllerIndexInput: FlowGraphDataConnection<number>;
|
|
28
|
+
/** Selection point associated with the event. */
|
|
29
|
+
readonly selectionPointInput: FlowGraphDataConnection<Vector3>;
|
|
30
|
+
/** Selection ray origin associated with the event. */
|
|
31
|
+
readonly selectionRayOriginInput: FlowGraphDataConnection<Vector3>;
|
|
32
|
+
/** Opaque node reference. */
|
|
33
|
+
readonly nodeReference: FlowGraphDataConnection<string>;
|
|
34
|
+
/** Retained controller index. */
|
|
35
|
+
readonly controllerIndex: FlowGraphDataConnection<number>;
|
|
36
|
+
/** Retained selection point. */
|
|
37
|
+
readonly selectionPoint: FlowGraphDataConnection<Vector3>;
|
|
38
|
+
/** Retained selection ray origin. */
|
|
39
|
+
readonly selectionRayOrigin: FlowGraphDataConnection<Vector3>;
|
|
40
|
+
/** Opaque event reference. */
|
|
41
|
+
readonly value: FlowGraphDataConnection<string>;
|
|
42
|
+
constructor(config: IFlowGraphEventReferenceBlockConfiguration);
|
|
43
|
+
/** @internal */
|
|
44
|
+
_execute(context: FlowGraphContext): void;
|
|
45
|
+
/** @returns the serialized class name */
|
|
46
|
+
getClassName(): string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { RichTypeAny, RichTypeNumber, RichTypeString, RichTypeVector3 } from "@babylonjs/core/FlowGraph/flowGraphRichTypes.pure.js";
|
|
2
|
+
import { FlowGraphExecutionBlock } from "@babylonjs/core/FlowGraph/flowGraphExecutionBlock.js";
|
|
3
|
+
import { Matrix, Vector3 } from "@babylonjs/core/Maths/math.vector.pure.js";
|
|
4
|
+
import { GetInteractivityObjectReference } from "./flowGraphObjectReferenceBlock.js";
|
|
5
|
+
/**
|
|
6
|
+
* Produces the opaque reference associated with a KHR event operation.
|
|
7
|
+
*/
|
|
8
|
+
export class FlowGraphEventReferenceBlock extends FlowGraphExecutionBlock {
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.config = config;
|
|
12
|
+
this._assetInverse = Matrix.Identity();
|
|
13
|
+
this._selectionPointValue = Vector3.Zero();
|
|
14
|
+
this._selectionRayOriginValue = Vector3.Zero();
|
|
15
|
+
const nanVector = new Vector3(NaN, NaN, NaN);
|
|
16
|
+
this.node = this.registerDataInput("node", RichTypeAny);
|
|
17
|
+
this.controllerIndexInput = this.registerDataInput("controllerIndexInput", RichTypeNumber, -1);
|
|
18
|
+
this.selectionPointInput = this.registerDataInput("selectionPointInput", RichTypeVector3, nanVector);
|
|
19
|
+
this.selectionRayOriginInput = this.registerDataInput("selectionRayOriginInput", RichTypeVector3, nanVector);
|
|
20
|
+
this.nodeReference = this.registerDataOutput("nodeReference", RichTypeString, "");
|
|
21
|
+
this.controllerIndex = this.registerDataOutput("controllerIndex", RichTypeNumber, -1);
|
|
22
|
+
this.selectionPoint = this.registerDataOutput("selectionPoint", RichTypeVector3, nanVector);
|
|
23
|
+
this.selectionRayOrigin = this.registerDataOutput("selectionRayOrigin", RichTypeVector3, nanVector);
|
|
24
|
+
this.value = this.registerDataOutput("value", RichTypeString, "");
|
|
25
|
+
this.out = this._registerSignalOutput("out");
|
|
26
|
+
}
|
|
27
|
+
/** @internal */
|
|
28
|
+
_execute(context) {
|
|
29
|
+
this.nodeReference.setValue(GetInteractivityObjectReference(context, this.node.getValue(context)), context);
|
|
30
|
+
const pointerId = this.controllerIndexInput.getValue(context);
|
|
31
|
+
if (pointerId < 0) {
|
|
32
|
+
this.controllerIndex.setValue(-1, context);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
const controllerIndices = context._getGlobalContextVariable("khrInteractivityControllerIndices", new Map());
|
|
36
|
+
let controllerIndex = controllerIndices.get(pointerId);
|
|
37
|
+
if (controllerIndex === undefined) {
|
|
38
|
+
controllerIndex = controllerIndices.size;
|
|
39
|
+
controllerIndices.set(pointerId, controllerIndex);
|
|
40
|
+
context._setGlobalContextVariable("khrInteractivityControllerIndices", controllerIndices);
|
|
41
|
+
}
|
|
42
|
+
this.controllerIndex.setValue(controllerIndex, context);
|
|
43
|
+
}
|
|
44
|
+
const node = this.node.getValue(context);
|
|
45
|
+
let root = node?.parent;
|
|
46
|
+
while (root?.parent) {
|
|
47
|
+
root = root.parent;
|
|
48
|
+
}
|
|
49
|
+
if (root?.getWorldMatrix) {
|
|
50
|
+
root.getWorldMatrix().invertToRef(this._assetInverse);
|
|
51
|
+
Vector3.TransformCoordinatesToRef(this.selectionPointInput.getValue(context), this._assetInverse, this._selectionPointValue);
|
|
52
|
+
Vector3.TransformCoordinatesToRef(this.selectionRayOriginInput.getValue(context), this._assetInverse, this._selectionRayOriginValue);
|
|
53
|
+
this.selectionPoint.setValue(this._selectionPointValue, context);
|
|
54
|
+
this.selectionRayOrigin.setValue(this._selectionRayOriginValue, context);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.selectionPoint.setValue(this.selectionPointInput.getValue(context), context);
|
|
58
|
+
this.selectionRayOrigin.setValue(this.selectionRayOriginInput.getValue(context), context);
|
|
59
|
+
}
|
|
60
|
+
this.value.setValue(context.getEventReference(this.config.eventKey ?? "gltf:manual"), context);
|
|
61
|
+
this.out._activateSignal(context);
|
|
62
|
+
}
|
|
63
|
+
/** @returns the serialized class name */
|
|
64
|
+
getClassName() {
|
|
65
|
+
return "FlowGraphEventReferenceBlock";
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=flowGraphEventReferenceBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphEventReferenceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/gl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;QAC9F,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,IAAI,aAAa,CAAC,EAAE,OAAO,CAAC,CAAC;QAC/F,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;IACtC,CAAC;IAED,yCAAyC;IACzB,YAAY;QACxB,OAAO,8BAA8B,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["import { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport { RichTypeAny, RichTypeNumber, RichTypeString, RichTypeVector3 } from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphExecutionBlock } from \"core/FlowGraph/flowGraphExecutionBlock\";\nimport { Matrix, Vector3 } from \"core/Maths/math.vector.pure\";\nimport { GetInteractivityObjectReference } from \"./flowGraphObjectReferenceBlock\";\nimport { type FlowGraphSignalConnection } from \"core/FlowGraph/flowGraphSignalConnection.pure\";\n\n/**\n * Configuration for a KHR event reference output.\n */\nexport interface IFlowGraphEventReferenceBlockConfiguration extends IFlowGraphBlockConfiguration {\n /** Stable key shared by equivalent event operations. */\n eventKey?: string;\n}\n\n/**\n * Produces the opaque reference associated with a KHR event operation.\n */\nexport class FlowGraphEventReferenceBlock extends FlowGraphExecutionBlock {\n private readonly _assetInverse = Matrix.Identity();\n private readonly _selectionPointValue = Vector3.Zero();\n private readonly _selectionRayOriginValue = Vector3.Zero();\n /** Output flow activated after event values are captured. */\n public readonly out: FlowGraphSignalConnection;\n /** Runtime node associated with the event. */\n public readonly node: FlowGraphDataConnection<object | undefined>;\n /** Controller index associated with the event. */\n public readonly controllerIndexInput: FlowGraphDataConnection<number>;\n /** Selection point associated with the event. */\n public readonly selectionPointInput: FlowGraphDataConnection<Vector3>;\n /** Selection ray origin associated with the event. */\n public readonly selectionRayOriginInput: FlowGraphDataConnection<Vector3>;\n /** Opaque node reference. */\n public readonly nodeReference: FlowGraphDataConnection<string>;\n /** Retained controller index. */\n public readonly controllerIndex: FlowGraphDataConnection<number>;\n /** Retained selection point. */\n public readonly selectionPoint: FlowGraphDataConnection<Vector3>;\n /** Retained selection ray origin. */\n public readonly selectionRayOrigin: FlowGraphDataConnection<Vector3>;\n /** Opaque event reference. */\n public readonly value: FlowGraphDataConnection<string>;\n\n constructor(public override config: IFlowGraphEventReferenceBlockConfiguration) {\n super(config);\n const nanVector = new Vector3(NaN, NaN, NaN);\n this.node = this.registerDataInput(\"node\", RichTypeAny);\n this.controllerIndexInput = this.registerDataInput(\"controllerIndexInput\", RichTypeNumber, -1);\n this.selectionPointInput = this.registerDataInput(\"selectionPointInput\", RichTypeVector3, nanVector);\n this.selectionRayOriginInput = this.registerDataInput(\"selectionRayOriginInput\", RichTypeVector3, nanVector);\n this.nodeReference = this.registerDataOutput(\"nodeReference\", RichTypeString, \"\");\n this.controllerIndex = this.registerDataOutput(\"controllerIndex\", RichTypeNumber, -1);\n this.selectionPoint = this.registerDataOutput(\"selectionPoint\", RichTypeVector3, nanVector);\n this.selectionRayOrigin = this.registerDataOutput(\"selectionRayOrigin\", RichTypeVector3, nanVector);\n this.value = this.registerDataOutput(\"value\", RichTypeString, \"\");\n this.out = this._registerSignalOutput(\"out\");\n }\n\n /** @internal */\n public override _execute(context: FlowGraphContext): void {\n this.nodeReference.setValue(GetInteractivityObjectReference(context, this.node.getValue(context)), context);\n const pointerId = this.controllerIndexInput.getValue(context);\n if (pointerId < 0) {\n this.controllerIndex.setValue(-1, context);\n } else {\n const controllerIndices = context._getGlobalContextVariable(\"khrInteractivityControllerIndices\", new Map<number, number>()) as Map<number, number>;\n let controllerIndex = controllerIndices.get(pointerId);\n if (controllerIndex === undefined) {\n controllerIndex = controllerIndices.size;\n controllerIndices.set(pointerId, controllerIndex);\n context._setGlobalContextVariable(\"khrInteractivityControllerIndices\", controllerIndices);\n }\n this.controllerIndex.setValue(controllerIndex, context);\n }\n const node = this.node.getValue(context) as { parent?: any; getWorldMatrix?: () => Matrix } | undefined;\n let root = node?.parent;\n while (root?.parent) {\n root = root.parent;\n }\n if (root?.getWorldMatrix) {\n root.getWorldMatrix().invertToRef(this._assetInverse);\n Vector3.TransformCoordinatesToRef(this.selectionPointInput.getValue(context), this._assetInverse, this._selectionPointValue);\n Vector3.TransformCoordinatesToRef(this.selectionRayOriginInput.getValue(context), this._assetInverse, this._selectionRayOriginValue);\n this.selectionPoint.setValue(this._selectionPointValue, context);\n this.selectionRayOrigin.setValue(this._selectionRayOriginValue, context);\n } else {\n this.selectionPoint.setValue(this.selectionPointInput.getValue(context), context);\n this.selectionRayOrigin.setValue(this.selectionRayOriginInput.getValue(context), context);\n }\n this.value.setValue(context.getEventReference(this.config.eventKey ?? \"gltf:manual\"), context);\n this.out._activateSignal(context);\n }\n\n /** @returns the serialized class name */\n public override getClassName(): string {\n return \"FlowGraphEventReferenceBlock\";\n }\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export interface IFlowGraphGLTFDataProviderBlockConfiguration extends IFlowGraph
|
|
|
10
10
|
/**
|
|
11
11
|
* the glTF object to provide data from
|
|
12
12
|
*/
|
|
13
|
-
glTF
|
|
13
|
+
glTF?: IGLTF;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* a glTF-based FlowGraph block that provides arrays with babylon object, based on the glTF tree
|
|
@@ -27,6 +27,6 @@ export declare class FlowGraphGLTFDataProvider extends FlowGraphBlock {
|
|
|
27
27
|
* Corresponds directly to the glTF nodes array
|
|
28
28
|
*/
|
|
29
29
|
readonly nodes: FlowGraphDataConnection<TransformNode[]>;
|
|
30
|
-
constructor(config
|
|
30
|
+
constructor(config?: IFlowGraphGLTFDataProviderBlockConfiguration);
|
|
31
31
|
getClassName(): string;
|
|
32
32
|
}
|
|
@@ -5,7 +5,7 @@ import { RichTypeAny } from "@babylonjs/core/FlowGraph/flowGraphRichTypes.js";
|
|
|
5
5
|
* Can be used, for example, to get animation index from a glTF animation
|
|
6
6
|
*/
|
|
7
7
|
export class FlowGraphGLTFDataProvider extends FlowGraphBlock {
|
|
8
|
-
constructor(config) {
|
|
8
|
+
constructor(config = {}) {
|
|
9
9
|
super(config);
|
|
10
10
|
const glTF = config.glTF;
|
|
11
11
|
// glTF may be undefined when the block is re-created from serialized data
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flowGraphGLTFDataProvider.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAKlG,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAYhE;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAazD,YAAY,
|
|
1
|
+
{"version":3,"file":"flowGraphGLTFDataProvider.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/flowGraphGLTFDataProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqC,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAKlG,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAYhE;;;GAGG;AACH,MAAM,OAAO,yBAA0B,SAAQ,cAAc;IAazD,YAAY,SAAuD,EAAE;QACjE,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,0EAA0E;QAC1E,iFAAiF;QACjF,MAAM,eAAe,GAAG,IAAI,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAC;QACrF,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,WAAW,EAAE,eAAe,CAAC,CAAC;QAChG,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,qBAAqB,CAAC,IAAI,EAAE,CAAC;QACrE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;IACtE,CAAC;IAEe,YAAY;QACxB,OAAO,2BAA2B,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import { type IFlowGraphBlockConfiguration, FlowGraphBlock } from \"core/FlowGraph/flowGraphBlock\";\nimport { type IGLTF } from \"../../glTFLoaderInterfaces\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection\";\nimport { type AnimationGroup } from \"core/Animations/animationGroup\";\nimport { type TransformNode } from \"core/Meshes/transformNode\";\nimport { RichTypeAny } from \"core/FlowGraph/flowGraphRichTypes\";\n\n/**\n * a configuration interface for this block\n */\nexport interface IFlowGraphGLTFDataProviderBlockConfiguration extends IFlowGraphBlockConfiguration {\n /**\n * the glTF object to provide data from\n */\n glTF?: IGLTF;\n}\n\n/**\n * a glTF-based FlowGraph block that provides arrays with babylon object, based on the glTF tree\n * Can be used, for example, to get animation index from a glTF animation\n */\nexport class FlowGraphGLTFDataProvider extends FlowGraphBlock {\n /**\n * Output: an array of animation groups\n * Corresponds directly to the glTF animations array\n */\n public readonly animationGroups: FlowGraphDataConnection<AnimationGroup[]>;\n\n /**\n * Output an array of (Transform) nodes\n * Corresponds directly to the glTF nodes array\n */\n public readonly nodes: FlowGraphDataConnection<TransformNode[]>;\n\n constructor(config: IFlowGraphGLTFDataProviderBlockConfiguration = {}) {\n super(config);\n const glTF = config.glTF;\n // glTF may be undefined when the block is re-created from serialized data\n // (e.g. in the Flow Graph Editor) where the live glTF parse tree is unavailable.\n const animationGroups = glTF?.animations?.map((a) => a._babylonAnimationGroup) || [];\n this.animationGroups = this.registerDataOutput(\"animationGroups\", RichTypeAny, animationGroups);\n const nodes = glTF?.nodes?.map((n) => n._babylonTransformNode) || [];\n this.nodes = this.registerDataOutput(\"nodes\", RichTypeAny, nodes);\n }\n\n public override getClassName(): string {\n return \"FlowGraphGLTFDataProvider\";\n }\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from "@babylonjs/core/FlowGraph/flowGraphBlock.js";
|
|
2
|
+
import { type FlowGraphContext } from "@babylonjs/core/FlowGraph/flowGraphContext.js";
|
|
3
|
+
import { type FlowGraphDataConnection } from "@babylonjs/core/FlowGraph/flowGraphDataConnection.pure.js";
|
|
4
|
+
/**
|
|
5
|
+
* Resolves a runtime object to its owning glTF node reference.
|
|
6
|
+
* @param context active FlowGraph context
|
|
7
|
+
* @param value runtime object, usually a picked primitive
|
|
8
|
+
* @returns the owning node reference or the null reference
|
|
9
|
+
*/
|
|
10
|
+
export declare function GetInteractivityObjectReference(context: FlowGraphContext, value: object | undefined): string;
|
|
11
|
+
/**
|
|
12
|
+
* Converts a runtime object into the opaque reference used by KHR_interactivity.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FlowGraphObjectReferenceBlock extends FlowGraphBlock {
|
|
15
|
+
/** Runtime object to encode. */
|
|
16
|
+
readonly object: FlowGraphDataConnection<object | undefined>;
|
|
17
|
+
/** Opaque KHR_interactivity reference. */
|
|
18
|
+
readonly value: FlowGraphDataConnection<string>;
|
|
19
|
+
constructor(config?: IFlowGraphBlockConfiguration);
|
|
20
|
+
/** @internal */
|
|
21
|
+
_updateOutputs(context: FlowGraphContext): void;
|
|
22
|
+
/** @returns the serialized class name */
|
|
23
|
+
getClassName(): string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { FlowGraphBlock } from "@babylonjs/core/FlowGraph/flowGraphBlock.js";
|
|
2
|
+
import { RichTypeAny, RichTypeString } from "@babylonjs/core/FlowGraph/flowGraphRichTypes.pure.js";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves a runtime object to its owning glTF node reference.
|
|
5
|
+
* @param context active FlowGraph context
|
|
6
|
+
* @param value runtime object, usually a picked primitive
|
|
7
|
+
* @returns the owning node reference or the null reference
|
|
8
|
+
*/
|
|
9
|
+
export function GetInteractivityObjectReference(context, value) {
|
|
10
|
+
let object = value;
|
|
11
|
+
while (object) {
|
|
12
|
+
const candidate = context.getObjectReference(object, "nodes");
|
|
13
|
+
if (candidate?.startsWith("/nodes/")) {
|
|
14
|
+
return candidate;
|
|
15
|
+
}
|
|
16
|
+
object = object.parent;
|
|
17
|
+
}
|
|
18
|
+
return "";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Converts a runtime object into the opaque reference used by KHR_interactivity.
|
|
22
|
+
*/
|
|
23
|
+
export class FlowGraphObjectReferenceBlock extends FlowGraphBlock {
|
|
24
|
+
constructor(config) {
|
|
25
|
+
super(config);
|
|
26
|
+
this.object = this.registerDataInput("object", RichTypeAny);
|
|
27
|
+
this.value = this.registerDataOutput("value", RichTypeString, "");
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
_updateOutputs(context) {
|
|
31
|
+
this.value.setValue(GetInteractivityObjectReference(context, this.object.getValue(context)), context);
|
|
32
|
+
}
|
|
33
|
+
/** @returns the serialized class name */
|
|
34
|
+
getClassName() {
|
|
35
|
+
return "FlowGraphObjectReferenceBlock";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=flowGraphObjectReferenceBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphObjectReferenceBlock.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/flowGraphObjectReferenceBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAqC,MAAM,+BAA+B,CAAC;AAGlG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AAErF;;;;;GAKG;AACH,MAAM,UAAU,+BAA+B,CAAC,OAAyB,EAAE,KAAyB;IAChG,IAAI,MAAM,GAAG,KAAmD,CAAC;IACjE,OAAO,MAAM,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,OAAO,CAAC,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC9D,IAAI,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3B,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,cAAc;IAM7D,YAAY,MAAqC;QAC7C,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,kBAAkB,CAAC,OAAO,EAAE,cAAc,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,gBAAgB;IACA,cAAc,CAAC,OAAyB;QACpD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,+BAA+B,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC1G,CAAC;IAED,yCAAyC;IACzB,YAAY;QACxB,OAAO,+BAA+B,CAAC;IAC3C,CAAC;CACJ","sourcesContent":["import { FlowGraphBlock, type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphDataConnection } from \"core/FlowGraph/flowGraphDataConnection.pure\";\nimport { RichTypeAny, RichTypeString } from \"core/FlowGraph/flowGraphRichTypes.pure\";\n\n/**\n * Resolves a runtime object to its owning glTF node reference.\n * @param context active FlowGraph context\n * @param value runtime object, usually a picked primitive\n * @returns the owning node reference or the null reference\n */\nexport function GetInteractivityObjectReference(context: FlowGraphContext, value: object | undefined): string {\n let object = value as (object & { parent?: object }) | undefined;\n while (object) {\n const candidate = context.getObjectReference(object, \"nodes\");\n if (candidate?.startsWith(\"/nodes/\")) {\n return candidate;\n }\n object = object.parent;\n }\n return \"\";\n}\n\n/**\n * Converts a runtime object into the opaque reference used by KHR_interactivity.\n */\nexport class FlowGraphObjectReferenceBlock extends FlowGraphBlock {\n /** Runtime object to encode. */\n public readonly object: FlowGraphDataConnection<object | undefined>;\n /** Opaque KHR_interactivity reference. */\n public readonly value: FlowGraphDataConnection<string>;\n\n constructor(config?: IFlowGraphBlockConfiguration) {\n super(config);\n this.object = this.registerDataInput(\"object\", RichTypeAny);\n this.value = this.registerDataOutput(\"value\", RichTypeString, \"\");\n }\n\n /** @internal */\n public override _updateOutputs(context: FlowGraphContext): void {\n this.value.setValue(GetInteractivityObjectReference(context, this.object.getValue(context)), context);\n }\n\n /** @returns the serialized class name */\n public override getClassName(): string {\n return \"FlowGraphObjectReferenceBlock\";\n }\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { FlowGraphExecutionBlock } from "@babylonjs/core/FlowGraph/flowGraphExecutionBlock.js";
|
|
2
|
+
import { type IFlowGraphBlockConfiguration } from "@babylonjs/core/FlowGraph/flowGraphBlock.js";
|
|
3
|
+
import { type FlowGraphContext } from "@babylonjs/core/FlowGraph/flowGraphContext.js";
|
|
4
|
+
import { type FlowGraphSignalConnection } from "@babylonjs/core/FlowGraph/flowGraphSignalConnection.pure.js";
|
|
5
|
+
/**
|
|
6
|
+
* Socket definition retained for an unsupported extension operation.
|
|
7
|
+
*/
|
|
8
|
+
export interface IFlowGraphUnsupportedInteractivitySocket {
|
|
9
|
+
/** Socket name. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** FlowGraph runtime type name. */
|
|
12
|
+
type?: string;
|
|
13
|
+
/** Exact KHR_interactivity type signature. */
|
|
14
|
+
signature?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Configuration for an unsupported KHR_interactivity extension operation.
|
|
18
|
+
*/
|
|
19
|
+
export interface IFlowGraphUnsupportedInteractivityBlockConfiguration extends IFlowGraphBlockConfiguration {
|
|
20
|
+
/** Full extension operation name. */
|
|
21
|
+
operation: string;
|
|
22
|
+
/** Input value sockets declared by the extension. */
|
|
23
|
+
inputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];
|
|
24
|
+
/** Output value sockets declared by the extension. */
|
|
25
|
+
outputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];
|
|
26
|
+
/** Input flow sockets used by the source graph. */
|
|
27
|
+
inputFlowSockets: string[];
|
|
28
|
+
/** Output flow sockets used by the source graph. */
|
|
29
|
+
outputFlowSockets: string[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Inspectable runtime no-op for an operation owned by an unsupported glTF extension.
|
|
33
|
+
*/
|
|
34
|
+
export declare class FlowGraphUnsupportedInteractivityBlock extends FlowGraphExecutionBlock {
|
|
35
|
+
config: IFlowGraphUnsupportedInteractivityBlockConfiguration;
|
|
36
|
+
constructor(config: IFlowGraphUnsupportedInteractivityBlockConfiguration);
|
|
37
|
+
/** @internal */
|
|
38
|
+
_execute(_context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void;
|
|
39
|
+
/** @returns the serialized class name */
|
|
40
|
+
getClassName(): string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { FlowGraphExecutionBlock } from "@babylonjs/core/FlowGraph/flowGraphExecutionBlock.js";
|
|
2
|
+
import { getRichTypeByFlowGraphType } from "@babylonjs/core/FlowGraph/flowGraphRichTypes.pure.js";
|
|
3
|
+
import { FlowGraphInteger } from "@babylonjs/core/FlowGraph/CustomTypes/flowGraphInteger.pure.js";
|
|
4
|
+
import { FlowGraphMatrix2D, FlowGraphMatrix3D } from "@babylonjs/core/FlowGraph/CustomTypes/flowGraphMatrix.js";
|
|
5
|
+
import { Matrix, Vector2, Vector3, Vector4 } from "@babylonjs/core/Maths/math.vector.pure.js";
|
|
6
|
+
function _GetDefaultValue(signature) {
|
|
7
|
+
switch (signature) {
|
|
8
|
+
case "bool":
|
|
9
|
+
return false;
|
|
10
|
+
case "int":
|
|
11
|
+
return new FlowGraphInteger(0);
|
|
12
|
+
case "float":
|
|
13
|
+
return NaN;
|
|
14
|
+
case "float2":
|
|
15
|
+
return new Vector2(NaN, NaN);
|
|
16
|
+
case "float3":
|
|
17
|
+
return new Vector3(NaN, NaN, NaN);
|
|
18
|
+
case "float4":
|
|
19
|
+
return new Vector4(NaN, NaN, NaN, NaN);
|
|
20
|
+
case "float2x2":
|
|
21
|
+
return new FlowGraphMatrix2D([NaN, NaN, NaN, NaN]);
|
|
22
|
+
case "float3x3":
|
|
23
|
+
return new FlowGraphMatrix3D([NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
|
|
24
|
+
case "float4x4":
|
|
25
|
+
return Matrix.FromArray([NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);
|
|
26
|
+
case "ref":
|
|
27
|
+
return "";
|
|
28
|
+
default:
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Inspectable runtime no-op for an operation owned by an unsupported glTF extension.
|
|
34
|
+
*/
|
|
35
|
+
export class FlowGraphUnsupportedInteractivityBlock extends FlowGraphExecutionBlock {
|
|
36
|
+
constructor(config) {
|
|
37
|
+
super(config);
|
|
38
|
+
this.config = config;
|
|
39
|
+
this._unregisterSignalInput("in");
|
|
40
|
+
this._unregisterSignalOutput("error");
|
|
41
|
+
for (const socket of config.inputValueSockets ?? []) {
|
|
42
|
+
this.registerDataInput(socket.name, getRichTypeByFlowGraphType(socket.type));
|
|
43
|
+
}
|
|
44
|
+
for (const socket of config.outputValueSockets ?? []) {
|
|
45
|
+
this.registerDataOutput(socket.name, getRichTypeByFlowGraphType(socket.type), _GetDefaultValue(socket.signature));
|
|
46
|
+
}
|
|
47
|
+
for (const socket of config.inputFlowSockets ?? []) {
|
|
48
|
+
this._registerSignalInput(socket);
|
|
49
|
+
}
|
|
50
|
+
for (const socket of config.outputFlowSockets ?? []) {
|
|
51
|
+
this._registerSignalOutput(socket);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/** @internal */
|
|
55
|
+
_execute(_context, _callingSignal) {
|
|
56
|
+
// Unsupported extension operations are required to behave as no-ops.
|
|
57
|
+
}
|
|
58
|
+
/** @returns the serialized class name */
|
|
59
|
+
getClassName() {
|
|
60
|
+
return "FlowGraphUnsupportedInteractivityBlock";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=flowGraphUnsupportedInteractivityBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flowGraphUnsupportedInteractivityBlock.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/flowGraphUnsupportedInteractivityBlock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AAIjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,wCAAwC,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kDAAkD,CAAC;AACpF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAchF,SAAS,gBAAgB,CAAC,SAAkB;IACxC,QAAQ,SAAS,EAAE,CAAC;QAChB,KAAK,MAAM;YACP,OAAO,KAAK,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,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAEtC,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,iBAAiB,IAAI,EAAE,EAAE,CAAC;YAClD,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACjF,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,kBAAkB,IAAI,EAAE,EAAE,CAAC;YACnD,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,IAAI,EAAE,0BAA0B,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACtH,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,gBAAgB,IAAI,EAAE,EAAE,CAAC;YACjD,IAAI,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;QACtC,CAAC;QACD,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,iBAAiB,IAAI,EAAE,EAAE,CAAC;YAClD,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;QACvC,CAAC;IACL,CAAC;IAED,gBAAgB;IACA,QAAQ,CAAC,QAA0B,EAAE,cAAyC;QAC1F,qEAAqE;IACzE,CAAC;IAED,yCAAyC;IACzB,YAAY;QACxB,OAAO,wCAAwC,CAAC;IACpD,CAAC;CACJ","sourcesContent":["import { FlowGraphExecutionBlock } from \"core/FlowGraph/flowGraphExecutionBlock\";\nimport { type IFlowGraphBlockConfiguration } from \"core/FlowGraph/flowGraphBlock\";\nimport { type FlowGraphContext } from \"core/FlowGraph/flowGraphContext\";\nimport { type FlowGraphSignalConnection } from \"core/FlowGraph/flowGraphSignalConnection.pure\";\nimport { getRichTypeByFlowGraphType } from \"core/FlowGraph/flowGraphRichTypes.pure\";\nimport { FlowGraphInteger } from \"core/FlowGraph/CustomTypes/flowGraphInteger.pure\";\nimport { FlowGraphMatrix2D, FlowGraphMatrix3D } from \"core/FlowGraph/CustomTypes/flowGraphMatrix\";\nimport { Matrix, Vector2, Vector3, Vector4 } from \"core/Maths/math.vector.pure\";\n\n/**\n * Socket definition retained for an unsupported extension operation.\n */\nexport interface IFlowGraphUnsupportedInteractivitySocket {\n /** Socket name. */\n name: string;\n /** FlowGraph runtime type name. */\n type?: string;\n /** Exact KHR_interactivity type signature. */\n signature?: string;\n}\n\nfunction _GetDefaultValue(signature?: string): unknown {\n switch (signature) {\n case \"bool\":\n return false;\n case \"int\":\n return new FlowGraphInteger(0);\n case \"float\":\n return NaN;\n case \"float2\":\n return new Vector2(NaN, NaN);\n case \"float3\":\n return new Vector3(NaN, NaN, NaN);\n case \"float4\":\n return new Vector4(NaN, NaN, NaN, NaN);\n case \"float2x2\":\n return new FlowGraphMatrix2D([NaN, NaN, NaN, NaN]);\n case \"float3x3\":\n return new FlowGraphMatrix3D([NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);\n case \"float4x4\":\n return Matrix.FromArray([NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN]);\n case \"ref\":\n return \"\";\n default:\n return undefined;\n }\n}\n\n/**\n * Configuration for an unsupported KHR_interactivity extension operation.\n */\nexport interface IFlowGraphUnsupportedInteractivityBlockConfiguration extends IFlowGraphBlockConfiguration {\n /** Full extension operation name. */\n operation: string;\n /** Input value sockets declared by the extension. */\n inputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];\n /** Output value sockets declared by the extension. */\n outputValueSockets: IFlowGraphUnsupportedInteractivitySocket[];\n /** Input flow sockets used by the source graph. */\n inputFlowSockets: string[];\n /** Output flow sockets used by the source graph. */\n outputFlowSockets: string[];\n}\n\n/**\n * Inspectable runtime no-op for an operation owned by an unsupported glTF extension.\n */\nexport class FlowGraphUnsupportedInteractivityBlock extends FlowGraphExecutionBlock {\n constructor(public override config: IFlowGraphUnsupportedInteractivityBlockConfiguration) {\n super(config);\n this._unregisterSignalInput(\"in\");\n this._unregisterSignalOutput(\"error\");\n\n for (const socket of config.inputValueSockets ?? []) {\n this.registerDataInput(socket.name, getRichTypeByFlowGraphType(socket.type));\n }\n for (const socket of config.outputValueSockets ?? []) {\n this.registerDataOutput(socket.name, getRichTypeByFlowGraphType(socket.type), _GetDefaultValue(socket.signature));\n }\n for (const socket of config.inputFlowSockets ?? []) {\n this._registerSignalInput(socket);\n }\n for (const socket of config.outputFlowSockets ?? []) {\n this._registerSignalOutput(socket);\n }\n }\n\n /** @internal */\n public override _execute(_context: FlowGraphContext, _callingSignal: FlowGraphSignalConnection): void {\n // Unsupported extension operations are required to behave as no-ops.\n }\n\n /** @returns the serialized class name */\n public override getClassName(): string {\n return \"FlowGraphUnsupportedInteractivityBlock\";\n }\n}\n"]}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
export * from "./declarationMapper.js";
|
|
2
2
|
export * from "./interactivityGraphParser.js";
|
|
3
3
|
export * from "./flowGraphGLTFDataProvider.js";
|
|
4
|
+
export * from "./flowGraphEventReferenceBlock.js";
|
|
5
|
+
export * from "./flowGraphObjectReferenceBlock.js";
|
|
6
|
+
export * from "./flowGraphUnsupportedInteractivityBlock.js";
|
|
7
|
+
export * from "./interactivityGraphModel.js";
|
|
8
|
+
export * from "./interactivityNodeState.js";
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from "./declarationMapper.js";
|
|
2
2
|
export * from "./interactivityGraphParser.js";
|
|
3
3
|
export * from "./flowGraphGLTFDataProvider.js";
|
|
4
|
+
export * from "./flowGraphEventReferenceBlock.js";
|
|
5
|
+
export * from "./flowGraphObjectReferenceBlock.js";
|
|
6
|
+
export * from "./flowGraphUnsupportedInteractivityBlock.js";
|
|
7
|
+
export * from "./interactivityGraphModel.js";
|
|
8
|
+
export * from "./interactivityNodeState.js";
|
|
4
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC","sourcesContent":["export * from \"./declarationMapper\";\nexport * from \"./interactivityGraphParser\";\nexport * from \"./flowGraphGLTFDataProvider\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0CAA0C,CAAC;AACzD,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC","sourcesContent":["export * from \"./declarationMapper\";\nexport * from \"./interactivityGraphParser\";\nexport * from \"./flowGraphGLTFDataProvider\";\nexport * from \"./flowGraphEventReferenceBlock\";\nexport * from \"./flowGraphObjectReferenceBlock\";\nexport * from \"./flowGraphUnsupportedInteractivityBlock\";\nexport * from \"./interactivityGraphModel\";\nexport * from \"./interactivityNodeState\";\n"]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { type IKHRInteractivity, type IKHRInteractivity_Declaration, type IKHRInteractivity_Graph } from "babylonjs-gltf2interface";
|
|
2
|
+
import { FlowGraphTypes } from "@babylonjs/core/FlowGraph/flowGraphRichTypes.js";
|
|
3
|
+
/**
|
|
4
|
+
* Ratified KHR_interactivity specification baseline used by this importer.
|
|
5
|
+
*/
|
|
6
|
+
export declare const KHR_INTERACTIVITY_SPECIFICATION_COMMIT = "f798712c5685bc9223a628140fba707db8889300";
|
|
7
|
+
/**
|
|
8
|
+
* Runtime representation of every ratified built-in KHR_interactivity type.
|
|
9
|
+
*/
|
|
10
|
+
export declare const gltfTypeToBabylonType: {
|
|
11
|
+
[key: string]: {
|
|
12
|
+
length: number;
|
|
13
|
+
flowGraphType: FlowGraphTypes;
|
|
14
|
+
elementType: "number" | "boolean" | "string" | "any";
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Classification of a KHR_interactivity declaration.
|
|
19
|
+
*/
|
|
20
|
+
export type KHRInteractivityDeclarationSupport = "core" | "extension" | "unsupported-extension" | "unknown-core";
|
|
21
|
+
/**
|
|
22
|
+
* A structured KHR_interactivity import diagnostic.
|
|
23
|
+
*/
|
|
24
|
+
export interface IKHRInteractivityDiagnostic {
|
|
25
|
+
/** JSON pointer identifying the source location. */
|
|
26
|
+
path: string;
|
|
27
|
+
/** Human-readable diagnostic text. */
|
|
28
|
+
message: string;
|
|
29
|
+
/** Diagnostic severity. */
|
|
30
|
+
severity: "error" | "warning";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Canonical declaration information retained during import.
|
|
34
|
+
*/
|
|
35
|
+
export interface IKHRInteractivityDeclarationModel {
|
|
36
|
+
/** Declaration index in the source graph. */
|
|
37
|
+
index: number;
|
|
38
|
+
/** Full operation name, including the defining extension when present. */
|
|
39
|
+
operation: string;
|
|
40
|
+
/** Whether Babylon can execute the declaration. */
|
|
41
|
+
support: KHRInteractivityDeclarationSupport;
|
|
42
|
+
/** Exact source declaration. */
|
|
43
|
+
source: IKHRInteractivity_Declaration;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Canonical graph information retained during import.
|
|
47
|
+
*/
|
|
48
|
+
export interface IKHRInteractivityGraphModel {
|
|
49
|
+
/** Graph index in the root extension. */
|
|
50
|
+
index: number;
|
|
51
|
+
/** Stable source path. */
|
|
52
|
+
path: string;
|
|
53
|
+
/** Human-readable graph name. */
|
|
54
|
+
name: string;
|
|
55
|
+
/** Exact source graph, including extension and extras payloads. */
|
|
56
|
+
source: IKHRInteractivity_Graph;
|
|
57
|
+
/** Executable graph with specification defaults and fallbacks applied. */
|
|
58
|
+
effectiveSource: IKHRInteractivity_Graph;
|
|
59
|
+
/** Canonical declarations in source order. */
|
|
60
|
+
declarations: IKHRInteractivityDeclarationModel[];
|
|
61
|
+
/** Validation diagnostics for this graph. */
|
|
62
|
+
diagnostics: IKHRInteractivityDiagnostic[];
|
|
63
|
+
/** Whether this graph is valid and can be lowered to FlowGraph. */
|
|
64
|
+
valid: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Lossless canonical representation of a KHR_interactivity root extension.
|
|
68
|
+
*/
|
|
69
|
+
export interface IKHRInteractivityDocument {
|
|
70
|
+
/** Ratified specification revision used for validation. */
|
|
71
|
+
specificationCommit: string;
|
|
72
|
+
/** Exact source extension, including unknown extensions and extras. */
|
|
73
|
+
source: IKHRInteractivity;
|
|
74
|
+
/** Default graph index, or -1 when the source selection is invalid. */
|
|
75
|
+
defaultGraphIndex: number;
|
|
76
|
+
/** Canonical graph models in source order. */
|
|
77
|
+
graphs: IKHRInteractivityGraphModel[];
|
|
78
|
+
/** Root-level validation diagnostics. */
|
|
79
|
+
diagnostics: IKHRInteractivityDiagnostic[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Creates a detached JSON copy of a KHR_interactivity graph.
|
|
83
|
+
* @param graph source graph
|
|
84
|
+
* @returns a lossless JSON copy
|
|
85
|
+
*/
|
|
86
|
+
export declare function CloneKHRInteractivityGraph(graph: IKHRInteractivity_Graph): IKHRInteractivity_Graph;
|
|
87
|
+
/**
|
|
88
|
+
* Creates the executable graph view with all ratified configuration defaults and fallback rules
|
|
89
|
+
* applied without modifying the lossless source graph.
|
|
90
|
+
* @param graph source graph
|
|
91
|
+
* @param declarations canonical declarations
|
|
92
|
+
* @param assetNodeCount number of glTF nodes in the containing asset
|
|
93
|
+
* @returns normalized executable graph
|
|
94
|
+
*/
|
|
95
|
+
export declare function CreateEffectiveKHRInteractivityGraph(graph: IKHRInteractivity_Graph, declarations: readonly IKHRInteractivityDeclarationModel[], assetNodeCount?: number): IKHRInteractivity_Graph;
|
|
96
|
+
/**
|
|
97
|
+
* Creates and validates a canonical copy of one KHR_interactivity graph.
|
|
98
|
+
* @param graph source graph
|
|
99
|
+
* @param index graph index in the root extension
|
|
100
|
+
* @param supportedExtensions enabled extensions that may provide executable operations
|
|
101
|
+
* @param assetNodeCount number of nodes in the containing glTF asset
|
|
102
|
+
* @returns the canonical graph model
|
|
103
|
+
*/
|
|
104
|
+
export declare function CreateKHRInteractivityGraphModel(graph: IKHRInteractivity_Graph | null | undefined, index?: number, supportedExtensions?: ReadonlySet<string>, assetNodeCount?: number): IKHRInteractivityGraphModel;
|
|
105
|
+
/**
|
|
106
|
+
* Creates an immutable canonical KHR_interactivity document and validates all graph-local references.
|
|
107
|
+
* @param extension source extension object from the glTF document
|
|
108
|
+
* @param supportedExtensions enabled extensions that may provide executable operations
|
|
109
|
+
* @param assetNodeCount number of nodes in the containing glTF asset
|
|
110
|
+
* @returns the canonical document
|
|
111
|
+
*/
|
|
112
|
+
export declare function CreateKHRInteractivityDocument(extension: IKHRInteractivity, supportedExtensions?: ReadonlySet<string>, assetNodeCount?: number): IKHRInteractivityDocument;
|