hz-particles 1.0.13 → 1.0.14

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.
@@ -584,10 +584,10 @@ async function O(c) {
584
584
  const u = l.attributes.POSITION;
585
585
  if (u === void 0)
586
586
  throw new Error("Mesh primitive missing POSITION attribute");
587
- const d = C(n, o, u, 3, 5126);
587
+ const d = _(n, o, u, 3, 5126);
588
588
  let f;
589
589
  if (l.attributes.NORMAL !== void 0)
590
- f = C(n, o, l.attributes.NORMAL, 3, 5126);
590
+ f = _(n, o, l.attributes.NORMAL, 3, 5126);
591
591
  else {
592
592
  const g = l.indices;
593
593
  if (g === void 0)
@@ -600,7 +600,7 @@ async function O(c) {
600
600
  throw new Error("Mesh primitive missing indices");
601
601
  const p = I(n, o, h), m = d.length / 3, b = p.length;
602
602
  let S = null;
603
- l.attributes.TEXCOORD_0 !== void 0 && (S = C(n, o, l.attributes.TEXCOORD_0, 2, 5126));
603
+ l.attributes.TEXCOORD_0 !== void 0 && (S = _(n, o, l.attributes.TEXCOORD_0, 2, 5126));
604
604
  let y = !1;
605
605
  if (n.materials && n.materials.length > 0) {
606
606
  const g = n.materials[0];
@@ -624,7 +624,7 @@ async function O(c) {
624
624
  hasBaseColorTexture: y
625
625
  };
626
626
  }
627
- function C(c, t, e, i, a) {
627
+ function _(c, t, e, i, a) {
628
628
  const r = c.accessors[e], o = {
629
629
  SCALAR: 1,
630
630
  VEC2: 2,
@@ -1134,13 +1134,13 @@ class ne {
1134
1134
  }
1135
1135
  }
1136
1136
  }
1137
- function V(c) {
1137
+ function D(c) {
1138
1138
  const t = atob(c), e = new Uint8Array(t.length);
1139
1139
  for (let i = 0; i < t.length; i++)
1140
1140
  e[i] = t.charCodeAt(i);
1141
1141
  return e.buffer;
1142
1142
  }
1143
- class _ {
1143
+ class C {
1144
1144
  constructor(t, e) {
1145
1145
  this.device = t, this.config = e, this.MAX_PARTICLES = e.maxParticles || 1e4, this.particleCount = e.particleCount || 100, this.activeParticles = 0, this.emitting = !1, this.currentEmissionTime = 0, this.particleData = new Float32Array(this.MAX_PARTICLES * 8), this.particleVelocities = new Float32Array(this.MAX_PARTICLES * 4), this.instanceBuffer = t.createBuffer({
1146
1146
  size: this.MAX_PARTICLES * 8 * 4,
@@ -1166,7 +1166,7 @@ class _ {
1166
1166
  // intensity (f32) + padding
1167
1167
  usage: GPUBufferUsage.UNIFORM | GPUBufferUsage.COPY_DST,
1168
1168
  label: "systemBloomIntensityBuffer"
1169
- }), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation === void 0 && (e.particleShapeRotation = 0), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.5), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.1), e.maxSize === void 0 && (e.maxSize = 0.5), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.cubeLength === void 0 && (e.cubeLength = 2), e.outerLength === void 0 && (e.outerLength = 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.shapeRotationX === void 0 && (e.shapeRotationX = 0), e.shapeRotationY === void 0 && (e.shapeRotationY = 0), e.shapeRotationZ === void 0 && (e.shapeRotationZ = 0), e.shapeTranslationX === void 0 && (e.shapeTranslationX = 0), e.shapeTranslationY === void 0 && (e.shapeTranslationY = 0), e.shapeTranslationZ === void 0 && (e.shapeTranslationZ = 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(44), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this.emitter = new Z(e), this.physics = new q(t, this.MAX_PARTICLES), this.textureManager = new $(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition), e.confinementEnabled && this.setConfinement({
1169
+ }), e.overrideXVelocity === void 0 && (e.overrideXVelocity = !1), e.overrideYVelocity === void 0 && (e.overrideYVelocity = !1), e.overrideZVelocity === void 0 && (e.overrideZVelocity = !1), e.xVelocity === void 0 && (e.xVelocity = 0), e.yVelocity === void 0 && (e.yVelocity = 0), e.zVelocity === void 0 && (e.zVelocity = 0), e.textureEnabled === void 0 && (e.textureEnabled = !1), e.glbModelEnabled === void 0 && (e.glbModelEnabled = !1), e.textureType === void 0 && (e.textureType = "image"), e.glbFileName === void 0 && (e.glbFileName = null), e.animationIndex === void 0 && (e.animationIndex = 0), e.animationSpeed === void 0 && (e.animationSpeed = 1), e.animationLoop === void 0 && (e.animationLoop = !0), e.useGlbTexture === void 0 && (e.useGlbTexture = !1), e.glbHasTexture === void 0 && (e.glbHasTexture = !1), e.particleShape === void 0 && (e.particleShape = "square"), e.particleShapeRotation === void 0 && (e.particleShapeRotation = 0), e.particleShapeRotationX === void 0 && (e.particleShapeRotationX = 0), e.particleShapeRotationY === void 0 && (e.particleShapeRotationY = 0), e.particleShapeRotationZ === void 0 && (e.particleShapeRotationZ = 0), e.particleColor === void 0 && (e.particleColor = [1, 1, 1]), e.startColor === void 0 && (e.startColor = [1, 0, 0]), e.endColor === void 0 && (e.endColor = [0, 0, 1]), e.fadeEnabled === void 0 && (e.fadeEnabled = !0), e.colorTransitionEnabled === void 0 && (e.colorTransitionEnabled = !1), e.randomColorEnabled === void 0 && (e.randomColorEnabled = !1), e.randomColors === void 0 && (e.randomColors = []), e.particleSize === void 0 && (e.particleSize = 0.5), e.particleSpeed === void 0 && (e.particleSpeed = 1), e.opacity === void 0 && (e.opacity = 1), e.aspectRatio === void 0 && (e.aspectRatio = 1), e.rotation === void 0 && (e.rotation = 0), e.rotationMode === void 0 && (e.rotationMode = "fixed"), e.minRotation === void 0 && (e.minRotation = 0), e.maxRotation === void 0 && (e.maxRotation = 90), e.randomSize === void 0 && (e.randomSize = !1), e.minSize === void 0 && (e.minSize = 0.1), e.maxSize === void 0 && (e.maxSize = 0.5), e.randomSpeed === void 0 && (e.randomSpeed = !1), e.minSpeed === void 0 && (e.minSpeed = 0.1), e.maxSpeed === void 0 && (e.maxSpeed = 1), e.fadeSizeEnabled === void 0 && (e.fadeSizeEnabled = !1), e.increaseSizeEnabled === void 0 && (e.increaseSizeEnabled = !1), e.sizeLifetimeSpeed === void 0 && (e.sizeLifetimeSpeed = 1), e.bloomEnabled === void 0 && (e.bloomEnabled = !0), e.bloomIntensity === void 0 && (e.bloomIntensity = 1), e.bloomColor === void 0 && (e.bloomColor = [1, 1, 1]), e.gravityEnabled === void 0 && (e.gravityEnabled = !1), e.gravityStrength === void 0 && (e.gravityStrength = 2), e.dampingEnabled === void 0 && (e.dampingEnabled = !1), e.dampingStrength === void 0 && (e.dampingStrength = 1), e.attractorEnabled === void 0 && (e.attractorEnabled = !1), e.attractorStrength === void 0 && (e.attractorStrength = 1), e.attractorPosition === void 0 && (e.attractorPosition = [0, 0, 0]), e.burstMode === void 0 && (e.burstMode = !1), e.emissionShape === void 0 && (e.emissionShape = "cube"), e.lifetime === void 0 && (e.lifetime = 5), e.emissionRate === void 0 && (e.emissionRate = 10), e.emissionDuration === void 0 && (e.emissionDuration = 10), e.cubeLength === void 0 && (e.cubeLength = 2), e.outerLength === void 0 && (e.outerLength = 2), e.innerLength === void 0 && (e.innerLength = 0), e.outerRadius === void 0 && (e.outerRadius = 2), e.innerRadius === void 0 && (e.innerRadius = 0), e.squareSize === void 0 && (e.squareSize = 2), e.squareInnerSize === void 0 && (e.squareInnerSize = 0), e.circleInnerRadius === void 0 && (e.circleInnerRadius = 0), e.circleOuterRadius === void 0 && (e.circleOuterRadius = 2), e.circleVelocityDirection === void 0 && (e.circleVelocityDirection = "outward"), e.cylinderInnerRadius === void 0 && (e.cylinderInnerRadius = 0), e.cylinderOuterRadius === void 0 && (e.cylinderOuterRadius = 2), e.cylinderHeight === void 0 && (e.cylinderHeight = 4), e.cylinderVelocityDirection === void 0 && (e.cylinderVelocityDirection = "outward"), e.planeWidth === void 0 && (e.planeWidth = 2), e.planeDepth === void 0 && (e.planeDepth = 2), e.coneOuterRadius === void 0 && (e.coneOuterRadius = 2), e.coneInnerRadius === void 0 && (e.coneInnerRadius = 0), e.coneHeight === void 0 && (e.coneHeight = 4), e.torusMajorRadius === void 0 && (e.torusMajorRadius = 2), e.torusMinorRadius === void 0 && (e.torusMinorRadius = 0.5), e.lineLength === void 0 && (e.lineLength = 4), e.hemisphereOuterRadius === void 0 && (e.hemisphereOuterRadius = 2), e.hemisphereInnerRadius === void 0 && (e.hemisphereInnerRadius = 0), e.discRadius === void 0 && (e.discRadius = 2), e.annulusInnerRadius === void 0 && (e.annulusInnerRadius = 1), e.annulusOuterRadius === void 0 && (e.annulusOuterRadius = 2), e.capsuleRadius === void 0 && (e.capsuleRadius = 0.5), e.capsuleHeight === void 0 && (e.capsuleHeight = 4), e.arcStartAngle === void 0 && (e.arcStartAngle = 0), e.arcEndAngle === void 0 && (e.arcEndAngle = 180), e.arcInnerRadius === void 0 && (e.arcInnerRadius = 0), e.arcOuterRadius === void 0 && (e.arcOuterRadius = 2), e.spiralTurns === void 0 && (e.spiralTurns = 3), e.spiralRadiusStart === void 0 && (e.spiralRadiusStart = 0.5), e.spiralRadiusEnd === void 0 && (e.spiralRadiusEnd = 2), e.spiralHeight === void 0 && (e.spiralHeight = 4), e.frustumRadiusNear === void 0 && (e.frustumRadiusNear = 0.5), e.frustumRadiusFar === void 0 && (e.frustumRadiusFar = 2), e.frustumHeight === void 0 && (e.frustumHeight = 4), e.cubeSurfaceSize === void 0 && (e.cubeSurfaceSize = 2), e.sphereSurfaceRadius === void 0 && (e.sphereSurfaceRadius = 2), e.boxFrameSize === void 0 && (e.boxFrameSize = 2), e.polygonSides === void 0 && (e.polygonSides = 6), e.polygonRadius === void 0 && (e.polygonRadius = 2), e.shapeRotationX === void 0 && (e.shapeRotationX = 0), e.shapeRotationY === void 0 && (e.shapeRotationY = 0), e.shapeRotationZ === void 0 && (e.shapeRotationZ = 0), e.shapeTranslationX === void 0 && (e.shapeTranslationX = 0), e.shapeTranslationY === void 0 && (e.shapeTranslationY = 0), e.shapeTranslationZ === void 0 && (e.shapeTranslationZ = 0), e.pulseEnabled === void 0 && (e.pulseEnabled = !1), e.pulseAmplitude === void 0 && (e.pulseAmplitude = 0.5), e.pulseFrequency === void 0 && (e.pulseFrequency = 1), e.pulsePhaseRandom === void 0 && (e.pulsePhaseRandom = 0), e.pulseOpacity === void 0 && (e.pulseOpacity = !1), e.confinementEnabled === void 0 && (e.confinementEnabled = !1), e.confinementShape === void 0 && (e.confinementShape = "box"), e.confinementMode === void 0 && (e.confinementMode = "bounce"), e.confinementSpace === void 0 && (e.confinementSpace = "world"), e.confinementBoxHalfSize === void 0 && (e.confinementBoxHalfSize = [2, 2, 2]), e.confinementSphereRadius === void 0 && (e.confinementSphereRadius = 3), e.confinementRestitution === void 0 && (e.confinementRestitution = 0.8), e.confinementFriction === void 0 && (e.confinementFriction = 0.1), e.softBoundaryEnabled === void 0 && (e.softBoundaryEnabled = !1), e.softBoundaryStrength === void 0 && (e.softBoundaryStrength = 5), e.softBoundaryFalloff === void 0 && (e.softBoundaryFalloff = 0.5), e.depthWriteEnabled === void 0 && (e.depthWriteEnabled = !1), e.velocityStretchEnabled === void 0 && (e.velocityStretchEnabled = !1), e.velocityStretchFactor === void 0 && (e.velocityStretchFactor = 1), e.emissionTrailEnabled === void 0 && (e.emissionTrailEnabled = !1), e.emissionTrailDuration === void 0 && (e.emissionTrailDuration = 1), e.emissionTrailWidth === void 0 && (e.emissionTrailWidth = 0.3), e.emissionTrailMinDistance === void 0 && (e.emissionTrailMinDistance = 0.05), e.emissionTrailMaxPoints === void 0 && (e.emissionTrailMaxPoints = 256), e.emissionTrailSegments === void 0 && (e.emissionTrailSegments = 8), e.emissionTrailShape === void 0 && (e.emissionTrailShape = "straight"), e.emissionTrailShapeAmplitude === void 0 && (e.emissionTrailShapeAmplitude = 0.1), e.emissionTrailShapeFrequency === void 0 && (e.emissionTrailShapeFrequency = 4), e.emissionTrailShapeSpeed === void 0 && (e.emissionTrailShapeSpeed = 0), e.shapeDisplay === void 0 && (e.shapeDisplay = !0), e.followSystemTranslation === void 0 && (e.followSystemTranslation = !0), e.followSystemId === void 0 && (e.followSystemId = null), this._newEmissions = [], this._emptyEmissions = [], this._pendingFollowEmissions = this._emptyEmissions, this.glbVertexBuffer = null, this.glbIndexBuffer = null, this.glbIndexCount = 0, this.glbIndexFormat = "uint16", this.glbMeshData = null, this.glbRawArrayBuffer = null, this.glbAnimator = null, this.glbAnimated = !1, this._glbInterleavedData = null, this._appearanceData = new Float32Array(44), this._bloomIntensityData = new Float32Array(16), this._simPosition = [0, 0, 0], this._simVelocity = [0, 0, 0], this._simRotMatrix = null, this._simRotX = 0, this._simRotZ = 0, this.emitter = new Z(e), this.physics = new q(t, this.MAX_PARTICLES), this.textureManager = new $(t), e.gravityEnabled && this.setGravity(e.gravityStrength || 0), e.dampingEnabled && this.physics.setDamping(e.dampingStrength || 0), e.attractorEnabled && e.attractorPosition && this.setAttractor(e.attractorStrength || 0, e.attractorPosition), e.confinementEnabled && this.setConfinement({
1170
1170
  enabled: !0,
1171
1171
  shape: e.confinementShape,
1172
1172
  mode: e.confinementMode,
@@ -1271,7 +1271,9 @@ class _ {
1271
1271
  let t = 0;
1272
1272
  this.config.rotationMode === "random" ? t = 1 : this.config.rotationMode === "velocity" && (t = 2);
1273
1273
  const i = { square: 0, circle: 1, triangle: 2, diamond: 3, star: 4, hexagon: 5, ring: 6, heart: 7, cross: 8, spark: 9, leaf: 10, capsule: 11, crescent: 12, line: 13, "curved-line": 14 }[this.config.particleShape] ?? 0, a = this._appearanceData;
1274
- a[0] = this.config.fadeEnabled ? 1 : 0, a[1] = this.config.randomColorEnabled ? 2 : this.config.colorTransitionEnabled ? 1 : 0, a[2] = this.config.particleSize, a[3] = this.config.textureEnabled ? 1 : 0, a[4] = this.config.particleColor[0], a[5] = this.config.particleColor[1], a[6] = this.config.particleColor[2], a[7] = this.config.rotation || 0, a[8] = this.config.startColor[0], a[9] = this.config.startColor[1], a[10] = this.config.startColor[2], a[11] = t, a[12] = this.config.endColor[0], a[13] = this.config.endColor[1], a[14] = this.config.endColor[2], a[15] = this.config.minRotation || 0, a[16] = this.config.maxRotation || 90, a[17] = this.config.aspectRatio || 1, a[18] = this.config.randomSize ? 1 : 0, a[19] = this.config.minSize || 0.1, a[20] = this.config.maxSize || 0.5, a[21] = this.config.fadeSizeEnabled ? 1 : 0, a[22] = this.config.opacity !== void 0 ? this.config.opacity : 1, a[23] = this.config.increaseSizeEnabled ? 1 : 0, a[24] = this.config.sizeLifetimeSpeed ?? 1, a[25] = i, a[26] = this.config.particleShapeRotation || 0, a[27] = this.config.pulseEnabled ? 1 : 0, a[28] = this.config.pulseAmplitude ?? 0.5, a[29] = this.config.pulseFrequency ?? 1, a[30] = this.config.pulsePhaseRandom ?? 0, a[31] = this.config.pulseOpacity ? 1 : 0, a[32] = this.config.particleShapeRotationX || 0, a[33] = this.config.particleShapeRotationY || 0, a[34] = this.config.particleShapeRotationZ || 0, a[35] = 0, (a[32] !== 0 || a[33] !== 0 || a[34] !== 0) && console.log(`[updateAppearanceUniform] ${this.config.name}: d[32-34] = ${a[32]}, ${a[33]}, ${a[34]}`), a[36] = this._simPosition[0], a[37] = this._simPosition[1], a[38] = this._simPosition[2], a[39] = 0, a[40] = this._simRotX, a[41] = this._simRotZ, a[42] = this.config.velocityStretchEnabled ? 1 : 0, a[43] = this.config.velocityStretchFactor ?? 1, this.device.queue.writeBuffer(this.appearanceUniformBuffer, 0, a);
1274
+ a[0] = this.config.fadeEnabled ? 1 : 0, a[1] = this.config.randomColorEnabled ? 2 : this.config.colorTransitionEnabled ? 1 : 0, a[2] = this.config.particleSize, a[3] = this.config.textureEnabled ? 1 : 0, a[4] = this.config.particleColor[0], a[5] = this.config.particleColor[1], a[6] = this.config.particleColor[2], a[7] = this.config.rotation || 0, a[8] = this.config.startColor[0], a[9] = this.config.startColor[1], a[10] = this.config.startColor[2], a[11] = t, a[12] = this.config.endColor[0], a[13] = this.config.endColor[1], a[14] = this.config.endColor[2], a[15] = this.config.minRotation || 0, a[16] = this.config.maxRotation || 90, a[17] = this.config.aspectRatio || 1, a[18] = this.config.randomSize ? 1 : 0, a[19] = this.config.minSize || 0.1, a[20] = this.config.maxSize || 0.5, a[21] = this.config.fadeSizeEnabled ? 1 : 0, a[22] = this.config.opacity !== void 0 ? this.config.opacity : 1, a[23] = this.config.increaseSizeEnabled ? 1 : 0, a[24] = this.config.sizeLifetimeSpeed ?? 1, a[25] = i, a[26] = this.config.particleShapeRotation || 0, a[27] = this.config.pulseEnabled ? 1 : 0, a[28] = this.config.pulseAmplitude ?? 0.5, a[29] = this.config.pulseFrequency ?? 1, a[30] = this.config.pulsePhaseRandom ?? 0, a[31] = this.config.pulseOpacity ? 1 : 0, a[32] = this.config.particleShapeRotationX || 0, a[33] = this.config.particleShapeRotationY || 0, a[34] = this.config.particleShapeRotationZ || 0, a[35] = 0, (a[32] !== 0 || a[33] !== 0 || a[34] !== 0) && console.log(`[updateAppearanceUniform] ${this.config.name}: d[32-34] = ${a[32]}, ${a[33]}, ${a[34]}`);
1275
+ const r = this.config.followSystemTranslation ?? !0;
1276
+ a[36] = r ? this._simPosition[0] : 0, a[37] = r ? this._simPosition[1] : 0, a[38] = r ? this._simPosition[2] : 0, a[39] = 0, a[40] = this._simRotX, a[41] = this._simRotZ, a[42] = this.config.velocityStretchEnabled ? 1 : 0, a[43] = this.config.velocityStretchFactor ?? 1, this.device.queue.writeBuffer(this.appearanceUniformBuffer, 0, a);
1275
1277
  }
1276
1278
  updateBloomIntensity() {
1277
1279
  const t = this._bloomIntensityData;
@@ -1324,7 +1326,7 @@ class _ {
1324
1326
  const l = this._simRotMatrix;
1325
1327
  this.particleData[t] = l[0] * i + l[1] * a + l[2] * r, this.particleData[t + 1] = l[3] * i + l[4] * a + l[5] * r, this.particleData[t + 2] = l[6] * i + l[7] * a + l[8] * r, this.particleVelocities[e] = l[0] * n + l[1] * o + l[2] * s, this.particleVelocities[e + 1] = l[3] * n + l[4] * o + l[5] * s, this.particleVelocities[e + 2] = l[6] * n + l[7] * o + l[8] * s;
1326
1328
  }
1327
- return this._newEmissions.push(
1329
+ return (this.config.followSystemTranslation ?? !0) || (this.particleData[t] += this._simPosition[0], this.particleData[t + 1] += this._simPosition[1], this.particleData[t + 2] += this._simPosition[2]), this._newEmissions.push(
1328
1330
  this.particleData[t],
1329
1331
  this.particleData[t + 1],
1330
1332
  this.particleData[t + 2],
@@ -1533,7 +1535,7 @@ class me {
1533
1535
  ...t,
1534
1536
  name: i,
1535
1537
  id: e
1536
- }, r = new _(this.device, a);
1538
+ }, r = new C(this.device, a);
1537
1539
  return this.particleSystems.push({
1538
1540
  system: r,
1539
1541
  config: a
@@ -1622,7 +1624,7 @@ class me {
1622
1624
  const r = this.systemCounter++, n = {
1623
1625
  ...a,
1624
1626
  id: r
1625
- }, o = new _(this.device, n);
1627
+ }, o = new C(this.device, n);
1626
1628
  this.particleSystems.push({
1627
1629
  system: o,
1628
1630
  config: n
@@ -1640,7 +1642,7 @@ class me {
1640
1642
  try {
1641
1643
  let n = null;
1642
1644
  if (r.glbModelData)
1643
- n = V(r.glbModelData);
1645
+ n = D(r.glbModelData);
1644
1646
  else if (r.glbFileName) {
1645
1647
  const o = await fetch(`/${r.glbFileName}`);
1646
1648
  o.ok ? n = await o.arrayBuffer() : console.warn(`GLB file not found: ${r.glbFileName}`);
@@ -1706,7 +1708,7 @@ class me {
1706
1708
  n.attractorPosition[1] + e[1],
1707
1709
  n.attractorPosition[2] + e[2]
1708
1710
  ]);
1709
- const l = new _(this.device, s);
1711
+ const l = new C(this.device, s);
1710
1712
  this.particleSystems.push({
1711
1713
  system: l,
1712
1714
  config: s
@@ -1725,7 +1727,7 @@ class me {
1725
1727
  try {
1726
1728
  let s = null;
1727
1729
  if (o.glbModelData)
1728
- s = V(o.glbModelData);
1730
+ s = D(o.glbModelData);
1729
1731
  else if (o.glbFileName) {
1730
1732
  const l = await fetch(`/${o.glbFileName}`);
1731
1733
  l.ok ? s = await l.arrayBuffer() : console.warn(`GLB file not found: ${o.glbFileName}`);
@@ -4077,11 +4079,11 @@ function we(c) {
4077
4079
  return `#${t}${e}${i}`;
4078
4080
  }
4079
4081
  function Be(c, t, e) {
4080
- const i = D([
4082
+ const i = V([
4081
4083
  c[0] - t[0],
4082
4084
  c[1] - t[1],
4083
4085
  c[2] - t[2]
4084
- ]), a = D(L(e, i)), r = L(i, a);
4086
+ ]), a = V(L(e, i)), r = L(i, a);
4085
4087
  return new Float32Array([
4086
4088
  a[0],
4087
4089
  r[0],
@@ -4122,7 +4124,7 @@ function Te(c, t = Math.PI / 4) {
4122
4124
  0
4123
4125
  ]);
4124
4126
  }
4125
- function D(c) {
4127
+ function V(c) {
4126
4128
  const t = Math.sqrt(c[0] * c[0] + c[1] * c[1] + c[2] * c[2]);
4127
4129
  return [c[0] / t, c[1] / t, c[2] / t];
4128
4130
  }
@@ -4154,7 +4156,7 @@ function pe(c) {
4154
4156
  e += String.fromCharCode(t[i]);
4155
4157
  return btoa(e);
4156
4158
  }
4157
- function Ce(c, t) {
4159
+ function _e(c, t) {
4158
4160
  if (!c || !c.particleSystems || c.particleSystems.length === 0) {
4159
4161
  alert("No particle systems to save.");
4160
4162
  return;
@@ -4272,6 +4274,13 @@ function Ce(c, t) {
4272
4274
  emissionTrailWidth: s.emissionTrailWidth ?? 0.5,
4273
4275
  emissionTrailMinDistance: s.emissionTrailMinDistance ?? 0.05,
4274
4276
  emissionTrailMaxPoints: s.emissionTrailMaxPoints ?? 100,
4277
+ emissionTrailSegments: s.emissionTrailSegments ?? 8,
4278
+ emissionTrailShape: s.emissionTrailShape ?? "straight",
4279
+ emissionTrailShapeAmplitude: s.emissionTrailShapeAmplitude ?? 0.1,
4280
+ emissionTrailShapeFrequency: s.emissionTrailShapeFrequency ?? 4,
4281
+ emissionTrailShapeSpeed: s.emissionTrailShapeSpeed ?? 0,
4282
+ shapeDisplay: s.shapeDisplay ?? !0,
4283
+ followSystemTranslation: s.followSystemTranslation ?? !0,
4275
4284
  textureImageData: s.textureEnabled && !s.glbModelEnabled && s.textureImageData ? s.textureImageData : void 0,
4276
4285
  glbModelData: s.glbModelEnabled && l.glbRawArrayBuffer ? pe(l.glbRawArrayBuffer) : void 0
4277
4286
  })),
@@ -4290,7 +4299,7 @@ function Ce(c, t) {
4290
4299
  console.error("Error saving scene:", e), alert("Error saving scene. See console for details.");
4291
4300
  }
4292
4301
  }
4293
- function _e(c) {
4302
+ function Ce(c) {
4294
4303
  return new Promise((t, e) => {
4295
4304
  try {
4296
4305
  const i = c.target.files[0];
@@ -4345,7 +4354,7 @@ export {
4345
4354
  Me as Objects3DManager,
4346
4355
  Z as ParticleEmitter,
4347
4356
  q as ParticlePhysics,
4348
- _ as ParticleSystem,
4357
+ C as ParticleSystem,
4349
4358
  me as ParticleSystemManager,
4350
4359
  $ as ParticleTextureManager,
4351
4360
  N as blurShader,
@@ -4367,12 +4376,12 @@ export {
4367
4376
  ue as glbMeshParticleShader,
4368
4377
  Re as hexToRgb,
4369
4378
  ye as initWebGPU,
4370
- _e as loadScene,
4379
+ Ce as loadScene,
4371
4380
  Ee as multiplyMatrices,
4372
4381
  ce as object3dShader,
4373
4382
  O as parseGLB,
4374
4383
  oe as particlePhysicsShader,
4375
4384
  j as particleShader,
4376
4385
  we as rgbToHex,
4377
- Ce as saveScene
4386
+ _e as saveScene
4378
4387
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hz-particles",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "High-performance WebGPU particle engine with compute shaders, GPU instancing, GLB model support, and skeletal animations",
5
5
  "type": "module",
6
6
  "main": "dist-lib/hz-particles.cjs",