@woosh/meep-engine 3.17.1 → 3.18.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/editor/actions/concrete/ComponentAddAction.d.ts +1 -0
- package/editor/actions/concrete/ComponentAddAction.d.ts.map +1 -1
- package/editor/actions/concrete/ComponentAddAction.js +4 -0
- package/editor/actions/concrete/ComponentRemoveAction.d.ts +1 -0
- package/editor/actions/concrete/ComponentRemoveAction.d.ts.map +1 -1
- package/editor/actions/concrete/ComponentRemoveAction.js +4 -0
- package/editor/actions/concrete/EntityCreateAction.d.ts +1 -0
- package/editor/actions/concrete/EntityCreateAction.d.ts.map +1 -1
- package/editor/actions/concrete/EntityCreateAction.js +7 -0
- package/editor/actions/concrete/EntityRemoveAction.d.ts +1 -0
- package/editor/actions/concrete/EntityRemoveAction.d.ts.map +1 -1
- package/editor/actions/concrete/EntityRemoveAction.js +4 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts +10 -0
- package/editor/actions/concrete/PatchTerrainHeightAction.d.ts.map +1 -1
- package/editor/actions/concrete/PatchTerrainHeightAction.js +107 -85
- package/editor/actions/concrete/TransformModifyAction.d.ts +1 -0
- package/editor/actions/concrete/TransformModifyAction.d.ts.map +1 -1
- package/editor/actions/concrete/TransformModifyAction.js +4 -0
- package/editor/particles/effect/ParticleEffectDocument.d.ts.map +1 -1
- package/editor/particles/effect/ParticleEffectDocument.js +10 -6
- package/editor/particles/effect/ParticleReferenceSimulation.d.ts.map +1 -1
- package/editor/particles/effect/ParticleReferenceSimulation.js +98 -4
- package/editor/particles/effect/make_starter_particle_effect.d.ts.map +1 -1
- package/editor/particles/effect/make_starter_particle_effect.js +0 -2
- package/editor/tools/engine/ToolEngine.d.ts +30 -0
- package/editor/tools/engine/ToolEngine.d.ts.map +1 -1
- package/editor/tools/engine/ToolEngine.js +257 -188
- package/editor/view/ecs/EntityList.d.ts.map +1 -1
- package/editor/view/ecs/EntityList.js +6 -5
- package/editor/view/particles/effect/ParticleEmitterInspectorView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleEmitterInspectorView.js +17 -9
- package/package.json +1 -1
- package/src/CODEC_LAYOUT_VERIFICATION.md +1 -2
- package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts +56 -0
- package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.d.ts.map +1 -0
- package/src/core/binary/meshopt/MESHOPT_VERTEX_BLOCK.js +73 -0
- package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.d.ts.map +1 -1
- package/src/core/binary/meshopt/meshopt_decode_vertex_buffer.js +18 -63
- package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts +53 -0
- package/src/core/binary/meshopt/meshopt_encode_byte_group.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_byte_group.js +140 -0
- package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts +32 -0
- package/src/core/binary/meshopt/meshopt_encode_data_block.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_data_block.js +77 -0
- package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts +46 -0
- package/src/core/binary/meshopt/meshopt_encode_index_sequence.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_index_sequence.js +146 -0
- package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts +40 -0
- package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_encode_vertex_buffer.js +700 -0
- package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts +24 -0
- package/src/core/binary/meshopt/meshopt_write_uint_var.d.ts.map +1 -0
- package/src/core/binary/meshopt/meshopt_write_uint_var.js +39 -0
- package/src/core/math/random/seededRandom_Mulberry32.d.ts.map +1 -1
- package/src/core/math/random/seededRandom_Mulberry32.js +4 -2
- package/src/core/process/undo/Action.d.ts +19 -0
- package/src/core/process/undo/Action.d.ts.map +1 -1
- package/src/core/process/undo/Action.js +17 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +78 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +310 -0
- package/src/engine/graphics3/GraphicsEngine.d.ts +17 -0
- package/src/engine/graphics3/GraphicsEngine.d.ts.map +1 -1
- package/src/engine/graphics3/GraphicsEngine.js +30 -10
- package/src/engine/graphics3/particles/particle_gpu_records.d.ts.map +1 -1
- package/src/engine/graphics3/particles/particle_gpu_records.js +0 -2
- package/src/engine/interpolation/InterpolationSystem.d.ts +7 -0
- package/src/engine/interpolation/InterpolationSystem.d.ts.map +1 -1
- package/src/engine/interpolation/InterpolationSystem.js +10 -0
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +14 -34
- package/src/engine/network/time/RenderPlayout.d.ts +76 -0
- package/src/engine/network/time/RenderPlayout.d.ts.map +1 -0
- package/src/engine/network/time/RenderPlayout.js +163 -0
- package/src/engine/network/transport/adapters/WebSocketTransport.d.ts.map +1 -1
- package/src/engine/network/transport/adapters/WebSocketTransport.js +11 -4
- package/src/engine/physics/ecs/PhysicsSystem.d.ts +4 -12
- package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
- package/src/engine/physics/ecs/PhysicsSystem.js +39 -13
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/sound/simulation/core/VolumeField.d.ts.map +1 -1
- package/src/engine/sound/simulation/core/VolumeField.js +4 -1
- package/src/format/scene/gltf/MESHOPT_COMPRESSION_PLAN.md +23 -2
- package/src/shade/playground/particle_system/README.md +139 -139
- package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
- package/src/shade/playground/particle_system/particle_prototype.js +0 -2
- package/src/shade/playground/particle_system/particle_scene.d.ts +6 -9
- package/src/shade/playground/particle_system/particle_scene.d.ts.map +1 -1
- package/src/shade/playground/particle_system/particle_scene.js +6 -13
- package/src/shade/playground/ssr_reprojection/README.md +103 -0
- package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts +17 -0
- package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.d.ts.map +1 -0
- package/src/shade/playground/ssr_reprojection/SpatialFilterProbe.js +68 -0
- package/src/shade/playground/ssr_reprojection/index.html +79 -0
- package/src/shade/playground/ssr_reprojection/main.d.ts +2 -0
- package/src/shade/playground/ssr_reprojection/main.d.ts.map +1 -0
- package/src/shade/playground/ssr_reprojection/main.js +245 -0
- package/src/shade/playground/ssr_reprojection/scene.d.ts +18 -0
- package/src/shade/playground/ssr_reprojection/scene.d.ts.map +1 -0
- package/src/shade/playground/ssr_reprojection/scene.js +51 -0
- package/src/shade/renderer/Renderer.d.ts +2 -23
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +185 -218
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts +5 -8
- package/src/shade/renderer/animation/GPUAnimationManager.d.ts.map +1 -1
- package/src/shade/renderer/animation/GPUAnimationManager.js +12 -12
- package/src/shade/renderer/buffer/table/GPUTypedTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/GPUTypedTable.js +6 -0
- package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.d.ts.map +1 -1
- package/src/shade/renderer/buffer/table/single/GPUSingleTypeTable.js +7 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts +4 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/chunk_brick4_sample_specular.js +51 -0
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/draw/shader_brick4_specular.js +5 -35
- package/src/shade/renderer/particles/DESIGN.md +703 -514
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts +16 -4
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +1189 -991
- package/src/shade/renderer/particles/ParticleConstants.d.ts +64 -0
- package/src/shade/renderer/particles/ParticleConstants.d.ts.map +1 -1
- package/src/shade/renderer/particles/ParticleConstants.js +71 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts +57 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds.js +181 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts +7 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/chunk_particle_bounds_unknown.js +12 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts +33 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/graph_particle_bounds.js +67 -0
- package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts +40 -0
- package/src/shade/renderer/particles/bounds/shader_particle_bounds.d.ts.map +1 -0
- package/src/shade/renderer/particles/bounds/shader_particle_bounds.js +187 -0
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts +15 -2
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.d.ts.map +1 -1
- package/src/shade/renderer/particles/coherence/graph_particle_bucket.js +14 -8
- package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts +58 -4
- package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/PARTICLE_COUNTERS.js +79 -4
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts +23 -1
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STATE.js +35 -2
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts +4 -2
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.js +5 -8
- package/src/shade/renderer/particles/data/particle_emitter_record.d.ts.map +1 -1
- package/src/shade/renderer/particles/data/particle_emitter_record.js +0 -6
- package/src/shade/renderer/particles/graph_particles.d.ts +25 -3
- package/src/shade/renderer/particles/graph_particles.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles.js +108 -31
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts +6 -4
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +5 -5
- package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts +5 -0
- package/src/shade/renderer/particles/runtime/EmitterRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/EmitterRegistry.js +27 -6
- package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts +4 -0
- package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/GPUParticleEmitterContext.js +6 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +35 -27
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.js +424 -425
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts +20 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts +4 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_render_math.js +38 -2
- package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts +22 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/chunk_particle_spawn_budget.js +42 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_occupancy.js +53 -22
- package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emitter_tick.js +213 -216
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts +50 -0
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts.map +1 -0
- package/src/shade/renderer/particles/shaders/shader_particle_render.js +1 -1
- package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts +36 -0
- package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/chunk_particle_warmup_step.js +102 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts +102 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/graph_particle_warmup.js +329 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts +112 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup.js +318 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts +35 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +108 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts +3 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +70 -0
- package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts +62 -0
- package/src/shade/renderer/particles/warmup/warmup_schedule.d.ts.map +1 -0
- package/src/shade/renderer/particles/warmup/warmup_schedule.js +55 -0
- package/src/shade/renderer/postprocess/PostProcess.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/PostProcess.js +2 -1
- package/src/shade/renderer/postprocess/ssr/REPROJECTION_PROPOSAL.md +286 -0
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts +57 -21
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +230 -129
- package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts +11 -0
- package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/SSRReprojectionMode.js +6 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_metadata.js +32 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/chunk_ssr_spatial_variance.js +41 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts +3 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.js +30 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +70 -0
- package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts +21 -0
- package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/resolve/build_ssr_resolve_shader.js +363 -0
- package/src/shade/renderer/postprocess/ssr/resolve/chunk_get_neighbour_weight.js +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts +2 -0
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_Brick4.js +24 -0
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts +1 -6
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_IBL.js +16 -332
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts +1 -6
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/resolve/ssr_resolve_shader_LPV.js +25 -358
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts +0 -5
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +201 -276
- package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts +1 -0
- package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_spatial_denoise_shader.js +167 -143
- package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts +15 -0
- package/src/shade/renderer/shader/graph/graph_create_buffer.d.ts.map +1 -0
- package/src/shade/renderer/shader/graph/graph_create_buffer.js +20 -0
- package/src/shade/renderer/view/GPUViewContext.d.ts +3 -4
- package/src/shade/renderer/view/GPUViewContext.d.ts.map +1 -1
- package/src/shade/renderer/view/GPUViewContext.js +5 -5
- package/src/core/binary/meshopt/__meshopt_test_streams.d.ts +0 -24
- package/src/core/binary/meshopt/__meshopt_test_streams.d.ts.map +0 -1
- package/src/core/binary/meshopt/__meshopt_test_streams.js +0 -237
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts +0 -84
- package/src/core/geom/3d/atlas/atlas_test_fixtures.d.ts.map +0 -1
- package/src/core/geom/3d/atlas/atlas_test_fixtures.js +0 -266
- package/src/engine/asset/loaders/gltf_test_fixtures.d.ts +0 -97
- package/src/engine/asset/loaders/gltf_test_fixtures.d.ts.map +0 -1
- package/src/engine/asset/loaders/gltf_test_fixtures.js +0 -359
- package/src/engine/sound/simulation/core/OcclusionSolver.d.ts +0 -29
- package/src/engine/sound/simulation/core/OcclusionSolver.d.ts.map +0 -1
- package/src/shade/renderer/animation/skin_test_fixtures.d.ts +0 -86
- package/src/shade/renderer/animation/skin_test_fixtures.d.ts.map +0 -1
- package/src/shade/renderer/animation/skin_test_fixtures.js +0 -250
- package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts +0 -16
- package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.js +0 -27
- package/src/shade/renderer/particles/particle_test_fixtures.d.ts +0 -151
- package/src/shade/renderer/particles/particle_test_fixtures.d.ts.map +0 -1
- package/src/shade/renderer/particles/particle_test_fixtures.js +0 -229
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.js +0 -23
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.js +0 -457
|
@@ -1,250 +0,0 @@
|
|
|
1
|
-
import { BinaryBuffer } from "../../../core/binary/BinaryBuffer.js";
|
|
2
|
-
import { platform_compute_endianness } from "../../../core/binary/platform_compute_endianness.js";
|
|
3
|
-
import { m4_invert } from "../../../core/geom/3d/mat4/m4_invert.js";
|
|
4
|
-
import { MeshletGeometry } from "../geometry/MeshletGeometry.js";
|
|
5
|
-
import {
|
|
6
|
-
MESHLET_METADATA_STRUCT
|
|
7
|
-
} from "../geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js";
|
|
8
|
-
import { StandardShadeMaterial } from "../material/StandardShadeMaterial.js";
|
|
9
|
-
import { write_wgsl_type_value } from "../shader/type/serde/write_gpu_typed_buffer.js";
|
|
10
|
-
import { Node3D } from "../scene/Node3D.js";
|
|
11
|
-
import { SkinnedMesh } from "../scene/SkinnedMesh.js";
|
|
12
|
-
import { Skin } from "./Skin.js";
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* The two shapes a glTF character actually arrives in, built as scene graphs.
|
|
16
|
-
*
|
|
17
|
-
* Both are legal glTF and both are in the wild; the difference is only the space the file's author
|
|
18
|
-
* wrote the inverse-bind matrices in, and it decides whether `inverse(mesh.global) × joint.global ×
|
|
19
|
-
* inverse_bind` — the matrix the skinning pass converts to a dual quaternion — comes out rigid. See
|
|
20
|
-
* `SKINNING_FRAME_PLAN.md`.
|
|
21
|
-
*
|
|
22
|
-
* One hierarchy serves both, because the difference is not in the hierarchy:
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
* "placement" added at runtime, above the file's own roots
|
|
26
|
-
* └── "Character" the file's unit conversion and up-axis rotation
|
|
27
|
-
* ├── "Mesh" the skinned mesh, no local transform of its own
|
|
28
|
-
* └── "Joint0" the joint root — the mesh node's *sibling*, as every rigged glTF has it
|
|
29
|
-
* └── "Joint1"
|
|
30
|
-
* └── "Joint2"
|
|
31
|
-
* ```
|
|
32
|
-
*
|
|
33
|
-
* @author Alex Goldring
|
|
34
|
-
* @copyright Company Named Limited (c) 2026
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* What every one of this game's creature models puts on its glTF root node — an FBX unit
|
|
39
|
-
* conversion, uniform, and inherited by the joints and the mesh node alike.
|
|
40
|
-
*
|
|
41
|
-
* @type {number}
|
|
42
|
-
*/
|
|
43
|
-
export const EXPORT_SCALE = 0.35;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The centimetre→metre conversion `Michelle.glb` carries on hers.
|
|
47
|
-
*
|
|
48
|
-
* @type {number}
|
|
49
|
-
*/
|
|
50
|
-
export const MICHELLE_SCALE = 0.01;
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Where the file's author wrote the inverse-bind matrices.
|
|
54
|
-
*
|
|
55
|
-
* @enum {string}
|
|
56
|
-
*/
|
|
57
|
-
export const BindSpace = {
|
|
58
|
-
/**
|
|
59
|
-
* Before the root's conversion — the matrices invert the joints' transforms in the mesh's own
|
|
60
|
-
* pre-conversion space, so `joint.global × inverse_bind` carries the conversion and equals the
|
|
61
|
-
* mesh node's world transform. This is the arrangement `chunk_skin_blend_mesh_local` was written
|
|
62
|
-
* for, and the one where the fold cancels.
|
|
63
|
-
*/
|
|
64
|
-
PreScale: 'pre-scale',
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* After it — the matrices invert the joints' world transforms as the file leaves them, so
|
|
68
|
-
* `joint.global × inverse_bind` is the **identity** and the geometry's positions are already in
|
|
69
|
-
* converted units. `Michelle.glb` is this shape, and the fold leaves a bare `1 / scale` behind.
|
|
70
|
-
*/
|
|
71
|
-
World: 'world',
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Rest offsets down the joint chain, in the space the geometry's positions live in — a hip, a knee
|
|
76
|
-
* and an ankle rather than three copies of the origin, so that a defect which only shows on a joint
|
|
77
|
-
* away from the origin cannot pass.
|
|
78
|
-
*
|
|
79
|
-
* @type {number[][]}
|
|
80
|
-
*/
|
|
81
|
-
const REST_OFFSETS = [
|
|
82
|
-
[0, 1, 0],
|
|
83
|
-
[0.25, -0.5, 0.1],
|
|
84
|
-
[-0.1, -0.45, 0],
|
|
85
|
-
];
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* A rigged character in one of the two shapes.
|
|
89
|
-
*
|
|
90
|
-
* The rest pose **is** the bind pose, which is what a well-formed file has. The bind matrices are
|
|
91
|
-
* taken off the skeleton itself rather than composed by hand: the fixture walks the hierarchy once
|
|
92
|
-
* with the root's conversion in place and once without, and the two snapshots *are* the two bind
|
|
93
|
-
* spaces. Nothing here can drift from the hierarchy it describes, because it is read from it.
|
|
94
|
-
*
|
|
95
|
-
* The placement node goes on last, after the bind matrices are settled — which is what happens for
|
|
96
|
-
* real, and is what makes "the correction does not depend on where the character stands" a fact this
|
|
97
|
-
* fixture can be asked about rather than an assumption.
|
|
98
|
-
*
|
|
99
|
-
* @param {object} options
|
|
100
|
-
* @param {BindSpace} options.bind_space
|
|
101
|
-
* @param {number} [options.scale] the root's uniform conversion
|
|
102
|
-
* @param {boolean} [options.up_axis_rotation] whether the root also carries the −90° about x that an
|
|
103
|
-
* FBX-derived file pairs with its conversion. On by default: a correction that handles only
|
|
104
|
-
* the scale passes without it.
|
|
105
|
-
* @param {number[]} [options.placement] a translation applied above the whole character
|
|
106
|
-
* @returns {{
|
|
107
|
-
* placement: Node3D,
|
|
108
|
-
* root: Node3D,
|
|
109
|
-
* mesh: SkinnedMesh,
|
|
110
|
-
* skin: Skin,
|
|
111
|
-
* joints: Node3D[],
|
|
112
|
-
* }}
|
|
113
|
-
*/
|
|
114
|
-
export function make_character({
|
|
115
|
-
bind_space,
|
|
116
|
-
scale = EXPORT_SCALE,
|
|
117
|
-
up_axis_rotation = true,
|
|
118
|
-
placement = [0, 0, 0],
|
|
119
|
-
}) {
|
|
120
|
-
|
|
121
|
-
const root = new Node3D();
|
|
122
|
-
|
|
123
|
-
root.name = 'Character';
|
|
124
|
-
|
|
125
|
-
const mesh = new SkinnedMesh();
|
|
126
|
-
|
|
127
|
-
mesh.name = 'Mesh';
|
|
128
|
-
mesh.geometry = make_geometry();
|
|
129
|
-
mesh.material = new StandardShadeMaterial();
|
|
130
|
-
|
|
131
|
-
const joints = REST_OFFSETS.map((offset, i) => {
|
|
132
|
-
const joint = new Node3D();
|
|
133
|
-
|
|
134
|
-
joint.name = `Joint${i}`;
|
|
135
|
-
joint.transform_local.setTranslation(offset[0], offset[1], offset[2]);
|
|
136
|
-
|
|
137
|
-
return joint;
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
for (let i = 1; i < joints.length; i++) {
|
|
141
|
-
joints[i - 1].addChild(joints[i]);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
root.addChildren([mesh, joints[0]]);
|
|
145
|
-
|
|
146
|
-
/*
|
|
147
|
-
Pass one: the root at the identity, so the joints stand in the pre-conversion space an exporter
|
|
148
|
-
writing `PreScale` bind matrices was working in. Pass two adds the conversion, and the joints
|
|
149
|
-
stand where the file leaves them — the space a `World` exporter inverts.
|
|
150
|
-
*/
|
|
151
|
-
root.updateMatrices();
|
|
152
|
-
|
|
153
|
-
const bind = bind_space === BindSpace.PreScale ? snapshot_joint_globals(joints) : null;
|
|
154
|
-
|
|
155
|
-
root.transform_local.setScale(scale, scale, scale);
|
|
156
|
-
|
|
157
|
-
if (up_axis_rotation) {
|
|
158
|
-
// −90° about x, as a quaternion: the Z-up of the file into the renderer's Y-up
|
|
159
|
-
root.transform_local.setRotation(-Math.SQRT1_2, 0, 0, Math.SQRT1_2);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
root.updateMatrices();
|
|
163
|
-
|
|
164
|
-
const inverse_bind_matrices = new Float32Array(joints.length * 16);
|
|
165
|
-
|
|
166
|
-
const source = bind ?? snapshot_joint_globals(joints);
|
|
167
|
-
|
|
168
|
-
const inverse = new Float64Array(16);
|
|
169
|
-
|
|
170
|
-
for (let i = 0; i < joints.length; i++) {
|
|
171
|
-
m4_invert(inverse, source[i]);
|
|
172
|
-
|
|
173
|
-
inverse_bind_matrices.set(inverse, i * 16);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
const skin = Skin.from({
|
|
177
|
-
name: 'fixture',
|
|
178
|
-
joints,
|
|
179
|
-
inverse_bind_matrices,
|
|
180
|
-
meshes: [mesh],
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
const placement_node = new Node3D();
|
|
184
|
-
|
|
185
|
-
placement_node.name = 'placement';
|
|
186
|
-
placement_node.transform_local.setTranslation(placement[0], placement[1], placement[2]);
|
|
187
|
-
placement_node.addChild(root);
|
|
188
|
-
placement_node.updateMatrices();
|
|
189
|
-
|
|
190
|
-
return { placement: placement_node, root, mesh, skin, joints };
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Every joint's world matrix as it stands, copied out — a `Transform64` is live, and these are read
|
|
195
|
-
* after the hierarchy has been walked again.
|
|
196
|
-
*
|
|
197
|
-
* @param {Node3D[]} joints
|
|
198
|
-
* @returns {Float64Array[]}
|
|
199
|
-
*/
|
|
200
|
-
function snapshot_joint_globals(joints) {
|
|
201
|
-
return joints.map(joint => {
|
|
202
|
-
const copy = new Float64Array(16);
|
|
203
|
-
|
|
204
|
-
// a Transform64's matrix starts at element 0
|
|
205
|
-
for (let i = 0; i < 16; i++) {
|
|
206
|
-
copy[i] = joint.transform_global[i];
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
return copy;
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* One triangle in one meshlet, with enough metadata behind it to be cloned.
|
|
215
|
-
*
|
|
216
|
-
* A bare {@link MeshletGeometry} is enough for the frame arithmetic, which only ever reads bounds —
|
|
217
|
-
* but `register_skin` reaches `GPUMeshSkinningContext#bind`, which allocates a per-instance vertex
|
|
218
|
-
* clone and refuses a batch of no meshlets. A fixture that stops short of that cannot be handed to
|
|
219
|
-
* the manager at all, and the manager is where half of what this fixture is for gets tested.
|
|
220
|
-
*
|
|
221
|
-
* @returns {MeshletGeometry}
|
|
222
|
-
*/
|
|
223
|
-
function make_geometry() {
|
|
224
|
-
const box = [-1, 0, -1, 1, 2, 1];
|
|
225
|
-
|
|
226
|
-
const geometry = new MeshletGeometry();
|
|
227
|
-
|
|
228
|
-
geometry.name = 'fixture';
|
|
229
|
-
geometry.primitive_count = 1;
|
|
230
|
-
geometry.bounding_box.set(box);
|
|
231
|
-
geometry.bounding_sphere.set([0, 1, 0, 1.8]);
|
|
232
|
-
|
|
233
|
-
const writer = BinaryBuffer.fromEndianness(platform_compute_endianness());
|
|
234
|
-
|
|
235
|
-
writer.setCapacity(MESHLET_METADATA_STRUCT.size);
|
|
236
|
-
|
|
237
|
-
write_wgsl_type_value({
|
|
238
|
-
bounds_box: box,
|
|
239
|
-
address: 0,
|
|
240
|
-
primitive_count: 1,
|
|
241
|
-
vertex_count: 3,
|
|
242
|
-
flags: 0,
|
|
243
|
-
}, writer, MESHLET_METADATA_STRUCT);
|
|
244
|
-
|
|
245
|
-
geometry.meshlets.count = 1;
|
|
246
|
-
geometry.meshlets.data_buffer = new ArrayBuffer(3 * 3 * 4);
|
|
247
|
-
geometry.meshlets.metadata_buffer = writer.data.slice(0, MESHLET_METADATA_STRUCT.size);
|
|
248
|
-
|
|
249
|
-
return geometry;
|
|
250
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A topology of `vertex_count` vertices carrying exactly the channels named.
|
|
3
|
-
*
|
|
4
|
-
* @param {number} vertex_count
|
|
5
|
-
* @param {number[]} carried_attributes indices into {@link VGEO_ATTRIBUTES}
|
|
6
|
-
* @returns {{topology: BinaryTopology, layers: (BinaryDataLayer|null)[]}}
|
|
7
|
-
*
|
|
8
|
-
* @author Alex Goldring
|
|
9
|
-
* @copyright Company Named Limited (c) 2026
|
|
10
|
-
*/
|
|
11
|
-
export function vgeo_test_layers(vertex_count: number, carried_attributes: number[]): {
|
|
12
|
-
topology: BinaryTopology;
|
|
13
|
-
layers: (BinaryDataLayer | null)[];
|
|
14
|
-
};
|
|
15
|
-
import { BinaryTopology } from "../../../../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
16
|
-
//# sourceMappingURL=vgeo_layers_test_fixtures.d.ts.map
|
package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vgeo_layers_test_fixtures.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shade/renderer/geometry/virtual/format/attribute/vgeo_layers_test_fixtures.js"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AACH,+CAPW,MAAM,sBACN,MAAM,EAAE;cACK,cAAc;YAAU,CAAC,kBAAgB,IAAI,CAAC,EAAE;EAiBvE;+BA1B8B,yEAAyE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { BinaryTopology } from "../../../../../../core/geom/3d/topology/struct/binary/BinaryTopology.js";
|
|
2
|
-
import { VGEO_ATTRIBUTES } from "./VGEO_ATTRIBUTES.js";
|
|
3
|
-
import { vgeo_layers_declare } from "./vgeo_layers_declare.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A topology of `vertex_count` vertices carrying exactly the channels named.
|
|
7
|
-
*
|
|
8
|
-
* @param {number} vertex_count
|
|
9
|
-
* @param {number[]} carried_attributes indices into {@link VGEO_ATTRIBUTES}
|
|
10
|
-
* @returns {{topology: BinaryTopology, layers: (BinaryDataLayer|null)[]}}
|
|
11
|
-
*
|
|
12
|
-
* @author Alex Goldring
|
|
13
|
-
* @copyright Company Named Limited (c) 2026
|
|
14
|
-
*/
|
|
15
|
-
export function vgeo_test_layers(vertex_count, carried_attributes) {
|
|
16
|
-
const topology = new BinaryTopology();
|
|
17
|
-
|
|
18
|
-
topology.vertices_create_continuous(vertex_count);
|
|
19
|
-
|
|
20
|
-
const carried = new Array(VGEO_ATTRIBUTES.length).fill(false);
|
|
21
|
-
|
|
22
|
-
for (const attribute of carried_attributes) {
|
|
23
|
-
carried[attribute] = true;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return { topology, layers: vgeo_layers_declare(topology, carried) };
|
|
27
|
-
}
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared scaffolding for the particle specs that run shaders under the WGSL emulator.
|
|
3
|
-
*
|
|
4
|
-
* An emitter is a scene node, so a shader that reads one needs two databases laid out the way the
|
|
5
|
-
* GPU would hold them: the scene's (for the node's world matrix) and the particle system's (for the
|
|
6
|
-
* emitter row). Both are real `GPUDatabase`s on the software device, filled through the real
|
|
7
|
-
* {@link GPUSceneContext} and {@link EmitterRegistry}, and serialised by
|
|
8
|
-
* {@link gpu_database_words} — so a spec exercises the actual writers, and the only thing standing
|
|
9
|
-
* in for the GPU is the upload.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* @typedef {object} ParticleSceneFixture
|
|
13
|
-
* @property {SoftwareGPUDevice} device
|
|
14
|
-
* @property {GraphicsContext} graphics
|
|
15
|
-
* @property {Scene} scene
|
|
16
|
-
* @property {import("../scene/GPUSceneContext.js").GPUSceneContext} scene_context
|
|
17
|
-
* @property {EmitterRegistry} registry
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* A scene with a GPU context and an emitter registry, both on a fresh software device.
|
|
21
|
-
*
|
|
22
|
-
* @returns {ParticleSceneFixture}
|
|
23
|
-
*/
|
|
24
|
-
export function particle_scene_fixture(): ParticleSceneFixture;
|
|
25
|
-
/**
|
|
26
|
-
* Put an emitter in the scene and register it, the way the system does: the node gets its
|
|
27
|
-
* `transforms` row from the scene context's sweep, and the emitter record points at that row.
|
|
28
|
-
*
|
|
29
|
-
* @param {ParticleSceneFixture} fixture
|
|
30
|
-
* @param {ParticleEmitter|object} config a {@link ParticleEmitter}, or what {@link ParticleEmitter.from} accepts
|
|
31
|
-
* @param {import("../scene/Node3D.js").Node3D} [parent] node to hang the emitter under, itself already in the scene
|
|
32
|
-
* @returns {ParticleEmitter}
|
|
33
|
-
*/
|
|
34
|
-
export function place_emitter(fixture: ParticleSceneFixture, config: ParticleEmitter | object, parent?: import("../scene/Node3D.js").Node3D): ParticleEmitter;
|
|
35
|
-
/**
|
|
36
|
-
* What the fixture's registry assigned an emitter: its table row, its generation, the heap
|
|
37
|
-
* placement of its program, the atlas patch. The emitter carries none of it — see
|
|
38
|
-
* {@link ./runtime/GPUParticleEmitterContext.js} — so a spec that wants the row a particle header
|
|
39
|
-
* should carry asks the registry, the way the passes' own callers do.
|
|
40
|
-
*
|
|
41
|
-
* @param {ParticleSceneFixture} fixture
|
|
42
|
-
* @param {ParticleEmitter} emitter
|
|
43
|
-
* @returns {import("./runtime/GPUParticleEmitterContext.js").GPUParticleEmitterContext}
|
|
44
|
-
*/
|
|
45
|
-
export function emitter_context(fixture: ParticleSceneFixture, emitter: ParticleEmitter): import("./runtime/GPUParticleEmitterContext.js").GPUParticleEmitterContext;
|
|
46
|
-
/**
|
|
47
|
-
* The emitter table row an emitter was given — {@link emitter_context}`.row`, which specs index
|
|
48
|
-
* per-emitter buffers with often enough to be worth naming.
|
|
49
|
-
*
|
|
50
|
-
* @param {ParticleSceneFixture} fixture
|
|
51
|
-
* @param {ParticleEmitter} emitter
|
|
52
|
-
* @returns {number}
|
|
53
|
-
*/
|
|
54
|
-
export function emitter_row(fixture: ParticleSceneFixture, emitter: ParticleEmitter): number;
|
|
55
|
-
/**
|
|
56
|
-
* The two databases as the `array<u32>` buffers the particle shaders bind. Call after the last
|
|
57
|
-
* change to either; it flushes both.
|
|
58
|
-
*
|
|
59
|
-
* @param {ParticleSceneFixture} fixture
|
|
60
|
-
* @returns {{scene_database: Uint32Array, emitter_database: Uint32Array}}
|
|
61
|
-
*/
|
|
62
|
-
export function particle_database_words(fixture: ParticleSceneFixture): {
|
|
63
|
-
scene_database: Uint32Array;
|
|
64
|
-
emitter_database: Uint32Array;
|
|
65
|
-
};
|
|
66
|
-
/**
|
|
67
|
-
* An `array<atomic<u32>>` the way the emulator models one: a `{value}` object per word.
|
|
68
|
-
*
|
|
69
|
-
* @param {number} length
|
|
70
|
-
* @param {number} [fill]
|
|
71
|
-
* @returns {{value: number}[]}
|
|
72
|
-
*/
|
|
73
|
-
export function atomic_words(length: number, fill?: number): {
|
|
74
|
-
value: number;
|
|
75
|
-
}[];
|
|
76
|
-
/**
|
|
77
|
-
* A counters buffer, every slot zero.
|
|
78
|
-
*
|
|
79
|
-
* @returns {{value: number}[]}
|
|
80
|
-
*/
|
|
81
|
-
export function particle_counters(): {
|
|
82
|
-
value: number;
|
|
83
|
-
}[];
|
|
84
|
-
/**
|
|
85
|
-
* One emitter's GPU-owned state, read back out of the serialised database.
|
|
86
|
-
*
|
|
87
|
-
* @param {Uint32Array} emitter_database
|
|
88
|
-
* @param {number} row
|
|
89
|
-
* @returns {{generation: number, accumulator: number, age: number, sleep: number, pending: number}}
|
|
90
|
-
*/
|
|
91
|
-
export function emitter_state_read(emitter_database: Uint32Array, row: number): {
|
|
92
|
-
generation: number;
|
|
93
|
-
accumulator: number;
|
|
94
|
-
age: number;
|
|
95
|
-
sleep: number;
|
|
96
|
-
pending: number;
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* Overwrite some of one emitter's state fields in the serialised database — what a previous tick
|
|
100
|
-
* would have left there.
|
|
101
|
-
*
|
|
102
|
-
* @param {Uint32Array} emitter_database
|
|
103
|
-
* @param {number} row
|
|
104
|
-
* @param {{generation?: number, accumulator?: number, age?: number, sleep?: number, pending?: number}} fields
|
|
105
|
-
*/
|
|
106
|
-
export function emitter_state_write(emitter_database: Uint32Array, row: number, fields: {
|
|
107
|
-
generation?: number;
|
|
108
|
-
accumulator?: number;
|
|
109
|
-
age?: number;
|
|
110
|
-
sleep?: number;
|
|
111
|
-
pending?: number;
|
|
112
|
-
}): void;
|
|
113
|
-
/**
|
|
114
|
-
* A `{count, elements}` collection as the emulator binds one — the shape both the emitter tick's
|
|
115
|
-
* output and the emit pass's input take.
|
|
116
|
-
*
|
|
117
|
-
* @param {number} count
|
|
118
|
-
* @param {ArrayLike<number>} [elements] defaults to `count` zeros
|
|
119
|
-
* @returns {{count: number, elements: Uint32Array}}
|
|
120
|
-
*/
|
|
121
|
-
export function u32_collection(count: number, elements?: ArrayLike<number>): {
|
|
122
|
-
count: number;
|
|
123
|
-
elements: Uint32Array;
|
|
124
|
-
};
|
|
125
|
-
/**
|
|
126
|
-
* The CSDLDF scan's stand-in: inclusive prefix sums over a collection's elements, in place, the
|
|
127
|
-
* count left alone.
|
|
128
|
-
*
|
|
129
|
-
* @param {{count: number, elements: Uint32Array}} collection
|
|
130
|
-
* @returns {{count: number, elements: Uint32Array}} the same object
|
|
131
|
-
*/
|
|
132
|
-
export function inclusive_scan(collection: {
|
|
133
|
-
count: number;
|
|
134
|
-
elements: Uint32Array;
|
|
135
|
-
}): {
|
|
136
|
-
count: number;
|
|
137
|
-
elements: Uint32Array;
|
|
138
|
-
};
|
|
139
|
-
export type ParticleSceneFixture = {
|
|
140
|
-
device: SoftwareGPUDevice;
|
|
141
|
-
graphics: GraphicsContext;
|
|
142
|
-
scene: Scene;
|
|
143
|
-
scene_context: import("../scene/GPUSceneContext.js").GPUSceneContext;
|
|
144
|
-
registry: EmitterRegistry;
|
|
145
|
-
};
|
|
146
|
-
import { ParticleEmitter } from "./runtime/ParticleEmitter.js";
|
|
147
|
-
import { SoftwareGPUDevice } from "../../device/mock/SoftwareGPUDevice.js";
|
|
148
|
-
import { GraphicsContext } from "../GraphicsContext.js";
|
|
149
|
-
import { Scene } from "../scene/Scene.js";
|
|
150
|
-
import { EmitterRegistry } from "./runtime/EmitterRegistry.js";
|
|
151
|
-
//# sourceMappingURL=particle_test_fixtures.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"particle_test_fixtures.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/particles/particle_test_fixtures.js"],"names":[],"mappings":"AAWA;;;;;;;;;GASG;AAEH;;;;;;;GAOG;AAEH;;;;GAIG;AACH,0CAFa,oBAAoB,CAUhC;AAED;;;;;;;;GAQG;AACH,uCALW,oBAAoB,UACpB,eAAe,GAAC,MAAM,WACtB,OAAO,oBAAoB,EAAE,MAAM,GACjC,eAAe,CAkB3B;AAED;;;;;;;;;GASG;AACH,yCAJW,oBAAoB,WACpB,eAAe,GACb,OAAO,wCAAwC,EAAE,yBAAyB,CAItF;AAED;;;;;;;GAOG;AACH,qCAJW,oBAAoB,WACpB,eAAe,GACb,MAAM,CAIlB;AAED;;;;;;GAMG;AACH,iDAHW,oBAAoB,GAClB;IAAC,cAAc,EAAE,WAAW,CAAC;IAAC,gBAAgB,EAAE,WAAW,CAAA;CAAC,CAUxE;AAED;;;;;;GAMG;AACH,qCAJW,MAAM,SACN,MAAM,GACJ;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,EAAE,CAI7B;AAED;;;;GAIG;AACH,qCAFa;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,EAAE,CAI7B;AA2BD;;;;;;GAMG;AACH,qDAJW,WAAW,OACX,MAAM,GACJ;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAC,CAalG;AAED;;;;;;;GAOG;AACH,sDAJW,WAAW,OACX,MAAM,UACN;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAC,QAWrG;AAED;;;;;;;GAOG;AACH,sCAJW,MAAM,aACN,UAAU,MAAM,CAAC,GACf;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAA;CAAC,CAIlD;AAED;;;;;;GAMG;AACH,2CAHW;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAA;CAAC,GACpC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAA;CAAC,CAWlD;;YA5Ma,iBAAiB;cACjB,eAAe;WACf,KAAK;mBACL,OAAO,6BAA6B,EAAE,eAAe;cACrD,eAAe;;gCAnBG,8BAA8B;kCAT5B,wCAAwC;gCAC1C,uBAAuB;sBAEjC,mBAAmB;gCAKT,8BAA8B"}
|
|
@@ -1,229 +0,0 @@
|
|
|
1
|
-
import { SoftwareGPUDevice } from "../../device/mock/SoftwareGPUDevice.js";
|
|
2
|
-
import { GraphicsContext } from "../GraphicsContext.js";
|
|
3
|
-
import { gpu_database_words } from "../buffer/table/gpu_database_words.js";
|
|
4
|
-
import { Scene } from "../scene/Scene.js";
|
|
5
|
-
import { SceneManager } from "../scene/SceneManager.js";
|
|
6
|
-
import { PARTICLE_COUNTER_COUNT } from "./data/PARTICLE_COUNTERS.js";
|
|
7
|
-
import { PARTICLE_EMITTER_STATE_DESCRIPTOR } from "./data/PARTICLE_DATABASE_SPEC.js";
|
|
8
|
-
import { PARTICLE_EMITTER_STATE_STRUCT } from "./data/PARTICLE_EMITTER_STATE.js";
|
|
9
|
-
import { EmitterRegistry } from "./runtime/EmitterRegistry.js";
|
|
10
|
-
import { ParticleEmitter } from "./runtime/ParticleEmitter.js";
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Shared scaffolding for the particle specs that run shaders under the WGSL emulator.
|
|
14
|
-
*
|
|
15
|
-
* An emitter is a scene node, so a shader that reads one needs two databases laid out the way the
|
|
16
|
-
* GPU would hold them: the scene's (for the node's world matrix) and the particle system's (for the
|
|
17
|
-
* emitter row). Both are real `GPUDatabase`s on the software device, filled through the real
|
|
18
|
-
* {@link GPUSceneContext} and {@link EmitterRegistry}, and serialised by
|
|
19
|
-
* {@link gpu_database_words} — so a spec exercises the actual writers, and the only thing standing
|
|
20
|
-
* in for the GPU is the upload.
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @typedef {object} ParticleSceneFixture
|
|
25
|
-
* @property {SoftwareGPUDevice} device
|
|
26
|
-
* @property {GraphicsContext} graphics
|
|
27
|
-
* @property {Scene} scene
|
|
28
|
-
* @property {import("../scene/GPUSceneContext.js").GPUSceneContext} scene_context
|
|
29
|
-
* @property {EmitterRegistry} registry
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A scene with a GPU context and an emitter registry, both on a fresh software device.
|
|
34
|
-
*
|
|
35
|
-
* @returns {ParticleSceneFixture}
|
|
36
|
-
*/
|
|
37
|
-
export function particle_scene_fixture() {
|
|
38
|
-
const device = new SoftwareGPUDevice({ requiredFeatures: ["subgroups"] });
|
|
39
|
-
const graphics = new GraphicsContext(device);
|
|
40
|
-
const scene = new Scene();
|
|
41
|
-
const scene_context = new SceneManager(graphics).obtain(scene);
|
|
42
|
-
const registry = new EmitterRegistry(device);
|
|
43
|
-
|
|
44
|
-
return { device, graphics, scene, scene_context, registry };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Put an emitter in the scene and register it, the way the system does: the node gets its
|
|
49
|
-
* `transforms` row from the scene context's sweep, and the emitter record points at that row.
|
|
50
|
-
*
|
|
51
|
-
* @param {ParticleSceneFixture} fixture
|
|
52
|
-
* @param {ParticleEmitter|object} config a {@link ParticleEmitter}, or what {@link ParticleEmitter.from} accepts
|
|
53
|
-
* @param {import("../scene/Node3D.js").Node3D} [parent] node to hang the emitter under, itself already in the scene
|
|
54
|
-
* @returns {ParticleEmitter}
|
|
55
|
-
*/
|
|
56
|
-
export function place_emitter(fixture, config, parent) {
|
|
57
|
-
const emitter = config.isParticleEmitter === true ? config : ParticleEmitter.from(config);
|
|
58
|
-
|
|
59
|
-
if (parent !== undefined) {
|
|
60
|
-
parent.addChild(emitter);
|
|
61
|
-
parent.updateMatrices();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
fixture.scene.add(emitter);
|
|
65
|
-
fixture.scene_context.build();
|
|
66
|
-
|
|
67
|
-
const transform_row = fixture.scene_context.id_mapping.get(emitter.id);
|
|
68
|
-
|
|
69
|
-
fixture.registry.add(emitter, transform_row);
|
|
70
|
-
|
|
71
|
-
return emitter;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* What the fixture's registry assigned an emitter: its table row, its generation, the heap
|
|
76
|
-
* placement of its program, the atlas patch. The emitter carries none of it — see
|
|
77
|
-
* {@link ./runtime/GPUParticleEmitterContext.js} — so a spec that wants the row a particle header
|
|
78
|
-
* should carry asks the registry, the way the passes' own callers do.
|
|
79
|
-
*
|
|
80
|
-
* @param {ParticleSceneFixture} fixture
|
|
81
|
-
* @param {ParticleEmitter} emitter
|
|
82
|
-
* @returns {import("./runtime/GPUParticleEmitterContext.js").GPUParticleEmitterContext}
|
|
83
|
-
*/
|
|
84
|
-
export function emitter_context(fixture, emitter) {
|
|
85
|
-
return fixture.registry.context(emitter);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
/**
|
|
89
|
-
* The emitter table row an emitter was given — {@link emitter_context}`.row`, which specs index
|
|
90
|
-
* per-emitter buffers with often enough to be worth naming.
|
|
91
|
-
*
|
|
92
|
-
* @param {ParticleSceneFixture} fixture
|
|
93
|
-
* @param {ParticleEmitter} emitter
|
|
94
|
-
* @returns {number}
|
|
95
|
-
*/
|
|
96
|
-
export function emitter_row(fixture, emitter) {
|
|
97
|
-
return emitter_context(fixture, emitter).row;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* The two databases as the `array<u32>` buffers the particle shaders bind. Call after the last
|
|
102
|
-
* change to either; it flushes both.
|
|
103
|
-
*
|
|
104
|
-
* @param {ParticleSceneFixture} fixture
|
|
105
|
-
* @returns {{scene_database: Uint32Array, emitter_database: Uint32Array}}
|
|
106
|
-
*/
|
|
107
|
-
export function particle_database_words(fixture) {
|
|
108
|
-
fixture.scene_context.build();
|
|
109
|
-
fixture.registry.flush();
|
|
110
|
-
|
|
111
|
-
return {
|
|
112
|
-
scene_database: gpu_database_words(fixture.scene_context.scene_database, fixture.graphics),
|
|
113
|
-
emitter_database: gpu_database_words(fixture.registry.database, fixture.graphics),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* An `array<atomic<u32>>` the way the emulator models one: a `{value}` object per word.
|
|
119
|
-
*
|
|
120
|
-
* @param {number} length
|
|
121
|
-
* @param {number} [fill]
|
|
122
|
-
* @returns {{value: number}[]}
|
|
123
|
-
*/
|
|
124
|
-
export function atomic_words(length, fill = 0) {
|
|
125
|
-
return Array.from({ length }, () => ({ value: fill }));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* A counters buffer, every slot zero.
|
|
130
|
-
*
|
|
131
|
-
* @returns {{value: number}[]}
|
|
132
|
-
*/
|
|
133
|
-
export function particle_counters() {
|
|
134
|
-
return atomic_words(PARTICLE_COUNTER_COUNT);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Where a row of the `emitter_state` table sits in the serialised database, in words — the same
|
|
139
|
-
* arithmetic the table's generated readers do.
|
|
140
|
-
*
|
|
141
|
-
* @param {Uint32Array} emitter_database the database as {@link particle_database_words} lays it out
|
|
142
|
-
* @param {number} row
|
|
143
|
-
* @returns {number}
|
|
144
|
-
*/
|
|
145
|
-
function emitter_state_base(emitter_database, row) {
|
|
146
|
-
const descriptor = PARTICLE_EMITTER_STATE_DESCRIPTOR;
|
|
147
|
-
const per_page = descriptor.elements_per_page;
|
|
148
|
-
const page_address = emitter_database[descriptor.page_lookup_address + Math.floor(row / per_page)];
|
|
149
|
-
|
|
150
|
-
if (page_address === 0xffffffff) {
|
|
151
|
-
throw new Error(`emitter state row ${row} is on a page the database has not allocated`);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
return page_address + descriptor.page_header_words + (row % per_page) * (descriptor.packed_element_size_bytes / 4);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
/** @type {Object<string, number>} word offset of each state field within its row */
|
|
158
|
-
const STATE_FIELD_WORD = Object.fromEntries(
|
|
159
|
-
PARTICLE_EMITTER_STATE_STRUCT.fields.map((field) => [field.name, field.offset / 4]),
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* One emitter's GPU-owned state, read back out of the serialised database.
|
|
164
|
-
*
|
|
165
|
-
* @param {Uint32Array} emitter_database
|
|
166
|
-
* @param {number} row
|
|
167
|
-
* @returns {{generation: number, accumulator: number, age: number, sleep: number, pending: number}}
|
|
168
|
-
*/
|
|
169
|
-
export function emitter_state_read(emitter_database, row) {
|
|
170
|
-
const base = emitter_state_base(emitter_database, row);
|
|
171
|
-
const floats = new Float32Array(emitter_database.buffer, emitter_database.byteOffset, emitter_database.length);
|
|
172
|
-
|
|
173
|
-
return {
|
|
174
|
-
generation: emitter_database[base + STATE_FIELD_WORD.generation],
|
|
175
|
-
accumulator: floats[base + STATE_FIELD_WORD.accumulator],
|
|
176
|
-
age: floats[base + STATE_FIELD_WORD.age],
|
|
177
|
-
sleep: floats[base + STATE_FIELD_WORD.sleep],
|
|
178
|
-
pending: emitter_database[base + STATE_FIELD_WORD.pending],
|
|
179
|
-
};
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Overwrite some of one emitter's state fields in the serialised database — what a previous tick
|
|
184
|
-
* would have left there.
|
|
185
|
-
*
|
|
186
|
-
* @param {Uint32Array} emitter_database
|
|
187
|
-
* @param {number} row
|
|
188
|
-
* @param {{generation?: number, accumulator?: number, age?: number, sleep?: number, pending?: number}} fields
|
|
189
|
-
*/
|
|
190
|
-
export function emitter_state_write(emitter_database, row, fields) {
|
|
191
|
-
const base = emitter_state_base(emitter_database, row);
|
|
192
|
-
const floats = new Float32Array(emitter_database.buffer, emitter_database.byteOffset, emitter_database.length);
|
|
193
|
-
|
|
194
|
-
if (fields.generation !== undefined) emitter_database[base + STATE_FIELD_WORD.generation] = fields.generation;
|
|
195
|
-
if (fields.accumulator !== undefined) floats[base + STATE_FIELD_WORD.accumulator] = fields.accumulator;
|
|
196
|
-
if (fields.age !== undefined) floats[base + STATE_FIELD_WORD.age] = fields.age;
|
|
197
|
-
if (fields.sleep !== undefined) floats[base + STATE_FIELD_WORD.sleep] = fields.sleep;
|
|
198
|
-
if (fields.pending !== undefined) emitter_database[base + STATE_FIELD_WORD.pending] = fields.pending;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* A `{count, elements}` collection as the emulator binds one — the shape both the emitter tick's
|
|
203
|
-
* output and the emit pass's input take.
|
|
204
|
-
*
|
|
205
|
-
* @param {number} count
|
|
206
|
-
* @param {ArrayLike<number>} [elements] defaults to `count` zeros
|
|
207
|
-
* @returns {{count: number, elements: Uint32Array}}
|
|
208
|
-
*/
|
|
209
|
-
export function u32_collection(count, elements) {
|
|
210
|
-
return { count, elements: elements === undefined ? new Uint32Array(count) : Uint32Array.from(elements) };
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* The CSDLDF scan's stand-in: inclusive prefix sums over a collection's elements, in place, the
|
|
215
|
-
* count left alone.
|
|
216
|
-
*
|
|
217
|
-
* @param {{count: number, elements: Uint32Array}} collection
|
|
218
|
-
* @returns {{count: number, elements: Uint32Array}} the same object
|
|
219
|
-
*/
|
|
220
|
-
export function inclusive_scan(collection) {
|
|
221
|
-
let running = 0;
|
|
222
|
-
|
|
223
|
-
for (let i = 0; i < collection.count; i++) {
|
|
224
|
-
running += collection.elements[i];
|
|
225
|
-
collection.elements[i] = running;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return collection;
|
|
229
|
-
}
|