@woosh/meep-engine 2.49.9 → 2.50.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 (170) hide show
  1. package/editor/actions/concrete/ArrayCopyAction.js +1 -1
  2. package/package.json +1 -1
  3. package/src/core/binary/BinaryBuffer.js +1 -1
  4. package/src/core/binary/BinaryBuffer.spec.js +128 -0
  5. package/src/core/binary/int32_to_binary_string.js +4 -1
  6. package/src/core/binary/int32_to_binary_string.spec.js +9 -0
  7. package/src/core/bvh2/BinaryNode.js +0 -30
  8. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +1 -1
  9. package/src/core/bvh2/binary/IndexedBinaryBVH.js +1 -1
  10. package/src/core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js +1 -1
  11. package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +1 -1
  12. package/src/core/cache/Cache.js +31 -29
  13. package/src/core/cache/Cache.spec.js +4 -1
  14. package/src/core/collection/HashMap.js +1 -1
  15. package/src/core/collection/array/{copyArray.js → array_copy.js} +1 -24
  16. package/src/core/collection/array/array_copy_entire.js +21 -0
  17. package/src/core/collection/array/typed/typed_array_copy.js +1 -1
  18. package/src/core/collection/queue/Deque.d.ts +4 -0
  19. package/src/core/collection/queue/Deque.js +5 -7
  20. package/src/core/collection/queue/Deque.spec.js +107 -0
  21. package/src/core/collection/table/RowFirstTable.js +1 -1
  22. package/src/core/geom/2d/aabb/AABB2.d.ts +14 -0
  23. package/src/core/geom/2d/aabb/AABB2.js +9 -7
  24. package/src/core/geom/2d/aabb/AABB2.spec.js +100 -0
  25. package/src/core/geom/2d/aabb/aabb2_compute_center_from_multiple.spec.js +11 -0
  26. package/src/core/geom/2d/aabb/aabb2_compute_overlap.spec.js +56 -0
  27. package/src/core/geom/2d/aabb/aabb2_contains.spec.js +40 -0
  28. package/src/core/geom/2d/bvh/Node2.js +1 -1
  29. package/src/core/geom/2d/convex-hull/fixed_convex_hull_humus.js +1 -1
  30. package/src/core/geom/2d/convex-hull/fixed_convex_hull_relaxation.js +1 -1
  31. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_2d.js +35 -0
  32. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_array_2d.js +51 -0
  33. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_vectors_2d.js +15 -0
  34. package/src/core/geom/2d/line/line_segment_compute_line_segment_intersection_vectors_array_2d.js +30 -0
  35. package/src/core/geom/2d/line/line_segment_line_segment_intersection_exists_2d.js +29 -0
  36. package/src/core/geom/3d/aabb/AABB3.d.ts +4 -0
  37. package/src/core/geom/3d/aabb/AABB3.spec.js +30 -0
  38. package/src/core/geom/3d/aabb/aabb3_detailed_volume_intersection.js +4 -4
  39. package/src/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +5 -5
  40. package/src/core/geom/3d/matrix/m4_make_translation.js +1 -1
  41. package/src/core/geom/3d/plane/is_point_within_planes.js +1 -1
  42. package/src/core/geom/3d/plane/lerp_planes_to_array.js +2 -0
  43. package/src/core/geom/3d/plane/{plane_computeConvex3PlaneIntersection.js → plane3_compute_convex_3_plane_intersection.js} +1 -1
  44. package/src/core/geom/3d/plane/{plane3_computeLineSegmentIntersection.js → plane3_compute_line_segment_intersection.js} +1 -1
  45. package/src/core/geom/3d/plane/{computePlanePlaneIntersection.js → plane3_compute_plane_intersection.js} +15 -11
  46. package/src/core/geom/3d/plane/{computePlaneLineIntersection.js → plane3_compute_ray_intersection.js} +5 -1
  47. package/src/core/geom/3d/plane/plane3_intersect_plane.js +14 -0
  48. package/src/core/geom/3d/plane/{plane_three_compute_convex3_plane_intersection.js → plane3_three_compute_convex_3_plane_intersection.js} +7 -4
  49. package/src/core/geom/3d/plane/planeRayIntersection.js +2 -2
  50. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +1 -1
  51. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +1 -1
  52. package/src/core/geom/3d/tetrahedra/compute_bounding_simplex_3d.js +5 -5
  53. package/src/core/geom/3d/tetrahedra/compute_circumsphere.js +1 -1
  54. package/src/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +1 -1
  55. package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +1 -1
  56. package/src/core/geom/3d/topology/expandConnectivityByLocality.js +1 -1
  57. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +1 -1
  58. package/src/core/geom/Quaternion.d.ts +11 -0
  59. package/src/core/geom/Quaternion.js +36 -27
  60. package/src/core/geom/Quaternion.spec.js +141 -0
  61. package/src/core/geom/Vector2.d.ts +5 -1
  62. package/src/core/geom/Vector2.js +24 -0
  63. package/src/core/geom/Vector3.d.ts +6 -0
  64. package/src/core/geom/Vector3.spec.js +60 -0
  65. package/src/core/graph/GraphUtils.js +4 -2
  66. package/src/core/graph/layout/CircleLayout.js +4 -2
  67. package/src/core/math/vector_nd_dot.js +16 -0
  68. package/src/core/math/{normalizeArrayVector.js → vector_nd_normalize.js} +3 -3
  69. package/src/core/math/{normalizeArrayVector.spec.js → vector_nd_normalize.spec.js} +3 -3
  70. package/src/core/process/PromiseWatcher.spec.js +1 -1
  71. package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +1 -1
  72. package/src/engine/ecs/EntityBlueprint.d.ts +14 -0
  73. package/src/engine/ecs/EntityBlueprint.js +2 -2
  74. package/src/engine/ecs/EntityBlueprint.spec.js +52 -0
  75. package/src/engine/ecs/EntityBuilder.js +8 -0
  76. package/src/engine/ecs/EntityManager.d.ts +1 -0
  77. package/src/engine/ecs/EntityManager.js +17 -213
  78. package/src/engine/ecs/EntityManager.spec.js +62 -1
  79. package/src/engine/ecs/System.js +8 -2
  80. package/src/engine/ecs/fow/FogOfWar.js +1 -1
  81. package/src/engine/ecs/guid/GUID.js +1 -1
  82. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +1 -1
  83. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +1 -1
  84. package/src/engine/ecs/terrain/tiles/TerrainTile.js +1 -1
  85. package/src/engine/ecs/transform/Transform.d.ts +2 -0
  86. package/src/engine/ecs/transform/Transform.spec.js +63 -0
  87. package/src/engine/ecs/transform-attachment/TransformAttachment.d.ts +17 -1
  88. package/src/engine/ecs/transform-attachment/TransformAttachment.js +12 -2
  89. package/src/engine/ecs/transform-attachment/TransformAttachment.spec.js +103 -0
  90. package/src/engine/graphics/ecs/camera/Camera.js +2 -2
  91. package/src/engine/graphics/ecs/path/entity/EntityPath.js +1 -1
  92. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -1
  93. package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +1 -1
  94. package/src/engine/graphics/geometry/MikkT/m_getNormal.js +1 -1
  95. package/src/engine/graphics/geometry/MikkT/m_getTexCoord.js +1 -1
  96. package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
  97. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +1 -1
  98. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  99. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +1 -1
  100. package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +1 -1
  101. package/src/engine/graphics/render/Lines.js +1 -1
  102. package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
  103. package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
  104. package/src/engine/graphics/render/forward_plus/computeFrustumCorners.js +10 -10
  105. package/src/engine/graphics/render/forward_plus/model/Decal.js +1 -1
  106. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1 -1
  107. package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.js +1 -1
  108. package/src/engine/graphics/render/layers/RenderLayerUtils.js +3 -3
  109. package/src/engine/graphics/render/view/CameraView.js +1 -1
  110. package/src/engine/graphics/render/visibility/hiz/query/BatchOcclusionQuery.js +1 -1
  111. package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +1 -1
  112. package/src/engine/graphics/sh3/LightProbeVolume.js +1 -1
  113. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +1 -1
  114. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
  115. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +1 -1
  116. package/src/engine/graphics/sh3/prototypeSH3Probe.js +1 -1
  117. package/src/engine/graphics/texture/3d/scs3d_read_2d_slice.js +1 -1
  118. package/src/engine/graphics/texture/CanvasClone.js +5 -1
  119. package/src/engine/graphics/texture/sampler/Sampler2D.js +14 -75
  120. package/src/engine/graphics/texture/sampler/bicubic.js +19 -19
  121. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.js +10 -0
  122. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.spec.js +90 -0
  123. package/src/engine/graphics/texture/sampler/differenceSampler.js +13 -8
  124. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +140 -0
  125. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +130 -0
  126. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +10 -0
  127. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.spec.js +183 -0
  128. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +133 -0
  129. package/src/engine/graphics/texture/sampler/filter/mitchell.js +4 -0
  130. package/src/engine/graphics/texture/sampler/loadSampler2D.js +5 -2
  131. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.js +8 -3
  132. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.spec.js +13 -0
  133. package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min_indices.js +58 -0
  134. package/src/engine/graphics/trail/TemporalPath.js +0 -36
  135. package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +12 -12
  136. package/src/engine/intelligence/behavior/composite/SequenceBehavior.spec.js +17 -0
  137. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +3 -1
  138. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +7 -1
  139. package/src/engine/knowledge/database/StaticKnowledgeDataTable.spec.js +21 -0
  140. package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.d.ts +2 -2
  141. package/src/engine/logging/ConsoleLoggerBackend.js +4 -0
  142. package/src/engine/logging/VoidLoggerBackend.js +12 -0
  143. package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +1 -1
  144. package/src/engine/navigation/ecs/components/computeCatmullRomSplineUniformDistance.js +1 -1
  145. package/src/engine/physics/cannon/CannonJSPhysicsSystem.js +1 -1
  146. package/src/engine/save/GameStateLoader.js +1 -1
  147. package/src/engine/scene/Scene.d.ts +2 -0
  148. package/src/engine/scene/Scene.js +2 -2
  149. package/src/engine/scene/Scene.spec.js +20 -0
  150. package/src/engine/scene/SceneManager.d.ts +4 -0
  151. package/src/engine/scene/SceneManager.js +46 -23
  152. package/src/engine/scene/SceneManager.spec.js +131 -0
  153. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +2 -2
  154. package/src/engine/ui/GUIEngine.js +1 -1
  155. package/src/generation/grid/GridData.js +8 -2
  156. package/src/generation/grid/GridData.spec.js +5 -0
  157. package/src/generation/grid/generation/util/buildUnsignedDistanceField.js +3 -1
  158. package/src/generation/markers/MarkerNode.js +2 -2
  159. package/src/generation/markers/actions/MarkerNodeActionEntityPlacement.js +1 -1
  160. package/src/generation/theme/AreaMask.js +3 -1
  161. package/src/view/elements/progress/RectangularPieProgressView.js +8 -6
  162. package/src/view/minimap/dom/MinimapCameraView.js +3 -3
  163. package/src/core/geom/2d/LineSegment2.js +0 -175
  164. package/src/core/geom/3d/plane/computePlaneRayIntersection.js +0 -55
  165. package/src/core/geom/Matrix4.js +0 -275
  166. package/src/engine/graphics/texture/sampler/distanceField.js +0 -411
  167. package/src/engine/graphics/texture/sampler/distanceField.spec.js +0 -184
  168. package/src/engine/physics/cannon/cannon.min.js +0 -27
  169. package/src/generation/grid/MarkerMatchCounter.js +0 -25
  170. /package/src/engine/physics/spring/{Spring.js → computeHookeForce.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
2
  import { clamp } from "../../../../core/math/clamp.js";
3
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
3
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
4
4
  import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
1
  import { clamp } from "../../../../core/math/clamp.js";
2
- import { array_copy } from "../../../../core/collection/array/copyArray.js";
2
+ import { array_copy } from "../../../../core/collection/array/array_copy.js";
3
3
  import { computeNonuniformCatmullRomSplineSample } from "./computeNonuniformCatmullRomSplineSample.js";
4
4
  import { assert } from "../../../../core/assert.js";
5
5
 
@@ -5,7 +5,7 @@ import { System } from '../../engine/ecs/System';
5
5
  import Transform from '../../engine/ecs/components/Transform';
6
6
  import PhysicalBody from '../../engine/ecs/components/PhysicalBody';
7
7
  import Vector3 from '../../core/geom/Vector3';
8
- import Cannon from './cannon.min.js';
8
+ import Cannon from './cannon.min.js'; //TODO replace with package import
9
9
 
10
10
 
11
11
  class CannonPhysicsSystem extends System {
@@ -26,7 +26,7 @@ class GameStateLoader extends EnginePlugin {
26
26
  save(name, resolve, reject, progress) {
27
27
  const engine = this.engine;
28
28
 
29
- const currentScene = engine.sceneManager.currentScene;
29
+ const currentScene = engine.sceneManager.current_scene;
30
30
 
31
31
 
32
32
  /**
@@ -1,5 +1,7 @@
1
1
  import {EntityComponentDataset} from "../ecs/EntityComponentDataset";
2
2
 
3
3
  export default class Scene {
4
+ constructor(name?: string)
5
+
4
6
  public dataset: EntityComponentDataset
5
7
  }
@@ -11,10 +11,10 @@ import { promiseTask } from "../../core/process/task/util/promiseTask.js";
11
11
  class Scene {
12
12
  /**
13
13
  *
14
- * @param {string} name
14
+ * @param {string} [name]
15
15
  * @constructor
16
16
  */
17
- constructor(name) {
17
+ constructor(name = "Unnamed") {
18
18
  /**
19
19
  *
20
20
  * @type {string}
@@ -0,0 +1,20 @@
1
+ import Scene from "./Scene.js";
2
+ import { EntityComponentDataset } from "../ecs/EntityComponentDataset.js";
3
+
4
+ test("constructor should not throw", () => {
5
+ expect(() => new Scene()).not.toThrow();
6
+ });
7
+
8
+ test("new scene has it's own dataset", () => {
9
+ const scene = new Scene();
10
+
11
+ expect(scene.dataset).not.toBeNull();
12
+ expect(scene.dataset).toBeDefined();
13
+ expect(scene.dataset).toBeInstanceOf(EntityComponentDataset);
14
+ });
15
+
16
+ test("name properly through constructor", () => {
17
+ const scene = new Scene("x");
18
+
19
+ expect(scene.name).toBe("x");
20
+ });
@@ -1,6 +1,10 @@
1
1
  import Scene from "./Scene";
2
+ import {EntityManager} from "../ecs/EntityManager";
2
3
 
3
4
  export default class SceneManager {
5
+ readonly current_scene:Scene|null
6
+ readonly entity_manager: EntityManager
7
+
4
8
  create(name: string): Scene
5
9
 
6
10
  add(scene: Scene): void
@@ -7,6 +7,34 @@ import List from "../../core/collection/list/List.js";
7
7
 
8
8
 
9
9
  class SceneManager {
10
+ /**
11
+ *
12
+ * @type {Scene|null}
13
+ */
14
+ #current_scene = null
15
+
16
+ /**
17
+ *
18
+ * @return {Scene|null}
19
+ */
20
+ get current_scene() {
21
+ return this.#current_scene;
22
+ }
23
+
24
+ /**
25
+ *
26
+ * @type {EntityManager|null}
27
+ */
28
+ #entity_manager = null;
29
+
30
+ /**
31
+ *
32
+ * @return {EntityManager|null}
33
+ */
34
+ get entity_manager(){
35
+ return this.#entity_manager;
36
+ }
37
+
10
38
  /**
11
39
  *
12
40
  * @param {EntityManager} entityManager
@@ -14,20 +42,17 @@ class SceneManager {
14
42
  * @constructor
15
43
  */
16
44
  constructor(entityManager, clock) {
17
- /**
18
- *
19
- * @type {Scene|null}
20
- */
21
- this.currentScene = null;
45
+
22
46
  /**
23
47
  * @type {List<Scene>}
24
48
  */
25
49
  this.scenes = new List();
50
+
26
51
  /**
27
52
  *
28
53
  * @type {EntityManager}
29
54
  */
30
- this.entityManager = entityManager;
55
+ this.#entity_manager = entityManager;
31
56
 
32
57
  /**
33
58
  *
@@ -113,10 +138,10 @@ class SceneManager {
113
138
  const scene = this.scenes.get(sceneIndex);
114
139
 
115
140
 
116
- if (this.currentScene === scene) {
141
+ if (this.#current_scene === scene) {
117
142
  this.deactivateCurrentScene();
118
143
 
119
- this.currentScene = null;
144
+ this.#current_scene = null;
120
145
  }
121
146
 
122
147
  this.scenes.remove(sceneIndex);
@@ -130,11 +155,11 @@ class SceneManager {
130
155
  */
131
156
  clear() {
132
157
 
133
- if (this.currentScene !== null) {
134
- this.currentScene.active.set(false);
135
- this.entityManager.detachDataSet();
158
+ if (this.#current_scene !== null) {
159
+ this.#current_scene.active.set(false);
160
+ this.#entity_manager.detachDataSet();
136
161
 
137
- this.currentScene = null;
162
+ this.#current_scene = null;
138
163
  }
139
164
 
140
165
  return this;
@@ -146,9 +171,7 @@ class SceneManager {
146
171
  * @returns {boolean}
147
172
  */
148
173
  exists(name) {
149
- return this.scenes.some(function (scene) {
150
- return scene.name === name;
151
- });
174
+ return this.getByName(name) !== undefined;
152
175
  }
153
176
 
154
177
  /**
@@ -170,8 +193,8 @@ class SceneManager {
170
193
 
171
194
  scene.active.set(false);
172
195
 
173
- if (this.entityManager.dataset === scene.dataset) {
174
- this.entityManager.detachDataSet();
196
+ if (this.#entity_manager.dataset === scene.dataset) {
197
+ this.#entity_manager.detachDataSet();
175
198
  }
176
199
 
177
200
  //remove speed modifiers
@@ -200,7 +223,7 @@ class SceneManager {
200
223
  console.error(`Exception in pre-activation routine of scene '${scene.id}'`, e);
201
224
  }
202
225
 
203
- const em = this.entityManager;
226
+ const em = this.#entity_manager;
204
227
 
205
228
  em.attachDataSet(scene.dataset);
206
229
 
@@ -218,7 +241,7 @@ class SceneManager {
218
241
  console.error(`Exception in post-activation routine of scene '${scene.id}'`, e);
219
242
  }
220
243
 
221
- this.currentScene = scene;
244
+ this.#current_scene = scene;
222
245
  }
223
246
 
224
247
  /**
@@ -226,7 +249,7 @@ class SceneManager {
226
249
  */
227
250
  deactivateCurrentScene() {
228
251
 
229
- const currentScene = this.currentScene;
252
+ const currentScene = this.#current_scene;
230
253
 
231
254
  if (currentScene !== null) {
232
255
  this.deactivateScene(currentScene);
@@ -261,12 +284,12 @@ class SceneManager {
261
284
  throw new Error(`Scene named '${name}' doesn't exist, valid options are: [${this.scenes.map(s => s.name).join(', ')}]`);
262
285
  }
263
286
 
264
- if (this.currentScene === scene) {
287
+ if (this.#current_scene === scene) {
265
288
  //already at that scene
266
289
  return;
267
290
  }
268
291
 
269
- const em = this.entityManager;
292
+ const em = this.#entity_manager;
270
293
 
271
294
  // Ensure that all system components are registered
272
295
  scene.dataset.registerManyComponentTypes(em.getComponentTypeMap());
@@ -281,7 +304,7 @@ class SceneManager {
281
304
  */
282
305
  stackPush(id) {
283
306
  //take current scene and put it onto the stack
284
- this.stack.push(this.currentScene.name);
307
+ this.stack.push(this.#current_scene.name);
285
308
 
286
309
  this.set(id);
287
310
  }
@@ -0,0 +1,131 @@
1
+ import SceneManager from "./SceneManager.js";
2
+ import { EntityManager } from "../ecs/EntityManager.js";
3
+ import Clock from "../Clock.js";
4
+
5
+
6
+ function makeSM() {
7
+ const em = new EntityManager();
8
+ const clock = new Clock();
9
+
10
+ return {
11
+ manager: new SceneManager(em, clock),
12
+ entityManager: em
13
+ };
14
+ }
15
+
16
+ test("constructor", () => {
17
+
18
+ const { manager } = makeSM();
19
+
20
+ expect(manager.current_scene).toBeNull();
21
+ });
22
+
23
+ test("create method", () => {
24
+
25
+ const { manager } = makeSM();
26
+
27
+ const scene_x = manager.create('x');
28
+
29
+ expect(scene_x).toBeDefined();
30
+ expect(scene_x).not.toBeNull();
31
+
32
+ expect(() => manager.create('x')).toThrow();
33
+
34
+ const scene_y = manager.create('y');
35
+
36
+ expect(scene_y).toBeDefined();
37
+ expect(scene_y).not.toBeNull();
38
+
39
+ });
40
+
41
+ test("getByName", () => {
42
+ const { manager } = makeSM();
43
+
44
+ expect(manager.getByName('x')).toBeUndefined();
45
+
46
+ const scene_x = manager.create('x');
47
+
48
+ expect(manager.getByName('x')).toBe(scene_x);
49
+
50
+ const scene_y = manager.create('y');
51
+
52
+ expect(manager.getByName('x')).toBe(scene_x);
53
+ expect(manager.getByName('y')).toBe(scene_y);
54
+ });
55
+
56
+ test("remove", () => {
57
+
58
+ const { manager } = makeSM();
59
+
60
+ expect(manager.remove('x')).toBe(false);
61
+
62
+ manager.create('x');
63
+
64
+ expect(manager.remove('x')).toBe(true);
65
+ expect(manager.remove('x')).toBe(false);
66
+
67
+ });
68
+
69
+ test("exists", () => {
70
+
71
+ const { manager } = makeSM();
72
+
73
+ expect(manager.exists('x')).toBe(false);
74
+
75
+ manager.create('x');
76
+
77
+ expect(manager.exists('x')).toBe(true);
78
+ });
79
+
80
+ test("set active scene", () => {
81
+ const { manager, entityManager } = makeSM();
82
+
83
+ const scene = manager.create('x');
84
+
85
+ manager.set('x');
86
+
87
+ expect(manager.current_scene).toBe(scene);
88
+ expect(scene.active.getValue()).toBe(true);
89
+ expect(entityManager.dataset).toBe(scene.dataset);
90
+ });
91
+
92
+ test("stack push/pop", () => {
93
+
94
+ const { manager } = makeSM();
95
+
96
+ const scene_x = manager.create('x');
97
+ const scene_y = manager.create('y');
98
+
99
+ manager.set('x');
100
+
101
+ manager.stackPush('y');
102
+
103
+ expect(manager.current_scene).toBe(scene_y);
104
+
105
+ manager.stackPop();
106
+
107
+ expect(manager.current_scene).toBe(scene_x);
108
+ });
109
+
110
+ test("clear on empty does nothing", () => {
111
+ const { manager } = makeSM();
112
+
113
+ manager.clear();
114
+
115
+ expect(manager.current_scene).toBeNull();
116
+ });
117
+
118
+ test("clear correctly clears active scene", () => {
119
+
120
+ const { manager, entityManager } = makeSM();
121
+
122
+ const scene = manager.create('x');
123
+
124
+ manager.set('x');
125
+
126
+ manager.clear();
127
+
128
+ expect(manager.current_scene).toBeNull();
129
+ expect(scene.active.getValue()).toBe(false);
130
+ expect(entityManager.dataset).toBe(null);
131
+ });
@@ -5,7 +5,7 @@ import { SilentSoundMaterial } from "../../concrete/SilentSoundMaterial.js";
5
5
  import { SingleSoundMaterial } from "../../concrete/SingleSoundMaterial.js";
6
6
  import { deserializeSoundMaterialFromJSON } from "../../concrete/json/deserializeSoundMaterialFromJSON.js";
7
7
  import { assert } from "../../../../../core/assert.js";
8
- import { normalizeArrayVector } from "../../../../../core/math/normalizeArrayVector.js";
8
+ import { vector_nd_normalize } from "../../../../../core/math/vector_nd_normalize.js";
9
9
 
10
10
  const v2_temp = new Vector2();
11
11
 
@@ -112,7 +112,7 @@ export class TerrainSoundMaterialSurfaceDetector extends SoundMaterialSurfaceDet
112
112
 
113
113
  }
114
114
 
115
- normalizeArrayVector(this.__composite.weights, this.__composite.weights, layer_count);
115
+ vector_nd_normalize(this.__composite.weights, this.__composite.weights, layer_count);
116
116
 
117
117
  const additions = this.__composite.computeInteractionSounds(result, 0, interaction);
118
118
 
@@ -462,7 +462,7 @@ GUIEngine.prototype.getActiveSceneContext = function () {
462
462
 
463
463
  const sm = engine.sceneManager;
464
464
 
465
- const scene = sm.currentScene;
465
+ const scene = sm.current_scene;
466
466
 
467
467
  if (scene === null) {
468
468
  return null;
@@ -3,7 +3,6 @@ import { QuadTreeNode } from "../../core/geom/2d/quad-tree/QuadTreeNode.js";
3
3
  import { OffsetScaleTransform2D } from "../../engine/ecs/terrain/ecs/OffsetScaleTransform2D.js";
4
4
  import { max2 } from "../../core/math/max2.js";
5
5
  import { qt_collect_by_circle } from "../../core/geom/2d/quad-tree/qt_collect_by_circle.js";
6
- import { v2_length_sqr } from "../../core/geom/Vector2.js";
7
6
 
8
7
  /**
9
8
  *
@@ -122,7 +121,14 @@ export class GridData {
122
121
  const distance_limit_sqr = distance_limit * distance_limit;
123
122
 
124
123
  // check refined containment
125
- if (v2_length_sqr(x - marker.position.x, y - marker.position.y) > distance_limit_sqr) {
124
+ const position = marker.position;
125
+
126
+ const dx = x - position.x;
127
+ const dy = y - position.y;
128
+
129
+ const distance_sqr = dx * dx + dy * dy;
130
+
131
+ if (distance_sqr > distance_limit_sqr) {
126
132
  continue;
127
133
  }
128
134
 
@@ -0,0 +1,5 @@
1
+ import { GridData } from "./GridData.js";
2
+
3
+ test("constructor does not throw", () => {
4
+ expect(() => new GridData()).not.toThrow()
5
+ });
@@ -1,5 +1,7 @@
1
- import { computeUnsignedDistanceField } from "../../../../engine/graphics/texture/sampler/distanceField.js";
2
1
  import { Sampler2D } from "../../../../engine/graphics/texture/sampler/Sampler2D.js";
2
+ import {
3
+ computeUnsignedDistanceField
4
+ } from "../../../../engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js";
3
5
 
4
6
  /**
5
7
  *
@@ -1,7 +1,7 @@
1
1
  import Vector2 from "../../core/geom/Vector2.js";
2
2
  import { Transform } from "../../engine/ecs/transform/Transform.js";
3
- import { copyArray } from "../../core/collection/array/copyArray.js";
4
3
  import { circleIntersectsCircle } from "../../core/geom/2d/circle/circleIntersectsCircle.js";
4
+ import { array_copy_entire } from "../../core/collection/array/array_copy_entire.js";
5
5
 
6
6
  export class MarkerNode {
7
7
  constructor() {
@@ -95,7 +95,7 @@ export class MarkerNode {
95
95
  copy(other) {
96
96
  this.type = other.type;
97
97
 
98
- copyArray(other.tags, this.tags);
98
+ array_copy_entire(other.tags, this.tags);
99
99
 
100
100
  this.position.copy(other.position);
101
101
 
@@ -64,7 +64,7 @@ export class MarkerNodeActionEntityPlacement extends MarkerNodeAction {
64
64
  execute(grid, ecd, node) {
65
65
  const blueprint = this.entity;
66
66
 
67
- const entityBuilder = blueprint.buildEntityBuilder(node.properties);
67
+ const entityBuilder = blueprint.build(node.properties);
68
68
 
69
69
  // execute post-process step
70
70
  if (this.processor !== null) {
@@ -1,6 +1,8 @@
1
1
  import { Sampler2D } from "../../engine/graphics/texture/sampler/Sampler2D.js";
2
2
  import AABB2 from "../../core/geom/2d/aabb/AABB2.js";
3
- import { computeUnsignedDistanceField } from "../../engine/graphics/texture/sampler/distanceField.js";
3
+ import {
4
+ computeUnsignedDistanceField
5
+ } from "../../engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js";
4
6
 
5
7
  export class AreaMask {
6
8
  constructor() {
@@ -1,7 +1,9 @@
1
1
  import View from "../../View.js";
2
2
  import SVG from "../../SVG.js";
3
- import { line2_line2_intersection } from "../../../core/geom/2d/LineSegment2.js";
4
3
  import Vector1 from "../../../core/geom/Vector1.js";
4
+ import {
5
+ line_segment_compute_line_segment_intersection_array_2d
6
+ } from "../../../core/geom/2d/line/line_segment_compute_line_segment_intersection_array_2d.js";
5
7
 
6
8
  export class RectangularPieProgressView extends View {
7
9
 
@@ -76,31 +78,31 @@ export class RectangularPieProgressView extends View {
76
78
 
77
79
  if (fraction < .125) {
78
80
 
79
- line2_line2_intersection(p, 0, 0, size_x, 0, center_x, center_y, line_x, line_y);
81
+ line_segment_compute_line_segment_intersection_array_2d(p, 0, 0, 0, size_x, 0, center_x, center_y, line_x, line_y);
80
82
 
81
83
  path = `M ${center_x} 0 L ${center_x} ${center_y} L ${p[0]} ${p[1]} L ${size_x} 0 L ${size_x} ${size_y} L 0 ${size_y} L 0 0 Z`;
82
84
 
83
85
  } else if (fraction < 0.375) {
84
86
 
85
- line2_line2_intersection(p, size_x, 0, size_x, size_y, center_x, center_y, line_x, line_y);
87
+ line_segment_compute_line_segment_intersection_array_2d(p, 0, size_x, 0, size_x, size_y, center_x, center_y, line_x, line_y);
86
88
 
87
89
  path = `M ${center_x} 0 L ${center_x} ${center_y} L ${p[0]} ${p[1]} L ${size_x} ${size_y} L 0 ${size_y} L 0 0 Z`;
88
90
 
89
91
  } else if (fraction < 0.625) {
90
92
 
91
- line2_line2_intersection(p, size_x, size_y, 0, size_y, center_x, center_y, line_x, line_y);
93
+ line_segment_compute_line_segment_intersection_array_2d(p, 0, size_x, size_y, 0, size_y, center_x, center_y, line_x, line_y);
92
94
 
93
95
  path = `M ${center_x} 0 L ${center_x} ${center_y} L ${p[0]} ${p[1]} L 0 ${size_y} L 0 0 Z`;
94
96
 
95
97
  } else if (fraction < 0.875) {
96
98
 
97
- line2_line2_intersection(p, 0, size_y, 0, 0, center_x, center_y, line_x, line_y);
99
+ line_segment_compute_line_segment_intersection_array_2d(p, 0, 0, size_y, 0, 0, center_x, center_y, line_x, line_y);
98
100
 
99
101
  path = `M ${center_x} 0 L ${center_x} ${center_y} L ${p[0]} ${p[1]} L 0 0 Z`;
100
102
 
101
103
  } else {
102
104
 
103
- line2_line2_intersection(p, 0, 0, size_x, 0, center_x, center_y, line_x, line_y);
105
+ line_segment_compute_line_segment_intersection_array_2d(p, 0, 0, 0, size_x, 0, center_x, center_y, line_x, line_y);
104
106
 
105
107
  path = `M ${center_x} 0 L ${center_x} ${center_y} L ${p[0]} ${p[1]} Z`;
106
108
 
@@ -3,7 +3,7 @@ import Vector3 from "../../../core/geom/Vector3.js";
3
3
  import ObservedValue from "../../../core/model/ObservedValue.js";
4
4
  import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
5
5
  import SVG from "../../SVG.js";
6
- import { computePlaneRayIntersection } from "../../../core/geom/3d/plane/computePlaneRayIntersection.js";
6
+ import { plane3_compute_ray_intersection } from "../../../core/geom/3d/plane/plane3_compute_ray_intersection.js";
7
7
 
8
8
 
9
9
  const rayContact = new SurfacePoint3();
@@ -93,7 +93,7 @@ export class MinimapCameraView extends View {
93
93
  const JITTER = 0.00001;
94
94
 
95
95
  if (terrain === null) {
96
- computePlaneRayIntersection(result, originX, originY, originZ, directionX, directionY, directionZ, 0, 1, 0, 0);
96
+ plane3_compute_ray_intersection(result, originX, originY, originZ, directionX, directionY, directionZ, 0, 1, 0, 0);
97
97
  } else {
98
98
 
99
99
  let oX = originX;
@@ -118,7 +118,7 @@ export class MinimapCameraView extends View {
118
118
 
119
119
  if (!foundHit) {
120
120
  //no hit found, fall back to planar test
121
- computePlaneRayIntersection(result, originX, originY, originZ, directionX, directionY, directionZ, 0, 1, 0, 0);
121
+ plane3_compute_ray_intersection(result, originX, originY, originZ, directionX, directionY, directionZ, 0, 1, 0, 0);
122
122
  }
123
123
 
124
124
  }