@woosh/meep-engine 2.57.0 → 2.59.0
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/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/build/meep.cjs +14789 -19638
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +14790 -19638
- package/editor/Editor.js +4 -4
- package/editor/process/symbolic/buildThreeJSHelperEntity.js +3 -3
- package/editor/process/symbolic/makeGridPositionSymbolDisplay.js +3 -3
- package/editor/process/symbolic/makePositionedIconDisplaySymbol.js +3 -3
- package/editor/tools/v2/prototypeTransformControls.js +3 -3
- package/editor/view/ecs/ComponentControlView.js +2 -1
- package/package.json +2 -2
- package/samples/generation/main.js +2 -2
- package/samples/terrain/from_image.js +2 -2
- package/samples/terrain/from_image_2.js +4 -4
- package/src/core/binary/byteArrayToString.js +28 -0
- package/src/core/binary/downloadAsFile.js +28 -0
- package/src/core/binary/downloadUrlAsFile.js +14 -0
- package/src/core/binary/jsonToStringToByteArray.js +27 -0
- package/src/core/binary/stringToByteArray.js +24 -0
- package/src/core/bvh2/BinaryNode.spec.js +2 -1
- package/src/core/color/Color.spec.js +27 -1
- package/src/core/color/parse_color.js +1 -1
- package/src/core/fsm/simple/SimpleStateMachine.spec.js +34 -2
- package/src/core/geom/3d/matrix/m4_multiply.js +2 -2
- package/src/core/geom/3d/matrix/m4_multiply.spec.js +11 -0
- package/src/core/geom/3d/matrix/m4_multiply_alphatensor.spec.js +11 -0
- package/src/core/geom/3d/morton/split_by_2.js +1 -1
- package/src/core/geom/3d/shape/util/shape_to_visual_entity.js +10 -10
- package/src/core/geom/3d/tetrahedra/prototypeTetrahedraBuilder.js +2 -2
- package/src/core/geom/3d/topology/samples/sampleFloodFill.js +3 -3
- package/src/core/process/action/AsynchronousDelayAction.js +2 -2
- package/src/core/process/executor/profile/ConcurrentExecutorProfiler.js +1 -1
- package/src/engine/EngineHarness.js +7 -7
- package/src/engine/EntityCreator.js +5 -5
- package/src/engine/__module.js +1 -1
- package/src/engine/achievements/AchievementManager.js +2 -2
- package/src/engine/animation/AnimationUtils.js +4 -4
- package/src/engine/animation/behavior/animateProperty.js +2 -2
- package/src/engine/animation/curve/draw/build_plot_entity_from_array.js +3 -3
- package/src/engine/animation/playAnimationTrack.js +3 -3
- package/src/engine/animation/playTrackRealTime.js +3 -3
- package/src/engine/animation/removeEntityWithMeshParticlesEffect.js +2 -2
- package/src/engine/control/ControlContext.js +7 -7
- package/src/engine/ecs/{EntityBuilder.d.ts → Entity.d.ts} +5 -5
- package/src/engine/ecs/{EntityBuilder.js → Entity.js} +29 -29
- package/src/engine/ecs/{EntityBuilder.spec.js → Entity.spec.js} +17 -17
- package/src/engine/ecs/EntityBlueprint.d.ts +2 -2
- package/src/engine/ecs/EntityBlueprint.js +3 -3
- package/src/engine/ecs/EntityBlueprint.spec.js +2 -2
- package/src/engine/ecs/{EntityBuilderFlags.js → EntityFlags.js} +1 -1
- package/src/engine/ecs/EntityObserver.spec.js +8 -8
- package/src/engine/ecs/dynamic_actions/DynamicActorSystem.js +5 -5
- package/src/engine/ecs/foliage/ecs/InstancedMeshUtils.js +3 -3
- package/src/engine/ecs/gui/menu/radial/RadialContextMenu.d.ts +2 -2
- package/src/engine/ecs/gui/menu/radial/RadialContextMenu.js +5 -5
- package/src/engine/ecs/parent/EntityNode.d.ts +3 -3
- package/src/engine/ecs/parent/EntityNode.js +5 -5
- package/src/engine/ecs/parent/testHuDPerf.js +2 -2
- package/src/engine/ecs/speaker/VoiceSystem.js +5 -5
- package/src/engine/ecs/tooltip/testTooltipComponentSystem.js +3 -3
- package/src/engine/graphics/camera/makeOrbitalCameraController.js +3 -3
- package/src/engine/graphics/camera/testClippingPlaneComputation.js +3 -3
- package/src/engine/graphics/debug/createDebugLabel.js +3 -3
- package/src/engine/graphics/ecs/camera/filter/setup_filtered_camera_controller.js +3 -3
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalEditor.js +3 -3
- package/src/engine/graphics/ecs/decal/v2/prototypeDecalSystem.js +14 -14
- package/src/engine/graphics/ecs/mesh-v2/aggregate/prototypeSGMesh.js +3 -3
- package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +5 -5
- package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +6 -6
- package/src/engine/graphics/ecs/path/ribbon/RibbonPathBuilder.js +3 -3
- package/src/engine/graphics/ecs/path/testPathDisplaySystem.js +3 -3
- package/src/engine/graphics/ecs/path/tube/build/TubePathBuilder.js +3 -3
- package/src/engine/graphics/ecs/path/tube/prototypeAnimatedPathMask.js +3 -3
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +2 -2
- package/src/engine/graphics/ecs/sprite/prototypeSpriteSystem.js +2 -2
- package/src/engine/graphics/geometry/optimization/merge/prototypeGeometryMerge.js +4 -4
- package/src/engine/graphics/impostors/octahedral/prototypeBaker.js +7 -7
- package/src/engine/graphics/particles/node-based/editor/ParticleSpecificationEditorView.js +1 -1
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +2 -2
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.d.ts +2 -2
- package/src/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +3 -3
- package/src/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +10 -10
- package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/src/engine/graphics/render/buffer/simple-fx/taa/prototypeTAA.js +2 -2
- package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +11 -11
- package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +5 -5
- package/src/engine/graphics/sh3/LightProbeVolume.js +2 -2
- package/src/engine/graphics/sh3/prototypeSH3Probe.js +3 -3
- package/src/engine/graphics/sh3/visualise_probe.js +3 -3
- package/src/engine/graphics/shadows/testShadowMapRendering.js +3 -3
- package/src/engine/graphics/texture/sampler/downloadSamplerAsPNG.js +1 -1
- package/src/engine/graphics/texture/sprite/prototypeSpriteCutoutGeometry.js +2 -2
- package/src/engine/input/ecs/controllers/KeyboardCameraController.js +2 -2
- package/src/engine/input/ecs/util/TopDownCameraControllerHelper.js +2 -2
- package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +13 -12
- package/src/engine/physics/fluid/prototype.js +3 -3
- package/src/engine/save/storage/JsonStringCodec.js +1 -1
- package/src/engine/save/storage/LocalStorage.js +2 -1
- package/src/engine/ui/GUIEngine.js +4 -4
- package/src/engine/ui/notification/NotificationManager.js +3 -3
- package/src/generation/markers/debug/visualizeMarkers.js +2 -2
- package/src/generation/markers/prototypeGridCellActionPlaceMarker.js +2 -2
- package/src/core/binary/ByteArrayTools.js +0 -137
- package/src/core/binary/NaiveBitSet.js +0 -69
- package/src/core/binary/objects/StandardTypeBuilder.js +0 -126
- package/src/core/binary/serde/JsonSerializer.js +0 -113
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EngineHarness } from "../../../../../EngineHarness.js";
|
|
2
|
-
import
|
|
2
|
+
import Entity from "../../../../../ecs/Entity.js";
|
|
3
3
|
import { Transform } from "../../../../../ecs/transform/Transform.js";
|
|
4
4
|
import { ShadedGeometry } from "../../../../ecs/mesh-v2/ShadedGeometry.js";
|
|
5
5
|
import { BoxBufferGeometry, MeshStandardMaterial } from "three";
|
|
@@ -29,7 +29,7 @@ async function main(engine) {
|
|
|
29
29
|
|
|
30
30
|
for (let i = 0; i < 5; i++) {
|
|
31
31
|
for (let j = 0; j < 5; j++) {
|
|
32
|
-
const entityBuilder = new
|
|
32
|
+
const entityBuilder = new Entity();
|
|
33
33
|
|
|
34
34
|
if (random() > 0.5) {
|
|
35
35
|
entityBuilder.add(Highlight.fromOne(random(), random(), random()));
|
|
@@ -54,7 +54,7 @@ import { makeEngineOptionsModel } from "../../../../../../../model/game/options/
|
|
|
54
54
|
import { enableEditor } from "../../../../../../editor/enableEditor.js";
|
|
55
55
|
import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
56
56
|
import Vector3 from "../../../../../core/geom/Vector3.js";
|
|
57
|
-
import
|
|
57
|
+
import Entity from "../../../../ecs/Entity.js";
|
|
58
58
|
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
59
59
|
import Mesh from "../../../ecs/mesh/Mesh.js";
|
|
60
60
|
import { ForwardPlusRenderingPlugin } from "./ForwardPlusRenderingPlugin.js";
|
|
@@ -230,7 +230,7 @@ function makeLight(position, radius, color, intensity = 1) {
|
|
|
230
230
|
const renderable = new Renderable(visual_group);
|
|
231
231
|
renderable.matrixAutoUpdate = true;
|
|
232
232
|
|
|
233
|
-
return new
|
|
233
|
+
return new Entity()
|
|
234
234
|
.add(Transform.fromJSON({
|
|
235
235
|
position: {
|
|
236
236
|
x: position[0],
|
|
@@ -260,7 +260,7 @@ function setup_scene_0(engine, ecd) {
|
|
|
260
260
|
key_light_transform.position.set(10, 10, 0);
|
|
261
261
|
key_light_transform.lookAt(new Vector3(0, 0, 0));
|
|
262
262
|
|
|
263
|
-
new
|
|
263
|
+
new Entity()
|
|
264
264
|
.add(light_key)
|
|
265
265
|
.add(key_light_transform)
|
|
266
266
|
.build(ecd);
|
|
@@ -350,7 +350,7 @@ function setup_scene_0(engine, ecd) {
|
|
|
350
350
|
.build(ecd);
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
new
|
|
353
|
+
new Entity()
|
|
354
354
|
.add(ParticleEmitter.fromJSON({
|
|
355
355
|
"parameters": [
|
|
356
356
|
{
|
|
@@ -515,7 +515,7 @@ function setup_scene_0(engine, ecd) {
|
|
|
515
515
|
}
|
|
516
516
|
|
|
517
517
|
|
|
518
|
-
new
|
|
518
|
+
new Entity()
|
|
519
519
|
.add(Transform.fromJSON({
|
|
520
520
|
position: offset,
|
|
521
521
|
scale: {
|
|
@@ -563,7 +563,7 @@ function setup_scene_3(engine, ecd) {
|
|
|
563
563
|
fill_light_transform.position.set(40, 15, 30);
|
|
564
564
|
fill_light_transform.lookAt(new Vector3(30, 0, 20));
|
|
565
565
|
|
|
566
|
-
new
|
|
566
|
+
new Entity()
|
|
567
567
|
.add(light_fill)
|
|
568
568
|
.add(fill_light_transform)
|
|
569
569
|
.build(ecd);
|
|
@@ -662,7 +662,7 @@ function setup_scene_3(engine, ecd) {
|
|
|
662
662
|
.build(ecd);
|
|
663
663
|
}
|
|
664
664
|
|
|
665
|
-
new
|
|
665
|
+
new Entity()
|
|
666
666
|
.add(ParticleEmitter.fromJSON({
|
|
667
667
|
"parameters": [
|
|
668
668
|
{
|
|
@@ -836,7 +836,7 @@ function setup_scene_3(engine, ecd) {
|
|
|
836
836
|
}
|
|
837
837
|
|
|
838
838
|
|
|
839
|
-
new
|
|
839
|
+
new Entity()
|
|
840
840
|
.add(Transform.fromJSON({
|
|
841
841
|
position: offset,
|
|
842
842
|
scale: {
|
|
@@ -877,7 +877,7 @@ function setup_scene_3(engine, ecd) {
|
|
|
877
877
|
continue;
|
|
878
878
|
}
|
|
879
879
|
|
|
880
|
-
new
|
|
880
|
+
new Entity()
|
|
881
881
|
.add(Transform.fromJSON({
|
|
882
882
|
position: p,
|
|
883
883
|
scale: {
|
|
@@ -983,7 +983,7 @@ function setup_scene_2(engine, ecd) {
|
|
|
983
983
|
}
|
|
984
984
|
|
|
985
985
|
|
|
986
|
-
new
|
|
986
|
+
new Entity()
|
|
987
987
|
.add(Transform.fromJSON({
|
|
988
988
|
position: offset,
|
|
989
989
|
scale: {
|
|
@@ -1095,7 +1095,7 @@ function makeKnot(engine, position, scale, rotation) {
|
|
|
1095
1095
|
|
|
1096
1096
|
transform.scale.multiplyScalar(scale);
|
|
1097
1097
|
|
|
1098
|
-
return new
|
|
1098
|
+
return new Entity()
|
|
1099
1099
|
.add(new Renderable(mesh))
|
|
1100
1100
|
.add(transform);
|
|
1101
1101
|
}
|
|
@@ -43,7 +43,7 @@ import Vector2 from "../../../../../core/geom/Vector2.js";
|
|
|
43
43
|
import RenderSystem from "../../../../ecs/systems/RenderSystem.js";
|
|
44
44
|
import { makeEngineOptionsModel } from "../../../../../../../model/game/options/makeEngineOptionsModel.js";
|
|
45
45
|
import { enableEditor } from "../../../../../../editor/enableEditor.js";
|
|
46
|
-
import
|
|
46
|
+
import Entity from "../../../../ecs/Entity.js";
|
|
47
47
|
import { Transform } from "../../../../ecs/transform/Transform.js";
|
|
48
48
|
import Mesh from "../../../ecs/mesh/Mesh.js";
|
|
49
49
|
import { PathDisplaySystem } from "../../../ecs/path/PathDisplaySystem.js";
|
|
@@ -207,7 +207,7 @@ function prepare_query_test(hiz, graphics, ecd) {
|
|
|
207
207
|
|
|
208
208
|
/**
|
|
209
209
|
*
|
|
210
|
-
* @type {
|
|
210
|
+
* @type {Entity[]}
|
|
211
211
|
*/
|
|
212
212
|
const entities = [];
|
|
213
213
|
const labels = [];
|
|
@@ -262,7 +262,7 @@ function prepare_query_test(hiz, graphics, ecd) {
|
|
|
262
262
|
|
|
263
263
|
labels[i] = v;
|
|
264
264
|
|
|
265
|
-
const entityBuilder = new
|
|
265
|
+
const entityBuilder = new Entity();
|
|
266
266
|
|
|
267
267
|
entities[i] = entityBuilder;
|
|
268
268
|
|
|
@@ -327,7 +327,7 @@ function prepare_query_test(hiz, graphics, ecd) {
|
|
|
327
327
|
});
|
|
328
328
|
|
|
329
329
|
|
|
330
|
-
new
|
|
330
|
+
new Entity()
|
|
331
331
|
.add(ViewportPosition.fromJSON({
|
|
332
332
|
offset: new Vector2(10, 276)
|
|
333
333
|
}))
|
|
@@ -426,7 +426,7 @@ function main(engine) {
|
|
|
426
426
|
|
|
427
427
|
prepare_query_test(hiz, graphics, ecd);
|
|
428
428
|
|
|
429
|
-
new
|
|
429
|
+
new Entity()
|
|
430
430
|
.add(ViewportPosition.fromJSON({
|
|
431
431
|
offset: new Vector2(10, 10)
|
|
432
432
|
}))
|
|
@@ -6,7 +6,7 @@ import { visualise_probe } from "./visualise_probe.js";
|
|
|
6
6
|
import {
|
|
7
7
|
build_tetrahedral_mesh_buffer_geometry
|
|
8
8
|
} from "../../../core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js";
|
|
9
|
-
import
|
|
9
|
+
import Entity from "../../ecs/Entity.js";
|
|
10
10
|
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
11
11
|
import {
|
|
12
12
|
CubeCamera,
|
|
@@ -571,7 +571,7 @@ export class LightProbeVolume {
|
|
|
571
571
|
sg.clearFlag(ShadedGeometryFlags.CastShadow);
|
|
572
572
|
sg.clearFlag(ShadedGeometryFlags.ReceiveShadow);
|
|
573
573
|
|
|
574
|
-
new
|
|
574
|
+
new Entity()
|
|
575
575
|
.add(sg)
|
|
576
576
|
.add(new Transform())
|
|
577
577
|
.build(ecd);
|
|
@@ -3,7 +3,7 @@ import { seededRandom } from "../../../core/math/random/seededRandom.js";
|
|
|
3
3
|
import { ShadedGeometrySystem } from "../ecs/mesh-v2/ShadedGeometrySystem.js";
|
|
4
4
|
import { GizmoRenderingPlugin } from "../render/gizmo/GizmoRenderingPlugin.js";
|
|
5
5
|
import { LightProbeVolume } from "./LightProbeVolume.js";
|
|
6
|
-
import
|
|
6
|
+
import Entity from "../../ecs/Entity.js";
|
|
7
7
|
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
8
8
|
import {
|
|
9
9
|
ClampToEdgeWrapping,
|
|
@@ -123,7 +123,7 @@ function make_plane({
|
|
|
123
123
|
sg.writeFlag(ShadedGeometryFlags.CastShadow, shadow);
|
|
124
124
|
sg.writeFlag(ShadedGeometryFlags.ReceiveShadow, shadow);
|
|
125
125
|
|
|
126
|
-
return new
|
|
126
|
+
return new Entity()
|
|
127
127
|
.add(sg)
|
|
128
128
|
.add(t1);
|
|
129
129
|
|
|
@@ -320,7 +320,7 @@ async function main(engine) {
|
|
|
320
320
|
|
|
321
321
|
for (let i = 0; i < 16; i++) {
|
|
322
322
|
|
|
323
|
-
new
|
|
323
|
+
new Entity()
|
|
324
324
|
.add(Transform.fromJSON({
|
|
325
325
|
position: {
|
|
326
326
|
x: randomFloatBetween(random, mesh_asset.boundingBox.x0, mesh_asset.boundingBox.x1),
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SH3VisualisationMaterial } from "./SH3VisualisationMaterial.js";
|
|
2
|
-
import
|
|
2
|
+
import Entity from "../../ecs/Entity.js";
|
|
3
3
|
import { Transform } from "../../ecs/transform/Transform.js";
|
|
4
4
|
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
5
5
|
import { OctahedronBufferGeometry } from "three";
|
|
@@ -12,7 +12,7 @@ import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
|
12
12
|
* @param position_offset
|
|
13
13
|
* @param sh
|
|
14
14
|
* @param sh_offset
|
|
15
|
-
* @return {
|
|
15
|
+
* @return {Entity}
|
|
16
16
|
*/
|
|
17
17
|
export function visualise_probe({ size = 1,shadow=false, position, position_offset = 0, sh, sh_offset = 0 }) {
|
|
18
18
|
|
|
@@ -27,7 +27,7 @@ export function visualise_probe({ size = 1,shadow=false, position, position_offs
|
|
|
27
27
|
shadedGeometry.writeFlag(ShadedGeometryFlags.ReceiveShadow,shadow);
|
|
28
28
|
shadedGeometry.writeFlag(ShadedGeometryFlags.CastShadow,shadow);
|
|
29
29
|
|
|
30
|
-
return new
|
|
30
|
+
return new Entity()
|
|
31
31
|
.add(Transform.fromJSON({
|
|
32
32
|
position: {
|
|
33
33
|
x: position[position_offset],
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
import WaterSystem from "../ecs/water/WaterSystem.js";
|
|
34
34
|
import Army from "../../../../../model/game/ecs/component/army/Army.js";
|
|
35
35
|
import Mesh from "../ecs/mesh/Mesh.js";
|
|
36
|
-
import
|
|
36
|
+
import Entity from "../../ecs/Entity.js";
|
|
37
37
|
import { buildCanvasViewFromTexture } from "../render/visibility/hiz/buildCanvasViewFromTexture.js";
|
|
38
38
|
import ViewportPosition from "../../ecs/gui/position/ViewportPosition.js";
|
|
39
39
|
import Vector2 from "../../../core/geom/Vector2.js";
|
|
@@ -143,7 +143,7 @@ function init_shadowmap_preview(engine) {
|
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
|
|
146
|
-
new
|
|
146
|
+
new Entity()
|
|
147
147
|
.add(ViewportPosition.fromJSON({
|
|
148
148
|
offset: new Vector2(10, 10)
|
|
149
149
|
}))
|
|
@@ -165,7 +165,7 @@ async function main(engine) {
|
|
|
165
165
|
|
|
166
166
|
const character = ecd.getAnyComponent(Army);
|
|
167
167
|
|
|
168
|
-
const entity =
|
|
168
|
+
const entity = Entity.readFromDataset(character.entity, ecd);
|
|
169
169
|
|
|
170
170
|
entity.getComponent(Mesh).url = "data/models/Conqueror Mech/Conqueror Mech.gltf";
|
|
171
171
|
|
|
@@ -2,7 +2,7 @@ import { EngineHarness } from "../../../EngineHarness.js";
|
|
|
2
2
|
import GUIElementSystem from "../../../ecs/gui/GUIElementSystem.js";
|
|
3
3
|
import { ImageRGBADataLoader } from "../../../asset/loaders/image/ImageRGBADataLoader.js";
|
|
4
4
|
import EmptyView from "../../../../view/elements/EmptyView.js";
|
|
5
|
-
import
|
|
5
|
+
import Entity from "../../../ecs/Entity.js";
|
|
6
6
|
import GUIElement from "../../../ecs/gui/GUIElement.js";
|
|
7
7
|
import ViewportPositionSystem from "../../../ecs/gui/position/ViewportPositionSystem.js";
|
|
8
8
|
import { CanvasView } from "../../../../view/elements/CanvasView.js";
|
|
@@ -193,7 +193,7 @@ async function main(engine) {
|
|
|
193
193
|
|
|
194
194
|
vContainer.addChild(vOptimalPoly);
|
|
195
195
|
|
|
196
|
-
new
|
|
196
|
+
new Entity()
|
|
197
197
|
.add(GUIElement.fromView(vContainer))
|
|
198
198
|
.add(new ViewportPosition({
|
|
199
199
|
offset: new Vector2(100, 100)
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import Vector2 from '../../../../core/geom/Vector2.js';
|
|
7
7
|
import Script from '../../../ecs/components/Script.js';
|
|
8
|
-
import
|
|
8
|
+
import Entity from '../../../ecs/Entity.js';
|
|
9
9
|
import InputController from '../components/InputController.js';
|
|
10
10
|
import { assert } from "../../../../core/assert.js";
|
|
11
11
|
import { Tag } from "../../../ecs/components/Tag.js";
|
|
@@ -105,7 +105,7 @@ class KeyboardCameraController {
|
|
|
105
105
|
controller.target.add(v3);
|
|
106
106
|
});
|
|
107
107
|
|
|
108
|
-
const builder = new
|
|
108
|
+
const builder = new Entity();
|
|
109
109
|
|
|
110
110
|
this.builder = builder
|
|
111
111
|
.add(inputController)
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { Transform } from '../../../ecs/transform/Transform.js';
|
|
5
5
|
import Renderable from '../../../ecs/renderable/Renderable.js';
|
|
6
6
|
import Vector3 from '../../../../core/geom/Vector3.js';
|
|
7
|
-
import
|
|
7
|
+
import Entity from '../../../ecs/Entity.js';
|
|
8
8
|
import { Group as ThreeGroup, Matrix4 as ThreeMatrix4, Mesh as ThreeMesh, MeshLambertMaterial } from 'three';
|
|
9
9
|
|
|
10
10
|
|
|
@@ -62,7 +62,7 @@ const TopDownCameraControllerHelper = function (targetController, targetTransfor
|
|
|
62
62
|
group.add(tMarkerTo);
|
|
63
63
|
|
|
64
64
|
|
|
65
|
-
const builder = new
|
|
65
|
+
const builder = new Entity();
|
|
66
66
|
const transform = new Transform();
|
|
67
67
|
builder.add(new Renderable(group))
|
|
68
68
|
.add(transform);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import {ParallelBehavior, ParallelBehaviorPolicy} from "./ParallelBehavior.js";
|
|
2
|
+
import {SucceedingBehavior} from "../primitive/SucceedingBehavior.js";
|
|
3
|
+
import {BehaviorStatus} from "../BehaviorStatus.js";
|
|
4
|
+
import {FailingBehavior} from "../primitive/FailingBehavior.js";
|
|
5
|
+
import {jest} from '@jest/globals';
|
|
6
|
+
import {RepeatBehavior} from "../decorator/RepeatBehavior.js";
|
|
6
7
|
|
|
7
8
|
test("constructor doesn't throw", () => {
|
|
8
9
|
new ParallelBehavior(ParallelBehaviorPolicy.RequireAll, ParallelBehaviorPolicy.RequireAll);
|
|
@@ -33,11 +34,11 @@ test("1 succeeding child", () => {
|
|
|
33
34
|
test("1 succeeding child, 1 tick delay", () => {
|
|
34
35
|
const p = new ParallelBehavior(ParallelBehaviorPolicy.RequireAll, ParallelBehaviorPolicy.RequireOne);
|
|
35
36
|
|
|
36
|
-
const b =
|
|
37
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
37
38
|
|
|
38
|
-
b.tick = jest.fn(b.tick);
|
|
39
|
-
b.initialize = jest.fn(b.initialize);
|
|
40
|
-
b.finalize = jest.fn(b.finalize);
|
|
39
|
+
b.tick = jest.fn(b.tick.bind(b));
|
|
40
|
+
b.initialize = jest.fn(b.initialize.bind(b));
|
|
41
|
+
b.finalize = jest.fn(b.finalize.bind(b));
|
|
41
42
|
|
|
42
43
|
p.addChild(b);
|
|
43
44
|
|
|
@@ -105,7 +106,7 @@ test("policy success-One, failure-One. Succeeding", () => {
|
|
|
105
106
|
|
|
106
107
|
p.addChild(a);
|
|
107
108
|
|
|
108
|
-
const b =
|
|
109
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
109
110
|
|
|
110
111
|
p.addChild(b);
|
|
111
112
|
|
|
@@ -121,7 +122,7 @@ test("policy success-All, failure-One. Succeeding", () => {
|
|
|
121
122
|
|
|
122
123
|
p.addChild(a);
|
|
123
124
|
|
|
124
|
-
const b =
|
|
125
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
125
126
|
|
|
126
127
|
p.addChild(b);
|
|
127
128
|
|
|
@@ -138,7 +139,7 @@ test("policy success-One, failure-One. Failing", () => {
|
|
|
138
139
|
|
|
139
140
|
p.addChild(a);
|
|
140
141
|
|
|
141
|
-
const b =
|
|
142
|
+
const b = RepeatBehavior.from(SucceedingBehavior.INSTANCE, 2);
|
|
142
143
|
|
|
143
144
|
p.addChild(b);
|
|
144
145
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EngineHarness } from "../../EngineHarness.js";
|
|
2
2
|
import GUIElementSystem from "../../ecs/gui/GUIElementSystem.js";
|
|
3
|
-
import
|
|
3
|
+
import Entity from "../../ecs/Entity.js";
|
|
4
4
|
import GUIElement from "../../ecs/gui/GUIElement.js";
|
|
5
5
|
import { BehaviorComponent } from "../../intelligence/behavior/ecs/BehaviorComponent.js";
|
|
6
6
|
import { BehaviorSystem } from "../../intelligence/behavior/ecs/BehaviorSystem.js";
|
|
@@ -58,7 +58,7 @@ function main(engine) {
|
|
|
58
58
|
slice_view.setData(field.buffer, field.resolution);
|
|
59
59
|
|
|
60
60
|
|
|
61
|
-
new
|
|
61
|
+
new Entity()
|
|
62
62
|
.add(BehaviorComponent.looping_function(time_delta => {
|
|
63
63
|
|
|
64
64
|
const t0 = performance.now();
|
|
@@ -82,7 +82,7 @@ function main(engine) {
|
|
|
82
82
|
return `${m}: ${metric_stats}`;
|
|
83
83
|
}).join('\n')).start()
|
|
84
84
|
|
|
85
|
-
new
|
|
85
|
+
new Entity()
|
|
86
86
|
.add(GUIElement.fromView(slice_view))
|
|
87
87
|
.build(ecd);
|
|
88
88
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
import { byteArrayToString } from "../../../core/binary/ByteArrayTools.js";
|
|
7
6
|
import { stringify } from "../../../core/json/JsonUtils.js";
|
|
7
|
+
import {byteArrayToString} from "../../../core/binary/byteArrayToString.js";
|
|
8
8
|
|
|
9
9
|
function JsonStringCodec() {
|
|
10
10
|
}
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
import MsgPackCodec from './MsgPackCodec.js';
|
|
7
7
|
|
|
8
8
|
import Storage from '../Storage.js';
|
|
9
|
-
import { byteArrayToString, stringToByteArray } from "../../../core/binary/ByteArrayTools.js";
|
|
10
9
|
import { InMemoryLocalStorage } from "./InMemoryLocalStorage.js";
|
|
10
|
+
import {stringToByteArray} from "../../../core/binary/stringToByteArray.js";
|
|
11
|
+
import {byteArrayToString} from "../../../core/binary/byteArrayToString.js";
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class LocalStorage extends Storage {
|
|
@@ -9,7 +9,7 @@ import { playTrackRealTime } from "../animation/playTrackRealTime.js";
|
|
|
9
9
|
import GUIElement from '../ecs/gui/GUIElement.js';
|
|
10
10
|
import ViewportPosition from '../ecs/gui/position/ViewportPosition.js';
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import Entity from '../ecs/Entity.js';
|
|
13
13
|
|
|
14
14
|
import ConfirmationDialogView from '../../view/elements/ConfirmationDialogView.js';
|
|
15
15
|
import SimpleWindowView from '../../view/elements/SimpleWindow.js';
|
|
@@ -127,10 +127,10 @@ function GUIEngine() {
|
|
|
127
127
|
* @param {View} content
|
|
128
128
|
* @param {string} title
|
|
129
129
|
* @param {View} [wrapper]
|
|
130
|
-
* @returns {
|
|
130
|
+
* @returns {Entity}
|
|
131
131
|
*/
|
|
132
132
|
GUIEngine.prototype.openWindow = function ({ closeable, content, title, wrapper }) {
|
|
133
|
-
const entityBuilder = new
|
|
133
|
+
const entityBuilder = new Entity();
|
|
134
134
|
|
|
135
135
|
function closeAction() {
|
|
136
136
|
entityBuilder.destroy();
|
|
@@ -219,7 +219,7 @@ GUIEngine.prototype.createModal = function ({ content, title, priority = 0 }) {
|
|
|
219
219
|
lifecycle.makeDestroyed();
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
-
const builder = new
|
|
222
|
+
const builder = new Entity();
|
|
223
223
|
|
|
224
224
|
builder.add(SerializationMetadata.Transient);
|
|
225
225
|
builder.add(GUIElement.fromView(overlay));
|
|
@@ -2,7 +2,7 @@ import NotificationLog from "../../notify/NotificationLog.js";
|
|
|
2
2
|
import { assert } from "../../../core/assert.js";
|
|
3
3
|
import { noop } from "../../../core/function/Functions.js";
|
|
4
4
|
import List from "../../../core/collection/list/List.js";
|
|
5
|
-
import
|
|
5
|
+
import Entity from "../../ecs/Entity.js";
|
|
6
6
|
import GUIElement from "../../ecs/gui/GUIElement.js";
|
|
7
7
|
import { SerializationMetadata } from "../../ecs/components/SerializationMetadata.js";
|
|
8
8
|
import { EventType } from "../../ecs/EntityManager.js";
|
|
@@ -148,7 +148,7 @@ export class NotificationManager {
|
|
|
148
148
|
addEmitterDisplay(channel, viewEmitter, grouping = null) {
|
|
149
149
|
/**
|
|
150
150
|
*
|
|
151
|
-
* @type {Map<View,
|
|
151
|
+
* @type {Map<View, Entity>}
|
|
152
152
|
*/
|
|
153
153
|
const views = new Map();
|
|
154
154
|
|
|
@@ -196,7 +196,7 @@ export class NotificationManager {
|
|
|
196
196
|
|
|
197
197
|
view.addClass(managedNotificationChannelClass);
|
|
198
198
|
|
|
199
|
-
const eb = new
|
|
199
|
+
const eb = new Entity();
|
|
200
200
|
|
|
201
201
|
//prevent serialization of the notification
|
|
202
202
|
eb.add(SerializationMetadata.Transient);
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
MeshLambertMaterial,
|
|
9
9
|
TetrahedronBufferGeometry
|
|
10
10
|
} from "three";
|
|
11
|
-
import
|
|
11
|
+
import Entity from "../../../engine/ecs/Entity.js";
|
|
12
12
|
import Renderable from "../../../engine/ecs/renderable/Renderable.js";
|
|
13
13
|
import { Transform } from "../../../engine/ecs/transform/Transform.js";
|
|
14
14
|
import LabelView from "../../../view/common/LabelView.js";
|
|
@@ -140,7 +140,7 @@ export function visualizeMarkers({
|
|
|
140
140
|
|
|
141
141
|
g.add(mark_size);
|
|
142
142
|
|
|
143
|
-
const entityBuilder = new
|
|
143
|
+
const entityBuilder = new Entity();
|
|
144
144
|
|
|
145
145
|
const renderable = new Renderable(g);
|
|
146
146
|
renderable.computeBoundsFromObject();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EngineHarness } from "../../engine/EngineHarness.js";
|
|
2
2
|
import { GridCellActionPlaceMarker } from "./GridCellActionPlaceMarker.js";
|
|
3
3
|
import { GridData } from "../grid/GridData.js";
|
|
4
|
-
import
|
|
4
|
+
import Entity from "../../engine/ecs/Entity.js";
|
|
5
5
|
import Mesh from "../../engine/graphics/ecs/mesh/Mesh.js";
|
|
6
6
|
import { MeshSystem } from "../../engine/graphics/ecs/mesh/MeshSystem.js";
|
|
7
7
|
import { GameAssetType } from "../../engine/asset/GameAssetType.js";
|
|
@@ -166,7 +166,7 @@ async function main(engine) {
|
|
|
166
166
|
|
|
167
167
|
function build_node(node, url) {
|
|
168
168
|
|
|
169
|
-
new
|
|
169
|
+
new Entity()
|
|
170
170
|
.add(node.transform)
|
|
171
171
|
.add(Mesh.fromJSON({
|
|
172
172
|
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by Alex on 03/11/2016.
|
|
3
|
-
* @author Alex Goldring
|
|
4
|
-
* @author google.closure library team
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { stringifyStream } from "../json/JsonUtils.js";
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Turns a string into an array of bytes; a "byte" being a JS number in the
|
|
11
|
-
* range 0-255.
|
|
12
|
-
* @param {string} str String value to arrify.
|
|
13
|
-
* @return {!Uint8Array} Array of numbers corresponding to the
|
|
14
|
-
* UCS character codes of each character in str.
|
|
15
|
-
*/
|
|
16
|
-
function stringToByteArray(str) {
|
|
17
|
-
const length = str.length;
|
|
18
|
-
|
|
19
|
-
const output = [];
|
|
20
|
-
let p = 0;
|
|
21
|
-
|
|
22
|
-
for (let i = 0; i < length; i++) {
|
|
23
|
-
let c = str.charCodeAt(i);
|
|
24
|
-
while (c > 0xff) {
|
|
25
|
-
output[p++] = c & 0xff;
|
|
26
|
-
c >>= 8;
|
|
27
|
-
}
|
|
28
|
-
output[p++] = c;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const uint8Array = new Uint8Array(output);
|
|
32
|
-
|
|
33
|
-
return uint8Array;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Turns an array of numbers into the string given by the concatenation of the
|
|
39
|
-
* characters to which the numbers correspond.
|
|
40
|
-
* @param {!Uint8Array|!Array<number>} bytes Array of numbers representing
|
|
41
|
-
* characters.
|
|
42
|
-
* @return {string} Stringification of the array.
|
|
43
|
-
*/
|
|
44
|
-
function byteArrayToString(bytes) {
|
|
45
|
-
const numBytes = bytes.length;
|
|
46
|
-
|
|
47
|
-
const CHUNK_SIZE = 8192;
|
|
48
|
-
|
|
49
|
-
// Special-case the simple case for speed's sake.
|
|
50
|
-
if (numBytes <= CHUNK_SIZE) {
|
|
51
|
-
return String.fromCharCode.apply(null, bytes);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// The remaining logic splits conversion by chunks since
|
|
55
|
-
// Function#apply() has a maximum parameter count.
|
|
56
|
-
// See discussion: http://goo.gl/LrWmZ9
|
|
57
|
-
|
|
58
|
-
let str = '';
|
|
59
|
-
for (let i = 0; i < numBytes; i += CHUNK_SIZE) {
|
|
60
|
-
const chunk = Array.prototype.slice.call(bytes, i, i + CHUNK_SIZE);
|
|
61
|
-
str += String.fromCharCode.apply(null, chunk);
|
|
62
|
-
}
|
|
63
|
-
return str;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
*
|
|
68
|
-
* @param {Object} json
|
|
69
|
-
* @returns {number[]}
|
|
70
|
-
*/
|
|
71
|
-
function jsonToStringToByteArray(json) {
|
|
72
|
-
const output = [];
|
|
73
|
-
let p = 0;
|
|
74
|
-
|
|
75
|
-
function addToOutput(str) {
|
|
76
|
-
for (let i = 0; i < str.length; i++) {
|
|
77
|
-
let c = str.charCodeAt(i);
|
|
78
|
-
while (c > 0xff) {
|
|
79
|
-
output[p++] = c & 0xff;
|
|
80
|
-
c >>= 8;
|
|
81
|
-
}
|
|
82
|
-
output[p++] = c;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
stringifyStream(json, addToOutput);
|
|
87
|
-
return output;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
*
|
|
93
|
-
* @param {string} url
|
|
94
|
-
* @param {string} filename
|
|
95
|
-
*/
|
|
96
|
-
export function downloadUrlAsFile(url, filename) {
|
|
97
|
-
const elem = window.document.createElement('a');
|
|
98
|
-
elem.href = url;
|
|
99
|
-
elem.download = filename;
|
|
100
|
-
document.body.appendChild(elem);
|
|
101
|
-
elem.click();
|
|
102
|
-
document.body.removeChild(elem);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function downloadAsFile(data, filename, type = 'text/json') {
|
|
106
|
-
|
|
107
|
-
let blobContent;
|
|
108
|
-
|
|
109
|
-
if (data instanceof ArrayBuffer || data instanceof Uint8Array) {
|
|
110
|
-
//raw binary data
|
|
111
|
-
blobContent = [data];
|
|
112
|
-
} else if (data instanceof Array) {
|
|
113
|
-
//already an array
|
|
114
|
-
blobContent = data;
|
|
115
|
-
} else if (data instanceof Blob) {
|
|
116
|
-
//already a blob
|
|
117
|
-
blobContent = [data];
|
|
118
|
-
} else if (typeof data === "string") {
|
|
119
|
-
blobContent = [data];
|
|
120
|
-
} else {
|
|
121
|
-
blobContent = [data]
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
const blob = new Blob(blobContent, { type });
|
|
125
|
-
if (window.navigator.msSaveOrOpenBlob) {
|
|
126
|
-
window.navigator.msSaveBlob(blob, filename);
|
|
127
|
-
} else {
|
|
128
|
-
downloadUrlAsFile(window.URL.createObjectURL(blob), filename);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
export {
|
|
133
|
-
stringToByteArray,
|
|
134
|
-
byteArrayToString,
|
|
135
|
-
jsonToStringToByteArray,
|
|
136
|
-
downloadAsFile
|
|
137
|
-
};
|