@extrabinoss/three-plot 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/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # 🎮 [Interactive Playground](https://binos.github.io/three-plot/)
2
+
3
+ # ThreePlot
4
+
5
+ A lightweight, high-performance GPU-accelerated data visualization library for the web, powered by Three.js.
6
+
7
+ ThreePlot is designed for real-time visualization of massive datasets (millions of points) where standard SVG or Canvas-based solutions fail.
8
+
9
+ ## 🚀 Key Performance Features
10
+
11
+ - **GPU Subsampling**: Smart data reduction performed on the GPU to maintain high FPS regardless of total point count.
12
+ - **Instanced Rendering**: Lines are rendered as hardware-instanced quads (not `THREE.Line` or `THREE.Line2`), allowing for thick, beautiful, and efficient segments.
13
+ - **Frustum Culling**: Automatic drawing range calculation to skip data points outside the viewport.
14
+ - **Tree-shakeable**: Minimal Three.js dependency footprint.
15
+ - **Managed Lifecycle**: Automatic GPU memory management (geometry/material disposal).
16
+
17
+ ## 🛠️ Usage
18
+
19
+ ### Installation
20
+
21
+ ```bash
22
+ npm install @extrabinoss/three-plot
23
+ ```
24
+
25
+ ### Basic Example (Fluent API)
26
+
27
+ ```typescript
28
+ import { ThreePlot } from '@extrabinoss/three-plot';
29
+
30
+ const container = ThreePlot.init(document.getElementById('plot-container'));
31
+
32
+ // Add an Axis
33
+ container.axis('#ffffff')
34
+ .ticks(50, 8)
35
+ .subTicks(5)
36
+ .thickness(1.5);
37
+
38
+ // Add a line plot with 100,000 points
39
+ const myLine = container.line(100000, '#00ff88')
40
+ .amplitude(50)
41
+ .frequency(0.02)
42
+ .preset(4);
43
+ ```
44
+
45
+ ## 🔧 Shaders & Custom Signals
46
+
47
+ ThreePlot uses external GLSL shaders bundled at build time. If you are consuming the library and want to use custom shaders or modify existing ones, ensure your build tool (like Vite or Webpack) can handle `.glsl` imports.
48
+
49
+ In a Vite project, we recommend `vite-plugin-glsl`:
50
+ ```typescript
51
+ import glsl from 'vite-plugin-glsl';
52
+ export default { plugins: [glsl()] };
53
+ ```
54
+
55
+ ### Custom Presets on-the-fly
56
+ You can register your own GPU signals without re-building:
57
+ ```typescript
58
+ container.registerPreset('MyWave', 'sin(t + x * 0.1) * uAmplitude');
59
+ myLine.preset(8); // Custom presets start at index 8
60
+ ```
61
+
62
+ ## ✅ What it does well
63
+ - High-frequency real-time updates (oscilloscopes, heart-rate monitors).
64
+ - Visualizing datasets from 10k to 10M+ points at 60 FPS.
65
+ - Multi-plot overlays on a single WebGL context.
66
+ - Flexible coordinate system with built-in zoom and pan.
67
+ - Built-in Axes and MSDF Labels for performance.
68
+
69
+ ## 📦 Project Structure
70
+ - `src/plot/PlotContainer.ts`: The orchestrator and scene manager.
71
+ - `src/plot/line/`: Instanced line engine with GLSL shaders.
72
+ - `src/plot/point/`: GPU subsampled point engine with GLSL shaders.
73
+ - `src/components/`: Vue.js showcase and demo components.
74
+
75
+ ---
76
+ Developed with performance and DX in mind.