@woosh/meep-engine 2.109.10 → 2.109.11
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/editor/tools/v2/GizmoNode.js +71 -0
- package/editor/tools/v2/TransformControls.js +10 -980
- package/editor/tools/v2/TransformControlsGizmo.js +774 -0
- package/editor/tools/v2/TransformControlsPlane.js +118 -0
- package/editor/tools/v2/TransformMode.js +8 -0
- package/editor/tools/v2/TranslateHelperGeometry.js +14 -0
- package/package.json +1 -1
- package/src/core/model/node-graph/NodeGraph.spec.js +1 -1
- package/src/core/model/node-graph/node/NodeDescription.d.ts +1 -1
- package/src/core/model/node-graph/node/NodeDescription.spec.js +1 -1
- package/src/core/model/node-graph/node/NodeInstance.spec.js +1 -1
- package/src/core/model/node-graph/node/NodeInstancePortReference.spec.js +1 -1
- package/src/core/model/node-graph/node/NodeRegistry.d.ts +1 -1
- package/src/core/model/node-graph/node/NodeRegistry.d.ts.map +1 -1
- package/src/core/model/node-graph/node/NodeRegistry.js +5 -5
- package/src/core/model/node-graph/node/NodeRegistry.spec.js +1 -1
- package/src/core/model/node-graph/node/Port.d.ts.map +1 -1
- package/src/core/model/node-graph/node/Port.js +1 -1
- package/src/core/model/node-graph/node/Port.spec.js +1 -1
- package/src/core/model/node-graph/type/DataType.d.ts.map +1 -0
- package/src/core/model/node-graph/{DataType.js → type/DataType.js} +2 -2
- package/src/core/model/node-graph/type/DataType.spec.d.ts.map +1 -0
- package/src/core/model/node-graph/{ParametricDataType.d.ts → type/ParametricDataType.d.ts} +6 -1
- package/src/core/model/node-graph/type/ParametricDataType.d.ts.map +1 -0
- package/src/core/model/node-graph/{ParametricDataType.js → type/ParametricDataType.js} +19 -4
- package/src/core/model/node-graph/type/ParametricDataType.spec.d.ts +2 -0
- package/src/core/model/node-graph/type/ParametricDataType.spec.d.ts.map +1 -0
- package/src/core/model/node-graph/type/ParametricDataType.spec.js +63 -0
- package/src/core/model/node-graph/type/deserializeDataTypeFromJSON.d.ts +8 -0
- package/src/core/model/node-graph/type/deserializeDataTypeFromJSON.d.ts.map +1 -0
- package/src/core/model/node-graph/type/deserializeDataTypeFromJSON.js +24 -0
- package/src/engine/graphics/geometry/CircleGeometry.d.ts +20 -0
- package/src/engine/graphics/geometry/CircleGeometry.d.ts.map +1 -0
- package/src/engine/graphics/geometry/CircleGeometry.js +17 -0
- package/src/engine/graphics/particles/node-based/nodes/ParticleDataTypes.js +1 -1
- package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.d.ts +10 -8
- package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.d.ts.map +1 -1
- package/src/engine/graphics/sh3/gi/material/common.glsl +115 -93
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts +4 -0
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/LightProbeVolume.js +4 -0
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/PathTracerProbeRenderer.js +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.d.ts.map +1 -1
- package/src/engine/graphics/sh3/lpv/depth/octahedral/bake_octahedral_depth_map.js +52 -0
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +5 -5
- package/src/core/model/node-graph/DataType.d.ts.map +0 -1
- package/src/core/model/node-graph/DataType.spec.d.ts.map +0 -1
- package/src/core/model/node-graph/ParametricDataType.d.ts.map +0 -1
- /package/src/core/model/node-graph/{DataType.d.ts → type/DataType.d.ts} +0 -0
- /package/src/core/model/node-graph/{DataType.spec.d.ts → type/DataType.spec.d.ts} +0 -0
- /package/src/core/model/node-graph/{DataType.spec.js → type/DataType.spec.js} +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { DoubleSide, Matrix4, MeshBasicMaterial, PlaneGeometry, Quaternion, Vector3 } from "three";
|
|
2
|
+
import { ShadedGeometry } from "../../../src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js";
|
|
3
|
+
import { GizmoNode } from "./GizmoNode.js";
|
|
4
|
+
import { TransformMode } from "./TransformMode.js";
|
|
5
|
+
|
|
6
|
+
// Reusable utility variables
|
|
7
|
+
const _alignVector = new Vector3(0, 1, 0);
|
|
8
|
+
const _identityQuaternion = new Quaternion();
|
|
9
|
+
const _dirVector = new Vector3();
|
|
10
|
+
const _tempMatrix = new Matrix4();
|
|
11
|
+
const _unitX = new Vector3(1, 0, 0);
|
|
12
|
+
const _unitY = new Vector3(0, 1, 0);
|
|
13
|
+
const _unitZ = new Vector3(0, 0, 1);
|
|
14
|
+
const _v1 = new Vector3();
|
|
15
|
+
const _v2 = new Vector3();
|
|
16
|
+
const _v3 = new Vector3();
|
|
17
|
+
|
|
18
|
+
const _tempVector = new Vector3();
|
|
19
|
+
|
|
20
|
+
export class TransformControlsPlane extends GizmoNode {
|
|
21
|
+
|
|
22
|
+
constructor() {
|
|
23
|
+
|
|
24
|
+
super();
|
|
25
|
+
|
|
26
|
+
this.entity.add(ShadedGeometry.from(new PlaneGeometry(100000, 100000, 2, 2),
|
|
27
|
+
new MeshBasicMaterial({
|
|
28
|
+
visible: false,
|
|
29
|
+
wireframe: true,
|
|
30
|
+
side: DoubleSide,
|
|
31
|
+
transparent: true,
|
|
32
|
+
opacity: 0.1,
|
|
33
|
+
toneMapped: false
|
|
34
|
+
})));
|
|
35
|
+
|
|
36
|
+
this.isTransformControlsPlane = true;
|
|
37
|
+
|
|
38
|
+
this.type = 'TransformControlsPlane';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
update() {
|
|
42
|
+
|
|
43
|
+
let space = this.space;
|
|
44
|
+
|
|
45
|
+
const transform = this.transform;
|
|
46
|
+
|
|
47
|
+
transform.position.copy(this.worldPosition);
|
|
48
|
+
|
|
49
|
+
if (this.mode === TransformMode.Scale) space = 'local'; // scale always oriented to local rotation
|
|
50
|
+
|
|
51
|
+
_v1.copy(_unitX).applyQuaternion(space === 'local' ? this.worldQuaternion : _identityQuaternion);
|
|
52
|
+
_v2.copy(_unitY).applyQuaternion(space === 'local' ? this.worldQuaternion : _identityQuaternion);
|
|
53
|
+
_v3.copy(_unitZ).applyQuaternion(space === 'local' ? this.worldQuaternion : _identityQuaternion);
|
|
54
|
+
|
|
55
|
+
// Align the plane for current transform mode, axis and space.
|
|
56
|
+
|
|
57
|
+
_alignVector.copy(_v2);
|
|
58
|
+
|
|
59
|
+
switch (this.mode) {
|
|
60
|
+
|
|
61
|
+
case TransformMode.Translate:
|
|
62
|
+
case TransformMode.Scale:
|
|
63
|
+
switch (this.axis) {
|
|
64
|
+
|
|
65
|
+
case 'X':
|
|
66
|
+
_alignVector.copy(this.eye).cross(_v1);
|
|
67
|
+
_dirVector.copy(_v1).cross(_alignVector);
|
|
68
|
+
break;
|
|
69
|
+
case 'Y':
|
|
70
|
+
_alignVector.copy(this.eye).cross(_v2);
|
|
71
|
+
_dirVector.copy(_v2).cross(_alignVector);
|
|
72
|
+
break;
|
|
73
|
+
case 'Z':
|
|
74
|
+
_alignVector.copy(this.eye).cross(_v3);
|
|
75
|
+
_dirVector.copy(_v3).cross(_alignVector);
|
|
76
|
+
break;
|
|
77
|
+
case 'XY':
|
|
78
|
+
_dirVector.copy(_v3);
|
|
79
|
+
break;
|
|
80
|
+
case 'YZ':
|
|
81
|
+
_dirVector.copy(_v1);
|
|
82
|
+
break;
|
|
83
|
+
case 'XZ':
|
|
84
|
+
_alignVector.copy(_v3);
|
|
85
|
+
_dirVector.copy(_v2);
|
|
86
|
+
break;
|
|
87
|
+
case 'XYZ':
|
|
88
|
+
case 'E':
|
|
89
|
+
_dirVector.set(0, 0, 0);
|
|
90
|
+
break;
|
|
91
|
+
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
break;
|
|
95
|
+
case TransformMode.Rotate:
|
|
96
|
+
default:
|
|
97
|
+
// special case for rotate
|
|
98
|
+
_dirVector.set(0, 0, 0);
|
|
99
|
+
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (_dirVector.length() === 0) {
|
|
103
|
+
|
|
104
|
+
// If in rotate mode, make the plane parallel to camera
|
|
105
|
+
transform.rotation.copy(this.cameraQuaternion);
|
|
106
|
+
|
|
107
|
+
} else {
|
|
108
|
+
|
|
109
|
+
_tempMatrix.lookAt(_tempVector.set(0, 0, 0), _dirVector, _alignVector);
|
|
110
|
+
|
|
111
|
+
transform.rotation.setFromRotationMatrix(_tempMatrix);
|
|
112
|
+
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
super.update();
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BufferGeometry, Float32BufferAttribute } from "three";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Special geometry for transform helper. If scaled with position vector it spans from [0,0,0] to position
|
|
5
|
+
*/
|
|
6
|
+
export function TranslateHelperGeometry() {
|
|
7
|
+
|
|
8
|
+
const geometry = new BufferGeometry();
|
|
9
|
+
|
|
10
|
+
geometry.setAttribute('position', new Float32BufferAttribute([0, 0, 0, 1, 1, 1], 3));
|
|
11
|
+
|
|
12
|
+
return geometry;
|
|
13
|
+
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { DataType } from "./DataType.js";
|
|
2
1
|
import { NodeDescription } from "./node/NodeDescription.js";
|
|
3
2
|
import { PortDirection } from "./node/PortDirection.js";
|
|
4
3
|
import { NodeGraph } from "./NodeGraph.js";
|
|
4
|
+
import { DataType } from "./type/DataType.js";
|
|
5
5
|
|
|
6
6
|
test("constructor doesn't throw", () => {
|
|
7
7
|
new NodeGraph();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jest } from "@jest/globals";
|
|
2
|
-
import { DataType } from "../DataType.js";
|
|
3
2
|
import { NodeGraph } from "../NodeGraph.js";
|
|
3
|
+
import { DataType } from "../type/DataType.js";
|
|
4
4
|
import { NodeDescription } from "./NodeDescription.js";
|
|
5
5
|
import { NodeInstance } from "./NodeInstance.js";
|
|
6
6
|
import { PortDirection } from "./PortDirection.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DataType } from "../DataType.js";
|
|
2
1
|
import { NodeGraph } from "../NodeGraph.js";
|
|
2
|
+
import { DataType } from "../type/DataType.js";
|
|
3
3
|
import { NodeDescription } from "./NodeDescription.js";
|
|
4
4
|
import { NodeInstancePortReference } from "./NodeInstancePortReference.js";
|
|
5
5
|
import { PortDirection } from "./PortDirection.js";
|
|
@@ -95,6 +95,6 @@ export class NodeRegistry {
|
|
|
95
95
|
readonly isNodeRegistry: boolean;
|
|
96
96
|
}
|
|
97
97
|
import { NodeDescription } from "./NodeDescription.js";
|
|
98
|
-
import { DataType } from "../DataType.js";
|
|
98
|
+
import { DataType } from "../type/DataType.js";
|
|
99
99
|
import { Port } from "./Port.js";
|
|
100
100
|
//# sourceMappingURL=NodeRegistry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/NodeRegistry.js"],"names":[],"mappings":"AAeA;IACI;;;OAGG;IACH,OAFU,IAAI,MAAM,EAAE,eAAe,CAAC,CAEpB;IAElB;;;OAGG;IACH,OAFU,IAAI,MAAM,EAAE,QAAQ,CAAC,CAEb;IAElB;;OAEG;IACH,mBAFa,eAAe,EAAE,CAI7B;IAED;;;;OAIG;IACH,cAHW,eAAe,GACb,OAAO,CA2BnB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACb,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iBAHW,eAAe,GACb,OAAO,CAenB;IAED;;;;;OAKG;IACH,+CAFa,eAAe,EAAE,CAY7B;IAED;;;OAGG;IACH,cAFW,QAAQ,WAUlB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACP,OAAO,CAOlB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,QAAQ,GAAC,SAAS,CAI9B;IAED;;;OAGG;IACH,kBAFa,MAAM,CAclB;IAED;;;;OAIG;IACH,0BAFa,QAAQ,CAYpB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,eAAe,GAAC,SAAS,CAIrC;IAED;;;;OAIG;IACH,sBAFa,IAAI,CAUhB;IAED;;;;OAIG;IACH,sBAFa,eAAe,CAsB3B;IAED,0BAiCC;IAED;;;MA6BC;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;
|
|
1
|
+
{"version":3,"file":"NodeRegistry.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/NodeRegistry.js"],"names":[],"mappings":"AAeA;IACI;;;OAGG;IACH,OAFU,IAAI,MAAM,EAAE,eAAe,CAAC,CAEpB;IAElB;;;OAGG;IACH,OAFU,IAAI,MAAM,EAAE,QAAQ,CAAC,CAEb;IAElB;;OAEG;IACH,mBAFa,eAAe,EAAE,CAI7B;IAED;;;;OAIG;IACH,cAHW,eAAe,GACb,OAAO,CA2BnB;IAED;;;;OAIG;IACH,cAHW,eAAe,GACb,OAAO,CAkBnB;IAED;;;;OAIG;IACH,iBAHW,eAAe,GACb,OAAO,CAenB;IAED;;;;;OAKG;IACH,+CAFa,eAAe,EAAE,CAY7B;IAED;;;OAGG;IACH,cAFW,QAAQ,WAUlB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACP,OAAO,CAOlB;IAED;;;OAGG;IACH,gBAHW,MAAM,GACJ,QAAQ,GAAC,SAAS,CAI9B;IAED;;;OAGG;IACH,kBAFa,MAAM,CAclB;IAED;;;;OAIG;IACH,0BAFa,QAAQ,CAYpB;IAED;;;;OAIG;IACH,YAHW,MAAM,GACJ,eAAe,GAAC,SAAS,CAIrC;IAED;;;;OAIG;IACH,sBAFa,IAAI,CAUhB;IAED;;;;OAIG;IACH,sBAFa,eAAe,CAsB3B;IAED,0BAiCC;IAED;;;MA6BC;IAGL;;;OAGG;IACH,yBAFU,OAAO,CAEoB;CANpC;gCAtT+B,sBAAsB;yBAD7B,qBAAqB;qBAEzB,WAAW"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {assert} from "../../../assert.js";
|
|
2
|
-
import {BitSet} from "../../../binary/BitSet.js";
|
|
3
|
-
import {DataType} from "../DataType.js";
|
|
4
|
-
import {NodeDescription} from "./NodeDescription.js";
|
|
5
|
-
import {Port} from "./Port.js";
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
|
+
import { BitSet } from "../../../binary/BitSet.js";
|
|
3
|
+
import { DataType } from "../type/DataType.js";
|
|
4
|
+
import { NodeDescription } from "./NodeDescription.js";
|
|
5
|
+
import { Port } from "./Port.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Port.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/Port.js"],"names":[],"mappings":"AAUA;IAmHI;;;;;OAKG;IACH,iDAFa,IAAI,CAQhB;IA9HD;;;OAGG;IACH,aAAU;IAEV;;;OAGG;IACH,IAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,WAFU,aAAa,GAAC,MAAM,CAEQ;IAEtC;;;OAGG;IACH,UAFU,QAAQ,CAEF;IAEhB;;;OAGG;IACH,UAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAenB;IAED,mBAEC;IAED;;;;;MAOC;IAED;;;;;;;OAOG;IACH,4CANW,MAAM,iCAuChB;IAiBL;;;OAGG;IACH,iBAFU,OAAO,CAEI;CANpB;8BAvI6B,oBAAoB;yBADzB,
|
|
1
|
+
{"version":3,"file":"Port.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/node/Port.js"],"names":[],"mappings":"AAUA;IAmHI;;;;;OAKG;IACH,iDAFa,IAAI,CAQhB;IA9HD;;;OAGG;IACH,aAAU;IAEV;;;OAGG;IACH,IAFU,MAAM,CAEE;IAElB;;;OAGG;IACH,WAFU,aAAa,GAAC,MAAM,CAEQ;IAEtC;;;OAGG;IACH,UAFU,QAAQ,CAEF;IAEhB;;;OAGG;IACH,UAFU,MAAM,CAEF;IAEd;;;OAGG;IACH,QAFa,MAAM,CAIlB;IAED;;;;OAIG;IACH,cAHW,IAAI,GACF,OAAO,CAenB;IAED,mBAEC;IAED;;;;;MAOC;IAED;;;;;;;OAOG;IACH,4CANW,MAAM,iCAuChB;IAiBL;;;OAGG;IACH,iBAFU,OAAO,CAEI;CANpB;8BAvI6B,oBAAoB;yBADzB,qBAAqB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../../assert.js";
|
|
2
2
|
import { objectKeyByValue } from "../../object/objectKeyByValue.js";
|
|
3
|
-
import { DataType } from "../DataType.js";
|
|
3
|
+
import { DataType } from "../type/DataType.js";
|
|
4
4
|
import { PortDirection } from "./PortDirection.js";
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataType.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/type/DataType.js"],"names":[],"mappings":"AAEA;IAyDI;;;;OAIG;IACH,yBAFa,QAAQ,CAQpB;IAGD;;;;;OAKG;IACH,gBAJW,MAAM,QACN,MAAM,GACJ,QAAQ,CAQpB;IAjFD;;;OAGG;IACH,IAFU,MAAM,CAET;IAEP;;;OAGG;IACH,MAFU,MAAM,CAEN;IAEV,mBAEC;IAED;;;OAGG;IACH,QAFY,MAAM,CAIjB;IAED;;;;OAIG;IACH,cAHW,QAAQ,GACN,OAAO,CAKnB;IAED;;;;OAIG;IACH,QAHW,MAAM,QACN,MAAM,QAQhB;IAED;;;MAEC;IAED;;;aAEC;IAgCL;;;OAGG;IACH,qBAFU,OAAO,CAEY;CAP5B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assert } from "
|
|
1
|
+
import { assert } from "../../../assert.js";
|
|
2
2
|
|
|
3
3
|
export class DataType {
|
|
4
4
|
|
|
@@ -50,7 +50,7 @@ export class DataType {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
toJSON() {
|
|
53
|
-
return {
|
|
53
|
+
return { id: this.id, name: this.name };
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
fromJSON({ id, name }) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DataType.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/type/DataType.spec.js"],"names":[],"mappings":""}
|
|
@@ -27,8 +27,13 @@ export class ParametricDataType extends DataType {
|
|
|
27
27
|
* @returns {boolean}
|
|
28
28
|
*/
|
|
29
29
|
equals(other: ParametricDataType): boolean;
|
|
30
|
-
toJSON():
|
|
30
|
+
toJSON(): any;
|
|
31
31
|
fromJSON(j: any): void;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @returns {boolean}
|
|
35
|
+
*/
|
|
36
|
+
get isParametricDataType(): boolean;
|
|
32
37
|
}
|
|
33
38
|
import { DataType } from "./DataType.js";
|
|
34
39
|
//# sourceMappingURL=ParametricDataType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParametricDataType.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/type/ParametricDataType.js"],"names":[],"mappings":"AAIA;;;GAGG;AACH;IA+CI;;;;OAIG;IACH,gBAJW,MAAM,QACN,MAAM,eACN,QAAQ,EAAE,sBAUpB;IA3DD;;;OAGG;IACH,YAFU,QAAQ,EAAE,CAEJ;IAGhB;;;;;OAKG;IACH,QAJW,MAAM,QACN,MAAM,eACN,QAAQ,EAAE,QAMpB;IAED;;;;OAIG;IACH,cAHW,kBAAkB,GAChB,OAAO,CAQnB;IAED,cAMC;IAED,uBAIC;IAiBD;;;OAGG;IACH,oCAEC;CACJ;yBA5EwB,eAAe"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { isArrayEqual } from "
|
|
1
|
+
import { isArrayEqual } from "../../../collection/array/isArrayEqual.js";
|
|
2
2
|
import { DataType } from "./DataType.js";
|
|
3
|
+
import { deserializeDataTypeFromJSON } from "./deserializeDataTypeFromJSON.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Loosely can be thought as implementing generics, allows creation of types that reference other types
|
|
@@ -31,7 +32,7 @@ export class ParametricDataType extends DataType {
|
|
|
31
32
|
* @returns {boolean}
|
|
32
33
|
*/
|
|
33
34
|
equals(other) {
|
|
34
|
-
if (
|
|
35
|
+
if (other.isParametricDataType !== true) {
|
|
35
36
|
return false;
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -39,11 +40,17 @@ export class ParametricDataType extends DataType {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
toJSON() {
|
|
42
|
-
|
|
43
|
+
const r = super.toJSON();
|
|
44
|
+
|
|
45
|
+
r.parameters = this.parameters.map(p => p.toJSON());
|
|
46
|
+
|
|
47
|
+
return r;
|
|
43
48
|
}
|
|
44
49
|
|
|
45
50
|
fromJSON(j) {
|
|
46
|
-
|
|
51
|
+
super.fromJSON(j);
|
|
52
|
+
|
|
53
|
+
this.parameters = j.parameters.map(deserializeDataTypeFromJSON);
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
/**
|
|
@@ -60,4 +67,12 @@ export class ParametricDataType extends DataType {
|
|
|
60
67
|
return r;
|
|
61
68
|
|
|
62
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
*
|
|
73
|
+
* @returns {boolean}
|
|
74
|
+
*/
|
|
75
|
+
get isParametricDataType() {
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
63
78
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParametricDataType.spec.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/type/ParametricDataType.spec.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DataType } from "./DataType.js";
|
|
2
|
+
import { ParametricDataType } from "./ParametricDataType.js";
|
|
3
|
+
|
|
4
|
+
test("to/from json", () => {
|
|
5
|
+
|
|
6
|
+
const t = ParametricDataType.from(1, "x", [
|
|
7
|
+
DataType.from(7, "a")
|
|
8
|
+
]);
|
|
9
|
+
|
|
10
|
+
const json = t.toJSON();
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
const actual = new ParametricDataType();
|
|
14
|
+
|
|
15
|
+
actual.fromJSON(json);
|
|
16
|
+
|
|
17
|
+
expect(actual.id).toEqual(1);
|
|
18
|
+
expect(actual.name).toEqual("x");
|
|
19
|
+
expect(actual.parameters.length).toEqual(1);
|
|
20
|
+
expect(actual.parameters[0].id).toEqual(7);
|
|
21
|
+
expect(actual.parameters[0].name).toEqual("a");
|
|
22
|
+
expect(actual.parameters[0]).toBeInstanceOf(DataType);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
test("equals", () => {
|
|
26
|
+
|
|
27
|
+
expect(
|
|
28
|
+
ParametricDataType.from(1, "x", [
|
|
29
|
+
DataType.from(7, "a")
|
|
30
|
+
]).equals(ParametricDataType.from(1, "x", [
|
|
31
|
+
DataType.from(7, "a")
|
|
32
|
+
]))
|
|
33
|
+
).toBe(true);
|
|
34
|
+
|
|
35
|
+
const t = ParametricDataType.from(1, "x");
|
|
36
|
+
|
|
37
|
+
expect(t.equals(t)).toBe(true);
|
|
38
|
+
|
|
39
|
+
expect(ParametricDataType.from(1, "x").equals(ParametricDataType.from(7, "x"))).toBe(false);
|
|
40
|
+
expect(ParametricDataType.from(1, "x").equals(ParametricDataType.from(1, "y"))).toBe(false);
|
|
41
|
+
|
|
42
|
+
expect(
|
|
43
|
+
ParametricDataType.from(1, "x", [
|
|
44
|
+
DataType.from(7, "a")
|
|
45
|
+
]).equals(ParametricDataType.from(1, "x", [
|
|
46
|
+
DataType.from(11, "a")
|
|
47
|
+
]))
|
|
48
|
+
).toBe(false);
|
|
49
|
+
|
|
50
|
+
expect(
|
|
51
|
+
ParametricDataType.from(1, "x", [
|
|
52
|
+
DataType.from(7, "a")
|
|
53
|
+
]).equals(ParametricDataType.from(1, "x", [
|
|
54
|
+
DataType.from(7, "b")
|
|
55
|
+
]))
|
|
56
|
+
).toBe(false);
|
|
57
|
+
|
|
58
|
+
expect(
|
|
59
|
+
ParametricDataType.from(1, "x", [
|
|
60
|
+
DataType.from(7, "a")
|
|
61
|
+
]).equals(ParametricDataType.from(1, "x"))
|
|
62
|
+
).toBe(false);
|
|
63
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deserializeDataTypeFromJSON.d.ts","sourceRoot":"","sources":["../../../../../../src/core/model/node-graph/type/deserializeDataTypeFromJSON.js"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,qDAFa,QAAQ,CAiBpB;yBAvBwB,eAAe"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { DataType } from "./DataType.js";
|
|
2
|
+
import { ParametricDataType } from "./ParametricDataType.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param {*} j
|
|
7
|
+
* @returns {DataType}
|
|
8
|
+
*/
|
|
9
|
+
export function deserializeDataTypeFromJSON(j) {
|
|
10
|
+
|
|
11
|
+
let r;
|
|
12
|
+
|
|
13
|
+
if (j.hasOwnProperty("parameters")) {
|
|
14
|
+
// it's a parametric data type
|
|
15
|
+
r = new ParametricDataType();
|
|
16
|
+
} else {
|
|
17
|
+
// primitive
|
|
18
|
+
r = new DataType();
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
r.fromJSON(j);
|
|
22
|
+
|
|
23
|
+
return r;
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {number} radius
|
|
4
|
+
* @param {number} arc
|
|
5
|
+
* @returns {TorusGeometry}
|
|
6
|
+
* @constructor
|
|
7
|
+
*/
|
|
8
|
+
export function CircleGeometry(radius: number, arc: number): TorusGeometry;
|
|
9
|
+
export class CircleGeometry {
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {number} radius
|
|
13
|
+
* @param {number} arc
|
|
14
|
+
* @returns {TorusGeometry}
|
|
15
|
+
* @constructor
|
|
16
|
+
*/
|
|
17
|
+
constructor(radius: number, arc: number);
|
|
18
|
+
}
|
|
19
|
+
import { TorusGeometry } from "three";
|
|
20
|
+
//# sourceMappingURL=CircleGeometry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CircleGeometry.d.ts","sourceRoot":"","sources":["../../../../../src/engine/graphics/geometry/CircleGeometry.js"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,uCALW,MAAM,OACN,MAAM,GACJ,aAAa,CAUzB;;IAdD;;;;;;OAMG;IACH,oBALW,MAAM,OACN,MAAM,EAWhB;;8BAhB6B,OAAO"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TorusGeometry } from "three";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {number} radius
|
|
6
|
+
* @param {number} arc
|
|
7
|
+
* @returns {TorusGeometry}
|
|
8
|
+
* @constructor
|
|
9
|
+
*/
|
|
10
|
+
export function CircleGeometry(radius, arc) {
|
|
11
|
+
|
|
12
|
+
const geometry = new TorusGeometry(radius, 0.0075, 3, 64, arc * Math.PI * 2);
|
|
13
|
+
geometry.rotateY(Math.PI / 2);
|
|
14
|
+
geometry.rotateX(Math.PI / 2);
|
|
15
|
+
return geometry;
|
|
16
|
+
|
|
17
|
+
}
|
package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.d.ts
CHANGED
|
@@ -8,17 +8,18 @@ export class ParticleAttributeSpecification {
|
|
|
8
8
|
static from(name: string, type: {
|
|
9
9
|
Void: any;
|
|
10
10
|
Float: any;
|
|
11
|
+
/**
|
|
12
|
+
* @type {ParticleDataTypes}
|
|
13
|
+
*/
|
|
11
14
|
Vector2: any;
|
|
12
15
|
Vector3: any;
|
|
13
|
-
Vector4: any;
|
|
14
|
-
/**
|
|
16
|
+
Vector4: any; /**
|
|
15
17
|
* Name must be unique
|
|
16
18
|
* @type {string}
|
|
17
19
|
*/
|
|
18
20
|
Matrix4: any;
|
|
19
21
|
Boolean: any;
|
|
20
|
-
Texture2D: any;
|
|
21
|
-
/**
|
|
22
|
+
Texture2D: any; /**
|
|
22
23
|
*
|
|
23
24
|
* @return {number}
|
|
24
25
|
*/
|
|
@@ -30,17 +31,18 @@ export class ParticleAttributeSpecification {
|
|
|
30
31
|
type: {
|
|
31
32
|
Void: any;
|
|
32
33
|
Float: any;
|
|
34
|
+
/**
|
|
35
|
+
* @type {ParticleDataTypes}
|
|
36
|
+
*/
|
|
33
37
|
Vector2: any;
|
|
34
38
|
Vector3: any;
|
|
35
|
-
Vector4: any;
|
|
36
|
-
/**
|
|
39
|
+
Vector4: any; /**
|
|
37
40
|
* Name must be unique
|
|
38
41
|
* @type {string}
|
|
39
42
|
*/
|
|
40
43
|
Matrix4: any;
|
|
41
44
|
Boolean: any;
|
|
42
|
-
Texture2D: any;
|
|
43
|
-
/**
|
|
45
|
+
Texture2D: any; /**
|
|
44
46
|
*
|
|
45
47
|
* @return {number}
|
|
46
48
|
*/
|
package/src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParticleAttributeSpecification.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.js"],"names":[],"mappings":"AAGA;IAqCI;;;;;OAKG;IACH,kBAJW,MAAM
|
|
1
|
+
{"version":3,"file":"ParticleAttributeSpecification.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/graphics/particles/node-based/particle/ParticleAttributeSpecification.js"],"names":[],"mappings":"AAGA;IAqCI;;;;;OAKG;IACH,kBAJW,MAAM;;;QApCb;;WAEG;;;sBAIH;;;WAGG;;;wBAKP;;;WAGG;;QAqBU,8BAA8B,CAc1C;IApDG;;OAEG;IACH;;;QAHA;;WAEG;;;sBAIH;;;WAGG;;;wBAKP;;;WAGG;;MAdoC;IAGnC;;;OAGG;IACH,MAFU,MAAM,CAEF;IAIlB;;;OAGG;IACH,yBAFY,MAAM,CAgBjB;CAqBJ"}
|