@kiberon-labs/behave-graph-scene 1.0.0 → 1.0.1
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/.turbo/turbo-build.log +7 -0
- package/LICENSE +6 -0
- package/README.md +13 -0
- package/dist/Abstractions/Drivers/DummyScene.d.ts +20 -0
- package/dist/Abstractions/Drivers/DummyScene.d.ts.map +1 -0
- package/dist/Abstractions/Drivers/DummyScene.js +58 -0
- package/dist/Abstractions/Drivers/DummyScene.js.map +1 -0
- package/dist/Abstractions/IScene.d.ts +16 -0
- package/dist/Abstractions/IScene.d.ts.map +1 -0
- package/dist/GLTFJson.d.ts +33 -0
- package/dist/GLTFJson.d.ts.map +1 -0
- package/dist/Nodes/Actions/EaseSceneProperty.d.ts +23 -0
- package/dist/Nodes/Actions/EaseSceneProperty.d.ts.map +1 -0
- package/dist/Nodes/Actions/EaseSceneProperty.js +73 -0
- package/dist/Nodes/Actions/EaseSceneProperty.js.map +1 -0
- package/dist/Nodes/Actions/SetSceneProperty.d.ts +5 -0
- package/dist/Nodes/Actions/SetSceneProperty.d.ts.map +1 -0
- package/dist/Nodes/Actions/SetSceneProperty.js +28 -0
- package/dist/Nodes/Actions/SetSceneProperty.js.map +1 -0
- package/dist/Nodes/Events/OnSceneNodeClick.d.ts +5 -0
- package/dist/Nodes/Events/OnSceneNodeClick.d.ts.map +1 -0
- package/dist/Nodes/Events/OnSceneNodeClick.js +39 -0
- package/dist/Nodes/Events/OnSceneNodeClick.js.map +1 -0
- package/dist/Nodes/Logic/ColorNodes.d.ts +19 -0
- package/dist/Nodes/Logic/ColorNodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/ColorNodes.js +137 -0
- package/dist/Nodes/Logic/ColorNodes.js.map +1 -0
- package/dist/Nodes/Logic/EulerNodes.d.ts +18 -0
- package/dist/Nodes/Logic/EulerNodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/EulerNodes.js +132 -0
- package/dist/Nodes/Logic/EulerNodes.js.map +1 -0
- package/dist/Nodes/Logic/Mat3Nodes.d.ts +28 -0
- package/dist/Nodes/Logic/Mat3Nodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/Mat3Nodes.js +213 -0
- package/dist/Nodes/Logic/Mat3Nodes.js.map +1 -0
- package/dist/Nodes/Logic/Mat4Nodes.d.ts +34 -0
- package/dist/Nodes/Logic/Mat4Nodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/Mat4Nodes.js +267 -0
- package/dist/Nodes/Logic/Mat4Nodes.js.map +1 -0
- package/dist/Nodes/Logic/QuatNodes.d.ts +24 -0
- package/dist/Nodes/Logic/QuatNodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/QuatNodes.js +173 -0
- package/dist/Nodes/Logic/QuatNodes.js.map +1 -0
- package/dist/Nodes/Logic/Vec2Nodes.d.ts +18 -0
- package/dist/Nodes/Logic/Vec2Nodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/Vec2Nodes.js +115 -0
- package/dist/Nodes/Logic/Vec2Nodes.js.map +1 -0
- package/dist/Nodes/Logic/Vec3Nodes.d.ts +19 -0
- package/dist/Nodes/Logic/Vec3Nodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/Vec3Nodes.js +137 -0
- package/dist/Nodes/Logic/Vec3Nodes.js.map +1 -0
- package/dist/Nodes/Logic/Vec4Nodes.d.ts +18 -0
- package/dist/Nodes/Logic/Vec4Nodes.d.ts.map +1 -0
- package/dist/Nodes/Logic/Vec4Nodes.js +132 -0
- package/dist/Nodes/Logic/Vec4Nodes.js.map +1 -0
- package/dist/Nodes/Logic/VecElements.d.ts +9 -0
- package/dist/Nodes/Logic/VecElements.d.ts.map +1 -0
- package/dist/Nodes/Logic/VecElements.js +22 -0
- package/dist/Nodes/Logic/VecElements.js.map +1 -0
- package/dist/Nodes/Queries/GetSceneProperty.d.ts +5 -0
- package/dist/Nodes/Queries/GetSceneProperty.d.ts.map +1 -0
- package/dist/Nodes/Queries/GetSceneProperty.js +23 -0
- package/dist/Nodes/Queries/GetSceneProperty.js.map +1 -0
- package/dist/Values/ColorValue.d.ts +7 -0
- package/dist/Values/ColorValue.d.ts.map +1 -0
- package/dist/Values/ColorValue.js +20 -0
- package/dist/Values/ColorValue.js.map +1 -0
- package/dist/Values/EulerValue.d.ts +7 -0
- package/dist/Values/EulerValue.d.ts.map +1 -0
- package/dist/Values/EulerValue.js +20 -0
- package/dist/Values/EulerValue.js.map +1 -0
- package/dist/Values/Internal/Mat3.d.ts +43 -0
- package/dist/Values/Internal/Mat3.d.ts.map +1 -0
- package/dist/Values/Internal/Mat3.js +278 -0
- package/dist/Values/Internal/Mat3.js.map +1 -0
- package/dist/Values/Internal/Mat4.d.ts +53 -0
- package/dist/Values/Internal/Mat4.d.ts.map +1 -0
- package/dist/Values/Internal/Mat4.js +445 -0
- package/dist/Values/Internal/Mat4.js.map +1 -0
- package/dist/Values/Internal/Vec2.d.ts +25 -0
- package/dist/Values/Internal/Vec2.d.ts.map +1 -0
- package/dist/Values/Internal/Vec2.js +64 -0
- package/dist/Values/Internal/Vec2.js.map +1 -0
- package/dist/Values/Internal/Vec3.d.ts +38 -0
- package/dist/Values/Internal/Vec3.d.ts.map +1 -0
- package/dist/Values/Internal/Vec3.js +159 -0
- package/dist/Values/Internal/Vec3.js.map +1 -0
- package/dist/Values/Internal/Vec4.d.ts +49 -0
- package/dist/Values/Internal/Vec4.d.ts.map +1 -0
- package/dist/Values/Internal/Vec4.js +191 -0
- package/dist/Values/Internal/Vec4.js.map +1 -0
- package/dist/Values/Mat3Value.d.ts +7 -0
- package/dist/Values/Mat3Value.d.ts.map +1 -0
- package/dist/Values/Mat3Value.js +16 -0
- package/dist/Values/Mat3Value.js.map +1 -0
- package/dist/Values/Mat4Value.d.ts +7 -0
- package/dist/Values/Mat4Value.d.ts.map +1 -0
- package/dist/Values/Mat4Value.js +16 -0
- package/dist/Values/Mat4Value.js.map +1 -0
- package/dist/Values/QuatValue.d.ts +7 -0
- package/dist/Values/QuatValue.d.ts.map +1 -0
- package/dist/Values/QuatValue.js +21 -0
- package/dist/Values/QuatValue.js.map +1 -0
- package/dist/Values/Vec2Value.d.ts +7 -0
- package/dist/Values/Vec2Value.d.ts.map +1 -0
- package/dist/Values/Vec2Value.js +16 -0
- package/dist/Values/Vec2Value.js.map +1 -0
- package/dist/Values/Vec3Value.d.ts +7 -0
- package/dist/Values/Vec3Value.d.ts.map +1 -0
- package/dist/Values/Vec3Value.js +20 -0
- package/dist/Values/Vec3Value.js.map +1 -0
- package/dist/Values/Vec4Value.d.ts +7 -0
- package/dist/Values/Vec4Value.d.ts.map +1 -0
- package/dist/Values/Vec4Value.js +21 -0
- package/dist/Values/Vec4Value.js.map +1 -0
- package/dist/_virtual/rolldown_runtime.js +13 -0
- package/dist/buildScene.d.ts +74 -0
- package/dist/buildScene.d.ts.map +1 -0
- package/dist/buildScene.js +283 -0
- package/dist/buildScene.js.map +1 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.js +31 -0
- package/dist/registerSceneProfile.d.ts +10 -0
- package/dist/registerSceneProfile.d.ts.map +1 -0
- package/dist/registerSceneProfile.js +78 -0
- package/dist/registerSceneProfile.js.map +1 -0
- package/package.json +19 -9
- package/src/Nodes/Logic/QuatNodes.ts +11 -11
- package/tests/graphs/logic/Color.json +53 -53
- package/tests/graphs/logic/Euler.json +53 -53
- package/tests/graphs/logic/Quaternion.json +56 -56
- package/tests/graphs/logic/Vector2.json +50 -50
- package/tests/graphs/logic/Vector3.json +53 -53
- package/tests/graphs/logic/Vector4.json +56 -56
- package/tests/tsconfig.json +10 -10
- package/tsconfig.json +54 -54
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Vec4Value.d.ts","names":[],"sources":["../../src/Values/Vec4Value.ts"],"sourcesContent":[],"mappings":";;;cASa,WAAW"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Vec4, vec4Equals, vec4Mix, vec4Parse } from "./Internal/Vec4.js";
|
|
2
|
+
|
|
3
|
+
//#region src/Values/Vec4Value.ts
|
|
4
|
+
const Vec4Value = {
|
|
5
|
+
name: "vec4",
|
|
6
|
+
creator: () => new Vec4(),
|
|
7
|
+
deserialize: (value) => typeof value === "string" ? vec4Parse(value) : new Vec4(value[0], value[1], value[2], value[3]),
|
|
8
|
+
serialize: (value) => [
|
|
9
|
+
value.x,
|
|
10
|
+
value.y,
|
|
11
|
+
value.z,
|
|
12
|
+
value.w
|
|
13
|
+
],
|
|
14
|
+
lerp: (start, end, t) => vec4Mix(start, end, t),
|
|
15
|
+
equals: (a, b) => vec4Equals(a, b),
|
|
16
|
+
clone: (value) => value.clone()
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { Vec4Value };
|
|
21
|
+
//# sourceMappingURL=Vec4Value.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Vec4Value.js","names":["Vec4Value: ValueType"],"sources":["../../src/Values/Vec4Value.ts"],"sourcesContent":["import type { ValueType } from '@kiberon-labs/behave-graph';\n\nimport {\n Vec4,\n vec4Equals,\n type Vec4JSON,\n vec4Mix,\n vec4Parse\n} from './Internal/Vec4.js';\nexport const Vec4Value: ValueType = {\n name: 'vec4',\n creator: () => new Vec4(),\n deserialize: (value: string | Vec4JSON) =>\n typeof value === 'string'\n ? vec4Parse(value)\n : new Vec4(value[0], value[1], value[2], value[3]),\n serialize: (value) => [value.x, value.y, value.z, value.w] as Vec4JSON,\n lerp: (start: Vec4, end: Vec4, t: number) => vec4Mix(start, end, t),\n equals: (a: Vec4, b: Vec4) => vec4Equals(a, b),\n clone: (value: Vec4) => value.clone()\n};\n"],"mappings":";;;AASA,MAAaA,YAAuB;CAClC,MAAM;CACN,eAAe,IAAI,MAAM;CACzB,cAAc,UACZ,OAAO,UAAU,WACb,UAAU,MAAM,GAChB,IAAI,KAAK,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,GAAG;CACtD,YAAY,UAAU;EAAC,MAAM;EAAG,MAAM;EAAG,MAAM;EAAG,MAAM;EAAE;CAC1D,OAAO,OAAa,KAAW,MAAc,QAAQ,OAAO,KAAK,EAAE;CACnE,SAAS,GAAS,MAAY,WAAW,GAAG,EAAE;CAC9C,QAAQ,UAAgB,MAAM,OAAO;CACtC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (all) => {
|
|
4
|
+
let target = {};
|
|
5
|
+
for (var name in all) __defProp(target, name, {
|
|
6
|
+
get: all[name],
|
|
7
|
+
enumerable: true
|
|
8
|
+
});
|
|
9
|
+
return target;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { __export };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { IScene } from "./Abstractions/IScene.js";
|
|
2
|
+
import { GLTFJson } from "./GLTFJson.js";
|
|
3
|
+
import { Choices } from "@kiberon-labs/behave-graph";
|
|
4
|
+
import { Material, Object3D } from "three";
|
|
5
|
+
import { GLTF } from "three-stdlib";
|
|
6
|
+
|
|
7
|
+
//#region src/buildScene.d.ts
|
|
8
|
+
declare const Resource: {
|
|
9
|
+
readonly nodes: "nodes";
|
|
10
|
+
readonly materials: "materials";
|
|
11
|
+
readonly animations: "animations";
|
|
12
|
+
};
|
|
13
|
+
type Resource = (typeof Resource)[keyof typeof Resource];
|
|
14
|
+
declare type ObjectMap = {
|
|
15
|
+
nodes: {
|
|
16
|
+
[name: string]: Object3D;
|
|
17
|
+
};
|
|
18
|
+
materials: {
|
|
19
|
+
[name: string]: Material;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
type Optional<T> = { [K in keyof T]: T[K] | undefined };
|
|
23
|
+
type Path = {
|
|
24
|
+
resource: Resource;
|
|
25
|
+
index: number;
|
|
26
|
+
property: string;
|
|
27
|
+
};
|
|
28
|
+
declare function toJsonPathString({
|
|
29
|
+
index,
|
|
30
|
+
property,
|
|
31
|
+
resource: resourceType
|
|
32
|
+
}: Optional<Path>, short: boolean): string | undefined;
|
|
33
|
+
declare function parseJsonPath(jsonPath: string, short?: boolean): Path;
|
|
34
|
+
declare function applyPropertyToModel({
|
|
35
|
+
resource,
|
|
36
|
+
index,
|
|
37
|
+
property
|
|
38
|
+
}: Path, gltf: GLTF & ObjectMap, value: any, properties: Properties, setActiveAnimations: ((animation: string, active: boolean) => void) | undefined): void;
|
|
39
|
+
type ResourceOption = {
|
|
40
|
+
name: string;
|
|
41
|
+
index: number;
|
|
42
|
+
};
|
|
43
|
+
type ResourceProperties = {
|
|
44
|
+
options: ResourceOption[];
|
|
45
|
+
properties: string[];
|
|
46
|
+
};
|
|
47
|
+
type Properties = { [key in Resource]?: ResourceProperties };
|
|
48
|
+
type ParsableScene = GLTF & ObjectMap & {
|
|
49
|
+
json?: GLTFJson;
|
|
50
|
+
};
|
|
51
|
+
declare const extractProperties: (gltf: ParsableScene) => Properties;
|
|
52
|
+
declare function generateSettableChoices(properties: Properties): Choices;
|
|
53
|
+
declare function generateRaycastableChoices(properties: Properties): Choices;
|
|
54
|
+
type OnClickCallback = (jsonPath: string) => void;
|
|
55
|
+
type OnClickListener = {
|
|
56
|
+
path: Path;
|
|
57
|
+
elementName: string;
|
|
58
|
+
callbacks: OnClickCallback[];
|
|
59
|
+
};
|
|
60
|
+
type OnClickListeners = {
|
|
61
|
+
[jsonPath: string]: OnClickListener;
|
|
62
|
+
};
|
|
63
|
+
declare const buildScene: ({
|
|
64
|
+
gltf,
|
|
65
|
+
setOnClickListeners,
|
|
66
|
+
setActiveAnimations
|
|
67
|
+
}: {
|
|
68
|
+
gltf: GLTF & ObjectMap;
|
|
69
|
+
setOnClickListeners: ((cb: (existing: OnClickListeners) => OnClickListeners) => void) | undefined;
|
|
70
|
+
setActiveAnimations: ((animation: string, active: boolean) => void) | undefined;
|
|
71
|
+
}) => IScene;
|
|
72
|
+
//#endregion
|
|
73
|
+
export { ObjectMap, OnClickCallback, OnClickListener, OnClickListeners, Optional, ParsableScene, Path, ResourceOption, ResourceProperties, applyPropertyToModel, buildScene, extractProperties, generateRaycastableChoices, generateSettableChoices, parseJsonPath, toJsonPathString };
|
|
74
|
+
//# sourceMappingURL=buildScene.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildScene.d.ts","names":[],"sources":["../src/buildScene.ts"],"sourcesContent":[],"mappings":";;;;;;;cAiBM;;EAAA,SAAA,SAII,EAAA,WAAA;EAEL,SAAA,UAAQ,EAAA,YAAkC;AAS/C,CAAA;AAaA,KAtBK,QAAA,GAsBe,CAAA,OAtBI,QAsBJ,CAAA,CAAA,MAAA,OAtB2B,QAsB3B,CAAA;AACN,aAdM,SAAA,GAcN;EAAI,KAAA,EAAA;IAAE,CAAA,IAAA,EAAA,MAAA,CAAA,EAZA,QAYA;EAAC,CAAA;EAGT,SAAI,EAAA;IAMA,CAAA,IAAA,EAAA,MAAA,CAAA,EAlBI,QAkBY;EAC5B,CAAA;CAAO;AAAoB,KAXnB,QAWmB,CAAA,CAAA,CAAA,GAAA,QAAyB,MAV1C,CAU0C,GAVtC,CAUsC,CAVpC,CAUoC,CAAA,GAAA,SAAA,EAAT;AAAQ,KAP3C,IAAA,GAO2C;EAYvC,QAAA,EAlBJ,QAkBiB;EAcb,KAAA,EAAA,MAAA;EACZ,QAAA,EAAA,MAAA;CAAU;AAAO,iBA5BL,gBAAA,CA4BK;EAAA,KAAA;EAAA,QAAA;EAAA,QAAA,EA3BU;AA2BV,CAAA,EA3B0B,QA2B1B,CA3BmC,IA2BnC,CAAA,EAAA,KAAA,EAAA,OAAA,CAAA,EAAA,MAAA,GAAA,SAAA;AAAY,iBAfjB,aAAA,CAeiB,QAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAAA,OAAA,CAAA,EAf+B,IAe/B;AACzB,iBAFQ,oBAAA,CAER;EAAA,QAAA;EAAA,KAAA;EAAA;AAAA,CAAA,E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.js";
|
|
2
|
+
import { Vec3 } from "./Values/Internal/Vec3.js";
|
|
3
|
+
import { EventEmitter } from "@kiberon-labs/behave-graph";
|
|
4
|
+
import { Material, Object3D } from "three";
|
|
5
|
+
|
|
6
|
+
//#region src/buildScene.ts
|
|
7
|
+
const Resource = {
|
|
8
|
+
nodes: "nodes",
|
|
9
|
+
materials: "materials",
|
|
10
|
+
animations: "animations"
|
|
11
|
+
};
|
|
12
|
+
function toVec3(value) {
|
|
13
|
+
return new Vec3(value.x, value.y, value.z);
|
|
14
|
+
}
|
|
15
|
+
function toVec4(value) {
|
|
16
|
+
return new Vec4(value.x, value.y, value.z, value.w);
|
|
17
|
+
}
|
|
18
|
+
const shortPathRegEx = /^\/?(?<resource>[^/]+)\/(?<index>\d+)$/;
|
|
19
|
+
const jsonPathRegEx = /^\/?(?<resource>[^/]+)\/(?<index>\d+)\/(?<property>[^/]+)$/;
|
|
20
|
+
function toJsonPathString({ index, property, resource: resourceType }, short) {
|
|
21
|
+
if (short) {
|
|
22
|
+
if (!resourceType || index === void 0) return;
|
|
23
|
+
return `${resourceType}/${index}`;
|
|
24
|
+
} else {
|
|
25
|
+
if (!resourceType || index === void 0 || !property) return;
|
|
26
|
+
return `${resourceType}/${index}/${property}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function parseJsonPath(jsonPath, short = false) {
|
|
30
|
+
const matches = (short ? shortPathRegEx : jsonPathRegEx).exec(jsonPath);
|
|
31
|
+
if (matches === null) throw new Error(`can not parse jsonPath: ${jsonPath}`);
|
|
32
|
+
if (matches.groups === void 0) throw new Error(`can not parse jsonPath (no groups): ${jsonPath}`);
|
|
33
|
+
return {
|
|
34
|
+
resource: matches.groups.resource,
|
|
35
|
+
index: +matches.groups.index,
|
|
36
|
+
property: matches.groups.property
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function applyPropertyToModel({ resource, index, property }, gltf, value, properties, setActiveAnimations) {
|
|
40
|
+
const nodeName = getResourceName({
|
|
41
|
+
resource,
|
|
42
|
+
index
|
|
43
|
+
}, properties);
|
|
44
|
+
if (!nodeName) throw new Error(`could not get node at index ${index}`);
|
|
45
|
+
if (resource === Resource.nodes) {
|
|
46
|
+
const node = gltf.nodes[nodeName];
|
|
47
|
+
if (!node) {
|
|
48
|
+
console.error(`no node at path ${nodeName}`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
applyNodeModifier(property, node, value);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (resource === Resource.materials) {
|
|
55
|
+
const node = gltf.materials[nodeName];
|
|
56
|
+
if (!node) {
|
|
57
|
+
console.error(`no node at path ${nodeName}`);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
applyMaterialModifier(property, node, value);
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
if (resource === Resource.animations) {
|
|
64
|
+
if (!setActiveAnimations) {
|
|
65
|
+
console.error("cannot apply animation property without setActiveAnimations");
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
setActiveAnimations(nodeName, value);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
console.error(`unknown resource type ${resource}`);
|
|
72
|
+
}
|
|
73
|
+
const getResourceName = ({ resource, index }, properties) => {
|
|
74
|
+
return properties[resource]?.options[index]?.name;
|
|
75
|
+
};
|
|
76
|
+
const getPropertyFromModel = ({ resource, index, property }, gltf, properties) => {
|
|
77
|
+
if (resource === Resource.nodes) {
|
|
78
|
+
const nodeName = getResourceName({
|
|
79
|
+
resource,
|
|
80
|
+
index
|
|
81
|
+
}, properties);
|
|
82
|
+
if (!nodeName) throw new Error(`could not get node at index ${index}`);
|
|
83
|
+
const node = gltf.nodes[nodeName];
|
|
84
|
+
if (!node) {
|
|
85
|
+
console.error(`no node at path ${nodeName}`);
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
getPropertyValue(property, node);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
function applyNodeModifier(property, objectRef, value) {
|
|
93
|
+
switch (property) {
|
|
94
|
+
case "visible":
|
|
95
|
+
objectRef.visible = value;
|
|
96
|
+
break;
|
|
97
|
+
case "translation": {
|
|
98
|
+
const v = value;
|
|
99
|
+
objectRef.position.set(v.x, v.y, v.z);
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
case "scale": {
|
|
103
|
+
const v = value;
|
|
104
|
+
console.log(v.x);
|
|
105
|
+
objectRef.scale.set(v.x, v.y, v.z);
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
case "rotation": {
|
|
109
|
+
const v = value;
|
|
110
|
+
objectRef.quaternion.set(v.x, v.y, v.z, v.w);
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
function applyMaterialModifier(property, materialRef, value) {
|
|
116
|
+
switch (property) {
|
|
117
|
+
case "color": {
|
|
118
|
+
const basic = materialRef;
|
|
119
|
+
if (basic.color) {
|
|
120
|
+
const v = value;
|
|
121
|
+
basic.color.setRGB(v.x, v.y, v.z);
|
|
122
|
+
basic.needsUpdate = true;
|
|
123
|
+
}
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function getPropertyValue(property, objectRef) {
|
|
129
|
+
switch (property) {
|
|
130
|
+
case "visible": return objectRef.visible;
|
|
131
|
+
case "translation": return toVec3(objectRef.position);
|
|
132
|
+
case "scale": return toVec3(objectRef.scale);
|
|
133
|
+
case "rotation": return toVec4(objectRef.quaternion);
|
|
134
|
+
default: throw new Error(`unrecognized property: ${property}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const extractProperties = (gltf) => {
|
|
138
|
+
const nodeProperties = [
|
|
139
|
+
"visible",
|
|
140
|
+
"translation",
|
|
141
|
+
"scale",
|
|
142
|
+
"rotation",
|
|
143
|
+
"color"
|
|
144
|
+
];
|
|
145
|
+
const animationProperties = ["playing"];
|
|
146
|
+
const materialProperties = ["color"];
|
|
147
|
+
const gltfJson = gltf.parser.json;
|
|
148
|
+
const nodeOptions = gltfJson.nodes?.map(({ name }, index) => ({
|
|
149
|
+
name: name || index.toString(),
|
|
150
|
+
index
|
|
151
|
+
}));
|
|
152
|
+
const materialOptions = gltfJson.materials?.map(({ name }, index) => ({
|
|
153
|
+
name: name || index.toString(),
|
|
154
|
+
index
|
|
155
|
+
}));
|
|
156
|
+
const animationOptions = gltf.animations?.map(({ name }, index) => ({
|
|
157
|
+
name: name || index.toString(),
|
|
158
|
+
index
|
|
159
|
+
}));
|
|
160
|
+
const properties = {};
|
|
161
|
+
properties.nodes = {
|
|
162
|
+
options: nodeOptions,
|
|
163
|
+
properties: nodeProperties
|
|
164
|
+
};
|
|
165
|
+
if (materialOptions) properties.materials = {
|
|
166
|
+
options: materialOptions,
|
|
167
|
+
properties: materialProperties
|
|
168
|
+
};
|
|
169
|
+
if (animationOptions) properties.animations = {
|
|
170
|
+
options: animationOptions,
|
|
171
|
+
properties: animationProperties
|
|
172
|
+
};
|
|
173
|
+
return properties;
|
|
174
|
+
};
|
|
175
|
+
function createPropertyChoice(resource, name, property, index) {
|
|
176
|
+
return {
|
|
177
|
+
text: `${resource}/${name}/${property}`,
|
|
178
|
+
value: `${resource}/${index}/${property}`
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
function generateChoicesForProperty(property, resource) {
|
|
182
|
+
if (!property) return [];
|
|
183
|
+
const choices = [];
|
|
184
|
+
property.options.forEach(({ index, name }) => {
|
|
185
|
+
property.properties.forEach((property$1) => {
|
|
186
|
+
choices.push(createPropertyChoice(resource, name, property$1, index));
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
return choices;
|
|
190
|
+
}
|
|
191
|
+
function generateSettableChoices(properties) {
|
|
192
|
+
return [
|
|
193
|
+
...generateChoicesForProperty(properties.nodes, Resource.nodes),
|
|
194
|
+
...generateChoicesForProperty(properties.materials, Resource.materials),
|
|
195
|
+
...generateChoicesForProperty(properties.animations, Resource.animations)
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
function generateRaycastableChoices(properties) {
|
|
199
|
+
const choices = [];
|
|
200
|
+
properties.nodes?.options.forEach(({ index, name }) => {
|
|
201
|
+
choices.push({
|
|
202
|
+
text: `nodes/${name}`,
|
|
203
|
+
value: `nodes/${index}`
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
return choices;
|
|
207
|
+
}
|
|
208
|
+
const buildScene = ({ gltf, setOnClickListeners, setActiveAnimations }) => {
|
|
209
|
+
const properties = extractProperties(gltf);
|
|
210
|
+
const onSceneChanged = new EventEmitter();
|
|
211
|
+
const addOnClickedListener = (jsonPath, callback) => {
|
|
212
|
+
if (!setOnClickListeners) return;
|
|
213
|
+
const path = parseJsonPath(jsonPath, true);
|
|
214
|
+
setOnClickListeners((existing) => {
|
|
215
|
+
const listenersForPath = existing[jsonPath] || {
|
|
216
|
+
path,
|
|
217
|
+
elementName: getResourceName({
|
|
218
|
+
resource: path.resource,
|
|
219
|
+
index: path.index
|
|
220
|
+
}, properties),
|
|
221
|
+
callbacks: []
|
|
222
|
+
};
|
|
223
|
+
const updatedListeners = {
|
|
224
|
+
...listenersForPath,
|
|
225
|
+
callbacks: [...listenersForPath.callbacks, callback]
|
|
226
|
+
};
|
|
227
|
+
return {
|
|
228
|
+
...existing,
|
|
229
|
+
[jsonPath]: updatedListeners
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
const removeOnClickedListener = (jsonPath, callback) => {
|
|
234
|
+
if (!setOnClickListeners) return;
|
|
235
|
+
setOnClickListeners((existing) => {
|
|
236
|
+
const listenersForPath = existing[jsonPath];
|
|
237
|
+
if (!listenersForPath) return existing;
|
|
238
|
+
const updatedCallbacks = listenersForPath.callbacks.filter((x) => x !== callback);
|
|
239
|
+
if (updatedCallbacks.length > 0) {
|
|
240
|
+
const updatedListeners = {
|
|
241
|
+
...listenersForPath,
|
|
242
|
+
callback: updatedCallbacks
|
|
243
|
+
};
|
|
244
|
+
return {
|
|
245
|
+
...existing,
|
|
246
|
+
[jsonPath]: updatedListeners
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
const result = { ...existing };
|
|
250
|
+
delete result[jsonPath];
|
|
251
|
+
return result;
|
|
252
|
+
});
|
|
253
|
+
};
|
|
254
|
+
const getProperty = (jsonPath, _valueTypeName) => {
|
|
255
|
+
return getPropertyFromModel(parseJsonPath(jsonPath), gltf, properties);
|
|
256
|
+
};
|
|
257
|
+
const setProperty = (jsonPath, valueTypeName, value) => {
|
|
258
|
+
applyPropertyToModel(parseJsonPath(jsonPath), gltf, value, properties, setActiveAnimations);
|
|
259
|
+
onSceneChanged.emit();
|
|
260
|
+
};
|
|
261
|
+
const settableChoices = generateSettableChoices(properties);
|
|
262
|
+
const raycastableChoices = generateRaycastableChoices(properties);
|
|
263
|
+
const addOnSceneChangedListener = (listener) => {
|
|
264
|
+
onSceneChanged.addListener(listener);
|
|
265
|
+
};
|
|
266
|
+
const removeOnSceneChangedListener = (listener) => {
|
|
267
|
+
onSceneChanged.removeListener(listener);
|
|
268
|
+
};
|
|
269
|
+
return {
|
|
270
|
+
getProperty,
|
|
271
|
+
setProperty,
|
|
272
|
+
getProperties: () => settableChoices,
|
|
273
|
+
getRaycastableProperties: () => raycastableChoices,
|
|
274
|
+
addOnClickedListener,
|
|
275
|
+
removeOnClickedListener,
|
|
276
|
+
addOnSceneChangedListener,
|
|
277
|
+
removeOnSceneChangedListener
|
|
278
|
+
};
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
//#endregion
|
|
282
|
+
export { applyPropertyToModel, buildScene, extractProperties, generateRaycastableChoices, generateSettableChoices, parseJsonPath, toJsonPathString };
|
|
283
|
+
//# sourceMappingURL=buildScene.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildScene.js","names":["properties: Properties","choices: { text: string; value: any }[]","property","updatedListeners: OnClickListener","addOnSceneChangedListener: IScene['addOnSceneChangedListener']","removeOnSceneChangedListener: IScene['removeOnSceneChangedListener']"],"sources":["../src/buildScene.ts"],"sourcesContent":["import { type Choices, EventEmitter } from '@kiberon-labs/behave-graph';\nimport {\n type Event,\n Material,\n MeshBasicMaterial,\n Object3D,\n Quaternion,\n Vector3,\n Vector4\n} from 'three';\nimport type { GLTF } from 'three-stdlib';\n\nimport type { IScene } from './Abstractions/IScene.js';\nimport type { GLTFJson } from './GLTFJson.js';\nimport { Vec3 } from './Values/Internal/Vec3.js';\nimport { Vec4 } from './Values/Internal/Vec4.js';\n\nconst Resource = {\n nodes: 'nodes',\n materials: 'materials',\n animations: 'animations'\n} as const;\n\ntype Resource = (typeof Resource)[keyof typeof Resource];\n\nfunction toVec3(value: Vector3): Vec3 {\n return new Vec3(value.x, value.y, value.z);\n}\nfunction toVec4(value: Vector4 | Quaternion): Vec4 {\n return new Vec4(value.x, value.y, value.z, value.w);\n}\n\nexport declare type ObjectMap = {\n nodes: {\n [name: string]: Object3D;\n };\n materials: {\n [name: string]: Material;\n };\n};\n\nconst shortPathRegEx = /^\\/?(?<resource>[^/]+)\\/(?<index>\\d+)$/;\nconst jsonPathRegEx =\n /^\\/?(?<resource>[^/]+)\\/(?<index>\\d+)\\/(?<property>[^/]+)$/;\n\nexport type Optional<T> = {\n [K in keyof T]: T[K] | undefined;\n};\n\nexport type Path = {\n resource: Resource;\n index: number;\n property: string;\n};\n\nexport function toJsonPathString(\n { index, property, resource: resourceType }: Optional<Path>,\n short: boolean\n) {\n if (short) {\n if (!resourceType || index === undefined) return;\n return `${resourceType}/${index}`;\n } else {\n if (!resourceType || index === undefined || !property) return;\n return `${resourceType}/${index}/${property}`;\n }\n}\n\nexport function parseJsonPath(jsonPath: string, short = false): Path {\n // hack = for now we see if there are 2 segments to know if its short\n const regex = short ? shortPathRegEx : jsonPathRegEx;\n const matches = regex.exec(jsonPath);\n if (matches === null) throw new Error(`can not parse jsonPath: ${jsonPath}`);\n if (matches.groups === undefined)\n throw new Error(`can not parse jsonPath (no groups): ${jsonPath}`);\n return {\n resource: matches.groups.resource as Resource,\n index: +matches.groups.index!,\n property: matches.groups.property!\n };\n}\n\nexport function applyPropertyToModel(\n { resource, index, property }: Path,\n gltf: GLTF & ObjectMap,\n value: any,\n properties: Properties,\n setActiveAnimations:\n | ((animation: string, active: boolean) => void)\n | undefined\n) {\n const nodeName = getResourceName({ resource, index }, properties);\n if (!nodeName) throw new Error(`could not get node at index ${index}`);\n if (resource === Resource.nodes) {\n const node = gltf.nodes[nodeName] as unknown as Object3D | undefined;\n\n if (!node) {\n console.error(`no node at path ${nodeName}`);\n return;\n }\n\n applyNodeModifier(property, node, value);\n\n return;\n }\n if (resource === Resource.materials) {\n const node = gltf.materials[nodeName] as unknown as Material | undefined;\n\n if (!node) {\n console.error(`no node at path ${nodeName}`);\n return;\n }\n\n applyMaterialModifier(property, node, value);\n\n return;\n }\n\n if (resource === Resource.animations) {\n if (!setActiveAnimations) {\n console.error(\n 'cannot apply animation property without setActiveAnimations'\n );\n return;\n }\n\n setActiveAnimations(nodeName, value as boolean);\n return;\n }\n\n console.error(`unknown resource type ${resource}`);\n}\n\nconst getResourceName = (\n { resource, index }: Pick<Path, 'resource' | 'index'>,\n properties: Properties\n) => {\n return properties[resource]?.options[index]?.name;\n};\n\nconst getPropertyFromModel = (\n { resource, index, property }: Path,\n gltf: GLTF & ObjectMap,\n properties: Properties\n) => {\n if (resource === Resource.nodes) {\n const nodeName = getResourceName({ resource, index }, properties);\n if (!nodeName) throw new Error(`could not get node at index ${index}`);\n const node = gltf.nodes[nodeName] as unknown as Object3D | undefined;\n\n if (!node) {\n console.error(`no node at path ${nodeName}`);\n return;\n }\n\n getPropertyValue(property, node);\n\n return;\n }\n};\n\nfunction applyNodeModifier(property: string, objectRef: Object3D, value: any) {\n switch (property) {\n case 'visible': {\n objectRef.visible = value as boolean;\n break;\n }\n case 'translation': {\n const v = value as Vec3;\n objectRef.position.set(v.x, v.y, v.z);\n break;\n }\n case 'scale': {\n const v = value as Vec3;\n console.log(v.x);\n objectRef.scale.set(v.x, v.y, v.z);\n break;\n }\n case 'rotation': {\n const v = value as Vec4;\n objectRef.quaternion.set(v.x, v.y, v.z, v.w);\n break;\n }\n }\n}\n\nfunction applyMaterialModifier(\n property: string,\n materialRef: Material,\n value: any\n) {\n switch (property) {\n case 'color': {\n const basic = materialRef as MeshBasicMaterial;\n\n if (basic.color) {\n const v = value as Vec3;\n basic.color.setRGB(v.x, v.y, v.z);\n basic.needsUpdate = true;\n }\n break;\n }\n }\n}\n\nfunction getPropertyValue(property: string, objectRef: Object3D<Event>) {\n switch (property) {\n case 'visible': {\n return objectRef.visible;\n }\n case 'translation': {\n return toVec3(objectRef.position);\n }\n case 'scale': {\n return toVec3(objectRef.scale);\n }\n case 'rotation': {\n return toVec4(objectRef.quaternion);\n }\n default:\n throw new Error(`unrecognized property: ${property}`);\n }\n}\n\nexport type ResourceOption = {\n name: string;\n index: number;\n};\n\nexport type ResourceProperties = {\n options: ResourceOption[];\n properties: string[];\n};\n\ntype Properties = {\n [key in Resource]?: ResourceProperties;\n};\n\nexport type ParsableScene = GLTF &\n ObjectMap & {\n json?: GLTFJson;\n };\n\nexport const extractProperties = (gltf: ParsableScene): Properties => {\n const nodeProperties = [\n 'visible',\n 'translation',\n 'scale',\n 'rotation',\n 'color'\n ];\n const animationProperties = ['playing'];\n const materialProperties = ['color'];\n\n const gltfJson = gltf.parser.json as GLTFJson;\n\n const nodeOptions = gltfJson.nodes?.map(({ name }, index) => ({\n name: name || index.toString(),\n index\n }));\n const materialOptions = gltfJson.materials?.map(({ name }, index) => ({\n name: name || index.toString(),\n index\n }));\n const animationOptions = gltf.animations?.map(({ name }, index) => ({\n name: name || index.toString(),\n index\n }));\n\n const properties: Properties = {};\n\n properties.nodes = { options: nodeOptions, properties: nodeProperties };\n\n if (materialOptions) {\n properties.materials = {\n options: materialOptions,\n properties: materialProperties\n };\n }\n\n if (animationOptions) {\n properties.animations = {\n options: animationOptions,\n properties: animationProperties\n };\n }\n\n return properties;\n};\n\nfunction createPropertyChoice(\n resource: string,\n name: string,\n property: string,\n index: number\n): { text: string; value: any } {\n return {\n text: `${resource}/${name}/${property}`,\n value: `${resource}/${index}/${property}`\n };\n}\n\nfunction generateChoicesForProperty(\n property: ResourceProperties | undefined,\n resource: Resource\n) {\n if (!property) return [];\n const choices: { text: string; value: any }[] = [];\n\n property.options.forEach(({ index, name }) => {\n property.properties.forEach((property) => {\n choices.push(createPropertyChoice(resource, name, property, index));\n });\n });\n\n return choices;\n}\n\nexport function generateSettableChoices(properties: Properties): Choices {\n const choices: { text: string; value: any }[] = [\n ...generateChoicesForProperty(properties.nodes, Resource.nodes),\n ...generateChoicesForProperty(properties.materials, Resource.materials),\n ...generateChoicesForProperty(properties.animations, Resource.animations)\n ];\n\n return choices;\n}\n\nexport function generateRaycastableChoices(properties: Properties): Choices {\n const choices: { text: string; value: any }[] = [];\n\n properties.nodes?.options.forEach(({ index, name }) => {\n choices.push({\n text: `nodes/${name}`,\n value: `nodes/${index}`\n });\n });\n\n return choices;\n}\n\nexport type OnClickCallback = (jsonPath: string) => void;\n\nexport type OnClickListener = {\n path: Path;\n elementName: string;\n callbacks: OnClickCallback[];\n};\n\nexport type OnClickListeners = {\n [jsonPath: string]: OnClickListener;\n};\n\nexport const buildScene = ({\n gltf,\n setOnClickListeners,\n setActiveAnimations\n}: {\n gltf: GLTF & ObjectMap;\n setOnClickListeners:\n | ((cb: (existing: OnClickListeners) => OnClickListeners) => void)\n | undefined;\n setActiveAnimations:\n | ((animation: string, active: boolean) => void)\n | undefined;\n}) => {\n const properties = extractProperties(gltf);\n\n const onSceneChanged = new EventEmitter<void>();\n\n const addOnClickedListener = (\n jsonPath: string,\n callback: (jsonPath: string) => void\n ) => {\n if (!setOnClickListeners) return;\n const path = parseJsonPath(jsonPath, true);\n\n setOnClickListeners((existing) => {\n const listenersForPath = existing[jsonPath] || {\n path,\n elementName: getResourceName(\n { resource: path.resource, index: path.index },\n properties\n )!,\n callbacks: []\n };\n\n const updatedListeners: OnClickListener = {\n ...listenersForPath,\n callbacks: [...listenersForPath.callbacks, callback]\n };\n\n const result: OnClickListeners = {\n ...existing,\n [jsonPath]: updatedListeners\n };\n\n return result;\n });\n };\n\n const removeOnClickedListener = (\n jsonPath: string,\n callback: (jsonPath: string) => void\n ) => {\n if (!setOnClickListeners) return;\n setOnClickListeners((existing) => {\n const listenersForPath = existing[jsonPath];\n\n if (!listenersForPath) return existing;\n\n const updatedCallbacks = listenersForPath.callbacks.filter(\n (x) => x !== callback\n );\n\n if (updatedCallbacks.length > 0) {\n const updatedListeners = {\n ...listenersForPath,\n callback: updatedCallbacks\n };\n\n return {\n ...existing,\n [jsonPath]: updatedListeners\n };\n }\n\n const result = {\n ...existing\n };\n\n delete result[jsonPath];\n\n return result;\n });\n };\n\n const getProperty = (jsonPath: string, _valueTypeName: string) => {\n const path = parseJsonPath(jsonPath);\n\n return getPropertyFromModel(path, gltf, properties);\n };\n\n const setProperty = (jsonPath: string, valueTypeName: string, value: any) => {\n const path = parseJsonPath(jsonPath);\n\n applyPropertyToModel(path, gltf, value, properties, setActiveAnimations);\n\n onSceneChanged.emit();\n };\n\n const settableChoices = generateSettableChoices(properties);\n const raycastableChoices = generateRaycastableChoices(properties);\n\n const addOnSceneChangedListener: IScene['addOnSceneChangedListener'] = (\n listener\n ) => {\n onSceneChanged.addListener(listener);\n };\n\n const removeOnSceneChangedListener: IScene['removeOnSceneChangedListener'] = (\n listener\n ) => {\n onSceneChanged.removeListener(listener);\n };\n\n const scene: IScene = {\n getProperty,\n setProperty,\n getProperties: () => settableChoices,\n getRaycastableProperties: () => raycastableChoices,\n addOnClickedListener,\n removeOnClickedListener,\n addOnSceneChangedListener,\n removeOnSceneChangedListener\n };\n\n return scene;\n};\n"],"mappings":";;;;;;AAiBA,MAAM,WAAW;CACf,OAAO;CACP,WAAW;CACX,YAAY;CACb;AAID,SAAS,OAAO,OAAsB;A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AAS,GAAG;IAC/B,MAAM,mBAAmB;KACvB,GAAG;KACH,UAAU;KACX;AAED,WAAO;KACL,GAAG;MACF,WAAW;KACb;;GAGH,MAAM,SAAS,EACb,GAAG,UACJ;AAED,UAAO,OAAO;AAEd,UAAO;IACP;;CAGJ,MAAM,eAAe,UAAkB,mBAA2B;AAGhE,SAAO,qBAFM,cAAc,SAAS,EAEF,MAAM,WAAW;;CAGrD,MAAM,eAAe,UAAkB,eAAuB,UAAe;AAG3E,uBAFa,cAAc,SAAS,EAET,MAAM,OAAO,YAAY,oBAAoB;AAExE,iBAAe,MAAM;;CAGvB,MAAM,kBAAkB,wBAAwB,WAAW;CAC3D,MAAM,qBAAqB,2BAA2B,WAAW;CAEjE,MAAMC,6BACJ,aACG;AACH,iBAAe,YAAY,SAAS;;CAGtC,MAAMC,gCACJ,aACG;AACH,iBAAe,eAAe,SAAS;;AAczC,QAXsB;EACpB;EACA;EACA,qBAAqB;EACrB,gCAAgC;EAChC;EACA;EACA;EACA;EACD"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { IScene } from "./Abstractions/IScene.js";
|
|
2
|
+
import { DummyScene } from "./Abstractions/Drivers/DummyScene.js";
|
|
3
|
+
import { Vec2, Vec2JSON, vec2Add, vec2Dot, vec2Equals, vec2FromArray, vec2Length, vec2Mix, vec2MultiplyByScalar, vec2Negate, vec2Normalize, vec2Parse, vec2Subtract, vec2ToArray, vec2ToString } from "./Values/Internal/Vec2.js";
|
|
4
|
+
import { Vec4, Vec4JSON, angleAxisToQuat, eulerToQuat, mat3ToQuat, mat4ToQuat, quatConjugate, quatExp, quatLn, quatMultiply, quatPow, quatSlerp, quatToAngleAxis, vec4Add, vec4Dot, vec4Equals, vec4FromArray, vec4Length, vec4Mix, vec4MultiplyByScalar, vec4Negate, vec4Normalize, vec4Parse, vec4Subtract, vec4ToArray, vec4ToString } from "./Values/Internal/Vec4.js";
|
|
5
|
+
import { Vec3, Vec3JSON, hexToRGB, hslToRGB, mat3ToEuler, mat4ToEuler, quatToEuler, rgbToHSL, rgbToHex, vec3Add, vec3Cross, vec3Dot, vec3Equals, vec3FromArray, vec3Length, vec3Mix, vec3MultiplyByScalar, vec3Negate, vec3Normalize, vec3Parse, vec3Subtract, vec3ToArray, vec3ToString } from "./Values/Internal/Vec3.js";
|
|
6
|
+
import { Mat4, Mat4JSON, column4ToMat4, eulerToMat4, mat3ToMat4, mat4Add, mat4Adjoint, mat4Determinant, mat4Equals, mat4FromArray, mat4Inverse, mat4LookAt, mat4Mix, mat4Multiply, mat4MultiplyByScalar, mat4Negate, mat4Orthogonal, mat4OrthogonalSimple, mat4Parse, mat4Perspective, mat4PerspectiveFov, mat4RotateByEuler, mat4RotateByQuat, mat4Scale, mat4SetColumn4, mat4SetRow4, mat4Subtract, mat4ToArray, mat4ToScale3, mat4ToString, mat4ToTranslation3, mat4TransformNormal3, mat4TransformPoint3, mat4Translate, mat4Transpose, quatToMat4, scale3ToMat4, translation3ToMat4 } from "./Values/Internal/Mat4.js";
|
|
7
|
+
import { Mat3, Mat3JSON, column3ToMat3, eulerToMat3, mat3Add, mat3Determinant, mat3Equals, mat3FromArray, mat3Inverse, mat3Mix, mat3Multiply, mat3MultiplyByScalar, mat3Negate, mat3Parse, mat3SetColumn3, mat3SetRow3, mat3Subtract, mat3ToArray, mat3ToScale2, mat3ToScale3, mat3ToString, mat3ToTranslation2, mat3Transpose, mat4ToMat3, quatToMat3, scale2ToMat3, scale3ToMat3, translation2ToMat3 } from "./Values/Internal/Mat3.js";
|
|
8
|
+
import { ColorValue } from "./Values/ColorValue.js";
|
|
9
|
+
import { EulerValue } from "./Values/EulerValue.js";
|
|
10
|
+
import { Mat3Value } from "./Values/Mat3Value.js";
|
|
11
|
+
import { Mat4Value } from "./Values/Mat4Value.js";
|
|
12
|
+
import { Vec2Value } from "./Values/Vec2Value.js";
|
|
13
|
+
import { Vec3Value } from "./Values/Vec3Value.js";
|
|
14
|
+
import { Vec4Value } from "./Values/Vec4Value.js";
|
|
15
|
+
import { QuatValue } from "./Values/QuatValue.js";
|
|
16
|
+
import { SetSceneProperty } from "./Nodes/Actions/SetSceneProperty.js";
|
|
17
|
+
import { EaseSceneProperty } from "./Nodes/Actions/EaseSceneProperty.js";
|
|
18
|
+
import { OnSceneNodeClick } from "./Nodes/Events/OnSceneNodeClick.js";
|
|
19
|
+
import { ColorNodes_d_exports } from "./Nodes/Logic/ColorNodes.js";
|
|
20
|
+
import { EulerNodes_d_exports } from "./Nodes/Logic/EulerNodes.js";
|
|
21
|
+
import { Mat3Nodes_d_exports } from "./Nodes/Logic/Mat3Nodes.js";
|
|
22
|
+
import { Mat4Nodes_d_exports } from "./Nodes/Logic/Mat4Nodes.js";
|
|
23
|
+
import { Vec2Nodes_d_exports } from "./Nodes/Logic/Vec2Nodes.js";
|
|
24
|
+
import { Vec3Nodes_d_exports } from "./Nodes/Logic/Vec3Nodes.js";
|
|
25
|
+
import { Vec4Nodes_d_exports } from "./Nodes/Logic/Vec4Nodes.js";
|
|
26
|
+
import { QuatNodes_d_exports } from "./Nodes/Logic/QuatNodes.js";
|
|
27
|
+
import { VecElements } from "./Nodes/Logic/VecElements.js";
|
|
28
|
+
import { GetSceneProperty } from "./Nodes/Queries/GetSceneProperty.js";
|
|
29
|
+
import { getSceneNodesMap, getSceneStringConversions, getSceneValuesMap, registerSceneProfile } from "./registerSceneProfile.js";
|
|
30
|
+
import { ObjectMap, OnClickCallback, OnClickListener, OnClickListeners, Optional, ParsableScene, Path, ResourceOption, ResourceProperties, applyPropertyToModel, buildScene, extractProperties, generateRaycastableChoices, generateSettableChoices, parseJsonPath, toJsonPathString } from "./buildScene.js";
|
|
31
|
+
export { ColorNodes_d_exports as ColorNodes, ColorValue, DummyScene, EaseSceneProperty, EulerNodes_d_exports as EulerNodes, EulerValue, GetSceneProperty, IScene, Mat3, Mat3JSON, Mat3Nodes_d_exports as Mat3Nodes, Mat3Value, Mat4, Mat4JSON, Mat4Nodes_d_exports as Mat4Nodes, Mat4Value, ObjectMap, OnClickCallback, OnClickListener, OnClickListeners, OnSceneNodeClick, Optional, ParsableScene, Path, QuatNodes_d_exports as QuatNodes, QuatValue, ResourceOption, ResourceProperties, SetSceneProperty, Vec2, Vec2JSON, Vec2Nodes_d_exports as Vec2Nodes, Vec2Value, Vec3, Vec3JSON, Vec3Nodes_d_exports as Vec3Nodes, Vec3Value, Vec4, Vec4JSON, Vec4Nodes_d_exports as Vec4Nodes, Vec4Value, VecElements, angleAxisToQuat, applyPropertyToModel, buildScene, column3ToMat3, column4ToMat4, eulerToMat3, eulerToMat4, eulerToQuat, extractProperties, generateRaycastableChoices, generateSettableChoices, getSceneNodesMap, getSceneStringConversions, getSceneValuesMap, hexToRGB, hslToRGB, mat3Add, mat3Determinant, mat3Equals, mat3FromArray, mat3Inverse, mat3Mix, mat3Multiply, mat3MultiplyByScalar, mat3Negate, mat3Parse, mat3SetColumn3, mat3SetRow3, mat3Subtract, mat3ToArray, mat3ToEuler, mat3ToMat4, mat3ToQuat, mat3ToScale2, mat3ToScale3, mat3ToString, mat3ToTranslation2, mat3Transpose, mat4Add, mat4Adjoint, mat4Determinant, mat4Equals, mat4FromArray, mat4Inverse, mat4LookAt, mat4Mix, mat4Multiply, mat4MultiplyByScalar, mat4Negate, mat4Orthogonal, mat4OrthogonalSimple, mat4Parse, mat4Perspective, mat4PerspectiveFov, mat4RotateByEuler, mat4RotateByQuat, mat4Scale, mat4SetColumn4, mat4SetRow4, mat4Subtract, mat4ToArray, mat4ToEuler, mat4ToMat3, mat4ToQuat, mat4ToScale3, mat4ToString, mat4ToTranslation3, mat4TransformNormal3, mat4TransformPoint3, mat4Translate, mat4Transpose, parseJsonPath, quatConjugate, quatExp, quatLn, quatMultiply, quatPow, quatSlerp, quatToAngleAxis, quatToEuler, quatToMat3, quatToMat4, registerSceneProfile, rgbToHSL, rgbToHex, scale2ToMat3, scale3ToMat3, scale3ToMat4, toJsonPathString, translation2ToMat3, translation3ToMat4, vec2Add, vec2Dot, vec2Equals, vec2FromArray, vec2Length, vec2Mix, vec2MultiplyByScalar, vec2Negate, vec2Normalize, vec2Parse, vec2Subtract, vec2ToArray, vec2ToString, vec3Add, vec3Cross, vec3Dot, vec3Equals, vec3FromArray, vec3Length, vec3Mix, vec3MultiplyByScalar, vec3Negate, vec3Normalize, vec3Parse, vec3Subtract, vec3ToArray, vec3ToString, vec4Add, vec4Dot, vec4Equals, vec4FromArray, vec4Length, vec4Mix, vec4MultiplyByScalar, vec4Negate, vec4Normalize, vec4Parse, vec4Subtract, vec4ToArray, vec4ToString };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Vec2, vec2Add, vec2Dot, vec2Equals, vec2FromArray, vec2Length, vec2Mix, vec2MultiplyByScalar, vec2Negate, vec2Normalize, vec2Parse, vec2Subtract, vec2ToArray, vec2ToString } from "./Values/Internal/Vec2.js";
|
|
2
|
+
import { Vec4, angleAxisToQuat, eulerToQuat, mat3ToQuat, mat4ToQuat, quatConjugate, quatExp, quatLn, quatMultiply, quatPow, quatSlerp, quatToAngleAxis, vec4Add, vec4Dot, vec4Equals, vec4FromArray, vec4Length, vec4Mix, vec4MultiplyByScalar, vec4Negate, vec4Normalize, vec4Parse, vec4Subtract, vec4ToArray, vec4ToString } from "./Values/Internal/Vec4.js";
|
|
3
|
+
import { Mat4, column4ToMat4, eulerToMat4, mat3ToMat4, mat4Add, mat4Adjoint, mat4Determinant, mat4Equals, mat4FromArray, mat4Inverse, mat4LookAt, mat4Mix, mat4Multiply, mat4MultiplyByScalar, mat4Negate, mat4Orthogonal, mat4OrthogonalSimple, mat4Parse, mat4Perspective, mat4PerspectiveFov, mat4RotateByEuler, mat4RotateByQuat, mat4Scale, mat4SetColumn4, mat4SetRow4, mat4Subtract, mat4ToArray, mat4ToScale3, mat4ToString, mat4ToTranslation3, mat4TransformNormal3, mat4TransformPoint3, mat4Translate, mat4Transpose, quatToMat4, scale3ToMat4, translation3ToMat4 } from "./Values/Internal/Mat4.js";
|
|
4
|
+
import { Mat3, column3ToMat3, eulerToMat3, mat3Add, mat3Determinant, mat3Equals, mat3FromArray, mat3Inverse, mat3Mix, mat3Multiply, mat3MultiplyByScalar, mat3Negate, mat3Parse, mat3SetColumn3, mat3SetRow3, mat3Subtract, mat3ToArray, mat3ToScale2, mat3ToScale3, mat3ToString, mat3ToTranslation2, mat3Transpose, mat4ToMat3, quatToMat3, scale2ToMat3, scale3ToMat3, translation2ToMat3 } from "./Values/Internal/Mat3.js";
|
|
5
|
+
import { Vec3, hexToRGB, hslToRGB, mat3ToEuler, mat4ToEuler, quatToEuler, rgbToHSL, rgbToHex, vec3Add, vec3Cross, vec3Dot, vec3Equals, vec3FromArray, vec3Length, vec3Mix, vec3MultiplyByScalar, vec3Negate, vec3Normalize, vec3Parse, vec3Subtract, vec3ToArray, vec3ToString } from "./Values/Internal/Vec3.js";
|
|
6
|
+
import { ColorValue } from "./Values/ColorValue.js";
|
|
7
|
+
import { EulerValue } from "./Values/EulerValue.js";
|
|
8
|
+
import { QuatValue } from "./Values/QuatValue.js";
|
|
9
|
+
import { Vec2Value } from "./Values/Vec2Value.js";
|
|
10
|
+
import { Vec3Value } from "./Values/Vec3Value.js";
|
|
11
|
+
import { Vec4Value } from "./Values/Vec4Value.js";
|
|
12
|
+
import { DummyScene } from "./Abstractions/Drivers/DummyScene.js";
|
|
13
|
+
import { Mat3Value } from "./Values/Mat3Value.js";
|
|
14
|
+
import { Mat4Value } from "./Values/Mat4Value.js";
|
|
15
|
+
import { SetSceneProperty } from "./Nodes/Actions/SetSceneProperty.js";
|
|
16
|
+
import { EaseSceneProperty } from "./Nodes/Actions/EaseSceneProperty.js";
|
|
17
|
+
import { OnSceneNodeClick } from "./Nodes/Events/OnSceneNodeClick.js";
|
|
18
|
+
import { ColorNodes_exports } from "./Nodes/Logic/ColorNodes.js";
|
|
19
|
+
import { EulerNodes_exports } from "./Nodes/Logic/EulerNodes.js";
|
|
20
|
+
import { Mat3Nodes_exports } from "./Nodes/Logic/Mat3Nodes.js";
|
|
21
|
+
import { Mat4Nodes_exports } from "./Nodes/Logic/Mat4Nodes.js";
|
|
22
|
+
import { Vec2Nodes_exports } from "./Nodes/Logic/Vec2Nodes.js";
|
|
23
|
+
import { Vec3Nodes_exports } from "./Nodes/Logic/Vec3Nodes.js";
|
|
24
|
+
import { Vec4Nodes_exports } from "./Nodes/Logic/Vec4Nodes.js";
|
|
25
|
+
import { QuatNodes_exports } from "./Nodes/Logic/QuatNodes.js";
|
|
26
|
+
import { VecElements } from "./Nodes/Logic/VecElements.js";
|
|
27
|
+
import { GetSceneProperty } from "./Nodes/Queries/GetSceneProperty.js";
|
|
28
|
+
import { getSceneNodesMap, getSceneStringConversions, getSceneValuesMap, registerSceneProfile } from "./registerSceneProfile.js";
|
|
29
|
+
import { applyPropertyToModel, buildScene, extractProperties, generateRaycastableChoices, generateSettableChoices, parseJsonPath, toJsonPathString } from "./buildScene.js";
|
|
30
|
+
|
|
31
|
+
export { ColorNodes_exports as ColorNodes, ColorValue, DummyScene, EaseSceneProperty, EulerNodes_exports as EulerNodes, EulerValue, GetSceneProperty, Mat3, Mat3Nodes_exports as Mat3Nodes, Mat3Value, Mat4, Mat4Nodes_exports as Mat4Nodes, Mat4Value, OnSceneNodeClick, QuatNodes_exports as QuatNodes, QuatValue, SetSceneProperty, Vec2, Vec2Nodes_exports as Vec2Nodes, Vec2Value, Vec3, Vec3Nodes_exports as Vec3Nodes, Vec3Value, Vec4, Vec4Nodes_exports as Vec4Nodes, Vec4Value, VecElements, angleAxisToQuat, applyPropertyToModel, buildScene, column3ToMat3, column4ToMat4, eulerToMat3, eulerToMat4, eulerToQuat, extractProperties, generateRaycastableChoices, generateSettableChoices, getSceneNodesMap, getSceneStringConversions, getSceneValuesMap, hexToRGB, hslToRGB, mat3Add, mat3Determinant, mat3Equals, mat3FromArray, mat3Inverse, mat3Mix, mat3Multiply, mat3MultiplyByScalar, mat3Negate, mat3Parse, mat3SetColumn3, mat3SetRow3, mat3Subtract, mat3ToArray, mat3ToEuler, mat3ToMat4, mat3ToQuat, mat3ToScale2, mat3ToScale3, mat3ToString, mat3ToTranslation2, mat3Transpose, mat4Add, mat4Adjoint, mat4Determinant, mat4Equals, mat4FromArray, mat4Inverse, mat4LookAt, mat4Mix, mat4Multiply, mat4MultiplyByScalar, mat4Negate, mat4Orthogonal, mat4OrthogonalSimple, mat4Parse, mat4Perspective, mat4PerspectiveFov, mat4RotateByEuler, mat4RotateByQuat, mat4Scale, mat4SetColumn4, mat4SetRow4, mat4Subtract, mat4ToArray, mat4ToEuler, mat4ToMat3, mat4ToQuat, mat4ToScale3, mat4ToString, mat4ToTranslation3, mat4TransformNormal3, mat4TransformPoint3, mat4Translate, mat4Transpose, parseJsonPath, quatConjugate, quatExp, quatLn, quatMultiply, quatPow, quatSlerp, quatToAngleAxis, quatToEuler, quatToMat3, quatToMat4, registerSceneProfile, rgbToHSL, rgbToHex, scale2ToMat3, scale3ToMat3, scale3ToMat4, toJsonPathString, translation2ToMat3, translation3ToMat4, vec2Add, vec2Dot, vec2Equals, vec2FromArray, vec2Length, vec2Mix, vec2MultiplyByScalar, vec2Negate, vec2Normalize, vec2Parse, vec2Subtract, vec2ToArray, vec2ToString, vec3Add, vec3Cross, vec3Dot, vec3Equals, vec3FromArray, vec3Length, vec3Mix, vec3MultiplyByScalar, vec3Negate, vec3Normalize, vec3Parse, vec3Subtract, vec3ToArray, vec3ToString, vec4Add, vec4Dot, vec4Equals, vec4FromArray, vec4Length, vec4Mix, vec4MultiplyByScalar, vec4Negate, vec4Normalize, vec4Parse, vec4Subtract, vec4ToArray, vec4ToString };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { IRegistry, NodeDefinition, ValueType } from "@kiberon-labs/behave-graph";
|
|
2
|
+
|
|
3
|
+
//#region src/registerSceneProfile.d.ts
|
|
4
|
+
declare const getSceneValuesMap: any;
|
|
5
|
+
declare const getSceneStringConversions: (values: Record<string, ValueType>) => NodeDefinition[];
|
|
6
|
+
declare const getSceneNodesMap: any;
|
|
7
|
+
declare const registerSceneProfile: (registry: IRegistry) => IRegistry;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { getSceneNodesMap, getSceneStringConversions, getSceneValuesMap, registerSceneProfile };
|
|
10
|
+
//# sourceMappingURL=registerSceneProfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerSceneProfile.d.ts","names":[],"sources":["../src/registerSceneProfile.ts"],"sourcesContent":[],"mappings":";;;cAiCa;cAiBA,oCACH,eAAe,eACtB;AAnBU,cAwBA,gBATX,EAAA,GAAA;AAEW,cAyCA,oBApCV,EAAA,CAAA,QAAA,EAoC4C,SApC5C,EAAA,GAoCwD,SApCxD"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { ColorValue } from "./Values/ColorValue.js";
|
|
2
|
+
import { EulerValue } from "./Values/EulerValue.js";
|
|
3
|
+
import { QuatValue } from "./Values/QuatValue.js";
|
|
4
|
+
import { Vec2Value } from "./Values/Vec2Value.js";
|
|
5
|
+
import { Vec3Value } from "./Values/Vec3Value.js";
|
|
6
|
+
import { Vec4Value } from "./Values/Vec4Value.js";
|
|
7
|
+
import { Mat3Value } from "./Values/Mat3Value.js";
|
|
8
|
+
import { Mat4Value } from "./Values/Mat4Value.js";
|
|
9
|
+
import { SetSceneProperty } from "./Nodes/Actions/SetSceneProperty.js";
|
|
10
|
+
import { OnSceneNodeClick } from "./Nodes/Events/OnSceneNodeClick.js";
|
|
11
|
+
import { ColorNodes_exports } from "./Nodes/Logic/ColorNodes.js";
|
|
12
|
+
import { EulerNodes_exports } from "./Nodes/Logic/EulerNodes.js";
|
|
13
|
+
import { Mat3Nodes_exports } from "./Nodes/Logic/Mat3Nodes.js";
|
|
14
|
+
import { Mat4Nodes_exports } from "./Nodes/Logic/Mat4Nodes.js";
|
|
15
|
+
import { Vec2Nodes_exports } from "./Nodes/Logic/Vec2Nodes.js";
|
|
16
|
+
import { Vec3Nodes_exports } from "./Nodes/Logic/Vec3Nodes.js";
|
|
17
|
+
import { Vec4Nodes_exports } from "./Nodes/Logic/Vec4Nodes.js";
|
|
18
|
+
import { QuatNodes_exports } from "./Nodes/Logic/QuatNodes.js";
|
|
19
|
+
import { GetSceneProperty } from "./Nodes/Queries/GetSceneProperty.js";
|
|
20
|
+
import { getCoreValuesMap, getNodeDescriptions, getStringConversionsForValueType, memo } from "@kiberon-labs/behave-graph";
|
|
21
|
+
|
|
22
|
+
//#region src/registerSceneProfile.ts
|
|
23
|
+
const getSceneValuesMap = memo(() => {
|
|
24
|
+
const valueTypes = [
|
|
25
|
+
Vec2Value,
|
|
26
|
+
Vec3Value,
|
|
27
|
+
Vec4Value,
|
|
28
|
+
ColorValue,
|
|
29
|
+
EulerValue,
|
|
30
|
+
QuatValue,
|
|
31
|
+
Mat3Value,
|
|
32
|
+
Mat4Value
|
|
33
|
+
];
|
|
34
|
+
return Object.fromEntries(valueTypes.map((valueType) => [valueType.name, valueType]));
|
|
35
|
+
});
|
|
36
|
+
const getSceneStringConversions = (values) => Object.keys(values).flatMap((valueTypeName) => getStringConversionsForValueType({
|
|
37
|
+
values,
|
|
38
|
+
valueTypeName
|
|
39
|
+
}));
|
|
40
|
+
const getSceneNodesMap = memo(() => {
|
|
41
|
+
const allValueTypeNames = Object.keys({
|
|
42
|
+
...getCoreValuesMap(),
|
|
43
|
+
...getSceneValuesMap()
|
|
44
|
+
});
|
|
45
|
+
const nodeDefinitions = [
|
|
46
|
+
...getNodeDescriptions(Vec2Nodes_exports),
|
|
47
|
+
...getNodeDescriptions(Vec3Nodes_exports),
|
|
48
|
+
...getNodeDescriptions(Vec4Nodes_exports),
|
|
49
|
+
...getNodeDescriptions(ColorNodes_exports),
|
|
50
|
+
...getNodeDescriptions(EulerNodes_exports),
|
|
51
|
+
...getNodeDescriptions(QuatNodes_exports),
|
|
52
|
+
...getNodeDescriptions(Mat3Nodes_exports),
|
|
53
|
+
...getNodeDescriptions(Mat4Nodes_exports),
|
|
54
|
+
OnSceneNodeClick,
|
|
55
|
+
...SetSceneProperty(allValueTypeNames),
|
|
56
|
+
...GetSceneProperty(allValueTypeNames),
|
|
57
|
+
...getSceneStringConversions(getSceneValuesMap())
|
|
58
|
+
];
|
|
59
|
+
return Object.fromEntries(nodeDefinitions.map((nodeDefinition) => [nodeDefinition.typeName, nodeDefinition]));
|
|
60
|
+
});
|
|
61
|
+
const registerSceneProfile = (registry) => {
|
|
62
|
+
return {
|
|
63
|
+
values: {
|
|
64
|
+
...registry.values,
|
|
65
|
+
...getCoreValuesMap(),
|
|
66
|
+
...getSceneValuesMap()
|
|
67
|
+
},
|
|
68
|
+
nodes: {
|
|
69
|
+
...registry.nodes,
|
|
70
|
+
...getSceneNodesMap()
|
|
71
|
+
},
|
|
72
|
+
dependencies: { ...registry.dependencies }
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
//#endregion
|
|
77
|
+
export { getSceneNodesMap, getSceneStringConversions, getSceneValuesMap, registerSceneProfile };
|
|
78
|
+
//# sourceMappingURL=registerSceneProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registerSceneProfile.js","names":["Vec2Nodes","Vec3Nodes","Vec4Nodes","ColorNodes","EulerNodes","QuatNodes","Mat3Nodes","Mat4Nodes"],"sources":["../src/registerSceneProfile.ts"],"sourcesContent":["import {\n getCoreValuesMap,\n getNodeDescriptions,\n getStringConversionsForValueType,\n memo\n} from '@kiberon-labs/behave-graph';\nimport type {\n IRegistry,\n NodeDefinition,\n ValueType,\n ValueTypeMap\n} from '@kiberon-labs/behave-graph';\n\nimport { SetSceneProperty } from './Nodes/Actions/SetSceneProperty.js';\nimport { OnSceneNodeClick } from './Nodes/Events/OnSceneNodeClick.js';\nimport * as ColorNodes from './Nodes/Logic/ColorNodes.js';\nimport * as EulerNodes from './Nodes/Logic/EulerNodes.js';\nimport * as Mat3Nodes from './Nodes/Logic/Mat3Nodes.js';\nimport * as Mat4Nodes from './Nodes/Logic/Mat4Nodes.js';\nimport * as QuatNodes from './Nodes/Logic/QuatNodes.js';\nimport * as Vec2Nodes from './Nodes/Logic/Vec2Nodes.js';\nimport * as Vec3Nodes from './Nodes/Logic/Vec3Nodes.js';\nimport * as Vec4Nodes from './Nodes/Logic/Vec4Nodes.js';\nimport { GetSceneProperty } from './Nodes/Queries/GetSceneProperty.js';\nimport { ColorValue } from './Values/ColorValue.js';\nimport { EulerValue } from './Values/EulerValue.js';\nimport { Mat3Value } from './Values/Mat3Value.js';\nimport { Mat4Value } from './Values/Mat4Value.js';\nimport { QuatValue } from './Values/QuatValue.js';\nimport { Vec2Value } from './Values/Vec2Value.js';\nimport { Vec3Value } from './Values/Vec3Value.js';\nimport { Vec4Value } from './Values/Vec4Value.js';\n\nexport const getSceneValuesMap = memo<ValueTypeMap>(() => {\n const valueTypes = [\n Vec2Value,\n Vec3Value,\n Vec4Value,\n ColorValue,\n EulerValue,\n QuatValue,\n Mat3Value,\n Mat4Value\n ];\n const temp = Object.fromEntries(\n valueTypes.map((valueType) => [valueType.name, valueType])\n );\n return temp;\n});\n\nexport const getSceneStringConversions = (\n values: Record<string, ValueType>\n): NodeDefinition[] =>\n Object.keys(values).flatMap((valueTypeName) =>\n getStringConversionsForValueType({ values, valueTypeName })\n );\n\nexport const getSceneNodesMap = memo<Record<string, NodeDefinition>>(() => {\n const allValueTypeNames = Object.keys({\n ...getCoreValuesMap(),\n ...getSceneValuesMap()\n });\n\n const nodeDefinitions = [\n // pull in value type nodes\n ...getNodeDescriptions(Vec2Nodes),\n ...getNodeDescriptions(Vec3Nodes),\n ...getNodeDescriptions(Vec4Nodes),\n ...getNodeDescriptions(ColorNodes),\n ...getNodeDescriptions(EulerNodes),\n ...getNodeDescriptions(QuatNodes),\n ...getNodeDescriptions(Mat3Nodes),\n ...getNodeDescriptions(Mat4Nodes),\n\n // events\n OnSceneNodeClick,\n // actions\n ...SetSceneProperty(allValueTypeNames),\n ...GetSceneProperty(allValueTypeNames),\n\n ...getSceneStringConversions(getSceneValuesMap())\n ];\n\n return Object.fromEntries(\n nodeDefinitions.map((nodeDefinition) => [\n nodeDefinition.typeName,\n nodeDefinition\n ])\n );\n});\n\nexport const registerSceneProfile = (registry: IRegistry): IRegistry => {\n const values = {\n ...registry.values,\n ...getCoreValuesMap(),\n ...getSceneValuesMap()\n };\n return {\n values,\n nodes: { ...registry.nodes, ...getSceneNodesMap() },\n dependencies: {\n ...registry.dependencies\n }\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,oBAAoB,WAAyB;CACxD,MAAM,aAAa;EACjB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD;AAID,QAHa,OAAO,YAClB,WAAW,KAAK,cAAc,CAAC,UAAU,MAAM,UAAU,CAAC,CAC3D;EAED;AAEF,MAAa,6BACX,WAEA,OAAO,KAAK,OAAO,CAAC,SAAS,kBAC3B,iCAAiC;CAAE;CAAQ;CAAe,CAAC,CAC5D;AAEH,MAAa,mBAAmB,WAA2C;CACzE,MAAM,oBAAoB,OAAO,KAAK;EACpC,GAAG,kBAAkB;EACrB,GAAG,mBAAmB;EACvB,CAAC;CAEF,MAAM,kBAAkB;EAEtB,GAAG,oBAAoBA,kBAAU;EACjC,GAAG,oBAAoBC,kBAAU;EACjC,GAAG,oBAAoBC,kBAAU;EACjC,GAAG,oBAAoBC,mBAAW;EAClC,GAAG,oBAAoBC,mBAAW;EAClC,GAAG,oBAAoBC,kBAAU;EACjC,GAAG,oBAAoBC,kBAAU;EACjC,GAAG,oBAAoBC,kBAAU;EAGjC;EAEA,GAAG,iBAAiB,kBAAkB;EACtC,GAAG,iBAAiB,kBAAkB;EAEtC,GAAG,0BAA0B,mBAAmB,CAAC;EAClD;AAED,QAAO,OAAO,YACZ,gBAAgB,KAAK,mBAAmB,CACtC,eAAe,UACf,eACD,CAAC,CACH;EACD;AAEF,MAAa,wBAAwB,aAAmC;AAMtE,QAAO;EACL,QANa;GACb,GAAG,SAAS;GACZ,GAAG,kBAAkB;GACrB,GAAG,mBAAmB;GACvB;EAGC,OAAO;GAAE,GAAG,SAAS;GAAO,GAAG,kBAAkB;GAAE;EACnD,cAAc,EACZ,GAAG,SAAS,cACb;EACF"}
|