@woosh/meep-engine 2.58.0 → 2.59.1

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.
Files changed (66) hide show
  1. package/build/bundle-worker-image-decoder.js +1 -1
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/build/meep.cjs +15297 -20126
  4. package/build/meep.min.js +1 -1
  5. package/build/meep.module.js +15298 -20126
  6. package/editor/process/symbolic/SymbolicDisplayInternalAPI.js +3 -3
  7. package/editor/process/symbolic/makeParticleEmitterSymbolicDisplay.js +1 -1
  8. package/editor/process/symbolic/makePathSymbolicDisplay.js +1 -1
  9. package/editor/process/symbolic/makeSoundEmitterSymbolicDisplay.js +1 -1
  10. package/editor/tools/TopDownCameraControlTool.js +2 -2
  11. package/editor/tools/v2/TransformControls.js +1 -1
  12. package/editor/tools/v2/prototypeTransformControls.js +1 -1
  13. package/package.json +2 -2
  14. package/samples/generation/main.js +1 -1
  15. package/samples/terrain/editor.js +1 -1
  16. package/src/core/collection/array/arraySetDiff.js +11 -7
  17. package/src/core/geom/3d/aabb/aabb3_array_intersects_point.spec.js +48 -0
  18. package/src/core/geom/3d/aabb/aabb3_array_intersects_ray.js +5 -1
  19. package/src/core/geom/3d/aabb/aabb3_expand_array.spec.js +16 -0
  20. package/src/core/geom/3d/aabb/aabb3_raycast.spec.js +37 -0
  21. package/src/core/geom/3d/aabb/aabb3_score_boxes_SAH.js +11 -12
  22. package/src/core/geom/3d/aabb/aabb3_score_boxes_SAH.spec.js +14 -0
  23. package/src/core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js +6 -4
  24. package/src/core/geom/3d/aabb/compute_aabb_from_points.js +6 -3
  25. package/src/core/geom/3d/matrix/m4_multiply.spec.js +24 -0
  26. package/src/core/geom/3d/matrix/m4_multiply_alphatensor.js +56 -40
  27. package/src/core/geom/3d/matrix/m4_multiply_alphatensor.spec.js +24 -0
  28. package/src/core/geom/3d/shape/util/shape_to_visual_entity.js +2 -2
  29. package/src/core/geom/Vector3.spec.js +24 -14
  30. package/src/engine/EngineHarness.js +1 -1
  31. package/src/engine/control/ControlContext.js +1 -1
  32. package/src/engine/ecs/Entity.d.ts +2 -0
  33. package/src/engine/ecs/Entity.js +40 -37
  34. package/src/engine/ecs/Entity.spec.js +2 -2
  35. package/src/engine/ecs/EntityBuilderUtils.js +2 -2
  36. package/src/engine/ecs/EntityComponentDataset.js +91 -89
  37. package/src/engine/ecs/EntityFlags.js +4 -4
  38. package/src/engine/ecs/attachment/Attachment.js +5 -2
  39. package/src/engine/ecs/binding/ComponentPropertyBinding.js +13 -13
  40. package/src/engine/ecs/dynamic_actions/RuleExecution.js +1 -1
  41. package/src/engine/ecs/parent/EntityNode.js +2 -2
  42. package/src/engine/ecs/parent/EntityNode.spec.js +2 -2
  43. package/src/engine/ecs/tooltip/testTooltipComponentSystem.js +1 -1
  44. package/src/engine/ecs/util/hideEntityGracefully.js +6 -6
  45. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +1 -0
  46. package/src/engine/graphics/ecs/mesh-v2/render/SGThreeObjectCache.js +30 -7
  47. package/src/engine/graphics/ecs/mesh-v2/sample/load_gltf.js +1 -1
  48. package/src/engine/graphics/ecs/mesh-v2/sample/prototypeShadedGeometry.js +71 -34
  49. package/src/engine/graphics/ecs/mesh-v2/sample/prototype_sg_raycast.js +1 -1
  50. package/src/engine/graphics/ecs/path/PathDisplaySystem.js +4 -4
  51. package/src/engine/graphics/ecs/path/entity/EntityPathMarker.js +1 -1
  52. package/src/engine/graphics/ecs/path/highlight/PathDisplayHighlightSystem.js +3 -3
  53. package/src/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +5 -5
  54. package/src/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +2 -2
  55. package/src/engine/graphics/render/visibility/hiz/prototypeHiZ.js +1 -1
  56. package/src/engine/graphics/sh3/prototypeSH3Probe.js +2 -2
  57. package/src/engine/intelligence/behavior/ecs/EntityBehavior.js +14 -17
  58. package/src/engine/intelligence/behavior/util/DelayBehavior.js +6 -6
  59. package/src/engine/ui/GUIEngine.js +368 -371
  60. package/src/engine/ui/notification/NotificationManager.js +1 -1
  61. package/src/generation/markers/actions/placement/MarkerNodeEntityProcessor.js +1 -1
  62. package/src/view/tooltip/gml/TooltipParser.js +21 -28
  63. package/src/view/tooltip/gml/compiler/GMLReferenceCompiler.js +3 -2
  64. package/src/core/geom/3d/aabb/aabb3_intersects_ray_branchless.js +0 -52
  65. package/src/core/geom/3d/aabb/aabb3_intersects_ray_fast.js +0 -176
  66. package/src/core/geom/3d/aabb/aabb3_intersects_ray_slab.js +0 -91
@@ -1,18 +1,18 @@
1
- import { resolvePath } from "../../../core/json/resolvePath.js";
1
+ import {resolvePath} from "../../../core/json/resolvePath.js";
2
2
 
3
3
  export class ComponentPropertyBinding {
4
- constructor() {
5
- /**
6
- * @type {ComponentPropertyPath}
7
- */
8
- this.path = null;
9
-
10
- /**
11
- *
12
- * @type {Vector1|Vector2|Vector3|ObservedBoolean}
13
- */
14
- this.value = null;
15
- }
4
+
5
+ /**
6
+ * @type {ComponentPropertyPath}
7
+ */
8
+ path = null;
9
+
10
+ /**
11
+ *
12
+ * @type {Vector1|Vector2|Vector3|ObservedBoolean}
13
+ */
14
+ value = null;
15
+
16
16
 
17
17
  /**
18
18
  * @template T
@@ -8,7 +8,7 @@ export class RuleExecution {
8
8
  this.rule = null;
9
9
  /**
10
10
  *
11
- * @type {EntityBuilder}
11
+ * @type {Entity}
12
12
  */
13
13
  this.executor = null
14
14
 
@@ -236,7 +236,7 @@ export class EntityNode {
236
236
  throw new Error('Parent entity is not built');
237
237
  }
238
238
 
239
- const parent_entity_id = parent_entity_builder.entity;
239
+ const parent_entity_id = parent_entity_builder.id;
240
240
  parent_entity.entity = parent_entity_id;
241
241
 
242
242
  // add component back
@@ -361,7 +361,7 @@ export class EntityNode {
361
361
  throw new Error('Parent entity is not built');
362
362
  }
363
363
 
364
- const parent_entity_id = parent_entity_builder.entity;
364
+ const parent_entity_id = parent_entity_builder.id;
365
365
  parent_entity.entity = parent_entity_id;
366
366
 
367
367
  assert.ok(parent.entity.hasComponent(Transform), "parent node must have a transform but doesn't. Transform is required for attachment transform hierarchy to work correctly");
@@ -83,7 +83,7 @@ test("build empty", () => {
83
83
 
84
84
  expect(node.isBuilt).toBe(true);
85
85
  expect(node.entity.isBuilt).toBe(true);
86
- expect(dataset.entityExists(node.entity.entity)).toBe(true);
86
+ expect(dataset.entityExists(node.entity.id)).toBe(true);
87
87
  });
88
88
 
89
89
  test("destroy empty", () => {
@@ -93,7 +93,7 @@ test("destroy empty", () => {
93
93
 
94
94
  node.build(dataset);
95
95
 
96
- const entity = node.entity.entity;
96
+ const entity = node.entity.id;
97
97
 
98
98
  node.destroy();
99
99
 
@@ -83,7 +83,7 @@ function main(engine) {
83
83
  pitch: -0.7
84
84
  });
85
85
 
86
- EngineHarness.buildOrbitalCameraController({ cameraEntity: camera.entity, engine });
86
+ EngineHarness.buildOrbitalCameraController({ cameraEntity: camera.id, engine });
87
87
 
88
88
  const ecd = engine.entityManager.dataset;
89
89
 
@@ -25,14 +25,14 @@ const SHUTDOWN_GRACE_PERIOD = 60;
25
25
 
26
26
  /**
27
27
  *
28
- * @type {Map<Class|function, function(T,entity?:EntityBuilder,createEntity?:function,createEntityContext?:*):number>}
28
+ * @type {Map<Class|function, function(T,entity?:Entity,createEntity?:function,createEntityContext?:*):number>}
29
29
  */
30
30
  const component_shutdown = new Map();
31
31
 
32
32
  /**
33
33
  * @template T
34
34
  * @param {Class<T>} type
35
- * @param {function(T,entity?:EntityBuilder,createEntity?:function,createEntityContext?:*):number} method
35
+ * @param {function(T,entity?:Entity,createEntity?:function,createEntityContext?:*):number} method
36
36
  */
37
37
  function addShutdown(type, method) {
38
38
  component_shutdown.set(type, method);
@@ -109,7 +109,7 @@ addShutdown(Light, (light, builder, createEntity, createEntityThisArg) => {
109
109
  path: 'intensity',
110
110
  target: [0],
111
111
  duration: delay,
112
- entity: builder.entity
112
+ entity: builder.id
113
113
  }),
114
114
  DieBehavior.create()
115
115
  ])));
@@ -161,8 +161,8 @@ addShutdown(SoundEmitter, (soundEmitter, builder, createEntity, createEntityThis
161
161
 
162
162
  /**
163
163
  *
164
- * @param {EntityBuilder} builder
165
- * @param {function():EntityBuilder} createEntity
164
+ * @param {Entity} builder
165
+ * @param {function():Entity} createEntity
166
166
  * @param {*} [createEntityThisArg]
167
167
  * @return {number} duration in seconds until the entity is completely hidden
168
168
  */
@@ -174,7 +174,7 @@ export function hideEntityGracefully(builder, createEntity, createEntityThisArg)
174
174
 
175
175
  let delay = 0;
176
176
 
177
- const components = builder.element;
177
+ const components = builder.components;
178
178
 
179
179
  const component_count = components.length;
180
180
 
@@ -39,6 +39,7 @@ const scratch_ray_0 = new Float32Array(6);
39
39
 
40
40
  /**
41
41
  * Represents a primitive 3d object, a combination of a material and geometry
42
+ * This is roughly equivalent to single draw call, note that his is not a hierarchical data structure, if you want that - you will need to combine multiple entities, each with a `ShadedGeometry` component
42
43
  */
43
44
  export class ShadedGeometry {
44
45
  constructor() {
@@ -1,10 +1,17 @@
1
- import { build_three_object } from "../build_three_object.js";
1
+ import {build_three_object} from "../build_three_object.js";
2
+ import {ShadedGeometry} from "../ShadedGeometry.js";
3
+
4
+ class CacheValue {
5
+ object = null
6
+ key = null
7
+ }
8
+
2
9
 
3
10
  export class SGThreeObjectCache {
4
11
  constructor() {
5
12
  /**
6
13
  *
7
- * @type {WeakMap<ShadedGeometry, THREE.Object3D>}
14
+ * @type {Map<ShadedGeometry, CacheValue>}
8
15
  * @private
9
16
  */
10
17
  this.__object_cache = new WeakMap();
@@ -17,15 +24,31 @@ export class SGThreeObjectCache {
17
24
  */
18
25
  get(sg) {
19
26
 
20
- const existing_object = this.__object_cache.get(sg);
27
+ const existing_value = this.__object_cache.get(sg);
28
+
29
+ if (existing_value !== undefined) {
30
+ const object = existing_value.object;
21
31
 
22
- if (existing_object !== undefined) {
23
- return existing_object;
32
+ // validate that the object is still the same
33
+ if (existing_value.key.equals(sg)) {
34
+ return object;
35
+ } else {
36
+ // object has changed, dispose of cached version and let it be rebuilt
37
+ // object.dispose();
38
+ }
24
39
  }
25
40
 
26
- const new_object = build_three_object(sg);
41
+ // replace scratch key as it's being used inside the cache now
42
+ const key = sg.clone();
43
+
44
+ const new_object = build_three_object(key);
45
+
46
+ const cacheValue = new CacheValue();
47
+
48
+ cacheValue.key = key;
49
+ cacheValue.object = new_object;
27
50
 
28
- this.__object_cache.set(sg, new_object);
51
+ this.__object_cache.set(sg, cacheValue);
29
52
 
30
53
  return new_object;
31
54
  }
@@ -69,7 +69,7 @@ async function load_gltf(path, engine) {
69
69
  // console.log(composition);
70
70
  // console.log(three_object);
71
71
  //
72
- // new EntityBuilder()
72
+ // new Entity()
73
73
  // .add(Mesh.fromJSON({
74
74
  // url: path
75
75
  // }))
@@ -1,26 +1,31 @@
1
- import { EngineHarness } from "../../../../EngineHarness.js";
2
- import { ShadedGeometrySystem } from "../ShadedGeometrySystem.js";
1
+ import {BoxBufferGeometry, MeshStandardMaterial, OctahedronGeometry} from "three";
2
+ import {OrbitingBehavior} from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
3
+ import {downloadAsFile} from "../../../../../core/binary/downloadAsFile.js";
4
+ import {convert_bvh_to_dot_format_string} from "../../../../../core/bvh2/visual/convert_bvh_to_dot_format_string.js";
5
+ import {Color} from "../../../../../core/color/Color.js";
6
+ import Quaternion from "../../../../../core/geom/Quaternion.js";
7
+ import Vector2 from "../../../../../core/geom/Vector2.js";
8
+ import Vector3 from "../../../../../core/geom/Vector3.js";
9
+ import {randomFloatBetween} from "../../../../../core/math/random/randomFloatBetween.js";
10
+ import {randomFromArray} from "../../../../../core/math/random/randomFromArray.js";
11
+ import {seededRandom} from "../../../../../core/math/random/seededRandom.js";
12
+ import ButtonView from "../../../../../view/elements/button/ButtonView.js";
3
13
  import Entity from "../../../../ecs/Entity.js";
4
- import { Transform } from "../../../../ecs/transform/Transform.js";
5
- import { ShadedGeometry } from "../ShadedGeometry.js";
6
- import { BoxBufferGeometry, MeshStandardMaterial, OctahedronGeometry } from "three";
7
- import { randomFloatBetween } from "../../../../../core/math/random/randomFloatBetween.js";
8
- import { seededRandom } from "../../../../../core/math/random/seededRandom.js";
9
- import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
10
14
  import GUIElement from "../../../../ecs/gui/GUIElement.js";
11
- import ButtonView from "../../../../../view/elements/button/ButtonView.js";
12
- import { convert_bvh_to_dot_format_string } from "../../../../../core/bvh2/visual/convert_bvh_to_dot_format_string.js";
13
- import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
14
15
  import GUIElementSystem from "../../../../ecs/gui/GUIElementSystem.js";
15
- import Vector3 from "../../../../../core/geom/Vector3.js";
16
- import Quaternion from "../../../../../core/geom/Quaternion.js";
17
- import { ShadedGeometryFlags } from "../ShadedGeometryFlags.js";
18
- import { randomFromArray } from "../../../../../core/math/random/randomFromArray.js";
19
- import { BehaviorComponent } from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
20
- import { OrbitingBehavior } from "../../../../../../../model/game/util/behavior/OrbitingBehavior.js";
21
- import { BehaviorSystem } from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
22
- import Vector2 from "../../../../../core/geom/Vector2.js";
23
- import {downloadAsFile} from "../../../../../core/binary/downloadAsFile.js";
16
+ import ViewportPosition from "../../../../ecs/gui/position/ViewportPosition.js";
17
+ import ViewportPositionSystem from "../../../../ecs/gui/position/ViewportPositionSystem.js";
18
+ import {Transform} from "../../../../ecs/transform/Transform.js";
19
+ import {EngineHarness} from "../../../../EngineHarness.js";
20
+ import {SequenceBehavior} from "../../../../intelligence/behavior/composite/SequenceBehavior.js";
21
+ import {RepeatBehavior} from "../../../../intelligence/behavior/decorator/RepeatBehavior.js";
22
+ import {BehaviorComponent} from "../../../../intelligence/behavior/ecs/BehaviorComponent.js";
23
+ import {BehaviorSystem} from "../../../../intelligence/behavior/ecs/BehaviorSystem.js";
24
+ import {ActionBehavior} from "../../../../intelligence/behavior/primitive/ActionBehavior.js";
25
+ import {DelayBehavior} from "../../../../intelligence/behavior/util/DelayBehavior.js";
26
+ import {ShadedGeometry} from "../ShadedGeometry.js";
27
+ import {ShadedGeometryFlags} from "../ShadedGeometryFlags.js";
28
+ import {ShadedGeometrySystem} from "../ShadedGeometrySystem.js";
24
29
 
25
30
  const eh = new EngineHarness();
26
31
 
@@ -33,7 +38,7 @@ function makeMovingShadedGeometry() {
33
38
  b.radius = 2;
34
39
  b.rate = 1;
35
40
 
36
- const sg = ShadedGeometry.from(new OctahedronGeometry(0.5, 5), new MeshStandardMaterial({ color: 0xFF0000 }));
41
+ const sg = ShadedGeometry.from(new OctahedronGeometry(0.5, 5), new MeshStandardMaterial({color: 0xFF0000}));
37
42
 
38
43
  sg.draw_method = DRAW_METHOD_INSTANCED;
39
44
 
@@ -89,31 +94,60 @@ async function main(engine) {
89
94
  geometries.push(new BoxBufferGeometry());
90
95
  }
91
96
 
97
+ const entities = [];
98
+
92
99
  for (let i = 0; i < INSTANCE_COUNT; i++) {
93
100
  const geometry = randomFromArray(random, geometries);
94
101
  const sg = ShadedGeometry.from(geometry, material);
95
102
 
96
- // sg.draw_method = DRAW_METHOD_PLAIN;
97
- sg.draw_method = DRAW_METHOD_INSTANCED;
103
+ sg.draw_method = DRAW_METHOD_PLAIN;
104
+ sg.setFlag(ShadedGeometryFlags.DrawMethodLocked);
105
+ // sg.draw_method = DRAW_METHOD_INSTANCED;
98
106
  // sg.draw_method = 2;
99
107
  // sg.draw_method = DRAW_METHOD_INSTANCED;
100
108
  // sg.draw_method = random() > 0.5 ? DRAW_METHOD_INSTANCED : 2;
101
109
  sg.clearFlag(ShadedGeometryFlags.CastShadow | ShadedGeometryFlags.ReceiveShadow);
102
110
 
103
- new Entity()
104
- .add(Transform.fromJSON({
105
- position: {
106
- x: randomFloatBetween(random, 0, TERRAIN_SIZE),
107
- y: randomFloatBetween(random, 0, 10),
108
- z: randomFloatBetween(random, 0, TERRAIN_SIZE)
109
- },
110
- rotation: Quaternion.random(random),
111
- scale: 0.1
112
- }))
111
+ const entity = new Entity();
112
+
113
+ entity.add(Transform.fromJSON({
114
+ position: {
115
+ x: randomFloatBetween(random, 0, TERRAIN_SIZE),
116
+ y: randomFloatBetween(random, 0, 10),
117
+ z: randomFloatBetween(random, 0, TERRAIN_SIZE)
118
+ },
119
+ rotation: Quaternion.random(random),
120
+ scale: 0.1
121
+ }))
113
122
  .add(sg)
114
123
  .build(ecd);
124
+
125
+ entities.push(entity);
115
126
  }
116
127
 
128
+ let iterator = 0;
129
+
130
+ new Entity()
131
+ .add(BehaviorComponent.fromOne(
132
+ RepeatBehavior.from(SequenceBehavior.from([
133
+ DelayBehavior.from(0.001),
134
+ RepeatBehavior.from(new ActionBehavior(() => {
135
+ const index = (iterator++) % entities.length;
136
+ const entity = entities[index];
137
+
138
+ const sg = entity.getComponent(ShadedGeometry);
139
+
140
+ const color = new Color();
141
+ color.setHSV(random(), 0.7, 1);
142
+
143
+ sg.material = new MeshStandardMaterial({
144
+ color: color.toUint()
145
+ });
146
+ }), 1000)
147
+ ]))
148
+ ))
149
+ .build(ecd);
150
+
117
151
  // makeMovingShadedGeometry().build(ecd);
118
152
 
119
153
  debug_button(engine, () => {
@@ -158,4 +192,7 @@ function debug_button(engine, action, name = "Button", ecd = entityManager.datas
158
192
  .build(ecd);
159
193
  }
160
194
 
161
- eh.initialize().then(main);
195
+ eh.initialize({
196
+ configuration(config, engine) {
197
+ }
198
+ }).then(main);
@@ -168,7 +168,7 @@ async function main(engine) {
168
168
  const sp = new SurfacePoint3();
169
169
 
170
170
  sgm.raycastNearest(sp, ray_origin.x, ray_origin.y, ray_origin.z, ray_direction.x, ray_direction.y, ray_direction.z, ((entity, mesh) => {
171
- return (entity !== raycast_marker.entity);
171
+ return (entity !== raycast_marker.id);
172
172
  }));
173
173
 
174
174
  const t = raycast_marker.getComponent(Transform);
@@ -27,7 +27,7 @@ const builders = {
27
27
  * @param {EntityPathStyle} style
28
28
  * @param {Path} _p
29
29
  * @param {PathDisplaySystem} system
30
- * @param {EntityBuilder[]} result
30
+ * @param {Entity[]} result
31
31
  */
32
32
  [PathDisplayType.Entity]: function (style, path, system, result) {
33
33
 
@@ -54,7 +54,7 @@ const builders = {
54
54
  * @param {RibbonPathStyle} style
55
55
  * @param {Path} path
56
56
  * @param {PathDisplaySystem} system
57
- * @param {EntityBuilder[]} result
57
+ * @param {Entity[]} result
58
58
  */
59
59
  [PathDisplayType.Ribbon]: function (style, path, system, result) {
60
60
  const builder = new RibbonPathBuilder();
@@ -72,7 +72,7 @@ const builders = {
72
72
  * @param {TubePathStyle} style
73
73
  * @param {Path} path
74
74
  * @param {PathDisplaySystem} system
75
- * @param {EntityBuilder[]} result
75
+ * @param {Entity[]} result
76
76
  */
77
77
  [PathDisplayType.Tube]: function (style, path, system, result) {
78
78
  const builder = new TubePathBuilder();
@@ -103,7 +103,7 @@ class PathDisplayContext extends SystemEntityContext {
103
103
 
104
104
  /**
105
105
  *
106
- * @type {EntityBuilder[]}
106
+ * @type {Entity[]}
107
107
  * @private
108
108
  */
109
109
  this.__owned_entities = [];
@@ -14,7 +14,7 @@ export class EntityPathMarker {
14
14
 
15
15
  /**
16
16
  *
17
- * @type {EntityBuilder}
17
+ * @type {Entity}
18
18
  */
19
19
  this.entity = null;
20
20
  }
@@ -63,7 +63,7 @@ export class PathDisplayHighlightSystem extends System {
63
63
 
64
64
  /**
65
65
  *
66
- * @type {EntityBuilder[]}
66
+ * @type {Entity[]}
67
67
  */
68
68
  const ownedEntities = ctx.__owned_entities;
69
69
 
@@ -72,7 +72,7 @@ export class PathDisplayHighlightSystem extends System {
72
72
 
73
73
  if (eb.hasComponent(Highlight)) {
74
74
  //already has a highlight
75
- console.warn(`Owned entity ${eb.entity} of PathDisplay entity ${entity} already has a Highlight component attached. Keeping existing Highlight.`);
75
+ console.warn(`Owned entity ${eb.id} of PathDisplay entity ${entity} already has a Highlight component attached. Keeping existing Highlight.`);
76
76
  continue;
77
77
  }
78
78
 
@@ -105,7 +105,7 @@ export class PathDisplayHighlightSystem extends System {
105
105
 
106
106
  /**
107
107
  *
108
- * @type {EntityBuilder[]}
108
+ * @type {Entity[]}
109
109
  */
110
110
  const ownedEntities = ctx.__owned_entities;
111
111
 
@@ -270,7 +270,7 @@ function main(engine) {
270
270
 
271
271
  const ecd = engine.entityManager.dataset;
272
272
 
273
- // new EntityBuilder()
273
+ // new Entity()
274
274
  // .add(Transform.fromJSON({
275
275
  // position: {
276
276
  // x: 100,
@@ -290,7 +290,7 @@ function main(engine) {
290
290
  // }))
291
291
  // .build(ecd);
292
292
 
293
- // new EntityBuilder()
293
+ // new Entity()
294
294
  // .add(Transform.fromJSON({
295
295
  // position: {
296
296
  // x: 107,
@@ -335,7 +335,7 @@ function main(engine) {
335
335
  }
336
336
  }
337
337
  //
338
- // new EntityBuilder()
338
+ // new Entity()
339
339
  // .add(Transform.fromJSON({
340
340
  // position: {
341
341
  // x: 107,
@@ -355,7 +355,7 @@ function main(engine) {
355
355
  // }))
356
356
  // .build(ecd);
357
357
 
358
- // new EntityBuilder()
358
+ // new Entity()
359
359
  // .add(Transform.fromJSON({
360
360
  // position: {
361
361
  // x: 107,
@@ -377,7 +377,7 @@ function main(engine) {
377
377
 
378
378
  // const canvasView = makeCameraClippingDebug(engine);
379
379
  //
380
- // new EntityBuilder()
380
+ // new Entity()
381
381
  // .add(ViewportPosition.fromJSON({
382
382
  // offset: new Vector2(10, 10)
383
383
  // }))
@@ -549,7 +549,7 @@ function setup_scene_3(engine, ecd) {
549
549
  // key_light_transform.position.set(10, 10, 0);
550
550
  // key_light_transform.lookAt(new Vector3(0, 0, 0));
551
551
  //
552
- // new EntityBuilder()
552
+ // new Entity()
553
553
  // .add(light_key)
554
554
  // .add(key_light_transform)
555
555
  // .build(ecd);
@@ -1150,7 +1150,7 @@ function main(engine) {
1150
1150
  // pointerEvents: 'auto'
1151
1151
  // });
1152
1152
 
1153
- // new EntityBuilder()
1153
+ // new Entity()
1154
1154
  // .add(ViewportPosition.fromJSON({
1155
1155
  // anchor: Vector2.one,
1156
1156
  // offset: new Vector2(-0, -0),
@@ -367,7 +367,7 @@ function main(engine) {
367
367
  // for (let i = 0; i < 10; i++) {
368
368
  // for (let j = 0; j < 10; j++) {
369
369
  //
370
- // new EntityBuilder()
370
+ // new Entity()
371
371
  // .add(Transform.fromJSON({
372
372
  // position: {
373
373
  // x: 60 + i * 10,
@@ -284,7 +284,7 @@ async function main(engine) {
284
284
  ];
285
285
 
286
286
  //
287
- // new EntityBuilder()
287
+ // new Entity()
288
288
  // .add(Transform.fromJSON({
289
289
  // position: {
290
290
  // x: mesh_asset.boundingBox.x0,
@@ -300,7 +300,7 @@ async function main(engine) {
300
300
  // }))
301
301
  // .build(ecd);
302
302
  //
303
- // new EntityBuilder()
303
+ // new Entity()
304
304
  // .add(Transform.fromJSON({
305
305
  // position: {
306
306
  // x: mesh_asset.boundingBox.x1,
@@ -1,28 +1,25 @@
1
- import { Behavior } from "../Behavior.js";
2
- import { assert } from "../../../../core/assert.js";
1
+ import {Behavior} from "../Behavior.js";
2
+ import {assert} from "../../../../core/assert.js";
3
3
 
4
4
  export class EntityBehavior extends Behavior {
5
5
 
6
- constructor() {
7
- super();
8
6
 
9
- /**
10
- * Entity ID
11
- * @type {number}
12
- */
13
- this.entity = -1;
7
+ /**
8
+ * Entity ID
9
+ * @type {number}
10
+ */
11
+ entity = -1;
14
12
 
15
- /**
16
- *
17
- * @type {EntityComponentDataset}
18
- */
19
- this.ecd = null;
20
- }
13
+ /**
14
+ *
15
+ * @type {EntityComponentDataset}
16
+ */
17
+ ecd = null;
21
18
 
22
19
  initialize(context) {
23
- const { entity, ecd, engine } = context;
20
+ const {entity, ecd, engine} = context;
24
21
 
25
- assert.typeOf(entity, 'number', 'entity');
22
+ assert.isNumber(entity, 'entity');
26
23
  assert.defined(ecd);
27
24
  assert.defined(engine);
28
25
 
@@ -41,17 +41,17 @@ export class DelayBehavior extends Behavior {
41
41
 
42
42
  /**
43
43
  *
44
- * @param {number} value in seconds
44
+ * @param {number} seconds in seconds
45
45
  * @return {DelayBehavior}
46
46
  */
47
- static from(value) {
48
- assert.isNumber(value, 'value');
49
- assert.notNaN(value, 'value');
50
- assert.isFiniteNumber(value, 'value');
47
+ static from(seconds) {
48
+ assert.isNumber(seconds, 'value');
49
+ assert.notNaN(seconds, 'value');
50
+ assert.isFiniteNumber(seconds, 'value');
51
51
 
52
52
  const r = new DelayBehavior();
53
53
 
54
- r.value = value;
54
+ r.value = seconds;
55
55
 
56
56
  return r;
57
57
  }