@cazala/party 0.0.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.
Files changed (73) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +598 -0
  3. package/dist/engine.d.ts +113 -0
  4. package/dist/engine.d.ts.map +1 -0
  5. package/dist/index.d.ts +8 -0
  6. package/dist/index.d.ts.map +1 -0
  7. package/dist/index.js +9628 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/interfaces.d.ts +223 -0
  10. package/dist/interfaces.d.ts.map +1 -0
  11. package/dist/module.d.ts +259 -0
  12. package/dist/module.d.ts.map +1 -0
  13. package/dist/modules/forces/behavior.d.ts +78 -0
  14. package/dist/modules/forces/behavior.d.ts.map +1 -0
  15. package/dist/modules/forces/boundary.d.ts +58 -0
  16. package/dist/modules/forces/boundary.d.ts.map +1 -0
  17. package/dist/modules/forces/collisions.d.ts +34 -0
  18. package/dist/modules/forces/collisions.d.ts.map +1 -0
  19. package/dist/modules/forces/environment.d.ts +62 -0
  20. package/dist/modules/forces/environment.d.ts.map +1 -0
  21. package/dist/modules/forces/fluids.d.ts +73 -0
  22. package/dist/modules/forces/fluids.d.ts.map +1 -0
  23. package/dist/modules/forces/grab.d.ts +56 -0
  24. package/dist/modules/forces/grab.d.ts.map +1 -0
  25. package/dist/modules/forces/interaction.d.ts +59 -0
  26. package/dist/modules/forces/interaction.d.ts.map +1 -0
  27. package/dist/modules/forces/joints.d.ts +87 -0
  28. package/dist/modules/forces/joints.d.ts.map +1 -0
  29. package/dist/modules/forces/sensors.d.ts +81 -0
  30. package/dist/modules/forces/sensors.d.ts.map +1 -0
  31. package/dist/modules/index.d.ts +13 -0
  32. package/dist/modules/index.d.ts.map +1 -0
  33. package/dist/modules/render/lines.d.ts +55 -0
  34. package/dist/modules/render/lines.d.ts.map +1 -0
  35. package/dist/modules/render/particles.d.ts +53 -0
  36. package/dist/modules/render/particles.d.ts.map +1 -0
  37. package/dist/modules/render/trails.d.ts +36 -0
  38. package/dist/modules/render/trails.d.ts.map +1 -0
  39. package/dist/oscillators.d.ts +66 -0
  40. package/dist/oscillators.d.ts.map +1 -0
  41. package/dist/particle.d.ts +19 -0
  42. package/dist/particle.d.ts.map +1 -0
  43. package/dist/runtimes/cpu/engine.d.ts +60 -0
  44. package/dist/runtimes/cpu/engine.d.ts.map +1 -0
  45. package/dist/runtimes/cpu/spatial-grid.d.ts +56 -0
  46. package/dist/runtimes/cpu/spatial-grid.d.ts.map +1 -0
  47. package/dist/runtimes/webgpu/builders/program.d.ts +56 -0
  48. package/dist/runtimes/webgpu/builders/program.d.ts.map +1 -0
  49. package/dist/runtimes/webgpu/builders/render-pass.d.ts +26 -0
  50. package/dist/runtimes/webgpu/builders/render-pass.d.ts.map +1 -0
  51. package/dist/runtimes/webgpu/engine.d.ts +73 -0
  52. package/dist/runtimes/webgpu/engine.d.ts.map +1 -0
  53. package/dist/runtimes/webgpu/gpu-resources.d.ts +141 -0
  54. package/dist/runtimes/webgpu/gpu-resources.d.ts.map +1 -0
  55. package/dist/runtimes/webgpu/module-registry.d.ts +53 -0
  56. package/dist/runtimes/webgpu/module-registry.d.ts.map +1 -0
  57. package/dist/runtimes/webgpu/particle-store.d.ts +43 -0
  58. package/dist/runtimes/webgpu/particle-store.d.ts.map +1 -0
  59. package/dist/runtimes/webgpu/render-pipeline.d.ts +49 -0
  60. package/dist/runtimes/webgpu/render-pipeline.d.ts.map +1 -0
  61. package/dist/runtimes/webgpu/shaders.d.ts +8 -0
  62. package/dist/runtimes/webgpu/shaders.d.ts.map +1 -0
  63. package/dist/runtimes/webgpu/simulation-pipeline.d.ts +22 -0
  64. package/dist/runtimes/webgpu/simulation-pipeline.d.ts.map +1 -0
  65. package/dist/runtimes/webgpu/spacial-grid.d.ts +27 -0
  66. package/dist/runtimes/webgpu/spacial-grid.d.ts.map +1 -0
  67. package/dist/spawner.d.ts +40 -0
  68. package/dist/spawner.d.ts.map +1 -0
  69. package/dist/vector.d.ts +61 -0
  70. package/dist/vector.d.ts.map +1 -0
  71. package/dist/view.d.ts +43 -0
  72. package/dist/view.d.ts.map +1 -0
  73. package/package.json +67 -0
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Collisions (Force Module)
3
+ *
4
+ * Simple pairwise collision response using the spatial grid for neighbor queries.
5
+ * Uses a two-phase approach: pick deepest overlap neighbor (to reduce bias), then
6
+ * correct position and apply a bounce impulse along the contact normal.
7
+ * Velocity response in apply() is commented out; constraint/correct handle stability.
8
+ *
9
+ * Special handling: When particles are at identical positions (e.g., from boundary
10
+ * repositioning), they are separated with a small pseudo-random offset to prevent
11
+ * them from being stuck together permanently.
12
+ */
13
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
14
+ export declare const DEFAULT_COLLISIONS_RESTITUTION = 0.8;
15
+ type CollisionsInputs = {
16
+ restitution: number;
17
+ };
18
+ export declare class Collisions extends Module<"collisions", CollisionsInputs> {
19
+ readonly name: "collisions";
20
+ readonly role = ModuleRole.Force;
21
+ readonly inputs: {
22
+ readonly restitution: DataType.NUMBER;
23
+ };
24
+ constructor(opts?: {
25
+ enabled?: boolean;
26
+ restitution?: number;
27
+ });
28
+ setRestitution(value: number): void;
29
+ getRestitution(): number;
30
+ webgpu(): WebGPUDescriptor<CollisionsInputs>;
31
+ cpu(): CPUDescriptor<CollisionsInputs>;
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=collisions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"collisions.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/collisions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAGlD,KAAK,gBAAgB,GAAG;IACtB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,qBAAa,UAAW,SAAQ,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAAC;IACpE,QAAQ,CAAC,IAAI,EAAG,YAAY,CAAU;IACtC,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,MAAM;;MAEJ;gBAEC,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE;IAU9D,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAInC,cAAc,IAAI,MAAM;IAIxB,MAAM,IAAI,gBAAgB,CAAC,gBAAgB,CAAC;IA0H5C,GAAG,IAAI,aAAa,CAAC,gBAAgB,CAAC;CA6JvC"}
@@ -0,0 +1,62 @@
1
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
2
+ export declare const DEFAULT_ENVIRONMENT_GRAVITY_STRENGTH = 0;
3
+ export declare const DEFAULT_ENVIRONMENT_GRAVITY_DIRECTION: GravityDirection;
4
+ export declare const DEFAULT_ENVIRONMENT_GRAVITY_ANGLE: number;
5
+ export declare const DEFAULT_ENVIRONMENT_INERTIA = 0;
6
+ export declare const DEFAULT_ENVIRONMENT_FRICTION = 0;
7
+ export declare const DEFAULT_ENVIRONMENT_DAMPING = 0;
8
+ export type GravityDirection = "up" | "down" | "left" | "right" | "inwards" | "outwards" | "custom";
9
+ type EnvironmentInputs = {
10
+ gravityStrength: number;
11
+ dirX: number;
12
+ dirY: number;
13
+ inertia: number;
14
+ friction: number;
15
+ damping: number;
16
+ mode: number;
17
+ };
18
+ export declare class Environment extends Module<"environment", EnvironmentInputs> {
19
+ readonly name: "environment";
20
+ readonly role = ModuleRole.Force;
21
+ readonly inputs: {
22
+ readonly gravityStrength: DataType.NUMBER;
23
+ readonly dirX: DataType.NUMBER;
24
+ readonly dirY: DataType.NUMBER;
25
+ readonly inertia: DataType.NUMBER;
26
+ readonly friction: DataType.NUMBER;
27
+ readonly damping: DataType.NUMBER;
28
+ readonly mode: DataType.NUMBER;
29
+ };
30
+ private gravityDirection;
31
+ private gravityAngle;
32
+ constructor(opts?: {
33
+ enabled?: boolean;
34
+ gravityStrength?: number;
35
+ dirX?: number;
36
+ dirY?: number;
37
+ inertia?: number;
38
+ friction?: number;
39
+ damping?: number;
40
+ gravityDirection?: GravityDirection;
41
+ gravityAngle?: number;
42
+ });
43
+ private directionFromOptions;
44
+ setGravityStrength(value: number): void;
45
+ setDirection(x: number, y: number): void;
46
+ setGravityDirection(direction: GravityDirection): void;
47
+ setGravityAngle(angleRadians: number): void;
48
+ setInertia(value: number): void;
49
+ setFriction(value: number): void;
50
+ setDamping(value: number): void;
51
+ getGravityStrength(): number;
52
+ getDirX(): number;
53
+ getDirY(): number;
54
+ getInertia(): number;
55
+ getFriction(): number;
56
+ getDamping(): number;
57
+ getMode(): number;
58
+ webgpu(): WebGPUDescriptor<EnvironmentInputs>;
59
+ cpu(): CPUDescriptor<EnvironmentInputs>;
60
+ }
61
+ export {};
62
+ //# sourceMappingURL=environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/environment.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,oCAAoC,IAAI,CAAC;AACtD,eAAO,MAAM,qCAAqC,EAAE,gBAAyB,CAAC;AAC9E,eAAO,MAAM,iCAAiC,QAAc,CAAC;AAC7D,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAE7C,MAAM,MAAM,gBAAgB,GACxB,IAAI,GACJ,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,UAAU,GACV,QAAQ,CAAC;AAEb,KAAK,iBAA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GAAG,IAAI;IAI/B,kBAAkB,IAAI,MAAM;IAG5B,OAAO,IAAI,MAAM;IAGjB,OAAO,IAAI,MAAM;IAGjB,UAAU,IAAI,MAAM;IAGpB,WAAW,IAAI,MAAM;IAGrB,UAAU,IAAI,MAAM;IAGpB,OAAO,IAAI,MAAM;IAIjB,MAAM,IAAI,gBAAgB,CAAC,iBAAiB,CAAC;IA2C7C,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC;CAgDxC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Fluid (Force Module)
3
+ *
4
+ * SPH-inspired fluid approximation. Two-phase algorithm:
5
+ * - state(): compute particle density and near-density using neighbor kernels
6
+ * - apply(): compute pressure gradient and viscosity forces; clamp max accel
7
+ * Stores per-particle state in shared SIM_STATE via the Program-provided helpers.
8
+ */
9
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
10
+ export declare const DEFAULT_FLUIDS_INFLUENCE_RADIUS = 100;
11
+ export declare const DEFAULT_FLUIDS_TARGET_DENSITY = 1;
12
+ export declare const DEFAULT_FLUIDS_PRESSURE_MULTIPLIER = 30;
13
+ export declare const DEFAULT_FLUIDS_VISCOSITY = 1;
14
+ export declare const DEFAULT_FLUIDS_NEAR_PRESSURE_MULTIPLIER = 50;
15
+ export declare const DEFAULT_FLUIDS_NEAR_THRESHOLD = 20;
16
+ export declare const DEFAULT_FLUIDS_ENABLE_NEAR_PRESSURE = true;
17
+ export declare const DEFAULT_FLUIDS_MAX_ACCELERATION = 75;
18
+ type FluidStateKeys = "density" | "nearDensity";
19
+ type FluidsInputs = {
20
+ influenceRadius: number;
21
+ targetDensity: number;
22
+ pressureMultiplier: number;
23
+ viscosity: number;
24
+ nearPressureMultiplier: number;
25
+ nearThreshold: number;
26
+ enableNearPressure: number;
27
+ maxAcceleration: number;
28
+ };
29
+ export declare class Fluids extends Module<"fluids", FluidsInputs, FluidStateKeys> {
30
+ readonly name: "fluids";
31
+ readonly role = ModuleRole.Force;
32
+ readonly inputs: {
33
+ readonly influenceRadius: DataType.NUMBER;
34
+ readonly targetDensity: DataType.NUMBER;
35
+ readonly pressureMultiplier: DataType.NUMBER;
36
+ readonly viscosity: DataType.NUMBER;
37
+ readonly nearPressureMultiplier: DataType.NUMBER;
38
+ readonly nearThreshold: DataType.NUMBER;
39
+ readonly enableNearPressure: DataType.NUMBER;
40
+ readonly maxAcceleration: DataType.NUMBER;
41
+ };
42
+ constructor(opts?: {
43
+ enabled?: boolean;
44
+ influenceRadius?: number;
45
+ targetDensity?: number;
46
+ pressureMultiplier?: number;
47
+ viscosity?: number;
48
+ nearPressureMultiplier?: number;
49
+ nearThreshold?: number;
50
+ enableNearPressure?: boolean;
51
+ maxAcceleration?: number;
52
+ });
53
+ setInfluenceRadius(v: number): void;
54
+ setTargetDensity(v: number): void;
55
+ setPressureMultiplier(v: number): void;
56
+ setViscosity(v: number): void;
57
+ setNearPressureMultiplier(v: number): void;
58
+ setNearThreshold(v: number): void;
59
+ setEnableNearPressure(enabled: boolean): void;
60
+ setMaxAcceleration(v: number): void;
61
+ getInfluenceRadius(): number;
62
+ getTargetDensity(): number;
63
+ getPressureMultiplier(): number;
64
+ getViscosity(): number;
65
+ getNearPressureMultiplier(): number;
66
+ getNearThreshold(): number;
67
+ getEnableNearPressure(): number;
68
+ getMaxAcceleration(): number;
69
+ webgpu(): WebGPUDescriptor<FluidsInputs, FluidStateKeys>;
70
+ cpu(): CPUDescriptor<FluidsInputs, FluidStateKeys>;
71
+ }
72
+ export {};
73
+ //# sourceMappingURL=fluids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluids.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/fluids.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,+BAA+B,MAAM,CAAC;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BAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAGjC,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAGtC,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAG7B,yBAAyB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAG1C,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAGjC,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAI7C,kBAAkB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAInC,kBAAkB,IAAI,MAAM;IAG5B,gBAAgB,IAAI,MAAM;IAG1B,qBAAqB,IAAI,MAAM;IAG/B,YAAY,IAAI,MAAM;IAGtB,yBAAyB,IAAI,MAAM;IAGnC,gBAAgB,IAAI,MAAM;IAG1B,qBAAqB,IAAI,MAAM;IAG/B,kBAAkB,IAAI,MAAM;IAI5B,MAAM,IAAI,gBAAgB,CAAC,YAAY,EAAE,cAAc,CAAC;IAgJxD,GAAG,IAAI,aAAa,CAAC,YAAY,EAAE,cAAc,CAAC;CAiLnD"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Grab (Force Module)
3
+ *
4
+ * Handles particle grabbing during mouse drag operations. When a particle is grabbed
5
+ * (grabbedIndex >= 0), it positions the particle at the specified coordinates and
6
+ * sets its velocity to zero during the constrain phase. This approach is much more
7
+ * efficient than syncing the entire particle array on every mouse move event.
8
+ */
9
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
10
+ export declare const DEFAULT_GRAB_GRABBED_INDEX = -1;
11
+ export declare const DEFAULT_GRAB_POSITION_X = 0;
12
+ export declare const DEFAULT_GRAB_POSITION_Y = 0;
13
+ type GrabInputs = {
14
+ grabbedIndex: number;
15
+ positionX: number;
16
+ positionY: number;
17
+ };
18
+ export declare class Grab extends Module<"grab", GrabInputs> {
19
+ readonly name: "grab";
20
+ readonly role = ModuleRole.Force;
21
+ readonly inputs: {
22
+ readonly grabbedIndex: DataType.NUMBER;
23
+ readonly positionX: DataType.NUMBER;
24
+ readonly positionY: DataType.NUMBER;
25
+ };
26
+ constructor(opts?: {
27
+ enabled?: boolean;
28
+ grabbedIndex?: number;
29
+ positionX?: number;
30
+ positionY?: number;
31
+ });
32
+ setGrabbedIndex(value: number): void;
33
+ setPositionX(value: number): void;
34
+ setPositionY(value: number): void;
35
+ setPosition(position: {
36
+ x: number;
37
+ y: number;
38
+ }): void;
39
+ getGrabbedIndex(): number;
40
+ getPositionX(): number;
41
+ getPositionY(): number;
42
+ getPosition(): {
43
+ x: number;
44
+ y: number;
45
+ };
46
+ grabParticle(index: number, position: {
47
+ x: number;
48
+ y: number;
49
+ }): void;
50
+ releaseParticle(): void;
51
+ isGrabbing(): boolean;
52
+ webgpu(): WebGPUDescriptor<GrabInputs>;
53
+ cpu(): CPUDescriptor<GrabInputs>;
54
+ }
55
+ export {};
56
+ //# sourceMappingURL=grab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grab.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/grab.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAC7C,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,KAAK,UAAU,GAAG;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,qBAAa,IAAK,SAAQ,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;IAClD,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAU;IAChC,QAAQ,CAAC,IAAI,oBAAoB;IACjC,QAAQ,CAAC,MAAM;;;;MAIJ;gBAEC,IAAI,CAAC,EAAE;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB;IAeD,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIpC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjC,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjC,WAAW,CAAC,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAKrD,eAAe,IAAI,MAAM;IAIzB,YAAY,IAAI,MAAM;IAItB,YAAY,IAAI,MAAM;IAItB,WAAW,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAQvC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAQrE,eAAe,IAAI,IAAI;IAIvB,UAAU,IAAI,OAAO;IAIrB,MAAM,IAAI,gBAAgB,CAAC,UAAU,CAAC;IAqBtC,GAAG,IAAI,aAAa,CAAC,UAAU,CAAC;CA0BjC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Interaction (Force Module)
3
+ *
4
+ * Mouse-driven attract/repel impulse applied within a radius when the selected
5
+ * input button is active. Strength falls off to zero at the edge of the radius.
6
+ */
7
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
8
+ export declare const DEFAULT_INTERACTION_MODE: "attract" | "repel";
9
+ export declare const DEFAULT_INTERACTION_STRENGTH = 10000;
10
+ export declare const DEFAULT_INTERACTION_RADIUS = 500;
11
+ type InteractionInputs = {
12
+ mode: number;
13
+ strength: number;
14
+ radius: number;
15
+ positionX: number;
16
+ positionY: number;
17
+ active: number;
18
+ };
19
+ export declare class Interaction extends Module<"interaction", InteractionInputs> {
20
+ readonly name: "interaction";
21
+ readonly role = ModuleRole.Force;
22
+ readonly inputs: {
23
+ readonly mode: DataType.NUMBER;
24
+ readonly strength: DataType.NUMBER;
25
+ readonly radius: DataType.NUMBER;
26
+ readonly positionX: DataType.NUMBER;
27
+ readonly positionY: DataType.NUMBER;
28
+ readonly active: DataType.NUMBER;
29
+ };
30
+ constructor(opts?: {
31
+ enabled?: boolean;
32
+ action?: "click" | "right_click";
33
+ mode?: "attract" | "repel";
34
+ strength?: number;
35
+ radius?: number;
36
+ position?: {
37
+ x: number;
38
+ y: number;
39
+ };
40
+ active?: boolean;
41
+ });
42
+ setMode(v: "attract" | "repel"): void;
43
+ setStrength(v: number): void;
44
+ setRadius(v: number): void;
45
+ setPosition(x: number, y: number): void;
46
+ setActive(active: boolean): void;
47
+ getMode(): number;
48
+ getStrength(): number;
49
+ getRadius(): number;
50
+ getPosition(): {
51
+ x: number;
52
+ y: number;
53
+ };
54
+ isActive(): boolean;
55
+ webgpu(): WebGPUDescriptor<InteractionInputs>;
56
+ cpu(): CPUDescriptor<InteractionInputs>;
57
+ }
58
+ export {};
59
+ //# sourceMappingURL=interaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interaction.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/interaction.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,eAAO,MAAM,wBAAwB,EAAE,SAAS,GAAG,OAAmB,CAAC;AACvE,eAAO,MAAM,4BAA4B,QAAQ,CAAC;AAClD,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAK9C,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IAC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sB7C,GAAG,IAAI,aAAa,CAAC,iBAAiB,CAAC;CA8BxC"}
@@ -0,0 +1,87 @@
1
+ import { Module, ModuleRole, type WebGPUDescriptor, CPUDescriptor, DataType } from "../../module";
2
+ export declare const DEFAULT_JOINTS_RESTITUTION = 0.9;
3
+ export declare const DEFAULT_JOINTS_SEPARATION = 0.5;
4
+ export declare const DEFAULT_JOINTS_STEPS = 1;
5
+ export declare const DEFAULT_JOINTS_FRICTION = 0.01;
6
+ export declare const DEFAULT_JOINTS_MOMENTUM = 0.7;
7
+ export declare const DEFAULT_JOINTS_ENABLE_PARTICLE_COLLISIONS = 0;
8
+ export declare const DEFAULT_JOINTS_ENABLE_JOINT_COLLISIONS = 0;
9
+ export interface Joint {
10
+ aIndex: number;
11
+ bIndex: number;
12
+ restLength: number;
13
+ }
14
+ type JointsInputs = {
15
+ aIndexes: number[];
16
+ bIndexes: number[];
17
+ restLengths: number[];
18
+ incidentJointOffsets: number[];
19
+ incidentJointIndices: number[];
20
+ enableParticleCollisions: number;
21
+ enableJointCollisions: number;
22
+ momentum: number;
23
+ restitution: number;
24
+ separation: number;
25
+ steps: number;
26
+ friction: number;
27
+ groupIds: number[];
28
+ };
29
+ export declare class Joints extends Module<"joints", JointsInputs> {
30
+ readonly name: "joints";
31
+ readonly role = ModuleRole.Force;
32
+ readonly inputs: {
33
+ readonly aIndexes: DataType.ARRAY;
34
+ readonly bIndexes: DataType.ARRAY;
35
+ readonly restLengths: DataType.ARRAY;
36
+ readonly incidentJointOffsets: DataType.ARRAY;
37
+ readonly incidentJointIndices: DataType.ARRAY;
38
+ readonly enableParticleCollisions: DataType.NUMBER;
39
+ readonly enableJointCollisions: DataType.NUMBER;
40
+ readonly momentum: DataType.NUMBER;
41
+ readonly restitution: DataType.NUMBER;
42
+ readonly separation: DataType.NUMBER;
43
+ readonly steps: DataType.NUMBER;
44
+ readonly friction: DataType.NUMBER;
45
+ readonly groupIds: DataType.ARRAY;
46
+ };
47
+ constructor(opts?: {
48
+ enabled?: boolean;
49
+ joints?: Joint[];
50
+ aIndexes?: number[];
51
+ bIndexes?: number[];
52
+ restLengths?: number[];
53
+ enableParticleCollisions?: boolean;
54
+ enableJointCollisions?: boolean;
55
+ momentum?: number;
56
+ restitution?: number;
57
+ separation?: number;
58
+ steps?: number;
59
+ friction?: number;
60
+ });
61
+ getJoints(): Joint[];
62
+ setJoints(joints: Joint[]): void;
63
+ setJoints(aIndexes: number[], bIndexes: number[], restLengths: number[]): void;
64
+ getEnableParticleCollisions(): number;
65
+ setEnableParticleCollisions(val: number | boolean): void;
66
+ getEnableJointCollisions(): number;
67
+ setEnableJointCollisions(val: number | boolean): void;
68
+ getEnableCollisions(): number;
69
+ setEnableCollisions(val: number | boolean): void;
70
+ getMomentum(): number;
71
+ setMomentum(val: number): void;
72
+ getRestitution(): number;
73
+ setRestitution(val: number): void;
74
+ getSeparation(): number;
75
+ setSeparation(val: number): void;
76
+ getSteps(): number;
77
+ setSteps(val: number): void;
78
+ getFriction(): number;
79
+ setFriction(val: number): void;
80
+ add(joint: Joint): void;
81
+ remove(aIndex: number, bIndex: number): void;
82
+ removeAll(): void;
83
+ webgpu(): WebGPUDescriptor<JointsInputs, "prevX" | "prevY">;
84
+ cpu(): CPUDescriptor<JointsInputs, "prevX" | "prevY">;
85
+ }
86
+ export {};
87
+ //# sourceMappingURL=joints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joints.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/joints.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,UAAU,EACV,KAAK,gBAAgB,EACrB,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAGtB,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAC9C,eAAO,MAAM,yBAAyB,MAAM,CAAC;AAC7C,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,uBAAuB,OAAO,CAAC;AAC5C,eAAO,MAAM,uBAAuB,MAAM,CA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module)
3
+ *
4
+ * Samples the scene texture around two forward-biased sensor points (left/right)
5
+ * to derive simple follow/flee steering decisions. Supports color-aware behaviors
6
+ * (same/different) and intensity-only mode. Writes directly to velocity for snappy
7
+ * reactions (mirrors CPU behavior path).
8
+ */
9
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
10
+ export type SensorBehavior = "any" | "same" | "different" | "none";
11
+ export declare const DEFAULT_SENSORS_SENSOR_DISTANCE = 30;
12
+ export declare const DEFAULT_SENSORS_SENSOR_ANGLE: number;
13
+ export declare const DEFAULT_SENSORS_SENSOR_RADIUS = 3;
14
+ export declare const DEFAULT_SENSORS_SENSOR_THRESHOLD = 0.1;
15
+ export declare const DEFAULT_SENSORS_SENSOR_STRENGTH = 1000;
16
+ export declare const DEFAULT_SENSORS_COLOR_SIMILARITY_THRESHOLD = 0.4;
17
+ export declare const DEFAULT_SENSORS_FOLLOW_BEHAVIOR: SensorBehavior;
18
+ export declare const DEFAULT_SENSORS_FLEE_BEHAVIOR: SensorBehavior;
19
+ export declare const DEFAULT_SENSORS_FLEE_ANGLE: number;
20
+ type SensorsInputs = {
21
+ sensorDistance: number;
22
+ sensorAngle: number;
23
+ sensorRadius: number;
24
+ sensorThreshold: number;
25
+ sensorStrength: number;
26
+ colorSimilarityThreshold: number;
27
+ followBehavior: number;
28
+ fleeBehavior: number;
29
+ fleeAngle: number;
30
+ };
31
+ export declare class Sensors extends Module<"sensors", SensorsInputs> {
32
+ readonly name: "sensors";
33
+ readonly role = ModuleRole.Force;
34
+ readonly inputs: {
35
+ readonly sensorDistance: DataType.NUMBER;
36
+ readonly sensorAngle: DataType.NUMBER;
37
+ readonly sensorRadius: DataType.NUMBER;
38
+ readonly sensorThreshold: DataType.NUMBER;
39
+ readonly sensorStrength: DataType.NUMBER;
40
+ readonly colorSimilarityThreshold: DataType.NUMBER;
41
+ readonly followBehavior: DataType.NUMBER;
42
+ readonly fleeBehavior: DataType.NUMBER;
43
+ readonly fleeAngle: DataType.NUMBER;
44
+ };
45
+ constructor(opts?: {
46
+ enabled?: boolean;
47
+ sensorDistance?: number;
48
+ sensorAngle?: number;
49
+ sensorRadius?: number;
50
+ sensorThreshold?: number;
51
+ sensorStrength?: number;
52
+ colorSimilarityThreshold?: number;
53
+ followBehavior?: SensorBehavior;
54
+ fleeBehavior?: SensorBehavior;
55
+ fleeAngle?: number;
56
+ });
57
+ private behaviorToUniform;
58
+ setSensorDistance(value: number): void;
59
+ setSensorAngle(value: number): void;
60
+ setSensorRadius(value: number): void;
61
+ setSensorThreshold(value: number): void;
62
+ setSensorStrength(value: number): void;
63
+ setColorSimilarityThreshold(value: number): void;
64
+ setFollowBehavior(behavior: SensorBehavior): void;
65
+ setFleeBehavior(behavior: SensorBehavior): void;
66
+ setFleeAngle(value: number): void;
67
+ getSensorDistance(): number;
68
+ getSensorAngle(): number;
69
+ getSensorRadius(): number;
70
+ getSensorThreshold(): number;
71
+ getSensorStrength(): number;
72
+ getColorSimilarityThreshold(): number;
73
+ getFollowBehavior(): number;
74
+ getFleeBehavior(): number;
75
+ getFleeAngle(): number;
76
+ getEnabled(): number;
77
+ webgpu(): WebGPUDescriptor<SensorsInputs>;
78
+ cpu(): CPUDescriptor<SensorsInputs>;
79
+ }
80
+ export {};
81
+ //# sourceMappingURL=sensors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sensors.d.ts","sourceRoot":"","sources":["../../../src/modules/forces/sensors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;AAEnE,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAClD,eAAO,MAAM,4BAA4B,QAAc,CAAC;AACxD,eAAO,MAAM,6BAA6B,IAAI,CAAC;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AC,KAAK,EAAE,MAAM,GAAG,IAAI;IAInC,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIpC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIvC,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAItC,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIhD,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAIjD,eAAe,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAI/C,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAIjC,iBAAiB,IAAI,MAAM;IAG3B,cAAc,IAAI,MAAM;IAGxB,eAAe,IAAI,MAAM;IAGzB,kBAAkB,IAAI,MAAM;IAG5B,iBAAiB,IAAI,MAAM;IAG3B,2BAA2B,IAAI,MAAM;IAGrC,iBAAiB,IAAI,MAAM;IAG3B,eAAe,IAAI,MAAM;IAGzB,YAAY,IAAI,MAAM;IAGtB,UAAU,IAAI,MAAM;IAIpB,MAAM,IAAI,gBAAgB,CAAC,aAAa,CAAC;IA2OzC,GAAG,IAAI,aAAa,CAAC,aAAa,CAAC;CA4TpC"}
@@ -0,0 +1,13 @@
1
+ export * from "./forces/environment";
2
+ export * from "./forces/boundary";
3
+ export * from "./forces/collisions";
4
+ export * from "./forces/fluids";
5
+ export * from "./forces/behavior";
6
+ export * from "./forces/sensors";
7
+ export * from "./forces/interaction";
8
+ export * from "./forces/joints";
9
+ export * from "./forces/grab";
10
+ export * from "./render/trails";
11
+ export * from "./render/lines";
12
+ export * from "./render/particles";
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,55 @@
1
+ import { Module, ModuleRole, type WebGPUDescriptor, CPUDescriptor, DataType } from "../../module";
2
+ export interface Line {
3
+ aIndex: number;
4
+ bIndex: number;
5
+ }
6
+ type LinesInputs = {
7
+ aIndexes: number[];
8
+ bIndexes: number[];
9
+ lineWidth: number;
10
+ lineColorR: number;
11
+ lineColorG: number;
12
+ lineColorB: number;
13
+ };
14
+ export declare class Lines extends Module<"lines", LinesInputs> {
15
+ readonly name: "lines";
16
+ readonly role = ModuleRole.Render;
17
+ readonly inputs: {
18
+ readonly aIndexes: DataType.ARRAY;
19
+ readonly bIndexes: DataType.ARRAY;
20
+ readonly lineWidth: DataType.NUMBER;
21
+ readonly lineColorR: DataType.NUMBER;
22
+ readonly lineColorG: DataType.NUMBER;
23
+ readonly lineColorB: DataType.NUMBER;
24
+ };
25
+ constructor(opts?: {
26
+ enabled?: boolean;
27
+ lines?: Line[];
28
+ aIndexes?: number[];
29
+ bIndexes?: number[];
30
+ lineWidth?: number;
31
+ });
32
+ getLines(): Line[];
33
+ setLines(lines: Line[]): void;
34
+ setLines(aIndexes: number[], bIndexes: number[]): void;
35
+ setLineWidth(value: number): void;
36
+ setLineColor(color: {
37
+ r: number;
38
+ g: number;
39
+ b: number;
40
+ a: number;
41
+ } | null): void;
42
+ getLineColor(): {
43
+ r: number;
44
+ g: number;
45
+ b: number;
46
+ a: number;
47
+ } | null;
48
+ add(line: Line): void;
49
+ remove(aIndex: number, bIndex: number): void;
50
+ removeAll(): void;
51
+ webgpu(): WebGPUDescriptor<LinesInputs>;
52
+ cpu(): CPUDescriptor<LinesInputs>;
53
+ }
54
+ export {};
55
+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AAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,GAC3D,IAAI;IAYP,YAAY,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAQrE,GAAG,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAqBrB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAkB5C,SAAS,IAAI,IAAI;IAIjB,MAAM,IAAI,gBAAgB,CAAC,WAAW,CAAC;IAqEvC,GAAG,IAAI,aAAa,CAAC,WAAW,CAAC;CAgDlC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Particles (Render Module)
3
+ *
4
+ * Single fullscreen pass that instanced-draws particle quads into the scene.
5
+ * Fragment shader renders a soft-disc using the particle color and alpha falloff.
6
+ */
7
+ import { Module, type WebGPUDescriptor, ModuleRole, CPUDescriptor, DataType } from "../../module";
8
+ export declare enum ParticlesColorType {
9
+ Default = 0,
10
+ Custom = 1,
11
+ Hue = 2
12
+ }
13
+ type ParticlesInputs = {
14
+ colorType: number;
15
+ customColorR: number;
16
+ customColorG: number;
17
+ customColorB: number;
18
+ hue: number;
19
+ };
20
+ export declare class Particles extends Module<"particles", ParticlesInputs> {
21
+ readonly name: "particles";
22
+ readonly role = ModuleRole.Render;
23
+ readonly inputs: {
24
+ readonly colorType: DataType.NUMBER;
25
+ readonly customColorR: DataType.NUMBER;
26
+ readonly customColorG: DataType.NUMBER;
27
+ readonly customColorB: DataType.NUMBER;
28
+ readonly hue: DataType.NUMBER;
29
+ };
30
+ constructor(opts?: {
31
+ enabled?: boolean;
32
+ colorType?: ParticlesColorType;
33
+ customColor?: {
34
+ r: number;
35
+ g: number;
36
+ b: number;
37
+ a: number;
38
+ };
39
+ hue?: number;
40
+ });
41
+ setColorType(type: ParticlesColorType): void;
42
+ setCustomColor(color: {
43
+ r: number;
44
+ g: number;
45
+ b: number;
46
+ a: number;
47
+ }): void;
48
+ setHue(hue: number): void;
49
+ webgpu(): WebGPUDescriptor<ParticlesInputs>;
50
+ cpu(): CPUDescriptor<ParticlesInputs>;
51
+ }
52
+ export {};
53
+ //# sourceMappingURL=particles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"particles.d.ts","sourceRoot":"","sources":["../../../src/modules/render/particles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EACL,MAAM,EACN,KAAK,gBAAgB,EACrB,UAAU,EAEV,aAAa,EAEb,QAAQ,EACT,MAAM,cAAc,CAAC;AAEtB,oBAAY,kBAAkB;IAC5B,OAAO,IAAI;IACX,MAAM,IAAI;IACV,GAAG,IAAI;CACR;AAED,KAAK,eAAe,GAAG;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qBAAa,SAAU,SAAQ,MAAM,CAAC,WAAW,EAAE,eAAe,CAAC;IACjE,QAAQ,CAAC,IAAI,EAAG,WAAW,CAAU;IACrC,QAAQ,CAAC,IAAI,qBAAqB;IAClC,QAAQ,CAAC,MAAM;;;;;;MAMJ;gBAEC,IAAI,CAAC,EAAE;QACjB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,kBAAkB,CAAC;QAC/B,WAAW,CAAC,EAAE;YAAE,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;QAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;KACd;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