streamkit-pointcloud 0.1.0-alpha.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,204 @@
1
+ /**
2
+ * @streamkit/pointcloud - Draco Decoder
3
+ *
4
+ * Utility for decoding Draco-compressed point cloud data.
5
+ * Uses Three.js DRACOLoader internally.
6
+ */
7
+ import { DRACOLoader } from "three/examples/jsm/loaders/DRACOLoader.js";
8
+ /** Default path for Draco decoder files (Google CDN) */
9
+ const DEFAULT_DRACO_PATH = "https://www.gstatic.com/draco/versioned/decoders/1.5.6/";
10
+ /**
11
+ * Creates a configured DRACOLoader instance.
12
+ * @param decoderPath - Path to Draco decoder files
13
+ * @returns Configured DRACOLoader
14
+ */
15
+ function createDracoLoader(decoderPath) {
16
+ const loader = new DRACOLoader();
17
+ loader.setDecoderPath(decoderPath);
18
+ loader.setDecoderConfig({ type: "js" }); // Use JS decoder for broader compatibility
19
+ return loader;
20
+ }
21
+ /**
22
+ * Generates fallback colors based on Z-height.
23
+ * Creates a gradient from blue (low) to red (high).
24
+ * @param points - Array of points
25
+ * @returns Generated colors array
26
+ */
27
+ function generateHeightBasedColors(points) {
28
+ if (points.length === 0) {
29
+ return [];
30
+ }
31
+ // Find Z range
32
+ let minZ = Infinity;
33
+ let maxZ = -Infinity;
34
+ for (const point of points) {
35
+ if (point.z < minZ)
36
+ minZ = point.z;
37
+ if (point.z > maxZ)
38
+ maxZ = point.z;
39
+ }
40
+ const zRange = maxZ - minZ;
41
+ const hasRange = zRange > 0;
42
+ return points.map((point) => {
43
+ // Normalize Z to 0-1
44
+ const t = hasRange ? (point.z - minZ) / zRange : 0.5;
45
+ // Blue to Red gradient through green
46
+ // t=0: Blue, t=0.5: Green, t=1: Red
47
+ let r, g, b;
48
+ if (t < 0.5) {
49
+ // Blue to Green
50
+ const localT = t * 2;
51
+ r = 0;
52
+ g = Math.round(localT * 255);
53
+ b = Math.round((1 - localT) * 255);
54
+ }
55
+ else {
56
+ // Green to Red
57
+ const localT = (t - 0.5) * 2;
58
+ r = Math.round(localT * 255);
59
+ g = Math.round((1 - localT) * 255);
60
+ b = 0;
61
+ }
62
+ return { r, g, b };
63
+ });
64
+ }
65
+ /**
66
+ * Extracts point positions from Draco geometry buffer.
67
+ * @param positionAttribute - The position buffer attribute
68
+ * @returns Array of PointCloudPoint
69
+ */
70
+ function extractPoints(positionAttribute) {
71
+ const points = [];
72
+ const positions = positionAttribute.array;
73
+ const count = positionAttribute.count;
74
+ for (let i = 0; i < count; i++) {
75
+ const idx = i * 3;
76
+ points.push({
77
+ x: positions[idx],
78
+ y: positions[idx + 1],
79
+ z: positions[idx + 2],
80
+ });
81
+ }
82
+ return points;
83
+ }
84
+ /**
85
+ * Extracts colors from Draco geometry buffer if available.
86
+ * @param colorAttribute - The color buffer attribute (may be undefined)
87
+ * @param pointCount - Expected number of points
88
+ * @returns Array of PointCloudColor or undefined
89
+ */
90
+ function extractColors(colorAttribute, pointCount) {
91
+ if (!colorAttribute || colorAttribute.count !== pointCount) {
92
+ return undefined;
93
+ }
94
+ const colors = [];
95
+ const colorData = colorAttribute.array;
96
+ const itemSize = colorAttribute.itemSize;
97
+ for (let i = 0; i < pointCount; i++) {
98
+ const idx = i * itemSize;
99
+ // Draco colors may be normalized (0-1) or byte (0-255)
100
+ // Detect based on max value in first few samples
101
+ let r = colorData[idx];
102
+ let g = colorData[idx + 1];
103
+ let b = colorData[idx + 2];
104
+ // If values are in 0-1 range, convert to 0-255
105
+ if (r <= 1 && g <= 1 && b <= 1) {
106
+ r = Math.round(r * 255);
107
+ g = Math.round(g * 255);
108
+ b = Math.round(b * 255);
109
+ }
110
+ colors.push({
111
+ r: Math.max(0, Math.min(255, r)),
112
+ g: Math.max(0, Math.min(255, g)),
113
+ b: Math.max(0, Math.min(255, b)),
114
+ });
115
+ }
116
+ return colors;
117
+ }
118
+ /**
119
+ * Processes a decoded BufferGeometry into PointCloudData.
120
+ * @param geometry - The decoded Three.js BufferGeometry
121
+ * @returns PointCloudData
122
+ */
123
+ function processGeometry(geometry) {
124
+ const positionAttribute = geometry.getAttribute("position");
125
+ if (!positionAttribute) {
126
+ geometry.dispose();
127
+ throw new Error("Draco geometry missing position attribute");
128
+ }
129
+ const points = extractPoints(positionAttribute);
130
+ // Try to extract colors
131
+ const colorAttribute = geometry.getAttribute("color");
132
+ let colors = extractColors(colorAttribute, points.length);
133
+ // Generate fallback colors if not available
134
+ if (!colors) {
135
+ colors = generateHeightBasedColors(points);
136
+ }
137
+ // Clean up geometry
138
+ geometry.dispose();
139
+ return {
140
+ points,
141
+ colors,
142
+ };
143
+ }
144
+ /**
145
+ * Decodes a Draco-compressed buffer into PointCloudData.
146
+ *
147
+ * @param buffer - Raw ArrayBuffer containing Draco-compressed data
148
+ * @param options - Optional decoder configuration
149
+ * @returns Promise resolving to PointCloudData
150
+ *
151
+ * @example
152
+ * ```typescript
153
+ * const response = await fetch('model.drc')
154
+ * const buffer = await response.arrayBuffer()
155
+ * const data = await decodeDraco(buffer)
156
+ * ```
157
+ */
158
+ export async function decodeDraco(buffer, options = {}) {
159
+ const decoderPath = options.decoderPath ?? DEFAULT_DRACO_PATH;
160
+ const loader = createDracoLoader(decoderPath);
161
+ try {
162
+ // Create a Blob URL to use the loader's standard load method
163
+ const blob = new Blob([buffer], { type: "application/octet-stream" });
164
+ const url = URL.createObjectURL(blob);
165
+ try {
166
+ const geometry = await new Promise((resolve, reject) => {
167
+ loader.load(url, (geometry) => resolve(geometry), undefined, (error) => reject(error));
168
+ });
169
+ return processGeometry(geometry);
170
+ }
171
+ finally {
172
+ URL.revokeObjectURL(url);
173
+ }
174
+ }
175
+ catch (err) {
176
+ const message = err instanceof Error ? err.message : String(err);
177
+ throw new Error(`Draco decoding failed: ${message}`);
178
+ }
179
+ finally {
180
+ // Always dispose the loader
181
+ loader.dispose();
182
+ }
183
+ }
184
+ /**
185
+ * Pre-warms the Draco decoder by loading the WASM module.
186
+ * Call this early in your application to reduce first-decode latency.
187
+ *
188
+ * @param options - Optional decoder configuration
189
+ * @returns Promise that resolves when decoder is ready
190
+ */
191
+ export async function preloadDracoDecoder(options = {}) {
192
+ const decoderPath = options.decoderPath ?? DEFAULT_DRACO_PATH;
193
+ const loader = createDracoLoader(decoderPath);
194
+ try {
195
+ // Warm up decoder by forcing internal initialization
196
+ await new Promise((resolve) => {
197
+ setTimeout(resolve, 50);
198
+ });
199
+ }
200
+ finally {
201
+ loader.dispose();
202
+ }
203
+ }
204
+ //# sourceMappingURL=decoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decoder.js","sourceRoot":"","sources":["../../src/draco/decoder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2CAA2C,CAAC;AAQxE,wDAAwD;AACxD,MAAM,kBAAkB,GACtB,yDAAyD,CAAC;AAE5D;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,WAAmB;IAC5C,MAAM,MAAM,GAAG,IAAI,WAAW,EAAE,CAAC;IACjC,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACnC,MAAM,CAAC,gBAAgB,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,2CAA2C;IACpF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;GAKG;AACH,SAAS,yBAAyB,CAChC,MAAyB;IAEzB,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,eAAe;IACf,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IAErB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,IAAI,KAAK,CAAC,CAAC,GAAG,IAAI;YAAE,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;QACnC,IAAI,KAAK,CAAC,CAAC,GAAG,IAAI;YAAE,IAAI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S,CAAC;QACT,4BAA4B;QAC5B,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAA+B,EAAE;IAEjC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,kBAAkB,CAAC;IAC9D,MAAM,MAAM,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAE9C,IAAI,CAAC;QACH,qDAAqD;QACrD,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YAClC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACL,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,OAAO,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @streamkit/pointcloud
3
+ *
4
+ * Production-ready PointCloud rendering kit for Three.js.
5
+ *
6
+ * This package provides:
7
+ * - Stable PointCloudData schema for data interchange
8
+ * - Draco decoder for compressed point cloud files
9
+ * - Three.js rendering layer with proper lifecycle management
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ export type { DracoDecoderOptions, PointCloudColor, PointCloudData, PointCloudFrame, PointCloudLayer, PointCloudLayerOptions, PointCloudPoint, PointCloudUpdateMode, PointCloudUpdateOptions, } from "./types.js";
14
+ export { clampColorValue, hasMatchingColorCount, isValidColor, isValidPoint, isValidPointCloudData, normalizeColorValue, } from "./core/validators.js";
15
+ export { decodeDraco, preloadDracoDecoder } from "./draco/decoder.js";
16
+ export { createPointCloudLayer } from "./three/pointCloudLayer.js";
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,YAAY,EACV,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,eAAe,EACf,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,uBAAuB,GACxB,MAAM,YAAY,CAAC;AAMpB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAMtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @streamkit/pointcloud
3
+ *
4
+ * Production-ready PointCloud rendering kit for Three.js.
5
+ *
6
+ * This package provides:
7
+ * - Stable PointCloudData schema for data interchange
8
+ * - Draco decoder for compressed point cloud files
9
+ * - Three.js rendering layer with proper lifecycle management
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ // =============================================================================
14
+ // Validators
15
+ // =============================================================================
16
+ export { clampColorValue, hasMatchingColorCount, isValidColor, isValidPoint, isValidPointCloudData, normalizeColorValue, } from "./core/validators.js";
17
+ // =============================================================================
18
+ // Draco Decoder
19
+ // =============================================================================
20
+ export { decodeDraco, preloadDracoDecoder } from "./draco/decoder.js";
21
+ // =============================================================================
22
+ // Three.js Layer
23
+ // =============================================================================
24
+ export { createPointCloudLayer } from "./three/pointCloudLayer.js";
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAkBH,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,sBAAsB,CAAC;AAE9B,gFAAgF;AAChF,gBAAgB;AAChB,gFAAgF;AAEhF,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEtE,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @streamkit/pointcloud - Three.js PointCloud Layer
3
+ *
4
+ * High-performance point cloud rendering layer for Three.js.
5
+ * Manages geometry, material, and lifecycle for point cloud visualization.
6
+ */
7
+ import type { PointCloudLayer, PointCloudLayerOptions } from "../types.js";
8
+ /**
9
+ * Creates a PointCloud rendering layer for Three.js.
10
+ *
11
+ * This function returns a controller object that manages the lifecycle
12
+ * of a point cloud in a Three.js scene.
13
+ *
14
+ * @param options - Configuration options
15
+ * @returns PointCloudLayer controller
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * import * as THREE from 'three'
20
+ * import { createPointCloudLayer } from '@streamkit/pointcloud'
21
+ *import { ThreeBufferGeometryLike } from './three-types';
22
+
23
+ * const scene = new THREE.Scene()
24
+ * const layer = createPointCloudLayer({ scene })
25
+ *
26
+ * // Build initial point cloud
27
+ * layer.build({
28
+ * points: [{ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 }],
29
+ * colors: [{ r: 255, g: 0, b: 0 }, { r: 0, g: 255, b: 0 }]
30
+ * })
31
+ *
32
+ * // Incremental append
33
+ * layer.update(newData, { mode: 'append' })
34
+ *
35
+ * // Partial update at offset
36
+ * layer.update(partialData, { mode: 'partial', offset: 100 })
37
+ *
38
+ * // Clean up when done
39
+ * layer.dispose()
40
+ * ```
41
+ */
42
+ export declare function createPointCloudLayer(options: PointCloudLayerOptions): PointCloudLayer;
43
+ //# sourceMappingURL=pointCloudLayer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointCloudLayer.d.ts","sourceRoot":"","sources":["../../src/three/pointCloudLayer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,OAAO,KAAK,EAEV,eAAe,EACf,sBAAsB,EAEvB,MAAM,aAAa,CAAC;AAwNrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,eAAe,CA0XjB"}