@woosh/meep-engine 3.78.0 → 3.78.2
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 +21 -0
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/engine/graphics3/GraphicsEngine.d.ts +19 -1
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine.js +24 -2
- package/src/engine/physics/cloth/solver/cloth_step.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_step.js +4 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts +36 -2
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +60 -3
- package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts +119 -0
- package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.d.ts.map +1 -0
- package/src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.js +563 -0
- package/src/generation/wfc/GRID_WFC_PIECE_SOCKET_PREFIX.d.ts +11 -0
- package/src/generation/wfc/GRID_WFC_PIECE_SOCKET_PREFIX.d.ts.map +1 -0
- package/src/generation/wfc/GRID_WFC_PIECE_SOCKET_PREFIX.js +10 -0
- package/src/generation/wfc/GridWFCCompiledTileSet.d.ts +123 -0
- package/src/generation/wfc/GridWFCCompiledTileSet.d.ts.map +1 -0
- package/src/generation/wfc/GridWFCCompiledTileSet.js +355 -0
- package/src/generation/wfc/GridWFCEdge.d.ts +13 -0
- package/src/generation/wfc/GridWFCEdge.d.ts.map +1 -0
- package/src/generation/wfc/GridWFCEdge.js +14 -0
- package/src/generation/wfc/GridWFCTileSet.d.ts +120 -0
- package/src/generation/wfc/GridWFCTileSet.d.ts.map +1 -0
- package/src/generation/wfc/GridWFCTileSet.js +275 -0
- package/src/shade/device/pipeline/ComputePipelineManager.d.ts +8 -0
- package/src/shade/device/pipeline/ComputePipelineManager.d.ts.map +1 -1
- package/src/shade/device/pipeline/ComputePipelineManager.js +18 -0
- package/src/shade/device/pipeline/RenderPipelineManager.d.ts +8 -0
- package/src/shade/device/pipeline/RenderPipelineManager.d.ts.map +1 -1
- package/src/shade/device/pipeline/RenderPipelineManager.js +17 -0
- package/src/shade/playground/avboit_footprint/index.html +20 -0
- package/src/shade/playground/avboit_footprint/main.d.ts +2 -0
- package/src/shade/playground/avboit_footprint/main.d.ts.map +1 -0
- package/src/shade/playground/avboit_footprint/main.js +428 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +7 -3
- package/src/shade/playground/screen_probes/main.d.ts.map +1 -1
- package/src/shade/playground/screen_probes/main.js +7 -3
- package/src/shade/renderer/Renderer.d.ts +18 -8
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +201 -16
- package/src/shade/renderer/RendererConfiguration.d.ts +95 -0
- package/src/shade/renderer/RendererConfiguration.d.ts.map +1 -0
- package/src/shade/renderer/RendererConfiguration.js +119 -0
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +8 -0
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +34 -0
- package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.d.ts +7 -0
- package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/surface/GPUMeshSurfaceCaches.js +15 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +10 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +37 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +31 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +7 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +20 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +8 -0
- 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 +14 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts +7 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.js +13 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +9 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +11 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +71 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.js +9 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +9 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +6 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +13 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts +9 -0
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/GPUScreenProbeGI.js +47 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts +6 -0
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/screen_probe/ScreenProbeSettings.js +17 -0
- package/src/shade/renderer/hair/GPUHairSystem.d.ts.map +1 -1
- package/src/shade/renderer/hair/GPUHairSystem.js +28 -9
- package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts +50 -9
- package/src/shade/renderer/hair/HAIR_SIMULATION.d.ts.map +1 -1
- package/src/shade/renderer/hair/HAIR_SIMULATION.js +71 -11
- package/src/shade/renderer/hair/shader_hair_simulate.d.ts +22 -16
- package/src/shade/renderer/hair/shader_hair_simulate.d.ts.map +1 -1
- package/src/shade/renderer/hair/shader_hair_simulate.js +151 -78
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts +8 -0
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +20 -1
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts +6 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts.map +1 -1
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.js +11 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +6 -0
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +15 -0
- package/src/shade/renderer/particles/graph_particles.d.ts +8 -0
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +28 -3
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts +7 -0
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +14 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +5 -7
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +7 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +15 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts +6 -0
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +16 -2
- package/src/shade/renderer/path_tracer/accumulating/graph_float32rgba_to_float16rgba.d.ts +6 -0
- package/src/shade/renderer/path_tracer/accumulating/graph_float32rgba_to_float16rgba.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/graph_float32rgba_to_float16rgba.js +9 -0
- package/src/shade/renderer/path_tracer/accumulating/graph_flood_fill.d.ts +11 -0
- package/src/shade/renderer/path_tracer/accumulating/graph_flood_fill.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/accumulating/graph_flood_fill.js +10 -0
- package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts +6 -0
- package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/gather/DepthOfFieldU.js +10 -1
- package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts +7 -0
- package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/gather/graph_postprocess_dof2.js +21 -0
- package/src/shade/renderer/postprocess/dof/raymarch/DepthOfField.d.ts +7 -0
- package/src/shade/renderer/postprocess/dof/raymarch/DepthOfField.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/DepthOfField.js +11 -1
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.d.ts +9 -0
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/graph_postprocess_dof.js +29 -0
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts +6 -0
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/motion_blur/MotionBlur.js +13 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts +6 -0
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/motion_blur/graph_postprocess_motion_blur.js +11 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +9 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/NSS.js +33 -18
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts +8 -0
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +42 -2
- package/src/shade/renderer/postprocess/ssr/ssr_graph_denoise_tiles.d.ts +6 -0
- package/src/shade/renderer/postprocess/ssr/ssr_graph_denoise_tiles.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_graph_denoise_tiles.js +10 -0
- package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.d.ts +6 -0
- package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_graph_prefilter_color.js +11 -0
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts +8 -0
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +27 -3
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.d.ts +6 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSettings.js +10 -0
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts +5 -4
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/AVBOITSideChannel.js +5 -4
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.d.ts +3 -3
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_CONSTANTS.js +3 -3
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +5 -7
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/avboit_unlit_draw.js +5 -7
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_depth.d.ts +34 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_depth.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_depth.js +42 -0
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.d.ts +5 -4
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_integral_depth_coordinate.js +8 -7
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.d.ts +2 -2
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_sample_transmittance.js +4 -5
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts +9 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +18 -0
- package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.d.ts +9 -0
- package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/oit/graph_rasterize_meshes_transparent_oit.js +15 -0
- package/src/shade/renderer/restir/di/ReSTIRDI.d.ts +6 -0
- package/src/shade/renderer/restir/di/ReSTIRDI.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/ReSTIRDI.js +10 -1
- package/src/shade/renderer/restir/di/graph_restir_di.d.ts +9 -0
- package/src/shade/renderer/restir/di/graph_restir_di.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/graph_restir_di.js +19 -1
- package/src/shade/renderer/restir/di/graph_restir_di_denoise.d.ts +6 -0
- package/src/shade/renderer/restir/di/graph_restir_di_denoise.d.ts.map +1 -1
- package/src/shade/renderer/restir/di/graph_restir_di_denoise.js +9 -0
- package/src/shade/renderer/scene/movers/graph_scene_movers.d.ts +7 -0
- package/src/shade/renderer/scene/movers/graph_scene_movers.d.ts.map +1 -1
- package/src/shade/renderer/scene/movers/graph_scene_movers.js +11 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts +10 -0
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +25 -1
- package/src/shade/renderer/shadow/vsm/graph_vsm_feedback.d.ts +7 -0
- package/src/shade/renderer/shadow/vsm/graph_vsm_feedback.d.ts.map +1 -1
- package/src/shade/renderer/shadow/vsm/graph_vsm_feedback.js +14 -0
- package/src/shade/renderer/text/shaders/shader_text_avboit.d.ts.map +1 -1
- package/src/shade/renderer/text/shaders/shader_text_avboit.js +5 -7
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts +9 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +16 -1
- package/src/shade/renderer/water/shader_water_avboit.d.ts.map +1 -1
- package/src/shade/renderer/water/shader_water_avboit.js +16 -13
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.d.ts +0 -33
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.d.ts.map +0 -1
- package/src/shade/renderer/rasterize/native/avboit/chunk_avboit_footprint_bias.js +0 -45
|
@@ -33,6 +33,10 @@ import {
|
|
|
33
33
|
HAIR_STATE_LAST_POSITION,
|
|
34
34
|
HAIR_STATE_NONE,
|
|
35
35
|
HAIR_STATE_POSITION,
|
|
36
|
+
HAIR_STATE_PREVIOUS_POSITION,
|
|
37
|
+
HAIR_STATE_PREVIOUS_ROTATION,
|
|
38
|
+
HAIR_STATE_SOLVED_POSITION,
|
|
39
|
+
HAIR_STATE_SOLVED_ROTATION,
|
|
36
40
|
HAIR_STATE_VELOCITY
|
|
37
41
|
} from "./HAIR_SIMULATION.js";
|
|
38
42
|
import { HAIR_LOD_WORKGROUP_SIZE } from "./shader_hair_lod.js";
|
|
@@ -140,9 +144,9 @@ pose_resources.createGroup()
|
|
|
140
144
|
.addStorageBuffer("hair_colliders", WebGPUArray.u32, true);
|
|
141
145
|
|
|
142
146
|
/**
|
|
143
|
-
* Writes each collider of the frame's list the way from the world into its own frame (`HAIR_COLLIDER_WORDS`),
|
|
144
|
-
* thread a collider, from its entity's world
|
|
145
|
-
* largest axis is taken.
|
|
147
|
+
* Writes each collider of the frame's list the way from the world into its own frame (`HAIR_COLLIDER_WORDS`), now
|
|
148
|
+
* and a frame ago, a thread a collider, from its entity's world matrices as the scene holds them: a rigid motion and
|
|
149
|
+
* a uniform scale, whose largest axis is taken.
|
|
146
150
|
*
|
|
147
151
|
* @type {ComputeShader}
|
|
148
152
|
*/
|
|
@@ -152,6 +156,22 @@ export const shader_hair_collider_poses = ComputeShader.from({
|
|
|
152
156
|
body: CodeChunk.from(
|
|
153
157
|
//language=WGSL
|
|
154
158
|
`
|
|
159
|
+
// the way from the world into the frame of a matrix, eight words from a word of the collider list
|
|
160
|
+
fn hair_collider_write_pose(at: u32, m: mat4x4<f32>) {
|
|
161
|
+
let scale = max(length(m[0].xyz), max(length(m[1].xyz), length(m[2].xyz)));
|
|
162
|
+
let rotation = quat_from_m3(mat3x3<f32>(m[0].xyz, m[1].xyz, m[2].xyz) * (1.0 / max(scale, 1e-30)));
|
|
163
|
+
let inverse = quat_conjugate(rotation);
|
|
164
|
+
|
|
165
|
+
hair_colliders[at] = bitcast<u32>(inverse.x);
|
|
166
|
+
hair_colliders[at + 1u] = bitcast<u32>(inverse.y);
|
|
167
|
+
hair_colliders[at + 2u] = bitcast<u32>(inverse.z);
|
|
168
|
+
hair_colliders[at + 3u] = bitcast<u32>(inverse.w);
|
|
169
|
+
hair_colliders[at + 4u] = bitcast<u32>(m[3].x);
|
|
170
|
+
hair_colliders[at + 5u] = bitcast<u32>(m[3].y);
|
|
171
|
+
hair_colliders[at + 6u] = bitcast<u32>(m[3].z);
|
|
172
|
+
hair_colliders[at + 7u] = bitcast<u32>(scale);
|
|
173
|
+
}
|
|
174
|
+
|
|
155
175
|
@compute @workgroup_size(${COMPUTE_SHADER_DEFAULT_GROUP_SIZE})
|
|
156
176
|
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
157
177
|
if (id.x >= settings.count) {
|
|
@@ -159,20 +179,10 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
|
159
179
|
}
|
|
160
180
|
|
|
161
181
|
let at = settings.first + id.x * ${HAIR_COLLIDER_WORDS}u;
|
|
162
|
-
let
|
|
163
|
-
|
|
164
|
-
let scale = max(length(m[0].xyz), max(length(m[1].xyz), length(m[2].xyz)));
|
|
165
|
-
let rotation = quat_from_m3(mat3x3<f32>(m[0].xyz, m[1].xyz, m[2].xyz) * (1.0 / max(scale, 1e-30)));
|
|
166
|
-
let inverse = quat_conjugate(rotation);
|
|
182
|
+
let node = scene_read_node(&scene_database, hair_colliders[at + 1u]);
|
|
167
183
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
hair_colliders[at + 10u] = bitcast<u32>(inverse.z);
|
|
171
|
-
hair_colliders[at + 11u] = bitcast<u32>(inverse.w);
|
|
172
|
-
hair_colliders[at + 12u] = bitcast<u32>(m[3].x);
|
|
173
|
-
hair_colliders[at + 13u] = bitcast<u32>(m[3].y);
|
|
174
|
-
hair_colliders[at + 14u] = bitcast<u32>(m[3].z);
|
|
175
|
-
hair_colliders[at + 15u] = bitcast<u32>(scale);
|
|
184
|
+
hair_collider_write_pose(at + 8u, node.global);
|
|
185
|
+
hair_collider_write_pose(at + 16u, node.prev_global);
|
|
176
186
|
}
|
|
177
187
|
`, [chunk_scene_database_access, chunk_quat_from_m3, chunk_quat_conjugate]),
|
|
178
188
|
});
|
|
@@ -180,10 +190,18 @@ fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
|
180
190
|
export const HAIR_SIMULATE_SETTINGS = WebGPUStruct.from({
|
|
181
191
|
/** the world's gravity, metres a second squared */
|
|
182
192
|
gravity: vec3f,
|
|
183
|
-
/** a
|
|
193
|
+
/** a step, seconds */
|
|
184
194
|
step: f32,
|
|
185
|
-
/**
|
|
186
|
-
|
|
195
|
+
/** steps this frame */
|
|
196
|
+
steps: u32,
|
|
197
|
+
/** the share of the frame's motion the first step falls at, a frame ago at 0 and now at 1 */
|
|
198
|
+
first: f32,
|
|
199
|
+
/** the share of the frame's motion from a step to the next */
|
|
200
|
+
stride: f32,
|
|
201
|
+
/** how far what is drawn is from the step before the last, 0, to the last, 1 */
|
|
202
|
+
blend: f32,
|
|
203
|
+
/** the scene's clock moved this frame, seconds */
|
|
204
|
+
seconds: f32,
|
|
187
205
|
}, "HairSimulateSettings");
|
|
188
206
|
|
|
189
207
|
const simulate_resources = new ShaderResourceSetDescriptor();
|
|
@@ -216,8 +234,9 @@ fn hair_ordered(v: f32) -> u32 {
|
|
|
216
234
|
return bits ^ select(0x80000000u, 0xFFFFFFFFu, (bits & 0x80000000u) != 0u);
|
|
217
235
|
}
|
|
218
236
|
|
|
219
|
-
// pushes a node out of the instance's colliders, by its wisp's radius, and takes away part of its sliding along them
|
|
220
|
-
|
|
237
|
+
// pushes a node out of the instance's colliders, by its wisp's radius, and takes away part of its sliding along them;
|
|
238
|
+
// the colliders where they are at a share of the frame's motion, a frame ago at 0 and now at 1
|
|
239
|
+
fn hair_collide(row: u32, anchor: vec3<f32>, start: vec3<f32>, position: vec3<f32>, radius: f32, share: f32) -> vec3<f32> {
|
|
221
240
|
var p = position;
|
|
222
241
|
|
|
223
242
|
let first = hair_colliders[row * 2u];
|
|
@@ -234,9 +253,16 @@ fn hair_collide(row: u32, anchor: vec3<f32>, start: vec3<f32>, position: vec3<f3
|
|
|
234
253
|
let friction = bitcast<f32>(hair_colliders[at + 2u]);
|
|
235
254
|
let inflation = bitcast<f32>(hair_colliders[at + 3u]);
|
|
236
255
|
let parameters = bitcast<vec4<f32>>(vec4<u32>(hair_colliders[at + 4u], hair_colliders[at + 5u], hair_colliders[at + 6u], hair_colliders[at + 7u]));
|
|
237
|
-
let
|
|
238
|
-
let
|
|
239
|
-
let
|
|
256
|
+
let inverse_now = bitcast<vec4<f32>>(vec4<u32>(hair_colliders[at + 8u], hair_colliders[at + 9u], hair_colliders[at + 10u], hair_colliders[at + 11u]));
|
|
257
|
+
let origin_now = bitcast<vec3<f32>>(vec3<u32>(hair_colliders[at + 12u], hair_colliders[at + 13u], hair_colliders[at + 14u]));
|
|
258
|
+
let scale_now = bitcast<f32>(hair_colliders[at + 15u]);
|
|
259
|
+
let inverse_before = bitcast<vec4<f32>>(vec4<u32>(hair_colliders[at + 16u], hair_colliders[at + 17u], hair_colliders[at + 18u], hair_colliders[at + 19u]));
|
|
260
|
+
let origin_before = bitcast<vec3<f32>>(vec3<u32>(hair_colliders[at + 20u], hair_colliders[at + 21u], hair_colliders[at + 22u]));
|
|
261
|
+
let scale_before = bitcast<f32>(hair_colliders[at + 23u]);
|
|
262
|
+
|
|
263
|
+
let inverse = hair_quat_nlerp(inverse_before, inverse_now, share);
|
|
264
|
+
let origin = mix(origin_before, origin_now, share);
|
|
265
|
+
let scale = mix(scale_before, scale_now, share);
|
|
240
266
|
|
|
241
267
|
let local = quat_rotate_v3(inverse, anchor + p - origin) / scale;
|
|
242
268
|
let field = shape_record_signed_distance_gradient(kind, parameters, local);
|
|
@@ -247,7 +273,7 @@ fn hair_collide(row: u32, anchor: vec3<f32>, start: vec3<f32>, position: vec3<f3
|
|
|
247
273
|
|
|
248
274
|
p -= normal * depth;
|
|
249
275
|
|
|
250
|
-
// positional friction: of the sliding this
|
|
276
|
+
// positional friction: of the sliding this step, as much is taken away as the push out was deep
|
|
251
277
|
let travel = p - start;
|
|
252
278
|
let sliding = travel - normal * dot(travel, normal);
|
|
253
279
|
let length_ = length(sliding);
|
|
@@ -320,6 +346,11 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
320
346
|
|
|
321
347
|
const IDENTITY = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
|
322
348
|
|
|
349
|
+
// the root's frame now: its rotation, and where the root is
|
|
350
|
+
let turn_now = normalize(quat_from_m3(now * (1.0 / max(scale, 1e-30))));
|
|
351
|
+
let rest_0 = hair_rest_point(instance, strand, 0u).xyz;
|
|
352
|
+
let root_now = now * rest_0 + now_origin;
|
|
353
|
+
|
|
323
354
|
if (reset) {
|
|
324
355
|
// at rest in the entity's frame, still
|
|
325
356
|
for (var i = 0u; i < nodes; i++) {
|
|
@@ -330,34 +361,42 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
330
361
|
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_FRAME}u, i, guide)] = IDENTITY;
|
|
331
362
|
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_LAST_POSITION}u, i, guide)] = vec4<f32>(x, 0.0);
|
|
332
363
|
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_LAST_FRAME}u, i, guide)] = IDENTITY;
|
|
364
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)] = vec4<f32>(x, 0.0);
|
|
365
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, i, guide)] = turn_now;
|
|
366
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_POSITION}u, i, guide)] = vec4<f32>(quat_rotate_v3(quat_conjugate(turn_now), x - root_now), 0.0);
|
|
367
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_ROTATION}u, i, guide)] = IDENTITY;
|
|
333
368
|
}
|
|
334
|
-
} else
|
|
335
|
-
//
|
|
336
|
-
// own geometry is, and what was becomes a frame ago
|
|
337
|
-
let before_scale = max(length(before[0]), max(length(before[1]), length(before[2])));
|
|
338
|
-
let carry = now * (transpose(before) * (1.0 / max(before_scale * before_scale, 1e-30)));
|
|
339
|
-
let turn = quat_from_m3(carry * (before_scale / max(scale, 1e-30)));
|
|
340
|
-
|
|
369
|
+
} else {
|
|
370
|
+
// the frame begins: what was drawn becomes a frame ago, and the solved positions follow the anchor
|
|
341
371
|
for (var i = 0u; i < nodes; i++) {
|
|
342
|
-
let
|
|
343
|
-
let
|
|
344
|
-
let
|
|
372
|
+
let drawn = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_POSITION}u, i, guide)].xyz - moved;
|
|
373
|
+
let drawn_frame = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_FRAME}u, i, guide)];
|
|
374
|
+
let x = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)].xyz - moved;
|
|
345
375
|
|
|
346
|
-
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_LAST_POSITION}u, i, guide)] = vec4<f32>(
|
|
347
|
-
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_LAST_FRAME}u, i, guide)] =
|
|
348
|
-
hair_guide_state[hair_state_index(instance, ${
|
|
349
|
-
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_VELOCITY}u, i, guide)] = vec4<f32>(quat_rotate_v3(turn, v), 0.0);
|
|
350
|
-
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_FRAME}u, i, guide)] = quat_multiply(quat_multiply(turn, q), quat_conjugate(turn));
|
|
376
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_LAST_POSITION}u, i, guide)] = vec4<f32>(drawn, 0.0);
|
|
377
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_LAST_FRAME}u, i, guide)] = drawn_frame;
|
|
378
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)] = vec4<f32>(x, 0.0);
|
|
351
379
|
}
|
|
352
|
-
} else {
|
|
353
|
-
// the frame begins: positions follow the anchor, and what is now becomes a frame ago
|
|
354
|
-
for (var i = 0u; i < nodes; i++) {
|
|
355
|
-
let x = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_POSITION}u, i, guide)].xyz - moved;
|
|
356
|
-
let q = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_FRAME}u, i, guide)];
|
|
357
380
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
381
|
+
if (settings.seconds == 0.0) {
|
|
382
|
+
// no time this frame: the solved state is carried with the entity from where it was to where it is, the
|
|
383
|
+
// way its own geometry is
|
|
384
|
+
let before_scale = max(length(before[0]), max(length(before[1]), length(before[2])));
|
|
385
|
+
let carry = now * (transpose(before) * (1.0 / max(before_scale * before_scale, 1e-30)));
|
|
386
|
+
let turn = normalize(quat_from_m3(carry * (before_scale / max(scale, 1e-30))));
|
|
387
|
+
let grown = scale / max(before_scale, 1e-30);
|
|
388
|
+
|
|
389
|
+
for (var i = 0u; i < nodes; i++) {
|
|
390
|
+
let x = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)].xyz;
|
|
391
|
+
let v = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_VELOCITY}u, i, guide)].xyz;
|
|
392
|
+
let q = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, i, guide)];
|
|
393
|
+
let u = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_POSITION}u, i, guide)].xyz;
|
|
394
|
+
|
|
395
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)] = vec4<f32>(carry * (x - before_origin) + now_origin, 0.0);
|
|
396
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_VELOCITY}u, i, guide)] = vec4<f32>(quat_rotate_v3(turn, v), 0.0);
|
|
397
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, i, guide)] = normalize(quat_multiply(turn, q));
|
|
398
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_POSITION}u, i, guide)] = vec4<f32>(u * grown, 0.0);
|
|
399
|
+
}
|
|
361
400
|
}
|
|
362
401
|
|
|
363
402
|
let h = settings.step;
|
|
@@ -366,22 +405,36 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
366
405
|
let keep_velocity = exp(-instance.damping * h);
|
|
367
406
|
let local_pull = 1.0 - exp(-instance.local_shape_rate * h);
|
|
368
407
|
|
|
369
|
-
|
|
408
|
+
for (var k = 0u; k < settings.steps; k++) {
|
|
409
|
+
if (k + 1u == settings.steps) {
|
|
410
|
+
// what the last step starts from is what the drawn state is blended from: in its root's frame
|
|
411
|
+
let from_root = quat_conjugate(hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, 0u, guide)]);
|
|
412
|
+
let root_before = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, 0u, guide)].xyz;
|
|
370
413
|
|
|
371
|
-
|
|
372
|
-
|
|
414
|
+
for (var i = 0u; i < nodes; i++) {
|
|
415
|
+
let x = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)].xyz;
|
|
416
|
+
let q = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, i, guide)];
|
|
373
417
|
|
|
374
|
-
|
|
375
|
-
|
|
418
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_POSITION}u, i, guide)] = vec4<f32>(quat_rotate_v3(from_root, x - root_before), 0.0);
|
|
419
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_ROTATION}u, i, guide)] = quat_multiply(from_root, q);
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// the world at the step's time: the entity's frame, the anchor being where the frame ends
|
|
424
|
+
let f = settings.first + f32(k) * settings.stride;
|
|
376
425
|
let linear = mat3x3<f32>(mix(before[0], now[0], f), mix(before[1], now[1], f), mix(before[2], now[2], f));
|
|
377
426
|
let origin = mix(before_origin, now_origin, f);
|
|
378
427
|
|
|
428
|
+
let linear_scale = max(length(linear[0]), max(length(linear[1]), length(linear[2])));
|
|
429
|
+
let turn = normalize(quat_from_m3(linear * (1.0 / max(linear_scale, 1e-30))));
|
|
430
|
+
|
|
379
431
|
// the root rides the entity; the first segment's rest direction is held by the local shape, from the
|
|
380
432
|
// entity's frame
|
|
381
433
|
let root = origin + linear * rest_0;
|
|
382
434
|
var parent = root;
|
|
383
435
|
|
|
384
|
-
hair_guide_state[hair_state_index(instance, ${
|
|
436
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, 0u, guide)] = vec4<f32>(root, 0.0);
|
|
437
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, 0u, guide)] = turn;
|
|
385
438
|
|
|
386
439
|
var rest_parent = rest_0;
|
|
387
440
|
var arc = 0.0;
|
|
@@ -395,7 +448,7 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
395
448
|
for (var i = 1u; i < nodes; i++) {
|
|
396
449
|
let rest = hair_rest_point(instance, strand, i * step).xyz;
|
|
397
450
|
|
|
398
|
-
let x = hair_guide_state[hair_state_index(instance, ${
|
|
451
|
+
let x = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)].xyz;
|
|
399
452
|
var v = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_VELOCITY}u, i, guide)].xyz;
|
|
400
453
|
|
|
401
454
|
// predict: damping and gravity, then the drag of the wisp relaxing the velocity toward the air's
|
|
@@ -420,7 +473,7 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
420
473
|
|
|
421
474
|
p += local_pull * (parent + quat_rotate_v3(frame, segment) - p);
|
|
422
475
|
|
|
423
|
-
p = hair_collide(row, anchor, x, p, radius);
|
|
476
|
+
p = hair_collide(row, anchor, x, p, radius, f);
|
|
424
477
|
|
|
425
478
|
// follow the leader: back onto the sphere of the segment's length about the parent
|
|
426
479
|
let reach = p - parent;
|
|
@@ -461,13 +514,11 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
461
514
|
if (pending) {
|
|
462
515
|
pending_velocity -= correction * (${HAIR_FOLLOW_THE_LEADER_DAMPING} / h);
|
|
463
516
|
|
|
464
|
-
hair_guide_state[hair_state_index(instance, ${
|
|
517
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i - 1u, guide)] = vec4<f32>(pending_position, 0.0);
|
|
465
518
|
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_VELOCITY}u, i - 1u, guide)] = vec4<f32>(pending_velocity, 0.0);
|
|
466
|
-
}
|
|
467
519
|
|
|
468
|
-
if (last_substep && i >= 2u) {
|
|
469
520
|
// a node's frame blends the segments either side of it; the root's is the entity's
|
|
470
|
-
hair_guide_state[hair_state_index(instance, ${
|
|
521
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, i - 1u, guide)] = quat_multiply(hair_quat_nlerp(frame, next_frame, 0.5), turn);
|
|
471
522
|
}
|
|
472
523
|
|
|
473
524
|
pending_position = p;
|
|
@@ -480,14 +531,30 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
480
531
|
}
|
|
481
532
|
|
|
482
533
|
if (pending) {
|
|
483
|
-
hair_guide_state[hair_state_index(instance, ${
|
|
534
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, nodes - 1u, guide)] = vec4<f32>(pending_position, 0.0);
|
|
484
535
|
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_VELOCITY}u, nodes - 1u, guide)] = vec4<f32>(pending_velocity, 0.0);
|
|
536
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, nodes - 1u, guide)] = quat_multiply(frame, turn);
|
|
485
537
|
}
|
|
538
|
+
}
|
|
486
539
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
540
|
+
// what is drawn: between the last two steps in the root's frame, carried by the root's frame now
|
|
541
|
+
let solved_turn = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, 0u, guide)];
|
|
542
|
+
let solved_root = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, 0u, guide)].xyz;
|
|
543
|
+
let from_solved = quat_conjugate(solved_turn);
|
|
544
|
+
let carry_solved = quat_multiply(turn_now, from_solved);
|
|
545
|
+
let from_now = quat_conjugate(turn_now);
|
|
546
|
+
|
|
547
|
+
for (var i = 0u; i < nodes; i++) {
|
|
548
|
+
let x = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_POSITION}u, i, guide)].xyz;
|
|
549
|
+
let q = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_SOLVED_ROTATION}u, i, guide)];
|
|
550
|
+
let u = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_POSITION}u, i, guide)].xyz;
|
|
551
|
+
let w = hair_guide_state[hair_state_index(instance, ${HAIR_STATE_PREVIOUS_ROTATION}u, i, guide)];
|
|
552
|
+
|
|
553
|
+
let place = mix(quat_rotate_v3(turn_now, u), quat_rotate_v3(carry_solved, x - solved_root), settings.blend);
|
|
554
|
+
let turned = hair_quat_nlerp(w, quat_multiply(from_solved, q), settings.blend);
|
|
555
|
+
|
|
556
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_POSITION}u, i, guide)] = vec4<f32>(root_now + place, 0.0);
|
|
557
|
+
hair_guide_state[hair_state_index(instance, ${HAIR_STATE_FRAME}u, i, guide)] = quat_multiply(quat_multiply(turn_now, turned), from_now);
|
|
491
558
|
}
|
|
492
559
|
}
|
|
493
560
|
|
|
@@ -527,14 +594,16 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
527
594
|
]);
|
|
528
595
|
|
|
529
596
|
/**
|
|
530
|
-
* Steps every simulated instance's guides through the frame
|
|
531
|
-
* of a row found from the inclusive sums of the rows' guide counts.
|
|
597
|
+
* Steps every simulated instance's guides through the frame's steps and writes what is drawn of them, a thread a
|
|
598
|
+
* guide (`HAIR_SIMULATION.js`), the threads of a row found from the inclusive sums of the rows' guide counts.
|
|
532
599
|
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
600
|
+
* Every step is `settings.step` long; a frame takes `settings.steps` of them, none when its time has not reached the
|
|
601
|
+
* next (`hair_frame_steps`). A step reads the world at its own time within the frame: a guide's root rides the
|
|
602
|
+
* entity, or its strand's root frame where the instance is bound to a mesh, the frame taken linearly from a frame
|
|
603
|
+
* ago to now at the step's share of the frame's motion, and the colliders are where they were at that share. The
|
|
604
|
+
* first segment's rest direction is held, as every other's, by the local shape from the entity's frame. A frame of
|
|
605
|
+
* no time carries the solved state rigidly from the entity's frame a frame ago to now, as its own geometry is
|
|
606
|
+
* carried. Each step, from the node after the root to the tip, a node:
|
|
538
607
|
*
|
|
539
608
|
* - **predicts**: its velocity loses `1 − e^(−damping·h)`, gains gravity, and relaxes toward the air's
|
|
540
609
|
* (`wind_field_sample` at the node) as `v ← u + (v − u) e^(−k h)`, `k` the wisp's drag rate
|
|
@@ -542,17 +611,21 @@ fn main(@builtin(workgroup_id) workgroup_id: vec3<u32>, @builtin(local_invocatio
|
|
|
542
611
|
* - is pulled toward its rest place in the entity's frame (**global shape**) at a rate that falls from
|
|
543
612
|
* `global_shape_rate` at the root to nothing at `global_shape_range` of the length, and toward its rest
|
|
544
613
|
* direction turned by its parent's frame (**local shape**) at `local_shape_rate`, each a share
|
|
545
|
-
* `1 − e^(−rate·h)
|
|
614
|
+
* `1 − e^(−rate·h)` a step;
|
|
546
615
|
* - is pushed out of each of its instance's colliders by its wisp's radius plus the instance's thickness and the
|
|
547
616
|
* collider's inflation, and loses `friction` of its sliding along it per push out as deep as the sliding;
|
|
548
617
|
* - is put back onto the sphere of its rest segment's length about its parent (**follow the leader**), and never
|
|
549
|
-
* farther from the root than its length along the guide; its velocity is its move over the
|
|
550
|
-
* parent's loses `HAIR_FOLLOW_THE_LEADER_DAMPING` of this node's correction over the
|
|
618
|
+
* farther from the root than its length along the guide; its velocity is its move over the step, and its
|
|
619
|
+
* parent's loses `HAIR_FOLLOW_THE_LEADER_DAMPING` of this node's correction over the step (Müller's DFTL).
|
|
551
620
|
*
|
|
552
621
|
* A segment's frame is its parent's, turned the least that takes the rest direction it predicts to the direction
|
|
553
|
-
* the segment has; a node's frame
|
|
554
|
-
*
|
|
555
|
-
*
|
|
622
|
+
* the segment has; a node's frame blends the two segments either side of it. A state to be laid at rest is the rest
|
|
623
|
+
* pose, still. Colliders and the wind are read in the world: the anchor plus a node's position.
|
|
624
|
+
*
|
|
625
|
+
* **What is drawn**, every frame, stepped or not: each node between where the last two steps solved it, in the frame
|
|
626
|
+
* of its guide's root at each, `settings.blend` of the way from the step before the last to the last, carried by the
|
|
627
|
+
* root's frame now. The drawn root is the root now; what was drawn the frame before is kept as a frame ago. The drawn
|
|
628
|
+
* nodes' bounds, from the anchor, are gathered into the row's guide bounds.
|
|
556
629
|
*
|
|
557
630
|
* @type {ComputeShader}
|
|
558
631
|
*/
|
|
@@ -119,6 +119,14 @@
|
|
|
119
119
|
* something to upload.
|
|
120
120
|
*/
|
|
121
121
|
export class GPUParticleSystem {
|
|
122
|
+
/**
|
|
123
|
+
* Offer the pipelines a scene's particles are simulated and drawn with — see {@link PipelineEnquiry}: the
|
|
124
|
+
* simulation, the lists' upkeep as the pool grows and shrinks, and the three passes it adds to the AVBOIT
|
|
125
|
+
* transparency pipeline. The same for every program: an effect brings bytecode, not a pipeline.
|
|
126
|
+
*
|
|
127
|
+
* @param {import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
128
|
+
*/
|
|
129
|
+
static enquirePipelines(enquiry: import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
122
130
|
/**
|
|
123
131
|
* @param {object} graphics engine GraphicsContext (has `.device`)
|
|
124
132
|
* @param {import("../scene/GPUSceneContext.js").GPUSceneContext} scene_context
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUParticleSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/particles/GPUParticleSystem.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUParticleSystem.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/particles/GPUParticleSystem.js"],"names":[],"mappings":"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"}
|
|
@@ -19,13 +19,14 @@ import {
|
|
|
19
19
|
particle_bounds_empty_words,
|
|
20
20
|
particle_counters_word_count,
|
|
21
21
|
} from "./data/PARTICLE_COUNTERS.js";
|
|
22
|
-
import { graph_particles_simulate } from "./graph_particles.js";
|
|
22
|
+
import { enquire_particles_simulate_pipelines, graph_particles_simulate } from "./graph_particles.js";
|
|
23
23
|
import { PARTICLE_FIELD_BIND_WORKGROUP_SIZE } from "./shaders/shader_particle_field_bind.js";
|
|
24
24
|
import {
|
|
25
25
|
SLOT_STACK_FILL_WORKGROUP_SIZE,
|
|
26
26
|
shader_slot_stack_fill,
|
|
27
27
|
} from "../gpu_primitive/slot_stack/shader_slot_stack_fill.js";
|
|
28
28
|
import {
|
|
29
|
+
enquire_particle_avboit_pipelines,
|
|
29
30
|
graph_particle_avboit_draw,
|
|
30
31
|
graph_particle_avboit_occupancy,
|
|
31
32
|
graph_particle_avboit_splat,
|
|
@@ -193,6 +194,24 @@ const DEFAULT_CAPACITY = 65536;
|
|
|
193
194
|
*/
|
|
194
195
|
export class GPUParticleSystem {
|
|
195
196
|
|
|
197
|
+
/**
|
|
198
|
+
* Offer the pipelines a scene's particles are simulated and drawn with — see {@link PipelineEnquiry}: the
|
|
199
|
+
* simulation, the lists' upkeep as the pool grows and shrinks, and the three passes it adds to the AVBOIT
|
|
200
|
+
* transparency pipeline. The same for every program: an effect brings bytecode, not a pipeline.
|
|
201
|
+
*
|
|
202
|
+
* @param {import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
203
|
+
*/
|
|
204
|
+
static enquirePipelines(enquiry) {
|
|
205
|
+
enquiry.compute.push(shader_slot_stack_fill.pipeline);
|
|
206
|
+
enquiry.compute.push(shader_slot_stack_push_range.pipeline);
|
|
207
|
+
enquiry.compute.push(shader_particle_shrink_free_list.pipeline);
|
|
208
|
+
enquiry.compute.push(shader_particle_shrink_alive_list.pipeline);
|
|
209
|
+
enquiry.compute.push(shader_buffer_copy_storage_to_storage.pipeline);
|
|
210
|
+
|
|
211
|
+
enquire_particles_simulate_pipelines(enquiry);
|
|
212
|
+
enquire_particle_avboit_pipelines(enquiry);
|
|
213
|
+
}
|
|
214
|
+
|
|
196
215
|
/**
|
|
197
216
|
* Engine GraphicsContext.
|
|
198
217
|
* @type {object}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offer the pipelines {@link graph_particle_bounds} dispatches — see {@link PipelineEnquiry}.
|
|
3
|
+
*
|
|
4
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
5
|
+
*/
|
|
6
|
+
export function enquire_particle_bounds_pipelines(enquiry: import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
1
7
|
/**
|
|
2
8
|
* Frame-graph wiring for the measured emitter bounds: the frame's alive list reduced to one
|
|
3
9
|
* world-space box per emitter, published where the culling and occupancy passes read it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_particle_bounds.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/bounds/graph_particle_bounds.js"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAVqG,KAAK,EAA/F,OAAO,8DAA8D,EAAE,UAAU;IAClE,gBAAgB,EAA/B,MAAM;IACS,IAAI,EAAnB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,QAAQ,EAAvB,MAAM;IACS,aAAa,EAA5B,MAAM;IACS,mBAAmB,EAAlC,MAAM;IAEJ;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAC,CAwCxD"}
|
|
1
|
+
{"version":3,"file":"graph_particle_bounds.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/bounds/graph_particle_bounds.js"],"names":[],"mappings":"AAQA;;;;GAIG;AACH,2DAFW,OAAO,6CAA6C,EAAE,eAAe,QAK/E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH;IAVqG,KAAK,EAA/F,OAAO,8DAA8D,EAAE,UAAU;IAClE,gBAAgB,EAA/B,MAAM;IACS,IAAI,EAAnB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,QAAQ,EAAvB,MAAM;IACS,aAAa,EAA5B,MAAM;IACS,mBAAmB,EAAlC,MAAM;IAEJ;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAC,CAwCxD"}
|
|
@@ -6,6 +6,16 @@ import {
|
|
|
6
6
|
shader_particle_bounds_publish,
|
|
7
7
|
} from "./shader_particle_bounds.js";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Offer the pipelines {@link graph_particle_bounds} dispatches — see {@link PipelineEnquiry}.
|
|
11
|
+
*
|
|
12
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
13
|
+
*/
|
|
14
|
+
export function enquire_particle_bounds_pipelines(enquiry) {
|
|
15
|
+
enquiry.compute.push(shader_particle_bounds_accumulate.pipeline);
|
|
16
|
+
enquiry.compute.push(shader_particle_bounds_publish.pipeline);
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
/**
|
|
10
20
|
* Frame-graph wiring for the measured emitter bounds: the frame's alive list reduced to one
|
|
11
21
|
* world-space box per emitter, published where the culling and occupancy passes read it.
|
|
@@ -56,7 +66,7 @@ export function graph_particle_bounds({
|
|
|
56
66
|
const published = graph_compute_pass({
|
|
57
67
|
graph,
|
|
58
68
|
shader: shader_particle_bounds_publish,
|
|
59
|
-
bindings: { emitter_database, counters: accumulated.counters },
|
|
69
|
+
bindings: { emitter_database, counters: accumulated.counters },
|
|
60
70
|
group_count: [emitter_group_count, 1, 1],
|
|
61
71
|
});
|
|
62
72
|
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offer the pipelines {@link graph_particle_bucket} dispatches — see {@link PipelineEnquiry}.
|
|
3
|
+
*
|
|
4
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
5
|
+
*/
|
|
6
|
+
export function enquire_particle_bucket_pipelines(enquiry: import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
1
7
|
/**
|
|
2
8
|
* @typedef {{keys: number, histogram: number, scanned: number, cursor: number, bucket_counts: number, dispatch_args: number}} ParticleBucketScratch
|
|
3
9
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_particle_bucket.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/coherence/graph_particle_bucket.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph_particle_bucket.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/particles/coherence/graph_particle_bucket.js"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,2DAFW,OAAO,6CAA6C,EAAE,eAAe,QAS/E;AAED;;GAEG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH;IAdqG,KAAK,EAA/F,OAAO,8DAA8D,EAAE,UAAU;IAClE,gBAAgB,EAA/B,MAAM;IACS,IAAI,EAAnB,MAAM;IACS,KAAK,EAApB,MAAM;IACS,QAAQ,EAAvB,MAAM;IACS,QAAQ,EAAvB,MAAM;IAIS,QAAQ,EAAvB,MAAM;IACS,YAAY,EAA3B,MAAM;IACyB,OAAO,GAAtC,qBAAqB;IACnB;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,qBAAqB,CAAA;CAAC,CA8GvG;oCAhKY;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAC"}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
PREFIX_SCAN_CSDLDF_HEADER_WORDS,
|
|
8
8
|
} from "../../gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js";
|
|
9
9
|
import {
|
|
10
|
+
enquire_prefix_scan_csdldf_pipelines,
|
|
10
11
|
graph_prefix_scan_csdldf,
|
|
11
12
|
prefix_scan_csdldf_output_descriptor
|
|
12
13
|
} from "../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
@@ -22,6 +23,20 @@ import {
|
|
|
22
23
|
|
|
23
24
|
const WORD = Uint32Array.BYTES_PER_ELEMENT;
|
|
24
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Offer the pipelines {@link graph_particle_bucket} dispatches — see {@link PipelineEnquiry}.
|
|
28
|
+
*
|
|
29
|
+
* @param {import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
30
|
+
*/
|
|
31
|
+
export function enquire_particle_bucket_pipelines(enquiry) {
|
|
32
|
+
enquiry.compute.push(shader_particle_bucket_reset.pipeline);
|
|
33
|
+
enquiry.compute.push(shader_particle_bucket_histogram.pipeline);
|
|
34
|
+
enquire_prefix_scan_csdldf_pipelines(enquiry);
|
|
35
|
+
enquiry.compute.push(shader_particle_bucket_pad.pipeline);
|
|
36
|
+
enquiry.compute.push(shader_particle_bucket_scatter.pipeline);
|
|
37
|
+
enquiry.compute.push(shader_particle_bucket_fill.pipeline);
|
|
38
|
+
}
|
|
39
|
+
|
|
25
40
|
/**
|
|
26
41
|
* @typedef {{keys: number, histogram: number, scanned: number, cursor: number, bucket_counts: number, dispatch_args: number}} ParticleBucketScratch
|
|
27
42
|
*/
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offer the pipelines {@link graph_particles_simulate} dispatches — see {@link PipelineEnquiry}: a frame's emitter
|
|
3
|
+
* tick, emission and simulation at either register width, the coherence pass, the measured bounds, and the warm-up
|
|
4
|
+
* of emitters that start ahead.
|
|
5
|
+
*
|
|
6
|
+
* @param {import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
7
|
+
*/
|
|
8
|
+
export function enquire_particles_simulate_pipelines(enquiry: import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry): void;
|
|
1
9
|
/**
|
|
2
10
|
* The simulation half of the particle system's frame, recorded into the frame graph.
|
|
3
11
|
* {@link GPUParticleSystem#execute} is what calls it, with the buffers it owns; nothing else needs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph_particles.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/particles/graph_particles.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph_particles.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/particles/graph_particles.js"],"names":[],"mappings":"AA4CA;;;;;;GAMG;AACH,8DAFW,OAAO,0CAA0C,EAAE,eAAe,QAiB5E;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuEG;AAEH;;;;;;;GAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH;IAtCkG,KAAK,EAA5F,OAAO,2DAA2D,EAAE,UAAU;IAC/D,MAAM,EAArB,MAAM;IACS,cAAc,EAA7B,MAAM;IACiD,IAAI,EAA3D,OAAO,yBAAyB,EAAE,YAAY;IAE4D,SAAS,EAAnH,OAAO,oEAAoE,EAAE,oBAAoB;IAGlF,GAAG,EAAlB,MAAM;IAGS,QAAQ;QACC,QAAQ,EAAhC,MAAM;QAEkB,WAAW,EAAnC,MAAM;;IACS,QAAQ,EAAvB,MAAM;IACS,YAAY,EAA3B,MAAM;IAEU,cAAc,EAA9B,OAAO;IAGQ,KAAK;QACC,EAAE,EAAvB,MAAM;QACe,IAAI,EAAzB,MAAM;QACe,KAAK,EAA1B,MAAM;QACiB,QAAQ,GAA/B,OAAO;QACc,WAAW,EAAhC,MAAM;QACe,mBAAmB,EAAxC,MAAM;QACe,YAAY,EAAjC,MAAM;QAGe,eAAe,EAApC,MAAM;QAC6D,eAAe,EAAlF,OAAO,6BAA6B,EAAE,cAAc;;IAErB,cAAc,GAA7C;QAAC,WAAW,EAAE,MAAM,CAAA;KAAC;IAEnB,yBAAyB,CAsWrC;;;;;UArZa,MAAM;;;;WACN,MAAM;;;;eACN,MAAM;;;;;sBACN,MAAM"}
|
|
@@ -3,12 +3,13 @@ import { align_4 } from "../../../core/binary/align_4.js";
|
|
|
3
3
|
import { BufferResourceDescriptor } from "../../device/graph/BufferResourceDescriptor.js";
|
|
4
4
|
import { INDIRECT_COMPUTE_COMMAND_DESCRIPTOR } from "../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
|
|
5
5
|
import {
|
|
6
|
+
enquire_prefix_scan_csdldf_pipelines,
|
|
6
7
|
graph_prefix_scan_csdldf,
|
|
7
8
|
prefix_scan_csdldf_output_descriptor
|
|
8
9
|
} from "../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
9
10
|
import { PREFIX_SCAN_CSDLDF_HEADER_WORDS } from "../gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js";
|
|
10
11
|
import { shader_prefix_sum_to_command } from "../rasterize/expand/mesh/shader_prefix_sum_to_command.js";
|
|
11
|
-
import { graph_particle_bounds } from "./bounds/graph_particle_bounds.js";
|
|
12
|
+
import { enquire_particle_bounds_pipelines, graph_particle_bounds } from "./bounds/graph_particle_bounds.js";
|
|
12
13
|
import { graph_compute_indirect_pass } from "../shader/graph/compute/graph_compute_indirect_pass.js";
|
|
13
14
|
import { graph_compute_pass } from "../shader/graph/compute/graph_compute_pass.js";
|
|
14
15
|
import { graph_create_buffer } from "../shader/graph/graph_create_buffer.js";
|
|
@@ -18,7 +19,7 @@ import {
|
|
|
18
19
|
PARTICLE_VM_REGISTER_SLOTS,
|
|
19
20
|
PARTICLE_VM_WIDE_LAUNCH_LANES,
|
|
20
21
|
} from "./ParticleConstants.js";
|
|
21
|
-
import { graph_particle_bucket } from "./coherence/graph_particle_bucket.js";
|
|
22
|
+
import { enquire_particle_bucket_pipelines, graph_particle_bucket } from "./coherence/graph_particle_bucket.js";
|
|
22
23
|
import { shader_particle_emit } from "./shaders/shader_particle_emit.js";
|
|
23
24
|
import {
|
|
24
25
|
PARTICLE_EMIT_WIDE_WORKGROUP_COUNT,
|
|
@@ -39,7 +40,31 @@ import {
|
|
|
39
40
|
PARTICLE_SPAWN_COMMAND_WORKGROUP_SIZE,
|
|
40
41
|
shader_particle_spawn_commands,
|
|
41
42
|
} from "./shaders/shader_particle_spawn_commands.js";
|
|
42
|
-
import { graph_particle_warmup } from "./warmup/graph_particle_warmup.js";
|
|
43
|
+
import { enquire_particle_warmup_pipelines, graph_particle_warmup } from "./warmup/graph_particle_warmup.js";
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Offer the pipelines {@link graph_particles_simulate} dispatches — see {@link PipelineEnquiry}: a frame's emitter
|
|
47
|
+
* tick, emission and simulation at either register width, the coherence pass, the measured bounds, and the warm-up
|
|
48
|
+
* of emitters that start ahead.
|
|
49
|
+
*
|
|
50
|
+
* @param {import("../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry} enquiry
|
|
51
|
+
*/
|
|
52
|
+
export function enquire_particles_simulate_pipelines(enquiry) {
|
|
53
|
+
enquiry.compute.push(shader_particle_reset_counters.pipeline);
|
|
54
|
+
enquiry.compute.push(shader_particle_field_bind.pipeline);
|
|
55
|
+
enquiry.compute.push(shader_particle_spawn_commands.pipeline);
|
|
56
|
+
enquiry.compute.push(shader_particle_emitter_tick.pipeline);
|
|
57
|
+
enquire_prefix_scan_csdldf_pipelines(enquiry);
|
|
58
|
+
enquiry.compute.push(shader_prefix_sum_to_command.pipeline);
|
|
59
|
+
enquiry.compute.push(shader_particle_emit.pipeline);
|
|
60
|
+
enquiry.compute.push(shader_particle_emit_wide.pipeline);
|
|
61
|
+
enquiry.compute.push(shader_particle_simulate.pipeline);
|
|
62
|
+
enquiry.compute.push(shader_particle_simulate_wide.pipeline);
|
|
63
|
+
enquire_particle_warmup_pipelines(enquiry);
|
|
64
|
+
enquire_particle_bucket_pipelines(enquiry);
|
|
65
|
+
enquire_particle_bounds_pipelines(enquiry);
|
|
66
|
+
enquiry.compute.push(shader_particle_build_indirect.pipeline);
|
|
67
|
+
}
|
|
43
68
|
|
|
44
69
|
/**
|
|
45
70
|
* What {@link graph_particles_simulate} is told when nothing is bound.
|