@woosh/meep-engine 3.74.0 → 3.75.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/CHANGELOG.md +20 -19
- package/package.json +1 -1
- package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts +11 -0
- package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts.map +1 -0
- package/src/core/geom/2d/hilbert/v2_hilbert_encode.js +46 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +6 -0
- package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/FrameGraph.js +9 -0
- package/src/engine/graphics3/GPUAcousticSystem.d.ts +29 -32
- package/src/engine/graphics3/GPUAcousticSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUAcousticSystem.js +87 -162
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +35 -17
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +2 -3
- package/src/engine/sound/simulation/AcousticSimulator.d.ts +7 -0
- package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
- package/src/engine/sound/simulation/AcousticSimulator.js +27 -0
- package/src/engine/sound/simulation/README.md +121 -107
- package/src/engine/sound/sopra/README.md +8 -3
- package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts +2 -2
- package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.js +4 -3
- package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts +118 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.js +472 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts +166 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbLines.js +447 -0
- package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts +69 -113
- package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.js +143 -491
- package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts +102 -0
- package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/AcousticSpeakers.js +232 -0
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts +17 -3
- package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/BusGraph.js +55 -5
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts +8 -6
- package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
- package/src/engine/sound/sopra/runtime/EventInstance.js +113 -105
- package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts +13 -0
- package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts.map +1 -0
- package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.js +15 -0
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
- package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +4 -6
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +4 -5
- package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_blas_refit/main.js +6 -12
- package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
- package/src/shade/playground/skinned_mesh_soup/main.js +1 -2
- package/src/shade/playground/vgeo_scene/README.md +12 -2
- package/src/shade/playground/vgeo_scene/main.js +1 -1
- package/src/shade/playground/volumetrics_froxel/README.md +191 -191
- package/src/shade/playground/volumetrics_froxel/measure.d.ts +3 -3
- package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
- package/src/shade/playground/volumetrics_froxel/measure.js +11 -13
- package/src/shade/playground/vsm/main.d.ts.map +1 -1
- package/src/shade/playground/vsm/main.js +5 -6
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +31 -8
- package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts +28 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.js +42 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts +58 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.js +108 -0
- package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +1 -1
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +161 -0
- package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/GPUAcousticProbes.js +760 -0
- package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +1 -1
- package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts +12 -0
- package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/acoustic_listener_order.js +56 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_direct.js +5 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts +57 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.js +314 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts +15 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_finite.js +21 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_gather.js +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts +27 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_lean.js +42 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts +80 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_listener.js +274 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_partials.d.ts +2 -2
- package/src/shade/renderer/acoustics/chunk_acoustic_partials.js +2 -2
- package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts +7 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_phonon.js +24 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_resample.js +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.js +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts +43 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_through.js +153 -0
- package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts +3 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/chunk_acoustic_trace.js +10 -1
- package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts +7 -3
- package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/shader_acoustic_combine.js +22 -6
- package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts +14 -0
- package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_coupling.js +102 -0
- package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts +12 -0
- package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_listener.js +80 -0
- package/src/shade/renderer/acoustics/shader_acoustic_receive.d.ts.map +1 -1
- package/src/shade/renderer/acoustics/shader_acoustic_receive.js +27 -6
- package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts +11 -0
- package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_room.js +111 -0
- package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts +18 -0
- package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts.map +1 -0
- package/src/shade/renderer/acoustics/shader_acoustic_source.js +130 -0
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.d.ts +2 -2
- package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.js +2 -2
- package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts +5 -2
- package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js +5 -2
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts +9 -2
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +48 -12
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts +0 -22
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js +0 -42
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts +2 -18
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.js +2 -19
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.js +0 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +5 -4
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +3 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +3 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +0 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts +60 -14
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.js +75 -39
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +0 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +45 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +7 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +43 -7
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BRICK_ATLAS_TEXTURE_RESOURCE,
|
|
3
|
+
BRICK_LEVELS_RESOURCE,
|
|
4
|
+
BRICK_MAP_TEXTURE_RESOURCE,
|
|
5
|
+
BRICK_OCCUPANCY_TEXTURE_RESOURCE,
|
|
6
|
+
BRICK_SAMPLER_RESOURCE,
|
|
7
|
+
chunk_brick_clipmap_distance
|
|
8
|
+
} from "../global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js";
|
|
9
|
+
import { chunk_workgroup_sum_vec4 } from "../shader/chunk/subgroup/chunk_workgroup_sum_vec4.js";
|
|
10
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
11
|
+
import { ComputeShader } from "../shader/ComputeShader.js";
|
|
12
|
+
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
13
|
+
import { WebGPUBufferType } from "../shader/type/WebGPUBufferType.js";
|
|
14
|
+
import { ACOUSTIC_FRAME_STRUCT } from "./ACOUSTIC_FRAME_STRUCT.js";
|
|
15
|
+
import {
|
|
16
|
+
ACOUSTIC_LISTENER_GROUPS,
|
|
17
|
+
ACOUSTIC_LISTENER_PARTIAL_VEC4S,
|
|
18
|
+
ACOUSTIC_LISTENER_PARTIALS_RESOURCE
|
|
19
|
+
} from "./ACOUSTIC_LISTENER_RESOURCES.js";
|
|
20
|
+
import { ACOUSTIC_PROBE_RESULT_DESCRIPTOR } from "./ACOUSTIC_PROBE_DATABASE_SPEC.js";
|
|
21
|
+
import { chunk_acoustic_room } from "./chunk_acoustic_listener.js";
|
|
22
|
+
import { BRICK_ACOUSTICS_RESOURCE } from "./chunk_brick_acoustics.js";
|
|
23
|
+
|
|
24
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
25
|
+
|
|
26
|
+
resources.createGroup()
|
|
27
|
+
.addUniform("acoustic_frame", ACOUSTIC_FRAME_STRUCT)
|
|
28
|
+
.addStorageBuffer("database", WebGPUBufferType.unsized, true)
|
|
29
|
+
.add(ACOUSTIC_LISTENER_PARTIALS_RESOURCE);
|
|
30
|
+
|
|
31
|
+
resources.createGroup()
|
|
32
|
+
.add(BRICK_LEVELS_RESOURCE)
|
|
33
|
+
.add(BRICK_MAP_TEXTURE_RESOURCE)
|
|
34
|
+
.add(BRICK_OCCUPANCY_TEXTURE_RESOURCE)
|
|
35
|
+
.add(BRICK_ATLAS_TEXTURE_RESOURCE)
|
|
36
|
+
.add(BRICK_SAMPLER_RESOURCE)
|
|
37
|
+
.add(BRICK_ACOUSTICS_RESOURCE);
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* The room about the listener, one workgroup: the listener workgroups' sums added, the room they make
|
|
41
|
+
* (`acoustic_room`), where its reflecting surface lies, the share of the rays that left (into open air, or into space not
|
|
42
|
+
* built yet) and how many rays were summed, written whole at row 0 of `acoustic_room`. A listener inside a solid has no
|
|
43
|
+
* room.
|
|
44
|
+
*
|
|
45
|
+
* @type {ComputeShader}
|
|
46
|
+
*/
|
|
47
|
+
export const shader_acoustic_room = ComputeShader.from({
|
|
48
|
+
label: "Acoustic Room",
|
|
49
|
+
resources,
|
|
50
|
+
body: CodeChunk.from(
|
|
51
|
+
//language=WGSL
|
|
52
|
+
`
|
|
53
|
+
@compute @workgroup_size(64)
|
|
54
|
+
fn main(
|
|
55
|
+
@builtin(local_invocation_index) lane: u32,
|
|
56
|
+
@builtin(subgroup_invocation_id) subgroup_lane: u32,
|
|
57
|
+
@builtin(subgroup_size) subgroup_size: u32,
|
|
58
|
+
) {
|
|
59
|
+
var counts = vec4<f32>(0.0);
|
|
60
|
+
var absorbed = vec4<f32>(0.0);
|
|
61
|
+
var lean = vec4<f32>(0.0);
|
|
62
|
+
|
|
63
|
+
if (lane < ${ACOUSTIC_LISTENER_GROUPS}u) {
|
|
64
|
+
let at = lane * ${ACOUSTIC_LISTENER_PARTIAL_VEC4S}u;
|
|
65
|
+
|
|
66
|
+
counts = acoustic_listener_partials[at];
|
|
67
|
+
absorbed = acoustic_listener_partials[at + 1u];
|
|
68
|
+
lean = acoustic_listener_partials[at + 2u];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
counts = workgroup_sum_vec4(counts, lane, subgroup_lane, subgroup_size);
|
|
72
|
+
absorbed = workgroup_sum_vec4(absorbed, lane, subgroup_lane, subgroup_size);
|
|
73
|
+
lean = workgroup_sum_vec4(lean, lane, subgroup_lane, subgroup_size);
|
|
74
|
+
|
|
75
|
+
if (lane != 0u) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var result = ${ACOUSTIC_PROBE_RESULT_DESCRIPTOR.marshalling_method_read_rw}(&database, 0u);
|
|
80
|
+
|
|
81
|
+
let inside = brick_clipmap_distance(acoustic_frame.listener, acoustic_frame.cascade_count, acoustic_frame.atlas_shift) < 0.0;
|
|
82
|
+
|
|
83
|
+
result.inside = select(0.0, 1.0, inside);
|
|
84
|
+
result.answered = counts.x;
|
|
85
|
+
result.escaped = select(0.0, counts.y / counts.x, counts.x > 0.0);
|
|
86
|
+
result.energy = vec3<f32>(0.0);
|
|
87
|
+
result.centre = vec3<f32>(0.0);
|
|
88
|
+
result.lean = vec3<f32>(0.0);
|
|
89
|
+
result.absorption = vec3<f32>(1.0);
|
|
90
|
+
result.mfp = 0.0;
|
|
91
|
+
|
|
92
|
+
if (!inside) {
|
|
93
|
+
let room = acoustic_room(counts, absorbed.xyz, acoustic_frame.air);
|
|
94
|
+
|
|
95
|
+
result.energy = room.energy;
|
|
96
|
+
result.centre = room.centre;
|
|
97
|
+
result.absorption = room.absorption;
|
|
98
|
+
result.mfp = select(0.0, 4.0 * counts.z / counts.w, counts.w > 0.0);
|
|
99
|
+
result.lean = select(vec3<f32>(0.0), lean.xyz / lean.w, lean.w > 0.0);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
${ACOUSTIC_PROBE_RESULT_DESCRIPTOR.marshalling_method_write}(&database, 0u, result);
|
|
103
|
+
}
|
|
104
|
+
`, [
|
|
105
|
+
chunk_workgroup_sum_vec4,
|
|
106
|
+
chunk_brick_clipmap_distance,
|
|
107
|
+
chunk_acoustic_room,
|
|
108
|
+
ACOUSTIC_PROBE_RESULT_DESCRIPTOR.chunk_read_rw,
|
|
109
|
+
ACOUSTIC_PROBE_RESULT_DESCRIPTOR.chunk_write,
|
|
110
|
+
]),
|
|
111
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The frame's heard sources, a workgroup a source of `source_list`, written at its row of `acoustic_direct`:
|
|
3
|
+
*
|
|
4
|
+
* - **Its direct path.** A cone from the listener over the source's disk, a lane a cell of it
|
|
5
|
+
* (`acoustic_direct_cone_cell`): the share of the cell each occluder leaves open, and what the walls let through of
|
|
6
|
+
* the rest; the mean over every cell, one that did not resolve passing nothing, and 1 in `answered` where any did.
|
|
7
|
+
* Where none did, the path stays as it was.
|
|
8
|
+
* - **Its reverberant energy at the listener**: its first-order reflections off the listener's hits
|
|
9
|
+
* (`shader_acoustic_coupling`'s chunks summed), and every order after as the room loses a share `α` a reflection and
|
|
10
|
+
* the air its share over a free path (row 0 of `acoustic_room`, written by the room pass before;
|
|
11
|
+
* `acoustic_reverb_orders`). As a ratio to the source's direct energy at 1 m; 0 where the listener's rays hit
|
|
12
|
+
* nothing.
|
|
13
|
+
*
|
|
14
|
+
* @type {ComputeShader}
|
|
15
|
+
*/
|
|
16
|
+
export const shader_acoustic_source: ComputeShader;
|
|
17
|
+
import { ComputeShader } from "../shader/ComputeShader.js";
|
|
18
|
+
//# sourceMappingURL=shader_acoustic_source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_acoustic_source.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/acoustics/shader_acoustic_source.js"],"names":[],"mappings":"AA4CA;;;;;;;;;;;;;;GAcG;AACH,qCAFU,aAAa,CAwEpB;8BAvH2B,4BAA4B"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BRICK_ATLAS_TEXTURE_RESOURCE,
|
|
3
|
+
BRICK_LEVELS_RESOURCE,
|
|
4
|
+
BRICK_MAP_TEXTURE_RESOURCE,
|
|
5
|
+
BRICK_OCCUPANCY_TEXTURE_RESOURCE,
|
|
6
|
+
BRICK_SAMPLER_RESOURCE
|
|
7
|
+
} from "../global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js";
|
|
8
|
+
import { chunk_folded_workgroup_index } from "../shader/chunk/grid/chunk_folded_workgroup_index.js";
|
|
9
|
+
import { chunk_workgroup_sum_vec4 } from "../shader/chunk/subgroup/chunk_workgroup_sum_vec4.js";
|
|
10
|
+
import { CodeChunk } from "../shader/compiler/CodeChunk.js";
|
|
11
|
+
import { ComputeShader } from "../shader/ComputeShader.js";
|
|
12
|
+
import { ShaderResourceSetDescriptor } from "../shader/resource/ShaderResourceSetDescriptor.js";
|
|
13
|
+
import { u32 } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
14
|
+
import { WebGPUArray } from "../shader/type/WebGPUArray.js";
|
|
15
|
+
import { WebGPUBufferType } from "../shader/type/WebGPUBufferType.js";
|
|
16
|
+
import { ACOUSTIC_FRAME_STRUCT } from "./ACOUSTIC_FRAME_STRUCT.js";
|
|
17
|
+
import {
|
|
18
|
+
ACOUSTIC_COUPLING_PARTIAL_VEC4S,
|
|
19
|
+
ACOUSTIC_COUPLING_PARTIALS_RESOURCE,
|
|
20
|
+
ACOUSTIC_LISTENER_GROUPS
|
|
21
|
+
} from "./ACOUSTIC_LISTENER_RESOURCES.js";
|
|
22
|
+
import { ACOUSTIC_DIRECT_DESCRIPTOR, ACOUSTIC_PROBE_RESULT_DESCRIPTOR, ACOUSTIC_SOURCE_DESCRIPTOR } from "./ACOUSTIC_PROBE_DATABASE_SPEC.js";
|
|
23
|
+
import { ACOUSTIC_CONE_CELLS, chunk_acoustic_direct_cone } from "./chunk_acoustic_direct_cone.js";
|
|
24
|
+
import { chunk_acoustic_room } from "./chunk_acoustic_listener.js";
|
|
25
|
+
import { BRICK_ACOUSTICS_RESOURCE } from "./chunk_brick_acoustics.js";
|
|
26
|
+
|
|
27
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
28
|
+
|
|
29
|
+
resources.setImmediate("source_count", u32);
|
|
30
|
+
|
|
31
|
+
resources.createGroup()
|
|
32
|
+
.addUniform("acoustic_frame", ACOUSTIC_FRAME_STRUCT)
|
|
33
|
+
.addStorageBuffer("database", WebGPUBufferType.unsized, true)
|
|
34
|
+
.addStorageBuffer("source_list", WebGPUArray.from(u32), false)
|
|
35
|
+
.add(ACOUSTIC_COUPLING_PARTIALS_RESOURCE);
|
|
36
|
+
|
|
37
|
+
resources.createGroup()
|
|
38
|
+
.add(BRICK_LEVELS_RESOURCE)
|
|
39
|
+
.add(BRICK_MAP_TEXTURE_RESOURCE)
|
|
40
|
+
.add(BRICK_OCCUPANCY_TEXTURE_RESOURCE)
|
|
41
|
+
.add(BRICK_ATLAS_TEXTURE_RESOURCE)
|
|
42
|
+
.add(BRICK_SAMPLER_RESOURCE)
|
|
43
|
+
.add(BRICK_ACOUSTICS_RESOURCE);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* The frame's heard sources, a workgroup a source of `source_list`, written at its row of `acoustic_direct`:
|
|
47
|
+
*
|
|
48
|
+
* - **Its direct path.** A cone from the listener over the source's disk, a lane a cell of it
|
|
49
|
+
* (`acoustic_direct_cone_cell`): the share of the cell each occluder leaves open, and what the walls let through of
|
|
50
|
+
* the rest; the mean over every cell, one that did not resolve passing nothing, and 1 in `answered` where any did.
|
|
51
|
+
* Where none did, the path stays as it was.
|
|
52
|
+
* - **Its reverberant energy at the listener**: its first-order reflections off the listener's hits
|
|
53
|
+
* (`shader_acoustic_coupling`'s chunks summed), and every order after as the room loses a share `α` a reflection and
|
|
54
|
+
* the air its share over a free path (row 0 of `acoustic_room`, written by the room pass before;
|
|
55
|
+
* `acoustic_reverb_orders`). As a ratio to the source's direct energy at 1 m; 0 where the listener's rays hit
|
|
56
|
+
* nothing.
|
|
57
|
+
*
|
|
58
|
+
* @type {ComputeShader}
|
|
59
|
+
*/
|
|
60
|
+
export const shader_acoustic_source = ComputeShader.from({
|
|
61
|
+
label: "Acoustic Source",
|
|
62
|
+
resources,
|
|
63
|
+
body: CodeChunk.from(
|
|
64
|
+
//language=WGSL
|
|
65
|
+
`
|
|
66
|
+
@compute @workgroup_size(64)
|
|
67
|
+
fn main(
|
|
68
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
69
|
+
@builtin(local_invocation_index) lane: u32,
|
|
70
|
+
@builtin(subgroup_invocation_id) subgroup_lane: u32,
|
|
71
|
+
@builtin(subgroup_size) subgroup_size: u32,
|
|
72
|
+
) {
|
|
73
|
+
let index = folded_workgroup_index(workgroup_id);
|
|
74
|
+
|
|
75
|
+
// the same for the whole workgroup: it leaves together, before the sums
|
|
76
|
+
if (index >= source_count) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
let row = source_list[index];
|
|
81
|
+
let source = ${ACOUSTIC_SOURCE_DESCRIPTOR.marshalling_method_read_rw}(&database, row);
|
|
82
|
+
|
|
83
|
+
var direct = vec4<f32>(0.0);
|
|
84
|
+
|
|
85
|
+
if (lane < ${ACOUSTIC_CONE_CELLS}u) {
|
|
86
|
+
let cell = acoustic_direct_cone_cell(acoustic_frame.listener, source.position, source.radius, lane, acoustic_frame.fallback, acoustic_frame.cascade_count, acoustic_frame.atlas_shift);
|
|
87
|
+
|
|
88
|
+
direct = vec4<f32>(cell.w * cell.xyz, cell.w);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var first = vec4<f32>(0.0);
|
|
92
|
+
|
|
93
|
+
if (lane < ${ACOUSTIC_LISTENER_GROUPS}u) {
|
|
94
|
+
first = acoustic_coupling_partials[(index * ${ACOUSTIC_LISTENER_GROUPS}u + lane) * ${ACOUSTIC_COUPLING_PARTIAL_VEC4S}u];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let direct_sum = workgroup_sum_vec4(direct, lane, subgroup_lane, subgroup_size);
|
|
98
|
+
let first_sum = workgroup_sum_vec4(first, lane, subgroup_lane, subgroup_size);
|
|
99
|
+
|
|
100
|
+
if (lane != 0u) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
var result = ${ACOUSTIC_DIRECT_DESCRIPTOR.marshalling_method_read_rw}(&database, row);
|
|
105
|
+
|
|
106
|
+
// the mean over every cell, a cell that did not resolve passing nothing: what is not known is lost, never assumed
|
|
107
|
+
if (direct_sum.w > 0.0) {
|
|
108
|
+
result.direct = direct_sum.xyz / f32(${ACOUSTIC_CONE_CELLS}u);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
result.answered = select(0.0, 1.0, direct_sum.w > 0.0);
|
|
112
|
+
|
|
113
|
+
let room = ${ACOUSTIC_PROBE_RESULT_DESCRIPTOR.marshalling_method_read_rw}(&database, 0u);
|
|
114
|
+
|
|
115
|
+
result.reverb = first_sum.xyz * acoustic_reverb_orders(room.absorption, acoustic_frame.air, room.mfp);
|
|
116
|
+
result.reverb_rays = select(0.0, 1.0, first_sum.w > 0.0);
|
|
117
|
+
|
|
118
|
+
${ACOUSTIC_DIRECT_DESCRIPTOR.marshalling_method_write}(&database, row, result);
|
|
119
|
+
}
|
|
120
|
+
`, [
|
|
121
|
+
chunk_folded_workgroup_index,
|
|
122
|
+
chunk_workgroup_sum_vec4,
|
|
123
|
+
chunk_acoustic_direct_cone,
|
|
124
|
+
chunk_acoustic_room,
|
|
125
|
+
ACOUSTIC_SOURCE_DESCRIPTOR.chunk_read_rw,
|
|
126
|
+
ACOUSTIC_PROBE_RESULT_DESCRIPTOR.chunk_read_rw,
|
|
127
|
+
ACOUSTIC_DIRECT_DESCRIPTOR.chunk_read_rw,
|
|
128
|
+
ACOUSTIC_DIRECT_DESCRIPTOR.chunk_write,
|
|
129
|
+
]),
|
|
130
|
+
});
|
|
@@ -145,7 +145,7 @@ export class GPUFluidCascade {
|
|
|
145
145
|
* @param {*} _resources
|
|
146
146
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
147
147
|
*/
|
|
148
|
-
static "__#
|
|
148
|
+
static "__#295@#execute_restrict"(record: object, _resources: any, context: {
|
|
149
149
|
encoder: ShadeGPUCommandContext;
|
|
150
150
|
}): void;
|
|
151
151
|
/**
|
|
@@ -153,7 +153,7 @@ export class GPUFluidCascade {
|
|
|
153
153
|
* @param {*} _resources
|
|
154
154
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
155
155
|
*/
|
|
156
|
-
static "__#
|
|
156
|
+
static "__#295@#execute_fill"(record: object, _resources: any, context: {
|
|
157
157
|
encoder: ShadeGPUCommandContext;
|
|
158
158
|
}): void;
|
|
159
159
|
/**
|
|
@@ -161,7 +161,7 @@ export class GPUFluidCascade {
|
|
|
161
161
|
* @param {import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
|
|
162
162
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
163
163
|
*/
|
|
164
|
-
static "__#
|
|
164
|
+
static "__#295@#execute"(record: object, resources: import("../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
|
|
165
165
|
encoder: ShadeGPUCommandContext;
|
|
166
166
|
}): void;
|
|
167
167
|
/**
|
|
@@ -65,7 +65,7 @@ export class GPUFluidCascadeStack {
|
|
|
65
65
|
* @param {*} _resources
|
|
66
66
|
* @param {{encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
67
67
|
*/
|
|
68
|
-
static "__#
|
|
68
|
+
static "__#297@#execute_publish"(pass: object, _resources: any, context: {
|
|
69
69
|
encoder: import("../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
70
70
|
}): void;
|
|
71
71
|
/**
|
|
@@ -86,7 +86,7 @@ export class GPUFluidForcing {
|
|
|
86
86
|
* @param {FluidObstacleRecord} record
|
|
87
87
|
* @returns {number} metres
|
|
88
88
|
*/
|
|
89
|
-
static "__#
|
|
89
|
+
static "__#298@#resolved_extent"(record: FluidObstacleRecord): number;
|
|
90
90
|
/**
|
|
91
91
|
* The descriptor of a transient of `role`, `size` bytes, from `kept` (by role): the one kept for
|
|
92
92
|
* the role while its size holds, a new one when it moves. A role's usage and clear range never
|
|
@@ -99,19 +99,19 @@ export class GPUFluidForcing {
|
|
|
99
99
|
* @param {number} clear_size bytes cleared from 0 when the pool reuses the buffer
|
|
100
100
|
* @returns {BufferResourceDescriptor}
|
|
101
101
|
*/
|
|
102
|
-
static "__#
|
|
102
|
+
static "__#298@#descriptor"(kept: BufferResourceDescriptor[], role: number, size: number, usage: number, clear_size: number): BufferResourceDescriptor;
|
|
103
103
|
/**
|
|
104
104
|
* @param {object} record
|
|
105
105
|
* @param {FramePassResources} resources
|
|
106
106
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
107
107
|
*/
|
|
108
|
-
static "__#
|
|
108
|
+
static "__#298@#execute_extract"(record: object, resources: FramePassResources, context: {
|
|
109
109
|
encoder: ShadeGPUCommandContext;
|
|
110
110
|
}): void;
|
|
111
|
-
static "__#
|
|
112
|
-
static "__#
|
|
113
|
-
static "__#
|
|
114
|
-
static "__#
|
|
111
|
+
static "__#298@#execute_clear"(record: any, _resources: any, context: any): void;
|
|
112
|
+
static "__#298@#execute_query"(record: any, resources: any, context: any): void;
|
|
113
|
+
static "__#298@#execute_command"(record: any, resources: any, context: any): void;
|
|
114
|
+
static "__#298@#execute_apply"(record: any, resources: any, context: any): void;
|
|
115
115
|
/**
|
|
116
116
|
* @param {object} options
|
|
117
117
|
* @param {GPUDevice} options.device
|
|
@@ -41,7 +41,7 @@ export class GPUFluidPressureSolve {
|
|
|
41
41
|
* @param {*} _resources
|
|
42
42
|
* @param {{encoder: ShadeGPUCommandContext}} context
|
|
43
43
|
*/
|
|
44
|
-
static "__#
|
|
44
|
+
static "__#294@#execute"(data: {
|
|
45
45
|
solve: GPUFluidPressureSolve;
|
|
46
46
|
arm: number;
|
|
47
47
|
count: number;
|
|
@@ -49,7 +49,7 @@ export class GPUFluidQueries {
|
|
|
49
49
|
* @param {import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources} resources
|
|
50
50
|
* @param {{encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext}} context
|
|
51
51
|
*/
|
|
52
|
-
static "__#
|
|
52
|
+
static "__#299@#execute"(pass: object, resources: import("../../../../engine/graphics/render/frame_graph/FramePassResources.js").FramePassResources, context: {
|
|
53
53
|
encoder: import("../../../device/ShadeGPUCommandContext.js").ShadeGPUCommandContext;
|
|
54
54
|
}): void;
|
|
55
55
|
/**
|
|
@@ -78,8 +78,8 @@ export class VGeoFrontier {
|
|
|
78
78
|
vertex_cluster_counts: Uint32Array;
|
|
79
79
|
/**
|
|
80
80
|
* Optional per-vertex mask (`1` = pinned) for coincident inter-primitive glTF material borders
|
|
81
|
-
* so separate per-material DAGs stay crack-free across mixed LOD cuts. Ignored
|
|
82
|
-
*
|
|
81
|
+
* so separate per-material DAGs stay crack-free across mixed LOD cuts. Ignored by a group whose
|
|
82
|
+
* pins leave it no way to reach its triangle target, and by the residual convergence fallback.
|
|
83
83
|
* @type {Uint8Array|null}
|
|
84
84
|
*/
|
|
85
85
|
seam_locked_vertices: Uint8Array | null;
|
|
@@ -91,8 +91,8 @@ export class VGeoFrontier {
|
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
93
|
* Optional per-vertex mask (`1` = pinned) for coincident inter-primitive glTF material borders
|
|
94
|
-
* so separate per-material DAGs stay crack-free across mixed LOD cuts. Ignored
|
|
95
|
-
*
|
|
94
|
+
* so separate per-material DAGs stay crack-free across mixed LOD cuts. Ignored by a group whose
|
|
95
|
+
* pins leave it no way to reach its triangle target, and by the residual convergence fallback.
|
|
96
96
|
* @type {Uint8Array|null}
|
|
97
97
|
*/
|
|
98
98
|
seam_locked_vertices = null;
|
|
@@ -35,8 +35,11 @@ export class VGeoLevelOptions {
|
|
|
35
35
|
/**
|
|
36
36
|
* Optional packed `[x0, y0, z0, x1, y1, z1, ...]` object-space coordinates along coincident
|
|
37
37
|
* inter-primitive seams (e.g. multi-material glTF borders). Matching source vertices stay
|
|
38
|
-
* pinned
|
|
39
|
-
*
|
|
38
|
+
* pinned so adjacent primitives simplify without opening cracks across material seams. A group
|
|
39
|
+
* whose pins leave it no way to reach its triangle target releases them
|
|
40
|
+
* ({@link vgeo_build_group_step}), and so does a round that otherwise cannot reduce its frontier.
|
|
41
|
+
* Released, each side of the seam simplifies on its own, so the two can part where a cut draws
|
|
42
|
+
* them at different levels.
|
|
40
43
|
*
|
|
41
44
|
* The primitives either side of a seam have to be built on one position lattice for the seam
|
|
42
45
|
* to close in what they store ({@link VGeoBuildOptions#position_exponent}).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VGeoLevelOptions.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;IACI;;;;;OAKG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,sBAFU,MAAM,CAEW;IAE3B;;;OAGG;IACH,mBAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,yBAFU,MAAM,CAEe;IAE/B;;;OAGG;IACH,YAFU,MAAM,CAEE;IAElB
|
|
1
|
+
{"version":3,"file":"VGeoLevelOptions.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH;IACI;;;;;OAKG;IACH,YAFU,MAAM,CAED;IAEf;;;OAGG;IACH,sBAFU,MAAM,CAEW;IAE3B;;;OAGG;IACH,mBAFU,MAAM,CAEM;IAEtB;;;OAGG;IACH,yBAFU,MAAM,CAEe;IAE/B;;;OAGG;IACH,YAFU,MAAM,CAEE;IAElB;;;;;;;;;;;;OAYG;IACH,kBAFU,YAAY,GAAC,IAAI,CAEH;IAExB;;;;;OAKG;IACH,2BAFU,MAAM,CAEc;CACjC"}
|
|
@@ -40,8 +40,11 @@ export class VGeoLevelOptions {
|
|
|
40
40
|
/**
|
|
41
41
|
* Optional packed `[x0, y0, z0, x1, y1, z1, ...]` object-space coordinates along coincident
|
|
42
42
|
* inter-primitive seams (e.g. multi-material glTF borders). Matching source vertices stay
|
|
43
|
-
* pinned
|
|
44
|
-
*
|
|
43
|
+
* pinned so adjacent primitives simplify without opening cracks across material seams. A group
|
|
44
|
+
* whose pins leave it no way to reach its triangle target releases them
|
|
45
|
+
* ({@link vgeo_build_group_step}), and so does a round that otherwise cannot reduce its frontier.
|
|
46
|
+
* Released, each side of the seam simplifies on its own, so the two can part where a cut draws
|
|
47
|
+
* them at different levels.
|
|
45
48
|
*
|
|
46
49
|
* The primitives either side of a seam have to be built on one position lattice for the seam
|
|
47
50
|
* to close in what they store ({@link VGeoBuildOptions#position_exponent}).
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Simplify one group and cut the result into the parent clusters of every cluster in it.
|
|
3
3
|
*
|
|
4
|
+
* The group's boundary with the rest of the frontier is held, always: a sibling group shares it,
|
|
5
|
+
* and moving it on one side opens a crack. An inter-primitive seam pin
|
|
6
|
+
* ({@link VGeoLevelOptions#locked_positions}) holds this primitive to another container instead, and
|
|
7
|
+
* a pin that never moves is never simplified away, so it can come to fill a group on its own. A
|
|
8
|
+
* group whose pins leave it no way to reach its triangle target ({@link fewest_faces_holding})
|
|
9
|
+
* releases its seam pins, and keeps its boundary with the rest of the frontier.
|
|
10
|
+
*
|
|
4
11
|
* @param {import("./VGeoFrontier.js").VGeoFrontier} frontier
|
|
5
12
|
* @param {number[]} group_clusters cluster indices
|
|
6
13
|
* @param {Uint32Array[]} shared_edges per-cluster shared-edge summaries from {@link vgeo_build_cluster_graph}
|
|
7
14
|
* @param {number} level of the parents this step produces
|
|
8
15
|
* @param {import("./VGeoLevelOptions.js").VGeoLevelOptions} options
|
|
9
|
-
* @param {boolean} [release_seam_locks=false] when true, ignore inter-primitive seam locks
|
|
10
|
-
*
|
|
16
|
+
* @param {boolean} [release_seam_locks=false] when true, ignore inter-primitive seam locks
|
|
17
|
+
* whatever the group's pins allow, while keeping all inter-group topological boundaries locked
|
|
11
18
|
* @returns {VGeoGroupStep|undefined}
|
|
12
19
|
*
|
|
13
20
|
* @author Alex Goldring
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vgeo_build_group_step.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vgeo_build_group_step.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js"],"names":[],"mappings":"AAsYA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,gDAZW,OAAO,mBAAmB,EAAE,YAAY,kBACxC,MAAM,EAAE,gBACR,WAAW,EAAE,SACb,MAAM,WACN,OAAO,uBAAuB,EAAE,gBAAgB,uBAChD,OAAO,GAEL,aAAa,GAAC,SAAS,CA2bnC;8BAryB6B,oBAAoB"}
|
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
bt_mesh_build_face_bvh
|
|
22
22
|
} from "../../../../../../core/geom/3d/topology/struct/binary/query/bt_mesh_build_face_bvh.js";
|
|
23
|
+
import {
|
|
24
|
+
bt_mesh_compute_face_islands
|
|
25
|
+
} from "../../../../../../core/geom/3d/topology/struct/binary/query/bt_mesh_compute_face_islands.js";
|
|
23
26
|
import {
|
|
24
27
|
bt_mesh_find_nearest_face
|
|
25
28
|
} from "../../../../../../core/geom/3d/topology/struct/binary/query/bt_mesh_find_nearest_face.js";
|
|
@@ -368,16 +371,40 @@ function compute_dropped_hausdorff_bound(
|
|
|
368
371
|
}
|
|
369
372
|
}
|
|
370
373
|
|
|
374
|
+
/**
|
|
375
|
+
* The fewest triangles a surface can come to while `pinned` of its vertices stay where they are.
|
|
376
|
+
*
|
|
377
|
+
* A collapse never removes a pinned vertex and never joins two of them, so at best every unpinned
|
|
378
|
+
* vertex goes and the pinned ones are left spanning the surface between them. By Euler's formula a
|
|
379
|
+
* disc whose `B` vertices all lie on its border holds `B - 2` triangles, and each pinned vertex
|
|
380
|
+
* inside it rather than on the border adds two more; over `islands` separate pieces that is at least
|
|
381
|
+
* `pinned - 2 * islands`.
|
|
382
|
+
*
|
|
383
|
+
* @param {number} pinned
|
|
384
|
+
* @param {number} islands
|
|
385
|
+
* @returns {number}
|
|
386
|
+
*/
|
|
387
|
+
function fewest_faces_holding(pinned, islands) {
|
|
388
|
+
return pinned - 2 * islands;
|
|
389
|
+
}
|
|
390
|
+
|
|
371
391
|
/**
|
|
372
392
|
* Simplify one group and cut the result into the parent clusters of every cluster in it.
|
|
373
393
|
*
|
|
394
|
+
* The group's boundary with the rest of the frontier is held, always: a sibling group shares it,
|
|
395
|
+
* and moving it on one side opens a crack. An inter-primitive seam pin
|
|
396
|
+
* ({@link VGeoLevelOptions#locked_positions}) holds this primitive to another container instead, and
|
|
397
|
+
* a pin that never moves is never simplified away, so it can come to fill a group on its own. A
|
|
398
|
+
* group whose pins leave it no way to reach its triangle target ({@link fewest_faces_holding})
|
|
399
|
+
* releases its seam pins, and keeps its boundary with the rest of the frontier.
|
|
400
|
+
*
|
|
374
401
|
* @param {import("./VGeoFrontier.js").VGeoFrontier} frontier
|
|
375
402
|
* @param {number[]} group_clusters cluster indices
|
|
376
403
|
* @param {Uint32Array[]} shared_edges per-cluster shared-edge summaries from {@link vgeo_build_cluster_graph}
|
|
377
404
|
* @param {number} level of the parents this step produces
|
|
378
405
|
* @param {import("./VGeoLevelOptions.js").VGeoLevelOptions} options
|
|
379
|
-
* @param {boolean} [release_seam_locks=false] when true, ignore inter-primitive seam locks
|
|
380
|
-
*
|
|
406
|
+
* @param {boolean} [release_seam_locks=false] when true, ignore inter-primitive seam locks
|
|
407
|
+
* whatever the group's pins allow, while keeping all inter-group topological boundaries locked
|
|
381
408
|
* @returns {VGeoGroupStep|undefined}
|
|
382
409
|
*
|
|
383
410
|
* @author Alex Goldring
|
|
@@ -390,7 +417,7 @@ export function vgeo_build_group_step(
|
|
|
390
417
|
|
|
391
418
|
const child_clusters = group_clusters.map((cluster) => frontier.clusters[cluster]);
|
|
392
419
|
|
|
393
|
-
|
|
420
|
+
let boundary = vgeo_compute_group_boundary(
|
|
394
421
|
frontier, group_clusters, shared_edges, release_seam_locks
|
|
395
422
|
);
|
|
396
423
|
|
|
@@ -401,6 +428,24 @@ export function vgeo_build_group_step(
|
|
|
401
428
|
|
|
402
429
|
const initial_face_count = topology.faces.count();
|
|
403
430
|
|
|
431
|
+
const parent_target = Math.max(
|
|
432
|
+
1, Math.ceil(group_clusters.length * options.simplification_ratio)
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
const target = Math.min(
|
|
436
|
+
parent_target * VGEO_MAX_CLUSTER_TRIANGLE_COUNT,
|
|
437
|
+
Math.max(2, Math.round(initial_face_count * options.simplification_ratio))
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
if (
|
|
441
|
+
!release_seam_locks
|
|
442
|
+
&& frontier.seam_locked_vertices !== null
|
|
443
|
+
&& fewest_faces_holding(boundary.locked.size, 1) > target
|
|
444
|
+
&& fewest_faces_holding(boundary.locked.size, bt_mesh_compute_face_islands(topology).length) > target
|
|
445
|
+
) {
|
|
446
|
+
boundary = vgeo_compute_group_boundary(frontier, group_clusters, shared_edges, true);
|
|
447
|
+
}
|
|
448
|
+
|
|
404
449
|
const submesh_source_vertex_ids = submesh.source_vertex_ids;
|
|
405
450
|
const source_vertex_id_count = submesh_source_vertex_ids.length;
|
|
406
451
|
|
|
@@ -563,15 +608,6 @@ export function vgeo_build_group_step(
|
|
|
563
608
|
return { face_graph, parts };
|
|
564
609
|
}
|
|
565
610
|
|
|
566
|
-
const parent_target = Math.max(
|
|
567
|
-
1, Math.ceil(group_clusters.length * options.simplification_ratio)
|
|
568
|
-
);
|
|
569
|
-
|
|
570
|
-
const target = Math.min(
|
|
571
|
-
parent_target * VGEO_MAX_CLUSTER_TRIANGLE_COUNT,
|
|
572
|
-
Math.max(2, Math.round(initial_face_count * options.simplification_ratio))
|
|
573
|
-
);
|
|
574
|
-
|
|
575
611
|
let outcome = reduce_to(target);
|
|
576
612
|
|
|
577
613
|
const ceiling = group_clusters.length - 1;
|
|
@@ -367,27 +367,6 @@ export class VGeoContainerReader {
|
|
|
367
367
|
* @returns {Promise<VGeoDirectory>}
|
|
368
368
|
*/
|
|
369
369
|
read_directory(): Promise<VGeoDirectory>;
|
|
370
|
-
/**
|
|
371
|
-
* Install every page the directory lists.
|
|
372
|
-
*
|
|
373
|
-
* @deprecated it reads the whole file, and a renderer holding a reader must not be able to reach
|
|
374
|
-
* that from the reader. Call `vgeo_install_all_pages` in `tool/` instead, which is a tool
|
|
375
|
-
* and says so. Kept as a shim because the playground and the specs are what it is for.
|
|
376
|
-
* @param {function(number, number): void} [on_progress] called with pages installed and total
|
|
377
|
-
* @returns {Promise<void>}
|
|
378
|
-
*/
|
|
379
|
-
install_all_pages(on_progress?: (arg0: number, arg1: number) => void): Promise<void>;
|
|
380
|
-
/**
|
|
381
|
-
* The whole-file audit — every build invariant of §11, every checksum, and the directory against
|
|
382
|
-
* what a frame scan reconstructs.
|
|
383
|
-
*
|
|
384
|
-
* @deprecated it reads the entire file into one `ArrayBuffer`, which is the one thing the rest
|
|
385
|
-
* of this class exists to avoid and which a multi-GB asset does not survive. Call
|
|
386
|
-
* `vgeo_audit_container` in `tool/` instead, which refuses a file too large to audit this
|
|
387
|
-
* way rather than attempting it. Kept as a shim for the playground and the specs.
|
|
388
|
-
* @returns {Promise<VGeoDefect[]>} empty is the only good answer
|
|
389
|
-
*/
|
|
390
|
-
validate(): Promise<VGeoDefect[]>;
|
|
391
370
|
/**
|
|
392
371
|
* Extract standalone copies of every complete non-root frame `[1..k]` contained inside `#head`
|
|
393
372
|
* and immediately release `#head` (`head_bytes === 0`).
|
|
@@ -419,7 +398,6 @@ export class VGeoContainerReader {
|
|
|
419
398
|
}
|
|
420
399
|
export type VGeoByteSource = import("./VGeoByteSource.js").VGeoByteSource;
|
|
421
400
|
export type VGeoContainerHeader = import("./VGeoContainerHeader.js").VGeoContainerHeader;
|
|
422
|
-
export type VGeoDefect = import("../VGeoDefect.js").VGeoDefect;
|
|
423
401
|
export type VGeoDirectory = import("./VGeoDirectory.js").VGeoDirectory;
|
|
424
402
|
export type VGeoPage = import("./VGeoPage.js").VGeoPage;
|
|
425
403
|
export type VGeoPageWant = import("./VGeoPageWant.js").VGeoPageWant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VGeoContainerReader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VGeoContainerReader.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH;IAoRI;;;;;;;;OAQG;IACH,oBANW,cAAc,YACd,eAAe,GACb,QAAQ,mBAAmB,CAAC,CAUxC;IAjKD;;;OAGG;IACH,oBAHW,cAAc,YACd,eAAe,EAQzB;IA3ID;;OAEG;IACH,QAFU,mBAAmB,CAEV;IAEnB;;;;OAIG;IACH,WAFU,aAAa,GAAC,SAAS,CAEX;IAmItB;;;;;;;;OAQG;IACH,kCAFa,IAAI,CAOhB;IAED;;OAEG;IACH,2DAEC;IAED;;OAEG;IACH,+BAEC;IAED;;OAEG;IACH,kCAEC;IAED;;;;;;;;;;;;;OAaG;IACH,6BAEC;IAED;;OAEG;IACH,iCAEC;IAED;;;;;;;;;OASG;IACH,2CAEC;IAED;;;;;OAKG;IACH,yBAEC;IAED;;;OAGG;IACH,qCAEC;IAED;;;;;;;;;;;;OAYG;IACH,6CAEC;IAED;;;;;;;;;OASG;IACH,gDAEC;IAED;;;;OAIG;IACH,kBAFa,iBAAiB,QAAQ,CAAC,CAItC;IAyFD;;;;;;;;OAQG;IACH,iBAHW,MAAM,GACJ,QAAQ,GAAC,SAAS,CAI9B;IAED;;;OAGG;IACH,wBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;;;OAWG;IACH,iCAHW,MAAM,GACJ,MAAM,CAoBlB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,0BAJW,MAAM,SACN,MAAM,GACJ,OAAO,CAUnB;IA6OD;;;;;OAKG;IACH,2BAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;;;;;OASG;IACH,8BAHW,MAAM,GACJ,MAAM,GAAC,SAAS,CAI5B;IAED;;;OAGG;IACH,cAFa,iBAAiB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAI9C;IAED;;;;;;;;;;;;OAYG;IACH,8BAHW,MAAM,GACJ,MAAM,CAYlB;IAED;;;;;;;;;;;;OAYG;IACH,oBAPW,MAAM,gBACN,MAAM,cACN,MAAM,GACJ,QAAQ,QAAQ,CAAC,CAoC7B;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,mBAHW,MAAM,GACJ,OAAO,CAYnB;IAED;;;OAGG;IACH,cAFa,MAAM,CAYlB;IA+CD;;;;;;;;;OASG;IACH,YAHW,QAAQ,GACN,QAAQ,CAqBpB;IAED;;;;;;;OAOG;IACH,4BAJW,MAAM,UACN,MAAM,GACJ,IAAI,CAMhB;IACD;;;;;OAKG;IACH,mBAHW,YAAY,GACV,QAAQ,QAAQ,CAAC,CAI7B;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,qBANW,YAAY,EAAE,UACd,MAAM,WAEN,WAAW,GACT,QAAQ,QAAQ,EAAE,CAAC,CA+D/B;IAED;;;;;;;;;;OAUG;IACH,kBAHW,MAAM,GACJ,OAAO,CAiEnB;IAED;;;;OAIG;IACH,aAFa,MAAM,CAYlB;IAED;;;;;;;;OAQG;IACH,kBAFa,QAAQ,aAAa,CAAC,CAkBlC;IAiCD;;;;;;;;;;;OAWG;IACH,uBAFa,IAAI,MAAM,EAAE;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAC,CAAC,GAAC,SAAS,CA8CtE;IAED;;;;;;;;;OASG;IACH,gBAFa,MAAM,CAQlB;;CA6BJ;6BAtzCY,OAAO,qBAAqB,EAAE,cAAc;kCAC5C,OAAO,0BAA0B,EAAE,mBAAmB;4BACtD,OAAO,oBAAoB,EAAE,aAAa;uBAC1C,OAAO,eAAe,EAAE,QAAQ;2BAChC,OAAO,mBAAmB,EAAE,YAAY;gCAVrB,sBAAsB"}
|