@woosh/meep-engine 2.37.16 → 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 +16 -2
- package/core/collection/array/typed/isTypedArray.js +20 -0
- package/core/collection/array/typedArrayToDataType.js +2 -1
- 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.js +8 -8
- 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/asset/AssetManager.js +1 -1
- package/engine/ecs/EntityBlueprint.js +1 -1
- package/engine/ecs/EntityBuilder.js +2 -2
- package/engine/ecs/EntityManager.js +1 -1
- package/engine/ecs/components/TagEditor.js +15 -0
- package/engine/ecs/parent/EntityNode.js +3 -0
- package/engine/ecs/storage/binary/object/BinaryObjectSerializationAdapter.js +1 -1
- 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/ecs/transform/Transform.js +3 -0
- package/engine/ecs/util/hideEntityGracefully.js +4 -2
- 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/knowledge/database/StaticKnowledgeDatabase.js +1 -1
- package/engine/navigation/ecs/components/Path.d.ts +2 -0
- package/engine/navigation/ecs/components/Path.js +6 -1
- package/engine/sound/material/concrete/json/serializeSoundMaterialToJSON.js +1 -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
|
@@ -131,7 +131,7 @@ class TerrainSystem extends System {
|
|
|
131
131
|
|
|
132
132
|
component.link(this.graphics);
|
|
133
133
|
|
|
134
|
-
const bvh = component.
|
|
134
|
+
const bvh = component.__tiles.bvh;
|
|
135
135
|
|
|
136
136
|
|
|
137
137
|
//record entity for editor
|
|
@@ -193,7 +193,7 @@ class TerrainSystem extends System {
|
|
|
193
193
|
assert.notEqual(terrain, null, 'terrain is null');
|
|
194
194
|
assert.notEqual(terrain, undefined, 'terrain is undefined');
|
|
195
195
|
|
|
196
|
-
const tileManager = terrain.
|
|
196
|
+
const tileManager = terrain.__tiles;
|
|
197
197
|
if (tileManager !== undefined) {
|
|
198
198
|
CameraSystem.getActiveFrustums(ecd, function (frustums) {
|
|
199
199
|
tileManager.bvh.threeTraverseFrustumsIntersections(frustums, function (leafNode) {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-04/schema",
|
|
3
|
+
"title": "Transform",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"position": {
|
|
7
|
+
"allOf": [{"$ref": "Vector3"}]
|
|
8
|
+
},
|
|
9
|
+
"rotation": {
|
|
10
|
+
"allOf": [{"$ref": "Quaterion"}]
|
|
11
|
+
},
|
|
12
|
+
"scale": {
|
|
13
|
+
"allOf": [{"$ref": "Vector3"}]
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -9,6 +9,7 @@ import { mat4 } from "gl-matrix";
|
|
|
9
9
|
import { compose_matrix4_array } from "../../../core/geom/3d/compose_matrix4_array.js";
|
|
10
10
|
import { TransformFlags } from "./TransformFlags.js";
|
|
11
11
|
import { allocate_transform_m4 } from "../../graphics/ecs/mesh-v2/allocate_transform_m4.js";
|
|
12
|
+
import { assert } from "../../../core/assert.js";
|
|
12
13
|
|
|
13
14
|
const delta = new Vector3();
|
|
14
15
|
|
|
@@ -180,6 +181,8 @@ export class Transform {
|
|
|
180
181
|
this.rotation.copy(other.rotation);
|
|
181
182
|
this.scale.copy(other.scale);
|
|
182
183
|
|
|
184
|
+
assert.arrayEqual(this.matrix, other.matrix, 'matrices must be equal after copy');
|
|
185
|
+
|
|
183
186
|
this.flags = other.flags;
|
|
184
187
|
}
|
|
185
188
|
|
|
@@ -13,7 +13,9 @@ import { SoundEmitter } from "../../sound/ecs/emitter/SoundEmitter.js";
|
|
|
13
13
|
import { TweenVector1Behavior } from "../../../../model/game/util/behavior/TweenVector1Behavior.js";
|
|
14
14
|
import { DelayBehavior } from "../../intelligence/behavior/util/DelayBehavior.js";
|
|
15
15
|
import { Light } from "../../graphics/ecs/light/Light.js";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
TransitionPropertyVectorXBehavior
|
|
18
|
+
} from "../../../../model/game/story/behaviors/generic/TransitionPropertyVectorXBehavior.js";
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
21
|
* @readonly
|
|
@@ -179,7 +181,7 @@ export function hideEntityGracefully(builder, createEntity, createEntityThisArg)
|
|
|
179
181
|
for (let i = 0; i < component_count; i++) {
|
|
180
182
|
const component = components[i];
|
|
181
183
|
|
|
182
|
-
const shutdown_method = component_shutdown.get(component.
|
|
184
|
+
const shutdown_method = component_shutdown.get(Object.getPrototypeOf(component).constructor);
|
|
183
185
|
|
|
184
186
|
if (shutdown_method === undefined) {
|
|
185
187
|
continue;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../../../editor/ecs/component/editors/primitive/ObjectEditor.js";
|
|
2
|
+
import List from "../../../../core/collection/list/List.js";
|
|
3
|
+
import { HighlightDefinition } from "./HighlightDefinition.js";
|
|
4
|
+
|
|
5
|
+
export class HighlightEditor extends ObjectEditor {
|
|
6
|
+
get schema() {
|
|
7
|
+
return {
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
properties: {
|
|
10
|
+
elements: {
|
|
11
|
+
type: List,
|
|
12
|
+
type_parameters: [HighlightDefinition]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ObjectEditor } from "../../../../editor/ecs/component/editors/primitive/ObjectEditor.js";
|
|
2
|
+
import { BitFlagsEditor } from "../../../../editor/ecs/component/editors/common/BitFlagsEditor.js";
|
|
3
|
+
import { MeshFlags } from "./Mesh.js";
|
|
4
|
+
|
|
5
|
+
export class MeshEditor extends ObjectEditor {
|
|
6
|
+
get schema() {
|
|
7
|
+
return {
|
|
8
|
+
properties: {
|
|
9
|
+
bvh: {
|
|
10
|
+
transient: true
|
|
11
|
+
},
|
|
12
|
+
asset: {
|
|
13
|
+
transient: true
|
|
14
|
+
},
|
|
15
|
+
boundingBox: {
|
|
16
|
+
transient: true
|
|
17
|
+
},
|
|
18
|
+
flags: {
|
|
19
|
+
editor: new BitFlagsEditor(MeshFlags),
|
|
20
|
+
transient: true
|
|
21
|
+
},
|
|
22
|
+
center: {
|
|
23
|
+
deprecated: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -56,7 +56,7 @@ new EngineHarness().initialize({
|
|
|
56
56
|
function make_grid(ecd, engine) {
|
|
57
57
|
const random = seededRandom(1);
|
|
58
58
|
|
|
59
|
-
const GRID_SIZE =
|
|
59
|
+
const GRID_SIZE = 40;
|
|
60
60
|
const GRID_FREQUENCY_SIZE = 7;
|
|
61
61
|
|
|
62
62
|
for (let i = 0; i < GRID_SIZE; i++) {
|
|
@@ -106,8 +106,8 @@ function make_grid(ecd, engine) {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
|
|
109
|
-
|
|
110
|
-
const mesh = SGMesh.fromURL("data/models/samples/transform-hierarchy.glb");
|
|
109
|
+
const mesh = SGMesh.fromURL("data/models/RTS_Buildings_Humans/18/Building_R_18_out/Building_R_18.gltf");
|
|
110
|
+
// const mesh = SGMesh.fromURL("data/models/samples/transform-hierarchy.glb");
|
|
111
111
|
new EntityBuilder()
|
|
112
112
|
.add(mesh)
|
|
113
113
|
.add(transform)
|
|
@@ -187,17 +187,17 @@ export function shader_rewrite_standard(shader, uniforms, spec, column_count) {
|
|
|
187
187
|
}
|
|
188
188
|
|
|
189
189
|
// shader.defines.USE_COLOR = true;
|
|
190
|
-
|
|
190
|
+
//
|
|
191
191
|
// rewrittenVertexShader = rewrittenVertexShader.replace(
|
|
192
192
|
// '#include <color_vertex>',
|
|
193
193
|
// `
|
|
194
194
|
// #include <color_vertex>
|
|
195
|
-
// vColor = vec3(1.0);
|
|
196
|
-
//
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
//
|
|
200
|
-
//
|
|
195
|
+
// //vColor = vec3(1.0);
|
|
196
|
+
// vColor.xyz = vec3(
|
|
197
|
+
// sin(float(micron_patch_address)*123.1),
|
|
198
|
+
// sin(float(micron_patch_address)*11.7),
|
|
199
|
+
// sin(float(micron_patch_address)*932.183)
|
|
200
|
+
// );
|
|
201
201
|
// `
|
|
202
202
|
// );
|
|
203
203
|
|
|
@@ -229,16 +229,16 @@ export function shader_rewrite_standard(shader, uniforms, spec, column_count) {
|
|
|
229
229
|
|
|
230
230
|
shader.fragmentShader = shader.fragmentShader.replace(
|
|
231
231
|
'#include <dithering_fragment>',
|
|
232
|
-
// `gl_FragColor.rgb = vec3(
|
|
233
|
-
// sin(v_micron_patch_address*123.1)*0.5 + 0.5,
|
|
234
|
-
// sin(v_micron_patch_address*11.7)*0.5 + 0.5,
|
|
235
|
-
// sin(v_micron_patch_address*932.183)*0.5 + 0.5
|
|
236
|
-
// );`
|
|
237
232
|
`gl_FragColor.rgb = vec3(
|
|
238
|
-
sin(
|
|
239
|
-
sin(
|
|
240
|
-
sin(
|
|
233
|
+
sin(v_micron_patch_address*123.1)*0.5 + 0.5,
|
|
234
|
+
sin(v_micron_patch_address*11.7)*0.5 + 0.5,
|
|
235
|
+
sin(v_micron_patch_address*932.183)*0.5 + 0.5
|
|
241
236
|
);`
|
|
237
|
+
// `gl_FragColor.rgb = vec3(
|
|
238
|
+
// sin(v_micron_instance_id*123.1)*0.5 + 0.5,
|
|
239
|
+
// sin(v_micron_instance_id*11.7)*0.5 + 0.5,
|
|
240
|
+
// sin(v_micron_instance_id*932.183)*0.5 + 0.5
|
|
241
|
+
// );`
|
|
242
242
|
// `gl_FragColor.rgb = vec3(
|
|
243
243
|
// v_vertex_id*0.0026041666666666665,
|
|
244
244
|
// 1.0,
|
|
@@ -140,6 +140,11 @@ ParticularEngine.prototype.advanceEmitter = function (emitter, timeDelta) {
|
|
|
140
140
|
|
|
141
141
|
const step = steps[type];
|
|
142
142
|
|
|
143
|
+
if (step === undefined) {
|
|
144
|
+
// no step definition
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
|
|
143
148
|
step.emitter = emitter;
|
|
144
149
|
step.timeDelta = timeDelta;
|
|
145
150
|
step.particles = emitter.particles;
|
|
@@ -1366,6 +1366,22 @@ Sampler2D.prototype.zeroFill = function (x, y, width, height) {
|
|
|
1366
1366
|
}
|
|
1367
1367
|
};
|
|
1368
1368
|
|
|
1369
|
+
/**
|
|
1370
|
+
*
|
|
1371
|
+
* @param {number} channel_index
|
|
1372
|
+
* @param {number} value
|
|
1373
|
+
*/
|
|
1374
|
+
Sampler2D.prototype.fill_channel = function (channel_index, value) {
|
|
1375
|
+
const itemSize = this.itemSize;
|
|
1376
|
+
const data = this.data;
|
|
1377
|
+
const length = data.length;
|
|
1378
|
+
|
|
1379
|
+
for (let i = channel_index; i < length; i += itemSize) {
|
|
1380
|
+
data[i] = value;
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
};
|
|
1384
|
+
|
|
1369
1385
|
/**
|
|
1370
1386
|
*
|
|
1371
1387
|
* @param {Number} x
|
|
@@ -13,6 +13,19 @@ export function scaleObject3ToBox(object, size, result) {
|
|
|
13
13
|
|
|
14
14
|
const boundingBox = new Box3();
|
|
15
15
|
|
|
16
|
+
object.traverse(a => {
|
|
17
|
+
if (a.isMesh) {
|
|
18
|
+
/**
|
|
19
|
+
* @type {THREE.BufferGeometry}
|
|
20
|
+
*/
|
|
21
|
+
const geometry = a.geometry;
|
|
22
|
+
|
|
23
|
+
if (geometry.boundingBox === null) {
|
|
24
|
+
geometry.computeBoundingBox();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
16
29
|
boundingBox.expandByObject(object);
|
|
17
30
|
|
|
18
31
|
//box size
|
|
@@ -22,4 +35,4 @@ export function scaleObject3ToBox(object, size, result) {
|
|
|
22
35
|
result.set(scale, scale, scale);
|
|
23
36
|
|
|
24
37
|
return actualBoxSize.multiplyScalar(scale);
|
|
25
|
-
}
|
|
38
|
+
}
|
|
@@ -11,6 +11,7 @@ import { rootObject3DFastMatrixUpdate } from "../ecs/mesh/rootObject3DFastMatrix
|
|
|
11
11
|
import { computeMeshPreviewCameraDistance } from "./computeMeshPreviewCameraDistance.js";
|
|
12
12
|
import { scaleObject3ToBox } from "./ScaleObject3ToBox.js";
|
|
13
13
|
import { DEG_TO_RAD } from "../../../core/math/DEG_TO_RAD.js";
|
|
14
|
+
import AABB2 from "../../../core/geom/AABB2.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
*
|
|
@@ -19,7 +20,7 @@ import { DEG_TO_RAD } from "../../../core/math/DEG_TO_RAD.js";
|
|
|
19
20
|
* @param {AABB2} focus
|
|
20
21
|
* @returns {{scene: Scene, camera: PerspectiveCamera}}
|
|
21
22
|
*/
|
|
22
|
-
export function makeMeshPreviewScene(mesh, size, focus) {
|
|
23
|
+
export function makeMeshPreviewScene(mesh, size, focus = new AABB2(0, 0, size.x, size.y)) {
|
|
23
24
|
const scene = new ThreeScene();
|
|
24
25
|
|
|
25
26
|
//lights
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
|
|
6
6
|
import Vector2 from '../../../core/geom/Vector2.js';
|
|
7
7
|
import { assert } from "../../../core/assert.js";
|
|
8
|
-
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
9
8
|
import { computeIntegerArrayHash } from "../../../core/primitives/array/computeIntegerArrayHash.js";
|
|
10
9
|
import { isArrayEqualStrict } from "../../../core/collection/array/isArrayEqualStrict.js";
|
|
11
10
|
import { computeHashIntegerArray } from "../../../core/collection/array/computeHashIntegerArray.js";
|
|
@@ -245,46 +244,3 @@ GridObstacle.typeName = "GridObstacle";
|
|
|
245
244
|
|
|
246
245
|
export default GridObstacle;
|
|
247
246
|
|
|
248
|
-
export class GridObstacleSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
249
|
-
constructor() {
|
|
250
|
-
super();
|
|
251
|
-
|
|
252
|
-
this.klass = GridObstacle;
|
|
253
|
-
this.version = 0;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
/**
|
|
257
|
-
*
|
|
258
|
-
* @param {BinaryBuffer} buffer
|
|
259
|
-
* @param {GridObstacle} value
|
|
260
|
-
*/
|
|
261
|
-
serialize(buffer, value) {
|
|
262
|
-
|
|
263
|
-
const w = value.size.x;
|
|
264
|
-
const h = value.size.y;
|
|
265
|
-
|
|
266
|
-
buffer.writeUint16(w);
|
|
267
|
-
buffer.writeUint16(h);
|
|
268
|
-
|
|
269
|
-
buffer.writeBytes(value.data, 0, w * h);
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
*
|
|
274
|
-
* @param {BinaryBuffer} buffer
|
|
275
|
-
* @param {GridObstacle} value
|
|
276
|
-
*/
|
|
277
|
-
deserialize(buffer, value) {
|
|
278
|
-
|
|
279
|
-
const x = buffer.readUint16();
|
|
280
|
-
const y = buffer.readUint16();
|
|
281
|
-
|
|
282
|
-
value.size.set(x, y);
|
|
283
|
-
|
|
284
|
-
const length = x * y;
|
|
285
|
-
|
|
286
|
-
value.data = new Uint8Array(length);
|
|
287
|
-
|
|
288
|
-
buffer.readBytes(value.data, 0, length);
|
|
289
|
-
}
|
|
290
|
-
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { BinaryClassSerializationAdapter } from "../../ecs/storage/binary/BinaryClassSerializationAdapter.js";
|
|
2
|
+
import GridObstacle from "./GridObstacle.js";
|
|
3
|
+
|
|
4
|
+
export class GridObstacleSerializationAdapter extends BinaryClassSerializationAdapter {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
|
|
8
|
+
this.klass = GridObstacle;
|
|
9
|
+
this.version = 0;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
*
|
|
14
|
+
* @param {BinaryBuffer} buffer
|
|
15
|
+
* @param {GridObstacle} value
|
|
16
|
+
*/
|
|
17
|
+
serialize(buffer, value) {
|
|
18
|
+
|
|
19
|
+
const w = value.size.x;
|
|
20
|
+
const h = value.size.y;
|
|
21
|
+
|
|
22
|
+
buffer.writeUint16(w);
|
|
23
|
+
buffer.writeUint16(h);
|
|
24
|
+
|
|
25
|
+
buffer.writeBytes(value.data, 0, w * h);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {BinaryBuffer} buffer
|
|
31
|
+
* @param {GridObstacle} value
|
|
32
|
+
*/
|
|
33
|
+
deserialize(buffer, value) {
|
|
34
|
+
|
|
35
|
+
const x = buffer.readUint16();
|
|
36
|
+
const y = buffer.readUint16();
|
|
37
|
+
|
|
38
|
+
value.size.set(x, y);
|
|
39
|
+
|
|
40
|
+
const length = x * y;
|
|
41
|
+
|
|
42
|
+
value.data = new Uint8Array(length);
|
|
43
|
+
|
|
44
|
+
buffer.readBytes(value.data, 0, length);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -66,7 +66,7 @@ export class StaticKnowledgeDatabase {
|
|
|
66
66
|
const existing = this.getDescriptorById(id);
|
|
67
67
|
if (existing !== undefined) {
|
|
68
68
|
|
|
69
|
-
if (existing.id === id && existing.source === path && existing.table
|
|
69
|
+
if (existing.id === id && existing.source === path && Object.getPrototypeOf(existing.table) === Object.getPrototypeOf(table)) {
|
|
70
70
|
// attempting to add the same thing
|
|
71
71
|
|
|
72
72
|
console.warn(`Attempting to ad the same table again, ignoring. id='${id}', path='${path}' (table prototype matching)`);
|
|
@@ -17,7 +17,9 @@ import { min2 } from "../../../../core/math/min2.js";
|
|
|
17
17
|
import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
|
|
18
18
|
import { InterpolationType } from "./InterpolationType.js";
|
|
19
19
|
import { v3_distance } from "../../../../core/geom/v3_distance.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
line3_computeSegmentPointDistance_sqr
|
|
22
|
+
} from "../../../../core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js";
|
|
21
23
|
|
|
22
24
|
const v3_a = new Vector3();
|
|
23
25
|
const v3_b = new Vector3();
|
|
@@ -262,6 +264,9 @@ class Path {
|
|
|
262
264
|
}
|
|
263
265
|
}
|
|
264
266
|
|
|
267
|
+
reverse() {
|
|
268
|
+
this.__data.reverse_rows();
|
|
269
|
+
}
|
|
265
270
|
|
|
266
271
|
/**
|
|
267
272
|
*
|
|
@@ -77,10 +77,12 @@ pNoTreasureIn3.addRule(0, 0, CellMatcherNot.from(CellMatcherContainsMarkerWithin
|
|
|
77
77
|
)));
|
|
78
78
|
|
|
79
79
|
const chestPlacementRule = GridCellPlacementRule.from({
|
|
80
|
-
matcher: CellMatcherAnd.from(pTreasureCorner, pNoTreasureIn3),
|
|
80
|
+
matcher: CellMatcherAnd.from(pTreasureCorner, pNoTreasureIn3),
|
|
81
|
+
action: GridCellActionSequence.from([
|
|
81
82
|
GridCellActionPlaceMarker.from({ type: 'Treasure', size: 0.5 }),
|
|
82
83
|
GridCellActionPlaceTags.from(GridTags.Treasure, MirGridLayers.Tags)
|
|
83
|
-
],
|
|
84
|
+
]),
|
|
85
|
+
probability: CellFilterLiteralFloat.from(0.5)
|
|
84
86
|
});
|
|
85
87
|
|
|
86
88
|
|
|
@@ -177,10 +179,11 @@ const ACTION_PLACE_ENEMY_TAG = GridCellActionPlaceTags.from(GridTags.Enemy | Gri
|
|
|
177
179
|
|
|
178
180
|
const prTreasureGuards = GridCellPlacementRule.from(
|
|
179
181
|
{
|
|
180
|
-
matcher: pNearTreasure,
|
|
182
|
+
matcher: pNearTreasure,
|
|
183
|
+
action: GridCellActionSequence.from([
|
|
181
184
|
ACTION_PLACE_ENEMY_MARKER,
|
|
182
185
|
ACTION_PLACE_ENEMY_TAG
|
|
183
|
-
]
|
|
186
|
+
])
|
|
184
187
|
}
|
|
185
188
|
);
|
|
186
189
|
|
|
@@ -194,10 +197,11 @@ const prEnemyTreasureGuard = GridCellPlacementRule.from(
|
|
|
194
197
|
matcher: CellMatcherAnd.from(
|
|
195
198
|
pNearTreasure,
|
|
196
199
|
pNoEnemyIn3
|
|
197
|
-
),
|
|
200
|
+
),
|
|
201
|
+
action: GridCellActionSequence.from([
|
|
198
202
|
ACTION_PLACE_ENEMY_MARKER,
|
|
199
203
|
ACTION_PLACE_ENEMY_TAG
|
|
200
|
-
]
|
|
204
|
+
])
|
|
201
205
|
}
|
|
202
206
|
);
|
|
203
207
|
|
|
@@ -207,10 +211,11 @@ const prEnemyCorridorGuard = GridCellPlacementRule.from(
|
|
|
207
211
|
matcher: CellMatcherAnd.from(
|
|
208
212
|
mir_matcher_attack_corridor,
|
|
209
213
|
pNoEnemyIn3
|
|
210
|
-
),
|
|
214
|
+
),
|
|
215
|
+
action: GridCellActionSequence.from([
|
|
211
216
|
ACTION_PLACE_ENEMY_MARKER,
|
|
212
217
|
ACTION_PLACE_ENEMY_TAG
|
|
213
|
-
],
|
|
218
|
+
]),
|
|
214
219
|
probability: CellFilterLiteralFloat.from(0.5)
|
|
215
220
|
}
|
|
216
221
|
);
|
|
@@ -264,7 +269,7 @@ const gDrawLayerMoisture = GridTaskActionRuleSet.from({
|
|
|
264
269
|
GridCellPlacementRule.from(
|
|
265
270
|
{
|
|
266
271
|
matcher: CellMatcherAny.INSTANCE,
|
|
267
|
-
|
|
272
|
+
action: GridCellActionWriteFilterToLayer.from(MirGridLayers.Moisture, SampleGroundMoistureFilter)
|
|
268
273
|
}
|
|
269
274
|
)
|
|
270
275
|
]
|
|
@@ -494,32 +499,31 @@ const gHeights = GridTaskActionRuleSet.from({
|
|
|
494
499
|
rules: [
|
|
495
500
|
GridCellPlacementRule.from(
|
|
496
501
|
{
|
|
497
|
-
matcher: CellMatcherAny.INSTANCE,
|
|
498
|
-
|
|
499
|
-
|
|
502
|
+
matcher: CellMatcherAny.INSTANCE,
|
|
503
|
+
actions: GridCellActionWriteFilterToLayer.from(
|
|
504
|
+
MirGridLayers.Heights,
|
|
500
505
|
|
|
506
|
+
CellFilterLerp.from(
|
|
507
|
+
CellFilterLiteralFloat.from(0),
|
|
501
508
|
CellFilterLerp.from(
|
|
502
|
-
CellFilterLiteralFloat.from(
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
+
CellFilterLiteralFloat.from(-2),
|
|
510
|
+
CellFilterLiteralFloat.from(7),
|
|
511
|
+
CellFilterMultiply.from(
|
|
512
|
+
CellFilterSimplexNoise.from(30, 30),
|
|
513
|
+
CellFilterSimplexNoise.from(13, 13)
|
|
514
|
+
)
|
|
515
|
+
),
|
|
516
|
+
CellFilterGaussianBlur.from(
|
|
517
|
+
CellFilterCache.from(
|
|
518
|
+
CellFilterCellMatcher.from(
|
|
519
|
+
mHeightArea
|
|
509
520
|
)
|
|
510
521
|
),
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
CellFilterCellMatcher.from(
|
|
514
|
-
mHeightArea
|
|
515
|
-
)
|
|
516
|
-
),
|
|
517
|
-
1.5,
|
|
518
|
-
1.5
|
|
519
|
-
)
|
|
522
|
+
1.5,
|
|
523
|
+
1.5
|
|
520
524
|
)
|
|
521
525
|
)
|
|
522
|
-
|
|
526
|
+
)
|
|
523
527
|
}
|
|
524
528
|
)
|
|
525
529
|
]
|
|
@@ -23,6 +23,7 @@ import { MirMarkerTypes } from "../../../../../generator/MirMarkerTypes.js";
|
|
|
23
23
|
import { GridPatternMatcherCell } from "../../../rules/cell/GridPatternMatcherCell.js";
|
|
24
24
|
import { BuffObjectTypes } from "../../../../../../generator/BuffObjectTypes.js";
|
|
25
25
|
import { UnlockableElementsManager } from "../../../../../../model/unlocks/UnlockableElementsManager.js";
|
|
26
|
+
import { GridCellActionSequence } from "../../../placement/action/util/GridCellActionSequence.js";
|
|
26
27
|
|
|
27
28
|
const TAG_MAJOR = 'Major Buff';
|
|
28
29
|
const TAG_MINOR = 'Minor Buff';
|
|
@@ -112,7 +113,7 @@ function makeMajorRule(tag) {
|
|
|
112
113
|
)
|
|
113
114
|
)
|
|
114
115
|
),
|
|
115
|
-
|
|
116
|
+
action: GridCellActionSequence.from([
|
|
116
117
|
placeTags,
|
|
117
118
|
clearTags,
|
|
118
119
|
GridCellActionPlaceMarker.from({
|
|
@@ -121,7 +122,7 @@ function makeMajorRule(tag) {
|
|
|
121
122
|
tags: [MirMarkerTypes.BuffObject, TAG_MAJOR]
|
|
122
123
|
}),
|
|
123
124
|
placeRoadMarkers
|
|
124
|
-
],
|
|
125
|
+
]),
|
|
125
126
|
probability: CellFilterLiteralFloat.from(0.1)
|
|
126
127
|
});
|
|
127
128
|
}
|
|
@@ -151,7 +152,7 @@ function makeMinorRule(tag) {
|
|
|
151
152
|
)
|
|
152
153
|
)
|
|
153
154
|
),
|
|
154
|
-
|
|
155
|
+
action: GridCellActionSequence.from([
|
|
155
156
|
placeTags,
|
|
156
157
|
clearTags,
|
|
157
158
|
GridCellActionPlaceMarker.from({
|
|
@@ -159,7 +160,7 @@ function makeMinorRule(tag) {
|
|
|
159
160
|
size: 0.52,
|
|
160
161
|
tags: [MirMarkerTypes.BuffObject, TAG_MINOR]
|
|
161
162
|
})
|
|
162
|
-
],
|
|
163
|
+
]),
|
|
163
164
|
probability: CellFilterLiteralFloat.from(0.1)
|
|
164
165
|
});
|
|
165
166
|
}
|
|
@@ -185,7 +186,7 @@ function makeUtilityRule(tag, frequency = 17) {
|
|
|
185
186
|
)
|
|
186
187
|
)
|
|
187
188
|
),
|
|
188
|
-
|
|
189
|
+
action: GridCellActionSequence.from([
|
|
189
190
|
placeTags,
|
|
190
191
|
clearTags,
|
|
191
192
|
GridCellActionPlaceMarker.from({
|
|
@@ -193,7 +194,7 @@ function makeUtilityRule(tag, frequency = 17) {
|
|
|
193
194
|
size: 0.52,
|
|
194
195
|
tags: [MirMarkerTypes.BuffObject, TAG_UTILITY]
|
|
195
196
|
})
|
|
196
|
-
],
|
|
197
|
+
]),
|
|
197
198
|
probability: CellFilterLiteralFloat.from(0.1)
|
|
198
199
|
});
|
|
199
200
|
}
|
|
@@ -21,9 +21,12 @@ import { MarkerNodeMatcherAny } from "../../markers/matcher/MarkerNodeMatcherAny
|
|
|
21
21
|
import { MarkerNodeEmitterFromAction } from "../../markers/emitter/MarkerNodeEmitterFromAction.js";
|
|
22
22
|
import { Transform } from "../../../engine/ecs/transform/Transform.js";
|
|
23
23
|
import { MarkerNodeTransformerOffsetPosition } from "../../markers/transform/MarkerNodeTransformerOffsetPosition.js";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
MarkerNodeTransformerRecordUniqueRandomEnum
|
|
26
|
+
} from "../../markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js";
|
|
25
27
|
import { MirMarkerTypes } from "../../../../generator/MirMarkerTypes.js";
|
|
26
28
|
import { MirMarkerTags } from "../../../../generator/MirMarkerTags.js";
|
|
29
|
+
import { GridCellActionSequence } from "../../placement/action/util/GridCellActionSequence.js";
|
|
27
30
|
|
|
28
31
|
const pMatcher = new CellMatcherGridPattern();
|
|
29
32
|
|
|
@@ -79,7 +82,7 @@ for (let i = 0; i < 100; i++) {
|
|
|
79
82
|
|
|
80
83
|
const rule = GridCellPlacementRule.from({
|
|
81
84
|
matcher: pMatcher,
|
|
82
|
-
|
|
85
|
+
action: GridCellActionSequence.from([
|
|
83
86
|
placeTags,
|
|
84
87
|
clearTags,
|
|
85
88
|
MarkerNodeEmitterGridCellAction.from(
|
|
@@ -134,7 +137,8 @@ const rule = GridCellPlacementRule.from({
|
|
|
134
137
|
})
|
|
135
138
|
),
|
|
136
139
|
placeRoadConnectors
|
|
137
|
-
],
|
|
140
|
+
]),
|
|
141
|
+
probability: CellFilterLiteralFloat.from(0.1)
|
|
138
142
|
});
|
|
139
143
|
|
|
140
144
|
rule.allowRotation = false;
|