@woosh/meep-engine 3.18.0 → 3.20.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-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/editor/view/particles/effect/ParticleCurveEditorView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleCurveEditorView.js +303 -120
- package/editor/view/particles/effect/ParticleGradientEditorView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleGradientEditorView.js +108 -63
- package/editor/view/particles/effect/ParticleGraphEditorView.js +2 -2
- package/editor/view/particles/effect/ParticleNodeParametersView.d.ts.map +1 -1
- package/editor/view/particles/effect/ParticleNodeParametersView.js +7 -46
- package/editor/view/particles/effect/particle-editor.css +60 -30
- package/package.json +1 -2
- package/samples/engine/README.md +1 -1
- package/src/core/binary/compression/decompress_bytes.d.ts +13 -0
- package/src/core/binary/compression/decompress_bytes.d.ts.map +1 -0
- package/src/core/binary/compression/decompress_bytes.js +28 -0
- package/src/core/collection/array/array_group_by.d.ts.map +1 -1
- package/src/core/collection/array/array_group_by.js +2 -11
- package/src/core/geom/3d/shape/HeightMapShape3D.d.ts.map +1 -1
- package/src/core/geom/3d/shape/HeightMapShape3D.js +4 -9
- package/src/core/model/node-graph/visual/layout/layout_assign_coordinates.js +67 -22
- package/src/core/model/object/optional_clone.d.ts +7 -0
- package/src/core/model/object/optional_clone.d.ts.map +1 -0
- package/src/core/model/object/optional_equality.d.ts +10 -0
- package/src/core/model/object/optional_equality.d.ts.map +1 -0
- package/src/{shade/descriptor/util → core/model/object}/optional_equality.js +2 -2
- package/src/core/model/object/optional_hash.d.ts +9 -0
- package/src/core/model/object/optional_hash.d.ts.map +1 -0
- package/src/{shade/descriptor/util → core/model/object}/optional_hash.js +3 -3
- package/src/engine/asset/Asset.d.ts +1 -1
- package/src/engine/asset/Asset.d.ts.map +1 -1
- package/src/engine/asset/Asset.js +3 -1
- package/src/engine/asset/loaders/image/ImageDecoderWorker.js +12 -27
- package/src/engine/asset/loaders/image/prototypePNG.js +8 -7
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.d.ts.map +1 -1
- package/src/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +9 -10
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
- package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +4 -0
- package/src/engine/graphics/ecs/particles/ParticleEffect.d.ts +266 -0
- package/src/engine/graphics/ecs/particles/ParticleEffect.d.ts.map +1 -0
- package/src/engine/graphics/ecs/particles/ParticleEffect.js +439 -0
- package/src/engine/graphics/ecs/particles/ParticleEffectSerializationAdapter.d.ts +58 -0
- package/src/engine/graphics/ecs/particles/ParticleEffectSerializationAdapter.d.ts.map +1 -0
- package/src/engine/graphics/ecs/particles/ParticleEffectSerializationAdapter.js +219 -0
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts +178 -25
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +809 -310
- package/src/format/image/png/PNGReader.d.ts +7 -6
- package/src/format/image/png/PNGReader.d.ts.map +1 -1
- package/src/format/image/png/PNGReader.js +13 -12
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.d.ts +3 -2
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.d.ts.map +1 -1
- package/src/format/image/png/chunk/png_chunk_decode_iTXt.js +5 -4
- package/src/format/image/png/chunk/png_chunk_decode_zTXt.d.ts +3 -2
- package/src/format/image/png/chunk/png_chunk_decode_zTXt.d.ts.map +1 -1
- package/src/format/image/png/chunk/png_chunk_decode_zTXt.js +5 -4
- package/src/format/image/png/png_inflate.d.ts +3 -3
- package/src/format/image/png/png_inflate.d.ts.map +1 -1
- package/src/format/image/png/png_inflate.js +29 -39
- package/src/format/texture/ktx2/ktx2_read.d.ts +4 -4
- package/src/format/texture/ktx2/ktx2_read.d.ts.map +1 -1
- package/src/format/texture/ktx2/ktx2_read.js +18 -21
- package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +1 -1
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +3 -3
- package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +1 -1
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +1 -1
- package/src/shade/descriptor/pipeline/render/ColorTargetState.js +3 -3
- package/src/shade/descriptor/pipeline/render/FragmentState.js +1 -1
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +3 -3
- package/src/shade/playground/particle_ecs/README.md +203 -0
- package/src/shade/playground/particle_ecs/bonfire_editor.d.ts +39 -0
- package/src/shade/playground/particle_ecs/bonfire_editor.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_editor.js +315 -0
- package/src/shade/playground/particle_ecs/bonfire_effects.d.ts +145 -0
- package/src/shade/playground/particle_ecs/bonfire_effects.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_effects.js +202 -0
- package/src/shade/playground/particle_ecs/bonfire_sprites.d.ts +23 -0
- package/src/shade/playground/particle_ecs/bonfire_sprites.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_sprites.js +315 -0
- package/src/shade/playground/particle_ecs/bonfire_world.d.ts +86 -0
- package/src/shade/playground/particle_ecs/bonfire_world.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/bonfire_world.js +303 -0
- package/src/shade/playground/particle_ecs/effects/embers.json +1634 -0
- package/src/shade/playground/particle_ecs/effects/flame.json +1882 -0
- package/src/shade/playground/particle_ecs/effects/smoke.json +1860 -0
- package/src/shade/playground/particle_ecs/effects/soot.json +1606 -0
- package/src/shade/playground/particle_ecs/index.html +330 -0
- package/src/shade/playground/particle_ecs/main.d.ts +2 -0
- package/src/shade/playground/particle_ecs/main.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/main.js +566 -0
- package/src/shade/playground/particle_ecs/moonlit_environment.d.ts +16 -0
- package/src/shade/playground/particle_ecs/moonlit_environment.d.ts.map +1 -0
- package/src/shade/playground/particle_ecs/moonlit_environment.js +144 -0
- package/src/shade/playground/particle_editor/README.md +5 -4
- package/src/shade/playground/particle_system/particle_prototype.d.ts +7 -9
- package/src/shade/playground/particle_system/particle_prototype.d.ts.map +1 -1
- package/src/shade/playground/particle_system/particle_prototype.js +7 -9
- package/src/shade/playground/profile_hotkey.d.ts +58 -0
- package/src/shade/playground/profile_hotkey.d.ts.map +1 -0
- package/src/shade/playground/profile_hotkey.js +325 -0
- package/src/shade/playground/ssr_motion/README.md +22 -0
- package/src/shade/playground/ssr_motion/index.html +18 -0
- package/src/shade/playground/ssr_motion/main.d.ts +2 -0
- package/src/shade/playground/ssr_motion/main.d.ts.map +1 -0
- package/src/shade/playground/ssr_motion/main.js +149 -0
- package/src/shade/playground/ssr_variance/README.md +105 -0
- package/src/shade/playground/ssr_variance/capture.d.ts +16 -0
- package/src/shade/playground/ssr_variance/capture.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/capture.js +96 -0
- package/src/shade/playground/ssr_variance/index.html +23 -0
- package/src/shade/playground/ssr_variance/main.d.ts +2 -0
- package/src/shade/playground/ssr_variance/main.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/main.js +246 -0
- package/src/shade/playground/ssr_variance/reference.d.ts +18 -0
- package/src/shade/playground/ssr_variance/reference.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/reference.js +78 -0
- package/src/shade/playground/ssr_variance/scene.d.ts +11 -0
- package/src/shade/playground/ssr_variance/scene.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/scene.js +61 -0
- package/src/shade/playground/ssr_variance/statistics.d.ts +44 -0
- package/src/shade/playground/ssr_variance/statistics.d.ts.map +1 -0
- package/src/shade/playground/ssr_variance/statistics.js +51 -0
- package/src/shade/renderer/geometry/Geometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/Geometry.js +4 -7
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts.map +1 -1
- package/src/shade/renderer/loader/gltf/tiny-gltf.js +9 -3
- package/src/shade/renderer/loader/usd/usd_decode_image.d.ts +4 -4
- package/src/shade/renderer/loader/usd/usd_decode_image.d.ts.map +1 -1
- package/src/shade/renderer/loader/usd/usd_decode_image.js +4 -4
- package/src/shade/renderer/material/StandardShadeMaterial.js +2 -2
- package/src/shade/renderer/particles/DESIGN.md +745 -702
- package/src/shade/renderer/particles/GPUParticleSystem.d.ts.map +1 -1
- package/src/shade/renderer/particles/GPUParticleSystem.js +3 -1
- package/src/shade/renderer/particles/graph/ParticleGroupBuilder.d.ts +1 -1
- package/src/shade/renderer/particles/graph/ParticleGroupBuilder.js +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/ParticleNodeRegistry.js +9 -15
- package/src/shade/renderer/particles/graph/particle_group_library.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_group_library.js +8 -3
- package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts +0 -2
- package/src/shade/renderer/particles/graph/particle_node_parameters.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_node_parameters.js +0 -9
- package/src/shade/renderer/particles/graph/particle_node_presentation.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_node_presentation.js +0 -10
- package/src/shade/renderer/particles/graph/particle_ramp.d.ts +2 -8
- package/src/shade/renderer/particles/graph/particle_ramp.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph/particle_ramp.js +2 -8
- package/src/shade/renderer/particles/graph/validate_particle_graph.js +0 -6
- package/src/shade/renderer/particles/graph_particles_avboit.d.ts.map +1 -1
- package/src/shade/renderer/particles/graph_particles_avboit.js +13 -4
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts +1 -12
- package/src/shade/renderer/particles/isa/InstructionStream.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/InstructionStream.js +1 -12
- package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts +54 -60
- package/src/shade/renderer/particles/isa/ParticleVMISA.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/ParticleVMISA.js +9 -17
- package/src/shade/renderer/particles/isa/particle_assembly.d.ts +0 -1
- package/src/shade/renderer/particles/isa/particle_assembly.d.ts.map +1 -1
- package/src/shade/renderer/particles/isa/particle_assembly.js +2 -16
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.d.ts +1 -1
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_graph.js +1 -1
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_lift.js +0 -14
- package/src/shade/renderer/particles/optimizer/dag/particle_vector_pack.js +3 -17
- package/src/shade/renderer/particles/optimizer/particle_program_analysis.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_analysis.js +15 -36
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_equivalence.js +1 -5
- package/src/shade/renderer/particles/optimizer/particle_program_fuzz.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_program_fuzz.js +1 -8
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts +2 -11
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.d.ts.map +1 -1
- package/src/shade/renderer/particles/optimizer/particle_vm_semantics.js +2 -11
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts +11 -4
- package/src/shade/renderer/particles/runtime/ParticleEmitter.d.ts.map +1 -1
- package/src/shade/renderer/particles/runtime/ParticleEmitter.js +431 -424
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_contribution.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_avboit_contribution.js +13 -0
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts +3 -6
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_avboit_draw.js +49 -17
- package/src/shade/renderer/particles/shaders/shader_particle_emit.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit.js +0 -2
- package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_emit_wide.js +0 -2
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate.js +1 -5
- package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/shaders/shader_particle_simulate_wide.js +0 -2
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts +1 -3
- package/src/shade/renderer/particles/vm/ParticleVMReference.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/ParticleVMReference.js +4 -20
- package/src/shade/renderer/particles/vm/chunk_particle_vm.d.ts.map +1 -1
- package/src/shade/renderer/particles/vm/chunk_particle_vm.js +2 -5
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance.js +0 -2
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.d.ts.map +1 -1
- package/src/shade/renderer/particles/warmup/shader_particle_warmup_advance_wide.js +0 -2
- package/src/shade/renderer/postprocess/ssr/SSR.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/SSR.js +2 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_reprojection.js +20 -5
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_sample_history.js +19 -5
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.d.ts +4 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/ssr/reproject/chunk_ssr_temporal_accumulate.js +137 -0
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts +0 -8
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/ssr/ssr_reproject_shader.js +18 -114
- package/src/shade/renderer/scene/Mesh.js +1 -1
- package/src/shade/renderer/texture/ShadeTexture.js +1 -1
- package/src/shade/renderer/texture/source/texel_data_from_ktx2.d.ts +2 -2
- package/src/shade/renderer/texture/source/texel_data_from_ktx2.d.ts.map +1 -1
- package/src/shade/renderer/texture/source/texel_data_from_ktx2.js +3 -3
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.d.ts +0 -19
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_animation.js +0 -30
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_disabled.d.ts +0 -11
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_disabled.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_curve_disabled.js +0 -13
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts +0 -20
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_warmup.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.d.ts +0 -14
- package/src/shade/renderer/particles/shaders/chunk_particle_emitter_world_sphere.d.ts.map +0 -1
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts +0 -50
- package/src/shade/renderer/particles/shaders/shader_particle_reclaim.d.ts.map +0 -1
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts +0 -17
- package/src/shade/renderer/postprocess/ssr/reproject/shader_ffx_denoiser_reflections_reproject.d.ts.map +0 -1
- /package/src/{shade/descriptor/util → core/model/object}/optional_clone.js +0 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What an entity emits. Paired with a {@link ../../../ecs/transform/Transform64.js Transform64},
|
|
3
|
+
* which says where, this is the whole of an emitter in the ECS:
|
|
4
|
+
*
|
|
5
|
+
* ```js
|
|
6
|
+
* new Entity()
|
|
7
|
+
* .add(new Transform64())
|
|
8
|
+
* .add(ParticleEffect.from({ ...create_particle_effect({ layout, init, update }), spawn_rate: 400 }))
|
|
9
|
+
* .build(dataset);
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* {@link ../../../graphics3/GPUParticleEmitterSystem.js GPUParticleEmitterSystem} is what turns the
|
|
13
|
+
* pair into particles: it gives the entity a
|
|
14
|
+
* {@link ../../../../shade/renderer/particles/runtime/ParticleEmitter.js ParticleEmitter} node in
|
|
15
|
+
* the scene it owns, keeps that node where the transform says, packs {@link texture} into the
|
|
16
|
+
* scene's sprite atlas, and follows every field below. Nothing here reaches a device by itself, and
|
|
17
|
+
* an entity carrying one of these with no such system in the profile simply emits nothing.
|
|
18
|
+
*
|
|
19
|
+
* ## It is a description, and only a description
|
|
20
|
+
*
|
|
21
|
+
* Everything on it means the same thing with no renderer present: the attribute {@link layout} and
|
|
22
|
+
* the compiled {@link program} that make up an effect, the {@link texture} to draw with, the rate,
|
|
23
|
+
* the pre-warm, the blend / projection / feature {@link flags}, the render-attribute bindings and
|
|
24
|
+
* the flipbook grid. That is deliberate, and it is what makes the component the unit an editor
|
|
25
|
+
* inspects, a prefab carries and a system diffs.
|
|
26
|
+
*
|
|
27
|
+
* What is **not** here: the scene node the system built, the emitter's row in the GPU emitter table,
|
|
28
|
+
* the generation of that row, where the program was placed in the program heap, and where the
|
|
29
|
+
* texture landed in the atlas. All of that belongs to whoever registered the emitter — see
|
|
30
|
+
* {@link ../../../../shade/renderer/particles/runtime/GPUParticleEmitterContext.js} — and none of it
|
|
31
|
+
* survives a device restart, which is exactly why it is not on a component that does.
|
|
32
|
+
*
|
|
33
|
+
* There are no bounds here either. An emitter's particles are moved by arbitrary bytecode, so the
|
|
34
|
+
* box is **measured** from the live particles by a GPU pass at the end of every frame rather than
|
|
35
|
+
* authored; the one authored part of it is whether this effect opts into culling at all
|
|
36
|
+
* (`cull` in {@link flags}).
|
|
37
|
+
*
|
|
38
|
+
* ## Sharing
|
|
39
|
+
*
|
|
40
|
+
* {@link layout} and {@link program} are immutable once compiled and are meant to be shared: fifty
|
|
41
|
+
* campfires hold fifty components pointing at one compiled effect, which is what puts them on one id
|
|
42
|
+
* in the program heap and therefore in one simulation bucket. {@link copy} shares them rather than
|
|
43
|
+
* duplicating them for that reason.
|
|
44
|
+
*
|
|
45
|
+
* ## Changing one
|
|
46
|
+
*
|
|
47
|
+
* Assign to the fields. The system compares what it holds against what it last wrote to the scene
|
|
48
|
+
* node, once per frame per entity, so there is no flag to set and no signal to fire — a component
|
|
49
|
+
* whose fields have not moved costs a run of comparisons and no upload. That is a deliberate trade
|
|
50
|
+
* against the observable-per-field shape the older components use: an effect has fifteen fields,
|
|
51
|
+
* gameplay writes them in bursts, and a row is restaged whole either way.
|
|
52
|
+
*
|
|
53
|
+
* ## Saving one
|
|
54
|
+
*
|
|
55
|
+
* {@link ./ParticleEffectSerializationAdapter.js} writes all of it, the compiled program included.
|
|
56
|
+
* The VM's instruction set is a durable format by design — fixed-width opcodes and a constant pool —
|
|
57
|
+
* so a level carries the bytecode the way it carries a mesh's indices, and a shipped build needs
|
|
58
|
+
* neither the graph the effect was compiled from nor a compiler at runtime. Authoring belongs to an
|
|
59
|
+
* editor.
|
|
60
|
+
*
|
|
61
|
+
* Two things are consequently wire format: the opcode numbers, and the **order** of the attributes
|
|
62
|
+
* in {@link layout}, because the offsets in the render bindings are assigned from that order.
|
|
63
|
+
*/
|
|
64
|
+
export class ParticleEffect {
|
|
65
|
+
/**
|
|
66
|
+
* Build a component from a plain description. Every field is optional — a component with no
|
|
67
|
+
* effect is a placeholder waiting for one — so an effect goes in by spreading what
|
|
68
|
+
* {@link ../../../../shade/renderer/particles/runtime/create_particle_effect.js create_particle_effect}
|
|
69
|
+
* returns: `ParticleEffect.from({ ...effect, spawn_rate: 100 })`.
|
|
70
|
+
*
|
|
71
|
+
* @param {object} [config]
|
|
72
|
+
* @param {import("../../../../shade/renderer/particles/layout/ParticleLayout.js").ParticleLayout} [config.layout]
|
|
73
|
+
* @param {import("../../../../shade/renderer/particles/isa/ParticleProgram.js").ParticleProgram} [config.program]
|
|
74
|
+
* @param {string|null} [config.texture] image URL to draw with
|
|
75
|
+
* @param {number} [config.seed]
|
|
76
|
+
* @param {number} [config.spawn_rate] particles/second
|
|
77
|
+
* @param {boolean} [config.emitting]
|
|
78
|
+
* @param {number} [config.prewarm] seconds of emission to run forward before the first frame
|
|
79
|
+
* @param {object} [config.flags] passed to `make_emitter_flags`
|
|
80
|
+
* @param {Object<string,string>} [config.render] render channel -> attribute name
|
|
81
|
+
* @param {ArrayLike<number>} [config.flipbook] `[columns, rows]`
|
|
82
|
+
* @returns {ParticleEffect}
|
|
83
|
+
*/
|
|
84
|
+
static from(config?: {
|
|
85
|
+
layout?: import("../../../../shade/renderer/particles/layout/ParticleLayout.js").ParticleLayout;
|
|
86
|
+
program?: import("../../../../shade/renderer/particles/isa/ParticleProgram.js").ParticleProgram;
|
|
87
|
+
texture?: string | null;
|
|
88
|
+
seed?: number;
|
|
89
|
+
spawn_rate?: number;
|
|
90
|
+
emitting?: boolean;
|
|
91
|
+
prewarm?: number;
|
|
92
|
+
flags?: object;
|
|
93
|
+
render?: {
|
|
94
|
+
[x: string]: string;
|
|
95
|
+
};
|
|
96
|
+
flipbook?: ArrayLike<number>;
|
|
97
|
+
}): ParticleEffect;
|
|
98
|
+
/**
|
|
99
|
+
* The per-particle attribute schema: which named attributes a particle of this effect has, how
|
|
100
|
+
* wide each is, and what word of the record it sits at.
|
|
101
|
+
*
|
|
102
|
+
* `null` until an effect is assigned. An entity whose component has none is linked and idle
|
|
103
|
+
* rather than an error — an effect that is still compiling or still loading is ordinary — and it
|
|
104
|
+
* starts emitting on the frame after both this and {@link program} are set.
|
|
105
|
+
*
|
|
106
|
+
* @type {import("../../../../shade/renderer/particles/layout/ParticleLayout.js").ParticleLayout|null}
|
|
107
|
+
*/
|
|
108
|
+
layout: import("../../../../shade/renderer/particles/layout/ParticleLayout.js").ParticleLayout | null;
|
|
109
|
+
/**
|
|
110
|
+
* The compiled INIT/UPDATE bytecode run for every particle. Replace the immutable program to
|
|
111
|
+
* edit the effect; do not mutate its bytecode in place.
|
|
112
|
+
*
|
|
113
|
+
* @type {import("../../../../shade/renderer/particles/isa/ParticleProgram.js").ParticleProgram|null}
|
|
114
|
+
*/
|
|
115
|
+
program: import("../../../../shade/renderer/particles/isa/ParticleProgram.js").ParticleProgram | null;
|
|
116
|
+
/**
|
|
117
|
+
* Image to draw the particles with, by URL, or `null` to draw against a single white texel — so
|
|
118
|
+
* an untextured effect is a flat quad of its own colour.
|
|
119
|
+
*
|
|
120
|
+
* The system loads this through `AssetManager` and packs it into the sprite atlas its scene
|
|
121
|
+
* shares, one patch per distinct URL however many entities name it. Where it lands is the
|
|
122
|
+
* system's answer and changes on every repack, without this component changing.
|
|
123
|
+
*
|
|
124
|
+
* @type {string|null}
|
|
125
|
+
*/
|
|
126
|
+
texture: string | null;
|
|
127
|
+
/**
|
|
128
|
+
* Base RNG seed.
|
|
129
|
+
*
|
|
130
|
+
* Two entities running one program produce identical particles from identical seeds. `0` reads
|
|
131
|
+
* as "unset", and the emitter then takes its registration's generation instead, which no other
|
|
132
|
+
* live emitter shares — so leaving this alone is what makes fifty campfires burn differently.
|
|
133
|
+
*
|
|
134
|
+
* @type {number}
|
|
135
|
+
*/
|
|
136
|
+
seed: number;
|
|
137
|
+
/**
|
|
138
|
+
* Continuous emission rate, particles per second. Integrated on the GPU; the CPU never counts
|
|
139
|
+
* particles.
|
|
140
|
+
*
|
|
141
|
+
* @type {number}
|
|
142
|
+
*/
|
|
143
|
+
spawn_rate: number;
|
|
144
|
+
/**
|
|
145
|
+
* Whether the effect is currently emitting.
|
|
146
|
+
*
|
|
147
|
+
* Turning it off holds {@link spawn_rate} at zero without the caller having to remember what the
|
|
148
|
+
* rate was — which is the whole reason it exists, because "put the torch out and light it again"
|
|
149
|
+
* otherwise means every caller keeping a shadow copy of the number. Particles already alive are
|
|
150
|
+
* **not** killed: a fire that stops emitting burns down, which is what stopping a fire looks
|
|
151
|
+
* like. Kill them from the effect's own UPDATE program if an effect wants to vanish.
|
|
152
|
+
*
|
|
153
|
+
* @type {boolean}
|
|
154
|
+
*/
|
|
155
|
+
emitting: boolean;
|
|
156
|
+
/**
|
|
157
|
+
* Seconds this effect is run forward before it is first shown, `0` for none.
|
|
158
|
+
*
|
|
159
|
+
* A continuous effect starts empty and grows into its steady state over one particle lifetime,
|
|
160
|
+
* in front of whoever is watching. Setting this to about the effect's particle lifetime means
|
|
161
|
+
* the population on the first visible frame is the one the emitter would have had by then —
|
|
162
|
+
* spawned, aged and thinned by its own program over that long.
|
|
163
|
+
*
|
|
164
|
+
* It is paid once, on the frame the emitter is registered, by a pipeline of its own that
|
|
165
|
+
* simulates a private population and moves the result into the scene. Longer costs a longer loop
|
|
166
|
+
* on that one frame and nothing after it.
|
|
167
|
+
*
|
|
168
|
+
* @type {number}
|
|
169
|
+
*/
|
|
170
|
+
prewarm: number;
|
|
171
|
+
/**
|
|
172
|
+
* Packed feature / blend / projection bits — see
|
|
173
|
+
* {@link ../../../../shade/renderer/particles/data/PARTICLE_EMITTER_STRUCT.js make_emitter_flags}.
|
|
174
|
+
*
|
|
175
|
+
* @type {number}
|
|
176
|
+
*/
|
|
177
|
+
flags: number;
|
|
178
|
+
/**
|
|
179
|
+
* Flipbook grid: columns, rows, over whatever region {@link texture} was packed into. `[1, 1]`
|
|
180
|
+
* is a single frame.
|
|
181
|
+
*
|
|
182
|
+
* @type {Float32Array}
|
|
183
|
+
*/
|
|
184
|
+
flipbook: Float32Array;
|
|
185
|
+
/** @type {number} record word offset of world position, or {@link EMITTER_ATTRIBUTE_ABSENT} */
|
|
186
|
+
render_position: number;
|
|
187
|
+
/** @type {number} record word offset of size */
|
|
188
|
+
render_size: number;
|
|
189
|
+
/** @type {number} record word offset of rgba colour */
|
|
190
|
+
render_color: number;
|
|
191
|
+
/** @type {number} record word offset of roll angle, radians */
|
|
192
|
+
render_rotation: number;
|
|
193
|
+
/** @type {number} record word offset of flipbook frame index */
|
|
194
|
+
render_frame: number;
|
|
195
|
+
/** @type {number} record word offset of velocity, read by the STRETCHED projection */
|
|
196
|
+
render_velocity: number;
|
|
197
|
+
/**
|
|
198
|
+
* The rate the emitter actually runs at: {@link spawn_rate} while {@link emitting}, and zero
|
|
199
|
+
* otherwise. What the system writes to the GPU record.
|
|
200
|
+
*
|
|
201
|
+
* @returns {number}
|
|
202
|
+
*/
|
|
203
|
+
get effective_spawn_rate(): number;
|
|
204
|
+
/**
|
|
205
|
+
* Bind render channels to per-particle attributes of this effect, by attribute name.
|
|
206
|
+
*
|
|
207
|
+
* Channels left out of `channels` keep whatever they had; a channel that was never bound stays
|
|
208
|
+
* at {@link EMITTER_ATTRIBUTE_ABSENT}, which the passes read as "this effect has no such
|
|
209
|
+
* attribute" — the render pass substitutes a default and the sort pass treats the particle as
|
|
210
|
+
* being at the origin.
|
|
211
|
+
*
|
|
212
|
+
* Word offsets are stored rather than names because that is what the render and sort passes
|
|
213
|
+
* index a particle record with; resolving here is the only place a name is involved, which is
|
|
214
|
+
* also why this needs {@link layout} to have been set first.
|
|
215
|
+
*
|
|
216
|
+
* @param {Object<string,string>} channels channel name (see `EMITTER_RENDER_CHANNELS`) ->
|
|
217
|
+
* attribute name in this effect's layout
|
|
218
|
+
* @returns {ParticleEffect} this
|
|
219
|
+
*/
|
|
220
|
+
bind_render(channels: {
|
|
221
|
+
[x: string]: string;
|
|
222
|
+
}): ParticleEffect;
|
|
223
|
+
/**
|
|
224
|
+
* Structural equality over everything the component *is*. Two components that compare equal
|
|
225
|
+
* describe one effect, and one emitter row would serve both.
|
|
226
|
+
*
|
|
227
|
+
* The compiled program compares by its own bytecode rather than by object identity, so two
|
|
228
|
+
* components separately compiled from one graph compare equal.
|
|
229
|
+
*
|
|
230
|
+
* @param {ParticleEffect} other
|
|
231
|
+
* @returns {boolean}
|
|
232
|
+
*/
|
|
233
|
+
equals(other: ParticleEffect): boolean;
|
|
234
|
+
/**
|
|
235
|
+
* Hash over everything {@link equals} compares, in the same terms.
|
|
236
|
+
*
|
|
237
|
+
* @returns {number} int32
|
|
238
|
+
*/
|
|
239
|
+
hash(): number;
|
|
240
|
+
/**
|
|
241
|
+
* Make this a copy of `other`: same effect, same settings.
|
|
242
|
+
*
|
|
243
|
+
* The layout and the compiled program are **shared** rather than duplicated — both are immutable
|
|
244
|
+
* once compiled, and sharing them is what puts two entities of one effect on one program id in
|
|
245
|
+
* the heap, hence in one simulation bucket.
|
|
246
|
+
*
|
|
247
|
+
* @param {ParticleEffect} other
|
|
248
|
+
* @returns {ParticleEffect} this
|
|
249
|
+
*/
|
|
250
|
+
copy(other: ParticleEffect): ParticleEffect;
|
|
251
|
+
/**
|
|
252
|
+
* @returns {ParticleEffect}
|
|
253
|
+
*/
|
|
254
|
+
clone(): ParticleEffect;
|
|
255
|
+
/**
|
|
256
|
+
* Enables a fast type check, without having to import the class separately.
|
|
257
|
+
*
|
|
258
|
+
* @readonly
|
|
259
|
+
* @type {boolean}
|
|
260
|
+
*/
|
|
261
|
+
readonly isParticleEffect: boolean;
|
|
262
|
+
}
|
|
263
|
+
export namespace ParticleEffect {
|
|
264
|
+
let typeName: string;
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=ParticleEffect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParticleEffect.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/graphics/ecs/particles/ParticleEffect.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH;IAoRI;;;;;;;;;;;;;;;;;;OAkBG;IACH;QAZ2G,MAAM,GAAtG,OAAO,+DAA+D,EAAE,cAAc;QACS,OAAO,GAAtG,OAAO,6DAA6D,EAAE,eAAe;QAChE,OAAO,GAA5B,MAAM,GAAC,IAAI;QACK,IAAI,GAApB,MAAM;QACU,UAAU,GAA1B,MAAM;QACW,QAAQ,GAAzB,OAAO;QACS,OAAO,GAAvB,MAAM;QACU,KAAK,GAArB,MAAM;QACyB,MAAM;gBAA9B,MAAM,GAAC,MAAM;;QACO,QAAQ,GAAnC,UAAU,MAAM,CAAC;QACf,cAAc,CA8C1B;IAjVD;;;;;;;;;OASG;IACH,QAFU,OAAO,+DAA+D,EAAE,cAAc,GAAC,IAAI,CAEvF;IAEd;;;;;OAKG;IACH,SAFU,OAAO,6DAA6D,EAAE,eAAe,GAAC,IAAI,CAErF;IAEf;;;;;;;;;OASG;IACH,SAFU,MAAM,GAAC,IAAI,CAEN;IAEf;;;;;;;;OAQG;IACH,MAFU,MAAM,CAEP;IAET;;;;;OAKG;IACH,YAFU,MAAM,CAED;IAEf;;;;;;;;;;OAUG;IACH,UAFU,OAAO,CAED;IAEhB;;;;;;;;;;;;;OAaG;IACH,SAFU,MAAM,CAEJ;IAEZ;;;;;OAKG;IACH,OAFU,MAAM,CAEN;IAEV;;;;;OAKG;IACH,UAFU,YAAY,CAEc;IAEpC,+FAA+F;IAC/F,iBADW,MAAM,CAC0B;IAC3C,gDAAgD;IAChD,aADW,MAAM,CACsB;IACvC,uDAAuD;IACvD,cADW,MAAM,CACuB;IACxC,+DAA+D;IAC/D,iBADW,MAAM,CAC0B;IAC3C,gEAAgE;IAChE,cADW,MAAM,CACuB;IACxC,sFAAsF;IACtF,iBADW,MAAM,CAC0B;IAE3C;;;;;OAKG;IACH,mCAEC;IAED;;;;;;;;;;;;;;;OAeG;IACH;YAJkB,MAAM,GAAC,MAAM;QAElB,cAAc,CAuC1B;IAED;;;;;;;;;OASG;IACH,cAHW,cAAc,GACZ,OAAO,CAsBnB;IAED;;;;OAIG;IACH,QAFa,MAAM,CAuBlB;IAED;;;;;;;;;OASG;IACH,YAHW,cAAc,GACZ,cAAc,CAuB1B;IAED;;OAEG;IACH,SAFa,cAAc,CAI1B;IAgFL;;;;;OAKG;IACH,2BAFU,OAAO,CAEwB;CApBxC;;kBAUS,MAAM"}
|