@woosh/meep-engine 2.64.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.
- package/build/meep.cjs +5345 -5345
- package/build/meep.min.js +1 -1
- package/build/meep.module.js +5345 -5345
- package/package.json +1 -1
- package/src/core/bvh2/BinaryNode.js +14 -14
- package/src/core/bvh2/LeafNode.js +4 -4
- package/src/core/bvh2/bvh3/{ExplicitBinaryBoundingVolumeHierarchy.d.ts → BVH.d.ts} +1 -1
- package/src/core/bvh2/bvh3/{ExplicitBinaryBoundingVolumeHierarchy.js → BVH.js} +2 -2
- package/src/core/bvh2/bvh3/{ExplicitBinaryBoundingVolumeHierarchy.spec.js → BVH.spec.js} +20 -20
- package/src/core/bvh2/bvh3/{EBBVHLeafProxy.js → BvhClient.js} +3 -3
- package/src/core/bvh2/bvh3/BvhClient.spec.js +51 -0
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_incremental.js +2 -2
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.js +4 -4
- package/src/core/bvh2/bvh3/ebvh_build_for_geometry_morton.spec.js +3 -3
- package/src/core/bvh2/bvh3/ebvh_sort_for_traversal_depth_first.js +2 -8
- package/src/core/bvh2/bvh3/query/BVHQuery.js +1 -1
- package/src/core/bvh2/bvh3/query/bvh_collect_user_data.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_generic.spec.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.js +3 -8
- package/src/core/bvh2/bvh3/query/bvh_query_leaves_ray.spec.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_generic.spec.js +2 -2
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.js +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_nearest_to_point.spec.js +3 -3
- package/src/core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js +3 -3
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.js +4 -4
- package/src/core/bvh2/bvh3/query/compute_tight_near_far_clipping_planes.spec.js +3 -3
- package/src/engine/graphics/ecs/decal/v2/FPDecalSystem.js +22 -24
- package/src/engine/graphics/ecs/mesh/Mesh.js +8 -8
- package/src/engine/graphics/ecs/mesh/MeshSystem.js +3 -5
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +6 -6
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +3 -3
- package/src/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.js +16 -18
- package/src/engine/graphics/ecs/mesh-v2/render/ShadedGeometryRendererContext.js +5 -5
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +9 -11
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +3 -3
- package/src/engine/graphics/render/forward_plus/LightManager.js +30 -32
- package/src/engine/graphics/render/forward_plus/LightRenderMetadata.js +3 -3
- package/src/engine/graphics/sh3/LightProbeVolume.js +19 -19
- package/src/engine/graphics/sh3/path_tracer/GeometryBVHBatched.js +4 -6
- package/src/engine/graphics/sh3/path_tracer/PathTracer.js +17 -19
- package/src/engine/sound/ecs/emitter/SoundEmitter.js +18 -16
- package/src/engine/sound/ecs/emitter/SoundEmitterSystem.js +3 -5
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
13
|
-
import {
|
|
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
|
|
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
|
|
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 {
|
|
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 {
|
|
74
|
+
* @type {BvhClient}
|
|
75
75
|
*/
|
|
76
|
-
this.__bvh_leaf = new
|
|
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 {
|
|
98
|
+
* @type {BVH}
|
|
101
99
|
* @private
|
|
102
100
|
*/
|
|
103
|
-
this.__bvh_binary = new
|
|
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 {
|
|
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 {
|
|
9
|
-
import {
|
|
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
|
|
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:
|
|
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 {
|
|
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 {
|
|
107
|
+
* @type {BVH}
|
|
110
108
|
* @private
|
|
111
109
|
*/
|
|
112
|
-
this.__bvh_binary = new
|
|
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 {
|
|
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 {
|
|
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 {
|
|
26
|
+
* @type {BVH}
|
|
29
27
|
*/
|
|
30
|
-
bvh = new
|
|
28
|
+
bvh = new BVH();
|
|
31
29
|
|
|
32
30
|
|
|
33
31
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Box3, BufferGeometry, Frustum, Points, PointsMaterial } from 'three';
|
|
2
2
|
import { assert } from "../../../../../../core/assert.js";
|
|
3
|
-
import {
|
|
3
|
+
import { BvhClient } from "../../../../../../core/bvh2/bvh3/BvhClient.js";
|
|
4
4
|
import { computeHashIntegerArray } from "../../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
5
5
|
import List from "../../../../../../core/collection/list/List.js";
|
|
6
6
|
import { AABB3 } from "../../../../../../core/geom/3d/aabb/AABB3.js";
|
|
@@ -144,9 +144,9 @@ export class ParticleEmitter {
|
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
146
|
* @readonly
|
|
147
|
-
* @type {
|
|
147
|
+
* @type {BvhClient}
|
|
148
148
|
*/
|
|
149
|
-
bvh_leaf = new
|
|
149
|
+
bvh_leaf = new BvhClient();
|
|
150
150
|
|
|
151
151
|
|
|
152
152
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mat4 } from "gl-matrix";
|
|
2
2
|
import {
|
|
3
3
|
ClampToEdgeWrapping,
|
|
4
4
|
DataTexture,
|
|
@@ -12,45 +12,43 @@ import {
|
|
|
12
12
|
UnsignedByteType,
|
|
13
13
|
UnsignedShortType
|
|
14
14
|
} from "three";
|
|
15
|
-
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
16
|
-
import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js";
|
|
17
|
-
import { computeFrustumCorners } from "./computeFrustumCorners.js";
|
|
18
|
-
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
19
|
-
import { read_frustum_planes_to_array } from "../../../../core/geom/3d/frustum/read_frustum_planes_to_array.js";
|
|
20
|
-
import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
|
|
21
|
-
import { TextureBackedMemoryRegion } from "../../texture/TextureBackedMemoryRegion.js";
|
|
22
15
|
import { assert } from "../../../../core/assert.js";
|
|
16
|
+
import { computeBinaryDataTypeByPrecision } from "../../../../core/binary/type/computeBinaryDataTypeByPrecision.js";
|
|
23
17
|
import {
|
|
24
18
|
DataType2TypedArrayConstructorMapping
|
|
25
19
|
} from "../../../../core/binary/type/DataType2TypedArrayConstructorMapping.js";
|
|
26
|
-
import { NumericType } from "../../../../core/math/NumericType.js";
|
|
27
|
-
import { computeBinaryDataTypeByPrecision } from "../../../../core/binary/type/computeBinaryDataTypeByPrecision.js";
|
|
28
|
-
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
29
|
-
import {
|
|
30
|
-
computeThreeTextureInternalFormatFromDataType
|
|
31
|
-
} from "../../texture/computeThreeTextureInternalFormatFromDataType.js";
|
|
32
20
|
import { BinaryUint32BVH } from "../../../../core/bvh2/binary/2/BinaryUint32BVH.js";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
import { Decal } from "./model/Decal.js";
|
|
38
|
-
import { ReferencedTextureAtlas } from "../../texture/atlas/ReferencedTextureAtlas.js";
|
|
39
|
-
import { v3_morton_encode_transformed } from "../../../../core/geom/3d/morton/v3_morton_encode_transformed.js";
|
|
40
|
-
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
21
|
+
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
22
|
+
import {
|
|
23
|
+
bvh_query_user_data_overlaps_frustum
|
|
24
|
+
} from "../../../../core/bvh2/bvh3/query/bvh_query_user_data_overlaps_frustum.js";
|
|
41
25
|
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
42
26
|
import { arrayQuickSort } from "../../../../core/collection/array/arrayQuickSort.js";
|
|
43
|
-
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
44
27
|
import { arraySwapElements } from "../../../../core/collection/array/arraySwapElements.js";
|
|
45
|
-
import { slice_frustum_linear_to_points } from "../../../../core/geom/3d/frustum/slice_frustum_linear_to_points.js";
|
|
46
28
|
import { read_cluster_frustum_corners } from "../../../../core/geom/3d/frustum/read_cluster_frustum_corners.js";
|
|
47
|
-
import {
|
|
48
|
-
import {
|
|
49
|
-
|
|
50
|
-
} from "../../../../core/
|
|
29
|
+
import { read_frustum_planes_to_array } from "../../../../core/geom/3d/frustum/read_frustum_planes_to_array.js";
|
|
30
|
+
import { slice_frustum_linear_to_points } from "../../../../core/geom/3d/frustum/slice_frustum_linear_to_points.js";
|
|
31
|
+
import { v3_morton_encode_transformed } from "../../../../core/geom/3d/morton/v3_morton_encode_transformed.js";
|
|
32
|
+
import { v3_distance } from "../../../../core/geom/vec3/v3_distance.js";
|
|
33
|
+
import Vector3 from "../../../../core/geom/Vector3.js";
|
|
34
|
+
import { NumericType } from "../../../../core/math/NumericType.js";
|
|
35
|
+
import { frustum_from_camera } from "../../ecs/camera/frustum_from_camera.js";
|
|
36
|
+
import { CachingTextureAtlas } from "../../texture/atlas/CachingTextureAtlas.js";
|
|
37
|
+
import { ReferencedTextureAtlas } from "../../texture/atlas/ReferencedTextureAtlas.js";
|
|
38
|
+
import { TextureAtlas } from "../../texture/atlas/TextureAtlas.js";
|
|
51
39
|
import {
|
|
52
|
-
|
|
53
|
-
} from "
|
|
40
|
+
computeThreeTextureInternalFormatFromDataType
|
|
41
|
+
} from "../../texture/computeThreeTextureInternalFormatFromDataType.js";
|
|
42
|
+
import { computeThreeTextureTypeFromDataType } from "../../texture/computeThreeTextureTypeFromDataType.js";
|
|
43
|
+
import { writeSample2DDataToDataTexture } from "../../texture/sampler/writeSampler2DDataToDataTexture.js";
|
|
44
|
+
import { TextureBackedMemoryRegion } from "../../texture/TextureBackedMemoryRegion.js";
|
|
45
|
+
import { IncrementalDeltaSet } from "../visibility/IncrementalDeltaSet.js";
|
|
46
|
+
import { assign_cluster, LOOKUP_CACHE, scratch_corners, scratch_frustum_planes } from "./assign_cluster.js";
|
|
47
|
+
import { compute_cluster_planes_from_points } from "./cluster/compute_cluster_planes_from_points.js";
|
|
48
|
+
import { read_plane_pair } from "./cluster/read_plane_pair.js";
|
|
49
|
+
import { computeFrustumCorners } from "./computeFrustumCorners.js";
|
|
50
|
+
import { LightRenderMetadata } from "./LightRenderMetadata.js";
|
|
51
|
+
import { Decal } from "./model/Decal.js";
|
|
54
52
|
import { point_light_inside_volume } from "./query/point_light_inside_volume.js";
|
|
55
53
|
|
|
56
54
|
|
|
@@ -137,9 +135,9 @@ export class LightManager {
|
|
|
137
135
|
|
|
138
136
|
/**
|
|
139
137
|
* @readonly
|
|
140
|
-
* @type {
|
|
138
|
+
* @type {BVH}
|
|
141
139
|
*/
|
|
142
|
-
#light_data_bvh = new
|
|
140
|
+
#light_data_bvh = new BVH();
|
|
143
141
|
|
|
144
142
|
/**
|
|
145
143
|
* Mapping from a light/decal object ID internal metadata
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BvhClient } from "../../../../core/bvh2/bvh3/BvhClient.js";
|
|
2
2
|
|
|
3
3
|
export class LightRenderMetadata {
|
|
4
4
|
|
|
@@ -20,7 +20,7 @@ export class LightRenderMetadata {
|
|
|
20
20
|
*/
|
|
21
21
|
this.address = 0;
|
|
22
22
|
|
|
23
|
-
this.bvh_leaf = new
|
|
23
|
+
this.bvh_leaf = new BvhClient();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
@@ -42,7 +42,7 @@ export class LightRenderMetadata {
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
*
|
|
45
|
-
* @param {
|
|
45
|
+
* @param {BVH} bvh
|
|
46
46
|
*/
|
|
47
47
|
link(bvh) {
|
|
48
48
|
this.bvh_leaf.link(bvh, this.light.id);
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { TetrahedralMesh } from "../../../core/geom/3d/tetrahedra/TetrahedralMesh.js";
|
|
2
|
-
import {
|
|
3
|
-
compute_delaunay_tetrahedral_mesh
|
|
4
|
-
} from "../../../core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js";
|
|
5
|
-
import { visualise_probe } from "./visualise_probe.js";
|
|
6
|
-
import {
|
|
7
|
-
build_tetrahedral_mesh_buffer_geometry
|
|
8
|
-
} from "../../../core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js";
|
|
9
|
-
import Entity from "../../ecs/Entity.js";
|
|
10
|
-
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
11
1
|
import {
|
|
12
2
|
CubeCamera,
|
|
13
3
|
LinearEncoding,
|
|
@@ -17,19 +7,29 @@ import {
|
|
|
17
7
|
Scene,
|
|
18
8
|
WebGLCubeRenderTarget
|
|
19
9
|
} from "three";
|
|
20
|
-
import { DrawMode } from "../ecs/mesh-v2/DrawMode.js";
|
|
21
|
-
import { Transform } from "../../ecs/transform/Transform.js";
|
|
22
10
|
import { array_copy } from "../../../core/collection/array/array_copy.js";
|
|
11
|
+
import { sh3_basis_at } from "../../../core/geom/3d/sphere/harmonics/sh3_basis_at.js";
|
|
12
|
+
import { sh3_dering_optimize_positive } from "../../../core/geom/3d/sphere/harmonics/sh3_dering_optimize_positive.js";
|
|
23
13
|
import { SurfacePoint3 } from "../../../core/geom/3d/SurfacePoint3.js";
|
|
24
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
build_tetrahedral_mesh_buffer_geometry
|
|
16
|
+
} from "../../../core/geom/3d/tetrahedra/build_tetrahedral_mesh_buffer_geometry.js";
|
|
17
|
+
import {
|
|
18
|
+
compute_delaunay_tetrahedral_mesh
|
|
19
|
+
} from "../../../core/geom/3d/tetrahedra/delaunay/compute_delaunay_tetrahedral_mesh.js";
|
|
20
|
+
import { TetrahedralMesh } from "../../../core/geom/3d/tetrahedra/TetrahedralMesh.js";
|
|
21
|
+
import { v3_length_sqr } from "../../../core/geom/vec3/v3_length_sqr.js";
|
|
22
|
+
import Entity from "../../ecs/Entity.js";
|
|
23
|
+
import { Transform } from "../../ecs/transform/Transform.js";
|
|
25
24
|
import { threeMakeLight } from "../ecs/light/binding/three/threeMakeLight.js";
|
|
25
|
+
import { Light } from "../ecs/light/Light.js";
|
|
26
26
|
import { ThreeLightCache } from "../ecs/light/three/ThreeLightCache.js";
|
|
27
|
-
import { applyTransformToThreeObject } from "../ecs/mesh/applyTransformToThreeObject.js";
|
|
28
27
|
import { build_three_object } from "../ecs/mesh-v2/build_three_object.js";
|
|
28
|
+
import { DrawMode } from "../ecs/mesh-v2/DrawMode.js";
|
|
29
|
+
import { ShadedGeometry } from "../ecs/mesh-v2/ShadedGeometry.js";
|
|
29
30
|
import { ShadedGeometryFlags } from "../ecs/mesh-v2/ShadedGeometryFlags.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import { sh3_basis_at } from "../../../core/geom/3d/sphere/harmonics/sh3_basis_at.js";
|
|
31
|
+
import { applyTransformToThreeObject } from "../ecs/mesh/applyTransformToThreeObject.js";
|
|
32
|
+
import { visualise_probe } from "./visualise_probe.js";
|
|
33
33
|
|
|
34
34
|
const TEMP_CONTACT = new SurfacePoint3();
|
|
35
35
|
|
|
@@ -333,7 +333,7 @@ class Baker {
|
|
|
333
333
|
|
|
334
334
|
/**
|
|
335
335
|
*
|
|
336
|
-
* @type {
|
|
336
|
+
* @type {BVH|null}
|
|
337
337
|
* @private
|
|
338
338
|
*/
|
|
339
339
|
this.__bvh = null;
|
|
@@ -345,7 +345,7 @@ class Baker {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
|
-
* @param {
|
|
348
|
+
* @param {BVH} bvh
|
|
349
349
|
*/
|
|
350
350
|
set_bvh(bvh) {
|
|
351
351
|
this.__bvh = bvh;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
|
|
1
|
+
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
2
|
+
import { ebvh_build_for_geometry_morton } from "../../../../core/bvh2/bvh3/ebvh_build_for_geometry_morton.js";
|
|
4
3
|
import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
|
|
5
4
|
import {
|
|
6
5
|
aabb3_signed_distance_sqr_to_point
|
|
7
6
|
} from "../../../../core/geom/3d/aabb/aabb3_signed_distance_sqr_to_point.js";
|
|
8
|
-
import { ebvh_build_for_geometry_morton } from "../../../../core/bvh2/bvh3/ebvh_build_for_geometry_morton.js";
|
|
9
7
|
import {
|
|
10
8
|
computeTriangleRayIntersectionBarycentric
|
|
11
9
|
} from "../../../../core/geom/3d/triangle/computeTriangleRayIntersectionBarycentric.js";
|
|
@@ -28,10 +26,10 @@ export class GeometryBVHBatched {
|
|
|
28
26
|
constructor() {
|
|
29
27
|
/**
|
|
30
28
|
*
|
|
31
|
-
* @type {
|
|
29
|
+
* @type {BVH}
|
|
32
30
|
* @private
|
|
33
31
|
*/
|
|
34
|
-
this.__bvh = new
|
|
32
|
+
this.__bvh = new BVH();
|
|
35
33
|
|
|
36
34
|
/**
|
|
37
35
|
*
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExplicitBinaryBoundingVolumeHierarchy
|
|
3
|
-
} from "../../../../core/bvh2/bvh3/ExplicitBinaryBoundingVolumeHierarchy.js";
|
|
4
|
-
import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
|
|
5
|
-
import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
6
|
-
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
7
1
|
import { mat4, vec3 } from "gl-matrix";
|
|
8
|
-
import { ensureGeometryBoundingBox } from "../../util/ensureGeometryBoundingBox.js";
|
|
9
|
-
import { GeometryBVHBatched } from "./GeometryBVHBatched.js";
|
|
10
|
-
import { PathTracedMesh } from "./PathTracedMesh.js";
|
|
11
|
-
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
|
|
12
|
-
import { convertTexture2Sampler2D } from "../../texture/sampler/convertTexture2Sampler2D.js";
|
|
13
2
|
import {
|
|
14
3
|
LinearEncoding,
|
|
15
4
|
LinearFilter,
|
|
@@ -19,16 +8,25 @@ import {
|
|
|
19
8
|
sRGBEncoding,
|
|
20
9
|
UnsignedByteType
|
|
21
10
|
} from "three";
|
|
22
|
-
import {
|
|
23
|
-
import { sample_triangle_attribute } from "./sample_triangle_attribute.js";
|
|
24
|
-
import { vec3_uint8_to_float } from "./vec3_uint8_to_float.js";
|
|
25
|
-
import { apply_texture_clamping_to_coordinate } from "./apply_texture_clamping_to_coordinate.js";
|
|
11
|
+
import { BVH } from "../../../../core/bvh2/bvh3/BVH.js";
|
|
26
12
|
import { ebvh_sort_for_traversal_depth_first } from "../../../../core/bvh2/bvh3/ebvh_sort_for_traversal_depth_first.js";
|
|
13
|
+
import { bvh_query_leaves_ray } from "../../../../core/bvh2/bvh3/query/bvh_query_leaves_ray.js";
|
|
14
|
+
import { array_copy } from "../../../../core/collection/array/array_copy.js";
|
|
15
|
+
import { linear_to_sRGB } from "../../../../core/color/sRGB/linear_to_sRGB.js";
|
|
16
|
+
import { aabb3_matrix4_project } from "../../../../core/geom/3d/aabb/aabb3_matrix4_project.js";
|
|
17
|
+
import { ray3_array_compose } from "../../../../core/geom/3d/ray/ray3_array_compose.js";
|
|
27
18
|
import { v3_dot } from "../../../../core/geom/vec3/v3_dot.js";
|
|
19
|
+
import { TextureAttachmentsByMaterialType } from "../../../asset/loaders/material/TextureAttachmensByMaterialType.js";
|
|
20
|
+
import { convertTexture2Sampler2D } from "../../texture/sampler/convertTexture2Sampler2D.js";
|
|
21
|
+
import { ensureGeometryBoundingBox } from "../../util/ensureGeometryBoundingBox.js";
|
|
22
|
+
import { apply_texture_clamping_to_coordinate } from "./apply_texture_clamping_to_coordinate.js";
|
|
23
|
+
import { GeometryBVHBatched } from "./GeometryBVHBatched.js";
|
|
24
|
+
import { getBiasedNormalSample } from "./getBiasedNormalSample.js";
|
|
28
25
|
import { make_one_vector3 } from "./make_one_vector3.js";
|
|
26
|
+
import { PathTracedMesh } from "./PathTracedMesh.js";
|
|
29
27
|
import { transform_normal_m4 } from "./ray_hit_apply_transform.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
28
|
+
import { sample_triangle_attribute } from "./sample_triangle_attribute.js";
|
|
29
|
+
import { vec3_uint8_to_float } from "./vec3_uint8_to_float.js";
|
|
32
30
|
|
|
33
31
|
/*
|
|
34
32
|
Ray hit data layout:
|
|
@@ -69,9 +67,9 @@ export class PathTracer {
|
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
69
|
*
|
|
72
|
-
* @type {
|
|
70
|
+
* @type {BVH}
|
|
73
71
|
*/
|
|
74
|
-
this.bvh_top_level = new
|
|
72
|
+
this.bvh_top_level = new BVH();
|
|
75
73
|
|
|
76
74
|
/**
|
|
77
75
|
*
|