@woosh/meep-engine 3.45.0 → 3.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +5 -1
- package/src/core/binary/hash/XXH128Hash.d.ts +1 -37
- package/src/core/binary/hash/XXH128Hash.d.ts.map +1 -1
- package/src/core/binary/hash/XXH128Hash.js +4 -55
- package/src/core/binary/hash/XXH3_SECRET.d.ts +1 -12
- package/src/core/binary/hash/XXH3_SECRET.d.ts.map +1 -1
- package/src/core/binary/hash/XXH3_SECRET.js +4 -25
- package/src/core/binary/hash/crc32.d.ts +1 -15
- package/src/core/binary/hash/crc32.d.ts.map +1 -1
- package/src/core/binary/hash/crc32.js +4 -96
- package/src/core/binary/hash/xxh3_128.d.ts +1 -9
- package/src/core/binary/hash/xxh3_128.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_128.js +4 -341
- package/src/core/binary/hash/xxh3_64.d.ts +1 -8
- package/src/core/binary/hash/xxh3_64.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_64.js +4 -241
- package/src/core/binary/hash/xxh3_common.d.ts +1 -223
- package/src/core/binary/hash/xxh3_common.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_common.js +90 -476
- package/src/core/collection/array/combine_hash.d.ts +6 -0
- package/src/core/collection/array/combine_hash.d.ts.map +1 -1
- package/src/core/collection/array/combine_hash.js +6 -0
- package/src/core/function/FunctionCompiler.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply.d.ts +3 -0
- package/src/core/geom/3d/mat4/m4_multiply.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply.js +3 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts +30 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.js +106 -0
- package/src/core/geom/ConicRay.js +2 -2
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/geom/Vector4.js +8 -5
- package/src/core/math/hash/XXH128Hash.d.ts +38 -0
- package/src/core/math/hash/XXH128Hash.d.ts.map +1 -0
- package/src/core/math/hash/XXH128Hash.js +55 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts +13 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts.map +1 -0
- package/src/core/math/hash/XXH3_SECRET.js +25 -0
- package/src/core/math/hash/crc32.d.ts +16 -0
- package/src/core/math/hash/crc32.d.ts.map +1 -0
- package/src/core/math/hash/crc32.js +96 -0
- package/src/core/math/hash/xxh3_128.d.ts +10 -0
- package/src/core/math/hash/xxh3_128.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_128.js +341 -0
- package/src/core/math/hash/xxh3_64.d.ts +9 -0
- package/src/core/math/hash/xxh3_64.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_64.js +241 -0
- package/src/core/math/hash/xxh3_common.d.ts +224 -0
- package/src/core/math/hash/xxh3_common.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_common.js +476 -0
- package/src/core/math/lookup/ParameterLookupTable.js +2 -2
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
- package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
- package/src/engine/asset/AssetDescription.js +2 -2
- package/src/engine/ecs/animation/Animation.js +2 -2
- package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
- package/src/engine/ecs/animation/AnimationClip.js +7 -5
- package/src/engine/ecs/gui/GUIElement.d.ts.map +1 -1
- package/src/engine/ecs/gui/GUIElement.js +7 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +11 -7
- package/src/engine/ecs/transform/Transform64.d.ts +1 -1
- package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform64.js +5 -4
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +8 -5
- package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +8 -5
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +9 -8
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +9 -6
- package/src/engine/graphics3/ParticipatingMedia.js +204 -204
- package/src/engine/graphics3/animation/AnimationClips.d.ts +5 -0
- package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -1
- package/src/engine/graphics3/animation/AnimationClips.js +5 -0
- package/src/engine/grid/obstacle/GridObstacle.js +2 -2
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
- package/src/engine/interpolation/Interpolated.js +2 -2
- package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothCollider.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothDynamics.js +20 -11
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +7 -5
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidComponent.js +19 -11
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +2 -2
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +2 -2
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +16 -9
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitter.js +12 -7
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.js +192 -191
- package/src/engine/sound/simulation/core/AcousticMedium.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticDirectivity.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticMaterial.d.ts.map +1 -1
- package/src/engine/sound/simulation/definition/AcousticMaterial.js +11 -7
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/BusDefinition.js +5 -4
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/DuckingRule.js +7 -5
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescription.js +23 -13
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +2 -2
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +7 -5
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +4 -3
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +3 -3
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +16 -9
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +7 -5
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +8 -5
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +2 -2
- package/src/engine/sound/sopra/legacy/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundEmitter.js +357 -352
- package/src/engine/sound/sopra/legacy/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundTrack.js +281 -278
- package/src/format/image/png/PNGReader.js +644 -644
- package/src/format/image/png/crc32.d.ts +1 -1
- package/src/format/image/png/crc32.js +7 -8
- package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.d.ts.map +1 -1
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +12 -8
- package/src/shade/descriptor/binding/StorageTextureBindingLayout.js +2 -2
- package/src/shade/descriptor/binding/TextureBindingLayout.js +2 -2
- package/src/shade/descriptor/blend/BlendComponent.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/ProgrammableStage.js +2 -2
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/render/ColorTargetState.js +2 -2
- package/src/shade/descriptor/pipeline/render/FragmentState.js +2 -2
- package/src/shade/descriptor/pipeline/render/PrimitiveState.js +2 -2
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +8 -5
- package/src/shade/descriptor/pipeline/render/VertexAttribute.js +2 -2
- package/src/shade/descriptor/texture/SamplerDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/SamplerDescriptor.js +20 -12
- package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/TextureDescriptor.js +11 -7
- package/src/shade/device/graph/BufferResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/BufferResourceDescriptor.js +196 -193
- package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/TextureResourceDescriptor.js +178 -173
- package/src/shade/device/timing/profile/sgpt_read_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_read_records.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_record.js +1 -1
- package/src/shade/renderer/binding/BufferBinding.js +2 -2
- package/src/shade/renderer/camera/Camera.js +2 -2
- package/src/shade/renderer/geometry/Attribute.js +2 -2
- package/src/shade/renderer/geometry/Geometry.js +2 -2
- package/src/shade/renderer/geometry/geometry_deduplicate_vertices.js +2 -2
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +2 -2
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +13 -13
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_directory_block_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +25 -25
- package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.js +13 -8
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map +1 -1
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js +14 -5
- package/src/shade/renderer/scene/optimization/sampler2d_from_image_bitmap.js +1 -1
- package/src/shade/renderer/shader/type/WGSLStructField.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUArray.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/WebGPUStruct.js +9 -6
- package/src/shade/renderer/texture/ShadeTexture.d.ts.map +1 -1
- package/src/shade/renderer/texture/ShadeTexture.js +17 -10
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +2 -2
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -4
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +6 -6
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +46 -55
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +3 -3
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +14 -4
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +10 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +82 -40
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +4 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +8 -4
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +98 -86
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +440 -298
- package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
- package/src/view/common/HTMLElementCacheKey.js +4 -3
- package/src/view/minimap/MinimapMarker.js +2 -2
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import { xxh3_64 } from "../../../../../../core/
|
|
2
|
-
import { VGEO_FRAME_HEADER_SIZE } from "../frame/VGEO_FRAME_HEADER_SIZE.js";
|
|
3
|
-
import { VGEO_FRAME_OFFSET } from "../frame/VGEO_FRAME_OFFSET.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The identity-seeded checksum of one frame: xxh3-64 over the frame's bytes with its own `checksum`
|
|
7
|
-
* field cut out, seeded so that a well-formed frame of the wrong page or the wrong asset fails to
|
|
8
|
-
* verify rather than installing silently.
|
|
9
|
-
*
|
|
10
|
-
* The seed is taken from `asset_id`, which is why {@link vgeo_asset_id_preimage} zeroes this field
|
|
11
|
-
* before hashing: the two would otherwise be defined in terms of each other.
|
|
12
|
-
*
|
|
13
|
-
* @param {BinaryBuffer} buffer whole file
|
|
14
|
-
* @param {VGeoFrameExtent} frame
|
|
15
|
-
* @param {bigint} asset_id_low64
|
|
16
|
-
* @returns {bigint}
|
|
17
|
-
*
|
|
18
|
-
* @author Alex Goldring
|
|
19
|
-
* @copyright Company Named Limited (c) 2026
|
|
20
|
-
*/
|
|
21
|
-
export function vgeo_compute_frame_checksum(buffer, frame, asset_id_low64) {
|
|
22
|
-
const seed = asset_id_low64 ^ BigInt(frame.page_index);
|
|
23
|
-
|
|
24
|
-
const bytes = buffer.raw_bytes;
|
|
25
|
-
|
|
26
|
-
const covered = new Uint8Array(frame.extent - 8);
|
|
27
|
-
|
|
28
|
-
// frame bytes [0, 16)
|
|
29
|
-
covered.set(
|
|
30
|
-
bytes.subarray(frame.frame_offset, frame.frame_offset + VGEO_FRAME_OFFSET.CHECKSUM),
|
|
31
|
-
0
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
// frame bytes [24, extent)
|
|
35
|
-
covered.set(
|
|
36
|
-
bytes.subarray(frame.frame_offset + VGEO_FRAME_HEADER_SIZE, frame.frame_offset + frame.extent),
|
|
37
|
-
VGEO_FRAME_OFFSET.CHECKSUM
|
|
38
|
-
);
|
|
39
|
-
|
|
40
|
-
return xxh3_64(covered, seed);
|
|
41
|
-
}
|
|
1
|
+
import { xxh3_64 } from "../../../../../../core/math/hash/xxh3_64.js";
|
|
2
|
+
import { VGEO_FRAME_HEADER_SIZE } from "../frame/VGEO_FRAME_HEADER_SIZE.js";
|
|
3
|
+
import { VGEO_FRAME_OFFSET } from "../frame/VGEO_FRAME_OFFSET.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The identity-seeded checksum of one frame: xxh3-64 over the frame's bytes with its own `checksum`
|
|
7
|
+
* field cut out, seeded so that a well-formed frame of the wrong page or the wrong asset fails to
|
|
8
|
+
* verify rather than installing silently.
|
|
9
|
+
*
|
|
10
|
+
* The seed is taken from `asset_id`, which is why {@link vgeo_asset_id_preimage} zeroes this field
|
|
11
|
+
* before hashing: the two would otherwise be defined in terms of each other.
|
|
12
|
+
*
|
|
13
|
+
* @param {BinaryBuffer} buffer whole file
|
|
14
|
+
* @param {VGeoFrameExtent} frame
|
|
15
|
+
* @param {bigint} asset_id_low64
|
|
16
|
+
* @returns {bigint}
|
|
17
|
+
*
|
|
18
|
+
* @author Alex Goldring
|
|
19
|
+
* @copyright Company Named Limited (c) 2026
|
|
20
|
+
*/
|
|
21
|
+
export function vgeo_compute_frame_checksum(buffer, frame, asset_id_low64) {
|
|
22
|
+
const seed = asset_id_low64 ^ BigInt(frame.page_index);
|
|
23
|
+
|
|
24
|
+
const bytes = buffer.raw_bytes;
|
|
25
|
+
|
|
26
|
+
const covered = new Uint8Array(frame.extent - 8);
|
|
27
|
+
|
|
28
|
+
// frame bytes [0, 16)
|
|
29
|
+
covered.set(
|
|
30
|
+
bytes.subarray(frame.frame_offset, frame.frame_offset + VGEO_FRAME_OFFSET.CHECKSUM),
|
|
31
|
+
0
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
// frame bytes [24, extent)
|
|
35
|
+
covered.set(
|
|
36
|
+
bytes.subarray(frame.frame_offset + VGEO_FRAME_HEADER_SIZE, frame.frame_offset + frame.extent),
|
|
37
|
+
VGEO_FRAME_OFFSET.CHECKSUM
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
return xxh3_64(covered, seed);
|
|
41
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { BinaryBuffer } from "../../../../../../core/binary/BinaryBuffer.js";
|
|
2
|
-
import { xxh3_64 } from "../../../../../../core/
|
|
3
|
-
import { VGEO_HEADER_OFFSET } from "../header/VGEO_HEADER_OFFSET.js";
|
|
4
|
-
import { VGEO_HEADER_SIZE } from "../header/VGEO_HEADER_SIZE.js";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* xxh3-64 of the header with `header_checksum` zeroed. `asset_id` must already be final: the
|
|
8
|
-
* ordering is what keeps the two non-circular.
|
|
9
|
-
*
|
|
10
|
-
* @param {BinaryBuffer} buffer whole file
|
|
11
|
-
* @returns {bigint}
|
|
12
|
-
*
|
|
13
|
-
* @author Alex Goldring
|
|
14
|
-
* @copyright Company Named Limited (c) 2026
|
|
15
|
-
*/
|
|
16
|
-
export function vgeo_compute_header_checksum(buffer) {
|
|
17
|
-
const header = new BinaryBuffer();
|
|
18
|
-
|
|
19
|
-
header.fromArrayBuffer(buffer.raw_bytes.slice(0, VGEO_HEADER_SIZE).buffer);
|
|
20
|
-
|
|
21
|
-
header.position = VGEO_HEADER_OFFSET.HEADER_CHECKSUM;
|
|
22
|
-
header.writeUint64(0n);
|
|
23
|
-
|
|
24
|
-
return xxh3_64(header.raw_bytes);
|
|
25
|
-
}
|
|
1
|
+
import { BinaryBuffer } from "../../../../../../core/binary/BinaryBuffer.js";
|
|
2
|
+
import { xxh3_64 } from "../../../../../../core/math/hash/xxh3_64.js";
|
|
3
|
+
import { VGEO_HEADER_OFFSET } from "../header/VGEO_HEADER_OFFSET.js";
|
|
4
|
+
import { VGEO_HEADER_SIZE } from "../header/VGEO_HEADER_SIZE.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* xxh3-64 of the header with `header_checksum` zeroed. `asset_id` must already be final: the
|
|
8
|
+
* ordering is what keeps the two non-circular.
|
|
9
|
+
*
|
|
10
|
+
* @param {BinaryBuffer} buffer whole file
|
|
11
|
+
* @returns {bigint}
|
|
12
|
+
*
|
|
13
|
+
* @author Alex Goldring
|
|
14
|
+
* @copyright Company Named Limited (c) 2026
|
|
15
|
+
*/
|
|
16
|
+
export function vgeo_compute_header_checksum(buffer) {
|
|
17
|
+
const header = new BinaryBuffer();
|
|
18
|
+
|
|
19
|
+
header.fromArrayBuffer(buffer.raw_bytes.slice(0, VGEO_HEADER_SIZE).buffer);
|
|
20
|
+
|
|
21
|
+
header.position = VGEO_HEADER_OFFSET.HEADER_CHECKSUM;
|
|
22
|
+
header.writeUint64(0n);
|
|
23
|
+
|
|
24
|
+
return xxh3_64(header.raw_bytes);
|
|
25
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardShadeMaterial.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/material/StandardShadeMaterial.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StandardShadeMaterial.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/material/StandardShadeMaterial.js"],"names":[],"mappings":"AAQA;;;;GAIG;AAEH;IACI;;;OAGG;IACH,gBAFU,YAAY,CAEP;IAEf;;;OAGG;IACH,eAFU,KAAK,CAEsB;IAErC;;OAEG;IACH,gBAFU,YAAY,CAEP;IAEf;;;;;;OAMG;IACH,aAFU,YAAY,CAEV;IAEZ;;OAEG;IACH,kBAFU,YAAY,CAEL;IAEjB;;;;;;;;OAQG;IACH,UAFU,mBAAmB,GAAC,SAAS,CAE9B;IAET;;;OAGG;IACH,kBAFU,MAAM,CAEK;IAErB;;;OAGG;IACH,iBAFU,MAAM,CAEI;IAEpB;;;;;;;;OAQG;IACH,qBAFU,MAAM,CAEQ;IAExB;;;;;;OAMG;IACH,YAFU,MAAM,CAEC;IAEjB;;;;;;;;;;;OAWG;IACH,QAFU,mBAAmB,GAAC,IAAI,CAEpB;IAEd;;;OAGG;IACH,iBAFU,KAAK,CAE4B;IAE3C;;;OAGG;IACH,iBAFU,cAAc,CAEmB;IAW3C;;;;;OAKG;IACH,YAFW,qBAAqB,QAoB/B;IAED;;;OAGG;IACH,SAFa,qBAAqB,CAQjC;IAiBD;;;;OAIG;IACH,cAHW,qBAAqB,GACnB,OAAO,CA+BnB;IAGL;;;OAGG;IACH,kCAFU,OAAO,CAEsC;CANtD;2BA3MY,OAAO,4BAA4B,EAAE,YAAY;kCACjD,OAAO,2CAA2C,EAAE,mBAAmB;kCACvE,OAAO,kCAAkC,EAAE,mBAAmB;8BAL7C,oBAAoB;sBAJ5B,8BAA8B;2BACzB,4CAA4C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix2 } from "../../../core/math/hash/hash_mix2.js";
|
|
2
|
+
import { hash_mix3 } from "../../../core/math/hash/hash_mix3.js";
|
|
2
3
|
import { Color } from "../../../core/color/Color.js";
|
|
3
4
|
import LinearModifier from "../../../core/model/stat/LinearModifier.js";
|
|
4
5
|
import { optional_equality } from "../../../core/model/object/optional_equality.js";
|
|
@@ -160,13 +161,17 @@ export class StandardShadeMaterial extends ShadeMaterial {
|
|
|
160
161
|
}
|
|
161
162
|
|
|
162
163
|
hash() {
|
|
163
|
-
return
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
return hash_mix2(
|
|
165
|
+
hash_mix3(
|
|
166
|
+
hash_mix3(
|
|
167
|
+
super.hash(),
|
|
168
|
+
this.diffuse_color.hash(),
|
|
169
|
+
optional_hash(this.texture_albedo)
|
|
170
|
+
),
|
|
171
|
+
optional_hash(this.texture_normal),
|
|
172
|
+
optional_hash(this.texture_orm)
|
|
173
|
+
),
|
|
174
|
+
optional_hash(this.texture_emissive)
|
|
170
175
|
);
|
|
171
176
|
}
|
|
172
177
|
|
package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"triangle_fingerprint_stream.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"triangle_fingerprint_stream.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js"],"names":[],"mappings":"AA8DA;;;;;;;;;;;;;;GAcG;AACH,iEAFa,WAAW,CAmFvB"}
|
package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { reinterpret_float32_as_int32 } from "../../../../../../core/binary/reinterpret_float32_as_int32.js";
|
|
2
|
-
import {
|
|
2
|
+
import { hash_mix2 } from "../../../../../../core/math/hash/hash_mix2.js";
|
|
3
|
+
import { hash_mix3 } from "../../../../../../core/math/hash/hash_mix3.js";
|
|
3
4
|
import { v3_distance } from "../../../../../../core/geom/vec3/v3_distance.js";
|
|
4
5
|
import { StandardAttributes } from "../../../../geometry/StandardAttributes.js";
|
|
5
6
|
|
|
@@ -15,7 +16,7 @@ function fold_strided(h, data, stride, vertex_index) {
|
|
|
15
16
|
if (data === null) return h;
|
|
16
17
|
const base = vertex_index * stride;
|
|
17
18
|
for (let i = 0; i < stride; i++) {
|
|
18
|
-
h =
|
|
19
|
+
h = hash_mix2(h, reinterpret_float32_as_int32(data[base + i]));
|
|
19
20
|
}
|
|
20
21
|
return h;
|
|
21
22
|
}
|
|
@@ -140,9 +141,17 @@ export function triangle_fingerprint_stream(geometry) {
|
|
|
140
141
|
|
|
141
142
|
sort_three(keys_scratch, attrs_scratch);
|
|
142
143
|
|
|
143
|
-
result[t] =
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
result[t] = hash_mix2(
|
|
145
|
+
hash_mix3(
|
|
146
|
+
hash_mix3(
|
|
147
|
+
keys_scratch[0],
|
|
148
|
+
keys_scratch[1],
|
|
149
|
+
keys_scratch[2]
|
|
150
|
+
),
|
|
151
|
+
attrs_scratch[0],
|
|
152
|
+
attrs_scratch[1]
|
|
153
|
+
),
|
|
154
|
+
attrs_scratch[2]
|
|
146
155
|
) | 0;
|
|
147
156
|
}
|
|
148
157
|
|
|
@@ -8,7 +8,7 @@ import html_canvas_to_sampler2d from "../../../../engine/graphics/texture/html_c
|
|
|
8
8
|
export function sampler2d_from_image_bitmap(bitmap) {
|
|
9
9
|
// 1. Draw the bitmap to a canvas
|
|
10
10
|
const canvas = new OffscreenCanvas(bitmap.width, bitmap.height);
|
|
11
|
-
const ctx = canvas.getContext('2d');
|
|
11
|
+
const ctx = canvas.getContext('2d', { willReadFrequently: true });
|
|
12
12
|
ctx.drawImage(bitmap, 0, 0);
|
|
13
13
|
|
|
14
14
|
return html_canvas_to_sampler2d(canvas);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
3
3
|
import { isArrayEqual } from "../../../../core/collection/array/isArrayEqual.js";
|
|
4
4
|
import { isPowerOfTwo } from "../../../../core/math/isPowerOfTwo.js";
|
|
5
5
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
@@ -181,7 +181,7 @@ export class WGSLStructField {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
hash() {
|
|
184
|
-
return
|
|
184
|
+
return hash_mix3(
|
|
185
185
|
computeStringHash(this.name),
|
|
186
186
|
this.offset,
|
|
187
187
|
this.type.hash()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
3
3
|
import { round_up } from "../../../../core/math/round_up.js";
|
|
4
4
|
import { CodeChunk } from "../compiler/CodeChunk.js";
|
|
5
5
|
import { f32, u32, vec4f, vec4u } from "./WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
@@ -61,7 +61,7 @@ export class WebGPUArray extends WebGPUType {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
hash() {
|
|
64
|
-
return
|
|
64
|
+
return hash_mix2(
|
|
65
65
|
this.type.hash(),
|
|
66
66
|
this.count
|
|
67
67
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebGPUStruct.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/shader/type/WebGPUStruct.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WebGPUStruct.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/shader/type/WebGPUStruct.js"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH;IAmNI;;;;;;;;;;;;;;OAcG;IACH,8BAHW,MAAM,GACL,YAAY,CAiCvB;IAED;;;;OAIG;IACH,6BAHc,eAAe,KACjB,YAAY,CAiBvB;IA5QD;;;OAGG;IACH,uBAEC;IAVD,kBAEC;IAUD;;;OAGG;IACH,iBAFU,eAAe,EAAE,CAEf;IAmBZ;;;;OAIG;IACH,YAHW,YAAY,GACV,IAAI,CAwBhB;IAED;;;OAGG;IACH,SAFY,YAAY,CAUvB;IAED;;;;;;;;OAQG;IACH,kBAJa,MAAM,CA+BlB;IAED;;;;;;OAMG;IACH,QAFa,IAAI,CAoChB;IAED,4BAYC;IAuGD;;;;OAIG;IACH,gBAHW,MAAM,GACJ,OAAO,CAKnB;IAGD;;;;;OAKG;IACH,gBAJW,MAAM,GACL,eAAe,CAa1B;IA8GL;;;OAGG;IACH,mBAFU,OAAO,CAEc;;CAN9B;2BAvb0B,iBAAiB;gCAEZ,sBAAsB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
2
|
import LineBuilder from "../../../../core/codegen/LineBuilder.js";
|
|
3
|
-
import {
|
|
3
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
4
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
4
5
|
import { isArrayEqual } from "../../../../core/collection/array/isArrayEqual.js";
|
|
5
6
|
import { round_up } from "../../../../core/math/round_up.js";
|
|
6
7
|
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
@@ -210,11 +211,13 @@ export class WebGPUStruct extends WebGPUType {
|
|
|
210
211
|
}
|
|
211
212
|
|
|
212
213
|
hash() {
|
|
213
|
-
return
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
214
|
+
return hash_mix2(
|
|
215
|
+
hash_mix3(
|
|
216
|
+
computeStringHash(this.name),
|
|
217
|
+
this.#size,
|
|
218
|
+
this.#align
|
|
219
|
+
),
|
|
220
|
+
this.fields.length
|
|
218
221
|
);
|
|
219
222
|
}
|
|
220
223
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShadeTexture.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/texture/ShadeTexture.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ShadeTexture.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/texture/ShadeTexture.js"],"names":[],"mappings":"AAeA;IA4GI;;;;OAIG;IACH,oBAHW,UAAU,GACR,YAAY,CAiBxB;IA/HD,cAAW;IAOX;;;OAGG;IACH,8BAEC;IAED;;;;;;;;;;;;;OAaG;IACH,aAFU,UAAU,GAAC,MAAM,GAAC,IAAI,CAEb;IAEnB;;;OAGG;IACH,yDAEC;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,iBAAiB,GACtB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,iBAAiB,GACtB,IAAI,CAIhB;IAED;;;;OAIG;IACH,gBAHW,MAAM,GAAC,iBAAiB,SACxB,OAAO,QAQjB;IAED;;;;OAIG;IACH,cAHW,MAAM,GAAC,iBAAiB,GACtB,OAAO,CAInB;IAED,cAAsB;IAEtB,kBAAqC;IACrC,kBAAqC;IAErC;;;OAGG;IACH,cAFU,iBAAiB,CAEa;IAExC,cAA+B;IAC/B,cAA+B;IAC/B,cAA+B;IAE/B;;;OAGG;IACH,YAFU,MAAM,CAED;IAEf;;;;OAIG;IACH,wBAFU,iBAAiB,GAAC,MAAM,CAEgB;IAwBlD,eAiBC;IAED;;;;OAIG;IACH,cAHW,YAAY,GACV,OAAO,CAYnB;;CACJ;yBA3KY,OAAO,wBAAwB,EAAE,UAAU;yBAC3C,OAAO,iBAAiB,EAAE,UAAU;kCANf,wBAAwB;kCACxB,wBAAwB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { hash_mix2 } from "../../../core/math/hash/hash_mix2.js";
|
|
3
|
+
import { hash_mix3 } from "../../../core/math/hash/hash_mix3.js";
|
|
3
4
|
import { optional_hash } from "../../../core/model/object/optional_hash.js";
|
|
4
5
|
import { ShadeTextureFlags } from "./ShadeTextureFlags.js";
|
|
5
6
|
import { TextureFilterType } from "./TextureFilterType.js";
|
|
@@ -143,15 +144,21 @@ export class ShadeTexture {
|
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
hash() {
|
|
146
|
-
return
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
147
|
+
return hash_mix2(
|
|
148
|
+
hash_mix3(
|
|
149
|
+
hash_mix3(
|
|
150
|
+
hash_mix3(
|
|
151
|
+
optional_hash(this.#image),
|
|
152
|
+
this.flags,
|
|
153
|
+
this.minFilter
|
|
154
|
+
),
|
|
155
|
+
this.magFilter,
|
|
156
|
+
this.mipmapFilter
|
|
157
|
+
),
|
|
158
|
+
this.wrapS,
|
|
159
|
+
this.wrapT
|
|
160
|
+
),
|
|
161
|
+
this.wrapR
|
|
155
162
|
);
|
|
156
163
|
}
|
|
157
164
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../../../core/assert.js";
|
|
2
2
|
import { BinaryBuffer } from "../../../../core/binary/BinaryBuffer.js";
|
|
3
3
|
import { platform_compute_endianness } from "../../../../core/binary/platform_compute_endianness.js";
|
|
4
|
-
import {
|
|
4
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
5
5
|
import { HashMap } from "../../../../core/collection/map/HashMap.js";
|
|
6
6
|
import { Deque } from "../../../../core/collection/queue/Deque.js";
|
|
7
7
|
import { round_up } from "../../../../core/math/round_up.js";
|
|
@@ -69,7 +69,7 @@ class MipmapShaderKey {
|
|
|
69
69
|
* @return {number}
|
|
70
70
|
*/
|
|
71
71
|
hash() {
|
|
72
|
-
return
|
|
72
|
+
return hash_mix2(
|
|
73
73
|
computeStringHash(this.format),
|
|
74
74
|
this.filter,
|
|
75
75
|
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Most particle entries one point reads, over every level.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
2
|
+
* Most particle entries one point reads, over every level. A front's run of particles in a cell is one entry, so a
|
|
3
|
+
* point reads about one a front that reaches it; where it would read more than WATER_PARTICLE_CROWD_KEEP, the keep
|
|
4
|
+
* pass dooms the flattest runs in its cells, which fade out while what is left of the budget still draws them, and
|
|
5
|
+
* cuts, whole, the fronts the budget cannot hold.
|
|
6
6
|
*/
|
|
7
7
|
export const WATER_PARTICLE_GATHER_BUDGET: 64;
|
|
8
8
|
/**
|
|
@@ -5,10 +5,10 @@ import { chunk_water_spectrum } from "./spectrum/chunk_water_spectrum.js";
|
|
|
5
5
|
import { chunk_water_particle } from "./particles/chunk_water_particle.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Most particle entries one point reads, over every level.
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Most particle entries one point reads, over every level. A front's run of particles in a cell is one entry, so a
|
|
9
|
+
* point reads about one a front that reaches it; where it would read more than WATER_PARTICLE_CROWD_KEEP, the keep
|
|
10
|
+
* pass dooms the flattest runs in its cells, which fade out while what is left of the budget still draws them, and
|
|
11
|
+
* cuts, whole, the fronts the budget cannot hold.
|
|
12
12
|
*/
|
|
13
13
|
export const WATER_PARTICLE_GATHER_BUDGET = 64;
|
|
14
14
|
|
|
@@ -133,8 +133,8 @@ fn water_surface_sum(wave: u32, p: vec2<f32>, footprint: f32) -> WaterSurfaceSum
|
|
|
133
133
|
visited++;
|
|
134
134
|
let entry = water_particle_entries[i];
|
|
135
135
|
if (entry.key != key || any(entry.cell != cell)) { continue; }
|
|
136
|
-
let field =
|
|
137
|
-
entry.dispersion, entry.distance, entry.phase);
|
|
136
|
+
let field = water_particle_run_field(p - entry.position, entry.angle, entry.amplitude, entry.radius, entry.half_length,
|
|
137
|
+
entry.dispersion, entry.distance, entry.phase, entry.run);
|
|
138
138
|
// a packet is geometry while its wavelength spans eight samples, fading out by four
|
|
139
139
|
let f = clamp(log2(entry.radius / (2.0 * footprint)), 0.0, 1.0);
|
|
140
140
|
let rough = sqrt(1.0 - f * f);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AAkCA,kHAAkH;AAClH,+CAAgD;AAUhD;;;;GAIG;AACH;
|
|
1
|
+
{"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AAkCA,kHAAkH;AAClH,+CAAgD;AAUhD;;;;GAIG;AACH;IAwBI,uFAAuF;IACvF,yBAAuC;IACvC,kGAAkG;IAClG,yBAAuC;IACvC,uGAAuG;IACvG,6BAA+C;IAC/C,mEAAmE;IACnE,2BAAyD;IACzD,uBAAyC;IAEzC;;;;;;;;;;;OAWG;IACH,qCALW,MAAM,QACN,MAAM,UACK,OAAO,8CAA8C,EAAE,sBAAsB,KAAE,IAAI,GAAC,IAAI,CA4D7G;IAED,gBAeC;IAED;;;;;;;;;;;;;;;OAeG;IACH;QATyG,KAAK,EAAnG,OAAO,iEAAiE,EAAE,UAAU;QACpE,KAAK,EAArB,MAAM;QACa,KAAK;QACL,QAAQ;QACR,SAAS;QACT,QAAQ;QACX,YAAY,EAA5B,MAAM;QACU,EAAE,EAAlB,MAAM;aA8FhB;;CACJ"}
|
|
@@ -14,15 +14,15 @@ import {
|
|
|
14
14
|
shader_water_particles_bin,
|
|
15
15
|
shader_water_particles_bounds,
|
|
16
16
|
shader_water_particles_clear,
|
|
17
|
+
shader_water_particles_cut,
|
|
17
18
|
shader_water_particles_emit,
|
|
18
19
|
shader_water_particles_finalize,
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
shader_water_particles_keep,
|
|
21
|
+
shader_water_particles_links,
|
|
22
|
+
shader_water_particles_mark,
|
|
21
23
|
shader_water_particles_nest,
|
|
22
24
|
shader_water_particles_rank,
|
|
23
|
-
shader_water_particles_runs,
|
|
24
25
|
shader_water_particles_scatter,
|
|
25
|
-
shader_water_particles_share,
|
|
26
26
|
shader_water_particles_split,
|
|
27
27
|
shader_water_particles_total,
|
|
28
28
|
shader_water_particles_update,
|
|
@@ -58,17 +58,15 @@ export class GPUWaterParticles {
|
|
|
58
58
|
#children = null;
|
|
59
59
|
#child_sums = null;
|
|
60
60
|
#images = null;
|
|
61
|
-
#
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#draw = null;
|
|
61
|
+
#links = null;
|
|
62
|
+
#reaches = null;
|
|
63
|
+
#shown = null;
|
|
65
64
|
#buckets = null;
|
|
66
65
|
#offsets = null;
|
|
67
66
|
#slots = null;
|
|
68
67
|
#bucket_amplitude = null;
|
|
69
|
-
#
|
|
68
|
+
#bucket_crowd = null;
|
|
70
69
|
#bucket_nest = null;
|
|
71
|
-
#visible = null;
|
|
72
70
|
#staging = null;
|
|
73
71
|
#entries = null;
|
|
74
72
|
#body_bounds = null;
|
|
@@ -114,22 +112,21 @@ export class GPUWaterParticles {
|
|
|
114
112
|
this.#child_sums = buffer('child sums', sums(capacity));
|
|
115
113
|
// per particle the mirror image the step left beside it at the outline
|
|
116
114
|
this.#images = buffer('images', capacity * WATER_PARTICLE_STRUCT.size);
|
|
117
|
-
// per particle
|
|
118
|
-
|
|
119
|
-
this
|
|
120
|
-
this.#
|
|
121
|
-
|
|
122
|
-
this.#
|
|
115
|
+
// per particle its front's neighbours before and after it
|
|
116
|
+
this.#links = buffer('links', capacity * 8);
|
|
117
|
+
// per particle the cells its support overlaps this frame: its first, its level and spans
|
|
118
|
+
this.#reaches = buffer('reaches', capacity * 12);
|
|
119
|
+
// per particle whether its crowds draw it
|
|
120
|
+
this.#shown = buffer('shown', capacity * 4);
|
|
123
121
|
// per bucket its entries, then the hash: table size and inclusive offsets
|
|
124
122
|
this.#buckets = buffer('buckets', 16 + this.#table_limit * 4);
|
|
125
123
|
this.#offsets = buffer('offsets', sums(this.#table_limit));
|
|
126
124
|
this.#slots = buffer('slots', capacity * WATER_PARTICLE_CORNERS * 4);
|
|
127
125
|
this.#bucket_amplitude = buffer('bucket amplitude', this.#table_limit * 4);
|
|
128
|
-
//
|
|
129
|
-
//
|
|
130
|
-
this.#
|
|
126
|
+
// its runs by steepness class and in all; then the most a point under it reads at finer levels, the classes its
|
|
127
|
+
// points keep and draw, and a slot of the frame's table of cut fronts
|
|
128
|
+
this.#bucket_crowd = buffer('bucket crowd', this.#table_limit * WATER_PARTICLE_CROWD_WORDS * 4);
|
|
131
129
|
this.#bucket_nest = buffer('bucket nest', this.#table_limit * WATER_PARTICLE_NEST_WORDS * 4);
|
|
132
|
-
this.#visible = buffer('visible', capacity * 4);
|
|
133
130
|
const entries = capacity * WATER_PARTICLE_CORNERS * WATER_PARTICLE_ENTRY_STRUCT.size;
|
|
134
131
|
this.#staging = buffer('staging', entries);
|
|
135
132
|
this.#entries = buffer('entries', entries);
|
|
@@ -157,16 +154,15 @@ export class GPUWaterParticles {
|
|
|
157
154
|
}
|
|
158
155
|
|
|
159
156
|
dispose() {
|
|
160
|
-
for (const buffer of [...this.#particles, this.#children, this.#child_sums, this.#images, this.#
|
|
161
|
-
this.#
|
|
162
|
-
|
|
157
|
+
for (const buffer of [...this.#particles, this.#children, this.#child_sums, this.#images, this.#links, this.#reaches, this.#shown, this.#buckets,
|
|
158
|
+
this.#offsets, this.#slots, this.#bucket_amplitude, this.#bucket_crowd, this.#bucket_nest, this.#staging, this.#entries, this.#body_bounds,
|
|
159
|
+
...(this.#commands ?? [])]) {
|
|
163
160
|
buffer?.destroy();
|
|
164
161
|
}
|
|
165
162
|
this.#particles = [];
|
|
166
163
|
this.#children = this.#child_sums = this.#images = this.#buckets = this.#offsets = this.#slots = this.#bucket_amplitude = null;
|
|
167
164
|
this.#staging = this.#entries = null;
|
|
168
|
-
this.#
|
|
169
|
-
this.#bucket_weight = this.#bucket_nest = this.#visible = null;
|
|
165
|
+
this.#links = this.#reaches = this.#shown = this.#bucket_crowd = this.#bucket_nest = null;
|
|
170
166
|
this.#body_bounds = null;
|
|
171
167
|
this.#commands = null;
|
|
172
168
|
this.#device = null;
|
|
@@ -205,8 +201,6 @@ export class GPUWaterParticles {
|
|
|
205
201
|
let child_sums = graph_import_buffer(graph, this.#child_sums, 'Water / particle child sums');
|
|
206
202
|
let buckets = graph_import_buffer(graph, this.#buckets, 'Water / particle buckets');
|
|
207
203
|
let offsets = graph_import_buffer(graph, this.#offsets, 'Water / particle offsets');
|
|
208
|
-
let fronts = graph_import_buffer(graph, this.#fronts, 'Water / particle fronts');
|
|
209
|
-
let front_sums = graph_import_buffer(graph, this.#front_sums, 'Water / particle front sums');
|
|
210
204
|
const node = (name, execute, reads, writes) => {
|
|
211
205
|
const data = {};
|
|
212
206
|
const pass = graph.add(name, data, (d, resources, context) => execute(resources, context, d));
|
|
@@ -243,49 +237,46 @@ export class GPUWaterParticles {
|
|
|
243
237
|
}, { child_sums }, {});
|
|
244
238
|
}
|
|
245
239
|
|
|
246
|
-
//
|
|
247
|
-
|
|
240
|
+
// The frame's hash: each particle's neighbours round its front, so that a run of them is drawn as one; how crowded
|
|
241
|
+
// each cell is and so which runs it keeps, the steepest, dooming the rest and cutting, whole, the fronts the gather
|
|
242
|
+
// cannot read;
|
|
243
|
+
// then each drawn run entered into every cell its first particle's support overlaps, offsets, entries in order.
|
|
244
|
+
buckets = node('Water / particles bin', (resources, { encoder }) => {
|
|
248
245
|
if (!stepping) {
|
|
249
246
|
// the table size the last stepping frame chose for these particles
|
|
250
247
|
shader_water_particles_finalize.dispatch({ encoder, bindings: { limits: { capacity, table_limit }, next, offsets: this.#buckets,
|
|
251
248
|
table_command: command_table } });
|
|
252
249
|
}
|
|
253
250
|
build_indirect_compute_dispatch_command(64, encoder, next, 0, command_next, 0, true);
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
front_sums = graph_prefix_scan_csdldf({ graph, input: fronts, output: front_sums, element_max_count: capacity });
|
|
258
|
-
|
|
259
|
-
// The frame's hash: how each particle is drawn, how crowded each cell is and so how much of each run its crowd
|
|
260
|
-
// leaves drawn, then each packet drawn into the cells its support overlaps, offsets, entries in order.
|
|
261
|
-
buckets = node('Water / particles bin', (resources, { encoder }) => {
|
|
262
|
-
const draw = this.#draw, runs = this.#runs;
|
|
263
|
-
shader_water_particles_runs.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs } });
|
|
264
|
-
shader_water_particles_groups.dispatchIndirect({ encoder, command: command_next, bindings: { next, fronts: this.#front_sums, runs, draw } });
|
|
251
|
+
const links = this.#links;
|
|
252
|
+
const reaches = this.#reaches;
|
|
253
|
+
shader_water_particles_links.dispatchIndirect({ encoder, command: command_next, bindings: { next, links, reaches } });
|
|
265
254
|
shader_water_particles_clear.dispatchIndirect({ encoder, command: command_table, bindings: {
|
|
266
|
-
buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude,
|
|
267
|
-
bucket_nest: this.#bucket_nest } });
|
|
268
|
-
shader_water_particles_weigh.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
269
|
-
next, activity, offsets: this.#buckets, draw, bucket_weight: this.#bucket_weight, body_bounds: this.#body_bounds } });
|
|
270
|
-
shader_water_particles_nest.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
271
|
-
next, activity, offsets: this.#buckets, draw, body_bounds: this.#body_bounds, bucket_weight: this.#bucket_weight,
|
|
255
|
+
buckets: this.#buckets, bucket_amplitude: this.#bucket_amplitude, bucket_crowd: this.#bucket_crowd,
|
|
272
256
|
bucket_nest: this.#bucket_nest } });
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
257
|
+
const crowd = { next, activity, offsets: this.#buckets, links, reaches, body_bounds: this.#body_bounds,
|
|
258
|
+
bucket_crowd: this.#bucket_crowd };
|
|
259
|
+
shader_water_particles_weigh.dispatchIndirect({ encoder, command: command_next, bindings: crowd });
|
|
260
|
+
shader_water_particles_nest.dispatchIndirect({ encoder, command: command_next, bindings: { ...crowd, bucket_nest: this.#bucket_nest } });
|
|
261
|
+
shader_water_particles_cut.dispatchIndirect({ encoder, command: command_next, bindings: { ...crowd, bucket_nest: this.#bucket_nest } });
|
|
262
|
+
const shown = this.#shown;
|
|
263
|
+
shader_water_particles_mark.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
264
|
+
next, activity, offsets: this.#buckets, reaches, bucket_nest: this.#bucket_nest } });
|
|
265
|
+
shader_water_particles_keep.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
266
|
+
next, activity, offsets: this.#buckets, reaches, bucket_nest: this.#bucket_nest, shown } });
|
|
276
267
|
shader_water_particles_bin.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
277
268
|
next, activity, buckets: this.#buckets, slots: this.#slots, bucket_amplitude: this.#bucket_amplitude,
|
|
278
|
-
body_bounds: this.#body_bounds,
|
|
279
|
-
}, {
|
|
269
|
+
body_bounds: this.#body_bounds, links, reaches, shown } });
|
|
270
|
+
}, {}, { buckets }).buckets;
|
|
280
271
|
offsets = graph_prefix_scan_csdldf({ graph, input: buckets, output: offsets, element_max_count: table_limit });
|
|
281
272
|
node('Water / particles order and bound', (resources, { encoder }) => {
|
|
282
|
-
const bindings = { next, offsets: this.#offsets, slots: this.#slots,
|
|
273
|
+
const bindings = { next, offsets: this.#offsets, slots: this.#slots, reaches: this.#reaches };
|
|
283
274
|
shader_water_particles_scatter.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
|
|
284
|
-
|
|
275
|
+
links: this.#links, shown: this.#shown, staging: this.#staging } });
|
|
285
276
|
shader_water_particles_rank.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings,
|
|
286
277
|
staging: this.#staging, entries: this.#entries } });
|
|
287
|
-
shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: {
|
|
288
|
-
|
|
278
|
+
shader_water_particles_bounds.dispatchIndirect({ encoder, command: command_next, bindings: { ...bindings, activity,
|
|
279
|
+
bucket_amplitude: this.#bucket_amplitude, body_bounds: this.#body_bounds } });
|
|
289
280
|
}, { offsets }, {});
|
|
290
281
|
}
|
|
291
282
|
}
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export const WATER_PARTICLE_STRUCT: WebGPUStruct;
|
|
10
10
|
/**
|
|
11
|
-
* A
|
|
12
|
-
* time, and the cell it was entered for, since
|
|
13
|
-
* two cells may share a bucket.
|
|
11
|
+
* A run of a front's particles as one hash cell holds it for the surface sampler: everything its kernel needs at the
|
|
12
|
+
* frame's time, from the run's first particle, and the cell it was entered for, since a front is entered in every cell
|
|
13
|
+
* its support overlaps and two cells may share a bucket.
|
|
14
14
|
*/
|
|
15
15
|
export const WATER_PARTICLE_ENTRY_STRUCT: WebGPUStruct;
|
|
16
16
|
import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WATER_PARTICLE_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,
|
|
1
|
+
{"version":3,"file":"WATER_PARTICLE_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AACH,iDAyBoB;AAEpB;;;;GAIG;AACH,uDAuByB;6BAjEI,sCAAsC"}
|