@woosh/meep-engine 3.45.0 → 3.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/assert.d.ts.map +1 -1
- package/src/core/assert.js +5 -1
- package/src/core/binary/hash/XXH128Hash.d.ts +1 -37
- package/src/core/binary/hash/XXH128Hash.d.ts.map +1 -1
- package/src/core/binary/hash/XXH128Hash.js +4 -55
- package/src/core/binary/hash/XXH3_SECRET.d.ts +1 -12
- package/src/core/binary/hash/XXH3_SECRET.d.ts.map +1 -1
- package/src/core/binary/hash/XXH3_SECRET.js +4 -25
- package/src/core/binary/hash/crc32.d.ts +1 -15
- package/src/core/binary/hash/crc32.d.ts.map +1 -1
- package/src/core/binary/hash/crc32.js +4 -96
- package/src/core/binary/hash/xxh3_128.d.ts +1 -9
- package/src/core/binary/hash/xxh3_128.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_128.js +4 -341
- package/src/core/binary/hash/xxh3_64.d.ts +1 -8
- package/src/core/binary/hash/xxh3_64.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_64.js +4 -241
- package/src/core/binary/hash/xxh3_common.d.ts +1 -223
- package/src/core/binary/hash/xxh3_common.d.ts.map +1 -1
- package/src/core/binary/hash/xxh3_common.js +90 -476
- package/src/core/collection/array/combine_hash.d.ts +6 -0
- package/src/core/collection/array/combine_hash.d.ts.map +1 -1
- package/src/core/collection/array/combine_hash.js +6 -0
- package/src/core/function/FunctionCompiler.js +2 -2
- package/src/core/geom/3d/mat4/m4_multiply.d.ts +3 -0
- package/src/core/geom/3d/mat4/m4_multiply.d.ts.map +1 -1
- package/src/core/geom/3d/mat4/m4_multiply.js +3 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts +30 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.d.ts.map +1 -0
- package/src/core/geom/3d/mat4/m4_multiply_f64.js +106 -0
- package/src/core/geom/ConicRay.js +2 -2
- package/src/core/geom/Vector4.d.ts.map +1 -1
- package/src/core/geom/Vector4.js +8 -5
- package/src/core/math/hash/XXH128Hash.d.ts +38 -0
- package/src/core/math/hash/XXH128Hash.d.ts.map +1 -0
- package/src/core/math/hash/XXH128Hash.js +55 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts +13 -0
- package/src/core/math/hash/XXH3_SECRET.d.ts.map +1 -0
- package/src/core/math/hash/XXH3_SECRET.js +25 -0
- package/src/core/math/hash/crc32.d.ts +16 -0
- package/src/core/math/hash/crc32.d.ts.map +1 -0
- package/src/core/math/hash/crc32.js +96 -0
- package/src/core/math/hash/xxh3_128.d.ts +10 -0
- package/src/core/math/hash/xxh3_128.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_128.js +341 -0
- package/src/core/math/hash/xxh3_64.d.ts +9 -0
- package/src/core/math/hash/xxh3_64.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_64.js +241 -0
- package/src/core/math/hash/xxh3_common.d.ts +224 -0
- package/src/core/math/hash/xxh3_common.d.ts.map +1 -0
- package/src/core/math/hash/xxh3_common.js +476 -0
- package/src/core/math/lookup/ParameterLookupTable.js +2 -2
- package/src/core/model/node-graph/node/NodeInstancePortReference.js +2 -2
- package/src/core/model/reactive/model/ReactiveBinaryExpression.js +2 -2
- package/src/core/model/reactive/model/terminal/ReactiveReference.js +2 -2
- package/src/engine/asset/AssetDescription.js +2 -2
- package/src/engine/ecs/animation/Animation.js +2 -2
- package/src/engine/ecs/animation/AnimationClip.d.ts.map +1 -1
- package/src/engine/ecs/animation/AnimationClip.js +7 -5
- package/src/engine/ecs/gui/GUIElement.d.ts.map +1 -1
- package/src/engine/ecs/gui/GUIElement.js +7 -5
- package/src/engine/ecs/gui/hud/HeadsUpDisplay.js +2 -2
- package/src/engine/ecs/gui/position/ViewportPosition.d.ts.map +1 -1
- package/src/engine/ecs/gui/position/ViewportPosition.js +11 -7
- package/src/engine/ecs/transform/Transform64.d.ts +1 -1
- package/src/engine/ecs/transform/Transform64.d.ts.map +1 -1
- package/src/engine/ecs/transform/Transform64.js +5 -4
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/AnimationClip.js +8 -5
- package/src/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +2 -2
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.d.ts.map +1 -1
- package/src/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +8 -5
- package/src/engine/graphics/ecs/decal/v2/Decal.d.ts.map +1 -1
- package/src/engine/graphics/ecs/decal/v2/Decal.js +9 -8
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/engine/graphics/render/frame_graph/resource/TextureResourceDescriptor.js +9 -6
- package/src/engine/graphics3/ParticipatingMedia.js +204 -204
- package/src/engine/graphics3/animation/AnimationClips.d.ts +5 -0
- package/src/engine/graphics3/animation/AnimationClips.d.ts.map +1 -1
- package/src/engine/graphics3/animation/AnimationClips.js +5 -0
- package/src/engine/grid/obstacle/GridObstacle.js +2 -2
- package/src/engine/intelligence/behavior/selector/WeightedElement.js +2 -2
- package/src/engine/interpolation/Interpolated.js +2 -2
- package/src/engine/physics/cloth/ecs/Cloth.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/Cloth.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothCollider.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothCollider.js +7 -5
- package/src/engine/physics/cloth/ecs/ClothDynamics.d.ts.map +1 -1
- package/src/engine/physics/cloth/ecs/ClothDynamics.js +20 -11
- package/src/engine/physics/fluid/FluidField.d.ts.map +1 -1
- package/src/engine/physics/fluid/FluidField.js +7 -5
- package/src/engine/physics/fluid/ecs/FluidComponent.d.ts.map +1 -1
- package/src/engine/physics/fluid/ecs/FluidComponent.js +19 -11
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.d.ts +2 -2
- package/src/engine/physics/fluid/effector/AbstractFluidEffector.js +2 -2
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/GlobalFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/ImpulseFluidEffector.js +11 -7
- package/src/engine/physics/fluid/effector/WakeFluidEffector.d.ts.map +1 -1
- package/src/engine/physics/fluid/effector/WakeFluidEffector.js +16 -9
- package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
- package/src/engine/sound/ecs/audio/AudioEmitter.js +12 -7
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.d.ts.map +1 -1
- package/src/engine/sound/ecs/trigger/AudioEventTrigger.js +192 -191
- package/src/engine/sound/simulation/core/AcousticMedium.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticDirectivity.js +2 -2
- package/src/engine/sound/simulation/definition/AcousticMaterial.d.ts.map +1 -1
- package/src/engine/sound/simulation/definition/AcousticMaterial.js +11 -7
- package/src/engine/sound/sopra/definition/BusDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/BusDefinition.js +5 -4
- package/src/engine/sound/sopra/definition/DuckingRule.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/DuckingRule.js +7 -5
- package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/EventDescription.js +23 -13
- package/src/engine/sound/sopra/definition/MixerSnapshot.js +2 -2
- package/src/engine/sound/sopra/definition/ParameterDefinition.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/ParameterDefinition.js +7 -5
- package/src/engine/sound/sopra/definition/clip/AbstractAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/BlendContainerAudioClip.js +4 -3
- package/src/engine/sound/sopra/definition/clip/ContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/RandomContainerAudioClip.js +3 -3
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SampleAudioClip.js +16 -9
- package/src/engine/sound/sopra/definition/clip/SilenceAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.js +2 -2
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/CompressorEffect.js +7 -5
- package/src/engine/sound/sopra/definition/effect/EqEffect.d.ts.map +1 -1
- package/src/engine/sound/sopra/definition/effect/EqEffect.js +8 -5
- package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +2 -2
- package/src/engine/sound/sopra/legacy/SoundEmitter.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundEmitter.js +357 -352
- package/src/engine/sound/sopra/legacy/SoundTrack.d.ts.map +1 -1
- package/src/engine/sound/sopra/legacy/SoundTrack.js +281 -278
- package/src/format/image/png/PNGReader.js +644 -644
- package/src/format/image/png/crc32.d.ts +1 -1
- package/src/format/image/png/crc32.js +7 -8
- package/src/shade/descriptor/binding/BindGroupLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.d.ts.map +1 -1
- package/src/shade/descriptor/binding/BindGroupLayoutEntry.js +12 -8
- package/src/shade/descriptor/binding/StorageTextureBindingLayout.js +2 -2
- package/src/shade/descriptor/binding/TextureBindingLayout.js +2 -2
- package/src/shade/descriptor/blend/BlendComponent.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineDescriptorBase.js +2 -2
- package/src/shade/descriptor/pipeline/PipelineLayoutDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/ProgrammableStage.js +2 -2
- package/src/shade/descriptor/pipeline/compute/ComputePipelineDescriptor.js +2 -2
- package/src/shade/descriptor/pipeline/render/ColorTargetState.js +2 -2
- package/src/shade/descriptor/pipeline/render/FragmentState.js +2 -2
- package/src/shade/descriptor/pipeline/render/PrimitiveState.js +2 -2
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/pipeline/render/RenderPipelineDescriptor.js +8 -5
- package/src/shade/descriptor/pipeline/render/VertexAttribute.js +2 -2
- package/src/shade/descriptor/texture/SamplerDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/SamplerDescriptor.js +20 -12
- package/src/shade/descriptor/texture/TextureDescriptor.d.ts.map +1 -1
- package/src/shade/descriptor/texture/TextureDescriptor.js +11 -7
- package/src/shade/device/graph/BufferResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/BufferResourceDescriptor.js +196 -193
- package/src/shade/device/graph/TextureResourceDescriptor.d.ts.map +1 -1
- package/src/shade/device/graph/TextureResourceDescriptor.js +178 -173
- package/src/shade/device/timing/profile/sgpt_read_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_read_records.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_header.js +1 -1
- package/src/shade/device/timing/profile/sgpt_write_record.js +1 -1
- package/src/shade/renderer/binding/BufferBinding.js +2 -2
- package/src/shade/renderer/camera/Camera.js +2 -2
- package/src/shade/renderer/geometry/Attribute.js +2 -2
- package/src/shade/renderer/geometry/Geometry.js +2 -2
- package/src/shade/renderer/geometry/geometry_deduplicate_vertices.js +2 -2
- package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +2 -2
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +13 -13
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_directory_block_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +41 -41
- package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +25 -25
- package/src/shade/renderer/material/StandardShadeMaterial.d.ts.map +1 -1
- package/src/shade/renderer/material/StandardShadeMaterial.js +13 -8
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.d.ts.map +1 -1
- package/src/shade/renderer/scene/optimization/geometry/internal/triangle_fingerprint_stream.js +14 -5
- package/src/shade/renderer/scene/optimization/sampler2d_from_image_bitmap.js +1 -1
- package/src/shade/renderer/shader/type/WGSLStructField.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUArray.js +2 -2
- package/src/shade/renderer/shader/type/WebGPUStruct.d.ts.map +1 -1
- package/src/shade/renderer/shader/type/WebGPUStruct.js +9 -6
- package/src/shade/renderer/texture/ShadeTexture.d.ts.map +1 -1
- package/src/shade/renderer/texture/ShadeTexture.js +17 -10
- package/src/shade/renderer/texture/mipmaps/WebGPUMipmapGenerator.js +2 -2
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.d.ts +4 -4
- package/src/shade/renderer/water/surface/chunk_water_surface_sample.js +6 -6
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +46 -55
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts +3 -3
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/WATER_PARTICLE_STRUCT.js +14 -4
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts +10 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +82 -40
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts +4 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle_step.js +8 -4
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts +98 -86
- package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/shader_water_particles.js +440 -298
- package/src/view/common/HTMLElementCacheKey.d.ts.map +1 -1
- package/src/view/common/HTMLElementCacheKey.js +4 -3
- package/src/view/minimap/MinimapMarker.js +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FluidComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/ecs/FluidComponent.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IAEI;;OAEG;IACH,OAFU,UAAU,CAEK;IAEzB;;;;;;;OAOG;IACH,QAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEf;IAEnB;;;;;;;;OAQG;IACH,QAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEf;IAEnB;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAFU,MAAM,CAEC;IAEjB;;;;OAIG;IACH,SAFU,OAAO,CAEF;IAEf;;;;;OAKG;IACH,UAFU,OAAO,CAEA;IAEjB;;;;;;;OAOG;IACH,iBANW,YAAY,GAAC,MAAM,EAAE,MACrB,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,GAAC,MAAM,EAAE,CAQhC;IAED;;;;;;;OAOG;IACH,iBANW,YAAY,GAAC,MAAM,EAAE,MACrB,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,GAAC,MAAM,EAAE,CAOhC;IAED;;;;;;;;;;;;;;OAcG;IACH,2BANW,YAAY,GAAC,MAAM,EAAE,MACrB,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,GAAC,MAAM,EAAE,CAQhC;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,MAAM,CAQjB;IAED;;;OAGG;IACH,cAHW,cAAc,GACb,OAAO,CAoBlB;IAED;;OAEG;IACH,QAFY,MAAM,
|
|
1
|
+
{"version":3,"file":"FluidComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/ecs/FluidComponent.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH;IAEI;;OAEG;IACH,OAFU,UAAU,CAEK;IAEzB;;;;;;;OAOG;IACH,QAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEf;IAEnB;;;;;;;;OAQG;IACH,QAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEf;IAEnB;;;OAGG;IACH,WAFU,MAAM,CAEF;IAEd;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAFU,MAAM,CAEC;IAEjB;;;;OAIG;IACH,SAFU,OAAO,CAEF;IAEf;;;;;OAKG;IACH,UAFU,OAAO,CAEA;IAEjB;;;;;;;OAOG;IACH,iBANW,YAAY,GAAC,MAAM,EAAE,MACrB,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,GAAC,MAAM,EAAE,CAQhC;IAED;;;;;;;OAOG;IACH,iBANW,YAAY,GAAC,MAAM,EAAE,MACrB,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,GAAC,MAAM,EAAE,CAOhC;IAED;;;;;;;;;;;;;;OAcG;IACH,2BANW,YAAY,GAAC,MAAM,EAAE,MACrB,MAAM,MACN,MAAM,MACN,MAAM,GACL,YAAY,GAAC,MAAM,EAAE,CAQhC;IAED;;;;;;;OAOG;IACH,0BANW,MAAM,MACN,MAAM,MACN,MAAM,MACN,MAAM,GACL,MAAM,CAQjB;IAED;;;OAGG;IACH,cAHW,cAAc,GACb,OAAO,CAoBlB;IAED;;OAEG;IACH,QAFY,MAAM,CAwBjB;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,iCAmBC;IAGL,0BAAyC;CAFxC;2BAvQ0B,kBAAkB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
2
2
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
3
3
|
import { FluidField } from "../FluidField.js";
|
|
4
4
|
|
|
@@ -197,16 +197,24 @@ export class FluidComponent {
|
|
|
197
197
|
* @return {number}
|
|
198
198
|
*/
|
|
199
199
|
hash() {
|
|
200
|
-
return
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
200
|
+
return hash_mix3(
|
|
201
|
+
hash_mix3(
|
|
202
|
+
hash_mix3(
|
|
203
|
+
hash_mix3(
|
|
204
|
+
hash_mix3(
|
|
205
|
+
this.enabled ? 1 : 0,
|
|
206
|
+
this.anchored ? 1 : 0,
|
|
207
|
+
computeHashFloat(this.cell_size)
|
|
208
|
+
),
|
|
209
|
+
computeHashFloat(this.hysteresis),
|
|
210
|
+
computeHashFloat(this.origin[0])
|
|
211
|
+
),
|
|
212
|
+
computeHashFloat(this.origin[1]),
|
|
213
|
+
computeHashFloat(this.origin[2])
|
|
214
|
+
),
|
|
215
|
+
computeHashFloat(this.offset[0]),
|
|
216
|
+
computeHashFloat(this.offset[1])
|
|
217
|
+
),
|
|
210
218
|
computeHashFloat(this.offset[2]),
|
|
211
219
|
this.field.hash()
|
|
212
220
|
);
|
|
@@ -53,8 +53,8 @@ export class AbstractFluidEffector {
|
|
|
53
53
|
equals(other: AbstractFluidEffector): boolean;
|
|
54
54
|
/**
|
|
55
55
|
* Fast hash. The base implementation returns a constant — concrete effectors
|
|
56
|
-
* override to hash their own state. Should stay cheap (a few `
|
|
57
|
-
* over scalar fields).
|
|
56
|
+
* override to hash their own state. Should stay cheap (a few `hash_mix2` / `hash_mix3`
|
|
57
|
+
* calls over scalar fields).
|
|
58
58
|
* @return {number}
|
|
59
59
|
*/
|
|
60
60
|
hash(): number;
|
|
@@ -63,8 +63,8 @@ export class AbstractFluidEffector {
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Fast hash. The base implementation returns a constant — concrete effectors
|
|
66
|
-
* override to hash their own state. Should stay cheap (a few `
|
|
67
|
-
* over scalar fields).
|
|
66
|
+
* override to hash their own state. Should stay cheap (a few `hash_mix2` / `hash_mix3`
|
|
67
|
+
* calls over scalar fields).
|
|
68
68
|
* @return {number}
|
|
69
69
|
*/
|
|
70
70
|
hash() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GlobalFluidEffector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/GlobalFluidEffector.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;IAEI;;;;;OAKG;IACH,OAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEhB;IAElB;;;;;OAKG;IACH,MAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEjB;IAEjB;;;;;;;OAOG;IACH,MAFU,MAAM,CAEP;
|
|
1
|
+
{"version":3,"file":"GlobalFluidEffector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/GlobalFluidEffector.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH;IAEI;;;;;OAKG;IACH,OAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEhB;IAElB;;;;;OAKG;IACH,MAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEjB;IAEjB;;;;;;;OAOG;IACH,MAFU,MAAM,CAEP;CA+HZ;sCA3MqC,4BAA4B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
2
2
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
3
3
|
import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
|
|
4
4
|
|
|
@@ -180,12 +180,16 @@ export class GlobalFluidEffector extends AbstractFluidEffector {
|
|
|
180
180
|
* @return {number}
|
|
181
181
|
*/
|
|
182
182
|
hash() {
|
|
183
|
-
return
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
return hash_mix3(
|
|
184
|
+
hash_mix3(
|
|
185
|
+
hash_mix3(
|
|
186
|
+
computeHashFloat(this.force[0]),
|
|
187
|
+
computeHashFloat(this.force[1]),
|
|
188
|
+
computeHashFloat(this.force[2])
|
|
189
|
+
),
|
|
190
|
+
computeHashFloat(this.wind[0]),
|
|
191
|
+
computeHashFloat(this.wind[1])
|
|
192
|
+
),
|
|
189
193
|
computeHashFloat(this.wind[2]),
|
|
190
194
|
computeHashFloat(this.drag)
|
|
191
195
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImpulseFluidEffector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/ImpulseFluidEffector.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAEI;;;OAGG;IACH,UAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEb;IAErB;;;;;;OAMG;IACH,OAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEhB;IAElB;;;;;;OAMG;IACH,QAFU,MAAM,CAEL;
|
|
1
|
+
{"version":3,"file":"ImpulseFluidEffector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/ImpulseFluidEffector.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AACH;IAEI;;;OAGG;IACH,UAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEb;IAErB;;;;;;OAMG;IACH,OAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEhB;IAElB;;;;;;OAMG;IACH,QAFU,MAAM,CAEL;CAkNd;sCAhQqC,4BAA4B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
2
2
|
import { v3_matrix4_multiply } from "../../../../core/geom/vec3/v3_matrix4_multiply.js";
|
|
3
3
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
4
4
|
import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
|
|
@@ -225,12 +225,16 @@ export class ImpulseFluidEffector extends AbstractFluidEffector {
|
|
|
225
225
|
* @return {number}
|
|
226
226
|
*/
|
|
227
227
|
hash() {
|
|
228
|
-
return
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
228
|
+
return hash_mix3(
|
|
229
|
+
hash_mix3(
|
|
230
|
+
hash_mix3(
|
|
231
|
+
computeHashFloat(this.position[0]),
|
|
232
|
+
computeHashFloat(this.position[1]),
|
|
233
|
+
computeHashFloat(this.position[2])
|
|
234
|
+
),
|
|
235
|
+
computeHashFloat(this.force[0]),
|
|
236
|
+
computeHashFloat(this.force[1])
|
|
237
|
+
),
|
|
234
238
|
computeHashFloat(this.force[2]),
|
|
235
239
|
computeHashFloat(this.radius)
|
|
236
240
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WakeFluidEffector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/WakeFluidEffector.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"WakeFluidEffector.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/physics/fluid/effector/WakeFluidEffector.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH;IAEI;;;;;OAKG;IACH,UAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEb;IAErB;;;;;;OAMG;IACH,mBAFU,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAEJ;IAE9B;;;;;OAKG;IACH,QAFU,MAAM,CAEL;IAEX;;;;;OAKG;IACH,UAFU,MAAM,CAEH;IAoBb;;;;;OAKG;IACH,oBAKC;;CAsSJ;sCAzZqC,4BAA4B"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
2
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
2
3
|
import { v3_matrix4_multiply } from "../../../../core/geom/vec3/v3_matrix4_multiply.js";
|
|
3
4
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
4
5
|
import { AbstractFluidEffector } from "./AbstractFluidEffector.js";
|
|
@@ -368,14 +369,20 @@ export class WakeFluidEffector extends AbstractFluidEffector {
|
|
|
368
369
|
* @return {number}
|
|
369
370
|
*/
|
|
370
371
|
hash() {
|
|
371
|
-
return
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
372
|
+
return hash_mix2(
|
|
373
|
+
hash_mix3(
|
|
374
|
+
hash_mix3(
|
|
375
|
+
hash_mix3(
|
|
376
|
+
computeHashFloat(this.position[0]),
|
|
377
|
+
computeHashFloat(this.position[1]),
|
|
378
|
+
computeHashFloat(this.position[2])
|
|
379
|
+
),
|
|
380
|
+
computeHashFloat(this.previous_position[0]),
|
|
381
|
+
computeHashFloat(this.previous_position[1])
|
|
382
|
+
),
|
|
383
|
+
computeHashFloat(this.previous_position[2]),
|
|
384
|
+
computeHashFloat(this.radius)
|
|
385
|
+
),
|
|
379
386
|
computeHashFloat(this.strength)
|
|
380
387
|
);
|
|
381
388
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioEmitter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/ecs/audio/AudioEmitter.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AudioEmitter.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/ecs/audio/AudioEmitter.js"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AACH;IAgII;;;OAGG;IACH,4BAFa,YAAY,CAMxB;IAtID;;;;;;;;;;;;OAYG;IACH,OAFU,gBAAgB,CAEK;IAE/B;;;OAGG;IACH,QAFU,OAAO,CAEO;IAExB;;;;OAIG;IACH,UAFU,OAAO,CAED;IAEhB;;;;;OAKG;IACH,UAFU,OAAO,CAEA;IAEjB;;;;;OAKG;IACH,cAFU,MAAM,CAEqB;IAErC;;;;;OAKG;IACH,aAFU,mBAAmB,CAEW;IAExC;;;;;;;;;;;;;;;OAeG;IACH,aAFU;QAAC,KAAK,EAAE,OAAO,YAAY,CAAC,CAAA;KAAC,CAIrC;IAEF;;;OAGG;IACH,cAHW,YAAY,GACV,OAAO,CASnB;IAED,eAaC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MASC;IAED,0BAaC;CAWJ;;;;iCAtJgC,4CAA4C;oBAHzD,kCAAkC;oCAElB,oDAAoD;mBAHrE,0CAA0C"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
2
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
2
3
|
import Signal from "../../../../core/events/signal/Signal.js";
|
|
3
4
|
import Vector1 from "../../../../core/geom/Vector1.js";
|
|
4
5
|
import { computeHashFloat } from "../../../../core/primitives/numbers/computeHashFloat.js";
|
|
@@ -104,12 +105,16 @@ export class AudioEmitter {
|
|
|
104
105
|
}
|
|
105
106
|
|
|
106
107
|
hash() {
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
return hash_mix2(
|
|
109
|
+
hash_mix3(
|
|
110
|
+
hash_mix3(
|
|
111
|
+
this.event.hash(),
|
|
112
|
+
this.autoplay ? 1 : 0,
|
|
113
|
+
this.acoustic ? 1 : 0
|
|
114
|
+
),
|
|
115
|
+
computeHashFloat(this.sourceRadius),
|
|
116
|
+
this.directivity.hash()
|
|
117
|
+
),
|
|
113
118
|
computeHashFloat(this.volume.getValue())
|
|
114
119
|
);
|
|
115
120
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioEventTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/ecs/trigger/AudioEventTrigger.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AudioEventTrigger.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/sound/ecs/trigger/AudioEventTrigger.js"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH;IAuBI;;;;;OAKG;IACH,wBALW,MAAM,SACN,gBAAgB,cAChB,MAAM,GAAC,IAAI,GACT,qBAAqB,CAUjC;IAuCD;;;OAGG;IACH,4BAFa,qBAAqB,CAMjC;IAlFD;;;;OAIG;IACH,YAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,WAFU,MAAM,GAAC,IAAI,CAEJ;IAEjB;;;;OAIG;IACH,OAFU,gBAAgB,CAEK;IAkB/B;;;OAGG;IACH,cAHW,qBAAqB,GACnB,OAAO,CAMnB;IAED,eAMC;IAED;;;;;;;;;;;;;;;;;;;;;;;MAMC;IAED,0BASC;CAWJ;AAED;;;;;;;;GAQG;AACH;IAcI;;;OAGG;IACH,mBAHW,qBAAqB,EAAE,GACrB,iBAAiB,CAQ7B;IA6CD;;;OAGG;IACH,4BAFa,iBAAiB,CAM7B;IA3ED;;;;;;;;;OASG;IACH,OAFU,qBAAqB,EAAE,CAEtB;IAcX;;;OAGG;IACH,cAHW,iBAAiB,GACf,OAAO,CAiBnB;IAED,eAUC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;MAIC;IAED,0BAEC;CAWJ;;;;iCA1LgC,4CAA4C"}
|
|
@@ -1,191 +1,192 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* `
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* nothing
|
|
20
|
-
*
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
42
|
-
* @
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
r.
|
|
49
|
-
r.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
* @
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
&& this.
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
this.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
this.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
* @
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
r
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
* @
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
* @
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
* @
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
r
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
|
|
1
|
+
import { hash_mix2 } from "../../../../core/math/hash/hash_mix2.js";
|
|
2
|
+
import { hash_mix3 } from "../../../../core/math/hash/hash_mix3.js";
|
|
3
|
+
import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
|
|
4
|
+
import { EventDescription } from "../../sopra/definition/EventDescription.js";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* One trigger rule: "when this entity receives `startEvent`, play `event`; when it receives
|
|
8
|
+
* `stopEvent`, stop what this rule started".
|
|
9
|
+
*
|
|
10
|
+
* The legacy `SoundController.Rule` carried `tracks[] / loop / volume / channel` alongside its event
|
|
11
|
+
* names, and its system did the picking and the routing at trigger time. Here all four collapse into
|
|
12
|
+
* the {@link EventDescription} itself — a random pick is a `RandomContainerAudioClip`, looping is the
|
|
13
|
+
* clip's own loop flag, volume is `gainDb`, and the channel is `busId`. That is the whole point of the
|
|
14
|
+
* native model: what plays is authored data, not a rule the runtime re-interprets on every trigger.
|
|
15
|
+
*/
|
|
16
|
+
export class AudioEventTriggerRule {
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Entity event name that starts this rule's event. Required — a rule with nothing to start does
|
|
20
|
+
* nothing at all.
|
|
21
|
+
* @type {string}
|
|
22
|
+
*/
|
|
23
|
+
startEvent = "";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Entity event name that stops whatever this rule started, or null for a fire-and-forget rule
|
|
27
|
+
* (a one-shot ends on its own; a looping event then lives until the component unlinks).
|
|
28
|
+
* @type {string|null}
|
|
29
|
+
*/
|
|
30
|
+
stopEvent = null;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The authored event this rule plays. Same data an {@link AudioEmitter} would hold — the difference
|
|
34
|
+
* is only in what makes it sound: linking, versus receiving an entity event.
|
|
35
|
+
* @type {EventDescription}
|
|
36
|
+
*/
|
|
37
|
+
event = new EventDescription();
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @param {string} startEvent
|
|
41
|
+
* @param {EventDescription} event
|
|
42
|
+
* @param {string|null} [stopEvent]
|
|
43
|
+
* @returns {AudioEventTriggerRule}
|
|
44
|
+
*/
|
|
45
|
+
static from(startEvent, event, stopEvent = null) {
|
|
46
|
+
const r = new AudioEventTriggerRule();
|
|
47
|
+
|
|
48
|
+
r.startEvent = startEvent;
|
|
49
|
+
r.event = event;
|
|
50
|
+
r.stopEvent = stopEvent;
|
|
51
|
+
|
|
52
|
+
return r;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @param {AudioEventTriggerRule} other
|
|
57
|
+
* @returns {boolean}
|
|
58
|
+
*/
|
|
59
|
+
equals(other) {
|
|
60
|
+
return this.startEvent === other.startEvent
|
|
61
|
+
&& this.stopEvent === other.stopEvent
|
|
62
|
+
&& this.event.equals(other.event);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
hash() {
|
|
66
|
+
return hash_mix3(
|
|
67
|
+
computeStringHash(this.startEvent),
|
|
68
|
+
this.stopEvent === null ? 0 : computeStringHash(this.stopEvent),
|
|
69
|
+
this.event.hash()
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
toJSON() {
|
|
74
|
+
return {
|
|
75
|
+
startEvent: this.startEvent,
|
|
76
|
+
stopEvent: this.stopEvent,
|
|
77
|
+
event: this.event.toJSON()
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
fromJSON(json) {
|
|
82
|
+
this.startEvent = json.startEvent !== undefined ? json.startEvent : "";
|
|
83
|
+
this.stopEvent = json.stopEvent !== undefined && json.stopEvent !== null ? json.stopEvent : null;
|
|
84
|
+
|
|
85
|
+
this.event = new EventDescription();
|
|
86
|
+
|
|
87
|
+
if (json.event !== undefined) {
|
|
88
|
+
this.event.fromJSON(json.event);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @param {*} json
|
|
94
|
+
* @returns {AudioEventTriggerRule}
|
|
95
|
+
*/
|
|
96
|
+
static fromJSON(json) {
|
|
97
|
+
const r = new AudioEventTriggerRule();
|
|
98
|
+
r.fromJSON(json);
|
|
99
|
+
return r;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Plays authored sopra events in response to entity events — the native replacement for the legacy
|
|
105
|
+
* `SoundController`, whose system wrote `SoundTrack`s into the entity's `SoundEmitter` and so could not
|
|
106
|
+
* outlive it.
|
|
107
|
+
*
|
|
108
|
+
* Where an {@link AudioEmitter} sounds because it was linked, an `AudioEventTrigger` sounds because the
|
|
109
|
+
* entity received an event: "unit took damage" → a hurt sound. Driven by {@link AudioEventTriggerSystem};
|
|
110
|
+
* the entity's {@link Transform} supplies position, exactly as for an emitter.
|
|
111
|
+
*/
|
|
112
|
+
export class AudioEventTrigger {
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Authored rules, evaluated independently — several may listen to the same event, and each owns the
|
|
116
|
+
* instances it started.
|
|
117
|
+
*
|
|
118
|
+
* Read once when the component links: the system registers one entity-event listener per rule then,
|
|
119
|
+
* so mutating this array on a linked component has no effect until it is re-linked (remove and
|
|
120
|
+
* re-add the component), which mirrors {@link AudioEmitter.event}.
|
|
121
|
+
*
|
|
122
|
+
* @type {AudioEventTriggerRule[]}
|
|
123
|
+
*/
|
|
124
|
+
rules = [];
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* @param {AudioEventTriggerRule[]} rules
|
|
128
|
+
* @returns {AudioEventTrigger}
|
|
129
|
+
*/
|
|
130
|
+
static from(rules) {
|
|
131
|
+
const r = new AudioEventTrigger();
|
|
132
|
+
|
|
133
|
+
r.rules = rules;
|
|
134
|
+
|
|
135
|
+
return r;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @param {AudioEventTrigger} other
|
|
140
|
+
* @returns {boolean}
|
|
141
|
+
*/
|
|
142
|
+
equals(other) {
|
|
143
|
+
const rules = this.rules;
|
|
144
|
+
const otherRules = other.rules;
|
|
145
|
+
|
|
146
|
+
if (rules.length !== otherRules.length) {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
for (let i = 0; i < rules.length; i++) {
|
|
151
|
+
if (!rules[i].equals(otherRules[i])) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return true;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
hash() {
|
|
160
|
+
const rules = this.rules;
|
|
161
|
+
|
|
162
|
+
let hash = rules.length;
|
|
163
|
+
|
|
164
|
+
for (let i = 0; i < rules.length; i++) {
|
|
165
|
+
hash = hash_mix2(hash, rules[i].hash());
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
return hash;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
toJSON() {
|
|
172
|
+
return {
|
|
173
|
+
rules: this.rules.map(rule => rule.toJSON())
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
fromJSON(json) {
|
|
178
|
+
this.rules = json.rules === undefined ? [] : json.rules.map(AudioEventTriggerRule.fromJSON);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @param {*} json
|
|
183
|
+
* @returns {AudioEventTrigger}
|
|
184
|
+
*/
|
|
185
|
+
static fromJSON(json) {
|
|
186
|
+
const r = new AudioEventTrigger();
|
|
187
|
+
r.fromJSON(json);
|
|
188
|
+
return r;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
AudioEventTrigger.typeName = "AudioEventTrigger";
|