@woosh/meep-engine 2.63.0 → 2.65.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 (69) hide show
  1. package/build/meep.cjs +5357 -5350
  2. package/build/meep.min.js +1 -1
  3. package/build/meep.module.js +5357 -5350
  4. package/package.json +1 -1
  5. package/src/core/binary/UINT16_MAX.js +5 -0
  6. package/src/core/bvh2/BinaryNode.js +14 -14
  7. package/src/core/bvh2/LeafNode.js +4 -4
  8. package/src/core/bvh2/bvh3/{ExplicitBinaryBoundingVolumeHierarchy.d.ts → BVH.d.ts} +1 -1
  9. package/src/core/bvh2/bvh3/{ExplicitBinaryBoundingVolumeHierarchy.js → BVH.js} +7 -7
  10. package/src/core/bvh2/bvh3/{ExplicitBinaryBoundingVolumeHierarchy.spec.js → BVH.spec.js} +20 -20
  11. package/src/core/bvh2/bvh3/{EBBVHLeafProxy.js → BvhClient.js} +3 -3
  12. package/src/core/bvh2/bvh3/BvhClient.spec.js +51 -0
  13. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +2 -2
  14. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +4 -4
  15. package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.spec.js +3 -3
  16. package/src/core/bvh2/bvh3/ebvh_sort_for_traversal_depth_first.js +2 -8
  17. package/src/core/bvh2/bvh3/query/BVHQuery.js +1 -1
  18. package/src/core/bvh2/bvh3/query/BVHQueryIntersectsFrustum.js +8 -10
  19. package/src/core/bvh2/bvh3/query/BVHQueryIntersectsRay.js +7 -7
  20. package/src/core/bvh2/bvh3/query/BVHQueryIntersectsSphere.js +37 -0
  21. package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +2 -2
  22. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +2 -2
  23. package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.spec.js +2 -2
  24. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +3 -8
  25. package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.spec.js +2 -2
  26. package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +13 -5
  27. package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.spec.js +29 -0
  28. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.js +3 -3
  29. package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.spec.js +3 -3
  30. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js +3 -3
  31. package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +4 -4
  32. package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.spec.js +3 -3
  33. package/src/core/collection/list/List.js +9 -3
  34. package/src/core/geom/3d/aabb/aabb3_from_v3_array.js +11 -4
  35. package/src/core/geom/Vector2.js +6 -4
  36. package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +22 -24
  37. package/src/engine/graphics/ecs/mesh/Mesh.js +8 -8
  38. package/src/engine/graphics/ecs/mesh/MeshSystem.js +3 -5
  39. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +6 -6
  40. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +3 -3
  41. package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +16 -18
  42. package/src/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +5 -5
  43. package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +9 -11
  44. package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +51 -88
  45. package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +41 -72
  46. package/src/engine/graphics/particles/particular/engine/emitter/write_particle_patch_uv.js +28 -0
  47. package/src/engine/graphics/render/forward_plus/LightManager.js +30 -32
  48. package/src/engine/graphics/render/forward_plus/LightRenderMetadata.js +3 -3
  49. package/src/engine/graphics/sh3/LightProbeVolume.js +19 -19
  50. package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +4 -6
  51. package/src/engine/graphics/sh3/path_tracer/PathTracer.js +17 -19
  52. package/src/engine/sound/ecs/emitter/SoundEmitter.js +18 -16
  53. package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +20 -22
  54. package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_sphere.js +0 -81
  55. package/src/engine/ecs/foliage/Foliage.js +0 -151
  56. package/src/engine/ecs/foliage/FoliageLoader.js +0 -39
  57. package/src/engine/ecs/foliage/FoliageVisibilitySetBuilder.js +0 -27
  58. package/src/engine/ecs/foliage/ImpostorFoliage.js +0 -106
  59. package/src/engine/ecs/foliage/InstancedFoliage.js +0 -395
  60. package/src/engine/ecs/foliage/ViewState.js +0 -181
  61. package/src/engine/ecs/foliage/ecs/Foliage2System.js +0 -333
  62. package/src/engine/ecs/foliage/ecs/InstancedMeshComponent.js +0 -70
  63. package/src/engine/ecs/foliage/ecs/InstancedMeshLayer.js +0 -138
  64. package/src/engine/ecs/foliage/ecs/InstancedMeshSerializationAdapter.js +0 -28
  65. package/src/engine/ecs/foliage/ecs/convertInstancedMeshComponents2Entities.js +0 -64
  66. package/src/engine/ecs/foliage/ecs/optimizeIndividualMeshesEntitiesToInstances.js +0 -233
  67. package/src/engine/save/storage/GooglePlayStorage.js +0 -47
  68. package/src/engine/save/storage/JsonStringCodec.js +0 -24
  69. /package/src/engine/sound/ecs/emitter/{SoundEmitter.spec.js → SoundEmitterSerializationAdapter.spec.js} +0 -0
@@ -1,12 +1,13 @@
1
- import { NULL_NODE } from "../ExplicitBinaryBoundingVolumeHierarchy.js";
1
+ import { assert } from "../../../assert.js";
2
2
  import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
3
+ import { NULL_NODE } from "../BVH.js";
3
4
 
4
5
  const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
5
6
 
6
7
 
7
8
  /**
8
9
  *
9
- * @param {ExplicitBinaryBoundingVolumeHierarchy} bvh
10
+ * @param {BVH} bvh
10
11
  * @param {number[]} result
11
12
  * @param {number} result_offset
12
13
  * @param {number} root
@@ -15,9 +16,15 @@ const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
15
16
  */
16
17
  export function bvh_query_user_data_generic(
17
18
  result, result_offset,
18
- bvh,root, query
19
+ bvh, root, query
19
20
  ) {
20
21
 
22
+ assert.isArrayLike(result, 'result');
23
+ assert.isNonNegativeInteger(result_offset, 'result_offset');
24
+ assert.defined(bvh, 'bvh');
25
+ assert.isNonNegativeInteger(root, 'root');
26
+ assert.defined(query, 'query');
27
+
21
28
  if (root === NULL_NODE) {
22
29
  return 0;
23
30
  }
@@ -44,13 +51,14 @@ export function bvh_query_user_data_generic(
44
51
  // test node against the query
45
52
  const pass = query.evaluate(node, bvh);
46
53
 
47
- if (!pass) {
54
+ if (pass === false) {
48
55
  continue;
49
56
  }
50
57
 
51
58
  const node_is_leaf = bvh.node_is_leaf(node);
52
59
 
53
- if (!node_is_leaf) {
60
+ if (node_is_leaf === false) {
61
+ // binary-node
54
62
 
55
63
  // read in-order
56
64
  const child1 = bvh.node_get_child1(node);
@@ -0,0 +1,29 @@
1
+ import { BVH } from "../BVH.js";
2
+ import { bvh_query_user_data_generic } from "./bvh_query_user_data_generic.js";
3
+ import { BVHQueryAny } from "./BVHQueryAny.js";
4
+
5
+ test("all-accepting query", () => {
6
+ const bvh = new BVH();
7
+
8
+ const leaf_a = bvh.allocate_node();
9
+ const leaf_b = bvh.allocate_node();
10
+
11
+ bvh.node_set_user_data(leaf_a, 7);
12
+ bvh.node_set_user_data(leaf_b, 13);
13
+
14
+ bvh.insert_leaf(leaf_a);
15
+ bvh.insert_leaf(leaf_b);
16
+
17
+ const result = [];
18
+
19
+ const count = bvh_query_user_data_generic(
20
+ result, 1,
21
+ bvh, bvh.root,
22
+ BVHQueryAny.INSTANCE
23
+ );
24
+
25
+ expect(count).toBe(2);
26
+ expect(result).toContain(7);
27
+ expect(result).toContain(13);
28
+
29
+ });
@@ -1,7 +1,7 @@
1
- import { NULL_NODE } from "../ExplicitBinaryBoundingVolumeHierarchy.js";
1
+ import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
2
2
  import { aabb3_signed_distance_sqr_to_point } from "../../../geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js";
3
3
  import { max2 } from "../../../math/max2.js";
4
- import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
4
+ import { NULL_NODE } from "../BVH.js";
5
5
 
6
6
  /**
7
7
  *
@@ -13,7 +13,7 @@ const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
13
13
 
14
14
  /**
15
15
  *
16
- * @param {ExplicitBinaryBoundingVolumeHierarchy} bvh
16
+ * @param {BVH} bvh
17
17
  * @param {number} x
18
18
  * @param {number} y
19
19
  * @param {number} z
@@ -1,13 +1,13 @@
1
- import { ExplicitBinaryBoundingVolumeHierarchy } from "../ExplicitBinaryBoundingVolumeHierarchy.js";
1
+ import { BVH } from "../BVH.js";
2
2
  import { bvh_query_user_data_nearest_to_point } from "./bvh_query_user_data_nearest_to_point.js";
3
3
 
4
4
  /**
5
5
  *
6
6
  * @param {number[]} boxes
7
- * @return {ExplicitBinaryBoundingVolumeHierarchy}
7
+ * @return {BVH}
8
8
  */
9
9
  function makeBvh(...boxes) {
10
- const r = new ExplicitBinaryBoundingVolumeHierarchy();
10
+ const r = new BVH();
11
11
 
12
12
  for (let i = 0; i < boxes.length; i++) {
13
13
  const box = boxes[i];
@@ -1,8 +1,8 @@
1
1
  //
2
- import { NULL_NODE } from "../ExplicitBinaryBoundingVolumeHierarchy.js";
2
+ import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
3
3
  import { aabb3_array_intersects_frustum_degree } from "../../../geom/3d/aabb/aabb3_array_intersects_frustum_degree.js";
4
+ import { NULL_NODE } from "../BVH.js";
4
5
  import { bvh_collect_user_data } from "./bvh_collect_user_data.js";
5
- import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
6
6
 
7
7
  const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
8
8
 
@@ -12,7 +12,7 @@ const scratch_aabb = new Float32Array(6);
12
12
  *
13
13
  * @param {number[]} result
14
14
  * @param {number} result_offset
15
- * @param {ExplicitBinaryBoundingVolumeHierarchy} bvh
15
+ * @param {BVH} bvh
16
16
  * @param {number[]|Float32Array} frustum
17
17
  */
18
18
  export function bvh_query_user_data_overlaps_frustum(
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
  import { array_copy } from "../../../collection/array/array_copy.js";
5
- import { NULL_NODE } from "../ExplicitBinaryBoundingVolumeHierarchy.js";
5
+ import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
6
6
  import { aabb3_array_intersects_frustum_degree } from "../../../geom/3d/aabb/aabb3_array_intersects_frustum_degree.js";
7
- import { bvh_collect_user_data } from "./bvh_collect_user_data.js";
8
7
  import { v3_distance_above_plane } from "../../../geom/vec3/v3_distance_above_plane.js";
9
- import { SCRATCH_UINT32_TRAVERSAL_STACK } from "../../../collection/SCRATCH_UINT32_TRAVERSAL_STACK.js";
8
+ import { NULL_NODE } from "../BVH.js";
9
+ import { bvh_collect_user_data } from "./bvh_collect_user_data.js";
10
10
 
11
11
  const stack = SCRATCH_UINT32_TRAVERSAL_STACK;
12
12
 
@@ -17,7 +17,7 @@ const scratch_aabb = [];
17
17
  * @param {number[]} result
18
18
  * @param {number} result_offset
19
19
  * @param {number} constrained_planes_mask if bit is set to 1, that plane is not allowed to move
20
- * @param {ExplicitBinaryBoundingVolumeHierarchy} bvh
20
+ * @param {BVH} bvh
21
21
  * @param {number[]|ArrayLike<number>|Float32Array} frustum
22
22
  */
23
23
  export function compute_tight_near_far_clipping_planes(result, result_offset, constrained_planes_mask, bvh, frustum) {
@@ -1,4 +1,4 @@
1
- import { ExplicitBinaryBoundingVolumeHierarchy } from "../ExplicitBinaryBoundingVolumeHierarchy.js";
1
+ import { BVH } from "../BVH.js";
2
2
  import { compute_tight_near_far_clipping_planes } from "./compute_tight_near_far_clipping_planes.js";
3
3
 
4
4
 
@@ -14,7 +14,7 @@ function orthographic_frustum(left, right, up, down, near, far) {
14
14
  }
15
15
 
16
16
  test('Empty does not throw', () => {
17
- const bvh = new ExplicitBinaryBoundingVolumeHierarchy();
17
+ const bvh = new BVH();
18
18
 
19
19
  const res = [];
20
20
 
@@ -26,7 +26,7 @@ test('Empty does not throw', () => {
26
26
  test.skip('Axis-aligned, orthographic tight fit around a single small node', () => {
27
27
  const frustum = orthographic_frustum(-1, 1, -1, 1, -1, 1);
28
28
 
29
- const bvh = new ExplicitBinaryBoundingVolumeHierarchy();
29
+ const bvh = new BVH();
30
30
 
31
31
  const leaf = bvh.allocate_node();
32
32
  bvh.node_set_aabb(leaf, [-0.1, -0.1, -0.1, 0.1, 0.1, 0.1]);
@@ -6,8 +6,8 @@
6
6
  import { assert } from "../../assert.js";
7
7
  import Signal from "../../events/signal/Signal.js";
8
8
  import { invokeObjectEquals } from "../../model/object/invokeObjectEquals.js";
9
- import { arraySetDiff } from "../array/arraySetDiff.js";
10
9
  import { arrayIndexByEquality } from "../array/arrayIndexByEquality.js";
10
+ import { arraySetDiff } from "../array/arraySetDiff.js";
11
11
 
12
12
 
13
13
  /**
@@ -51,9 +51,12 @@ class List {
51
51
  /**
52
52
  * Retrieve element at a given position in the list
53
53
  * @param {number} index
54
- * @returns {T}
54
+ * @returns {T|undefined}
55
55
  */
56
56
  get(index) {
57
+ assert.isNumber(index, 'index');
58
+ assert.isNonNegativeInteger(index, 'index');
59
+
57
60
  return this.data[index];
58
61
  }
59
62
 
@@ -63,6 +66,9 @@ class List {
63
66
  * @param {T} value
64
67
  */
65
68
  set(index, value) {
69
+ assert.isNumber(index, 'index');
70
+ assert.isNonNegativeInteger(index, 'index');
71
+
66
72
  const oldValue = this.data[index];
67
73
 
68
74
  if (oldValue !== undefined) {
@@ -183,7 +189,7 @@ class List {
183
189
  /**
184
190
  * Replace the data, replacements is performed surgically, meaning that diff is computed and add/remove operations are performed on the set
185
191
  * This method is tailored to work well with visualisation as only elements that's missing from the new set is removed, and only elements that are new to are added
186
- * Conversely, relevant events are dispatched that a visualisation can observe. This results in fewer changes required to the visualisation
192
+ * Conversely, relevant events are dispatched that can observe. This results in fewer changes required to the visualisation
187
193
  * @param {T[]} newOutput
188
194
  */
189
195
  patch(newOutput) {
@@ -1,10 +1,10 @@
1
- import { min2 } from "../../../math/min2.js";
2
- import { max2 } from "../../../math/max2.js";
3
1
  import { assert } from "../../../assert.js";
2
+ import { max2 } from "../../../math/max2.js";
3
+ import { min2 } from "../../../math/min2.js";
4
4
 
5
5
  /**
6
6
  *
7
- * @param {AABB3} result
7
+ * @param {ArrayLike<number>|number[]|Float32Array|AABB3} result
8
8
  * @param {number[]|ArrayLike<number>|Float32Array} input
9
9
  * @param {number} input_length length of the input array
10
10
  */
@@ -33,5 +33,12 @@ export function aabb3_from_v3_array(result, input, input_length) {
33
33
  z1 = max2(z, z1);
34
34
  }
35
35
 
36
- result.setBounds(x0, y0, z0, x1, y1, z1);
36
+ // read out
37
+ result[0] = x0;
38
+ result[1] = y0;
39
+ result[2] = z0;
40
+
41
+ result[3] = x1;
42
+ result[4] = y1;
43
+ result[5] = z1;
37
44
  }
@@ -6,11 +6,12 @@
6
6
  import { assert } from "../assert.js";
7
7
  import Signal from "../events/signal/Signal.js";
8
8
  import { clamp } from "../math/clamp.js";
9
+ import { EPSILON } from "../math/EPSILON.js";
10
+ import { epsilonEquals } from "../math/epsilonEquals.js";
9
11
  import { lerp } from "../math/lerp.js";
10
12
  import { max2 } from "../math/max2.js";
11
13
  import { min2 } from "../math/min2.js";
12
- import { EPSILON } from "../math/EPSILON.js";
13
- import { epsilonEquals } from "../math/epsilonEquals.js";
14
+ import { computeHashFloat } from "../primitives/numbers/computeHashFloat.js";
14
15
 
15
16
  class Vector2 {
16
17
  /**
@@ -542,8 +543,8 @@ class Vector2 {
542
543
  * @returns {number}
543
544
  */
544
545
  hash() {
545
- const x = Math.sin(this.x) * 1367130550;
546
- const y = Math.sin(this.y) * 1367130550;
546
+ const x = computeHashFloat(this.x);
547
+ const y = computeHashFloat(this.y);
547
548
 
548
549
  let hash = ((x << 5) - x) + y;
549
550
 
@@ -680,6 +681,7 @@ Vector2.one = Object.freeze(new Vector2(1, 1));
680
681
  * @type {boolean}
681
682
  */
682
683
  Vector2.prototype.isVector2 = true;
684
+
683
685
  /**
684
686
  *
685
687
  * @param {number} x0
@@ -1,34 +1,32 @@
1
- import { AbstractContextSystem } from "../../../../ecs/system/AbstractContextSystem.js";
2
- import { SystemEntityContext } from "../../../../ecs/system/SystemEntityContext.js";
3
- import { Decal } from "./Decal.js";
4
- import { Transform } from "../../../../ecs/transform/Transform.js";
5
- import { ForwardPlusRenderingPlugin } from "../../../render/forward_plus/plugin/ForwardPlusRenderingPlugin.js";
6
- import { Reference } from "../../../../reference/v2/Reference.js";
7
- import { Decal as FPDecal } from '../../../render/forward_plus/model/Decal.js';
8
- import { AssetManager } from "../../../../asset/AssetManager.js";
9
- import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
10
- import { GameAssetType } from "../../../../asset/GameAssetType.js";
1
+ import { mat4 } from "gl-matrix";
11
2
  import { assert } from "../../../../../core/assert.js";
12
- import { AsyncLoadingCache } from "../../../../../core/collection/map/AsyncLoadingCache.js";
13
- import { returnTrue } from "../../../../../core/function/Functions.js";
14
- import {
15
- ExplicitBinaryBoundingVolumeHierarchy
16
- } from "../../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
3
+ import { BVH } from "../../../../../core/bvh2/bvh3/BVH.js";
4
+ import { BvhClient } from "../../../../../core/bvh2/bvh3/BvhClient.js";
17
5
  import { bvh_query_leaves_ray } from "../../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
18
- import { ray3_array_apply_matrix4 } from "../../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
19
- import { ray3_array_compose } from "../../../../../core/geom/3d/ray/ray3_array_compose.js";
20
- import { mat4 } from "gl-matrix";
21
- import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
22
- import { EBBVHLeafProxy } from "../../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
23
- import { aabb3_matrix4_project } from "../../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
24
- import { aabb3_raycast } from "../../../../../core/geom/3d/aabb/aabb3_raycast.js";
25
6
  import {
26
7
  bvh_query_user_data_overlaps_frustum
27
8
  } from "../../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
9
+ import { AsyncLoadingCache } from "../../../../../core/collection/map/AsyncLoadingCache.js";
10
+ import { returnTrue } from "../../../../../core/function/Functions.js";
11
+ import { aabb3_matrix4_project } from "../../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
12
+ import { aabb3_raycast } from "../../../../../core/geom/3d/aabb/aabb3_raycast.js";
28
13
  import {
29
14
  aabb3_transformed_compute_plane_side
30
15
  } from "../../../../../core/geom/3d/aabb/aabb3_transformed_compute_plane_side.js";
16
+ import { ray3_array_apply_matrix4 } from "../../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
17
+ import { ray3_array_compose } from "../../../../../core/geom/3d/ray/ray3_array_compose.js";
18
+ import { SurfacePoint3 } from "../../../../../core/geom/3d/SurfacePoint3.js";
19
+ import { AssetManager } from "../../../../asset/AssetManager.js";
20
+ import { GameAssetType } from "../../../../asset/GameAssetType.js";
21
+ import { AbstractContextSystem } from "../../../../ecs/system/AbstractContextSystem.js";
22
+ import { SystemEntityContext } from "../../../../ecs/system/SystemEntityContext.js";
23
+ import { Transform } from "../../../../ecs/transform/Transform.js";
24
+ import { Reference } from "../../../../reference/v2/Reference.js";
25
+ import { Decal as FPDecal } from '../../../render/forward_plus/model/Decal.js';
26
+ import { ForwardPlusRenderingPlugin } from "../../../render/forward_plus/plugin/ForwardPlusRenderingPlugin.js";
27
+ import { Sampler2D } from "../../../texture/sampler/Sampler2D.js";
31
28
  import { sampler2d_ensure_uint8_RGBA } from "../../../texture/sampler/sampler2d_ensure_uint8_RGBA.js";
29
+ import { Decal } from "./Decal.js";
32
30
 
33
31
  const placeholder_texture = Sampler2D.uint8(4, 1, 1);
34
32
  placeholder_texture.data.fill(255);
@@ -64,7 +62,7 @@ class Context extends SystemEntityContext {
64
62
  */
65
63
  __fp_decal = null;
66
64
 
67
- #bvh_leaf = new EBBVHLeafProxy();
65
+ #bvh_leaf = new BvhClient();
68
66
 
69
67
  /**
70
68
  * @return {ForwardPlusRenderingPlugin}
@@ -229,7 +227,7 @@ class Context extends SystemEntityContext {
229
227
  *
230
228
  */
231
229
  export class FPDecalSystem extends AbstractContextSystem {
232
- bvh = new ExplicitBinaryBoundingVolumeHierarchy();
230
+ bvh = new BVH();
233
231
 
234
232
  /**
235
233
  *
@@ -1,16 +1,16 @@
1
1
  /**
2
2
  * Created by Alex Goldring on 25.02.2015.
3
3
  */
4
- import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
5
- import { getSkeletonBoneByType } from "./SkeletonUtils.js";
6
4
  import { assert } from "../../../../core/assert.js";
5
+ import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
6
+ import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
7
+ import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
8
+ import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
9
+ import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
7
10
  import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
8
11
  import { Transform } from "../../../ecs/transform/Transform.js";
9
12
  import { applyTransformToThreeObject } from "./applyTransformToThreeObject.js";
10
- import { computeHashIntegerArray } from "../../../../core/collection/array/computeHashIntegerArray.js";
11
- import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
12
- import { EBBVHLeafProxy } from "../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
13
- import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
13
+ import { getSkeletonBoneByType } from "./SkeletonUtils.js";
14
14
 
15
15
  /**
16
16
  *
@@ -71,9 +71,9 @@ class Mesh {
71
71
 
72
72
  /**
73
73
  *
74
- * @type {EBBVHLeafProxy}
74
+ * @type {BvhClient}
75
75
  */
76
- this.__bvh_leaf = new EBBVHLeafProxy();
76
+ this.__bvh_leaf = new BvhClient();
77
77
 
78
78
  /**
79
79
  * @private
@@ -5,9 +5,7 @@
5
5
 
6
6
  import { BoxBufferGeometry, MeshLambertMaterial } from "three";
7
7
  import { assert } from "../../../../core/assert.js";
8
- import {
9
- ExplicitBinaryBoundingVolumeHierarchy
10
- } from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
8
+ import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
11
9
  import {
12
10
  bvh_query_user_data_overlaps_frustum
13
11
  } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
@@ -97,10 +95,10 @@ export class MeshSystem extends System {
97
95
 
98
96
  /**
99
97
  *
100
- * @type {ExplicitBinaryBoundingVolumeHierarchy}
98
+ * @type {BVH}
101
99
  * @private
102
100
  */
103
- this.__bvh_binary = new ExplicitBinaryBoundingVolumeHierarchy();
101
+ this.__bvh_binary = new BVH();
104
102
  }
105
103
 
106
104
  /**
@@ -1,12 +1,12 @@
1
+ import { mat4 } from "gl-matrix";
2
+ import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
1
3
  import { AABB3 } from "../../../../core/geom/3d/aabb/AABB3.js";
2
- import { DrawMode } from "./DrawMode.js";
3
- import { ShadedGeometryFlags } from "./ShadedGeometryFlags.js";
4
+ import { aabb3_from_threejs_geometry } from "../../../../core/geom/3d/aabb/aabb3_from_threejs_geometry.js";
4
5
  import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
5
- import { mat4 } from "gl-matrix";
6
6
  import { ray3_array_apply_matrix4 } from "../../../../core/geom/3d/ray/ray3_array_apply_matrix4.js";
7
7
  import { GeometrySpatialQueryAccelerator } from "../../geometry/buffered/query/GeometrySpatialQueryAccelerator.js";
8
- import { EBBVHLeafProxy } from "../../../../core/bvh2/bvh3/EBBVHLeafProxy.js";
9
- import { aabb3_from_threejs_geometry } from "../../../../core/geom/3d/aabb/aabb3_from_threejs_geometry.js";
8
+ import { DrawMode } from "./DrawMode.js";
9
+ import { ShadedGeometryFlags } from "./ShadedGeometryFlags.js";
10
10
 
11
11
  /**
12
12
  * @readonly
@@ -60,7 +60,7 @@ export class ShadedGeometry {
60
60
  */
61
61
  this.depth_material = null;
62
62
 
63
- this.__bvh_leaf = new EBBVHLeafProxy();
63
+ this.__bvh_leaf = new BvhClient();
64
64
 
65
65
  /**
66
66
  * Transient, assigned in the system
@@ -1,13 +1,13 @@
1
+ import {BVH} from "../../../../core/bvh2/bvh3/BVH";
2
+ import {SurfacePoint3} from "../../../../core/geom/3d/SurfacePoint3";
1
3
  import {System} from "../../../ecs/System";
2
4
  import Engine from "../../../Engine";
3
5
  import {ShadedGeometry} from "./ShadedGeometry";
4
- import {SurfacePoint3} from "../../../../core/geom/3d/SurfacePoint3";
5
- import {ExplicitBinaryBoundingVolumeHierarchy} from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy";
6
6
 
7
7
  export class ShadedGeometrySystem extends System<ShadedGeometry> {
8
8
  constructor(engine: Engine)
9
9
 
10
- readonly bvh: ExplicitBinaryBoundingVolumeHierarchy
10
+ readonly bvh: BVH
11
11
 
12
12
  raycastNearest(
13
13
  contact: SurfacePoint3,
@@ -1,26 +1,24 @@
1
- import { ShadedGeometry } from "./ShadedGeometry.js";
2
- import { Transform } from "../../../ecs/transform/Transform.js";
3
- import { System } from "../../../ecs/System.js";
4
- import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
5
- import { v3_distance_sqr } from "../../../../core/geom/vec3/v3_distance_sqr.js";
6
1
  import { mat4 } from "gl-matrix";
7
- import { returnTrue } from "../../../../core/function/Functions.js";
8
- import { ShadedGeometryRendererContext } from "./render/ShadedGeometryRendererContext.js";
9
2
  import { assert } from "../../../../core/assert.js";
10
- import { ray3_array_compose } from "../../../../core/geom/3d/ray/ray3_array_compose.js";
11
- import {
12
- ExplicitBinaryBoundingVolumeHierarchy
13
- } from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
3
+ import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
14
4
  import { bvh_query_leaves_generic } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_generic.js";
5
+ import {
6
+ bvh_query_user_data_overlaps_frustum
7
+ } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
15
8
  import { BVHQueryIntersectsRay } from "../../../../core/bvh2/bvh3/query/BVHQueryIntersectsRay.js";
9
+ import { returnTrue } from "../../../../core/function/Functions.js";
10
+ import { ray3_array_compose } from "../../../../core/geom/3d/ray/ray3_array_compose.js";
11
+ import { SurfacePoint3 } from "../../../../core/geom/3d/SurfacePoint3.js";
12
+ import { v3_distance_sqr } from "../../../../core/geom/vec3/v3_distance_sqr.js";
16
13
  import Task from "../../../../core/process/task/Task.js";
17
- import { RuntimeDrawMethodOptimizer } from "./render/optimization/RuntimeDrawMethodOptimizer.js";
18
14
  import { TaskSignal } from "../../../../core/process/task/TaskSignal.js";
19
15
  import TaskState from "../../../../core/process/task/TaskState.js";
20
- import {
21
- bvh_query_user_data_overlaps_frustum
22
- } from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
23
16
  import { iteratorTask } from "../../../../core/process/task/util/iteratorTask.js";
17
+ import { System } from "../../../ecs/System.js";
18
+ import { Transform } from "../../../ecs/transform/Transform.js";
19
+ import { RuntimeDrawMethodOptimizer } from "./render/optimization/RuntimeDrawMethodOptimizer.js";
20
+ import { ShadedGeometryRendererContext } from "./render/ShadedGeometryRendererContext.js";
21
+ import { ShadedGeometry } from "./ShadedGeometry.js";
24
22
 
25
23
 
26
24
  /**
@@ -106,10 +104,10 @@ export class ShadedGeometrySystem extends System {
106
104
 
107
105
  /**
108
106
  *
109
- * @type {ExplicitBinaryBoundingVolumeHierarchy}
107
+ * @type {BVH}
110
108
  * @private
111
109
  */
112
- this.__bvh_binary = new ExplicitBinaryBoundingVolumeHierarchy();
110
+ this.__bvh_binary = new BVH();
113
111
 
114
112
  const optimizer = new RuntimeDrawMethodOptimizer();
115
113
 
@@ -137,7 +135,7 @@ export class ShadedGeometrySystem extends System {
137
135
 
138
136
  /**
139
137
  *
140
- * @returns {ExplicitBinaryBoundingVolumeHierarchy}
138
+ * @returns {BVH}
141
139
  */
142
140
  get bvh() {
143
141
  return this.__bvh_binary;
@@ -1,12 +1,12 @@
1
- import { AbstractRenderAdapter } from "./adapters/AbstractRenderAdapter.js";
2
- import { InstancedRendererAdapter } from "./adapters/InstancedRendererAdapter.js";
3
- import { GenericRendererAdapter } from "./adapters/GenericRendererAdapter.js";
4
1
  import { assert } from "../../../../../core/assert.js";
5
- import { ShadedGeometry } from "../ShadedGeometry.js";
6
2
  import {
7
3
  bvh_query_user_data_overlaps_frustum
8
4
  } from "../../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
5
+ import { ShadedGeometry } from "../ShadedGeometry.js";
9
6
  import { ShadedGeometryFlags } from "../ShadedGeometryFlags.js";
7
+ import { AbstractRenderAdapter } from "./adapters/AbstractRenderAdapter.js";
8
+ import { GenericRendererAdapter } from "./adapters/GenericRendererAdapter.js";
9
+ import { InstancedRendererAdapter } from "./adapters/InstancedRendererAdapter.js";
10
10
 
11
11
  /**
12
12
  *
@@ -95,7 +95,7 @@ export class ShadedGeometryRendererContext {
95
95
  * @param {number} destination_offset
96
96
  * @param {THREE.WebGLRenderer} renderer
97
97
  * @param {CameraView} view
98
- * @param {ExplicitBinaryBoundingVolumeHierarchy} bvh
98
+ * @param {BVH} bvh
99
99
  * @param {EntityComponentDataset} ecd
100
100
  */
101
101
  collect(destination, destination_offset, renderer, view, bvh, ecd) {
@@ -1,13 +1,11 @@
1
- import {
2
- ExplicitBinaryBoundingVolumeHierarchy
3
- } from "../../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
1
+ import { BVH } from "../../../../../core/bvh2/bvh3/BVH.js";
4
2
  import List from "../../../../../core/collection/list/List.js";
5
- import {ParticleEmitterFlag} from "./emitter/ParticleEmitterFlag.js";
6
- import {ShaderManager} from "./shader/ShaderManager.js";
7
- import {SimulationStepApplyForce} from "./simulator/SimulationStepApplyForce.js";
8
- import {SimulationStepCurlNoiseAcceleration} from "./simulator/SimulationStepCurlNoiseAcceleration.js";
9
- import {SimulationStepCurlNoiseVelocity} from "./simulator/SimulationStepCurlNoiseVelocity.js";
10
- import {SimulationStepFixedPhysics} from "./simulator/SimulationStepFixedPhysics.js";
3
+ import { ParticleEmitterFlag } from "./emitter/ParticleEmitterFlag.js";
4
+ import { ShaderManager } from "./shader/ShaderManager.js";
5
+ import { SimulationStepApplyForce } from "./simulator/SimulationStepApplyForce.js";
6
+ import { SimulationStepCurlNoiseAcceleration } from "./simulator/SimulationStepCurlNoiseAcceleration.js";
7
+ import { SimulationStepCurlNoiseVelocity } from "./simulator/SimulationStepCurlNoiseVelocity.js";
8
+ import { SimulationStepFixedPhysics } from "./simulator/SimulationStepFixedPhysics.js";
11
9
 
12
10
 
13
11
  export class ParticularEngine {
@@ -25,9 +23,9 @@ export class ParticularEngine {
25
23
 
26
24
  /**
27
25
  * @readonly
28
- * @type {ExplicitBinaryBoundingVolumeHierarchy}
26
+ * @type {BVH}
29
27
  */
30
- bvh = new ExplicitBinaryBoundingVolumeHierarchy();
28
+ bvh = new BVH();
31
29
 
32
30
 
33
31
  /**