@woosh/meep-engine 2.33.21 → 2.33.25
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/core/assert.js +3 -1
- package/core/bvh2/BinaryNode.js +1 -1
- package/core/bvh2/aabb3/AABB3.js +18 -0
- package/core/bvh2/aabb3/AABB3Math.js +1 -1
- package/core/bvh2/binary/2/BinaryUint32BVH.js +498 -0
- package/core/bvh2/binary/2/BinaryUint32BVH.spec.js +54 -0
- package/core/bvh2/binary/IndexedBinaryBVH.js +22 -26
- package/core/bvh2/traversal/ThreeClippingPlaneComputingBVHVisitor.js +5 -1
- package/core/bvh2/traversal/__detailed_box_volume_intersection.js +31 -11
- package/core/collection/ArrayUtils.js +1 -1
- package/core/collection/array/arrayQuickSort.js +9 -6
- package/core/collection/array/array_swap.js +22 -0
- package/core/collection/array/binarySearchHighIndex.js +1 -1
- package/core/collection/array/computeHashArray.js +22 -0
- package/core/collection/array/computeHashIntegerArray.js +15 -0
- package/core/collection/array/copyArray.js +2 -2
- package/core/collection/table/DataType2TypedArrayConstructorMapping.js +15 -0
- package/core/color/Color.js +2 -1
- package/core/function/FunctionCompiler.js +2 -1
- package/core/geom/3d/aabb/aabb3_computeDistanceAbovePlane.js +9 -33
- package/core/geom/3d/frustum/frustum3_computeNearestPointToPoint.js +10 -2
- package/core/geom/3d/line/line3_computeSegmentPointDistance_sqr.js +41 -0
- package/core/geom/3d/morton/mortonEncode_magicbits.js +2 -1
- package/core/geom/3d/morton/reinterpret_float32_as_int32.js +13 -0
- package/core/geom/3d/morton/v3_morton_encode_transformed.js +33 -0
- package/core/geom/3d/normal/hemioct/unit_hemioct.spec.js +1 -1
- package/core/geom/3d/plane/plane_computeConvex3PlaneIntersection.js +13 -14
- package/core/geom/3d/ray/ray_computeNearestPointToPoint.js +37 -0
- package/core/geom/3d/shape/AbstractShape3D.js +38 -0
- package/core/geom/3d/shape/CompositeShape.js +240 -0
- package/core/geom/3d/shape/TransformedShape3D.js +126 -0
- package/core/geom/3d/shape/UnitCubeShape3D.js +24 -0
- package/core/geom/3d/shape/UnitSphereShape3D.js +24 -0
- package/core/geom/3d/shape/util/shape_to_visual_entity.js +159 -0
- package/core/geom/3d/voxel/DenseBitVolume3D.js +87 -0
- package/core/geom/3d/voxel/buildVolumeFromProjectedGeometry.js +23 -0
- package/core/geom/AABB2.js +1 -1
- package/core/geom/ConicRay.js +3 -1
- package/core/geom/LineSegment.js +0 -78
- package/core/geom/Matrix4.js +7 -8
- package/core/geom/Plane.js +14 -9
- package/core/geom/Rectangle.js +2 -1
- package/core/geom/Vector1.js +1 -1
- package/core/geom/Vector3.js +2 -1
- package/core/geom/Vector4.js +2 -1
- package/core/geom/random/randomPointInBox.js +7 -3
- package/core/geom/random/randomPointInPoint.js +6 -3
- package/core/geom/random/randomPointInSphere.js +9 -5
- package/core/geom/random/randomPointOnBox.js +7 -3
- package/core/geom/random/randomPointOnSphere.js +6 -3
- package/core/geom/v3_length.js +8 -3
- package/core/graph/graph_k_means_cluster.js +1 -1
- package/core/json/resolvePathByArray.js +2 -2
- package/core/math/MathUtils.js +0 -354
- package/core/math/MathUtils.spec.js +7 -1
- package/core/math/gaussian.js +9 -0
- package/core/math/hash/computeHashFloat.js +17 -0
- package/core/math/hash/computeHashFloatArray.js +34 -0
- package/core/math/hash/computeObjectHash.js +54 -0
- package/core/math/intersects1D.js +19 -0
- package/core/math/interval/NumericInterval.js +2 -2
- package/core/math/isValueBetween.js +10 -0
- package/core/math/isValueBetweenInclusive.js +10 -0
- package/core/math/noise/curl_noise_3dt.js +1 -1
- package/core/math/noise/sdnoise.js +10 -10
- package/core/math/overlap1D.js +19 -0
- package/core/math/pingpong.js +17 -0
- package/core/math/random/makeRangedRandom.js +19 -0
- package/core/math/random/randomFloatBetween.js +14 -0
- package/core/math/random/randomFromArray.js +19 -0
- package/core/math/random/randomGaussian.js +15 -0
- package/core/math/random/randomIntegerBetween.js +14 -0
- package/core/math/random/roundFair.js +15 -0
- package/core/math/separation1D.js +21 -0
- package/core/math/solveQuadratic.js +25 -0
- package/core/model/BoundedValue.js +1 -1
- package/core/model/node-graph/node/NodeInstancePortReference.js +1 -1
- package/core/model/node-graph/node/Port.js +1 -1
- package/core/model/reactive/evaluation/MultiPredicateEvaluator.spec.js +3 -1
- package/core/model/reactive/model/ReactiveBinaryExpression.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveLiteralNumber.js +1 -1
- package/core/model/reactive/model/terminal/ReactiveReference.js +1 -1
- package/core/model/reactive/model/util/createRandomReactiveExpression.js +1 -1
- package/core/model/stat/LinearModifier.js +1 -1
- package/core/primitives/array/computeIntegerArrayHash.js +1 -1
- package/{engine/graphics/render/forward_plus/materials → core/primitives/strings}/insert_after.js +3 -0
- package/core/primitives/strings/insert_after_or_replace.js +27 -0
- package/editor/process/symbolic/makeHelperBoxGeometry.js +44 -0
- package/editor/view/ecs/EntityEditor.js +2 -2
- package/editor/view/ecs/components/particles/ParticleEmitterController.js +2 -2
- package/engine/EngineHarness.js +1 -0
- package/engine/animation/AnimationUtils.js +5 -5
- package/engine/animation/curve/AnimationCurve.js +72 -0
- package/engine/animation/curve/Keyframe.js +27 -0
- package/engine/animation/keyed2/AnimationTrack.js +27 -3
- package/engine/asset/Asset.js +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.d.ts +1 -1
- package/engine/asset/loaders/GLTFAssetLoader.js +10 -0
- package/engine/asset/loaders/image/ImageRGBADataAsset.js +8 -1
- package/engine/asset/loaders/material/computeImageBitmapEquality.js +11 -0
- package/engine/asset/loaders/material/computeImageBitmapHash.js +22 -28
- package/engine/asset/loaders/material/computeMaterialHash.js +3 -1
- package/engine/asset/loaders/material/computeTextureHash.js +2 -1
- package/engine/ecs/EntityBuilder.js +25 -5
- package/engine/ecs/animation/Animation.js +2 -1
- package/engine/ecs/animation/InverseKinematics.js +2 -1
- package/engine/ecs/attachment/AttachmentBinding.js +8 -0
- package/engine/ecs/attachment/AttachmentSystem.js +4 -0
- package/engine/ecs/attachment/TransformAttachmentBinding.js +14 -44
- package/engine/ecs/components/Tag.js +27 -6
- package/engine/ecs/dynamic_actions/DynamicActorSystem.js +2 -1
- package/engine/ecs/dynamic_actions/DynamicRuleDescriptionTable.spec.js +3 -5
- package/engine/ecs/dynamic_actions/actions/definition/WeightedRandomActionDescription.js +1 -1
- package/engine/ecs/evaluation/complex/PointFitnessGaussianBlur.js +1 -1
- package/engine/ecs/foliage/ecs/Foliage2.js +1 -1
- package/engine/ecs/fow/FogOfWar.js +4 -0
- package/engine/ecs/fow/FogOfWarSystem.js +2 -0
- package/engine/ecs/fow/shader/FogOfWarRenderer.js +1 -1
- package/engine/ecs/gui/GUIElement.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplay.js +1 -1
- package/engine/ecs/gui/hud/HeadsUpDisplaySystem.js +2 -0
- package/engine/ecs/gui/position/ViewportPosition.js +2 -1
- package/engine/ecs/system/AbstractContextSystem.js +1 -1
- package/engine/ecs/systems/RangedAttackSystem.js +1 -1
- package/engine/ecs/systems/SteeringSystem.js +1 -1
- package/engine/ecs/systems/TagSystem.js +17 -0
- package/engine/ecs/terrain/tiles/TerrainTileManager.js +1 -1
- package/engine/ecs/tooltip/TooltipComponent.js +15 -0
- package/engine/ecs/transform/Transform.js +19 -6
- package/engine/ecs/util/hideEntityGracefully.js +18 -0
- package/engine/graphics/GraphicsEngine.js +11 -23
- package/engine/graphics/camera/testClippingPlaneComputation.js +2 -2
- package/engine/graphics/composit/CompositLayer.js +17 -4
- package/engine/graphics/composit/CompositingStages.js +8 -0
- package/engine/graphics/composit/LayerCompositer.js +35 -6
- package/engine/graphics/ecs/animation/animator/AnimationClip.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationClipDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotification.js +2 -1
- package/engine/graphics/ecs/animation/animator/AnimationNotificationDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/AnimationGraph.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationGraphDefinition.js +2 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationStateDefinition.js +1 -1
- package/engine/graphics/ecs/animation/animator/graph/definition/AnimationTransitionDefinition.js +2 -1
- package/engine/graphics/ecs/camera/CameraClippingPlaneComputer.js +1 -1
- package/engine/graphics/ecs/highlight/HighlightDefinition.js +2 -1
- package/engine/graphics/ecs/highlight/plugin/OutlineRenderPlugin.js +11 -7
- package/engine/graphics/ecs/light/Light.d.ts +1 -1
- package/engine/graphics/ecs/light/Light.js +5 -0
- package/engine/graphics/ecs/light/binding/three/ThreeLightBinding.js +5 -1
- package/engine/graphics/ecs/mesh/Mesh.js +2 -1
- package/engine/graphics/ecs/mesh-v2/DrawMode.js +5 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.d.ts +13 -0
- package/engine/graphics/ecs/mesh-v2/ShadedGeometry.js +32 -18
- package/engine/graphics/ecs/mesh-v2/ShadedGeometrySystem.d.ts +6 -0
- package/engine/graphics/ecs/path/testPathDisplaySystem.js +98 -98
- package/engine/graphics/ecs/trail2d/Trail2D.js +17 -4
- package/engine/graphics/ecs/trail2d/Trail2DSystem.d.ts +2 -3
- package/engine/graphics/ecs/trail2d/Trail2DSystem.js +34 -118
- package/engine/graphics/geometry/AttributeSpec.js +105 -0
- package/engine/graphics/{micron/format/MicronVertexDataSpec.js → geometry/VertexDataSpec.js} +56 -25
- package/engine/graphics/micron/build/buildMicronGeometryFromBufferGeometry.js +7 -7
- package/engine/graphics/micron/build/fill_patch_geometry_data.js +1 -1
- package/engine/graphics/micron/buildPatchwork.js +1 -1
- package/engine/graphics/micron/format/MicronGeometry.js +3 -3
- package/engine/graphics/micron/format/serialization/MicronGeometryBinarySerializationAdapter.js +2 -2
- package/engine/graphics/micron/format/serialization/deserialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/format/serialization/serialize_attribute_spec.js +1 -1
- package/engine/graphics/micron/render/PatchCacheKey.js +1 -1
- package/engine/graphics/micron/render/instanced/AttributeDataTexture.js +5 -5
- package/engine/graphics/micron/render/v1/ThreeVirtualGeometryAdapter.js +1 -1
- package/engine/graphics/particles/ParticleEmitterLibrary.js +3 -0
- package/engine/graphics/particles/ecs/{ParticleEmitterSystem2.js → ParticleEmitterSystem.js} +17 -9
- package/engine/graphics/particles/particular/engine/ParticularEngine.js +12 -4
- package/engine/graphics/particles/particular/engine/emitter/PARTICULAR_PARTICLE_SPECIFICATION.js +84 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitter.js +106 -169
- package/engine/graphics/particles/particular/engine/emitter/ParticleEmitterFlag.js +5 -0
- package/engine/graphics/particles/particular/engine/emitter/ParticleLayer.js +14 -3
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.js +141 -14
- package/engine/graphics/particles/particular/engine/emitter/ParticlePool.spec.js +8 -7
- package/engine/graphics/particles/particular/engine/emitter/computeEmissionFunction.js +37 -0
- package/engine/graphics/particles/particular/engine/emitter/distance_to_camera.js +25 -0
- package/engine/graphics/particles/particular/engine/emitter/serde/ParameterLookupTableSerializationAdapter.js +8 -2
- package/engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js +2 -1
- package/engine/graphics/particles/particular/engine/parameter/ParameterTrack.js +1 -1
- package/engine/graphics/particles/particular/engine/parameter/ParticleParameter.js +1 -1
- package/engine/graphics/particles/particular/engine/renderers/billboard/BILLBOARD_PARTICLE_SPECIFICATION.js +24 -0
- package/engine/graphics/particles/particular/engine/renderers/billboard/ParticleBillboardMaterial.js +262 -71
- package/engine/graphics/particles/particular/engine/renderers/billboard/prototypeBillboardRenderer.js +9 -9
- package/engine/graphics/particles/particular/engine/shader/ShaderManager.js +80 -46
- package/engine/graphics/particles/particular/engine/shader/debugAtlas.js +14 -0
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepApplyForce.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseAcceleration.js +2 -6
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepCurlNoiseVelocity.js +2 -7
- package/engine/graphics/particles/particular/engine/simulator/SimulationStepFixedPhysics.js +2 -5
- package/engine/graphics/particles/particular/engine/simulator/update_parameters.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distributeParticlesOnObject3D.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/distrubuteParticlesOnMesh.js +1 -1
- package/engine/graphics/particles/particular/engine/utils/volume/AttributeValue.js +141 -0
- package/engine/graphics/particles/particular/engine/utils/volume/ParticleVolume.js +478 -0
- package/engine/graphics/particles/particular/engine/utils/volume/lut_to_sampler.js +27 -0
- package/engine/graphics/particles/particular/engine/utils/volume/prototypeParticleVolume.js +935 -0
- package/engine/graphics/particles/particular/group/Operation.js +18 -0
- package/engine/graphics/particles/particular/group/OperationType.js +9 -0
- package/engine/graphics/particles/particular/group/ParticleAttribute.js +2 -1
- package/engine/graphics/particles/particular/group/ParticleAttributeType.js +11 -0
- package/engine/graphics/particles/particular/group/ParticleDataType.js +10 -0
- package/engine/graphics/particles/particular/group/ParticleGroup.js +7 -245
- package/engine/graphics/particles/particular/group/ParticleGroup.spec.js +3 -1
- package/engine/graphics/particles/particular/group/ParticleSpecification.js +21 -14
- package/engine/graphics/particles/particular/group/itemSizeFromAttributeType.js +20 -0
- package/engine/graphics/particles/particular/group/optimizeCommandQueue.js +162 -0
- package/engine/graphics/particles/particular/group/typedArrayConstructorFromDataType.js +19 -0
- package/engine/graphics/render/buffer/buffers/prototypeNormalFrameBuffer.js +2 -2
- package/engine/graphics/render/buffer/simple-fx/ao/AmbientOcclusionPostProcessEffect.js +13 -7
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameter.js +2 -1
- package/engine/graphics/render/buffer/slot/parameter/ProgramValueSlotParameterSet.js +1 -1
- package/engine/graphics/render/forward_plus/LightManager.js +126 -95
- package/engine/graphics/render/forward_plus/PointLight.js +9 -0
- package/engine/graphics/render/forward_plus/PointLightData.js +1 -1
- package/engine/graphics/render/forward_plus/SpotLight.js +9 -0
- package/engine/graphics/render/forward_plus/cluster/compute_light_data_hash_0.js +2 -2
- package/engine/graphics/render/forward_plus/computeFrustumCorners.js +14 -32
- package/engine/graphics/render/forward_plus/materials/FP_INJECTION_POINT_ACCUMULATION.js +1 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_ACCUMULATION.js +32 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_DECODE_PARS.js +51 -0
- package/engine/graphics/render/forward_plus/materials/FP_SHADER_CHUNK_PREAMBLE.js +25 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_fragment_shader.js +31 -120
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_lighting_shared.js +35 -0
- package/engine/graphics/render/forward_plus/materials/fp_build_vertex_shader.js +4 -5
- package/engine/graphics/render/forward_plus/plugin/ForwardPlusRenderingPlugin.js +1 -1
- package/engine/graphics/render/forward_plus/plugin/MaterialTransformer.js +10 -3
- package/engine/graphics/render/forward_plus/plugin/ptototypeFPPlugin.js +595 -60
- package/engine/graphics/render/forward_plus/prototypeLightManager.js +256 -136
- package/engine/graphics/render/forward_plus/query/analytical_triplanar_corner_mapping.js +8 -0
- package/engine/graphics/render/forward_plus/query/cube_mapping.js +38 -0
- package/engine/graphics/render/forward_plus/query/detailed_sphere_frustum_intersection_test.js +86 -0
- package/engine/graphics/render/forward_plus/query/point_light_inside_volume.js +73 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_objects.js +131 -0
- package/engine/graphics/render/forward_plus/query/query_bvh_frustum_from_texture.js +129 -0
- package/engine/graphics/render/forward_plus/query/spot_light_inside_volume.js +33 -0
- package/engine/graphics/render/forward_plus/read_frustum_corner.js +14 -0
- package/engine/graphics/render/forward_plus/testClusterEquality.js +22 -0
- package/engine/graphics/render/layers/RenderLayerUtils.js +7 -4
- package/engine/graphics/render/visibility/IncrementalDeltaSet.js +11 -0
- package/engine/graphics/render/visibility/hiz/prototypeHiZ.js +2 -2
- package/engine/graphics/shaders/TerrainShader.js +4 -5
- package/engine/graphics/texture/atlas/AtlasPatch.js +7 -2
- package/engine/graphics/texture/atlas/TextureAtlas.js +2 -2
- package/engine/graphics/texture/sampler/HarmonicDiffusionGrid.spec.js +1 -1
- package/engine/graphics/texture/sampler/SampleTraverser.js +1 -1
- package/engine/graphics/texture/sampler/Sampler2D.js +8 -7
- package/engine/graphics/texture/sampler/distanceField.spec.js +1 -1
- package/engine/graphics/texture/sampler/scaleSampler2D.js +7 -10
- package/engine/graphics/trail/x/RibbonMaterialX.js +3 -3
- package/engine/graphics/trail/x/RibbonX.js +17 -2
- package/engine/graphics/trail/x/RibbonXPlugin.js +51 -1
- package/engine/graphics/util/composeMatrix4.js +33 -23
- package/engine/graphics/util/decompose_matrix_4_array.js +61 -0
- package/engine/grid/components/GridObstacle.js +3 -10
- package/engine/intelligence/behavior/ecs/BehaviorComponent.js +30 -14
- package/engine/intelligence/behavior/selector/WeightedElement.js +2 -1
- package/engine/intelligence/optimization/RandomOptimizer.js +1 -1
- package/engine/knowledge/database/StaticKnowledgeDataTable.js +6 -1
- package/engine/navigation/ecs/components/Path.js +1 -6
- package/engine/navigation/grid/FastBinaryHeap.spec.js +1 -1
- package/engine/reference/v2/Reference.js +6 -0
- package/engine/sound/ecs/emitter/SoundEmitter.js +2 -1
- package/engine/sound/ecs/emitter/SoundTrack.js +2 -1
- package/engine/sound/material/concrete/RandomSoundMaterial.js +1 -1
- package/engine/ui/notification/notificationGenerator.js +1 -1
- package/generation/filtering/numeric/complex/CellFilterGaussianBlur.js +1 -1
- package/generation/grid/generation/GridTaskExecuteRuleTimes.js +2 -1
- package/generation/markers/actions/MarkerNodeActionSelectRandom.js +1 -1
- package/generation/markers/transform/MarkerNodeTransformerRecordUniqueRandomEnum.js +1 -1
- package/generation/placement/action/random/CellActionSelectRandom.js +1 -1
- package/generation/theme/ThemeEngine.js +2 -2
- package/misc/makeMaterialIconCached.js +2 -2
- package/package.json +3 -3
- package/view/View.js +4 -2
- package/view/elements/image/HTMLElementCacheKey.js +2 -1
- package/view/elements/radial/RadialText.js +2 -1
- package/view/minimap/gl/MinimapMarkersGL.js +6 -100
- package/view/minimap/gl/buildMaterial.js +94 -0
- package/engine/graphics/micron/format/MicronGeometryBufferAttributeSpec.js +0 -71
- package/engine/graphics/render/forward_plus/queryBVH_Frustum.js +0 -345
|
@@ -3,7 +3,6 @@ import List from "../../../../../../core/collection/list/List.js";
|
|
|
3
3
|
import { lerp } from "../../../../../../core/math/lerp.js";
|
|
4
4
|
import { max2 } from "../../../../../../core/math/max2.js";
|
|
5
5
|
import { min2 } from "../../../../../../core/math/min2.js";
|
|
6
|
-
import { ParticleAttributeType, ParticleDataType } from "../../group/ParticleGroup.js";
|
|
7
6
|
import { Box3, BufferGeometry, Frustum, Matrix4, Points, PointsMaterial } from 'three';
|
|
8
7
|
import { frustumFromCamera } from "../../../../ecs/camera/CameraSystem.js";
|
|
9
8
|
import { ParticlePool } from "./ParticlePool.js";
|
|
@@ -15,9 +14,6 @@ import { ParticleLayer } from "./ParticleLayer.js";
|
|
|
15
14
|
import { ParticleParameters } from "./ParticleParameters.js";
|
|
16
15
|
import { BlendingType } from "../../../../texture/sampler/BlendingType.js";
|
|
17
16
|
import Quaternion from "../../../../../../core/geom/Quaternion.js";
|
|
18
|
-
import { computeHashIntegerArray } from "../../../../../../core/math/MathUtils.js";
|
|
19
|
-
import { ParticleSpecification } from "../../group/ParticleSpecification.js";
|
|
20
|
-
import { ParticleAttribute } from "../../group/ParticleAttribute.js";
|
|
21
17
|
import { ParticleEmitterFlag } from "./ParticleEmitterFlag.js";
|
|
22
18
|
import { AABB3 } from "../../../../../../core/bvh2/aabb3/AABB3.js";
|
|
23
19
|
import {
|
|
@@ -34,14 +30,11 @@ import {
|
|
|
34
30
|
PARTICLE_ATTRIBUTE_VELOCITY
|
|
35
31
|
} from "./PARTICLE_ATTRIBUTES.js";
|
|
36
32
|
import { composeMatrix4 } from "../../../../util/composeMatrix4.js";
|
|
37
|
-
import { randomPointInPoint } from "../../../../../../core/geom/random/randomPointInPoint.js";
|
|
38
|
-
import { randomPointInSphere } from "../../../../../../core/geom/random/randomPointInSphere.js";
|
|
39
|
-
import { randomPointOnSphere } from "../../../../../../core/geom/random/randomPointOnSphere.js";
|
|
40
|
-
import { randomPointInBox } from "../../../../../../core/geom/random/randomPointInBox.js";
|
|
41
|
-
import { randomPointOnBox } from "../../../../../../core/geom/random/randomPointOnBox.js";
|
|
42
|
-
import { EmissionFromType } from "./EmissionFromType.js";
|
|
43
|
-
import { EmissionShapeType } from "./EmissionShapeType.js";
|
|
44
33
|
import { update_parameters } from "../simulator/update_parameters.js";
|
|
34
|
+
import { distance_to_camera } from "./distance_to_camera.js";
|
|
35
|
+
import { computeEmissionFunction } from "./computeEmissionFunction.js";
|
|
36
|
+
import { PARTICULAR_PARTICLE_SPECIFICATION } from "./PARTICULAR_PARTICLE_SPECIFICATION.js";
|
|
37
|
+
import { computeHashIntegerArray } from "../../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
45
38
|
|
|
46
39
|
const EMPTY_GEOMETRY = new BufferGeometry();
|
|
47
40
|
|
|
@@ -68,57 +61,9 @@ const scratch_array = [];
|
|
|
68
61
|
|
|
69
62
|
/**
|
|
70
63
|
*
|
|
71
|
-
* @
|
|
72
|
-
* @param {EmissionShapeType} emissionShape
|
|
73
|
-
* @returns {function(random: function, result:Vector3):void}
|
|
74
|
-
*/
|
|
75
|
-
function computeEmissionFunction(emissionType, emissionShape) {
|
|
76
|
-
if (emissionShape === EmissionShapeType.Point) {
|
|
77
|
-
return randomPointInPoint;
|
|
78
|
-
} else if (emissionShape === EmissionShapeType.Sphere) {
|
|
79
|
-
if (emissionType === EmissionFromType.Volume) {
|
|
80
|
-
return randomPointInSphere;
|
|
81
|
-
} else if (emissionType === EmissionFromType.Shell) {
|
|
82
|
-
return randomPointOnSphere;
|
|
83
|
-
} else {
|
|
84
|
-
throw new TypeError(`Unsupported EmissionFrom Type`);
|
|
85
|
-
}
|
|
86
|
-
} else if (emissionShape === EmissionShapeType.Box) {
|
|
87
|
-
if (emissionType === EmissionFromType.Volume) {
|
|
88
|
-
return randomPointInBox;
|
|
89
|
-
} else if (emissionType === EmissionFromType.Shell) {
|
|
90
|
-
return randomPointOnBox;
|
|
91
|
-
} else {
|
|
92
|
-
throw new TypeError(`Unsupported EmissionFrom Type`);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
99
|
-
* @param {number} index
|
|
100
|
-
* @param {number[]|Float32Array} positionArray
|
|
101
|
-
* @param {Vector3} planeNormal
|
|
102
|
-
* @return {number}
|
|
64
|
+
* @type {number[]}
|
|
103
65
|
*/
|
|
104
|
-
|
|
105
|
-
const address = index * 3;
|
|
106
|
-
|
|
107
|
-
// extract position components of the particle
|
|
108
|
-
const x = positionArray[address];
|
|
109
|
-
const y = positionArray[address + 1];
|
|
110
|
-
const z = positionArray[address + 2];
|
|
111
|
-
|
|
112
|
-
const planeNormalX = planeNormal.x;
|
|
113
|
-
const planeNormalY = planeNormal.y;
|
|
114
|
-
const planeNormalZ = planeNormal.z;
|
|
115
|
-
|
|
116
|
-
// compute dot product
|
|
117
|
-
const dot = x * planeNormalX + y * planeNormalY + z * planeNormalZ;
|
|
118
|
-
|
|
119
|
-
// use dot product instead of the actual distance to save computation. Difference is going to be constant
|
|
120
|
-
return dot;
|
|
121
|
-
}
|
|
66
|
+
const scratch_v3_array = [];
|
|
122
67
|
|
|
123
68
|
/**
|
|
124
69
|
*
|
|
@@ -135,6 +80,35 @@ function generateStandardParameterSet(parameters) {
|
|
|
135
80
|
parameters.add(pColor);
|
|
136
81
|
}
|
|
137
82
|
|
|
83
|
+
|
|
84
|
+
const uint16_mul = 65536;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
*
|
|
88
|
+
* @param {AtlasPatch} atlasPatch
|
|
89
|
+
* @param {ParticlePool} particles
|
|
90
|
+
* @param {number} ref
|
|
91
|
+
*/
|
|
92
|
+
function write_particle_patch_uv(atlasPatch, particles, ref) {
|
|
93
|
+
const uv = atlasPatch.uv;
|
|
94
|
+
|
|
95
|
+
const uv_position = uv.position;
|
|
96
|
+
|
|
97
|
+
const u0 = uv_position.x;
|
|
98
|
+
const v0 = uv_position.y;
|
|
99
|
+
|
|
100
|
+
const uv_size = uv.size;
|
|
101
|
+
|
|
102
|
+
const u1 = uv_size.x;
|
|
103
|
+
const v1 = uv_size.y;
|
|
104
|
+
|
|
105
|
+
particles.writeAttributeVector4(
|
|
106
|
+
ref,
|
|
107
|
+
PARTICLE_ATTRIBUTE_UV,
|
|
108
|
+
u0 * uint16_mul, v0 * uint16_mul, u1 * uint16_mul, v1 * uint16_mul
|
|
109
|
+
);
|
|
110
|
+
}
|
|
111
|
+
|
|
138
112
|
export class ParticleEmitter {
|
|
139
113
|
constructor() {
|
|
140
114
|
/**
|
|
@@ -297,6 +271,8 @@ export class ParticleEmitter {
|
|
|
297
271
|
readDepth: !this.getFlag(ParticleEmitterFlag.DepthReadDisabled),
|
|
298
272
|
softDepth: !this.getFlag(ParticleEmitterFlag.DepthSoftDisabled),
|
|
299
273
|
velocityAlign: this.getFlag(ParticleEmitterFlag.AlignOnVelocity),
|
|
274
|
+
depthSort: this.getFlag(ParticleEmitterFlag.DepthSorting),
|
|
275
|
+
receiveLight: this.getFlag(ParticleEmitterFlag.Lit),
|
|
300
276
|
blendingMode: this.blendingMode,
|
|
301
277
|
layers: this.layers.toJSON()
|
|
302
278
|
};
|
|
@@ -349,6 +325,18 @@ export class ParticleEmitter {
|
|
|
349
325
|
this.writeFlag(ParticleEmitterFlag.AlignOnVelocity, false);
|
|
350
326
|
}
|
|
351
327
|
|
|
328
|
+
if (typeof json.depthSort === "boolean") {
|
|
329
|
+
this.writeFlag(ParticleEmitterFlag.DepthSorting, json.depthSort);
|
|
330
|
+
} else {
|
|
331
|
+
this.writeFlag(ParticleEmitterFlag.DepthSorting, true);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (typeof json.receiveLight === "boolean") {
|
|
335
|
+
this.writeFlag(ParticleEmitterFlag.Lit, json.receiveLight);
|
|
336
|
+
} else {
|
|
337
|
+
this.clearFlag(ParticleEmitterFlag.Lit);
|
|
338
|
+
}
|
|
339
|
+
|
|
352
340
|
this.layers.fromJSON(json.layers, ParticleLayer);
|
|
353
341
|
|
|
354
342
|
this.writeFlag(ParticleEmitterFlag.Built, false);
|
|
@@ -404,19 +392,20 @@ export class ParticleEmitter {
|
|
|
404
392
|
throw new Error('Layer not found');
|
|
405
393
|
}
|
|
406
394
|
|
|
407
|
-
const numLayers = layers.length;
|
|
408
|
-
|
|
409
395
|
const particles = this.particles;
|
|
410
396
|
const occupancy = particles.occupancy;
|
|
411
397
|
|
|
412
398
|
let removeCount = 0;
|
|
413
399
|
|
|
414
|
-
for (
|
|
415
|
-
|
|
400
|
+
for (
|
|
401
|
+
let i = occupancy.nextSetBit(0);
|
|
402
|
+
i !== -1;
|
|
403
|
+
i = occupancy.nextSetBit(i + 1)
|
|
404
|
+
) {
|
|
416
405
|
|
|
417
|
-
const
|
|
406
|
+
const layerPosition = particles.readAttributeScalar(i, PARTICLE_ATTRIBUTE_LAYER_POSITION);
|
|
418
407
|
|
|
419
|
-
if (
|
|
408
|
+
if (layerPosition !== targetLayerIndex) {
|
|
420
409
|
// not the layer we want
|
|
421
410
|
continue;
|
|
422
411
|
}
|
|
@@ -425,6 +414,7 @@ export class ParticleEmitter {
|
|
|
425
414
|
occupancy.set(i, false);
|
|
426
415
|
|
|
427
416
|
removeCount++;
|
|
417
|
+
|
|
428
418
|
}
|
|
429
419
|
|
|
430
420
|
if (removeCount > 0) {
|
|
@@ -489,7 +479,10 @@ export class ParticleEmitter {
|
|
|
489
479
|
}
|
|
490
480
|
}
|
|
491
481
|
|
|
492
|
-
this.emisionBounds.setBounds(
|
|
482
|
+
this.emisionBounds.setBounds(
|
|
483
|
+
bounds_x0, bounds_y0, bounds_z0,
|
|
484
|
+
bounds_x1, bounds_y1, bounds_z1
|
|
485
|
+
);
|
|
493
486
|
|
|
494
487
|
this.clearFlag(ParticleEmitterFlag.BaseBoundsNeedUpdate);
|
|
495
488
|
}
|
|
@@ -498,33 +491,15 @@ export class ParticleEmitter {
|
|
|
498
491
|
//retire dead particles
|
|
499
492
|
const particles = this.particles;
|
|
500
493
|
|
|
501
|
-
|
|
494
|
+
particles.computeAttributeVector3AxisAlignedBoundingBox(PARTICLE_ATTRIBUTE_POSITION, scratch_array);
|
|
502
495
|
|
|
503
|
-
let bounds_x0 =
|
|
504
|
-
let bounds_y0 =
|
|
505
|
-
let bounds_z0 =
|
|
496
|
+
let bounds_x0 = scratch_array[0];
|
|
497
|
+
let bounds_y0 = scratch_array[1];
|
|
498
|
+
let bounds_z0 = scratch_array[2];
|
|
506
499
|
|
|
507
|
-
let bounds_x1 =
|
|
508
|
-
let bounds_y1 =
|
|
509
|
-
let bounds_z1 =
|
|
510
|
-
|
|
511
|
-
for (let i = 0; i < liveParticleCount; i++) {
|
|
512
|
-
|
|
513
|
-
particles.readAttributeVector3(i, PARTICLE_ATTRIBUTE_POSITION, position);
|
|
514
|
-
|
|
515
|
-
const p_x = position[0];
|
|
516
|
-
const p_y = position[1];
|
|
517
|
-
const p_z = position[2];
|
|
518
|
-
|
|
519
|
-
//update bounds
|
|
520
|
-
bounds_x0 = min2(bounds_x0, p_x);
|
|
521
|
-
bounds_y0 = min2(bounds_y0, p_y);
|
|
522
|
-
bounds_z0 = min2(bounds_z0, p_z);
|
|
523
|
-
|
|
524
|
-
bounds_x1 = max2(bounds_x1, p_x);
|
|
525
|
-
bounds_y1 = max2(bounds_y1, p_y);
|
|
526
|
-
bounds_z1 = max2(bounds_z1, p_z);
|
|
527
|
-
}
|
|
500
|
+
let bounds_x1 = scratch_array[3];
|
|
501
|
+
let bounds_y1 = scratch_array[4];
|
|
502
|
+
let bounds_z1 = scratch_array[5];
|
|
528
503
|
|
|
529
504
|
//expand bounds by maximum sprite size
|
|
530
505
|
const extents = this.computeSpriteMaxHalfSize();
|
|
@@ -708,8 +683,8 @@ export class ParticleEmitter {
|
|
|
708
683
|
}
|
|
709
684
|
|
|
710
685
|
computeHash() {
|
|
711
|
-
const
|
|
712
|
-
const
|
|
686
|
+
const parameters_hash = this.parameters.hash();
|
|
687
|
+
const layers_hash = this.layers.hash();
|
|
713
688
|
|
|
714
689
|
/**
|
|
715
690
|
* Extract relevant flags
|
|
@@ -717,7 +692,12 @@ export class ParticleEmitter {
|
|
|
717
692
|
*/
|
|
718
693
|
const flags = this.flags & (SERIALIZABLE_FLAGS);
|
|
719
694
|
|
|
720
|
-
return computeHashIntegerArray(
|
|
695
|
+
return computeHashIntegerArray(
|
|
696
|
+
parameters_hash,
|
|
697
|
+
layers_hash,
|
|
698
|
+
this.blendingMode,
|
|
699
|
+
flags
|
|
700
|
+
);
|
|
721
701
|
}
|
|
722
702
|
|
|
723
703
|
hash() {
|
|
@@ -799,14 +779,19 @@ export class ParticleEmitter {
|
|
|
799
779
|
|
|
800
780
|
const pivotIndex = (left + right) >> 1;
|
|
801
781
|
|
|
802
|
-
const pivot =
|
|
782
|
+
const pivot = distance_to_camera(pivotIndex, positionArray, nearPlaneNormal);
|
|
803
783
|
|
|
804
784
|
/* partition */
|
|
805
785
|
while (i <= j) {
|
|
806
|
-
|
|
786
|
+
|
|
787
|
+
while (distance_to_camera(i, positionArray, nearPlaneNormal) > pivot) {
|
|
807
788
|
i++;
|
|
808
|
-
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
while (distance_to_camera(j, positionArray, nearPlaneNormal) < pivot) {
|
|
809
792
|
j--;
|
|
793
|
+
}
|
|
794
|
+
|
|
810
795
|
if (i <= j) {
|
|
811
796
|
|
|
812
797
|
if (i !== j) {
|
|
@@ -879,29 +864,19 @@ export class ParticleEmitter {
|
|
|
879
864
|
|
|
880
865
|
const layers = this.layers;
|
|
881
866
|
|
|
882
|
-
const numLayers = layers.length;
|
|
883
|
-
|
|
884
867
|
let missingFlag = false;
|
|
885
868
|
|
|
886
869
|
//cycle through each particle
|
|
887
870
|
for (let i = occupancy.nextSetBit(0); i !== -1; i = occupancy.nextSetBit(i + 1)) {
|
|
888
|
-
const
|
|
889
|
-
|
|
890
|
-
const layerIndex = Math.round(layerPosition * numLayers);
|
|
871
|
+
const layerIndex = particles.readAttributeScalar(i, PARTICLE_ATTRIBUTE_LAYER_POSITION);
|
|
891
872
|
|
|
892
873
|
const layer = layers.get(layerIndex);
|
|
893
874
|
|
|
894
875
|
const atlasPatch = layer.__atlasPatch;
|
|
895
876
|
|
|
896
877
|
if (atlasPatch !== null) {
|
|
897
|
-
const uv = atlasPatch.uv;
|
|
898
|
-
|
|
899
|
-
const u0 = uv.position.x;
|
|
900
|
-
const v0 = uv.position.y;
|
|
901
|
-
const u1 = uv.size.x;
|
|
902
|
-
const v1 = uv.size.y;
|
|
903
878
|
|
|
904
|
-
|
|
879
|
+
write_particle_patch_uv(atlasPatch, particles, i);
|
|
905
880
|
} else {
|
|
906
881
|
missingFlag = true;
|
|
907
882
|
}
|
|
@@ -933,8 +908,6 @@ export class ParticleEmitter {
|
|
|
933
908
|
|
|
934
909
|
const emissionPeriod = 1 / layer.emissionRate;
|
|
935
910
|
|
|
936
|
-
const layerPosition = layerIndex / this.layers.length;
|
|
937
|
-
|
|
938
911
|
//compute transform matrix of the emitter
|
|
939
912
|
const emitter_position = this.position;
|
|
940
913
|
const last_spawn_position = this.__lastSpawnPosition;
|
|
@@ -952,7 +925,9 @@ export class ParticleEmitter {
|
|
|
952
925
|
const f = time / timeDelta;
|
|
953
926
|
|
|
954
927
|
//compute position for particle
|
|
955
|
-
emissionFunction(random,
|
|
928
|
+
emissionFunction(random, scratch_v3_array, 0);
|
|
929
|
+
|
|
930
|
+
v3position.readFromArray(scratch_v3_array, 0);
|
|
956
931
|
|
|
957
932
|
//apply layer transform
|
|
958
933
|
v3position.multiply(layer.scale);
|
|
@@ -1011,28 +986,17 @@ export class ParticleEmitter {
|
|
|
1011
986
|
//write UV
|
|
1012
987
|
const atlasPatch = layer.__atlasPatch;
|
|
1013
988
|
if (atlasPatch !== null) {
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
const uv_position = uv.position;
|
|
1017
|
-
|
|
1018
|
-
const u0 = uv_position.x;
|
|
1019
|
-
const v0 = uv_position.y;
|
|
1020
|
-
|
|
1021
|
-
const uv_size = uv.size;
|
|
1022
|
-
|
|
1023
|
-
const u1 = uv_size.x;
|
|
1024
|
-
const v1 = uv_size.y;
|
|
1025
|
-
|
|
1026
|
-
particles.writeAttributeVector4(ref, PARTICLE_ATTRIBUTE_UV, u0, v0, u1, v1);
|
|
989
|
+
//patch exists, write it
|
|
990
|
+
write_particle_patch_uv(atlasPatch, particles, ref);
|
|
1027
991
|
} else {
|
|
1028
992
|
this.setFlag(ParticleEmitterFlag.SpritesNeedUpdate);
|
|
1029
993
|
}
|
|
1030
994
|
|
|
1031
|
-
particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_LAYER_POSITION,
|
|
995
|
+
particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_LAYER_POSITION, layerIndex);
|
|
1032
996
|
|
|
1033
997
|
update_parameters(ref, particles, layer, initialAge / deathAge);
|
|
1034
998
|
|
|
1035
|
-
particles.writeAttributeScalar(ref,PARTICLE_ATTRIBUTE_BLEND,this.blendingMode);
|
|
999
|
+
particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_BLEND, this.blendingMode);
|
|
1036
1000
|
}
|
|
1037
1001
|
|
|
1038
1002
|
//update time buffer
|
|
@@ -1051,9 +1015,11 @@ export class ParticleEmitter {
|
|
|
1051
1015
|
return;
|
|
1052
1016
|
}
|
|
1053
1017
|
|
|
1054
|
-
|
|
1018
|
+
const layers = this.layers;
|
|
1055
1019
|
|
|
1056
|
-
|
|
1020
|
+
assert.ok(layerIndex < layers.length && layerIndex >= 0, `layerIndex[=${layerIndex}] is out of bounds`);
|
|
1021
|
+
|
|
1022
|
+
const layer = layers.get(layerIndex);
|
|
1057
1023
|
|
|
1058
1024
|
const random = Math.random;
|
|
1059
1025
|
|
|
@@ -1065,8 +1031,6 @@ export class ParticleEmitter {
|
|
|
1065
1031
|
|
|
1066
1032
|
const emissionFunction = computeEmissionFunction(layer.emissionFrom, layer.emissionShape);
|
|
1067
1033
|
|
|
1068
|
-
const layerPosition = layerIndex / this.layers.length;
|
|
1069
|
-
|
|
1070
1034
|
//compute transform matrix of the emitter
|
|
1071
1035
|
composeMatrix4(matrix4, this.position, this.rotation, this.scale);
|
|
1072
1036
|
|
|
@@ -1079,7 +1043,9 @@ export class ParticleEmitter {
|
|
|
1079
1043
|
const ref = particles.create();
|
|
1080
1044
|
|
|
1081
1045
|
//compute position for particle
|
|
1082
|
-
emissionFunction(random,
|
|
1046
|
+
emissionFunction(random, scratch_v3_array, 0);
|
|
1047
|
+
|
|
1048
|
+
v3position.readFromArray(scratch_v3_array, 0);
|
|
1083
1049
|
|
|
1084
1050
|
//apply layer transform
|
|
1085
1051
|
v3position.multiply(layer.scale);
|
|
@@ -1137,29 +1103,17 @@ export class ParticleEmitter {
|
|
|
1137
1103
|
|
|
1138
1104
|
if (atlasPatch !== null) {
|
|
1139
1105
|
//patch exists, write it
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
const uv_position = uv.position;
|
|
1143
|
-
|
|
1144
|
-
const u0 = uv_position.x;
|
|
1145
|
-
const v0 = uv_position.y;
|
|
1146
|
-
|
|
1147
|
-
const uv_size = uv.size;
|
|
1148
|
-
|
|
1149
|
-
const u1 = uv_size.x;
|
|
1150
|
-
const v1 = uv_size.y;
|
|
1151
|
-
|
|
1152
|
-
particles.writeAttributeVector4(ref, PARTICLE_ATTRIBUTE_UV, u0, v0, u1, v1);
|
|
1106
|
+
write_particle_patch_uv(atlasPatch, particles, ref);
|
|
1153
1107
|
} else {
|
|
1154
1108
|
//patch is not loaded yet, request update
|
|
1155
1109
|
spritesNeedUpdate = true;
|
|
1156
1110
|
}
|
|
1157
1111
|
|
|
1158
|
-
particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_LAYER_POSITION,
|
|
1112
|
+
particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_LAYER_POSITION, layerIndex);
|
|
1159
1113
|
|
|
1160
1114
|
update_parameters(ref, particles, layer, initialAge / deathAge);
|
|
1161
1115
|
|
|
1162
|
-
particles.writeAttributeScalar(ref,PARTICLE_ATTRIBUTE_BLEND,this.blendingMode);
|
|
1116
|
+
particles.writeAttributeScalar(ref, PARTICLE_ATTRIBUTE_BLEND, this.blendingMode);
|
|
1163
1117
|
}
|
|
1164
1118
|
|
|
1165
1119
|
if (spritesNeedUpdate) {
|
|
@@ -1197,7 +1151,9 @@ export class ParticleEmitter {
|
|
|
1197
1151
|
continue;
|
|
1198
1152
|
}
|
|
1199
1153
|
|
|
1200
|
-
const
|
|
1154
|
+
const particleLife = layer.particleLife;
|
|
1155
|
+
|
|
1156
|
+
const averageLifetime = (particleLife.max + particleLife.min) / 2;
|
|
1201
1157
|
|
|
1202
1158
|
//emitting more than averageLifetime lifetime is unproductive, so we'll crop the emission
|
|
1203
1159
|
let emissionDelta;
|
|
@@ -1260,27 +1216,8 @@ const matrix4 = new Matrix4();
|
|
|
1260
1216
|
|
|
1261
1217
|
const defaultPointsMaterial = new PointsMaterial({ color: 0xFFFFFF });
|
|
1262
1218
|
|
|
1263
|
-
|
|
1264
|
-
//build particle spec
|
|
1265
|
-
export const PARTICULAR_PARTICLE_SPECIFICATION = new ParticleSpecification();
|
|
1266
|
-
|
|
1267
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('position', ParticleAttributeType.Vector3, ParticleDataType.Float32));
|
|
1268
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('age', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1269
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('deathAge', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1270
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('atlasPatch', ParticleAttributeType.Vector4, ParticleDataType.Float32));
|
|
1271
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('size', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1272
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('layerPosition', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1273
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('velocity', ParticleAttributeType.Vector3, ParticleDataType.Float32));
|
|
1274
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('rotation', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1275
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('rotationSpeed', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1276
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('color', ParticleAttributeType.Vector4, ParticleDataType.Float32));
|
|
1277
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('blending', ParticleAttributeType.Scalar, ParticleDataType.Uint8));
|
|
1278
|
-
PARTICULAR_PARTICLE_SPECIFICATION.add(new ParticleAttribute('size_initial', ParticleAttributeType.Scalar, ParticleDataType.Float32));
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
1219
|
const frustum = new Frustum();
|
|
1282
1220
|
|
|
1283
|
-
const velocity = [];
|
|
1284
1221
|
const position = [];
|
|
1285
1222
|
|
|
1286
1223
|
const v3position = new Vector3();
|
|
@@ -3,7 +3,6 @@ import { NumericInterval } from "../../../../../../core/math/interval/NumericInt
|
|
|
3
3
|
import { ParameterTrackSet } from "../parameter/ParameterTrackSet.js";
|
|
4
4
|
import { AABB3 } from "../../../../../../core/bvh2/aabb3/AABB3.js";
|
|
5
5
|
import { ParticleParameters } from "./ParticleParameters.js";
|
|
6
|
-
import { computeHashFloat, computeHashIntegerArray } from "../../../../../../core/math/MathUtils.js";
|
|
7
6
|
import { ConicRay } from "../../../../../../core/geom/ConicRay.js";
|
|
8
7
|
import { SimulationStepDefinition } from "../simulator/SimulationStepDefinition.js";
|
|
9
8
|
import List from "../../../../../../core/collection/list/List.js";
|
|
@@ -12,6 +11,8 @@ import { computeStringHash } from "../../../../../../core/primitives/strings/com
|
|
|
12
11
|
import { computeConeBoundingBox } from "../../../../../../core/geom/3d/cone/computeConeBoundingBox.js";
|
|
13
12
|
import { EmissionFromType } from "./EmissionFromType.js";
|
|
14
13
|
import { EmissionShapeType } from "./EmissionShapeType.js";
|
|
14
|
+
import { computeHashIntegerArray } from "../../../../../../core/collection/array/computeHashIntegerArray.js";
|
|
15
|
+
import { computeHashFloat } from "../../../../../../core/math/hash/computeHashFloat.js";
|
|
15
16
|
|
|
16
17
|
function ParticleLayer() {
|
|
17
18
|
/**
|
|
@@ -68,6 +69,7 @@ function ParticleLayer() {
|
|
|
68
69
|
* @type {number}
|
|
69
70
|
*/
|
|
70
71
|
this.emissionRate = 1;
|
|
72
|
+
|
|
71
73
|
/**
|
|
72
74
|
* When layer is added - it will immediately emit this number of particles
|
|
73
75
|
* @type {number}
|
|
@@ -97,6 +99,11 @@ function ParticleLayer() {
|
|
|
97
99
|
* @type {ConicRay}
|
|
98
100
|
*/
|
|
99
101
|
this.particleVelocityDirection = new ConicRay();
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @type {NumericInterval}
|
|
106
|
+
*/
|
|
100
107
|
this.particleSpeed = new NumericInterval(0, 0);
|
|
101
108
|
|
|
102
109
|
/**
|
|
@@ -111,7 +118,6 @@ function ParticleLayer() {
|
|
|
111
118
|
*/
|
|
112
119
|
this.isEmitting = true;
|
|
113
120
|
|
|
114
|
-
|
|
115
121
|
/**
|
|
116
122
|
* Simulation steps that are to be applied
|
|
117
123
|
* @type {List<SimulationStepDefinition>}
|
|
@@ -173,7 +179,12 @@ ParticleLayer.prototype.computePointBoundingBox = function (result) {
|
|
|
173
179
|
//displace by current position
|
|
174
180
|
const position = this.position;
|
|
175
181
|
|
|
176
|
-
computeConeBoundingBox(
|
|
182
|
+
computeConeBoundingBox(
|
|
183
|
+
aabb3,
|
|
184
|
+
position.x, position.y, position.z,
|
|
185
|
+
direction.x, direction.y, direction.z,
|
|
186
|
+
particleVelocityDirection.angle, maxDisplacement
|
|
187
|
+
);
|
|
177
188
|
|
|
178
189
|
x0 = aabb3.x0;
|
|
179
190
|
y0 = aabb3.y0;
|