@woosh/meep-engine 3.32.0 → 3.34.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/editor/Editor.d.ts.map +1 -1
- package/editor/Editor.js +0 -3
- package/editor/ecs/component/prototypeObjectEditor.js +1 -165
- package/editor/ecs/component/registerBasicTypeEditors.d.ts.map +1 -1
- package/editor/ecs/component/registerBasicTypeEditors.js +0 -5
- package/editor/ecs/component/registerEngineComponentEditors.d.ts.map +1 -1
- package/editor/ecs/component/registerEngineComponentEditors.js +0 -20
- package/editor/process/SymbolicDisplayProcess.d.ts.map +1 -1
- package/editor/process/SymbolicDisplayProcess.js +100 -106
- package/editor/prototypeEditorShell.d.ts.map +1 -1
- package/editor/prototypeEditorShell.js +190 -186
- package/editor/templates/entity_templates.d.ts.map +1 -1
- package/editor/templates/entity_templates.js +10 -27
- package/editor/view/makeEntityDecorators.js +2 -2
- package/package.json +1 -1
- package/src/core/collection/table/RowFirstTable.d.ts +8 -0
- package/src/core/collection/table/RowFirstTable.d.ts.map +1 -1
- package/src/core/collection/table/RowFirstTable.js +40 -11
- package/src/{engine/graphics/particles/particular/engine → core/geom/3d/aabb}/MovingBoundingBox.d.ts +3 -3
- package/src/core/geom/3d/aabb/MovingBoundingBox.d.ts.map +1 -0
- package/src/{engine/graphics/particles/particular/engine → core/geom/3d/aabb}/MovingBoundingBox.js +5 -5
- package/src/core/math/lookup/RGBA_LUT_HEATMAP_IR.d.ts +3 -0
- package/src/core/math/lookup/RGBA_LUT_HEATMAP_IR.d.ts.map +1 -0
- package/src/{engine/graphics/particles/particular/engine/parameter/sample → core/math/lookup}/RGBA_LUT_HEATMAP_IR.js +1 -1
- package/src/core/math/lookup/RGB_LUT_INFERNO.d.ts +6 -0
- package/src/core/math/lookup/RGB_LUT_INFERNO.d.ts.map +1 -0
- package/src/{engine/graphics/particles/particular/engine/parameter/sample → core/math/lookup}/RGB_LUT_INFERNO.js +1 -1
- package/src/{engine/graphics/particles/particular/engine/parameter/sample → core/math/lookup}/RGB_LUT_TURBO.d.ts +1 -1
- package/src/core/math/lookup/RGB_LUT_TURBO.d.ts.map +1 -0
- package/src/{engine/graphics/particles/particular/engine/parameter/sample → core/math/lookup}/RGB_LUT_TURBO.js +1 -1
- package/src/{engine/graphics/particles/particular/engine/parameter/sample → core/math/lookup}/RGB_LUT_VIRIDIS.d.ts +1 -1
- package/src/core/math/lookup/RGB_LUT_VIRIDIS.d.ts.map +1 -0
- package/src/{engine/graphics/particles/particular/engine/parameter/sample → core/math/lookup}/RGB_LUT_VIRIDIS.js +1 -1
- package/src/engine/animation/AnimatedActions.d.ts.map +1 -1
- package/src/engine/animation/AnimatedActions.js +2 -4
- package/src/engine/animation/AnimationUtils.d.ts +1 -17
- package/src/engine/animation/AnimationUtils.d.ts.map +1 -1
- package/src/engine/animation/AnimationUtils.js +138 -246
- package/src/engine/ecs/EntityManager.d.ts +1 -1
- package/src/engine/ecs/EntityManager.d.ts.map +1 -1
- package/src/engine/ecs/EntityManager.js +2 -2
- package/src/engine/ecs/storage/binary/SERIALIZATION_COVERAGE.md +268 -275
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +0 -10
- package/src/engine/graphics/geometry/distribute_points_on_indexed_triangles.d.ts.map +1 -0
- package/src/engine/graphics/{particles/particular/engine/utils → geometry}/distribute_points_on_indexed_triangles.js +3 -3
- package/src/engine/graphics/{particles/particular/engine/utils/volume → texture/sampler}/lut_to_sampler.d.ts +1 -1
- package/src/engine/graphics/texture/sampler/lut_to_sampler.d.ts.map +1 -0
- package/src/engine/graphics/{particles/particular/engine/utils/volume → texture/sampler}/lut_to_sampler.js +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +0 -3
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +0 -3
- package/src/engine/network/NetworkSession.d.ts +1 -1
- package/src/engine/network/NetworkSession.js +1 -1
- package/src/engine/physics/cloth/MEASUREMENTS.md +115 -0
- package/src/engine/physics/cloth/solver/cloth_contact_find.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/cloth_contact_find.js +2 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts +9 -0
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.d.ts.map +1 -1
- package/src/engine/physics/cloth/solver/constraint/cloth_contact_row.js +30 -7
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +12 -2
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +11 -2
- package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/LiveEmitterSet.js +14 -7
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts +6 -15
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/SpatialAudioIndex.js +161 -174
- package/src/shade/device/mock/SoftwareGPUBuffer.d.ts +5 -3
- package/src/shade/device/mock/SoftwareGPUBuffer.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUBuffer.js +32 -3
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.d.ts +20 -3
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPURenderPassEncoder.js +21 -3
- package/src/shade/playground/caldera/main.js +73 -60
- package/src/shade/playground/vgeo_runtime/main.js +25 -77
- package/src/shade/playground/vgeo_scene/main.js +2231 -2217
- package/src/shade/renderer/GraphicsContext.d.ts +18 -0
- package/src/shade/renderer/GraphicsContext.d.ts.map +1 -1
- package/src/shade/renderer/GraphicsContext.js +63 -40
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +38 -0
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts +8 -0
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.d.ts.map +1 -1
- package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +21 -0
- package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts +6 -5
- package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.d.ts.map +1 -1
- package/src/shade/renderer/buffer/GPUBufferReadbackAllocator.js +241 -240
- package/src/shade/renderer/buffer/GPUBufferStagingAllocator.d.ts +51 -0
- package/src/shade/renderer/buffer/GPUBufferStagingAllocator.d.ts.map +1 -1
- package/src/shade/renderer/buffer/GPUBufferStagingAllocator.js +214 -28
- package/src/shade/renderer/dynamic/DynamicMeshAVBOITChannel.d.ts +2 -1
- package/src/shade/renderer/dynamic/DynamicMeshAVBOITChannel.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/DynamicMeshAVBOITChannel.js +19 -17
- package/src/shade/renderer/dynamic/GPUDynamicMeshDrawList.d.ts +70 -0
- package/src/shade/renderer/dynamic/GPUDynamicMeshDrawList.d.ts.map +1 -0
- package/src/shade/renderer/dynamic/GPUDynamicMeshDrawList.js +257 -0
- package/src/shade/renderer/dynamic/GPUDynamicMeshRenderer.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/GPUDynamicMeshRenderer.js +19 -34
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.d.ts +6 -20
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/GPUDynamicMeshResidency.js +42 -36
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts +2 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.js +4 -3
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.d.ts +4 -3
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.js +7 -4
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts +14 -15
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/graph_dynamic_mesh_avboit.js +49 -83
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.d.ts +19 -3
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh.js +26 -6
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts +2 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_draw.js +12 -6
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts +3 -2
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.d.ts.map +1 -1
- package/src/shade/renderer/dynamic/shader_dynamic_mesh_avboit_splat.js +21 -13
- package/src/shade/renderer/extension/RENDER_EXTENSION_DESIGN.md +1 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/GPUGeometryManager.js +9 -10
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +5 -0
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +11 -0
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.d.ts +12 -0
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.js +25 -0
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +115 -101
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +282 -140
- package/src/shade/renderer/geometry/virtual/runtime/REVIEW_LEDGER.md +30 -0
- package/src/shade/renderer/geometry/virtual/runtime/RUNTIME_PLAN_2026_09_14.md +4 -1
- package/src/shade/renderer/geometry/virtual/runtime/SHADOW_PLAN_2026_09_28.md +536 -0
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts +6 -2
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +68 -19
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts +2 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +17 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts +4 -0
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +42 -12
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts +93 -12
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.js +166 -20
- package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.js +30 -7
- package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.js +12 -5
- package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_claim.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_claim.js +2 -2
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +23 -13
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_queue_remainder.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_queue_remainder.js +1 -2
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.js +1 -2
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.js +10 -6
- package/src/shade/renderer/geometry/virtual/runtime/cut/vgeo_cut_feedback_layout.d.ts +45 -17
- package/src/shade/renderer/geometry/virtual/runtime/cut/vgeo_cut_feedback_layout.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/cut/vgeo_cut_feedback_layout.js +61 -19
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.d.ts +8 -11
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.js +9 -16
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +25 -10
- package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_FEEDBACK_OFFSET.js +10 -8
- package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts +1 -0
- package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.js +19 -7
- package/src/shade/renderer/geometry/virtual/runtime/make_vgeo_page_worker.d.ts +4 -2
- package/src/shade/renderer/geometry/virtual/runtime/make_vgeo_page_worker.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/make_vgeo_page_worker.js +4 -2
- package/src/shade/renderer/global_illumination/brick4/Brick4LightMap.d.ts +4 -0
- package/src/shade/renderer/global_illumination/brick4/Brick4LightMap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/Brick4LightMap.js +7 -0
- package/src/shade/renderer/global_illumination/lpv/GPULightProbeVolume.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/lpv/GPULightProbeVolume.js +1 -0
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.js +2 -0
- package/src/shade/renderer/particles/DESIGN.md +4 -10
- package/src/shade/renderer/particles/ParticleConstants.d.ts +1 -3
- package/src/shade/renderer/particles/ParticleConstants.d.ts.map +1 -1
- package/src/shade/renderer/particles/ParticleConstants.js +1 -3
- package/src/shade/renderer/particles/shaders/chunk_particle_billboard_vertex.d.ts +3 -4
- package/src/shade/renderer/particles/shaders/chunk_particle_billboard_vertex.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_billboard_vertex.js +3 -4
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.d.ts +45 -0
- package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.js +99 -0
- package/src/shade/renderer/rasterize/bucket/rasterization_opaque_buckets.d.ts +4 -4
- package/src/shade/renderer/rasterize/bucket/rasterization_opaque_buckets.js +36 -36
- package/src/shade/renderer/rasterize/bucket/shader_gather_bucket.d.ts +15 -0
- package/src/shade/renderer/rasterize/bucket/shader_gather_bucket.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/bucket/shader_gather_bucket.js +103 -0
- package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.d.ts +3 -0
- package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.js +6 -1
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/graph_extract_meshlets_from_bucket.d.ts +26 -0
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/graph_extract_meshlets_from_bucket.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/expand/bucket/meshlet/graph_extract_meshlets_from_bucket.js +91 -0
- package/src/shade/renderer/rasterize/fast/graph_gather_meshes_from_buckets.d.ts +22 -0
- package/src/shade/renderer/rasterize/fast/graph_gather_meshes_from_buckets.d.ts.map +1 -0
- package/src/shade/renderer/rasterize/fast/graph_gather_meshes_from_buckets.js +102 -0
- package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.d.ts +2 -1
- package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +28 -24
- package/src/shade/renderer/rasterize/native/avboit/AVBOIT_LEDGER.md +20 -0
- package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.js +32 -28
- package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.js +9 -105
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts +5 -0
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUInstancesAccelerationStructure.js +11 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +11 -3
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +93 -21
- package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts +4 -1
- package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -1
- package/src/shade/renderer/scene/rows/GPUSceneRows.js +5 -23
- package/src/shade/renderer/shader/type/serde/write_gpu_typed_buffer.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/serde/write_gpu_typed_buffer.js +8 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +63 -0
- package/src/shade/renderer/shadow/map/SHADOWMAP_VGEO_TAU_SCALE.d.ts +12 -0
- package/src/shade/renderer/shadow/map/SHADOWMAP_VGEO_TAU_SCALE.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/SHADOWMAP_VGEO_TAU_SCALE.js +11 -0
- package/src/shade/renderer/shadow/map/Shadowmap.d.ts +15 -0
- package/src/shade/renderer/shadow/map/Shadowmap.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/Shadowmap.js +17 -0
- package/src/shade/renderer/shadow/map/shadowmap_caster_detail_pending.d.ts +25 -0
- package/src/shade/renderer/shadow/map/shadowmap_caster_detail_pending.d.ts.map +1 -0
- package/src/shade/renderer/shadow/map/shadowmap_caster_detail_pending.js +22 -0
- package/src/shade/renderer/shadow/map/shadowmap_update_score.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/shadowmap_update_score.js +5 -2
- package/src/shade/renderer/texture/TextureManager.d.ts +2 -1
- package/src/shade/renderer/texture/TextureManager.d.ts.map +1 -1
- package/src/shade/renderer/texture/TextureManager.js +4 -1
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +1 -1
- package/src/shade/renderer/util/Uint32BufferSamplingStats.d.ts +9 -1
- package/src/shade/renderer/util/Uint32BufferSamplingStats.d.ts.map +1 -1
- package/src/shade/renderer/util/Uint32BufferSamplingStats.js +55 -5
- package/src/shade/renderer/view/ViewManager.d.ts +7 -1
- package/src/shade/renderer/view/ViewManager.d.ts.map +1 -1
- package/src/shade/renderer/view/ViewManager.js +17 -1
- package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/GPUSceneVolumetrics.js +1 -0
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.d.ts +0 -20
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.d.ts.map +0 -1
- package/editor/ecs/component/editors/ecs/ParameterLookupTableEditor.js +0 -35
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.d.ts +0 -12
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.d.ts.map +0 -1
- package/editor/ecs/component/editors/ecs/ParameterTrackEditor.js +0 -17
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.d.ts +0 -14
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.d.ts.map +0 -1
- package/editor/ecs/component/editors/ecs/ParameterTrackSetEditor.js +0 -18
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.d.ts +0 -52
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.d.ts.map +0 -1
- package/editor/ecs/component/editors/ecs/ParticleEmitterEditor.js +0 -58
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.d.ts +0 -47
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.d.ts.map +0 -1
- package/editor/ecs/component/editors/ecs/ParticleEmitterLayerEditor.js +0 -58
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.d.ts +0 -16
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.d.ts.map +0 -1
- package/editor/ecs/component/editors/ecs/SimulationStepDefinitionEditor.js +0 -21
- package/editor/particles/rebuildParticleEmitter.d.ts +0 -11
- package/editor/particles/rebuildParticleEmitter.d.ts.map +0 -1
- package/editor/particles/rebuildParticleEmitter.js +0 -31
- package/editor/process/ParticleEmitterRebuildProcess.d.ts +0 -66
- package/editor/process/ParticleEmitterRebuildProcess.d.ts.map +0 -1
- package/editor/process/ParticleEmitterRebuildProcess.js +0 -217
- package/editor/process/symbolic/ParticleEmitterSymbolicDisplay.d.ts +0 -18
- package/editor/process/symbolic/ParticleEmitterSymbolicDisplay.d.ts.map +0 -1
- package/editor/process/symbolic/ParticleEmitterSymbolicDisplay.js +0 -140
- package/src/engine/animation/removeEntityGenericEffect.d.ts +0 -18
- package/src/engine/animation/removeEntityGenericEffect.d.ts.map +0 -1
- package/src/engine/animation/removeEntityGenericEffect.js +0 -160
- package/src/engine/animation/removeEntityWithMeshParticlesEffect.d.ts +0 -16
- package/src/engine/animation/removeEntityWithMeshParticlesEffect.d.ts.map +0 -1
- package/src/engine/animation/removeEntityWithMeshParticlesEffect.js +0 -194
- package/src/engine/graphics/ecs/sprite/Sprite.d.ts +0 -12
- package/src/engine/graphics/ecs/sprite/Sprite.d.ts.map +0 -1
- package/src/engine/graphics/ecs/sprite/Sprite.js +0 -11
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts +0 -8
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.d.ts.map +0 -1
- package/src/engine/graphics/ecs/sprite/SpriteSystemPE.js +0 -141
- package/src/engine/graphics/particles/particular/engine/MovingBoundingBox.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.d.ts +0 -61
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/ParticularEngine.js +0 -229
- package/src/engine/graphics/particles/particular/engine/emitter/EmissionFromType.d.ts +0 -6
- package/src/engine/graphics/particles/particular/engine/emitter/EmissionFromType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/EmissionFromType.js +0 -8
- package/src/engine/graphics/particles/particular/engine/emitter/EmissionShapeType.d.ts +0 -7
- package/src/engine/graphics/particles/particular/engine/emitter/EmissionShapeType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/EmissionShapeType.js +0 -9
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICLE_ATTRIBUTES.d.ts +0 -13
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICLE_ATTRIBUTES.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICLE_ATTRIBUTES.js +0 -12
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.d.ts +0 -3
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +0 -84
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts +0 -285
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +0 -1201
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.d.ts +0 -19
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +0 -67
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.d.ts +0 -197
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +0 -398
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleParameters.d.ts +0 -5
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleParameters.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticleParameters.js +0 -4
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.d.ts +0 -162
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +0 -472
- package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.d.ts +0 -10
- package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +0 -37
- package/src/engine/graphics/particles/particular/engine/emitter/distance_to_camera.d.ts +0 -9
- package/src/engine/graphics/particles/particular/engine/emitter/distance_to_camera.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +0 -25
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.d.ts +0 -19
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +0 -28
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.d.ts +0 -19
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationAdapter.js +0 -162
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationUpgrader_0_1.d.ts +0 -5
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationUpgrader_0_1.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/serde/ParticleEmitterSerializationUpgrader_0_1.js +0 -103
- package/src/engine/graphics/particles/particular/engine/emitter/write_particle_patch_uv.d.ts +0 -8
- package/src/engine/graphics/particles/particular/engine/emitter/write_particle_patch_uv.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/emitter/write_particle_patch_uv.js +0 -28
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.d.ts +0 -2
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +0 -2
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.d.ts +0 -2
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterLookupTableFlags.js +0 -2
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterSet.d.ts +0 -60
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterSet.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterSet.js +0 -128
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.d.ts +0 -47
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +0 -77
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrackSet.d.ts +0 -45
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrackSet.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParameterTrackSet.js +0 -93
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.d.ts +0 -95
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +0 -239
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGBA_LUT_HEATMAP_IR.d.ts +0 -3
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGBA_LUT_HEATMAP_IR.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts +0 -6
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_INFERNO.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_TURBO.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/parameter/sample/RGB_LUT_VIRIDIS.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/renderers/ParticleRenderer.d.ts +0 -13
- package/src/engine/graphics/particles/particular/engine/renderers/ParticleRenderer.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/renderers/ParticleRenderer.js +0 -28
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.d.ts +0 -9
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +0 -24
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticlePool.d.ts +0 -13
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticlePool.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticlePool.js +0 -27
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticleRenderer.d.ts +0 -33
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticleRenderer.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/renderers/billboard/SoftBillboardParticleRenderer.js +0 -80
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.d.ts +0 -49
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/shader/ShaderManager.js +0 -135
- package/src/engine/graphics/particles/particular/engine/shader/debugAtlas.d.ts +0 -7
- package/src/engine/graphics/particles/particular/engine/shader/debugAtlas.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/shader/debugAtlas.js +0 -14
- package/src/engine/graphics/particles/particular/engine/simulator/AbstractSimulationStep.d.ts +0 -41
- package/src/engine/graphics/particles/particular/engine/simulator/AbstractSimulationStep.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/AbstractSimulationStep.js +0 -59
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.d.ts +0 -4
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +0 -56
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.d.ts +0 -4
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +0 -84
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.d.ts +0 -4
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +0 -80
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepDefinition.d.ts +0 -29
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepDefinition.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepDefinition.js +0 -43
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.d.ts +0 -5
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +0 -104
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepType.d.ts +0 -9
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/SimulationStepType.js +0 -11
- package/src/engine/graphics/particles/particular/engine/simulator/update_parameters.d.ts +0 -9
- package/src/engine/graphics/particles/particular/engine/simulator/update_parameters.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/simulator/update_parameters.js +0 -64
- package/src/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.d.ts +0 -9
- package/src/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +0 -172
- package/src/engine/graphics/particles/particular/engine/utils/distribute_points_on_indexed_triangles.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.d.ts +0 -20
- package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +0 -84
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.d.ts +0 -81
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +0 -200
- package/src/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.d.ts +0 -6
- package/src/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/engine/utils/volume/SamplingFunctionKind.js +0 -8
- package/src/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/Operation.d.ts +0 -20
- package/src/engine/graphics/particles/particular/group/Operation.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/Operation.js +0 -20
- package/src/engine/graphics/particles/particular/group/OperationType.d.ts +0 -7
- package/src/engine/graphics/particles/particular/group/OperationType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/OperationType.js +0 -9
- package/src/engine/graphics/particles/particular/group/ParticleAttribute.d.ts +0 -27
- package/src/engine/graphics/particles/particular/group/ParticleAttribute.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/ParticleAttribute.js +0 -27
- package/src/engine/graphics/particles/particular/group/ParticleAttributeType.d.ts +0 -8
- package/src/engine/graphics/particles/particular/group/ParticleAttributeType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/ParticleAttributeType.js +0 -11
- package/src/engine/graphics/particles/particular/group/ParticleDataType.d.ts +0 -7
- package/src/engine/graphics/particles/particular/group/ParticleDataType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/ParticleDataType.js +0 -10
- package/src/engine/graphics/particles/particular/group/ParticleSpecification.d.ts +0 -24
- package/src/engine/graphics/particles/particular/group/ParticleSpecification.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/ParticleSpecification.js +0 -48
- package/src/engine/graphics/particles/particular/group/itemSizeFromAttributeType.d.ts +0 -7
- package/src/engine/graphics/particles/particular/group/itemSizeFromAttributeType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +0 -20
- package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.d.ts +0 -6
- package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/optimizeCommandQueue.js +0 -162
- package/src/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.d.ts +0 -8
- package/src/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.d.ts.map +0 -1
- package/src/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +0 -19
- package/src/engine/graphics3/ParticleEmitterSystem.d.ts +0 -77
- package/src/engine/graphics3/ParticleEmitterSystem.d.ts.map +0 -1
- package/src/engine/graphics3/ParticleEmitterSystem.js +0 -307
- package/src/engine/graphics3/ParticleEmitterSystem3.d.ts +0 -10
- package/src/engine/graphics3/ParticleEmitterSystem3.d.ts.map +0 -1
- package/src/engine/graphics3/ParticleEmitterSystem3.js +0 -10
- package/src/engine/graphics3/particles/GPUParticularRenderer.d.ts +0 -61
- package/src/engine/graphics3/particles/GPUParticularRenderer.d.ts.map +0 -1
- package/src/engine/graphics3/particles/GPUParticularRenderer.js +0 -627
- package/src/engine/graphics3/particles/particle_gpu_records.d.ts +0 -85
- package/src/engine/graphics3/particles/particle_gpu_records.d.ts.map +0 -1
- package/src/engine/graphics3/particles/particle_gpu_records.js +0 -227
- package/src/shade/renderer/particles/shaders/shader_particle_render.d.ts +0 -35
- package/src/shade/renderer/particles/shaders/shader_particle_render.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/shader_particle_render.js +0 -135
- /package/src/engine/graphics/{particles/particular/engine/utils → geometry}/distribute_points_on_indexed_triangles.d.ts +0 -0
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
import { assert } from "../../../core/assert.js";
|
|
2
|
+
import { ceilPowerOfTwo } from "../../../core/binary/operations/ceilPowerOfTwo.js";
|
|
3
|
+
import { round_up } from "../../../core/math/round_up.js";
|
|
4
|
+
import {
|
|
5
|
+
DYNAMIC_MESH_BIND_GROUP_DRAWS,
|
|
6
|
+
DYNAMIC_MESH_DRAW_STRUCT,
|
|
7
|
+
DYNAMIC_MESH_RESOURCES
|
|
8
|
+
} from "./shader_dynamic_mesh.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The most draws one chunk of a frame's constants holds — and so the most draws one bind of the
|
|
12
|
+
* constants' group serves.
|
|
13
|
+
*
|
|
14
|
+
* Bounded rather than one table for every mesh the renderer draws: a chunk is one transient buffer
|
|
15
|
+
* and one write of at most 80 KiB of constants, whatever the frame's mesh count, so the write never
|
|
16
|
+
* grows with the scene and a chunk's buffer is the pool's ordinary business.
|
|
17
|
+
*
|
|
18
|
+
* @type {number}
|
|
19
|
+
*/
|
|
20
|
+
export const DYNAMIC_MESH_DRAWS_PER_CHUNK = 1024;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* The fewest draws a chunk is sized for. See {@link chunk_capacity}.
|
|
24
|
+
*
|
|
25
|
+
* @type {number}
|
|
26
|
+
*/
|
|
27
|
+
const DRAWS_PER_CHUNK_MIN = 64;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Bytes from one draw's constants to the next: the array stride of {@link DYNAMIC_MESH_DRAW_STRUCT}.
|
|
31
|
+
*
|
|
32
|
+
* @type {number}
|
|
33
|
+
*/
|
|
34
|
+
const DRAW_STRIDE = round_up(DYNAMIC_MESH_DRAW_STRUCT.size, DYNAMIC_MESH_DRAW_STRUCT.align);
|
|
35
|
+
|
|
36
|
+
const DRAW_STRIDE_FLOATS = DRAW_STRIDE / 4;
|
|
37
|
+
const MODEL_OFFSET_FLOATS = DYNAMIC_MESH_DRAW_STRUCT.get("model").offset / 4;
|
|
38
|
+
const COLOR_OFFSET_FLOATS = DYNAMIC_MESH_DRAW_STRUCT.get("color").offset / 4;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Where a frame's constants are laid out on the CPU before they are sent. Only ever used for the
|
|
42
|
+
* length of one {@link GPUDynamicMeshDrawList#write} — the write copies them out before it returns —
|
|
43
|
+
* so one serves every list.
|
|
44
|
+
*
|
|
45
|
+
* @type {Float32Array}
|
|
46
|
+
*/
|
|
47
|
+
let scratch = new Float32Array(DRAW_STRIDE_FLOATS * DRAWS_PER_CHUNK_MIN);
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The scratch is given back once it holds more than four times what a write needs and more than this
|
|
51
|
+
* many bytes: a burst of meshes should not pin its constants' worth of memory for the rest of the
|
|
52
|
+
* process, and a count that swings within an ordinary range should not reallocate every frame.
|
|
53
|
+
*
|
|
54
|
+
* @type {number}
|
|
55
|
+
*/
|
|
56
|
+
const SCRATCH_RETAINED_BYTES = 1024 * 1024;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* How many draws' worth of buffer a chunk of `count` draws takes, and writes: the next power of two,
|
|
60
|
+
* between {@link DRAWS_PER_CHUNK_MIN} and {@link DYNAMIC_MESH_DRAWS_PER_CHUNK}.
|
|
61
|
+
*
|
|
62
|
+
* Sized by class rather than to the count because the count is the part of a frame most certain to
|
|
63
|
+
* change. Buffers of the exact size are a new size whenever one effect appears, and the transient
|
|
64
|
+
* pool hands out a buffer only for a request close enough to its size — so a count climbing by a
|
|
65
|
+
* mesh a frame made a new transient buffer every frame. Five sizes cover every chunk; the
|
|
66
|
+
* price is writing up to twice the bytes of the draws, rows past the last draw holding whatever the
|
|
67
|
+
* scratch held, which no draw reads.
|
|
68
|
+
*
|
|
69
|
+
* @param {number} count draws in the chunk, 1 to {@link DYNAMIC_MESH_DRAWS_PER_CHUNK}
|
|
70
|
+
* @returns {number}
|
|
71
|
+
*/
|
|
72
|
+
function chunk_capacity(count) {
|
|
73
|
+
return Math.min(DYNAMIC_MESH_DRAWS_PER_CHUNK, Math.max(DRAWS_PER_CHUNK_MIN, ceilPowerOfTwo(count)));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Rows of scratch that a write of up to `mesh_count` draws can send, padding included.
|
|
78
|
+
*
|
|
79
|
+
* @param {number} mesh_count
|
|
80
|
+
* @returns {number}
|
|
81
|
+
*/
|
|
82
|
+
function scratch_rows(mesh_count) {
|
|
83
|
+
if (mesh_count <= DYNAMIC_MESH_DRAWS_PER_CHUNK) {
|
|
84
|
+
return chunk_capacity(mesh_count);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return round_up(mesh_count, DYNAMIC_MESH_DRAWS_PER_CHUNK);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* One frame's draws of a set of {@link DynamicMesh}es: which geometry each draws, and its per-draw
|
|
92
|
+
* constants ({@link DYNAMIC_MESH_DRAW_STRUCT}), written in chunks of up to
|
|
93
|
+
* {@link DYNAMIC_MESH_DRAWS_PER_CHUNK}.
|
|
94
|
+
*
|
|
95
|
+
* **The constants are all written anew every frame**, into transient buffers of the frame's own: a
|
|
96
|
+
* dynamic mesh's transform and colour are as free to change as its vertices, so nothing is kept for
|
|
97
|
+
* a mesh from one frame to the next. What the table buys is that the frame pays per *chunk* for the
|
|
98
|
+
* buffer, the copy and the bind group, where it used to pay per mesh for each. Per draw, what is
|
|
99
|
+
* left is the geometry's bind group — the same one every frame, while its buffers keep their size —
|
|
100
|
+
* and the draw, which names its row of the chunk through its `first_instance`.
|
|
101
|
+
*
|
|
102
|
+
* Draws keep the order of the meshes they came from, across chunks: the pass over the scene blends,
|
|
103
|
+
* and composites in that order.
|
|
104
|
+
*
|
|
105
|
+
* {@link write} before a render pass is opened on the encoder — the constants go up through copies,
|
|
106
|
+
* which a command encoder refuses while a pass is open on it — and then {@link draw} into as many
|
|
107
|
+
* passes of the frame as draw these meshes. The AVBOIT splat and draw read one write.
|
|
108
|
+
*/
|
|
109
|
+
export class GPUDynamicMeshDrawList {
|
|
110
|
+
/**
|
|
111
|
+
* What each draw draws, in draw order.
|
|
112
|
+
*
|
|
113
|
+
* @type {GPUDynamicMeshResidency[]}
|
|
114
|
+
*/
|
|
115
|
+
#residencies = [];
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* One transient storage buffer per chunk, {@link DYNAMIC_MESH_DRAWS_PER_CHUNK} draws apiece and
|
|
119
|
+
* the rest in the last, each sized by {@link chunk_capacity}.
|
|
120
|
+
*
|
|
121
|
+
* @type {GPUBuffer[]}
|
|
122
|
+
*/
|
|
123
|
+
#chunks = [];
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* How many draws the last {@link write} laid out.
|
|
127
|
+
*
|
|
128
|
+
* @returns {number}
|
|
129
|
+
*/
|
|
130
|
+
get count() {
|
|
131
|
+
return this.#residencies.length;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Lay out a draw for every visible mesh of `meshes` with triangles resident in `residency`, and
|
|
136
|
+
* send their constants — as they are now — in one write per chunk. Replaces whatever the list
|
|
137
|
+
* held.
|
|
138
|
+
*
|
|
139
|
+
* The buffers are the encoder's transients, so the list is good for as long as that encoder is
|
|
140
|
+
* recording and no longer.
|
|
141
|
+
*
|
|
142
|
+
* @param {ShadeGPUCommandContext} encoder
|
|
143
|
+
* @param {GPUDynamicMeshResidencyTable} residency brought up to date for `meshes` this frame
|
|
144
|
+
* @param {DynamicMesh[]} meshes
|
|
145
|
+
*/
|
|
146
|
+
write(encoder, residency, meshes) {
|
|
147
|
+
assert.defined(encoder, 'encoder');
|
|
148
|
+
assert.defined(residency, 'residency');
|
|
149
|
+
assert.isArray(meshes, 'meshes');
|
|
150
|
+
|
|
151
|
+
const residencies = this.#residencies;
|
|
152
|
+
const chunks = this.#chunks;
|
|
153
|
+
|
|
154
|
+
residencies.length = 0;
|
|
155
|
+
chunks.length = 0;
|
|
156
|
+
|
|
157
|
+
const mesh_count = meshes.length;
|
|
158
|
+
const needed = scratch_rows(mesh_count) * DRAW_STRIDE_FLOATS;
|
|
159
|
+
|
|
160
|
+
if (scratch.length < needed || (scratch.length > needed * 4 && scratch.byteLength > SCRATCH_RETAINED_BYTES)) {
|
|
161
|
+
scratch = new Float32Array(needed);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const constants = scratch;
|
|
165
|
+
|
|
166
|
+
for (let i = 0; i < mesh_count; i++) {
|
|
167
|
+
const mesh = meshes[i];
|
|
168
|
+
|
|
169
|
+
if (!mesh.visible) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
const resident = residency.get(mesh.geometry);
|
|
174
|
+
|
|
175
|
+
if (resident === undefined || resident.index_count === 0) {
|
|
176
|
+
// never uploaded, or nothing to draw
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const row = residencies.length * DRAW_STRIDE_FLOATS;
|
|
181
|
+
|
|
182
|
+
// the transform is its own matrix from element 0; `matrix` would hand out a fresh view
|
|
183
|
+
const transform = mesh.transform;
|
|
184
|
+
const model = row + MODEL_OFFSET_FLOATS;
|
|
185
|
+
|
|
186
|
+
for (let k = 0; k < 16; k++) {
|
|
187
|
+
constants[model + k] = transform[k];
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const color = mesh.color;
|
|
191
|
+
const tint = row + COLOR_OFFSET_FLOATS;
|
|
192
|
+
|
|
193
|
+
constants[tint] = color[0];
|
|
194
|
+
constants[tint + 1] = color[1];
|
|
195
|
+
constants[tint + 2] = color[2];
|
|
196
|
+
constants[tint + 3] = color[3];
|
|
197
|
+
|
|
198
|
+
residencies.push(resident);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const draw_count = residencies.length;
|
|
202
|
+
|
|
203
|
+
for (let first = 0; first < draw_count; first += DYNAMIC_MESH_DRAWS_PER_CHUNK) {
|
|
204
|
+
const bytes = chunk_capacity(Math.min(DYNAMIC_MESH_DRAWS_PER_CHUNK, draw_count - first)) * DRAW_STRIDE;
|
|
205
|
+
|
|
206
|
+
const chunk = encoder.allocateTransientBuffer(GPUBufferUsage.STORAGE, bytes);
|
|
207
|
+
|
|
208
|
+
encoder.writeBuffer(chunk, 0, constants.buffer, constants.byteOffset + first * DRAW_STRIDE, bytes);
|
|
209
|
+
|
|
210
|
+
chunks.push(chunk);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Let go of the frame: the geometries it drew and the transient buffers it wrote, which the
|
|
216
|
+
* encoder hands back when it finishes. For a list that outlives its frame, once its last pass is
|
|
217
|
+
* recorded.
|
|
218
|
+
*/
|
|
219
|
+
clear() {
|
|
220
|
+
this.#residencies.length = 0;
|
|
221
|
+
this.#chunks.length = 0;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Record every draw into `render_pass`: the constants' group once per chunk, then per draw the
|
|
226
|
+
* geometry's group and the draw at its row. The pass's other groups are the caller's to set.
|
|
227
|
+
*
|
|
228
|
+
* @param {ShadeGPURenderPassEncoder} render_pass running `pipeline`
|
|
229
|
+
* @param {GraphicsContext} graphics
|
|
230
|
+
* @param {RenderPipelineDescriptor} pipeline one of the dynamic-mesh pipelines, whose layout opens
|
|
231
|
+
* with `DYNAMIC_MESH_RESOURCES`' groups
|
|
232
|
+
* @param {GPUBuffer} camera
|
|
233
|
+
*/
|
|
234
|
+
draw(render_pass, graphics, pipeline, camera) {
|
|
235
|
+
const residencies = this.#residencies;
|
|
236
|
+
const chunks = this.#chunks;
|
|
237
|
+
|
|
238
|
+
const draw_count = residencies.length;
|
|
239
|
+
const group = DYNAMIC_MESH_RESOURCES.groups[DYNAMIC_MESH_BIND_GROUP_DRAWS];
|
|
240
|
+
|
|
241
|
+
for (let c = 0; c < chunks.length; c++) {
|
|
242
|
+
graphics.setPipelineBindGroup(
|
|
243
|
+
render_pass,
|
|
244
|
+
pipeline,
|
|
245
|
+
DYNAMIC_MESH_BIND_GROUP_DRAWS,
|
|
246
|
+
group.generateBindings({ camera, draws: chunks[c] })
|
|
247
|
+
);
|
|
248
|
+
|
|
249
|
+
const first = c * DYNAMIC_MESH_DRAWS_PER_CHUNK;
|
|
250
|
+
const end = Math.min(first + DYNAMIC_MESH_DRAWS_PER_CHUNK, draw_count);
|
|
251
|
+
|
|
252
|
+
for (let i = first; i < end; i++) {
|
|
253
|
+
residencies[i].draw(render_pass, graphics, pipeline, i - first);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUDynamicMeshRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/GPUDynamicMeshRenderer.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUDynamicMeshRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/GPUDynamicMeshRenderer.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;GAWG;AACH;IACI;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAFU,OAAO,CAEF;IA0Bf;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH;QAP4B,KAAK;QACC,KAAK;QACf,KAAK,EAAlB,MAAM;QACO,KAAK,EAAlB,MAAM;QACU,MAAM;QACpB;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CA0B1C;IA4FD;;;;;;OAMG;IACH,6BAFa,OAAO,CAInB;IAED,gBAEC;;CACJ"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { assert } from "../../../core/assert.js";
|
|
2
2
|
import { TextureViewDescriptor } from "../../descriptor/texture/TextureViewDescriptor.js";
|
|
3
3
|
import { DEFAULT_DEPTH_TEXTURE_VIEW } from "../depth/DEFAULT_DEPTH_TEXTURE_VIEW.js";
|
|
4
|
+
import { GPUDynamicMeshDrawList } from "./GPUDynamicMeshDrawList.js";
|
|
4
5
|
import { GPUDynamicMeshResidencyTable } from "./GPUDynamicMeshResidencyTable.js";
|
|
5
6
|
import { create_dynamic_mesh_pipeline } from "./shader_dynamic_mesh.js";
|
|
6
7
|
|
|
@@ -44,6 +45,15 @@ export class GPUDynamicMeshRenderer {
|
|
|
44
45
|
*/
|
|
45
46
|
#residency = new GPUDynamicMeshResidencyTable();
|
|
46
47
|
|
|
48
|
+
/**
|
|
49
|
+
* The draws of the frame being executed. Written, drawn and cleared within one pass callback, so
|
|
50
|
+
* one list serves every frame and every graph this renderer draws into, and holds nothing between
|
|
51
|
+
* them.
|
|
52
|
+
*
|
|
53
|
+
* @type {GPUDynamicMeshDrawList}
|
|
54
|
+
*/
|
|
55
|
+
#draws = new GPUDynamicMeshDrawList();
|
|
56
|
+
|
|
47
57
|
/**
|
|
48
58
|
* @type {RenderPipelineDescriptor|null}
|
|
49
59
|
*/
|
|
@@ -110,38 +120,16 @@ export class GPUDynamicMeshRenderer {
|
|
|
110
120
|
* @param {GPUBuffer} camera
|
|
111
121
|
*/
|
|
112
122
|
#execute(data, resources, context, batch, camera) {
|
|
113
|
-
const meshes = batch.meshes;
|
|
114
|
-
const count = meshes.length;
|
|
115
|
-
|
|
116
|
-
if (count === 0) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
123
|
const encoder = context.encoder;
|
|
121
124
|
const graphics = context.graphics;
|
|
122
125
|
|
|
123
|
-
//
|
|
124
|
-
// encoder, and the encoder is locked for as long as a render pass is open on it.
|
|
125
|
-
const draws =
|
|
126
|
+
// Written before the pass is opened: the constants go up through copies recorded onto the
|
|
127
|
+
// command encoder, and the encoder is locked for as long as a render pass is open on it.
|
|
128
|
+
const draws = this.#draws;
|
|
126
129
|
|
|
127
|
-
|
|
128
|
-
const mesh = meshes[i];
|
|
130
|
+
draws.write(encoder, this.#residency, batch.meshes);
|
|
129
131
|
|
|
130
|
-
|
|
131
|
-
continue;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const residency = this.#residency.get(mesh.geometry);
|
|
135
|
-
|
|
136
|
-
if (residency === undefined || residency.index_count === 0) {
|
|
137
|
-
// never uploaded, or empty
|
|
138
|
-
continue;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
draws.push({ residency, bindings: residency.create_bindings(encoder, mesh, camera) });
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
if (draws.length === 0) {
|
|
132
|
+
if (draws.count === 0) {
|
|
145
133
|
return;
|
|
146
134
|
}
|
|
147
135
|
|
|
@@ -159,8 +147,7 @@ export class GPUDynamicMeshRenderer {
|
|
|
159
147
|
const render_pass = encoder.constructRenderPass({
|
|
160
148
|
label: "Dynamic Mesh",
|
|
161
149
|
pipeline,
|
|
162
|
-
//
|
|
163
|
-
// set per draw rather than once for the pass.
|
|
150
|
+
// The constants' group is set per chunk and the geometry's per draw, by the draws.
|
|
164
151
|
bindings: [],
|
|
165
152
|
colorAttachments: [{
|
|
166
153
|
loadOp: "load",
|
|
@@ -184,13 +171,11 @@ export class GPUDynamicMeshRenderer {
|
|
|
184
171
|
},
|
|
185
172
|
});
|
|
186
173
|
|
|
187
|
-
|
|
188
|
-
const entry = draws[i];
|
|
189
|
-
|
|
190
|
-
entry.residency.draw(render_pass, graphics, pipeline, entry.bindings);
|
|
191
|
-
}
|
|
174
|
+
draws.draw(render_pass, graphics, pipeline, camera);
|
|
192
175
|
|
|
193
176
|
render_pass.end();
|
|
177
|
+
|
|
178
|
+
draws.clear();
|
|
194
179
|
}
|
|
195
180
|
|
|
196
181
|
/**
|
|
@@ -25,29 +25,15 @@ export class GPUDynamicMeshResidency {
|
|
|
25
25
|
*/
|
|
26
26
|
write(device: GPUDevice, staging: Float32Array, vertex_float_count: number, indices: Uint32Array): void;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* Draw this geometry: bind its group and draw its indices as the one instance `slot`, which is
|
|
29
|
+
* the row of the constants the pass has bound that the draw reads (`GPUDynamicMeshDrawList`).
|
|
29
30
|
*
|
|
30
|
-
*
|
|
31
|
-
* a transient buffer, and staging records a copy onto the command encoder — which WebGPU locks
|
|
32
|
-
* for as long as a pass is open on it. Doing this lazily at draw time is the obvious shape and
|
|
33
|
-
* an invalid one.
|
|
34
|
-
*
|
|
35
|
-
* The constants are transient because one mesh is one draw and its transform and colour are
|
|
36
|
-
* expected to differ every frame, so there is nothing worth keeping between them.
|
|
37
|
-
*
|
|
38
|
-
* @param {ShadeGPUCommandContext} encoder
|
|
39
|
-
* @param {DynamicMesh} mesh
|
|
40
|
-
* @param {GPUBuffer} camera
|
|
41
|
-
* @returns {Array} bind groups, for {@link draw}
|
|
42
|
-
*/
|
|
43
|
-
create_bindings(encoder: ShadeGPUCommandContext, mesh: DynamicMesh, camera: GPUBuffer): any[];
|
|
44
|
-
/**
|
|
45
|
-
* @param {ShadeGPURenderPassEncoder} render_pass
|
|
31
|
+
* @param {ShadeGPURenderPassEncoder} render_pass running `pipeline`, with its constants' group set
|
|
46
32
|
* @param {GraphicsContext} graphics
|
|
47
|
-
* @param {RenderPipelineDescriptor} pipeline
|
|
48
|
-
* @param {
|
|
33
|
+
* @param {RenderPipelineDescriptor} pipeline a dynamic-mesh pipeline
|
|
34
|
+
* @param {number} slot this draw's row in the bound chunk of constants
|
|
49
35
|
*/
|
|
50
|
-
draw(render_pass: ShadeGPURenderPassEncoder, graphics: GraphicsContext, pipeline: RenderPipelineDescriptor,
|
|
36
|
+
draw(render_pass: ShadeGPURenderPassEncoder, graphics: GraphicsContext, pipeline: RenderPipelineDescriptor, slot: number): void;
|
|
51
37
|
destroy(): void;
|
|
52
38
|
#private;
|
|
53
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GPUDynamicMeshResidency.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/GPUDynamicMeshResidency.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"GPUDynamicMeshResidency.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/GPUDynamicMeshResidency.js"],"names":[],"mappings":"AAyBA;;;;;GAKG;AACH;IAgCI;;;;OAIG;IACH,aAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,SAFU,MAAM,CAEH;IAEb;;;;;OAKG;IACH,kCAJW,YAAY,sBACZ,MAAM,WACN,WAAW,QA2DrB;IAED;;;;;;;;OAQG;IACH,kHAFW,MAAM,QAsBhB;IAED,gBAgBC;;CACJ"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { round_up } from "../../../core/math/round_up.js";
|
|
2
|
-
import {
|
|
2
|
+
import { BindGroupDescriptor } from "../binding/BindGroupDescriptor.js";
|
|
3
|
+
import { DYNAMIC_MESH_BIND_GROUP_GEOMETRY, DYNAMIC_MESH_RESOURCES } from "./shader_dynamic_mesh.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Growth factor for the vertex and index buffers.
|
|
@@ -51,6 +52,15 @@ export class GPUDynamicMeshResidency {
|
|
|
51
52
|
*/
|
|
52
53
|
#indices_capacity = 0;
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
* The group that binds {@link #vertices} and {@link #indices}, made on the first draw after they
|
|
57
|
+
* were allocated and kept until either is replaced: the geometry's buffers change far less often
|
|
58
|
+
* than their contents, so the group costs one creation per growth rather than a lookup per draw.
|
|
59
|
+
*
|
|
60
|
+
* @type {GPUBindGroup|null}
|
|
61
|
+
*/
|
|
62
|
+
#bind_group = null;
|
|
63
|
+
|
|
54
64
|
/**
|
|
55
65
|
* How many indices to draw — the count from the last upload, not the buffer's capacity.
|
|
56
66
|
*
|
|
@@ -86,6 +96,9 @@ export class GPUDynamicMeshResidency {
|
|
|
86
96
|
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
|
|
87
97
|
label: "DynamicMesh/vertices",
|
|
88
98
|
});
|
|
99
|
+
|
|
100
|
+
// names the buffer just destroyed
|
|
101
|
+
this.#bind_group = null;
|
|
89
102
|
}
|
|
90
103
|
|
|
91
104
|
if (this.#indices_capacity < index_bytes) {
|
|
@@ -99,6 +112,8 @@ export class GPUDynamicMeshResidency {
|
|
|
99
112
|
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
|
|
100
113
|
label: "DynamicMesh/indices",
|
|
101
114
|
});
|
|
115
|
+
|
|
116
|
+
this.#bind_group = null;
|
|
102
117
|
}
|
|
103
118
|
|
|
104
119
|
/*
|
|
@@ -126,48 +141,39 @@ export class GPUDynamicMeshResidency {
|
|
|
126
141
|
}
|
|
127
142
|
|
|
128
143
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* **Must be called before the render pass is opened.** The per-draw constants are staged through
|
|
132
|
-
* a transient buffer, and staging records a copy onto the command encoder — which WebGPU locks
|
|
133
|
-
* for as long as a pass is open on it. Doing this lazily at draw time is the obvious shape and
|
|
134
|
-
* an invalid one.
|
|
135
|
-
*
|
|
136
|
-
* The constants are transient because one mesh is one draw and its transform and colour are
|
|
137
|
-
* expected to differ every frame, so there is nothing worth keeping between them.
|
|
144
|
+
* Draw this geometry: bind its group and draw its indices as the one instance `slot`, which is
|
|
145
|
+
* the row of the constants the pass has bound that the draw reads (`GPUDynamicMeshDrawList`).
|
|
138
146
|
*
|
|
139
|
-
* @param {
|
|
140
|
-
* @param {DynamicMesh} mesh
|
|
141
|
-
* @param {GPUBuffer} camera
|
|
142
|
-
* @returns {Array} bind groups, for {@link draw}
|
|
143
|
-
*/
|
|
144
|
-
create_bindings(encoder, mesh, camera) {
|
|
145
|
-
const draw_buffer = encoder.allocateTransientValueBuffer(DYNAMIC_MESH_DRAW_STRUCT, {
|
|
146
|
-
model: mesh.transform.matrix,
|
|
147
|
-
color: mesh.color,
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
return DYNAMIC_MESH_RESOURCES.generateBindings({
|
|
151
|
-
camera,
|
|
152
|
-
draw: draw_buffer,
|
|
153
|
-
vertices: this.#vertices,
|
|
154
|
-
indices: this.#indices,
|
|
155
|
-
}, encoder);
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* @param {ShadeGPURenderPassEncoder} render_pass
|
|
147
|
+
* @param {ShadeGPURenderPassEncoder} render_pass running `pipeline`, with its constants' group set
|
|
160
148
|
* @param {GraphicsContext} graphics
|
|
161
|
-
* @param {RenderPipelineDescriptor} pipeline
|
|
162
|
-
* @param {
|
|
149
|
+
* @param {RenderPipelineDescriptor} pipeline a dynamic-mesh pipeline
|
|
150
|
+
* @param {number} slot this draw's row in the bound chunk of constants
|
|
163
151
|
*/
|
|
164
|
-
draw(render_pass, graphics, pipeline,
|
|
165
|
-
|
|
152
|
+
draw(render_pass, graphics, pipeline, slot) {
|
|
153
|
+
let group = this.#bind_group;
|
|
154
|
+
|
|
155
|
+
if (group === null) {
|
|
156
|
+
// every dynamic-mesh pipeline declares this group alike, so one made for any of them
|
|
157
|
+
// serves them all
|
|
158
|
+
group = graphics.bind_groups.create(BindGroupDescriptor.from(
|
|
159
|
+
pipeline.layout.bindGroupLayouts[DYNAMIC_MESH_BIND_GROUP_GEOMETRY],
|
|
160
|
+
DYNAMIC_MESH_RESOURCES.groups[DYNAMIC_MESH_BIND_GROUP_GEOMETRY].generateBindings({
|
|
161
|
+
vertices: this.#vertices,
|
|
162
|
+
indices: this.#indices,
|
|
163
|
+
})
|
|
164
|
+
));
|
|
165
|
+
|
|
166
|
+
this.#bind_group = group;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
render_pass.setBindGroup(DYNAMIC_MESH_BIND_GROUP_GEOMETRY, group);
|
|
166
170
|
|
|
167
|
-
render_pass.draw(this.index_count);
|
|
171
|
+
render_pass.draw(this.index_count, 1, 0, slot);
|
|
168
172
|
}
|
|
169
173
|
|
|
170
174
|
destroy() {
|
|
175
|
+
this.#bind_group = null;
|
|
176
|
+
|
|
171
177
|
if (this.#vertices !== null) {
|
|
172
178
|
this.#vertices.destroy();
|
|
173
179
|
this.#vertices = null;
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
* nearly edge-on lands the extinction slices away from the ribbon. The draw has one sample, where a
|
|
16
16
|
* fragment exists only if the centre is covered and the centroid is the centre.
|
|
17
17
|
*
|
|
18
|
-
* The enclosing shader binds the dynamic-mesh
|
|
18
|
+
* The enclosing shader binds the dynamic-mesh groups (`DYNAMIC_MESH_RESOURCES`), `camera` included,
|
|
19
|
+
* and hands over `instance_index` as the draw's row, as for {@link chunk_dynamic_mesh_vertex}.
|
|
19
20
|
*
|
|
20
21
|
* @type {CodeChunk}
|
|
21
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_dynamic_mesh_avboit_vertex.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.js"],"names":[],"mappings":"AAGA
|
|
1
|
+
{"version":3,"file":"chunk_dynamic_mesh_avboit_vertex.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/chunk_dynamic_mesh_avboit_vertex.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,+CAFU,SAAS,CA0BjB;0BAjDwB,iCAAiC"}
|
|
@@ -18,7 +18,8 @@ import { chunk_dynamic_mesh_vertex } from "./chunk_dynamic_mesh_vertex.js";
|
|
|
18
18
|
* nearly edge-on lands the extinction slices away from the ribbon. The draw has one sample, where a
|
|
19
19
|
* fragment exists only if the centre is covered and the centroid is the centre.
|
|
20
20
|
*
|
|
21
|
-
* The enclosing shader binds the dynamic-mesh
|
|
21
|
+
* The enclosing shader binds the dynamic-mesh groups (`DYNAMIC_MESH_RESOURCES`), `camera` included,
|
|
22
|
+
* and hands over `instance_index` as the draw's row, as for {@link chunk_dynamic_mesh_vertex}.
|
|
22
23
|
*
|
|
23
24
|
* @type {CodeChunk}
|
|
24
25
|
*/
|
|
@@ -31,8 +32,8 @@ struct DynamicMeshAVBOITVertexOut {
|
|
|
31
32
|
@location(1) @interpolate(perspective, centroid) view_depth : f32,
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
fn dynamic_mesh_avboit_vertex(vertex_index : u32) -> DynamicMeshAVBOITVertexOut {
|
|
35
|
-
let vertex = dynamic_mesh_vertex(vertex_index);
|
|
35
|
+
fn dynamic_mesh_avboit_vertex(vertex_index : u32, draw_index : u32) -> DynamicMeshAVBOITVertexOut {
|
|
36
|
+
let vertex = dynamic_mesh_vertex(vertex_index, draw_index);
|
|
36
37
|
|
|
37
38
|
var out : DynamicMeshAVBOITVertexOut;
|
|
38
39
|
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* One vertex of a {@link DynamicMesh}, pulled from its storage buffers and carried into the world:
|
|
3
|
-
* the index at `vertex_index`, the vertex it names, its position through
|
|
4
|
-
* colour multiplied by
|
|
3
|
+
* the index at `vertex_index`, the vertex it names, its position through its draw's `model` and its
|
|
4
|
+
* colour multiplied by its draw's flat `color`. The draw's constants are row `draw_index` of
|
|
5
|
+
* `draws`, which a draw names through its `first_instance` — pass `@builtin(instance_index)`.
|
|
5
6
|
*
|
|
6
7
|
* Vertices are pulled from storage rather than bound as vertex buffers, which is how the rest of the
|
|
7
8
|
* engine reads geometry: one pipeline then serves every dynamic mesh, whatever it holds.
|
|
8
9
|
*
|
|
9
|
-
* The enclosing shader binds the dynamic-mesh
|
|
10
|
+
* The enclosing shader binds the dynamic-mesh groups (`DYNAMIC_MESH_RESOURCES`) — `draws`,
|
|
10
11
|
* `vertices` and `indices` under those names. Shared by every pipeline that draws a dynamic mesh —
|
|
11
12
|
* the blended and opaque passes over the scene, and the AVBOIT splat and draw — so the one vertex
|
|
12
13
|
* layout ({@link DYNAMIC_MESH_VERTEX_STRIDE}) is read in exactly one place.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk_dynamic_mesh_vertex.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.js"],"names":[],"mappings":"AAOA
|
|
1
|
+
{"version":3,"file":"chunk_dynamic_mesh_vertex.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/dynamic/chunk_dynamic_mesh_vertex.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;GAeG;AACH,wCAFU,SAAS,CAmCjB;0BAxDwB,iCAAiC"}
|
|
@@ -7,13 +7,14 @@ import {
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* One vertex of a {@link DynamicMesh}, pulled from its storage buffers and carried into the world:
|
|
10
|
-
* the index at `vertex_index`, the vertex it names, its position through
|
|
11
|
-
* colour multiplied by
|
|
10
|
+
* the index at `vertex_index`, the vertex it names, its position through its draw's `model` and its
|
|
11
|
+
* colour multiplied by its draw's flat `color`. The draw's constants are row `draw_index` of
|
|
12
|
+
* `draws`, which a draw names through its `first_instance` — pass `@builtin(instance_index)`.
|
|
12
13
|
*
|
|
13
14
|
* Vertices are pulled from storage rather than bound as vertex buffers, which is how the rest of the
|
|
14
15
|
* engine reads geometry: one pipeline then serves every dynamic mesh, whatever it holds.
|
|
15
16
|
*
|
|
16
|
-
* The enclosing shader binds the dynamic-mesh
|
|
17
|
+
* The enclosing shader binds the dynamic-mesh groups (`DYNAMIC_MESH_RESOURCES`) — `draws`,
|
|
17
18
|
* `vertices` and `indices` under those names. Shared by every pipeline that draws a dynamic mesh —
|
|
18
19
|
* the blended and opaque passes over the scene, and the AVBOIT splat and draw — so the one vertex
|
|
19
20
|
* layout ({@link DYNAMIC_MESH_VERTEX_STRIDE}) is read in exactly one place.
|
|
@@ -32,7 +33,9 @@ struct DynamicMeshVertex {
|
|
|
32
33
|
color : vec4<f32>,
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
fn dynamic_mesh_vertex(vertex_index : u32) -> DynamicMeshVertex {
|
|
36
|
+
fn dynamic_mesh_vertex(vertex_index : u32, draw_index : u32) -> DynamicMeshVertex {
|
|
37
|
+
let draw = draws[draw_index];
|
|
38
|
+
|
|
36
39
|
let base = indices[vertex_index] * DYNAMIC_MESH_VERTEX_STRIDE;
|
|
37
40
|
|
|
38
41
|
let position = vec3<f32>(
|