@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
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
### Generation: wave function collapse over a grid
|
|
6
|
+
|
|
7
|
+
- **Added:** `GridTaskWaveFunctionCollapse`, a grid task that lays the tiles of a `GridWFCTileSet` over the whole
|
|
8
|
+
grid with the `core/wfc` solver and runs each tile's `GridCellAction` on its cell, turned as the tile is. Cells a
|
|
9
|
+
`CellMatcher` names can be restricted to tiles carrying a tag, the edge of the grid likewise, and the tiles of one
|
|
10
|
+
tag can be required to form one region — by swapping in a tile with the same sockets that carries the tag where
|
|
11
|
+
one keeps two regions apart, and by drawing again where none can. A `fallback` tile covers the grid when every draw
|
|
12
|
+
failed.
|
|
13
|
+
- **Added:** `generation/wfc/GridWFCTileSet`: tiles described by a socket on each edge, expanded into their quarter
|
|
14
|
+
turns and compiled to a `WFCRuleTable`. `add_piece` makes a piece of several cells, joined edge to edge, that only
|
|
15
|
+
ever appears whole; `compile().lint()` names a tile showing a socket nothing answers and tiles that can never share
|
|
16
|
+
a result (`WFC_DESIGN.md` §13).
|
|
17
|
+
|
|
18
|
+
### Cloth: a cloth that slides is not pulled back to where it landed
|
|
19
|
+
|
|
20
|
+
- **Fixed:** cloth friction pulled a sliding particle towards the point where its contact began, for as long as
|
|
21
|
+
the contact lasted. A sheet shoved across a floor swung back through where it started, and a sheet carried by a
|
|
22
|
+
turning collider went on round after the collider stopped. A friction row at its cap now brings its anchor up
|
|
23
|
+
behind the particle; a contact that holds is unchanged (cloth `MEASUREMENTS.md` §70).
|
|
24
|
+
- **Changed:** `cloth_contact_dual_update` takes `alpha` and `gamma` after the collider table.
|
|
25
|
+
|
|
5
26
|
### Sound: beat-locked music
|
|
6
27
|
|
|
7
28
|
- **Added:** `sopra/music/`, an adaptive score as layers of stems on one tempo grid. `MusicGrid` (tempo, meter
|
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
Meep is a game engine with a GPU-driven WebGPU renderer, physics, spatial audio, rollback
|
|
6
6
|
networking and an in-app editor.
|
|
7
7
|
|
|
8
|
-
[Examples](https://meep.company-named.com/examples/) · [Documentation](https://meep.company-named.com/docs/getting-started/) · [Licence & pricing](https://meep.company-named.com/pricing/)
|
|
8
|
+
[Examples](https://meep.company-named.com/examples/) · [Documentation](https://meep.company-named.com/docs/getting-started/) · [Licence & pricing](https://meep.company-named.com/pricing/) · [Check your device](https://webgpu.report/check?features=indirect-first-instance,float32-blendable,texture-formats-tier1,subgroups&maxStorageBuffersPerShaderStage=10&maxColorAttachmentBytesPerSample=32)
|
|
9
9
|
|
|
10
10
|
## Getting started
|
|
11
11
|
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* start(), stop(), render(), updateSize()}` — because that is what `Engine` needs in order to boot,
|
|
7
7
|
* and because the facade is deliberately not allowed to grow past §4.2 (D14).
|
|
8
8
|
*
|
|
9
|
-
* **
|
|
9
|
+
* **Five things have been let through since, each by name.** {@link add_extension} /
|
|
10
10
|
* {@link remove_extension} (E9), because an extension has to survive the restart that replaces the
|
|
11
11
|
* renderer holding it; {@link add_transparency_channel} / {@link remove_transparency_channel}
|
|
12
12
|
* (2026-09-24, trails), the same door for the one thing an extension cannot do — draw inside the
|
|
@@ -20,6 +20,10 @@
|
|
|
20
20
|
* callers that have no other route, not a migration target — the old engine's 44
|
|
21
21
|
* `.renderer`/`getRenderer()` call sites are each still a migration item.
|
|
22
22
|
*
|
|
23
|
+
* {@link renderer_configuration} is the fifth: what every renderer this engine starts begins as. It
|
|
24
|
+
* is held here for the reason extensions are — it is stated before a device exists, and it outlives
|
|
25
|
+
* the renderer a restart replaces — and it is data the caller writes, not the renderer.
|
|
26
|
+
*
|
|
23
27
|
* What is deliberately absent, and stays absent: `getRenderer()` (the old engine's accessor, and
|
|
24
28
|
* the shape those call sites are being ported off), `layers` (CPU visibility dies with GPU
|
|
25
29
|
* culling), `scene` (entities reach the scene through the mesh system, not through the facade),
|
|
@@ -44,6 +48,19 @@ export class GraphicsEngine {
|
|
|
44
48
|
* @returns {Renderer|null}
|
|
45
49
|
*/
|
|
46
50
|
get renderer(): Renderer;
|
|
51
|
+
/**
|
|
52
|
+
* What every renderer {@link start} makes begins as: the settings that decide which pipelines it
|
|
53
|
+
* compiles ahead of its first frame, so a frame is not held up compiling them when it first draws
|
|
54
|
+
* with them. Write to it before {@link start}.
|
|
55
|
+
*
|
|
56
|
+
* {@link start} reads it each time, so a restart begins from it again. Once a renderer is running
|
|
57
|
+
* its own fields are the state: a change made here waits for the next {@link start}, and a change
|
|
58
|
+
* made on the renderer does not come back here.
|
|
59
|
+
*
|
|
60
|
+
* @readonly
|
|
61
|
+
* @type {RendererConfiguration}
|
|
62
|
+
*/
|
|
63
|
+
readonly renderer_configuration: RendererConfiguration;
|
|
47
64
|
/**
|
|
48
65
|
* @param {boolean} v
|
|
49
66
|
*/
|
|
@@ -409,6 +426,7 @@ export type GPUSceneContext = import("../../shade/renderer/scene/GPUSceneContext
|
|
|
409
426
|
export type ShadeTexture = import("../../shade/renderer/texture/ShadeTexture.js").ShadeTexture;
|
|
410
427
|
export type Camera = import("../graphics/ecs/camera/Camera.js").Camera;
|
|
411
428
|
import { Renderer } from "../../shade/renderer/Renderer.js";
|
|
429
|
+
import { RendererConfiguration } from "../../shade/renderer/RendererConfiguration.js";
|
|
412
430
|
import { ShadeCameraAdapter } from "./ShadeCameraAdapter.js";
|
|
413
431
|
import Signal from "../../core/events/signal/Signal.js";
|
|
414
432
|
import { Vector2 } from "../../core/geom/Vector2.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GraphicsEngine.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/GraphicsEngine.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GraphicsEngine.d.ts","sourceRoot":"","sources":["../../../../src/engine/graphics3/GraphicsEngine.js"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH;IACI;;;;;OAKG;IACH,gCAEC;IAUD;;;;OAIG;IACH,yBAEC;IAED;;;;;;;;;;;OAWG;IACH,iCAFU,qBAAqB,CAEsB;IAwDrD;;OAEG;IACH,0CAQC;IAlBD;;OAEG;IACH,yCAEC;IA0CG;;;;;;OAMG;IACH,QAFU,kBAAkB,CAEsB;IAElD;QACI;;;;;;;;WAQG;mBADO,MAAM;QAIhB;;;;;WAKG;oBADO,MAAM;QAIhB;;;;WAIG;qBADO,MAAM;QAIhB;;;;;;;WAOG;;QAGH;;;;;WAKG;;MAEN;IAID;;;;;OAKG;IACH,4BAFU,OAAO,CAEyB;IAE1C;;;;;;OAMG;IACH,UAFU,SAAS,CAEY;IAG/B;;OAEG;IACH,YAFU,iBAAiB,GAAC,IAAI,CAEV;IAEtB;;;;;OAKG;IACH,UAFU,OAAO,CAEG;IAEpB;;;;;OAKG;IACH,UAFU,OAAO,CAEG;IAEpB;;OAEG;IACH,YAFU,MAAM,CAEG;IAoBvB;;;;;;;;;;;;OAYG;IACH,mDAEC;IAED;;;;;;;;OAQG;IACH,iBAFW,KAAK,QAgBf;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,6BAFW,YAAY,QAStB;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,yBAHW,eAAe,GACb,eAAe,CAa3B;IAED;;;;;;;;;;OAUG;IACH,uBAHW,UAAU,GACR,MAAM,CAclB;IAED;;;;;;OAMG;IACH,4BAHW,eAAe,GACb,OAAO,CAgBnB;IAED;;;;;;;;;;;;;OAaG;IACH,kCAHW,iBAAiB,GACf,iBAAiB,CAqB7B;IAED;;;;;;OAMG;IACH,8BAFa,MAAM,CAIlB;IAED;;;;;OAKG;IACH,qCAHW,iBAAiB,GACf,OAAO,CAgBnB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,qBALW,KAAK,GACH,eAAe,GAAC,IAAI,CAehC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,yBARW,KAAK,UACL,MAAM,SACN,MAAM,UACN,MAAM,GACJ,QAAQ,SAAS,CAAC,CAwD9B;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;;;;;;;OAUG;IACH,SAFa,QAAQ,IAAI,CAAC,CA4DzB;IAED;;;;;;;;;;;;;;;OAeG;IACH,qBAFW,iBAAiB,QAc3B;IAED;;;;;OAKG;IACH,aAiBC;IASD;;;;;;;;OAQG;IACH,8BAHW,OAAO,GAAC,OAAO,UACf,OAAO,GAAC,OAAO,QAQzB;IAED;;;;;;;;;;;;;;;OAeG;IACH,yBALW,MAAM,KACN,MAAM,UACN,OAAO,aACP,OAAO,QAIjB;IAED;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,mBAyBC;IAED;;;;;;;;;OASG;IACH,4BAPW,MAAM,GAKJ,OAAO,CA2DnB;;CACJ;sBA77BY,OAAO,4BAA4B,EAAE,OAAO;yBAC5C,OAAO,8CAA8C,EAAE,UAAU;8BACjE,OAAO,mDAAmD,EAAE,eAAe;gCAC3E,OAAO,mEAAmE,EAAE,iBAAiB;8BAC7F,OAAO,+CAA+C,EAAE,eAAe;2BACvE,OAAO,8CAA8C,EAAE,YAAY;qBACnE,OAAO,kCAAkC,EAAE,MAAM;yBAfrC,kCAAkC;sCACrB,+CAA+C;mCAKlD,yBAAyB;mBAZzC,oCAAoC;wBAC/B,4BAA4B;sBAS9B,kCAAkC;yCALf,kDAAkD;sBAGrE,qCAAqC;0BACjC,0CAA0C"}
|
|
@@ -6,6 +6,7 @@ import { TextureDescriptor } from "../../shade/descriptor/texture/TextureDescrip
|
|
|
6
6
|
import { PerspectiveCamera } from "../../shade/renderer/camera/PerspectiveCamera.js";
|
|
7
7
|
import { DynamicResolutionScaling } from "../../shade/renderer/DynamicResolutionScaling.js";
|
|
8
8
|
import { Renderer } from "../../shade/renderer/Renderer.js";
|
|
9
|
+
import { RendererConfiguration } from "../../shade/renderer/RendererConfiguration.js";
|
|
9
10
|
import { Scene } from "../../shade/renderer/scene/Scene.js";
|
|
10
11
|
import { Sampler2D } from "../graphics/texture/sampler/Sampler2D.js";
|
|
11
12
|
import EmptyView from "../../view/elements/EmptyView.js";
|
|
@@ -64,7 +65,7 @@ const TARGET_FRAME_RATE = 30;
|
|
|
64
65
|
* start(), stop(), render(), updateSize()}` — because that is what `Engine` needs in order to boot,
|
|
65
66
|
* and because the facade is deliberately not allowed to grow past §4.2 (D14).
|
|
66
67
|
*
|
|
67
|
-
* **
|
|
68
|
+
* **Five things have been let through since, each by name.** {@link add_extension} /
|
|
68
69
|
* {@link remove_extension} (E9), because an extension has to survive the restart that replaces the
|
|
69
70
|
* renderer holding it; {@link add_transparency_channel} / {@link remove_transparency_channel}
|
|
70
71
|
* (2026-09-24, trails), the same door for the one thing an extension cannot do — draw inside the
|
|
@@ -78,6 +79,10 @@ const TARGET_FRAME_RATE = 30;
|
|
|
78
79
|
* callers that have no other route, not a migration target — the old engine's 44
|
|
79
80
|
* `.renderer`/`getRenderer()` call sites are each still a migration item.
|
|
80
81
|
*
|
|
82
|
+
* {@link renderer_configuration} is the fifth: what every renderer this engine starts begins as. It
|
|
83
|
+
* is held here for the reason extensions are — it is stated before a device exists, and it outlives
|
|
84
|
+
* the renderer a restart replaces — and it is data the caller writes, not the renderer.
|
|
85
|
+
*
|
|
81
86
|
* What is deliberately absent, and stays absent: `getRenderer()` (the old engine's accessor, and
|
|
82
87
|
* the shape those call sites are being ported off), `layers` (CPU visibility dies with GPU
|
|
83
88
|
* culling), `scene` (entities reach the scene through the mesh system, not through the facade),
|
|
@@ -116,6 +121,20 @@ export class GraphicsEngine {
|
|
|
116
121
|
return this.#renderer;
|
|
117
122
|
}
|
|
118
123
|
|
|
124
|
+
/**
|
|
125
|
+
* What every renderer {@link start} makes begins as: the settings that decide which pipelines it
|
|
126
|
+
* compiles ahead of its first frame, so a frame is not held up compiling them when it first draws
|
|
127
|
+
* with them. Write to it before {@link start}.
|
|
128
|
+
*
|
|
129
|
+
* {@link start} reads it each time, so a restart begins from it again. Once a renderer is running
|
|
130
|
+
* its own fields are the state: a change made here waits for the next {@link start}, and a change
|
|
131
|
+
* made on the renderer does not come back here.
|
|
132
|
+
*
|
|
133
|
+
* @readonly
|
|
134
|
+
* @type {RendererConfiguration}
|
|
135
|
+
*/
|
|
136
|
+
renderer_configuration = new RendererConfiguration();
|
|
137
|
+
|
|
119
138
|
/**
|
|
120
139
|
* Trades internal resolution for frame time — see {@link dynamic_resolution}.
|
|
121
140
|
*
|
|
@@ -709,7 +728,10 @@ export class GraphicsEngine {
|
|
|
709
728
|
}
|
|
710
729
|
|
|
711
730
|
try {
|
|
712
|
-
await renderer.initialize({
|
|
731
|
+
await renderer.initialize({
|
|
732
|
+
context: canvas.getContext('webgpu'),
|
|
733
|
+
configuration: this.renderer_configuration,
|
|
734
|
+
});
|
|
713
735
|
} catch (failure) {
|
|
714
736
|
this.#canvas = null;
|
|
715
737
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_step.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/solver/cloth_step.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,kDAfW,MAAM,kBACN,MAAM,kBAEN,MAAM,kBACN,MAAM,YACN,MAAM,cACN,MAAM,mBACN,YAAY,GAAC,YAAY,GAAC,IAAI,mBAE9B,MAAM,WACN;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAC,aAChK,YAAY,GAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"cloth_step.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/cloth/solver/cloth_step.js"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkIG;AAEH;;;;;;;;;;;;;;;;;;GAkBG;AACH,kDAfW,MAAM,kBACN,MAAM,kBAEN,MAAM,kBACN,MAAM,YACN,MAAM,cACN,MAAM,mBACN,YAAY,GAAC,YAAY,GAAC,IAAI,mBAE9B,MAAM,WACN;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAC,aAChK,YAAY,GAAC,IAAI,QA2I3B"}
|
|
@@ -302,7 +302,10 @@ export function cloth_step(
|
|
|
302
302
|
cloth_backstop_dual_update(state, beta, k_max_ratio, inverse_h_squared);
|
|
303
303
|
|
|
304
304
|
if (contacts !== null) {
|
|
305
|
-
cloth_contact_dual_update(
|
|
305
|
+
cloth_contact_dual_update(
|
|
306
|
+
state, contacts, alpha, gamma, beta,
|
|
307
|
+
k_max_ratio, inverse_h_squared, contact_ramp_ratio
|
|
308
|
+
);
|
|
306
309
|
}
|
|
307
310
|
}
|
|
308
311
|
|
|
@@ -38,15 +38,22 @@ export function cloth_contact_warm_start(state: ClothState, alpha: number, gamma
|
|
|
38
38
|
* the next iteration. It costs a second field evaluation per contact per
|
|
39
39
|
* iteration and it is what makes the multiplier converge within the step.
|
|
40
40
|
*
|
|
41
|
+
* A friction row that ends the update at its cap has yielded, and its anchor is
|
|
42
|
+
* brought up behind the particle — the module docblock says how far and why.
|
|
43
|
+
*
|
|
41
44
|
* @param {ClothState} state
|
|
42
|
-
* @param {Float32Array|Float64Array} table
|
|
45
|
+
* @param {Float32Array|Float64Array} table packed colliders, cloth-local, posed
|
|
46
|
+
* at the substep in progress
|
|
47
|
+
* @param {number} alpha the multiplier's regularisation, as
|
|
48
|
+
* {@link cloth_contact_warm_start} takes it
|
|
49
|
+
* @param {number} gamma the multiplier's decay, with `alpha`
|
|
43
50
|
* @param {number} beta the friction row's ramp, N/m²
|
|
44
51
|
* @param {number} k_max_ratio
|
|
45
52
|
* @param {number} inverse_h_squared
|
|
46
53
|
* @param {number} [ramp_ratio] the normal row's ramp, as the fraction of the
|
|
47
54
|
* band gained per contact offset of violation per iteration
|
|
48
55
|
*/
|
|
49
|
-
export function cloth_contact_dual_update(state: ClothState, table: Float32Array | Float64Array, beta: number, k_max_ratio: number, inverse_h_squared: number, ramp_ratio?: number): void;
|
|
56
|
+
export function cloth_contact_dual_update(state: ClothState, table: Float32Array | Float64Array, alpha: number, gamma: number, beta: number, k_max_ratio: number, inverse_h_squared: number, ramp_ratio?: number): void;
|
|
50
57
|
/**
|
|
51
58
|
* # Contact — the collision row and its friction row, which are one contact
|
|
52
59
|
*
|
|
@@ -95,6 +102,33 @@ export function cloth_contact_dual_update(state: ClothState, table: Float32Array
|
|
|
95
102
|
* frame to frame is a choice with state in it — which is exactly what §7 P4(a)
|
|
96
103
|
* exists to keep out of this system.
|
|
97
104
|
*
|
|
105
|
+
* ## The anchor follows a row that has yielded
|
|
106
|
+
*
|
|
107
|
+
* The anchor remembers a point only while the row holds. A row at its cap is
|
|
108
|
+
* sliding, and Coulomb friction opposes the slide — not the way back to where
|
|
109
|
+
* the particle first touched. An anchor left behind turns the cap into a pull
|
|
110
|
+
* towards that point whichever way the particle is moving, which is a
|
|
111
|
+
* potential: it takes speed from a particle going out and hands it back on the
|
|
112
|
+
* return.
|
|
113
|
+
*
|
|
114
|
+
* So when the dual update finds a row at its cap, the anchor is brought up
|
|
115
|
+
* behind the particle, along the slip, to
|
|
116
|
+
*
|
|
117
|
+
* ‖P_t(x − a)‖ = (1 − α·γ) · μ·f_n / k_f
|
|
118
|
+
*
|
|
119
|
+
* and no closer. The invariant is that **a row enters a substep carrying no
|
|
120
|
+
* more than its cap**. The row's force is `k_f·‖P_t(x − a)‖ + λ_f`, and the
|
|
121
|
+
* warm start keeps `α·γ` of `λ_f`; the offset carries what that drops. Closer,
|
|
122
|
+
* and a contact held near its cap has to slide every substep to rebuild the
|
|
123
|
+
* force the multiplier lost. Further, and the offset and the multiplier carry
|
|
124
|
+
* more than the cap between them, so a row that has yielded is still at its cap
|
|
125
|
+
* after the particle has stopped. The friction penalty's own decay only takes
|
|
126
|
+
* the row further inside the cap.
|
|
127
|
+
*
|
|
128
|
+
* A row under its cap is not touched, so static friction holds a particle to
|
|
129
|
+
* the point it stuck at exactly as before. What is left of the pull is that
|
|
130
|
+
* offset: a particle that slides to a stop settles back by at most that far.
|
|
131
|
+
*
|
|
98
132
|
* ## Which force the friction cap reads
|
|
99
133
|
*
|
|
100
134
|
* The *current iteration's* normal force, not the previous iteration's
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloth_contact_row.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/physics/cloth/solver/constraint/cloth_contact_row.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cloth_contact_row.d.ts","sourceRoot":"","sources":["../../../../../../../src/engine/physics/cloth/solver/constraint/cloth_contact_row.js"],"names":[],"mappings":"AAmKA;;;;;;;;GAQG;AACH,sDANW,YAAY,+BAEZ,MAAM,SACN,YAAY,GAAC,YAAY,QA+LnC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,mEARW,MAAM,SACN,MAAM,eACN,MAAM,eACN,MAAM,qBACN,MAAM,kBACN,MAAM,QAkDhB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,oEAXW,YAAY,GAAC,YAAY,SAEzB,MAAM,SAEN,MAAM,QACN,MAAM,eACN,MAAM,qBACN,MAAM,eACN,MAAM,QAkIhB;AA5iBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,kCAFU,MAAM,CAEqB;AAErC;;;;;GAKG;AACH,qCAFU,MAAM,CAE2B"}
|
|
@@ -72,6 +72,33 @@ import { CLOTH_CONTACT_GAMMA, CLOTH_CONTACT_RAMP_RATIO } from "../cloth_solver_c
|
|
|
72
72
|
* frame to frame is a choice with state in it — which is exactly what §7 P4(a)
|
|
73
73
|
* exists to keep out of this system.
|
|
74
74
|
*
|
|
75
|
+
* ## The anchor follows a row that has yielded
|
|
76
|
+
*
|
|
77
|
+
* The anchor remembers a point only while the row holds. A row at its cap is
|
|
78
|
+
* sliding, and Coulomb friction opposes the slide — not the way back to where
|
|
79
|
+
* the particle first touched. An anchor left behind turns the cap into a pull
|
|
80
|
+
* towards that point whichever way the particle is moving, which is a
|
|
81
|
+
* potential: it takes speed from a particle going out and hands it back on the
|
|
82
|
+
* return.
|
|
83
|
+
*
|
|
84
|
+
* So when the dual update finds a row at its cap, the anchor is brought up
|
|
85
|
+
* behind the particle, along the slip, to
|
|
86
|
+
*
|
|
87
|
+
* ‖P_t(x − a)‖ = (1 − α·γ) · μ·f_n / k_f
|
|
88
|
+
*
|
|
89
|
+
* and no closer. The invariant is that **a row enters a substep carrying no
|
|
90
|
+
* more than its cap**. The row's force is `k_f·‖P_t(x − a)‖ + λ_f`, and the
|
|
91
|
+
* warm start keeps `α·γ` of `λ_f`; the offset carries what that drops. Closer,
|
|
92
|
+
* and a contact held near its cap has to slide every substep to rebuild the
|
|
93
|
+
* force the multiplier lost. Further, and the offset and the multiplier carry
|
|
94
|
+
* more than the cap between them, so a row that has yielded is still at its cap
|
|
95
|
+
* after the particle has stopped. The friction penalty's own decay only takes
|
|
96
|
+
* the row further inside the cap.
|
|
97
|
+
*
|
|
98
|
+
* A row under its cap is not touched, so static friction holds a particle to
|
|
99
|
+
* the point it stuck at exactly as before. What is left of the pull is that
|
|
100
|
+
* offset: a particle that slides to a stop settles back by at most that far.
|
|
101
|
+
*
|
|
75
102
|
* ## Which force the friction cap reads
|
|
76
103
|
*
|
|
77
104
|
* The *current iteration's* normal force, not the previous iteration's
|
|
@@ -411,17 +438,28 @@ export function cloth_contact_warm_start(state, alpha, gamma, k_min_ratio, k_max
|
|
|
411
438
|
* the next iteration. It costs a second field evaluation per contact per
|
|
412
439
|
* iteration and it is what makes the multiplier converge within the step.
|
|
413
440
|
*
|
|
441
|
+
* A friction row that ends the update at its cap has yielded, and its anchor is
|
|
442
|
+
* brought up behind the particle — the module docblock says how far and why.
|
|
443
|
+
*
|
|
414
444
|
* @param {ClothState} state
|
|
415
|
-
* @param {Float32Array|Float64Array} table
|
|
445
|
+
* @param {Float32Array|Float64Array} table packed colliders, cloth-local, posed
|
|
446
|
+
* at the substep in progress
|
|
447
|
+
* @param {number} alpha the multiplier's regularisation, as
|
|
448
|
+
* {@link cloth_contact_warm_start} takes it
|
|
449
|
+
* @param {number} gamma the multiplier's decay, with `alpha`
|
|
416
450
|
* @param {number} beta the friction row's ramp, N/m²
|
|
417
451
|
* @param {number} k_max_ratio
|
|
418
452
|
* @param {number} inverse_h_squared
|
|
419
453
|
* @param {number} [ramp_ratio] the normal row's ramp, as the fraction of the
|
|
420
454
|
* band gained per contact offset of violation per iteration
|
|
421
455
|
*/
|
|
422
|
-
export function cloth_contact_dual_update(state, table, beta, k_max_ratio, inverse_h_squared, ramp_ratio = CLOTH_CONTACT_RAMP_RATIO) {
|
|
456
|
+
export function cloth_contact_dual_update(state, table, alpha, gamma, beta, k_max_ratio, inverse_h_squared, ramp_ratio = CLOTH_CONTACT_RAMP_RATIO) {
|
|
423
457
|
const particle_count = state.particle_count;
|
|
424
458
|
|
|
459
|
+
// What the next warm start drops from a friction multiplier, which is what
|
|
460
|
+
// a yielded row's anchor has to carry in its place.
|
|
461
|
+
const carried_by_anchor = 1 - alpha * gamma;
|
|
462
|
+
|
|
425
463
|
const collider = state.contact_collider;
|
|
426
464
|
const mass_inverse = state.mass_inverse;
|
|
427
465
|
const position = state.position;
|
|
@@ -516,7 +554,26 @@ export function cloth_contact_dual_update(state, table, beta, k_max_ratio, inver
|
|
|
516
554
|
|
|
517
555
|
const unclamped = kf * slip + friction_lambda[slot];
|
|
518
556
|
|
|
519
|
-
|
|
557
|
+
if (unclamped < cap) {
|
|
558
|
+
friction_lambda[slot] = unclamped > 0 ? unclamped : 0;
|
|
559
|
+
} else {
|
|
560
|
+
friction_lambda[slot] = cap;
|
|
561
|
+
|
|
562
|
+
// The row has yielded, so the anchor follows (the module
|
|
563
|
+
// docblock). A penalty of zero puts the reach at `Infinity`
|
|
564
|
+
// and leaves the anchor where it is.
|
|
565
|
+
const reach = carried_by_anchor * cap / kf;
|
|
566
|
+
|
|
567
|
+
if (slip > reach) {
|
|
568
|
+
const follow = 1 - reach / slip;
|
|
569
|
+
|
|
570
|
+
ANCHOR_WORLD[0] += tx * follow;
|
|
571
|
+
ANCHOR_WORLD[1] += ty * follow;
|
|
572
|
+
ANCHOR_WORLD[2] += tz * follow;
|
|
573
|
+
|
|
574
|
+
cloth_collider_to_local_array(anchor, slot * 3, table, record, ANCHOR_WORLD, 0);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
520
577
|
|
|
521
578
|
const ramped_friction = kf + beta * slip;
|
|
522
579
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lays tiles over the whole grid by wave function collapse: every cell gets one tile of a
|
|
3
|
+
* {@link GridWFCTileSet}, and every pair of neighbours shows the same socket on the edge they
|
|
4
|
+
* share. Each tile's {@link GridCellAction} is then run on its cell, turned the way the tile is.
|
|
5
|
+
*
|
|
6
|
+
* What adjacency alone cannot say is said around the solve:
|
|
7
|
+
* - {@link restrictions} narrow what a cell may hold before it starts — keep these cells open,
|
|
8
|
+
* let paving stand only where that field is high;
|
|
9
|
+
* - {@link boundary} says what may stand against the edge of the grid;
|
|
10
|
+
* - {@link connected} makes the tiles of one kind hang together — by opening what keeps them
|
|
11
|
+
* apart where the set has a tile for it, and by drawing again, up to {@link attempts} times,
|
|
12
|
+
* where it has not;
|
|
13
|
+
* - {@link fallback} covers the grid when every attempt failed, so a generator that must always
|
|
14
|
+
* produce a map does.
|
|
15
|
+
*
|
|
16
|
+
* The same grid, tile set and seed always give the same result.
|
|
17
|
+
*/
|
|
18
|
+
export class GridTaskWaveFunctionCollapse extends GridTaskGenerator {
|
|
19
|
+
/**
|
|
20
|
+
* @param {Object} options
|
|
21
|
+
* @param {string} [options.name]
|
|
22
|
+
* @param {GridWFCTileSet} options.tiles
|
|
23
|
+
* @param {{matcher: CellMatcher, tag: string}[]} [options.restrictions]
|
|
24
|
+
* @param {string|null} [options.boundary]
|
|
25
|
+
* @param {string|null} [options.connected]
|
|
26
|
+
* @param {WFCCellChoice} [options.cell_choice]
|
|
27
|
+
* @param {number} [options.attempts]
|
|
28
|
+
* @param {string|null} [options.fallback]
|
|
29
|
+
* @returns {GridTaskWaveFunctionCollapse}
|
|
30
|
+
*/
|
|
31
|
+
static from({ name, tiles, restrictions, boundary, connected, cell_choice, attempts, fallback }: {
|
|
32
|
+
name?: string;
|
|
33
|
+
tiles: GridWFCTileSet;
|
|
34
|
+
restrictions?: {
|
|
35
|
+
matcher: CellMatcher;
|
|
36
|
+
tag: string;
|
|
37
|
+
}[];
|
|
38
|
+
boundary?: string | null;
|
|
39
|
+
connected?: string | null;
|
|
40
|
+
cell_choice?: WFCCellChoice;
|
|
41
|
+
attempts?: number;
|
|
42
|
+
fallback?: string | null;
|
|
43
|
+
}): GridTaskWaveFunctionCollapse;
|
|
44
|
+
/**
|
|
45
|
+
* @type {GridWFCTileSet}
|
|
46
|
+
*/
|
|
47
|
+
tiles: GridWFCTileSet;
|
|
48
|
+
/**
|
|
49
|
+
* A cell that `matcher` matches may only hold tiles carrying `tag`. A cell matched by several
|
|
50
|
+
* may only hold tiles carrying all their tags.
|
|
51
|
+
*
|
|
52
|
+
* @type {{matcher: CellMatcher, tag: string}[]}
|
|
53
|
+
*/
|
|
54
|
+
restrictions: {
|
|
55
|
+
matcher: CellMatcher;
|
|
56
|
+
tag: string;
|
|
57
|
+
}[];
|
|
58
|
+
/**
|
|
59
|
+
* Tag of the tiles allowed in the cells along the edge of the grid; `null` allows any.
|
|
60
|
+
*
|
|
61
|
+
* A tile set whose walls must close on themselves wants its open tile here: a wall could
|
|
62
|
+
* otherwise run off the edge and never have to turn back.
|
|
63
|
+
*
|
|
64
|
+
* @type {string|null}
|
|
65
|
+
*/
|
|
66
|
+
boundary: string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Tag of the tiles that must form one region, joined edge to edge; `null` skips the check.
|
|
69
|
+
*
|
|
70
|
+
* Adjacency rules cannot express this — a ring of wall with no gate in it is locally perfect —
|
|
71
|
+
* so it is seen to on the finished result. Where a tile keeping two regions apart has a
|
|
72
|
+
* **twin** carrying the tag (a tile with the same four sockets: the gap in a wall, for a
|
|
73
|
+
* stretch of that wall), the twin is swapped in and nothing around it has to change. Give the
|
|
74
|
+
* set such twins and one draw nearly always does; a result no swap can join (a pocket walled
|
|
75
|
+
* by tiles with no twin, or by two walls back to back) is thrown away and drawn again — which
|
|
76
|
+
* is all a set without twins can do, and a large grid can rarely afford.
|
|
77
|
+
*
|
|
78
|
+
* @type {string|null}
|
|
79
|
+
*/
|
|
80
|
+
connected: string | null;
|
|
81
|
+
/**
|
|
82
|
+
* @type {WFCCellChoice}
|
|
83
|
+
*/
|
|
84
|
+
cell_choice: WFCCellChoice;
|
|
85
|
+
/**
|
|
86
|
+
* How many draws are tried before giving up. A draw is abandoned when the search runs out of
|
|
87
|
+
* backtracks, or when its result cannot be made {@link connected}.
|
|
88
|
+
*
|
|
89
|
+
* @type {number}
|
|
90
|
+
*/
|
|
91
|
+
attempts: number;
|
|
92
|
+
/**
|
|
93
|
+
* Name of the tile laid over the whole grid when every attempt failed; `null` fails the task
|
|
94
|
+
* instead. It has to be a tile that may neighbour itself, which {@link build} checks, and that
|
|
95
|
+
* may stand in every restricted cell and against the edge of the grid, which nothing checks:
|
|
96
|
+
* the fallback is laid over restrictions and boundary alike — the set's open tile, usually.
|
|
97
|
+
*
|
|
98
|
+
* @type {string|null}
|
|
99
|
+
*/
|
|
100
|
+
fallback: string | null;
|
|
101
|
+
/**
|
|
102
|
+
* How the most recent build went, for tuning a tile set. Not an input. `backtracks` and
|
|
103
|
+
* `openings` are summed over every draw of the build, the ones thrown away included.
|
|
104
|
+
*
|
|
105
|
+
* @type {{attempts: number, backtracks: number, openings: number, solved: boolean, fallback: boolean}}
|
|
106
|
+
*/
|
|
107
|
+
statistics: {
|
|
108
|
+
attempts: number;
|
|
109
|
+
backtracks: number;
|
|
110
|
+
openings: number;
|
|
111
|
+
solved: boolean;
|
|
112
|
+
fallback: boolean;
|
|
113
|
+
};
|
|
114
|
+
build(grid: any, ecd: any, seed: any): TaskGroup;
|
|
115
|
+
}
|
|
116
|
+
import { GridTaskGenerator } from "../../GridTaskGenerator.js";
|
|
117
|
+
import { WFCCellChoice } from "../../../../core/wfc/WFCCellChoice.js";
|
|
118
|
+
import TaskGroup from "../../../../core/process/task/TaskGroup.js";
|
|
119
|
+
//# sourceMappingURL=GridTaskWaveFunctionCollapse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GridTaskWaveFunctionCollapse.d.ts","sourceRoot":"","sources":["../../../../../../src/generation/grid/generation/discrete/GridTaskWaveFunctionCollapse.js"],"names":[],"mappings":"AA8BA;;;;;;;;;;;;;;;;GAgBG;AACH;IAuEI;;;;;;;;;;;OAWG;IACH;QAV4B,IAAI,GAArB,MAAM;QACkB,KAAK;QACmB,YAAY,GAA5D;YAAC,OAAO,cAAc;YAAC,GAAG,EAAE,MAAM,CAAA;SAAC,EAAE;QACf,QAAQ,GAA9B,MAAM,GAAC,IAAI;QACW,SAAS,GAA/B,MAAM,GAAC,IAAI;QACa,WAAW,GAAnC,aAAa;QACI,QAAQ,GAAzB,MAAM;QACgB,QAAQ,GAA9B,MAAM,GAAC,IAAI;QACT,4BAA4B,CAiCxC;IAhHD;;OAEG;IACH,sBAAa;IAEb;;;;;OAKG;IACH,cAFU;QAAC,OAAO,cAAc;QAAC,GAAG,EAAE,MAAM,CAAA;KAAC,EAAE,CAE7B;IAElB;;;;;;;OAOG;IACH,UAFU,MAAM,GAAC,IAAI,CAEL;IAEhB;;;;;;;;;;;;OAYG;IACH,WAFU,MAAM,GAAC,IAAI,CAEJ;IAEjB;;OAEG;IACH,aAFU,aAAa,CAEc;IAErC;;;;;OAKG;IACH,UAFU,MAAM,CAEH;IAEb;;;;;;;OAOG;IACH,UAFU,MAAM,GAAC,IAAI,CAEL;IAEhB;;;;;OAKG;IACH,YAFU;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,OAAO,CAAA;KAAC,CAEb;IAmDzF,iDA0YC;CACJ;kCA/hBiC,4BAA4B;8BAThC,uCAAuC;sBAJ/C,4CAA4C"}
|