@polarfront-lab/ionian 1.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.
@@ -0,0 +1,88 @@
1
+ import * as THREE from 'three';
2
+
3
+ /**
4
+ * Represents an entry for an asset, pairing an ID with the asset itself.
5
+ * @template T The type of the asset.
6
+ */
7
+ declare type AssetEntry<T> = {
8
+ id: string;
9
+ item: T;
10
+ };
11
+
12
+ /**
13
+ * Represents an easing function.
14
+ */
15
+ declare interface EasingFunction {
16
+ (n: number): number;
17
+ }
18
+
19
+ /**
20
+ * The main class for the particle engine.
21
+ */
22
+ export declare class ParticlesEngine {
23
+ private simulationRendererService;
24
+ private eventEmitter;
25
+ private renderer;
26
+ private scene;
27
+ private serviceStates;
28
+ private dataTextureManager;
29
+ private matcapService;
30
+ private instancedMeshManager;
31
+ private transitionService;
32
+ private engineState;
33
+ private intersectionService;
34
+ /**
35
+ * Creates a new ParticlesEngine instance.
36
+ * @param params The parameters for creating the instance.
37
+ */
38
+ constructor(params: ParticlesEngineParameters);
39
+ /**
40
+ * Renders the scene.
41
+ * @param elapsedTime The elapsed time since the last frame.
42
+ */
43
+ render(elapsedTime: number): void;
44
+ setOriginDataTexture(meshID: string, override?: boolean): void;
45
+ setDestinationDataTexture(meshID: string, override?: boolean): void;
46
+ setDataTextureTransitionProgress(progress: number, override?: boolean): void;
47
+ setOriginMatcap(matcapID: string, override?: boolean): void;
48
+ setDestinationMatcap(matcapID: string, override?: boolean): void;
49
+ setMatcapProgress(progress: number, override?: boolean): void;
50
+ setTextureSize(size: number): Promise<void>;
51
+ setPointerPosition(position: THREE.Vector2Like): void;
52
+ setGeometrySize(geometrySize: THREE.Vector3Like): void;
53
+ setVelocityTractionForce(force: number): void;
54
+ setPositionalTractionForce(force: number): void;
55
+ setMaxRepelDistance(distance: number): void;
56
+ scheduleMeshTransition(originMeshID: string, destinationMeshID: string, easing?: EasingFunction, duration?: number, override?: boolean): void;
57
+ scheduleMatcapTransition(originMatcapID: string, destinationMatcapID: string, easing?: EasingFunction, duration?: number, override?: boolean): void;
58
+ handleServiceStateUpdated({ type, state }: {
59
+ type: ServiceType;
60
+ state: ServiceState;
61
+ }): void;
62
+ /**
63
+ * Disposes the resources used by the engine.
64
+ */
65
+ dispose(): void;
66
+ private initialEngineState;
67
+ private initialServiceStates;
68
+ private handleTransitionProgress;
69
+ private handleInteractionPositionUpdated;
70
+ }
71
+
72
+ /**
73
+ * Parameters for creating a ParticlesEngine instance.
74
+ */
75
+ declare type ParticlesEngineParameters = {
76
+ textureSize: number;
77
+ scene: THREE.Scene;
78
+ renderer: THREE.WebGLRenderer;
79
+ meshes?: AssetEntry<THREE.Mesh>[];
80
+ matcaps?: AssetEntry<THREE.Texture>[];
81
+ camera?: THREE.Camera;
82
+ };
83
+
84
+ declare type ServiceState = 'created' | 'initializing' | 'ready' | 'disposed' | 'error' | 'loading';
85
+
86
+ declare type ServiceType = 'data-texture' | 'matcap' | 'instanced-mesh' | 'simulation';
87
+
88
+ export { }