@woosh/meep-engine 2.49.9 → 2.50.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.
Files changed (141) 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/matrix/m4_make_translation.js +1 -1
  39. package/src/core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js +1 -1
  40. package/src/core/geom/3d/tetrahedra/TetrahedralMesh.js +1 -1
  41. package/src/core/geom/3d/tetrahedra/compute_circumsphere.js +1 -1
  42. package/src/core/geom/3d/tetrahedra/delaunay/fill_in_a_cavity.js +1 -1
  43. package/src/core/geom/3d/topology/bounds/computeTriangleClusterNormalBoundingCone.js +1 -1
  44. package/src/core/geom/3d/topology/expandConnectivityByLocality.js +1 -1
  45. package/src/core/geom/3d/topology/struct/binary/BinaryTopology.js +1 -1
  46. package/src/core/geom/Quaternion.d.ts +11 -0
  47. package/src/core/geom/Quaternion.js +36 -27
  48. package/src/core/geom/Quaternion.spec.js +141 -0
  49. package/src/core/geom/Vector2.d.ts +5 -1
  50. package/src/core/geom/Vector2.js +24 -0
  51. package/src/core/geom/Vector3.d.ts +4 -0
  52. package/src/core/geom/Vector3.spec.js +60 -0
  53. package/src/core/graph/GraphUtils.js +4 -2
  54. package/src/core/graph/layout/CircleLayout.js +4 -2
  55. package/src/core/math/vector_nd_dot.js +16 -0
  56. package/src/core/math/{normalizeArrayVector.js → vector_nd_normalize.js} +3 -3
  57. package/src/core/math/{normalizeArrayVector.spec.js → vector_nd_normalize.spec.js} +3 -3
  58. package/src/core/process/PromiseWatcher.spec.js +1 -1
  59. package/src/engine/animation/curve/compression/downsample_float_array_curve_by_error.js +1 -1
  60. package/src/engine/ecs/EntityManager.js +1 -205
  61. package/src/engine/ecs/fow/FogOfWar.js +1 -1
  62. package/src/engine/ecs/guid/GUID.js +1 -1
  63. package/src/engine/ecs/terrain/ecs/splat/SplatMapping.js +1 -1
  64. package/src/engine/ecs/terrain/overlay/TerrainOverlay.js +1 -1
  65. package/src/engine/ecs/terrain/tiles/TerrainTile.js +1 -1
  66. package/src/engine/ecs/transform/Transform.d.ts +2 -0
  67. package/src/engine/ecs/transform/Transform.spec.js +63 -0
  68. package/src/engine/ecs/transform-attachment/TransformAttachment.d.ts +17 -1
  69. package/src/engine/ecs/transform-attachment/TransformAttachment.js +12 -2
  70. package/src/engine/ecs/transform-attachment/TransformAttachment.spec.js +103 -0
  71. package/src/engine/graphics/ecs/path/tube/build/computeFrenetFrames.js +1 -1
  72. package/src/engine/graphics/geometry/MikkT/GenerateTSpaces.js +1 -1
  73. package/src/engine/graphics/geometry/MikkT/m_getNormal.js +1 -1
  74. package/src/engine/graphics/geometry/MikkT/m_getTexCoord.js +1 -1
  75. package/src/engine/graphics/geometry/bvh/buffered/BVHGeometryRaycaster.js +1 -1
  76. package/src/engine/graphics/geometry/instancing/InstancedMeshGroup.js +1 -1
  77. package/src/engine/graphics/geometry/optimization/merge/merge_geometry_hierarchy.js +1 -1
  78. package/src/engine/graphics/impostors/octahedral/util/build_cutout_from_atlas_by_alpha.js +1 -1
  79. package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +1 -1
  80. package/src/engine/graphics/render/Lines.js +1 -1
  81. package/src/engine/graphics/render/buffer/simple-fx/taa/TemporalSupersamplingRenderPlugin.js +1 -1
  82. package/src/engine/graphics/render/forward_plus/LightManager.js +1 -1
  83. package/src/engine/graphics/render/forward_plus/model/Decal.js +1 -1
  84. package/src/engine/graphics/render/forward_plus/prototype/prototypeLightManager.js +1 -1
  85. package/src/engine/graphics/render/gizmo/GizmoShapeRenderingInterface.js +1 -1
  86. package/src/engine/graphics/render/view/CameraView.js +1 -1
  87. package/src/engine/graphics/render/visibility/hiz/query/BatchOcclusionQuery.js +1 -1
  88. package/src/engine/graphics/render/webgpu/sample/MeshInstance.js +1 -1
  89. package/src/engine/graphics/sh3/LightProbeVolume.js +1 -1
  90. package/src/engine/graphics/sh3/path_tracer/PathTracedMesh.js +1 -1
  91. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +1 -1
  92. package/src/engine/graphics/sh3/path_tracer/make_sky_hosek.js +1 -1
  93. package/src/engine/graphics/sh3/prototypeSH3Probe.js +1 -1
  94. package/src/engine/graphics/texture/3d/scs3d_read_2d_slice.js +1 -1
  95. package/src/engine/graphics/texture/CanvasClone.js +5 -1
  96. package/src/engine/graphics/texture/sampler/Sampler2D.js +14 -75
  97. package/src/engine/graphics/texture/sampler/bicubic.js +19 -19
  98. package/src/engine/graphics/texture/sampler/convertSampler2D2DataURL.spec.js +10 -0
  99. package/src/engine/graphics/texture/sampler/copy_Sampler2D_channel_data.spec.js +90 -0
  100. package/src/engine/graphics/texture/sampler/differenceSampler.js +13 -8
  101. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_Chamfer.js +140 -0
  102. package/src/engine/graphics/texture/sampler/distance/computeSignedDistanceField_NaiveFlood.js +130 -0
  103. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.js +10 -0
  104. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField.spec.js +183 -0
  105. package/src/engine/graphics/texture/sampler/distance/computeUnsignedDistanceField_Chamfer.js +133 -0
  106. package/src/engine/graphics/texture/sampler/filter/mitchell.js +4 -0
  107. package/src/engine/graphics/texture/sampler/loadSampler2D.js +5 -2
  108. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.js +8 -3
  109. package/src/engine/graphics/texture/sampler/resize/sampler2d_downsample_mipmap.spec.js +13 -0
  110. package/src/engine/graphics/texture/sampler/sampler2d_channel_compute_min_indices.js +58 -0
  111. package/src/engine/graphics/trail/TemporalPath.js +0 -36
  112. package/src/engine/intelligence/behavior/composite/ParallelBehavior.spec.js +12 -12
  113. package/src/engine/intelligence/behavior/composite/SequenceBehavior.spec.js +17 -0
  114. package/src/engine/intelligence/behavior/primitive/SucceedingBehavior.js +2 -0
  115. package/src/engine/knowledge/database/StaticKnowledgeDataTable.d.ts +7 -1
  116. package/src/engine/knowledge/database/StaticKnowledgeDataTable.spec.js +21 -0
  117. package/src/engine/knowledge/database/StaticKnowledgeDataTableDescriptor.d.ts +2 -2
  118. package/src/engine/logging/ConsoleLoggerBackend.js +4 -0
  119. package/src/engine/logging/VoidLoggerBackend.js +12 -0
  120. package/src/engine/navigation/ecs/components/computeCatmullRomSpline.js +1 -1
  121. package/src/engine/navigation/ecs/components/computeCatmullRomSplineUniformDistance.js +1 -1
  122. package/src/engine/physics/cannon/CannonJSPhysicsSystem.js +1 -1
  123. package/src/engine/save/GameStateLoader.js +1 -1
  124. package/src/engine/scene/Scene.d.ts +2 -0
  125. package/src/engine/scene/Scene.js +2 -2
  126. package/src/engine/scene/Scene.spec.js +20 -0
  127. package/src/engine/scene/SceneManager.d.ts +4 -0
  128. package/src/engine/scene/SceneManager.js +46 -23
  129. package/src/engine/scene/SceneManager.spec.js +107 -0
  130. package/src/engine/sound/material/detector/terrain/TerrainSoundMaterialSurfaceDetector.js +2 -2
  131. package/src/engine/ui/GUIEngine.js +1 -1
  132. package/src/generation/grid/generation/util/buildUnsignedDistanceField.js +3 -1
  133. package/src/generation/markers/MarkerNode.js +2 -2
  134. package/src/generation/theme/AreaMask.js +3 -1
  135. package/src/view/elements/progress/RectangularPieProgressView.js +8 -6
  136. package/src/core/geom/2d/LineSegment2.js +0 -175
  137. package/src/core/geom/Matrix4.js +0 -275
  138. package/src/engine/graphics/texture/sampler/distanceField.js +0 -411
  139. package/src/engine/graphics/texture/sampler/distanceField.spec.js +0 -184
  140. package/src/engine/physics/cannon/cannon.min.js +0 -27
  141. /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,107 @@
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(entityManager.dataset).toBe(scene.dataset);
89
+ });
90
+
91
+ test("stack push/pop", () => {
92
+
93
+ const { manager } = makeSM();
94
+
95
+ const scene_x = manager.create('x');
96
+ const scene_y = manager.create('y');
97
+
98
+ manager.set('x');
99
+
100
+ manager.stackPush('y');
101
+
102
+ expect(manager.current_scene).toBe(scene_y);
103
+
104
+ manager.stackPop();
105
+
106
+ expect(manager.current_scene).toBe(scene_x);
107
+ });
@@ -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;
@@ -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
 
@@ -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
 
@@ -1,175 +0,0 @@
1
- /**
2
- * 2-D line Mathematics
3
- * @author Alex Goldring 2019
4
- * @copyright Alex Goldring 2019
5
- */
6
-
7
- /**
8
- *
9
- * @constructor
10
- */
11
- function LineSegment2() {
12
-
13
- }
14
-
15
- /**
16
- * @param {Vector2} p0
17
- * @param {Vector2} p1
18
- * @param {Vector2} p2
19
- * @param {Vector2} p3
20
- * @returns {[number,number]}
21
- */
22
- export function computeLine2Intersection(p0, p1, p2, p3) {
23
- const p0_x = p0.x;
24
- const p0_y = p0.y;
25
- const p1_x = p1.x;
26
- const p1_y = p1.y;
27
- const p2_x = p2.x;
28
- const p2_y = p2.y;
29
- const p3_x = p3.x;
30
- const p3_y = p3.y;
31
-
32
- const result = [];
33
-
34
- if (line2_line2_intersection(result, p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y)) {
35
- return result;
36
- } else {
37
- return null; // No collision
38
- }
39
-
40
- }
41
-
42
- /**
43
- *
44
- * @param {number[]} result
45
- * @param {number} a0_x
46
- * @param {number} a0_y
47
- * @param {number} a1_x
48
- * @param {number} a1_y
49
- * @param {number} b2_x
50
- * @param {number} b2_y
51
- * @param {number} b3_x
52
- * @param {number} b3_y
53
- * @return {boolean}
54
- */
55
- export function line2_line2_intersection(result, a0_x, a0_y, a1_x, a1_y, b2_x, b2_y, b3_x, b3_y) {
56
-
57
- const s1_x = a1_x - a0_x;
58
- const s1_y = a1_y - a0_y;
59
- const s2_x = b3_x - b2_x;
60
- const s2_y = b3_y - b2_y;
61
-
62
- const dy_02 = a0_y - b2_y;
63
- const dx_02 = a0_x - b2_x;
64
-
65
- const denom = -s2_x * s1_y + s1_x * s2_y;
66
-
67
- const s = (-s1_y * dx_02 + s1_x * dy_02) / denom;
68
- const t = (s2_x * dy_02 - s2_y * dx_02) / denom;
69
-
70
- if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
71
- // Collision detected
72
-
73
- const intX = a0_x + (t * s1_x);
74
- const intY = a0_y + (t * s1_y);
75
-
76
- result[0] = intX;
77
- result[1] = intY;
78
-
79
- return true;
80
- }
81
-
82
- return false; // No collision
83
- }
84
-
85
- /**
86
- * Adapted from answer by iMalc from stackoverflow.com "how do you detect where two line segments intersect"
87
- * @link https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
88
- * @param {Vector2} a0 start of first segment
89
- * @param {Vector2} a1 end of first segment
90
- * @param {Vector2} b0 start of second segment
91
- * @param {Vector2} b1 end of second segment
92
- * @param {Vector2} result resulting intersection point will be stored here if intersection exists
93
- * @returns {boolean} True if segments intersect, False otherwise
94
- */
95
- function intersectionPoint(a0, a1, b0, b1, result) {
96
- return intersectionPointRaw(a0.x, a0.y, a1.x, a1.y, b0.x, b0.y, b1.x, b1.y, result);
97
- }
98
-
99
- /**
100
- *
101
- * @param {number} a0_x
102
- * @param {number} a0_y
103
- * @param {number} a1_x
104
- * @param {number} a1_y
105
- * @param {number} b0_x
106
- * @param {number} b0_y
107
- * @param {number} b1_x
108
- * @param {number} b1_y
109
- * @returns {boolean} True if segments intersect, False otherwise
110
- * @public
111
- */
112
- export function line2SegmentsIntersect(a0_x, a0_y, a1_x, a1_y, b0_x, b0_y, b1_x, b1_y) {
113
- const s1_x = a1_x - a0_x;
114
- const s1_y = a1_y - a0_y;
115
- const s2_x = b1_x - b0_x;
116
- const s2_y = b1_y - b0_y;
117
-
118
-
119
- const denom = (-s2_x * s1_y + s1_x * s2_y);
120
-
121
- const dy0_ab = a0_y - b0_y;
122
- const dx0_ab = a0_x - b0_x;
123
-
124
- const s = (-s1_y * dx0_ab + s1_x * dy0_ab) / denom;
125
- const t = (s2_x * dy0_ab - s2_y * dx0_ab) / denom;
126
-
127
- return s >= 0 && s <= 1 && t >= 0 && t <= 1;
128
- }
129
-
130
-
131
- /**
132
- *
133
- * @param {number} a0_x
134
- * @param {number} a0_y
135
- * @param {number} a1_x
136
- * @param {number} a1_y
137
- * @param {number} b0_x
138
- * @param {number} b0_y
139
- * @param {number} b1_x
140
- * @param {number} b1_y
141
- * @param {Vector2} result resulting intersection point will be stored here if intersection exists
142
- * @returns {boolean} True if segments intersect, False otherwise
143
- * @public
144
- */
145
- function intersectionPointRaw(a0_x, a0_y, a1_x, a1_y, b0_x, b0_y, b1_x, b1_y, result) {
146
- const s1_x = a1_x - a0_x;
147
- const s1_y = a1_y - a0_y;
148
- const s2_x = b1_x - b0_x;
149
- const s2_y = b1_y - b0_y;
150
-
151
-
152
- const denom = (-s2_x * s1_y + s1_x * s2_y);
153
-
154
- const s = (-s1_y * (a0_x - b0_x) + s1_x * (a0_y - b0_y)) / denom;
155
- const t = (s2_x * (a0_y - b0_y) - s2_y * (a0_x - b0_x)) / denom;
156
-
157
- if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
158
- // Collision detected
159
-
160
- const i_x = a0_x + (t * s1_x);
161
- const i_y = a0_y + (t * s1_y);
162
-
163
- result.set(i_x, i_y);
164
-
165
- return true;
166
- }
167
-
168
-
169
- return false;
170
- }
171
-
172
- LineSegment2.intersectionPoint = intersectionPoint;
173
- LineSegment2.intersectionPointRaw = intersectionPointRaw;
174
-
175
- export default LineSegment2;