scichart-engine 0.4.2 → 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.
- package/dist/core/3d/Area3DRenderer.d.ts +117 -0
- package/dist/core/3d/Axes3D.d.ts +104 -0
- package/dist/core/3d/Bubble3DRenderer.d.ts +194 -0
- package/dist/core/3d/Impulse3DRenderer.d.ts +126 -0
- package/dist/core/3d/Line3DRenderer.d.ts +118 -0
- package/dist/core/3d/PointCloud3DRenderer.d.ts +79 -0
- package/dist/core/3d/Raycaster3D.d.ts +137 -0
- package/dist/core/3d/Ribbon3DRenderer.d.ts +78 -0
- package/dist/core/3d/SurfaceBar3DRenderer.d.ts +87 -0
- package/dist/core/3d/SurfaceMesh3DRenderer.d.ts +130 -0
- package/dist/core/3d/Tooltip3D.d.ts +71 -0
- package/dist/core/3d/VectorField3DRenderer.d.ts +82 -0
- package/dist/core/3d/Voxel3DRenderer.d.ts +86 -0
- package/dist/core/3d/Waterfall3DRenderer.d.ts +88 -0
- package/dist/core/3d/camera/OrbitCamera.d.ts +99 -0
- package/dist/core/3d/camera/index.d.ts +1 -0
- package/dist/core/3d/controls/OrbitController.d.ts +69 -0
- package/dist/core/3d/controls/index.d.ts +1 -0
- package/dist/core/3d/index.d.ts +59 -0
- package/dist/core/3d/math/Mat4.d.ts +33 -0
- package/dist/core/3d/math/Vec3.d.ts +37 -0
- package/dist/core/3d/math/index.d.ts +4 -0
- package/dist/core/3d/mesh/InstancedMesh.d.ts +42 -0
- package/dist/core/3d/mesh/geometry.d.ts +34 -0
- package/dist/core/3d/mesh/index.d.ts +2 -0
- package/dist/core/3d/series/Area3D.d.ts +17 -0
- package/dist/core/3d/series/Column3D.d.ts +20 -0
- package/dist/core/3d/series/Heatmap3D.d.ts +17 -0
- package/dist/core/3d/series/Impulse3D.d.ts +16 -0
- package/dist/core/3d/series/PointLine3D.d.ts +20 -0
- package/dist/core/3d/series/Ribbon3D.d.ts +17 -0
- package/dist/core/3d/series/Scatter3D.d.ts +21 -0
- package/dist/core/3d/series/SurfaceMesh3D.d.ts +35 -0
- package/dist/core/3d/series/Waterfall3D.d.ts +38 -0
- package/dist/core/3d/series/index.d.ts +13 -0
- package/dist/core/3d/series/types.d.ts +143 -0
- package/dist/core/3d/shader/index.d.ts +2 -0
- package/dist/core/3d/shader/programs.d.ts +24 -0
- package/dist/core/3d/shader/sources.d.ts +27 -0
- package/dist/core/3d/types.d.ts +71 -0
- package/dist/core/OverlayRenderer.d.ts +3 -3
- package/dist/scichart-engine.es.js +27 -27
- package/dist/scichart-engine.es.js.map +1 -1
- package/dist/scichart-engine.umd.js +30 -30
- package/dist/scichart-engine.umd.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/package.json +10 -11
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { OrbitCamera, OrbitCameraOptions } from './camera/OrbitCamera';
|
|
2
|
+
import { OrbitControllerOptions } from './controls/OrbitController';
|
|
3
|
+
import { Axes3DOptions } from './Axes3D';
|
|
4
|
+
import { Tooltip3DOptions } from './Tooltip3D';
|
|
5
|
+
import { Renderer3DOptions, RenderStats3D, Renderer3DEventCallback } from './types';
|
|
6
|
+
|
|
7
|
+
export interface AreaSeriesData {
|
|
8
|
+
/** X coordinates */
|
|
9
|
+
x: Float32Array;
|
|
10
|
+
/** Y coordinates (top of area) */
|
|
11
|
+
y: Float32Array;
|
|
12
|
+
/** Z coordinates */
|
|
13
|
+
z: Float32Array;
|
|
14
|
+
/** Base Y value (bottom of area, default: 0) */
|
|
15
|
+
baseY?: number;
|
|
16
|
+
/** Color per vertex (optional, RGB) */
|
|
17
|
+
colors?: Float32Array;
|
|
18
|
+
/** Single area color [r, g, b] */
|
|
19
|
+
color?: [number, number, number];
|
|
20
|
+
}
|
|
21
|
+
export interface Area3DRendererOptions extends Renderer3DOptions {
|
|
22
|
+
camera?: OrbitCameraOptions;
|
|
23
|
+
controls?: OrbitControllerOptions;
|
|
24
|
+
axes?: Axes3DOptions;
|
|
25
|
+
showAxes?: boolean;
|
|
26
|
+
/** Opacity of areas (default: 0.8) */
|
|
27
|
+
opacity?: number;
|
|
28
|
+
/** Enable tooltips (default: true) */
|
|
29
|
+
enableTooltip?: boolean;
|
|
30
|
+
tooltip?: Tooltip3DOptions;
|
|
31
|
+
}
|
|
32
|
+
export declare class Area3DRenderer {
|
|
33
|
+
private canvas;
|
|
34
|
+
private gl;
|
|
35
|
+
private dpr;
|
|
36
|
+
private programs;
|
|
37
|
+
private camera;
|
|
38
|
+
private controller;
|
|
39
|
+
private axes;
|
|
40
|
+
private vao;
|
|
41
|
+
private positionBuffer;
|
|
42
|
+
private normalBuffer;
|
|
43
|
+
private colorBuffer;
|
|
44
|
+
private indexBuffer;
|
|
45
|
+
private indexCount;
|
|
46
|
+
private backgroundColor;
|
|
47
|
+
private showAxes;
|
|
48
|
+
private opacity;
|
|
49
|
+
private areas;
|
|
50
|
+
private bounds;
|
|
51
|
+
private animationFrameId;
|
|
52
|
+
private needsRender;
|
|
53
|
+
private eventListeners;
|
|
54
|
+
private tooltip;
|
|
55
|
+
private enableTooltip;
|
|
56
|
+
private lastHitIndex;
|
|
57
|
+
private boundHandleMouseMove?;
|
|
58
|
+
private boundHandleMouseLeave?;
|
|
59
|
+
private lastFrameTime;
|
|
60
|
+
private frameCount;
|
|
61
|
+
private fps;
|
|
62
|
+
private lastFpsUpdate;
|
|
63
|
+
constructor(options: Area3DRendererOptions);
|
|
64
|
+
private handleMouseMove;
|
|
65
|
+
private handleMouseLeave;
|
|
66
|
+
pickAtScreen(screenX: number, screenY: number): {
|
|
67
|
+
seriesIndex: number;
|
|
68
|
+
pointIndex: number;
|
|
69
|
+
distance: number;
|
|
70
|
+
point: [number, number, number];
|
|
71
|
+
} | null;
|
|
72
|
+
private initBuffers;
|
|
73
|
+
private handleResize;
|
|
74
|
+
resize(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Set area data (single area or array of areas)
|
|
77
|
+
*/
|
|
78
|
+
setData(areas: AreaSeriesData | AreaSeriesData[]): void;
|
|
79
|
+
/**
|
|
80
|
+
* Add a single area
|
|
81
|
+
*/
|
|
82
|
+
addArea(area: AreaSeriesData): void;
|
|
83
|
+
/**
|
|
84
|
+
* Clear all areas
|
|
85
|
+
*/
|
|
86
|
+
clearAreas(): void;
|
|
87
|
+
private buildAreaGeometry;
|
|
88
|
+
private calculateBounds;
|
|
89
|
+
/**
|
|
90
|
+
* Fit camera to show all data
|
|
91
|
+
*/
|
|
92
|
+
fitToData(): void;
|
|
93
|
+
getCanvasSize(): {
|
|
94
|
+
width: number;
|
|
95
|
+
height: number;
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Render a single frame
|
|
99
|
+
*/
|
|
100
|
+
render(): void;
|
|
101
|
+
startRenderLoop(): void;
|
|
102
|
+
stopRenderLoop(): void;
|
|
103
|
+
getStats(): RenderStats3D;
|
|
104
|
+
getCamera(): OrbitCamera;
|
|
105
|
+
getAxisLabels(): import('./Axes3D').AxisLabel3D[];
|
|
106
|
+
getViewProjectionMatrix(): Float32Array;
|
|
107
|
+
projectToScreen(worldPos: [number, number, number]): {
|
|
108
|
+
x: number;
|
|
109
|
+
y: number;
|
|
110
|
+
visible: boolean;
|
|
111
|
+
};
|
|
112
|
+
exportImage(format?: 'png' | 'jpeg' | 'webp', quality?: number, transparent?: boolean): string;
|
|
113
|
+
on(event: string, callback: Renderer3DEventCallback): void;
|
|
114
|
+
off(event: string, callback: Renderer3DEventCallback): void;
|
|
115
|
+
private emitEvent;
|
|
116
|
+
destroy(): void;
|
|
117
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Bounds3D, Axis3DConfig } from './types';
|
|
2
|
+
|
|
3
|
+
/** Axis label info for text overlay rendering */
|
|
4
|
+
export interface AxisLabel3D {
|
|
5
|
+
text: string;
|
|
6
|
+
worldPosition: [number, number, number];
|
|
7
|
+
axis: 'x' | 'y' | 'z' | 'title';
|
|
8
|
+
color: [number, number, number];
|
|
9
|
+
}
|
|
10
|
+
/** Full axis configuration with defaults applied */
|
|
11
|
+
export interface Axes3DOptions {
|
|
12
|
+
/** X-axis configuration */
|
|
13
|
+
xAxis?: Axis3DConfig & {
|
|
14
|
+
label?: string;
|
|
15
|
+
tickFormat?: (v: number) => string;
|
|
16
|
+
};
|
|
17
|
+
/** Y-axis configuration */
|
|
18
|
+
yAxis?: Axis3DConfig & {
|
|
19
|
+
label?: string;
|
|
20
|
+
tickFormat?: (v: number) => string;
|
|
21
|
+
};
|
|
22
|
+
/** Z-axis configuration */
|
|
23
|
+
zAxis?: Axis3DConfig & {
|
|
24
|
+
label?: string;
|
|
25
|
+
tickFormat?: (v: number) => string;
|
|
26
|
+
};
|
|
27
|
+
/** Show axis lines */
|
|
28
|
+
showAxes?: boolean;
|
|
29
|
+
/** Show wall grids */
|
|
30
|
+
showWallGrids?: boolean;
|
|
31
|
+
/** Show floor grid (XZ plane) */
|
|
32
|
+
showFloorGrid?: boolean;
|
|
33
|
+
/** Grid line color */
|
|
34
|
+
gridColor?: [number, number, number];
|
|
35
|
+
/** Grid line opacity */
|
|
36
|
+
gridOpacity?: number;
|
|
37
|
+
/** Wall grid opacity (slightly more transparent) */
|
|
38
|
+
wallGridOpacity?: number;
|
|
39
|
+
/** Number of ticks per axis */
|
|
40
|
+
tickCount?: number;
|
|
41
|
+
/** Axis line width */
|
|
42
|
+
lineWidth?: number;
|
|
43
|
+
/** Box wireframe color */
|
|
44
|
+
boxColor?: [number, number, number];
|
|
45
|
+
/** Box wireframe opacity */
|
|
46
|
+
boxOpacity?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare class Axes3D {
|
|
49
|
+
private gl;
|
|
50
|
+
private axisVAO;
|
|
51
|
+
private axisPositionBuffer;
|
|
52
|
+
private axisColorBuffer;
|
|
53
|
+
private gridVAO;
|
|
54
|
+
private gridPositionBuffer;
|
|
55
|
+
private gridColorBuffer;
|
|
56
|
+
private boxVAO;
|
|
57
|
+
private boxPositionBuffer;
|
|
58
|
+
private boxColorBuffer;
|
|
59
|
+
private lineProgram;
|
|
60
|
+
private lineUniforms;
|
|
61
|
+
private axisVertexCount;
|
|
62
|
+
private gridVertexCount;
|
|
63
|
+
private boxVertexCount;
|
|
64
|
+
private bounds;
|
|
65
|
+
private labels;
|
|
66
|
+
private options;
|
|
67
|
+
constructor(gl: WebGL2RenderingContext, options?: Axes3DOptions);
|
|
68
|
+
private initLineShader;
|
|
69
|
+
private initBuffers;
|
|
70
|
+
/**
|
|
71
|
+
* Update axes geometry based on data bounds
|
|
72
|
+
*/
|
|
73
|
+
updateBounds(bounds: Bounds3D): void;
|
|
74
|
+
private buildBoxGeometry;
|
|
75
|
+
private buildGridGeometry;
|
|
76
|
+
private buildAxisGeometry;
|
|
77
|
+
private buildLabels;
|
|
78
|
+
/**
|
|
79
|
+
* Render axes and grid
|
|
80
|
+
*/
|
|
81
|
+
render(viewProjectionMatrix: Float32Array): void;
|
|
82
|
+
private renderLines;
|
|
83
|
+
/**
|
|
84
|
+
* Get labels for 2D text overlay rendering.
|
|
85
|
+
* Returns world positions that need to be projected to screen coordinates.
|
|
86
|
+
*/
|
|
87
|
+
getLabels(): AxisLabel3D[];
|
|
88
|
+
/**
|
|
89
|
+
* Project a 3D world position to 2D screen coordinates.
|
|
90
|
+
*/
|
|
91
|
+
projectToScreen(worldPos: [number, number, number], viewProjectionMatrix: Float32Array, canvasWidth: number, canvasHeight: number): {
|
|
92
|
+
x: number;
|
|
93
|
+
y: number;
|
|
94
|
+
visible: boolean;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Update options
|
|
98
|
+
*/
|
|
99
|
+
setOptions(options: Partial<Axes3DOptions>): void;
|
|
100
|
+
/**
|
|
101
|
+
* Cleanup resources
|
|
102
|
+
*/
|
|
103
|
+
destroy(): void;
|
|
104
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { OrbitCamera, OrbitCameraOptions } from './camera/OrbitCamera';
|
|
2
|
+
import { OrbitController, OrbitControllerOptions } from './controls/OrbitController';
|
|
3
|
+
import { Axes3DOptions } from './Axes3D';
|
|
4
|
+
import { Ray3D, HitResult } from './Raycaster3D';
|
|
5
|
+
import { Bubble3DData, Bubble3DStyle, Renderer3DOptions, RenderStats3D, Renderer3DEventCallback } from './types';
|
|
6
|
+
import { Tooltip3DOptions, Tooltip3DData } from './Tooltip3D';
|
|
7
|
+
|
|
8
|
+
export interface Bubble3DRendererOptions extends Renderer3DOptions {
|
|
9
|
+
camera?: OrbitCameraOptions;
|
|
10
|
+
controls?: OrbitControllerOptions;
|
|
11
|
+
style?: Bubble3DStyle;
|
|
12
|
+
autoRender?: boolean;
|
|
13
|
+
/** Axes configuration */
|
|
14
|
+
axes?: Axes3DOptions;
|
|
15
|
+
/** Show axes (default: true) */
|
|
16
|
+
showAxes?: boolean;
|
|
17
|
+
/** Enable tooltips on hover (default: true) */
|
|
18
|
+
enableTooltip?: boolean;
|
|
19
|
+
/** Tooltip configuration */
|
|
20
|
+
tooltip?: Tooltip3DOptions;
|
|
21
|
+
/** Custom tooltip formatter */
|
|
22
|
+
tooltipFormatter?: (data: Tooltip3DData) => string;
|
|
23
|
+
}
|
|
24
|
+
export declare class Bubble3DRenderer {
|
|
25
|
+
private canvas;
|
|
26
|
+
private gl;
|
|
27
|
+
private dpr;
|
|
28
|
+
private programs;
|
|
29
|
+
private mesh;
|
|
30
|
+
private camera;
|
|
31
|
+
private controller;
|
|
32
|
+
private axes;
|
|
33
|
+
private backgroundColor;
|
|
34
|
+
private style;
|
|
35
|
+
private showAxes;
|
|
36
|
+
private instanceData;
|
|
37
|
+
private bounds;
|
|
38
|
+
private animationFrameId;
|
|
39
|
+
private autoRender;
|
|
40
|
+
private needsRender;
|
|
41
|
+
private eventListeners;
|
|
42
|
+
private tooltip;
|
|
43
|
+
private enableTooltip;
|
|
44
|
+
private lastHitIndex;
|
|
45
|
+
private boundHandleMouseMove;
|
|
46
|
+
private boundHandleMouseLeave;
|
|
47
|
+
private lastFrameTime;
|
|
48
|
+
private frameCount;
|
|
49
|
+
private fps;
|
|
50
|
+
private lastFpsUpdate;
|
|
51
|
+
constructor(options: Bubble3DRendererOptions);
|
|
52
|
+
private handleMouseMove;
|
|
53
|
+
private handleMouseLeave;
|
|
54
|
+
private createGeometry;
|
|
55
|
+
private handleResize;
|
|
56
|
+
/**
|
|
57
|
+
* Resize canvas to match display size.
|
|
58
|
+
*/
|
|
59
|
+
resize(): void;
|
|
60
|
+
/**
|
|
61
|
+
* Set bubble data for rendering.
|
|
62
|
+
*/
|
|
63
|
+
setData(data: Bubble3DData): void;
|
|
64
|
+
private calculateBounds;
|
|
65
|
+
/**
|
|
66
|
+
* Fit camera to view all data.
|
|
67
|
+
*/
|
|
68
|
+
fitToData(): void;
|
|
69
|
+
/**
|
|
70
|
+
* Render a single frame.
|
|
71
|
+
*/
|
|
72
|
+
render(): void;
|
|
73
|
+
/**
|
|
74
|
+
* Start automatic render loop.
|
|
75
|
+
*/
|
|
76
|
+
startRenderLoop(): void;
|
|
77
|
+
/**
|
|
78
|
+
* Stop automatic render loop.
|
|
79
|
+
*/
|
|
80
|
+
stopRenderLoop(): void;
|
|
81
|
+
/**
|
|
82
|
+
* Request a render on next frame.
|
|
83
|
+
*/
|
|
84
|
+
requestRender(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Get render statistics.
|
|
87
|
+
*/
|
|
88
|
+
getStats(): RenderStats3D;
|
|
89
|
+
/**
|
|
90
|
+
* Get camera instance for direct manipulation.
|
|
91
|
+
*/
|
|
92
|
+
getCamera(): OrbitCamera;
|
|
93
|
+
/**
|
|
94
|
+
* Get controller instance for configuration.
|
|
95
|
+
*/
|
|
96
|
+
getController(): OrbitController;
|
|
97
|
+
/**
|
|
98
|
+
* Update style options.
|
|
99
|
+
*/
|
|
100
|
+
setStyle(style: Partial<Bubble3DStyle>): void;
|
|
101
|
+
/**
|
|
102
|
+
* Set background color.
|
|
103
|
+
*/
|
|
104
|
+
setBackgroundColor(r: number, g: number, b: number, a?: number): void;
|
|
105
|
+
/**
|
|
106
|
+
* Add event listener.
|
|
107
|
+
*/
|
|
108
|
+
on(event: string, callback: Renderer3DEventCallback): void;
|
|
109
|
+
/**
|
|
110
|
+
* Remove event listener.
|
|
111
|
+
*/
|
|
112
|
+
off(event: string, callback: Renderer3DEventCallback): void;
|
|
113
|
+
private emitEvent;
|
|
114
|
+
/**
|
|
115
|
+
* Get axis labels for 2D text overlay rendering.
|
|
116
|
+
* Returns labels with world positions that need to be projected to screen.
|
|
117
|
+
*/
|
|
118
|
+
getAxisLabels(): {
|
|
119
|
+
text: string;
|
|
120
|
+
worldPosition: [number, number, number];
|
|
121
|
+
axis: string;
|
|
122
|
+
color: [number, number, number];
|
|
123
|
+
}[];
|
|
124
|
+
/**
|
|
125
|
+
* Project world coordinates to screen coordinates.
|
|
126
|
+
* Useful for positioning 2D overlay text.
|
|
127
|
+
*/
|
|
128
|
+
projectToScreen(worldPos: [number, number, number]): {
|
|
129
|
+
x: number;
|
|
130
|
+
y: number;
|
|
131
|
+
visible: boolean;
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* Get the current view-projection matrix.
|
|
135
|
+
*/
|
|
136
|
+
getViewProjectionMatrix(): Float32Array;
|
|
137
|
+
/**
|
|
138
|
+
* Get canvas dimensions.
|
|
139
|
+
*/
|
|
140
|
+
getCanvasSize(): {
|
|
141
|
+
width: number;
|
|
142
|
+
height: number;
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* Get WebGL context info.
|
|
146
|
+
*/
|
|
147
|
+
getContextInfo(): Record<string, any>;
|
|
148
|
+
/**
|
|
149
|
+
* Pick a bubble at screen coordinates.
|
|
150
|
+
* @param screenX X coordinate relative to canvas
|
|
151
|
+
* @param screenY Y coordinate relative to canvas
|
|
152
|
+
* @returns Hit result with bubble index, or null if no hit
|
|
153
|
+
*/
|
|
154
|
+
pickAtScreen(screenX: number, screenY: number): HitResult | null;
|
|
155
|
+
/**
|
|
156
|
+
* Create a ray from screen coordinates.
|
|
157
|
+
* Useful for custom picking logic.
|
|
158
|
+
*/
|
|
159
|
+
createRay(screenX: number, screenY: number): Ray3D;
|
|
160
|
+
/**
|
|
161
|
+
* Get data for a specific bubble by index.
|
|
162
|
+
*/
|
|
163
|
+
getBubbleData(index: number): {
|
|
164
|
+
position: [number, number, number];
|
|
165
|
+
color: [number, number, number];
|
|
166
|
+
scale: number;
|
|
167
|
+
} | null;
|
|
168
|
+
/**
|
|
169
|
+
* Export the current view as an image.
|
|
170
|
+
* @param format Image format ('png' | 'jpeg' | 'webp')
|
|
171
|
+
* @param quality Quality for jpeg/webp (0-1)
|
|
172
|
+
* @param transparent Use transparent background (only for 'png')
|
|
173
|
+
* @returns Data URL of the image
|
|
174
|
+
*/
|
|
175
|
+
exportImage(format?: 'png' | 'jpeg' | 'webp', quality?: number, transparent?: boolean): string;
|
|
176
|
+
/**
|
|
177
|
+
* Export the current view as a Blob.
|
|
178
|
+
* @param format Image format ('png' | 'jpeg' | 'webp')
|
|
179
|
+
* @param quality Quality for jpeg/webp (0-1)
|
|
180
|
+
* @returns Promise that resolves to Blob
|
|
181
|
+
*/
|
|
182
|
+
exportImageBlob(format?: 'png' | 'jpeg' | 'webp', quality?: number): Promise<Blob | null>;
|
|
183
|
+
/**
|
|
184
|
+
* Download the current view as an image file.
|
|
185
|
+
* @param filename Filename without extension
|
|
186
|
+
* @param format Image format
|
|
187
|
+
* @param quality Quality for jpeg/webp
|
|
188
|
+
*/
|
|
189
|
+
downloadImage(filename?: string, format?: 'png' | 'jpeg' | 'webp', quality?: number): void;
|
|
190
|
+
/**
|
|
191
|
+
* Clean up all resources.
|
|
192
|
+
*/
|
|
193
|
+
destroy(): void;
|
|
194
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { OrbitCamera, OrbitCameraOptions } from './camera/OrbitCamera';
|
|
2
|
+
import { OrbitControllerOptions } from './controls/OrbitController';
|
|
3
|
+
import { Axes3DOptions } from './Axes3D';
|
|
4
|
+
import { Tooltip3DOptions } from './Tooltip3D';
|
|
5
|
+
import { Renderer3DOptions, RenderStats3D, Renderer3DEventCallback } from './types';
|
|
6
|
+
|
|
7
|
+
export interface ImpulseSeriesData {
|
|
8
|
+
/** X coordinates */
|
|
9
|
+
x: Float32Array;
|
|
10
|
+
/** Y coordinates (top of stems) */
|
|
11
|
+
y: Float32Array;
|
|
12
|
+
/** Z coordinates */
|
|
13
|
+
z: Float32Array;
|
|
14
|
+
/** Base Y value (default: 0) */
|
|
15
|
+
baseY?: number;
|
|
16
|
+
/** Color per point (RGB) */
|
|
17
|
+
colors?: Float32Array;
|
|
18
|
+
/** Single color for all stems */
|
|
19
|
+
color?: [number, number, number];
|
|
20
|
+
}
|
|
21
|
+
export interface Impulse3DRendererOptions extends Renderer3DOptions {
|
|
22
|
+
camera?: OrbitCameraOptions;
|
|
23
|
+
controls?: OrbitControllerOptions;
|
|
24
|
+
axes?: Axes3DOptions;
|
|
25
|
+
showAxes?: boolean;
|
|
26
|
+
/** Stem thickness (default: 0.03) */
|
|
27
|
+
stemWidth?: number;
|
|
28
|
+
/** Number of sides for cylinder (default: 6) */
|
|
29
|
+
stemSides?: number;
|
|
30
|
+
/** Show marker at top of stem (default: true) */
|
|
31
|
+
showMarkers?: boolean;
|
|
32
|
+
/** Marker size multiplier (default: 2) */
|
|
33
|
+
markerSize?: number;
|
|
34
|
+
/** Enable tooltips (default: true) */
|
|
35
|
+
enableTooltip?: boolean;
|
|
36
|
+
tooltip?: Tooltip3DOptions;
|
|
37
|
+
}
|
|
38
|
+
export declare class Impulse3DRenderer {
|
|
39
|
+
private canvas;
|
|
40
|
+
private gl;
|
|
41
|
+
private dpr;
|
|
42
|
+
private programs;
|
|
43
|
+
private camera;
|
|
44
|
+
private controller;
|
|
45
|
+
private axes;
|
|
46
|
+
private stemVao;
|
|
47
|
+
private stemPositionBuffer;
|
|
48
|
+
private stemNormalBuffer;
|
|
49
|
+
private stemColorBuffer;
|
|
50
|
+
private stemIndexBuffer;
|
|
51
|
+
private stemIndexCount;
|
|
52
|
+
private markerVao;
|
|
53
|
+
private markerPositionBuffer;
|
|
54
|
+
private markerNormalBuffer;
|
|
55
|
+
private markerColorBuffer;
|
|
56
|
+
private markerIndexBuffer;
|
|
57
|
+
private markerIndexCount;
|
|
58
|
+
private backgroundColor;
|
|
59
|
+
private showAxes;
|
|
60
|
+
private stemWidth;
|
|
61
|
+
private stemSides;
|
|
62
|
+
private showMarkers;
|
|
63
|
+
private markerSize;
|
|
64
|
+
private impulseData;
|
|
65
|
+
private bounds;
|
|
66
|
+
private animationFrameId;
|
|
67
|
+
private needsRender;
|
|
68
|
+
private eventListeners;
|
|
69
|
+
private tooltip;
|
|
70
|
+
private enableTooltip;
|
|
71
|
+
private lastHitIndex;
|
|
72
|
+
private boundHandleMouseMove?;
|
|
73
|
+
private boundHandleMouseLeave?;
|
|
74
|
+
private lastFrameTime;
|
|
75
|
+
private frameCount;
|
|
76
|
+
private fps;
|
|
77
|
+
private lastFpsUpdate;
|
|
78
|
+
constructor(options: Impulse3DRendererOptions);
|
|
79
|
+
private handleMouseMove;
|
|
80
|
+
private handleMouseLeave;
|
|
81
|
+
pickAtScreen(screenX: number, screenY: number): {
|
|
82
|
+
index: number;
|
|
83
|
+
distance: number;
|
|
84
|
+
point: [number, number, number];
|
|
85
|
+
} | null;
|
|
86
|
+
private initBuffers;
|
|
87
|
+
private handleResize;
|
|
88
|
+
resize(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Set impulse data
|
|
91
|
+
*/
|
|
92
|
+
setData(data: ImpulseSeriesData): void;
|
|
93
|
+
private buildGeometry;
|
|
94
|
+
private buildStemGeometry;
|
|
95
|
+
private buildMarkerGeometry;
|
|
96
|
+
private calculateBounds;
|
|
97
|
+
/**
|
|
98
|
+
* Fit camera to show all data
|
|
99
|
+
*/
|
|
100
|
+
fitToData(): void;
|
|
101
|
+
getCanvasSize(): {
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Render a single frame
|
|
107
|
+
*/
|
|
108
|
+
render(): void;
|
|
109
|
+
private renderBuffers;
|
|
110
|
+
startRenderLoop(): void;
|
|
111
|
+
stopRenderLoop(): void;
|
|
112
|
+
getStats(): RenderStats3D;
|
|
113
|
+
getCamera(): OrbitCamera;
|
|
114
|
+
getAxisLabels(): import('./Axes3D').AxisLabel3D[];
|
|
115
|
+
getViewProjectionMatrix(): Float32Array;
|
|
116
|
+
projectToScreen(worldPos: [number, number, number]): {
|
|
117
|
+
x: number;
|
|
118
|
+
y: number;
|
|
119
|
+
visible: boolean;
|
|
120
|
+
};
|
|
121
|
+
exportImage(format?: 'png' | 'jpeg' | 'webp', quality?: number, transparent?: boolean): string;
|
|
122
|
+
on(event: string, callback: Renderer3DEventCallback): void;
|
|
123
|
+
off(event: string, callback: Renderer3DEventCallback): void;
|
|
124
|
+
private emitEvent;
|
|
125
|
+
destroy(): void;
|
|
126
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { OrbitCamera, OrbitCameraOptions } from './camera/OrbitCamera';
|
|
2
|
+
import { OrbitControllerOptions } from './controls/OrbitController';
|
|
3
|
+
import { Axes3DOptions } from './Axes3D';
|
|
4
|
+
import { Tooltip3DOptions } from './Tooltip3D';
|
|
5
|
+
import { Renderer3DOptions, RenderStats3D, Renderer3DEventCallback } from './types';
|
|
6
|
+
|
|
7
|
+
export interface Line3DData {
|
|
8
|
+
/** X coordinates */
|
|
9
|
+
x: Float32Array;
|
|
10
|
+
/** Y coordinates */
|
|
11
|
+
y: Float32Array;
|
|
12
|
+
/** Z coordinates */
|
|
13
|
+
z: Float32Array;
|
|
14
|
+
/** Color per vertex (optional, RGB) */
|
|
15
|
+
colors?: Float32Array;
|
|
16
|
+
/** Single line color [r, g, b] (used if colors not provided) */
|
|
17
|
+
color?: [number, number, number];
|
|
18
|
+
}
|
|
19
|
+
export interface Line3DRendererOptions extends Renderer3DOptions {
|
|
20
|
+
camera?: OrbitCameraOptions;
|
|
21
|
+
controls?: OrbitControllerOptions;
|
|
22
|
+
axes?: Axes3DOptions;
|
|
23
|
+
showAxes?: boolean;
|
|
24
|
+
/** Line thickness in world units (default: 0.05) */
|
|
25
|
+
lineWidth?: number;
|
|
26
|
+
/** Number of segments around the tube (default: 8) */
|
|
27
|
+
tubeSides?: number;
|
|
28
|
+
/** Enable tooltips (default: true) */
|
|
29
|
+
enableTooltip?: boolean;
|
|
30
|
+
tooltip?: Tooltip3DOptions;
|
|
31
|
+
}
|
|
32
|
+
export declare class Line3DRenderer {
|
|
33
|
+
private canvas;
|
|
34
|
+
private gl;
|
|
35
|
+
private dpr;
|
|
36
|
+
private programs;
|
|
37
|
+
private camera;
|
|
38
|
+
private controller;
|
|
39
|
+
private axes;
|
|
40
|
+
private vao;
|
|
41
|
+
private positionBuffer;
|
|
42
|
+
private normalBuffer;
|
|
43
|
+
private colorBuffer;
|
|
44
|
+
private indexBuffer;
|
|
45
|
+
private indexCount;
|
|
46
|
+
private backgroundColor;
|
|
47
|
+
private showAxes;
|
|
48
|
+
private lineWidth;
|
|
49
|
+
private tubeSides;
|
|
50
|
+
private lines;
|
|
51
|
+
private bounds;
|
|
52
|
+
private animationFrameId;
|
|
53
|
+
private needsRender;
|
|
54
|
+
private eventListeners;
|
|
55
|
+
private tooltip;
|
|
56
|
+
private enableTooltip;
|
|
57
|
+
private lastHitIndex;
|
|
58
|
+
private boundHandleMouseMove?;
|
|
59
|
+
private boundHandleMouseLeave?;
|
|
60
|
+
private lastFrameTime;
|
|
61
|
+
private frameCount;
|
|
62
|
+
private fps;
|
|
63
|
+
private lastFpsUpdate;
|
|
64
|
+
constructor(options: Line3DRendererOptions);
|
|
65
|
+
private handleMouseMove;
|
|
66
|
+
private handleMouseLeave;
|
|
67
|
+
pickAtScreen(screenX: number, screenY: number): {
|
|
68
|
+
seriesIndex: number;
|
|
69
|
+
pointIndex: number;
|
|
70
|
+
distance: number;
|
|
71
|
+
point: [number, number, number];
|
|
72
|
+
} | null;
|
|
73
|
+
private initBuffers;
|
|
74
|
+
private handleResize;
|
|
75
|
+
resize(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Set line data (single line or array of lines)
|
|
78
|
+
*/
|
|
79
|
+
setData(lines: Line3DData | Line3DData[]): void;
|
|
80
|
+
/**
|
|
81
|
+
* Add a single line
|
|
82
|
+
*/
|
|
83
|
+
addLine(line: Line3DData): void;
|
|
84
|
+
/**
|
|
85
|
+
* Clear all lines
|
|
86
|
+
*/
|
|
87
|
+
clearLines(): void;
|
|
88
|
+
private buildTubeGeometry;
|
|
89
|
+
private calculateBounds;
|
|
90
|
+
/**
|
|
91
|
+
* Fit camera to show all data
|
|
92
|
+
*/
|
|
93
|
+
fitToData(): void;
|
|
94
|
+
getCanvasSize(): {
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Render a single frame
|
|
100
|
+
*/
|
|
101
|
+
render(): void;
|
|
102
|
+
startRenderLoop(): void;
|
|
103
|
+
stopRenderLoop(): void;
|
|
104
|
+
getStats(): RenderStats3D;
|
|
105
|
+
getCamera(): OrbitCamera;
|
|
106
|
+
getAxisLabels(): import('./Axes3D').AxisLabel3D[];
|
|
107
|
+
getViewProjectionMatrix(): Float32Array;
|
|
108
|
+
projectToScreen(worldPos: [number, number, number]): {
|
|
109
|
+
x: number;
|
|
110
|
+
y: number;
|
|
111
|
+
visible: boolean;
|
|
112
|
+
};
|
|
113
|
+
exportImage(format?: 'png' | 'jpeg' | 'webp', quality?: number, transparent?: boolean): string;
|
|
114
|
+
on(event: string, callback: Renderer3DEventCallback): void;
|
|
115
|
+
off(event: string, callback: Renderer3DEventCallback): void;
|
|
116
|
+
private emitEvent;
|
|
117
|
+
destroy(): void;
|
|
118
|
+
}
|