@woosh/meep-engine 2.46.28 → 2.46.30
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/Editor.js +793 -0
- package/editor/SelectionVisualizer.js +148 -0
- package/editor/actions/concrete/ActionUpdateTexture.js +21 -0
- package/editor/actions/concrete/ArrayCopyAction.js +39 -0
- package/editor/actions/concrete/ComponentAddAction.js +47 -0
- package/editor/actions/concrete/ComponentRemoveAction.js +38 -0
- package/editor/actions/concrete/EntityCreateAction.js +47 -0
- package/editor/actions/concrete/EntityRemoveAction.js +51 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.js +118 -0
- package/editor/actions/concrete/ModifyPatchSampler2DAction.spec.js +30 -0
- package/editor/actions/concrete/ModifyPatchTextureArray2DAction.js +182 -0
- package/editor/actions/concrete/PaintTerrainOverlayAction.js +45 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.js +67 -0
- package/editor/actions/concrete/PatchTerrainTextureAction.js +152 -0
- package/editor/actions/concrete/SelectionAddAction.js +36 -0
- package/editor/actions/concrete/SelectionClearAction.js +22 -0
- package/editor/actions/concrete/SelectionRemoveAction.js +30 -0
- package/editor/actions/concrete/TransformModifyAction.js +46 -0
- package/editor/actions/concrete/WriteGridValueAction.js +46 -0
- package/editor/ecs/EditorEntity.js +12 -0
- package/editor/ecs/EditorEntitySystem.js +14 -0
- package/editor/ecs/component/FieldDescriptor.js +34 -0
- package/editor/ecs/component/FieldValueAdapter.js +20 -0
- package/editor/ecs/component/TypeEditor.js +33 -0
- package/editor/ecs/component/TypeSchema.d.ts +38 -0
- package/editor/ecs/component/createFieldEditor.js +92 -0
- package/editor/ecs/component/createObjectEditor.js +361 -0
- package/editor/ecs/component/editors/ColorEditor.js +39 -0
- package/editor/ecs/component/editors/HTMLElementEditor.js +17 -0
- package/editor/ecs/component/editors/ImagePathEditor.js +82 -0
- package/editor/ecs/component/editors/LargeStrongEditor.js +107 -0
- package/editor/ecs/component/editors/NumericIntervalEditor.js +86 -0
- package/editor/ecs/component/editors/ObservedBooleanEditor.js +13 -0
- package/editor/ecs/component/editors/ObservedEnumEditor.js +32 -0
- package/editor/ecs/component/editors/ObservedIntegerEditor.js +43 -0
- package/editor/ecs/component/editors/ObservedStringEditor.js +51 -0
- package/editor/ecs/component/editors/Sampler2DEditor.js +221 -0
- package/editor/ecs/component/editors/collection/ListEditor.js +83 -0
- package/editor/ecs/component/editors/common/BitFlagsEditor.js +80 -0
- package/editor/ecs/component/editors/common/EnumEditor.js +41 -0
- package/editor/ecs/component/editors/common/makeV3_editor.js +85 -0
- package/editor/ecs/component/editors/common/noEditor.js +9 -0
- package/editor/ecs/component/editors/ecs/GridObstacleEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/MinimapMarkerEditor.js +16 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +225 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/Trail2DEditor.js +33 -0
- package/editor/ecs/component/editors/ecs/TransformEditor.js +23 -0
- package/editor/ecs/component/editors/ecs/terrain/SplatMappingEditor.js +21 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainEditor.js +95 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayerEditor.js +18 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainLayersEditor.js +22 -0
- package/editor/ecs/component/editors/ecs/terrain/TerrainOverlayEditor.js +20 -0
- package/editor/ecs/component/editors/geom/QuaternionEditor.js +63 -0
- package/editor/ecs/component/editors/geom/Vector1Editor.js +57 -0
- package/editor/ecs/component/editors/geom/Vector2Editor.js +11 -0
- package/editor/ecs/component/editors/geom/Vector3Editor.js +13 -0
- package/editor/ecs/component/editors/geom/Vector4Editor.js +12 -0
- package/editor/ecs/component/editors/primitive/ArrayEditor.js +46 -0
- package/editor/ecs/component/editors/primitive/BooleanEditor.js +27 -0
- package/editor/ecs/component/editors/primitive/FunctionEditor.js +29 -0
- package/editor/ecs/component/editors/primitive/NumberEditor.js +60 -0
- package/editor/ecs/component/editors/primitive/ObjectEditor.js +12 -0
- package/editor/ecs/component/editors/primitive/StringEditor.js +31 -0
- package/editor/ecs/component/editors/three/BufferGeometryEditor.js +28 -0
- package/editor/ecs/component/editors/three/MaterialEditor.js +27 -0
- package/editor/ecs/component/editors/three/MeshEditor.js +35 -0
- package/editor/ecs/component/editors/three/TextureEditor.js +112 -0
- package/editor/ecs/component/findNearestRegisteredType.js +59 -0
- package/editor/ecs/component/prototypeObjectEditor.js +379 -0
- package/editor/enableEditor.js +85 -0
- package/editor/library/MeshLibrary.js +33 -0
- package/editor/process/DisableGameUIProcess.js +43 -0
- package/editor/process/EditorProcess.js +35 -0
- package/editor/process/ObstacleGridDisplayProcess.js +120 -0
- package/editor/process/ProcessEngine.js +123 -0
- package/editor/process/SymbolicDisplayProcess.js +132 -0
- package/editor/process/symbolic/ComponentSymbolicDisplay.js +34 -0
- package/editor/process/symbolic/SymbolicDisplayInternalAPI.js +159 -0
- package/editor/process/symbolic/buildThreeJSHelperEntity.js +36 -0
- package/editor/process/symbolic/make3DSymbolicDisplay.js +91 -0
- package/editor/process/symbolic/makeCameraSymbolicDisplay.js +32 -0
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +176 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/process/symbolic/makeHelperSphereGeometry.js +73 -0
- package/editor/process/symbolic/makeLightSymbolicDisplay.js +77 -0
- package/editor/process/symbolic/makeParticleEmitterSymbolicDisplay.js +146 -0
- package/editor/process/symbolic/makePathSymbolicDisplay.js +105 -0
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +74 -0
- package/editor/process/symbolic/makeSocketsSymbolicDisplay.js +153 -0
- package/editor/process/symbolic/makeSolidArrowGeometry.js +391 -0
- package/editor/process/symbolic/makeSoundEmitterSymbolicDisplay.js +89 -0
- package/editor/process/symbolic/makeStoryTriggerSetAreaDisplay.js +114 -0
- package/editor/process/symbolic/synchronizeTransform.js +50 -0
- package/editor/tools/FoliagePaintTool.js +168 -0
- package/editor/tools/GridPaintTool.js +247 -0
- package/editor/tools/SelectionTool.js +407 -0
- package/editor/tools/TopDownCameraControlTool.js +59 -0
- package/editor/tools/TransformTool.js +370 -0
- package/editor/tools/engine/Tool.js +121 -0
- package/editor/tools/engine/ToolEngine.js +193 -0
- package/editor/tools/engine/ToolState.js +9 -0
- package/editor/tools/engine/ToolStateMachine.js +53 -0
- package/editor/tools/paint/TerrainHeightPaintTool.js +297 -0
- package/editor/tools/paint/TerrainPaintTool.js +211 -0
- package/editor/tools/paint/TerrainTexturePaintTool.js +193 -0
- package/editor/tools/paint/prototypeTerrainEditor.js +135 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.d.ts +50 -0
- package/editor/tools/v2/BlenderCameraOrientationGizmo.js +500 -0
- package/editor/tools/v2/TransformControls.d.ts +20 -0
- package/editor/tools/v2/TransformControls.js +1782 -0
- package/editor/tools/v2/prototypeTransformControls.js +92 -0
- package/editor/view/EditorView.js +462 -0
- package/editor/view/GridPickCoordinateView.js +88 -0
- package/editor/view/ecs/ComponentControlFactory.js +48 -0
- package/editor/view/ecs/ComponentControlView.js +214 -0
- package/editor/view/ecs/EntityEditor.js +258 -0
- package/editor/view/ecs/EntityList.js +258 -0
- package/editor/view/ecs/components/BlackboardController.js +50 -0
- package/editor/view/ecs/components/DatGuiController.js +216 -0
- package/editor/view/ecs/components/FogOfWarController.js +78 -0
- package/editor/view/ecs/components/FogOfWarRevealerController.js +44 -0
- package/editor/view/ecs/components/GeneratedArmyController.js +42 -0
- package/editor/view/ecs/components/GridObstacleController.js +72 -0
- package/editor/view/ecs/components/GridPositionController.js +40 -0
- package/editor/view/ecs/components/HeadsUpDisplayController.js +30 -0
- package/editor/view/ecs/components/HighlightController.js +47 -0
- package/editor/view/ecs/components/MeshController.js +125 -0
- package/editor/view/ecs/components/PathFollowerController.js +87 -0
- package/editor/view/ecs/components/TagController.js +80 -0
- package/editor/view/ecs/components/TerrainController.js +225 -0
- package/editor/view/ecs/components/TransformController.js +103 -0
- package/editor/view/ecs/components/UnitShopController.js +112 -0
- package/editor/view/ecs/components/army/ArmyController.js +130 -0
- package/editor/view/ecs/components/color/GaugeView.js +107 -0
- package/editor/view/ecs/components/common/AutoCanvasView.js +53 -0
- package/editor/view/ecs/components/common/LineView.js +17 -0
- package/editor/view/ecs/components/common/NumberController.js +112 -0
- package/editor/view/ecs/components/common/NumericIntervalController.js +64 -0
- package/editor/view/ecs/components/gui/GUIElementController.js +117 -0
- package/editor/view/ecs/components/items/ItemContainerController.js +132 -0
- package/editor/view/ecs/components/items/ItemContainerController.stories.js +50 -0
- package/editor/view/ecs/components/items/ItemController.js +52 -0
- package/editor/view/ecs/components/particles/ColorParameterLUTController.js +444 -0
- package/editor/view/ecs/components/particles/ParameterTrackController.js +51 -0
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +213 -0
- package/editor/view/ecs/components/particles/ParticleLayerController.js +213 -0
- package/editor/view/ecs/components/particles/ScalarParameterLUTController.js +401 -0
- package/editor/view/ecs/components/sockets/AttachmentSocketsController.js +51 -0
- package/editor/view/ecs/components/sound/SoundEmitterController.js +137 -0
- package/editor/view/ecs/components/story/StoryTriggerSetController.js +214 -0
- package/editor/view/ecs/components/unit/AuraController.js +45 -0
- package/editor/view/library/MeshLibraryView.js +164 -0
- package/editor/view/node-graph/NodeGraphEditorView.js +170 -0
- package/editor/view/node-graph/NodeGraphView.js +453 -0
- package/editor/view/node-graph/NodeView.js +135 -0
- package/editor/view/node-graph/PortView.js +69 -0
- package/editor/view/process/ProcessView.js +63 -0
- package/editor/view/tools/ToolSettingsView.js +143 -0
- package/editor/view/tools/ToolView.js +58 -0
- package/package.json +2 -1
- package/src/core/bvh2/bvh3/EBBVHLeafProxy.js +6 -1
- package/src/core/geom/3d/aabb/aabb3_matrix4_project.js +1 -1
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.d.ts +9 -0
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +148 -9
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +21 -1
- package/src/engine/graphics/render/forward_plus/LightManager.js +0 -60
- package/src/engine/graphics/render/forward_plus/LightRenderMetadata.js +1 -3
- package/src/engine/graphics/render/forward_plus/model/Decal.js +1 -1
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.d.ts +0 -3
- package/src/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +0 -11
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import View from "../../../src/view/View.js";
|
|
2
|
+
import { PortView } from "./PortView.js";
|
|
3
|
+
import EmptyView from "../../../src/view/elements/EmptyView.js";
|
|
4
|
+
import LabelView from "../../../src/view/common/LabelView.js";
|
|
5
|
+
import { DraggableAspect } from "../../../src/engine/ui/DraggableAspect.js";
|
|
6
|
+
import Vector2 from "../../../src/core/geom/Vector2.js";
|
|
7
|
+
import { noop } from "../../../src/core/function/Functions.js";
|
|
8
|
+
import { NodeParameterDataType } from "../../../src/core/model/node-graph/node/parameter/NodeParameterDataType.js";
|
|
9
|
+
import DatGuiController from "../ecs/components/DatGuiController.js";
|
|
10
|
+
import { PortDirection } from "../../../src/core/model/node-graph/node/PortDirection.js";
|
|
11
|
+
|
|
12
|
+
export class NodeView extends View {
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {NodeInstance} node
|
|
16
|
+
* @param {NodeVisualData} visual
|
|
17
|
+
* @param {NodeGraphVisualData} visualData
|
|
18
|
+
* @param {boolean} enableDrag
|
|
19
|
+
* @param {function(PortView, Port)} portCreationCallback
|
|
20
|
+
*/
|
|
21
|
+
constructor({ node, visual, visualData, enableDrag = true, portCreationCallback = noop }) {
|
|
22
|
+
super();
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @type {NodeInstance}
|
|
27
|
+
*/
|
|
28
|
+
this.node = node;
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @type {NodeVisualData}
|
|
32
|
+
*/
|
|
33
|
+
this.visual = visual;
|
|
34
|
+
|
|
35
|
+
this.el = document.createElement('div');
|
|
36
|
+
|
|
37
|
+
this.addClass('ui-node-view');
|
|
38
|
+
|
|
39
|
+
const vPorts = new EmptyView({
|
|
40
|
+
classList: ['ports']
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const nodeDescription = node.description;
|
|
44
|
+
const vName = new LabelView(nodeDescription.name, {
|
|
45
|
+
classList: ['name']
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const v2_prev_position = new Vector2();
|
|
49
|
+
|
|
50
|
+
const self = this;
|
|
51
|
+
|
|
52
|
+
if (enableDrag) {
|
|
53
|
+
const draggableAspect = new DraggableAspect({
|
|
54
|
+
el: this.el,
|
|
55
|
+
dragStart(p) {
|
|
56
|
+
v2_prev_position.copy(p);
|
|
57
|
+
},
|
|
58
|
+
drag(position, origin, delta) {
|
|
59
|
+
const p = delta.clone();
|
|
60
|
+
|
|
61
|
+
const scale = new Vector2(1, 1);
|
|
62
|
+
|
|
63
|
+
self.computeGlobalScale(scale);
|
|
64
|
+
|
|
65
|
+
p.divide(scale);
|
|
66
|
+
|
|
67
|
+
// p.add(v2_origin);
|
|
68
|
+
|
|
69
|
+
visual.dimensions.position.add(p);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
this.on.linked.add(draggableAspect.start, draggableAspect);
|
|
73
|
+
this.on.unlinked.add(draggableAspect.stop, draggableAspect);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
//create parameters
|
|
77
|
+
|
|
78
|
+
const vParamContainer = new EmptyView({ classList: ['parameters-container'] });
|
|
79
|
+
|
|
80
|
+
const vParams = new DatGuiController({ classList: ['parameters'] });
|
|
81
|
+
vParamContainer.addChild(vParams);
|
|
82
|
+
|
|
83
|
+
nodeDescription.parameters.forEach(param => {
|
|
84
|
+
const id = param.id;
|
|
85
|
+
|
|
86
|
+
const type = param.type;
|
|
87
|
+
|
|
88
|
+
let controller = null;
|
|
89
|
+
|
|
90
|
+
if (type === NodeParameterDataType.Number) {
|
|
91
|
+
controller = vParams.addControl({ v: node.getParameterValue(id) }, 'v');
|
|
92
|
+
} else if (type === NodeParameterDataType.String) {
|
|
93
|
+
controller = vParams.addControl({ v: node.getParameterValue(id) }, 'v');
|
|
94
|
+
} else if (type === NodeParameterDataType.Boolean) {
|
|
95
|
+
controller = vParams.addControl({ v: node.getParameterValue(id) }, 'v');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
controller.name(param.name);
|
|
99
|
+
controller.onChange((v) => {
|
|
100
|
+
node.setParameterValue(id, v);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
this.addChild(vParamContainer);
|
|
106
|
+
|
|
107
|
+
this.addChild(vName);
|
|
108
|
+
|
|
109
|
+
this.addChild(vPorts);
|
|
110
|
+
|
|
111
|
+
nodeDescription.getPorts().forEach(port => {
|
|
112
|
+
|
|
113
|
+
const portVisualData = visual.getPort(port.id);
|
|
114
|
+
|
|
115
|
+
const portView = new PortView({ port, visual: portVisualData, visualData });
|
|
116
|
+
|
|
117
|
+
portCreationCallback(portView, port);
|
|
118
|
+
|
|
119
|
+
vPorts.addChild(portView);
|
|
120
|
+
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
this.setClass('has-inputs', nodeDescription.getPorts().some(p => p.direction === PortDirection.In));
|
|
124
|
+
this.setClass('has-outputs', nodeDescription.getPorts().some(p => p.direction === PortDirection.Out));
|
|
125
|
+
|
|
126
|
+
this.on.linked.add(this.update, this);
|
|
127
|
+
this.bindSignal(visual.dimensions.position.onChanged, this.update, this);
|
|
128
|
+
this.bindSignal(visual.dimensions.size.onChanged, this.update, this);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
update() {
|
|
132
|
+
this.position.copy(this.visual.dimensions.position);
|
|
133
|
+
this.size.copy(this.visual.dimensions.size);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import View from "../../../src/view/View.js";
|
|
2
|
+
import { PortDirection } from "../../../src/core/model/node-graph/node/PortDirection.js";
|
|
3
|
+
import { camelToKebab } from "../../../src/core/primitives/strings/StringUtils.js";
|
|
4
|
+
import LabelView from "../../../src/view/common/LabelView.js";
|
|
5
|
+
import EmptyView from "../../../src/view/elements/EmptyView.js";
|
|
6
|
+
import { Color } from "../../../src/core/color/Color.js";
|
|
7
|
+
import { objectKeyByValue } from "../../../src/core/model/object/objectKeyByValue.js";
|
|
8
|
+
|
|
9
|
+
const DEFAULT_TYPE_COLOR = new Color(1, 1, 1);
|
|
10
|
+
|
|
11
|
+
export class PortView extends View {
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {Port} port
|
|
15
|
+
* @param {PortVisualData} visual
|
|
16
|
+
* @param {NodeGraphVisualData} visualData
|
|
17
|
+
*/
|
|
18
|
+
constructor({ port, visual, visualData }) {
|
|
19
|
+
super();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @type {Port}
|
|
24
|
+
*/
|
|
25
|
+
this.port = port;
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @type {PortVisualData}
|
|
29
|
+
*/
|
|
30
|
+
this.visual = visual;
|
|
31
|
+
|
|
32
|
+
this.el = document.createElement('div');
|
|
33
|
+
|
|
34
|
+
this.addClass('ui-port-view');
|
|
35
|
+
|
|
36
|
+
this.addClass(`direction-${objectKeyByValue(PortDirection, port.direction).toLocaleLowerCase()}`);
|
|
37
|
+
|
|
38
|
+
this.addClass(`data-type-${camelToKebab(port.dataType.name)}`);
|
|
39
|
+
|
|
40
|
+
//add port name label
|
|
41
|
+
const vName = new LabelView(port.name, {
|
|
42
|
+
classList: ['name']
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
this.addChild(vName);
|
|
46
|
+
|
|
47
|
+
let color = visualData.getDataColor(port.dataType.id);
|
|
48
|
+
|
|
49
|
+
if (color === undefined) {
|
|
50
|
+
console.warn(`No color for data type ${port.dataType}, using default`);
|
|
51
|
+
|
|
52
|
+
color = DEFAULT_TYPE_COLOR;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
this.addChild(new EmptyView({
|
|
56
|
+
classList: ['marker'],
|
|
57
|
+
css: {
|
|
58
|
+
backgroundColor: `rgb(${color.r * 255}, ${color.g * 255}, ${color.b * 255})`
|
|
59
|
+
}
|
|
60
|
+
}));
|
|
61
|
+
|
|
62
|
+
this.on.linked.add(this.update, this);
|
|
63
|
+
this.bindSignal(visual.position.onChanged, this.update, this);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
update() {
|
|
67
|
+
this.position.copy(this.visual.position);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import View from "../../../src/view/View.js";
|
|
2
|
+
import dom from "../../../src/view/DOM.js";
|
|
3
|
+
|
|
4
|
+
import LabelView from '../../../src/view/common/LabelView.js';
|
|
5
|
+
import { ProcessState } from "../../../src/core/process/ProcessState.js";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {ProcessState} state
|
|
10
|
+
* @returns {string}
|
|
11
|
+
*/
|
|
12
|
+
function processState2ClassName(state) {
|
|
13
|
+
return `process-state-${state}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
class ProcessView extends View {
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
* @param {BaseProcess} process
|
|
20
|
+
* @constructor
|
|
21
|
+
*/
|
|
22
|
+
constructor(process) {
|
|
23
|
+
|
|
24
|
+
super(process);
|
|
25
|
+
|
|
26
|
+
this.model = process;
|
|
27
|
+
|
|
28
|
+
const dRoot = dom('div');
|
|
29
|
+
|
|
30
|
+
dRoot.addClass('process-view');
|
|
31
|
+
|
|
32
|
+
dRoot.addClass(`editor-process-${process.name}`);
|
|
33
|
+
|
|
34
|
+
this.$el = dRoot;
|
|
35
|
+
this.el = dRoot.el;
|
|
36
|
+
|
|
37
|
+
//add process name
|
|
38
|
+
const lName = new LabelView(process.name);
|
|
39
|
+
this.addChild(lName);
|
|
40
|
+
|
|
41
|
+
this.bindSignal(process.getState().onChanged, function (newValue, oldValue) {
|
|
42
|
+
dRoot.removeClass(processState2ClassName(oldValue));
|
|
43
|
+
dRoot.addClass(processState2ClassName(newValue));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
link() {
|
|
48
|
+
const $el = this.$el;
|
|
49
|
+
|
|
50
|
+
//clear status classes
|
|
51
|
+
Object.values(ProcessState).map(processState2ClassName).forEach(function (state) {
|
|
52
|
+
$el.removeClass(state);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
//set active status class
|
|
56
|
+
$el.addClass(processState2ClassName(this.model.getState().getValue()));
|
|
57
|
+
|
|
58
|
+
super.link();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export default ProcessView;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import View from "../../../src/view/View.js";
|
|
2
|
+
import { clear } from "../../../src/view/controller/dat/DatGuiUtils.js";
|
|
3
|
+
import dat from 'dat.gui'
|
|
4
|
+
|
|
5
|
+
class ToolSettingsView extends View {
|
|
6
|
+
constructor(tool) {
|
|
7
|
+
super(tool);
|
|
8
|
+
|
|
9
|
+
this.model = tool;
|
|
10
|
+
|
|
11
|
+
const gui = new dat.GUI({
|
|
12
|
+
autoPlace: false,
|
|
13
|
+
closed: false,
|
|
14
|
+
resizable: false
|
|
15
|
+
});
|
|
16
|
+
this.gui = gui;
|
|
17
|
+
|
|
18
|
+
this.el = gui.domElement;
|
|
19
|
+
|
|
20
|
+
this.addClass('editor-tool-settings-view');
|
|
21
|
+
|
|
22
|
+
this.build();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
setTool(tool) {
|
|
26
|
+
this.model = tool;
|
|
27
|
+
this.build();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
build() {
|
|
31
|
+
|
|
32
|
+
let rowCount = 0;
|
|
33
|
+
|
|
34
|
+
function isObservedValue(v) {
|
|
35
|
+
return typeof v === "object" && typeof v.onChanged === "object" && typeof v.get === "function";
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function isVector1(v) {
|
|
39
|
+
return typeof v === "object" && v.constructor !== undefined && v.constructor.typeName === "Vector1";
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function addProperties(folder, object) {
|
|
43
|
+
for (let propertyName in object) {
|
|
44
|
+
const propertyValue = object[propertyName];
|
|
45
|
+
if (typeof propertyValue === object) {
|
|
46
|
+
//check for observed values
|
|
47
|
+
if (isObservedValue(propertyValue) || isVector1(propertyValue)) {
|
|
48
|
+
makeProperty(folder, object, propertyName);
|
|
49
|
+
} else {
|
|
50
|
+
makeFolder(folder, propertyValue, propertyName);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
makeProperty(folder, object, propertyName);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function makeFolder(parentFolder, object, name) {
|
|
59
|
+
rowCount++;
|
|
60
|
+
|
|
61
|
+
const folder = parentFolder.addFolder(name);
|
|
62
|
+
|
|
63
|
+
folder.closed = false;
|
|
64
|
+
|
|
65
|
+
addProperties(folder, object);
|
|
66
|
+
|
|
67
|
+
return folder;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function wrapObservedValue(value) {
|
|
71
|
+
const op = {
|
|
72
|
+
v: null
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
Object.defineProperty(op, "v", {
|
|
76
|
+
get: function () {
|
|
77
|
+
return value.get();
|
|
78
|
+
},
|
|
79
|
+
set: function (v) {
|
|
80
|
+
return value.set(v);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
return op;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function wrapVector1(value) {
|
|
88
|
+
const op = {
|
|
89
|
+
v: null
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
Object.defineProperty(op, "v", {
|
|
93
|
+
get: function () {
|
|
94
|
+
return value.getValue();
|
|
95
|
+
},
|
|
96
|
+
set: function (v) {
|
|
97
|
+
return value.set(v);
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
return op;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function makeProperty(parentFolder, owner, name) {
|
|
105
|
+
rowCount++;
|
|
106
|
+
|
|
107
|
+
let control;
|
|
108
|
+
|
|
109
|
+
try {
|
|
110
|
+
const propertyValue = owner[name];
|
|
111
|
+
if (isObservedValue(propertyValue)) {
|
|
112
|
+
control = parentFolder.add(wrapObservedValue(propertyValue), "v");
|
|
113
|
+
control.name(name);
|
|
114
|
+
} else if (isVector1(propertyValue)) {
|
|
115
|
+
control = parentFolder.add(wrapVector1(propertyValue), "v");
|
|
116
|
+
control.name(name);
|
|
117
|
+
} else {
|
|
118
|
+
control = parentFolder.add(owner, name);
|
|
119
|
+
}
|
|
120
|
+
} catch (e) {
|
|
121
|
+
console.error("Failed to add option controller", name, e);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return control;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const gui = this.gui;
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
clear(gui);
|
|
131
|
+
|
|
132
|
+
const tool = this.model;
|
|
133
|
+
|
|
134
|
+
if (tool !== undefined && typeof tool.settings === "object") {
|
|
135
|
+
addProperties(gui, tool.settings);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.size.set(gui.width, rowCount * 30 + 20);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
export default ToolSettingsView;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Created by Alex on 16/01/2017.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
import View from "../../../src/view/View.js";
|
|
7
|
+
import dom from "../../../src/view/DOM.js";
|
|
8
|
+
|
|
9
|
+
import LabelView from '../../../src/view/common/LabelView.js';
|
|
10
|
+
import ImageView from "../../../src/view/elements/image/ImageView.js";
|
|
11
|
+
|
|
12
|
+
class ToolView extends View {
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param {Tool} tool
|
|
16
|
+
* @param {Editor} editor
|
|
17
|
+
* @constructor
|
|
18
|
+
*/
|
|
19
|
+
constructor({ tool, editor }) {
|
|
20
|
+
|
|
21
|
+
super(tool);
|
|
22
|
+
|
|
23
|
+
const dRoot = dom('div');
|
|
24
|
+
|
|
25
|
+
dRoot.addClass('tool-view');
|
|
26
|
+
|
|
27
|
+
dRoot.addClass(`editor-tool-${tool.name}`);
|
|
28
|
+
|
|
29
|
+
this.el = dRoot.el;
|
|
30
|
+
|
|
31
|
+
//add tool name
|
|
32
|
+
const lName = new LabelView(tool.name);
|
|
33
|
+
|
|
34
|
+
const icon = new ImageView(tool.icon, { classList: ['icon'] });
|
|
35
|
+
|
|
36
|
+
icon.size.set(32, 32);
|
|
37
|
+
icon.position.set(2, 2);
|
|
38
|
+
|
|
39
|
+
this.addChild(icon);
|
|
40
|
+
|
|
41
|
+
this.addChild(lName);
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
this.on.linked.add(() => {
|
|
45
|
+
tool.updateIcon(editor);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
function updateIconVisibility() {
|
|
49
|
+
icon.visible = (tool.icon.getValue() !== "");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
tool.icon.onChanged.add(updateIconVisibility);
|
|
53
|
+
this.on.linked.add(updateIconVisibility);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export default ToolView;
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"description": "Fully featured ECS game engine written in JavaScript",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "Alexander Goldring",
|
|
8
|
-
"version": "2.46.
|
|
8
|
+
"version": "2.46.30",
|
|
9
9
|
"main": "build/meep.module.js",
|
|
10
10
|
"module": "build/meep.module.js",
|
|
11
11
|
"exports": {
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"files": [
|
|
28
28
|
"build",
|
|
29
29
|
"src",
|
|
30
|
+
"editor",
|
|
30
31
|
"samples",
|
|
31
32
|
"package.json",
|
|
32
33
|
"README.md"
|
|
@@ -22,7 +22,7 @@ export class EBBVHLeafProxy {
|
|
|
22
22
|
*/
|
|
23
23
|
bounds = new Float32Array(6);
|
|
24
24
|
|
|
25
|
-
get is_linked(){
|
|
25
|
+
get is_linked() {
|
|
26
26
|
return this.#node_id !== -1;
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -55,6 +55,11 @@ export class EBBVHLeafProxy {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
write_bounds() {
|
|
58
|
+
if (this.#tree === null) {
|
|
59
|
+
// nothing to write to
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
this.#tree.node_move_aabb(this.#node_id, this.bounds);
|
|
59
64
|
}
|
|
60
65
|
}
|
|
@@ -5,7 +5,7 @@ import { assert } from "../../../assert.js";
|
|
|
5
5
|
* NOTE: {@link result} and {@link aabb} must be different objects
|
|
6
6
|
* @param {ArrayLike<number>|number[]|Float32Array} result
|
|
7
7
|
* @param {ArrayLike<number>|number[]|Float32Array} aabb
|
|
8
|
-
* @param {number[]} matrix 4x4 matrix
|
|
8
|
+
* @param {ArrayLike<number>|number[]|Float32Array} matrix 4x4 matrix
|
|
9
9
|
*/
|
|
10
10
|
export function aabb3_matrix4_project(result, aabb, matrix) {
|
|
11
11
|
assert.notEqual(result, aabb, 'input and output must not be the same for algorithm to work correctly');
|
|
@@ -2,7 +2,16 @@ import {System} from "../../../../ecs/System";
|
|
|
2
2
|
import {Decal} from "./Decal";
|
|
3
3
|
import {Transform} from "../../../../ecs/transform/Transform";
|
|
4
4
|
import Engine from "../../../../Engine";
|
|
5
|
+
import {SurfacePoint3} from "../../../../../core/geom/3d/SurfacePoint3";
|
|
5
6
|
|
|
6
7
|
export class FPDecalSystem extends System<Decal, Transform> {
|
|
7
8
|
constructor(engine: Engine)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
raycast(
|
|
12
|
+
origin_x: number, origin_y: number, origin_z: number,
|
|
13
|
+
direction_x: number, direction_y: number, direction_z: number,
|
|
14
|
+
filter_function?: (entity: number, mesh: Decal) => boolean,
|
|
15
|
+
filter_function_context?: any
|
|
16
|
+
): { entity: number, component: Decal, contact: SurfacePoint3 }[]
|
|
8
17
|
}
|