@woosh/meep-engine 2.37.18 → 2.37.19
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/core/assert.js +1 -1
- package/core/collection/array/typed/isTypedArray.js +20 -0
- package/core/collection/array/typedArrayToDataType.js +1 -0
- package/core/collection/table/RowFirstTable.js +34 -0
- package/core/collection/table/RowFirstTable.spec.js +59 -1
- package/core/color/Color.js +14 -0
- package/core/color/rgb2hex.js +1 -1
- package/core/events/signal/Signal.spec.js +16 -0
- package/core/geom/Quaternion.d.ts +5 -0
- package/core/geom/Quaternion.js +152 -137
- package/core/geom/Quaternion.spec.js +47 -2
- package/core/geom/Vector3.schema.json +16 -0
- package/core/json/JsonUtils.js +2 -20
- package/core/model/ObservedEnum.js +8 -0
- package/editor/Editor.js +97 -1
- package/editor/actions/concrete/PatchTerrainHeightAction.js +1 -1
- 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 +90 -0
- package/editor/ecs/component/createObjectEditor.js +242 -60
- 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 +50 -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 +60 -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 +44 -0
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.js +17 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.js +58 -0
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +54 -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 +42 -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 +56 -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 +25 -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 +32 -0
- package/editor/ecs/component/findNearestRegisteredType.js +59 -0
- package/editor/ecs/component/prototypeObjectEditor.js +379 -0
- package/editor/view/EditorView.js +1 -1
- package/editor/view/ecs/ComponentControlView.js +2 -30
- package/editor/view/ecs/EntityEditor.js +61 -139
- package/editor/view/ecs/components/GridObstacleController.js +4 -4
- package/editor/view/ecs/components/TerrainController.js +1 -1
- package/editor/view/ecs/components/common/NumberController.js +19 -7
- package/engine/animation/keyed2/AnimationTrack.js +1 -1
- package/engine/ecs/components/TagEditor.js +15 -0
- package/engine/ecs/terrain/ecs/Terrain.js +23 -42
- package/engine/ecs/terrain/ecs/TerrainSystem.js +2 -2
- package/engine/ecs/terrain/ecs/layers/TerrainLayer.js +1 -1
- package/engine/ecs/terrain/util/loadVisibleTerrainTiles.js +1 -1
- package/engine/ecs/transform/Transform.editor.schema.json +16 -0
- package/engine/graphics/ecs/highlight/HighlightEditor.js +17 -0
- package/engine/graphics/ecs/mesh/MeshEditor.js +28 -0
- package/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +3 -3
- package/engine/graphics/micron/render/instanced/shader/shader_rewrite_standard.js +15 -15
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +5 -0
- package/engine/graphics/texture/sampler/Sampler2D.js +16 -0
- package/engine/graphics/util/ScaleObject3ToBox.js +14 -1
- package/engine/graphics/util/makeMeshPreviewScene.js +2 -1
- package/engine/grid/components/GridObstacle.js +0 -44
- package/engine/grid/components/GridObstacleSerializationAdapter.js +46 -0
- package/engine/navigation/ecs/components/Path.d.ts +2 -0
- package/engine/navigation/ecs/components/Path.js +6 -1
- package/generation/example/SampleGenerator0.js +33 -29
- package/generation/example/generators/interactive/mir_generator_place_buff_objects.js +7 -6
- package/generation/example/generators/mir_generator_place_bases.js +7 -3
- package/generation/example/generators/mir_generator_place_road_decorators.js +3 -3
- package/generation/example/generators/mir_generator_place_starting_point.js +3 -2
- package/generation/markers/GridCellActionPlaceMarker.js +9 -3
- package/generation/markers/transform/MarkerNodeTransformerOffsetPosition.js +1 -1
- package/generation/placement/GridCellPlacementRule.js +22 -23
- package/generation/theme/ThemeEngine.js +1 -1
- package/package.json +1 -1
- package/samples/terrain/main.js +1 -1
- package/view/View.js +23 -1
- package/view/common/LabelView.js +1 -1
- package/view/compose3x3transform.js +32 -8
- package/view/controller/dat/DatGuiUtils.js +1 -1
- package/view/elements/DropDownSelectionView.js +11 -3
- package/view/elements/image/ImageView.js +3 -1
- package/core/model/ObservedReal.js +0 -55
- package/editor/ecs/component/ObjectEditor.js +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TypeEditor } from "../TypeEditor.js";
|
|
2
|
+
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
3
|
+
import sampler2D2Canvas from "../../../../engine/graphics/texture/sampler/Sampler2D2Canvas.js";
|
|
4
|
+
import { scaleSampler2D } from "../../../../engine/graphics/texture/sampler/scaleSampler2D.js";
|
|
5
|
+
import { Sampler2D } from "../../../../engine/graphics/texture/sampler/Sampler2D.js";
|
|
6
|
+
import {
|
|
7
|
+
typedArrayConstructorByInstance
|
|
8
|
+
} from "../../../../engine/graphics/texture/sampler/typedArrayConstructorByInstance.js";
|
|
9
|
+
import { typedArrayToDataType } from "../../../../core/collection/array/typedArrayToDataType.js";
|
|
10
|
+
import { DataType } from "../../../../core/collection/table/DataType.js";
|
|
11
|
+
import { min2 } from "../../../../core/math/min2.js";
|
|
12
|
+
import { max2 } from "../../../../core/math/max2.js";
|
|
13
|
+
import { isTypedArray } from "../../../../core/collection/array/typed/isTypedArray.js";
|
|
14
|
+
|
|
15
|
+
export class Sampler2DEditor extends TypeEditor {
|
|
16
|
+
build(parent, field, context) {
|
|
17
|
+
/**
|
|
18
|
+
* @type {Sampler2D}
|
|
19
|
+
*/
|
|
20
|
+
const sampler = field.adapter.read(parent, field.name);
|
|
21
|
+
|
|
22
|
+
let dataType;
|
|
23
|
+
|
|
24
|
+
if (isTypedArray(sampler.data)) {
|
|
25
|
+
dataType = typedArrayToDataType(sampler.data);
|
|
26
|
+
} else {
|
|
27
|
+
dataType = DataType.Float32;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const TypedArrayConstructor = typedArrayConstructorByInstance(sampler.data);
|
|
31
|
+
|
|
32
|
+
const res = 32;
|
|
33
|
+
const result_sampler = new Sampler2D(new TypedArrayConstructor(sampler.itemSize * res * res), sampler.itemSize, res, res);
|
|
34
|
+
|
|
35
|
+
scaleSampler2D(sampler, result_sampler);
|
|
36
|
+
|
|
37
|
+
const view = new CanvasView();
|
|
38
|
+
|
|
39
|
+
let min = 0, max = 0;
|
|
40
|
+
if (dataType === DataType.Float32) {
|
|
41
|
+
min = Infinity;
|
|
42
|
+
max = -Infinity;
|
|
43
|
+
for (let i = 0; i < result_sampler.itemSize; i++) {
|
|
44
|
+
|
|
45
|
+
min = min2(min, result_sampler.computeMin(i).value)
|
|
46
|
+
max = max2(min, result_sampler.computeMax(i).value)
|
|
47
|
+
}
|
|
48
|
+
} else if (dataType === DataType.Uint8) {
|
|
49
|
+
min = 0;
|
|
50
|
+
max = 255;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const scale = 255 / (max - min);
|
|
54
|
+
const offset = min;
|
|
55
|
+
|
|
56
|
+
sampler2D2Canvas(result_sampler, scale, offset, view.el);
|
|
57
|
+
|
|
58
|
+
return view;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { NativeListController } from "../../../../../view/controller/controls/NativeListController.js";
|
|
3
|
+
import { buildObjectEditorFromRegistry } from "../../createObjectEditor.js";
|
|
4
|
+
import LabelView from "../../../../../view/common/LabelView.js";
|
|
5
|
+
import { FieldDescriptor } from "../../FieldDescriptor.js";
|
|
6
|
+
import { FieldValueAdapter } from "../../FieldValueAdapter.js";
|
|
7
|
+
|
|
8
|
+
export class ListEditor extends TypeEditor {
|
|
9
|
+
inline = false;
|
|
10
|
+
|
|
11
|
+
build(parent, field, registry) {
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const list = field.adapter.read(parent, field.name);
|
|
15
|
+
|
|
16
|
+
if (list.length > 100) {
|
|
17
|
+
return new LabelView(`List is too big (length = ${list.length})`);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let ElementType;
|
|
21
|
+
|
|
22
|
+
const field_schema = field.schema;
|
|
23
|
+
|
|
24
|
+
if (field_schema !== undefined) {
|
|
25
|
+
|
|
26
|
+
const type_parameters = field_schema.type_parameters;
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if (type_parameters === undefined || type_parameters.length < 1) {
|
|
30
|
+
// no type specified on schema
|
|
31
|
+
|
|
32
|
+
} else {
|
|
33
|
+
|
|
34
|
+
ElementType = type_parameters[0];
|
|
35
|
+
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let inferred_type = false;
|
|
40
|
+
|
|
41
|
+
if (ElementType === undefined && list.length > 0) {
|
|
42
|
+
ElementType = list.get(0).constructor;
|
|
43
|
+
inferred_type = true;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (ElementType === undefined) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (inferred_type && !registry.has(ElementType)) {
|
|
51
|
+
// only work with known types when type is inferred, too messy otherwise
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return new NativeListController({
|
|
56
|
+
model: list,
|
|
57
|
+
elementFactory() {
|
|
58
|
+
return new ElementType();
|
|
59
|
+
},
|
|
60
|
+
elementViewFactory(el) {
|
|
61
|
+
const fd = new FieldDescriptor();
|
|
62
|
+
|
|
63
|
+
let last_known = el;
|
|
64
|
+
|
|
65
|
+
fd.type = ElementType;
|
|
66
|
+
fd.adapter = new FieldValueAdapter();
|
|
67
|
+
fd.adapter.read = (object, field_name) => {
|
|
68
|
+
return last_known;
|
|
69
|
+
};
|
|
70
|
+
fd.adapter.write = (object, field_name, value) => {
|
|
71
|
+
const i = list.indexOf(last_known);
|
|
72
|
+
|
|
73
|
+
list.set(i, value);
|
|
74
|
+
|
|
75
|
+
last_known = value;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
return buildObjectEditorFromRegistry(el, registry, fd);
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { assert } from "../../../../../core/assert.js";
|
|
3
|
+
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
4
|
+
import { CheckboxView } from "../../../../../view/elements/CheckboxView.js";
|
|
5
|
+
import ObservedBoolean from "../../../../../core/model/ObservedBoolean.js";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {Object} parent
|
|
11
|
+
* @param {FieldDescriptor} field
|
|
12
|
+
* @param {string} key
|
|
13
|
+
* @param {Object<number>} definition
|
|
14
|
+
*/
|
|
15
|
+
function make_flag_editor(parent, field, key, definition) {
|
|
16
|
+
const mask = definition[key];
|
|
17
|
+
|
|
18
|
+
function get_field_value() {
|
|
19
|
+
return field.adapter.read(parent, field.name);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function read() {
|
|
23
|
+
const flags = get_field_value();
|
|
24
|
+
|
|
25
|
+
return (flags & mask) !== 0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const flag = new ObservedBoolean(read());
|
|
29
|
+
|
|
30
|
+
const r = new CheckboxView({ value: flag });
|
|
31
|
+
|
|
32
|
+
r.attr({
|
|
33
|
+
// Tooltip
|
|
34
|
+
title: key
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
flag.onChanged.add((v) => {
|
|
38
|
+
const flags = get_field_value();
|
|
39
|
+
|
|
40
|
+
let new_flags;
|
|
41
|
+
|
|
42
|
+
if (v) {
|
|
43
|
+
new_flags = flags | mask;
|
|
44
|
+
} else {
|
|
45
|
+
new_flags = flags & ~(mask);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
field.adapter.write(parent, field.name, new_flags);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return r;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export class BitFlagsEditor extends TypeEditor {
|
|
55
|
+
/**
|
|
56
|
+
*
|
|
57
|
+
* @param {Object<number>} definition
|
|
58
|
+
*/
|
|
59
|
+
constructor(definition) {
|
|
60
|
+
super();
|
|
61
|
+
|
|
62
|
+
assert.defined(definition, 'definition');
|
|
63
|
+
|
|
64
|
+
this.definition = definition;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
build(parent, field, registry) {
|
|
68
|
+
const flag_names = Object.keys(this.definition);
|
|
69
|
+
|
|
70
|
+
const r = new EmptyView();
|
|
71
|
+
|
|
72
|
+
for (let i = 0; i < flag_names.length; i++) {
|
|
73
|
+
const flag_key = flag_names[i];
|
|
74
|
+
|
|
75
|
+
r.addChild(make_flag_editor(parent, field, flag_key, this.definition));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return r;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import DropDownSelectionView from "../../../../../view/elements/DropDownSelectionView.js";
|
|
3
|
+
import List from "../../../../../core/collection/list/List.js";
|
|
4
|
+
import { objectKeyByValue } from "../../../../../core/model/object/objectKeyByValue.js";
|
|
5
|
+
|
|
6
|
+
export class EnumEditor extends TypeEditor {
|
|
7
|
+
constructor(type) {
|
|
8
|
+
super();
|
|
9
|
+
|
|
10
|
+
this.type = type;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
build(parent, field, registry) {
|
|
14
|
+
|
|
15
|
+
const valueSet = this.type;
|
|
16
|
+
|
|
17
|
+
function read() {
|
|
18
|
+
return field.adapter.read(parent, field.name);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function write(v) {
|
|
22
|
+
field.adapter.write(parent, field.name, v);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const ctrl = new DropDownSelectionView(
|
|
26
|
+
new List(Object.keys(valueSet)), {
|
|
27
|
+
changeListener(key) {
|
|
28
|
+
const v = valueSet[key];
|
|
29
|
+
|
|
30
|
+
write(v);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
ctrl.on.linked.add(() => {
|
|
36
|
+
ctrl.setSelectedValue(objectKeyByValue(valueSet, read()));
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
return ctrl;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import EmptyView from "../../../../../view/elements/EmptyView.js";
|
|
2
|
+
import { NumberController } from "../../../../view/ecs/components/common/NumberController.js";
|
|
3
|
+
import LabelView from "../../../../../view/common/LabelView.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param {string[]} props
|
|
8
|
+
* @param {} value
|
|
9
|
+
* @param {Signal} change_signal
|
|
10
|
+
*/
|
|
11
|
+
export function make_row_editor(props, value, change_signal = value.onChanged) {
|
|
12
|
+
|
|
13
|
+
const r = new EmptyView({
|
|
14
|
+
classList: ['inline-field-row-editor']
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const ctrls = [];
|
|
18
|
+
|
|
19
|
+
for (let i = 0; i < props.length; i++) {
|
|
20
|
+
const prop_name = props[i];
|
|
21
|
+
|
|
22
|
+
const ctrl = new NumberController({
|
|
23
|
+
value: value[prop_name]
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
r.addChild(new LabelView(prop_name));
|
|
27
|
+
r.addChild(ctrl);
|
|
28
|
+
|
|
29
|
+
ctrls[i] = ctrl;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let lock = false;
|
|
33
|
+
|
|
34
|
+
const sync_up = () => {
|
|
35
|
+
if (lock) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
lock = true;
|
|
40
|
+
|
|
41
|
+
for (let i = 0; i < props.length; i++) {
|
|
42
|
+
const prop_name = props[i];
|
|
43
|
+
|
|
44
|
+
ctrls[i].value.set(value[prop_name]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
lock = false;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const sync_down = () => {
|
|
52
|
+
|
|
53
|
+
if (lock) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
lock = true;
|
|
58
|
+
|
|
59
|
+
const params = ctrls.map(c => c.value.getValue());
|
|
60
|
+
|
|
61
|
+
value.set.apply(value, params);
|
|
62
|
+
|
|
63
|
+
lock = false;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
r.on.linked.add(sync_up);
|
|
67
|
+
|
|
68
|
+
r.bindSignal(change_signal, sync_up);
|
|
69
|
+
|
|
70
|
+
for (let i = 0; i < props.length; i++) {
|
|
71
|
+
|
|
72
|
+
ctrls[i].value.onChanged.add(sync_down);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return r;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
*
|
|
80
|
+
* @param {Vector3} v3
|
|
81
|
+
* @returns {EmptyView}
|
|
82
|
+
*/
|
|
83
|
+
export function makeV3_editor(v3) {
|
|
84
|
+
return make_row_editor(['x', 'y', 'z'], v3);
|
|
85
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
3
|
+
import { buildGridObstaclePreview } from "../../../../view/ecs/components/GridObstacleController.js";
|
|
4
|
+
|
|
5
|
+
export class GridObstacleEditor extends TypeEditor {
|
|
6
|
+
inline = false
|
|
7
|
+
|
|
8
|
+
build(parent, field, registry) {
|
|
9
|
+
const v = new CanvasView();
|
|
10
|
+
|
|
11
|
+
v.size.set(100, 100);
|
|
12
|
+
|
|
13
|
+
buildGridObstaclePreview(field.adapter.read(parent, field.name), v.el);
|
|
14
|
+
|
|
15
|
+
return v;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
2
|
+
import ObservedString from "../../../../../core/model/ObservedString.js";
|
|
3
|
+
import { ImagePathEditor } from "../ImagePathEditor.js";
|
|
4
|
+
|
|
5
|
+
export class MinimapMarkerEditor extends ObjectEditor {
|
|
6
|
+
get schema() {
|
|
7
|
+
return {
|
|
8
|
+
properties: {
|
|
9
|
+
iconURL: {
|
|
10
|
+
type: ObservedString,
|
|
11
|
+
editor: new ImagePathEditor()
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { TypeEditor } from "../../TypeEditor.js";
|
|
2
|
+
import { CanvasView } from "../../../../../view/elements/CanvasView.js";
|
|
3
|
+
import { plot_data } from "../../../../../engine/animation/curve/draw/plot_data.js";
|
|
4
|
+
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
5
|
+
|
|
6
|
+
export class ParameterLookupTableEditor extends TypeEditor {
|
|
7
|
+
get schema() {
|
|
8
|
+
return {
|
|
9
|
+
properties: {
|
|
10
|
+
on: {
|
|
11
|
+
transient: true
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
build(parent, field,registry) {
|
|
18
|
+
|
|
19
|
+
const canvasView = new CanvasView();
|
|
20
|
+
canvasView.size.set(200, 100);
|
|
21
|
+
const ctx = canvasView.context2d;
|
|
22
|
+
|
|
23
|
+
const data = [];
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @type {ParameterLookupTable}
|
|
27
|
+
*/
|
|
28
|
+
const lut = field.adapter.read(parent, field.name);
|
|
29
|
+
|
|
30
|
+
const sample = [];
|
|
31
|
+
|
|
32
|
+
for (let i = 0; i < canvasView.size.x; i++) {
|
|
33
|
+
const f = i / (canvasView.size.x - 1);
|
|
34
|
+
|
|
35
|
+
lut.sample(f, sample);
|
|
36
|
+
|
|
37
|
+
data[i] = sample[0];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
plot_data({ ctx, data, width: canvasView.size.x, height: canvasView.size.y, margin: new Vector2(4, 4) });
|
|
41
|
+
|
|
42
|
+
return canvasView;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
2
|
+
import { EnumEditor } from "../common/EnumEditor.js";
|
|
3
|
+
|
|
4
|
+
export class ParameterTrackEditor extends ObjectEditor {
|
|
5
|
+
get schema() {
|
|
6
|
+
return {
|
|
7
|
+
properties: {
|
|
8
|
+
name: {
|
|
9
|
+
editor: new EnumEditor({
|
|
10
|
+
Color: "color",
|
|
11
|
+
Scale: "scale"
|
|
12
|
+
})
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import List from "../../../../../core/collection/list/List.js";
|
|
2
|
+
import { ParticleLayer } from "../../../../../engine/graphics/particles/particular/engine/emitter/ParticleLayer.js";
|
|
3
|
+
import { BitFlagsEditor } from "../common/BitFlagsEditor.js";
|
|
4
|
+
import {
|
|
5
|
+
ParticleEmitterFlag
|
|
6
|
+
} from "../../../../../engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js";
|
|
7
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
8
|
+
import { EnumEditor } from "../common/EnumEditor.js";
|
|
9
|
+
import { BlendingType } from "../../../../../engine/graphics/texture/sampler/BlendingType.js";
|
|
10
|
+
|
|
11
|
+
export class ParticleEmitterEditor extends ObjectEditor {
|
|
12
|
+
get schema() {
|
|
13
|
+
return {
|
|
14
|
+
properties: {
|
|
15
|
+
parameters: {
|
|
16
|
+
transient: true
|
|
17
|
+
},
|
|
18
|
+
layers: {
|
|
19
|
+
type: List,
|
|
20
|
+
type_parameters: [ParticleLayer]
|
|
21
|
+
},
|
|
22
|
+
particles: {
|
|
23
|
+
transient: true
|
|
24
|
+
},
|
|
25
|
+
mesh: {
|
|
26
|
+
transient: true
|
|
27
|
+
},
|
|
28
|
+
bvhLeaf: {
|
|
29
|
+
transient: true
|
|
30
|
+
},
|
|
31
|
+
particleBounds: {
|
|
32
|
+
transient: true
|
|
33
|
+
},
|
|
34
|
+
emisionBounds: {
|
|
35
|
+
transient: true
|
|
36
|
+
},
|
|
37
|
+
flags: {
|
|
38
|
+
editor: new BitFlagsEditor(ParticleEmitterFlag)
|
|
39
|
+
},
|
|
40
|
+
blendingMode: {
|
|
41
|
+
editor: new EnumEditor(BlendingType)
|
|
42
|
+
},
|
|
43
|
+
sleepTime: {
|
|
44
|
+
transient: true,
|
|
45
|
+
},
|
|
46
|
+
position: {
|
|
47
|
+
transient: true
|
|
48
|
+
},
|
|
49
|
+
rotation: {
|
|
50
|
+
transient: true
|
|
51
|
+
},
|
|
52
|
+
scale: {
|
|
53
|
+
transient: true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import List from "../../../../../core/collection/list/List.js";
|
|
2
|
+
import {
|
|
3
|
+
SimulationStepDefinition
|
|
4
|
+
} from "../../../../../engine/graphics/particles/particular/engine/simulator/SimulationStepDefinition.js";
|
|
5
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
6
|
+
import { ImagePathEditor } from "../ImagePathEditor.js";
|
|
7
|
+
import { EnumEditor } from "../common/EnumEditor.js";
|
|
8
|
+
import {
|
|
9
|
+
EmissionShapeType
|
|
10
|
+
} from "../../../../../engine/graphics/particles/particular/engine/emitter/EmissionShapeType.js";
|
|
11
|
+
import {
|
|
12
|
+
EmissionFromType
|
|
13
|
+
} from "../../../../../engine/graphics/particles/particular/engine/emitter/EmissionFromType.js";
|
|
14
|
+
import { DataType } from "../../../../../core/collection/table/DataType.js";
|
|
15
|
+
|
|
16
|
+
export class ParticleEmitterLayerEditor extends ObjectEditor {
|
|
17
|
+
get schema() {
|
|
18
|
+
return {
|
|
19
|
+
properties: {
|
|
20
|
+
imageURL: {
|
|
21
|
+
type: String,
|
|
22
|
+
editor: new ImagePathEditor()
|
|
23
|
+
},
|
|
24
|
+
emissionShape: {
|
|
25
|
+
editor: new EnumEditor(EmissionShapeType)
|
|
26
|
+
},
|
|
27
|
+
emissionFrom: {
|
|
28
|
+
editor: new EnumEditor(EmissionFromType)
|
|
29
|
+
},
|
|
30
|
+
emissionRate: {
|
|
31
|
+
type: Number,
|
|
32
|
+
numeric_type: DataType.Uint32
|
|
33
|
+
},
|
|
34
|
+
emissionImmediate: {
|
|
35
|
+
type: Number,
|
|
36
|
+
numeric_type: DataType.Uint32
|
|
37
|
+
},
|
|
38
|
+
scaledSpriteHalfSize: {
|
|
39
|
+
transient: true
|
|
40
|
+
},
|
|
41
|
+
baseBoundingBox: {
|
|
42
|
+
transient: true
|
|
43
|
+
},
|
|
44
|
+
steps: {
|
|
45
|
+
type: List,
|
|
46
|
+
type_parameters: [SimulationStepDefinition]
|
|
47
|
+
},
|
|
48
|
+
timeSinceLastEmission: {
|
|
49
|
+
transient: true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
2
|
+
import { EnumEditor } from "../common/EnumEditor.js";
|
|
3
|
+
import {
|
|
4
|
+
SimulationStepType
|
|
5
|
+
} from "../../../../../engine/graphics/particles/particular/engine/simulator/SimulationStepType.js";
|
|
6
|
+
|
|
7
|
+
export class SimulationStepDefinitionEditor extends ObjectEditor {
|
|
8
|
+
get schema() {
|
|
9
|
+
return {
|
|
10
|
+
properties: {
|
|
11
|
+
type: {
|
|
12
|
+
editor: new EnumEditor(SimulationStepType)
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
type: Array,
|
|
16
|
+
type_parameters: [Number]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BitFlagsEditor } from "../common/BitFlagsEditor.js";
|
|
2
|
+
import { Trail2DFlags } from "../../../../../engine/graphics/ecs/trail2d/Trail2D.js";
|
|
3
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
4
|
+
|
|
5
|
+
export class Trail2DEditor extends ObjectEditor {
|
|
6
|
+
get schema() {
|
|
7
|
+
return {
|
|
8
|
+
properties: {
|
|
9
|
+
maxAge: {
|
|
10
|
+
description: "How long does the trail persist in time"
|
|
11
|
+
},
|
|
12
|
+
time: {
|
|
13
|
+
transient: true
|
|
14
|
+
},
|
|
15
|
+
trailingIndex: {
|
|
16
|
+
transient: true
|
|
17
|
+
},
|
|
18
|
+
timeSinceLastUpdate: {
|
|
19
|
+
transient: true
|
|
20
|
+
},
|
|
21
|
+
ribbon: {
|
|
22
|
+
transient: true
|
|
23
|
+
},
|
|
24
|
+
bvhLeaf: {
|
|
25
|
+
transient: true
|
|
26
|
+
},
|
|
27
|
+
flags: {
|
|
28
|
+
editor: new BitFlagsEditor(Trail2DFlags)
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
2
|
+
import Quaternion from "../../../../../core/geom/Quaternion.js";
|
|
3
|
+
import { ObjectEditor } from "../primitive/ObjectEditor.js";
|
|
4
|
+
|
|
5
|
+
export class TransformEditor extends ObjectEditor {
|
|
6
|
+
get schema() {
|
|
7
|
+
return {
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
|
|
10
|
+
properties: {
|
|
11
|
+
position: {
|
|
12
|
+
type: Vector3
|
|
13
|
+
},
|
|
14
|
+
rotation: {
|
|
15
|
+
type: Quaternion
|
|
16
|
+
},
|
|
17
|
+
scale: {
|
|
18
|
+
type: Vector3
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../primitive/ObjectEditor.js";
|
|
2
|
+
|
|
3
|
+
export class SplatMappingEditor extends ObjectEditor {
|
|
4
|
+
get schema() {
|
|
5
|
+
return {
|
|
6
|
+
properties: {
|
|
7
|
+
depth: {
|
|
8
|
+
transient: true,
|
|
9
|
+
},
|
|
10
|
+
materialTexture: {
|
|
11
|
+
transient: true,
|
|
12
|
+
deprecated: true
|
|
13
|
+
},
|
|
14
|
+
materialSampler: {
|
|
15
|
+
transient: true,
|
|
16
|
+
deprecated: true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|