hz-particles 1.0.13 → 1.0.15

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.
@@ -12,7 +12,7 @@ export interface ParticleSystemConfig {
12
12
  lifetime?: number;
13
13
  emissionRate?: number;
14
14
  emissionDuration?: number;
15
- emissionShape?: 'cube' | 'sphere' | 'square' | 'circle' | 'cylinder' | 'point';
15
+ emissionShape?: 'cube' | 'sphere' | 'square' | 'circle' | 'cylinder' | 'plain' | 'cone' | 'torus' | 'line' | 'hemisphere' | 'disc' | 'annulus' | 'capsule' | 'arc' | 'spiral' | 'frustum' | 'cubeSurface' | 'sphereSurface' | 'boxFrame' | 'polygon' | 'rectangle' | 'point';
16
16
  particleSize?: number;
17
17
  particleSpeed?: number;
18
18
  particleColor?: [number, number, number];
@@ -24,6 +24,7 @@ export interface ParticleSystemConfig {
24
24
  randomColors?: number[][];
25
25
  textureEnabled?: boolean;
26
26
  textureType?: 'image' | 'glb';
27
+ textureImageData?: string;
27
28
  glbModelEnabled?: boolean;
28
29
  glbFileName?: string | null;
29
30
  glbAnimated?: boolean;
@@ -47,12 +48,12 @@ export interface ParticleSystemConfig {
47
48
  attractorEnabled?: boolean;
48
49
  attractorStrength?: number;
49
50
  attractorPosition?: [number, number, number];
50
- shapeRotationX?: number;
51
- shapeRotationY?: number;
52
- shapeRotationZ?: number;
53
- shapeTranslationX?: number;
54
- shapeTranslationY?: number;
55
- shapeTranslationZ?: number;
51
+ emissionRotationX?: number;
52
+ emissionRotationY?: number;
53
+ emissionRotationZ?: number;
54
+ emissionTranslationX?: number;
55
+ emissionTranslationY?: number;
56
+ emissionTranslationZ?: number;
56
57
  overrideXVelocity?: boolean;
57
58
  overrideYVelocity?: boolean;
58
59
  overrideZVelocity?: boolean;
@@ -68,6 +69,8 @@ export interface ParticleSystemConfig {
68
69
  squareInnerSize?: number;
69
70
  circleOuterRadius?: number;
70
71
  circleInnerRadius?: number;
72
+ rectangleWidth?: number;
73
+ rectangleHeight?: number;
71
74
  circleVelocityDirection?: string;
72
75
  cylinderOuterRadius?: number;
73
76
  cylinderInnerRadius?: number;
@@ -96,9 +99,17 @@ export interface ParticleSystemConfig {
96
99
  emissionTrailWidth?: number;
97
100
  emissionTrailMinDistance?: number;
98
101
  emissionTrailMaxPoints?: number;
102
+ emissionTrailSegments?: number;
103
+ emissionTrailShape?: 'straight' | 'zigzag' | 'sine' | 'spiral';
104
+ emissionTrailShapeAmplitude?: number;
105
+ emissionTrailShapeFrequency?: number;
106
+ emissionTrailShapeSpeed?: number;
107
+ shapeDisplay?: boolean;
108
+ followSystemTranslation?: boolean;
99
109
  followSystemId?: number | null;
100
110
  hidden?: boolean;
101
111
  oneOnlyMode?: boolean;
112
+ script?: string;
102
113
  glbModelData?: string;
103
114
  onAppearanceChange?: ((config: ParticleSystemConfig) => void) | null;
104
115
  onColorChange?: ((config: ParticleSystemConfig) => void) | null;
@@ -283,6 +294,7 @@ export class ParticleSystem {
283
294
  outParticleData: Float32Array,
284
295
  outVelocities: Float32Array
285
296
  ): Promise<PhysicsReadbackResult>;
297
+ setScript(source: string | null): void;
286
298
  destroy(): void;
287
299
  respawnParticle(oldIndex: number, newIndex: number): void;
288
300
  updateBuffers(): void;
@@ -380,6 +392,13 @@ export class ParticlePhysics {
380
392
  instanceBuffer: GPUBuffer,
381
393
  velocityBuffer: GPUBuffer
382
394
  ): Promise<PhysicsReadbackResult>;
395
+ readbackForScript(
396
+ activeParticles: number,
397
+ outParticleData: Float32Array,
398
+ outVelocities: Float32Array,
399
+ instanceBuffer: GPUBuffer,
400
+ velocityBuffer: GPUBuffer
401
+ ): Promise<PhysicsReadbackResult>;
383
402
  destroy(): void;
384
403
  setDamping(dampingValue: number): void;
385
404
  setGravity(gravityValue: number): void;
@@ -476,6 +495,23 @@ export class Objects3DManager {
476
495
  ): void;
477
496
  }
478
497
 
498
+ export class ParticleScript {
499
+ constructor(source: string, config: ParticleSystemConfig, maxParticles: number);
500
+ compile(source: string): void;
501
+ execute(
502
+ deltaTime: number,
503
+ time: number,
504
+ frame: number,
505
+ totalFrames: number,
506
+ particleData: Float32Array,
507
+ velocityData: Float32Array,
508
+ count: number
509
+ ): boolean;
510
+ snapshotConfig(config: ParticleSystemConfig): void;
511
+ restoreConfig(config: ParticleSystemConfig): void;
512
+ destroy(): void;
513
+ }
514
+
479
515
  // ─── WebGPU Utilities ────────────────────────────────────────────────────────
480
516
 
481
517
  export function initWebGPU(canvas: HTMLCanvasElement): Promise<WebGPUContext>;