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,494 @@
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 * as THREE from "three";
8
+ import { hasMatchingColorCount, normalizeColorValue, } from "../core/validators.js";
9
+ /** Default point size in world units */
10
+ const DEFAULT_POINT_SIZE = 0.01;
11
+ /** Default point color (white) */
12
+ const DEFAULT_POINT_COLOR = 0xffffff;
13
+ /** Default initial buffer capacity for append mode */
14
+ const DEFAULT_BUFFER_CAPACITY = 100000;
15
+ /** Growth factor when buffer needs expansion */
16
+ const BUFFER_GROWTH_FACTOR = 2;
17
+ /**
18
+ * Writes points directly into a Float32Array at the specified offset.
19
+ * @param target - Target array to write into
20
+ * @param points - Points to write
21
+ * @param startIndex - Starting point index in target
22
+ */
23
+ function writePointsToArray(target, points, startIndex) {
24
+ const baseIdx = startIndex * 3;
25
+ for (let i = 0; i < points.length; i++) {
26
+ const point = points[i];
27
+ const idx = baseIdx + i * 3;
28
+ target[idx] = point.x;
29
+ target[idx + 1] = point.y;
30
+ target[idx + 2] = point.z;
31
+ }
32
+ }
33
+ /**
34
+ * Writes colors directly into a Float32Array at the specified offset (normalized).
35
+ * @param target - Target array to write into
36
+ * @param colors - Colors to write (0-255 range)
37
+ * @param startIndex - Starting point index in target
38
+ */
39
+ function writeColorsToArray(target, colors, startIndex) {
40
+ const baseIdx = startIndex * 3;
41
+ for (let i = 0; i < colors.length; i++) {
42
+ const color = colors[i];
43
+ const idx = baseIdx + i * 3;
44
+ target[idx] = normalizeColorValue(color.r);
45
+ target[idx + 1] = normalizeColorValue(color.g);
46
+ target[idx + 2] = normalizeColorValue(color.b);
47
+ }
48
+ }
49
+ /**
50
+ * Converts PointCloudData points to a Float32Array for BufferGeometry.
51
+ * @param points - Array of points
52
+ * @param capacity - Optional pre-allocated capacity (for streaming)
53
+ * @returns Float32Array of positions
54
+ */
55
+ function pointsToPositionArray(points, capacity) {
56
+ const size = capacity ?? points.length;
57
+ const array = new Float32Array(size * 3);
58
+ writePointsToArray(array, points, 0);
59
+ return array;
60
+ }
61
+ /**
62
+ * Converts PointCloudData colors to a Float32Array (normalized 0-1).
63
+ * @param colors - Array of colors (0-255 range)
64
+ * @param capacity - Optional pre-allocated capacity (for streaming)
65
+ * @returns Float32Array of normalized colors
66
+ */
67
+ function colorsToColorArray(colors, capacity) {
68
+ const size = capacity ?? colors.length;
69
+ const array = new Float32Array(size * 3);
70
+ writeColorsToArray(array, colors, 0);
71
+ return array;
72
+ }
73
+ /**
74
+ * Creates a new BufferGeometry from PointCloudData.
75
+ * @param data - The point cloud data
76
+ * @returns Configured BufferGeometry
77
+ */
78
+ function createGeometry(data) {
79
+ const geometry = new THREE.BufferGeometry();
80
+ // Set positions
81
+ const positions = pointsToPositionArray(data.points);
82
+ geometry.setAttribute("position", new THREE.BufferAttribute(positions, 3));
83
+ // Set colors if available and matching
84
+ if (data.colors && hasMatchingColorCount(data)) {
85
+ const colors = colorsToColorArray(data.colors);
86
+ geometry.setAttribute("color", new THREE.BufferAttribute(colors, 3));
87
+ }
88
+ // Compute bounding sphere for frustum culling
89
+ geometry.computeBoundingSphere();
90
+ return geometry;
91
+ }
92
+ /**
93
+ * Creates a PointsMaterial configured for the given data.
94
+ * @param data - The point cloud data
95
+ * @param defaultSize - Default point size
96
+ * @param defaultColor - Default point color
97
+ * @returns Configured PointsMaterial
98
+ */
99
+ function createMaterial(data, defaultSize, defaultColor) {
100
+ const hasVertexColors = data.colors && hasMatchingColorCount(data);
101
+ const useUniformColor = data.color !== undefined && !hasVertexColors;
102
+ return new THREE.PointsMaterial({
103
+ size: data.size ?? defaultSize,
104
+ color: useUniformColor ? data.color : defaultColor,
105
+ vertexColors: hasVertexColors,
106
+ opacity: data.opacity ?? 1.0,
107
+ transparent: (data.opacity ?? 1.0) < 1.0,
108
+ sizeAttenuation: true, // Points get smaller with distance
109
+ depthWrite: true,
110
+ depthTest: true,
111
+ });
112
+ }
113
+ /**
114
+ * Updates an existing BufferGeometry with new data.
115
+ * Reuses buffers when possible for better performance.
116
+ * @param geometry - The geometry to update
117
+ * @param data - New point cloud data
118
+ * @returns True if geometry was updated in place, false if rebuild needed
119
+ */
120
+ function updateGeometry(geometry, data) {
121
+ const positionAttr = geometry.getAttribute("position");
122
+ const colorAttr = geometry.getAttribute("color");
123
+ // Check if we can reuse the position buffer
124
+ const currentCount = positionAttr.count;
125
+ const newCount = data.points.length;
126
+ // If point count changed significantly, we need to rebuild
127
+ if (newCount !== currentCount) {
128
+ return false;
129
+ }
130
+ // Update positions in place
131
+ const positions = pointsToPositionArray(data.points);
132
+ positionAttr.array.set(positions);
133
+ positionAttr.needsUpdate = true;
134
+ // Update colors
135
+ if (data.colors && hasMatchingColorCount(data)) {
136
+ const colors = colorsToColorArray(data.colors);
137
+ if (colorAttr && colorAttr.count === newCount) {
138
+ // Update existing color buffer
139
+ colorAttr.array.set(colors);
140
+ colorAttr.needsUpdate = true;
141
+ }
142
+ else {
143
+ // Need to add color attribute
144
+ geometry.setAttribute("color", new THREE.BufferAttribute(colors, 3));
145
+ }
146
+ }
147
+ else if (colorAttr) {
148
+ // Remove color attribute if no longer needed
149
+ geometry.deleteAttribute?.("color");
150
+ }
151
+ // Update bounding sphere
152
+ geometry.computeBoundingSphere();
153
+ return true;
154
+ }
155
+ /**
156
+ * Updates material properties based on new data.
157
+ * @param material - The material to update
158
+ * @param data - New point cloud data
159
+ * @param defaultSize - Default point size
160
+ * @param defaultColor - Default point color
161
+ */
162
+ function updateMaterial(material, data, defaultSize, defaultColor) {
163
+ const hasVertexColors = Boolean(data.colors && hasMatchingColorCount(data));
164
+ material.size = data.size ?? defaultSize;
165
+ material.vertexColors = hasVertexColors;
166
+ material.color.setHex(data.color ?? defaultColor);
167
+ material.opacity = data.opacity ?? 1.0;
168
+ material.transparent = material.opacity < 1.0;
169
+ material.needsUpdate = true;
170
+ }
171
+ /**
172
+ * Creates a PointCloud rendering layer for Three.js.
173
+ *
174
+ * This function returns a controller object that manages the lifecycle
175
+ * of a point cloud in a Three.js scene.
176
+ *
177
+ * @param options - Configuration options
178
+ * @returns PointCloudLayer controller
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * import * as THREE from 'three'
183
+ * import { createPointCloudLayer } from '@streamkit/pointcloud'
184
+ *import { ThreeBufferGeometryLike } from './three-types';
185
+
186
+ * const scene = new THREE.Scene()
187
+ * const layer = createPointCloudLayer({ scene })
188
+ *
189
+ * // Build initial point cloud
190
+ * layer.build({
191
+ * points: [{ x: 0, y: 0, z: 0 }, { x: 1, y: 1, z: 1 }],
192
+ * colors: [{ r: 255, g: 0, b: 0 }, { r: 0, g: 255, b: 0 }]
193
+ * })
194
+ *
195
+ * // Incremental append
196
+ * layer.update(newData, { mode: 'append' })
197
+ *
198
+ * // Partial update at offset
199
+ * layer.update(partialData, { mode: 'partial', offset: 100 })
200
+ *
201
+ * // Clean up when done
202
+ * layer.dispose()
203
+ * ```
204
+ */
205
+ export function createPointCloudLayer(options) {
206
+ const { scene, defaultSize = DEFAULT_POINT_SIZE, defaultColor = DEFAULT_POINT_COLOR, } = options;
207
+ // Internal state
208
+ let geometry = null;
209
+ let material = null;
210
+ let points = null;
211
+ let isDisposed = false;
212
+ // Streaming state: tracks actual point count vs buffer capacity
213
+ let activePointCount = 0;
214
+ let bufferCapacity = 0;
215
+ let hasColors = false;
216
+ /**
217
+ * Validates that the layer has not been disposed.
218
+ */
219
+ function assertNotDisposed() {
220
+ if (isDisposed) {
221
+ throw new Error("PointCloudLayer has been disposed and cannot be used");
222
+ }
223
+ }
224
+ /**
225
+ * Removes the current point cloud from the scene without disposing resources.
226
+ */
227
+ function removeFromScene() {
228
+ if (points) {
229
+ scene.remove(points);
230
+ }
231
+ }
232
+ /**
233
+ * Disposes of geometry and material resources.
234
+ */
235
+ function disposeResources() {
236
+ if (geometry) {
237
+ geometry.dispose();
238
+ geometry = null;
239
+ }
240
+ if (material) {
241
+ material.dispose();
242
+ material = null;
243
+ }
244
+ points = null;
245
+ activePointCount = 0;
246
+ bufferCapacity = 0;
247
+ hasColors = false;
248
+ }
249
+ /**
250
+ * Creates geometry with pre-allocated buffers for streaming.
251
+ */
252
+ function createStreamingGeometry(data, capacity) {
253
+ const geo = new THREE.BufferGeometry();
254
+ const positions = pointsToPositionArray(data.points, capacity);
255
+ const posAttr = new THREE.BufferAttribute(positions, 3);
256
+ posAttr.setUsage(THREE.DynamicDrawUsage);
257
+ geo.setAttribute("position", posAttr);
258
+ if (data.colors && hasMatchingColorCount(data)) {
259
+ const colors = colorsToColorArray(data.colors, capacity);
260
+ const colorAttr = new THREE.BufferAttribute(colors, 3);
261
+ colorAttr.setUsage(THREE.DynamicDrawUsage);
262
+ geo.setAttribute("color", colorAttr);
263
+ hasColors = true;
264
+ }
265
+ // Set draw range to actual point count
266
+ geo.setDrawRange(0, data.points.length);
267
+ geo.computeBoundingSphere();
268
+ return geo;
269
+ }
270
+ /**
271
+ * Expands buffer capacity by creating new larger buffers.
272
+ */
273
+ function expandBuffers(requiredCapacity) {
274
+ if (!geometry)
275
+ return;
276
+ const newCapacity = Math.max(requiredCapacity, Math.ceil(bufferCapacity * BUFFER_GROWTH_FACTOR));
277
+ const oldPosAttr = geometry.getAttribute("position");
278
+ const newPositions = new Float32Array(newCapacity * 3);
279
+ newPositions.set(oldPosAttr.array.slice(0, activePointCount * 3));
280
+ const newPosAttr = new THREE.BufferAttribute(newPositions, 3);
281
+ newPosAttr.setUsage(THREE.DynamicDrawUsage);
282
+ geometry.setAttribute("position", newPosAttr);
283
+ if (hasColors) {
284
+ const oldColorAttr = geometry.getAttribute("color");
285
+ if (oldColorAttr) {
286
+ const newColors = new Float32Array(newCapacity * 3);
287
+ newColors.set(oldColorAttr.array.slice(0, activePointCount * 3));
288
+ const newColorAttr = new THREE.BufferAttribute(newColors, 3);
289
+ newColorAttr.setUsage(THREE.DynamicDrawUsage);
290
+ geometry.setAttribute("color", newColorAttr);
291
+ }
292
+ }
293
+ bufferCapacity = newCapacity;
294
+ }
295
+ /**
296
+ * Handles 'append' mode: adds new points to existing buffer.
297
+ */
298
+ function handleAppend(data, maxPoints) {
299
+ if (!geometry || !material) {
300
+ // First append: create with initial capacity
301
+ const initialCapacity = Math.max(DEFAULT_BUFFER_CAPACITY, data.points.length * BUFFER_GROWTH_FACTOR);
302
+ geometry = createStreamingGeometry(data, initialCapacity);
303
+ material = createMaterial(data, defaultSize, defaultColor);
304
+ points = new THREE.Points(geometry, material);
305
+ scene.add(points);
306
+ activePointCount = data.points.length;
307
+ bufferCapacity = initialCapacity;
308
+ return;
309
+ }
310
+ const newTotal = activePointCount + data.points.length;
311
+ // Check if we need to enforce maxPoints (ring buffer behavior)
312
+ if (maxPoints && newTotal > maxPoints) {
313
+ const overflow = newTotal - maxPoints;
314
+ const keepCount = activePointCount - overflow;
315
+ if (keepCount > 0) {
316
+ // Shift existing data to make room
317
+ const posAttr = geometry.getAttribute("position");
318
+ const posArray = posAttr.array;
319
+ posArray.copyWithin(0, overflow * 3, activePointCount * 3);
320
+ if (hasColors) {
321
+ const colorAttr = geometry.getAttribute("color");
322
+ if (colorAttr) {
323
+ const colorArray = colorAttr.array;
324
+ colorArray.copyWithin(0, overflow * 3, activePointCount * 3);
325
+ }
326
+ }
327
+ activePointCount = keepCount;
328
+ }
329
+ else {
330
+ // New data exceeds maxPoints entirely, replace
331
+ activePointCount = 0;
332
+ }
333
+ }
334
+ const requiredCapacity = activePointCount + data.points.length;
335
+ // Expand buffers if needed
336
+ if (requiredCapacity > bufferCapacity) {
337
+ expandBuffers(requiredCapacity);
338
+ }
339
+ // Write new points at current end position
340
+ const posAttr = geometry.getAttribute("position");
341
+ writePointsToArray(posAttr.array, data.points, activePointCount);
342
+ posAttr.needsUpdate = true;
343
+ // Write new colors if provided
344
+ if (data.colors && hasMatchingColorCount(data)) {
345
+ let colorAttr = geometry.getAttribute("color");
346
+ if (!colorAttr && hasColors) {
347
+ const colors = new Float32Array(bufferCapacity * 3);
348
+ const newColorAttr = new THREE.BufferAttribute(colors, 3);
349
+ newColorAttr.setUsage(THREE.DynamicDrawUsage);
350
+ geometry.setAttribute("color", newColorAttr);
351
+ colorAttr = newColorAttr;
352
+ }
353
+ if (colorAttr) {
354
+ writeColorsToArray(colorAttr.array, data.colors, activePointCount);
355
+ colorAttr.needsUpdate = true;
356
+ }
357
+ }
358
+ activePointCount += data.points.length;
359
+ geometry.setDrawRange(0, activePointCount);
360
+ geometry.computeBoundingSphere();
361
+ updateMaterial(material, data, defaultSize, defaultColor);
362
+ }
363
+ /**
364
+ * Handles 'partial' mode: updates subset of points at offset.
365
+ */
366
+ function handlePartial(data, offset) {
367
+ if (!geometry || !material) {
368
+ console.warn("PointCloudLayer.update: No geometry to update partially. Use build() first.");
369
+ return;
370
+ }
371
+ // Validate offset
372
+ if (offset < 0) {
373
+ console.warn("PointCloudLayer.update: Invalid offset (negative)");
374
+ return;
375
+ }
376
+ if (offset >= activePointCount) {
377
+ console.warn("PointCloudLayer.update: Offset exceeds current point count");
378
+ return;
379
+ }
380
+ // Calculate how many points we can actually update
381
+ const maxUpdateCount = activePointCount - offset;
382
+ const updateCount = Math.min(data.points.length, maxUpdateCount);
383
+ if (updateCount === 0) {
384
+ return;
385
+ }
386
+ // Update positions
387
+ const posAttr = geometry.getAttribute("position");
388
+ const posArray = posAttr.array;
389
+ const baseIdx = offset * 3;
390
+ for (let i = 0; i < updateCount; i++) {
391
+ const point = data.points[i];
392
+ const idx = baseIdx + i * 3;
393
+ posArray[idx] = point.x;
394
+ posArray[idx + 1] = point.y;
395
+ posArray[idx + 2] = point.z;
396
+ }
397
+ posAttr.needsUpdate = true;
398
+ // Update colors if provided
399
+ if (data.colors && data.colors.length >= updateCount && hasColors) {
400
+ const colorAttr = geometry.getAttribute("color");
401
+ if (colorAttr) {
402
+ const colorArray = colorAttr.array;
403
+ for (let i = 0; i < updateCount; i++) {
404
+ const color = data.colors[i];
405
+ const idx = baseIdx + i * 3;
406
+ colorArray[idx] = normalizeColorValue(color.r);
407
+ colorArray[idx + 1] = normalizeColorValue(color.g);
408
+ colorArray[idx + 2] = normalizeColorValue(color.b);
409
+ }
410
+ colorAttr.needsUpdate = true;
411
+ }
412
+ }
413
+ geometry.computeBoundingSphere();
414
+ updateMaterial(material, data, defaultSize, defaultColor);
415
+ }
416
+ /**
417
+ * Handles 'replace' mode: full geometry replacement.
418
+ */
419
+ function handleReplace(data) {
420
+ // Clean up existing resources
421
+ removeFromScene();
422
+ disposeResources();
423
+ // Create new geometry and material
424
+ geometry = createGeometry(data);
425
+ material = createMaterial(data, defaultSize, defaultColor);
426
+ // Track state
427
+ activePointCount = data.points.length;
428
+ bufferCapacity = data.points.length;
429
+ hasColors = Boolean(data.colors && hasMatchingColorCount(data));
430
+ // Create Points object and add to scene
431
+ points = new THREE.Points(geometry, material);
432
+ scene.add(points);
433
+ }
434
+ return {
435
+ build(data) {
436
+ assertNotDisposed();
437
+ if (!data.points || data.points.length === 0) {
438
+ console.warn("PointCloudLayer.build: No points provided");
439
+ return;
440
+ }
441
+ handleReplace(data);
442
+ },
443
+ update(data, options) {
444
+ assertNotDisposed();
445
+ if (!data.points || data.points.length === 0) {
446
+ console.warn("PointCloudLayer.update: No points provided");
447
+ return;
448
+ }
449
+ const mode = options?.mode ?? "replace";
450
+ switch (mode) {
451
+ case "append":
452
+ handleAppend(data, options?.maxPoints);
453
+ break;
454
+ case "partial":
455
+ handlePartial(data, options?.offset ?? 0);
456
+ break;
457
+ case "replace":
458
+ default:
459
+ // If no existing geometry or point count differs, rebuild
460
+ if (!geometry || !material || !points) {
461
+ handleReplace(data);
462
+ }
463
+ else if (data.points.length === activePointCount) {
464
+ // Try in-place update for same-size data
465
+ const updated = updateGeometry(geometry, data);
466
+ if (updated) {
467
+ updateMaterial(material, data, defaultSize, defaultColor);
468
+ }
469
+ else {
470
+ handleReplace(data);
471
+ }
472
+ }
473
+ else {
474
+ handleReplace(data);
475
+ }
476
+ break;
477
+ }
478
+ },
479
+ clear() {
480
+ assertNotDisposed();
481
+ removeFromScene();
482
+ disposeResources();
483
+ },
484
+ dispose() {
485
+ if (isDisposed) {
486
+ return;
487
+ }
488
+ removeFromScene();
489
+ disposeResources();
490
+ isDisposed = true;
491
+ },
492
+ };
493
+ }
494
+ //# sourceMappingURL=pointCloudLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointCloudLayer.js","sourceRoot":"","sources":["../../src/three/pointCloudLayer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAe/B,wCAAwC;AACxC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,kCAAkC;AAClC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAErC,sDAAsD;AACtD,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAEvC,gDAAgD;AAChD,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B;;;;;GAKG;AACH,SAAS,kBAAkB,CACzB,MAAoB,EACpB,MAAgC,EAChC,UAAkB;IAElB,MAAM,OAAO,GAAG,UAAU,GAAG,CAAC,CAAC;IAC/B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QACxB,MAAM,GAAG,GAAG,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC;QACtB,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAA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AI,CAAC,MAAM,EAAE,CAAC;wBACtC,aAAa,CAAC,IAAI,CAAC,CAAC;oBACtB,CAAC;yBAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,gBAAgB,EAAE,CAAC;wBACnD,yCAAyC;wBACzC,MAAM,OAAO,GAAG,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;wBAC/C,IAAI,OAAO,EAAE,CAAC;4BACZ,cAAc,CAAC,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;wBAC5D,CAAC;6BAAM,CAAC;4BACN,aAAa,CAAC,IAAI,CAAC,CAAC;wBACtB,CAAC;oBACH,CAAC;yBAAM,CAAC;wBACN,aAAa,CAAC,IAAI,CAAC,CAAC;oBACtB,CAAC;oBACD,MAAM;YACV,CAAC;QACH,CAAC;QAED,KAAK;YACH,iBAAiB,EAAE,CAAC;YACpB,eAAe,EAAE,CAAC;YAClB,gBAAgB,EAAE,CAAC;QACrB,CAAC;QAED,OAAO;YACL,IAAI,UAAU,EAAE,CAAC;gBACf,OAAO;YACT,CAAC;YAED,eAAe,EAAE,CAAC;YAClB,gBAAgB,EAAE,CAAC;YACnB,UAAU,GAAG,IAAI,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Minimal structural typings for Three.js objects
3
+ * We avoid importing THREE types to prevent duplicate type conflicts.
4
+ */
5
+ export interface ThreeSceneLike {
6
+ add(object: any): void;
7
+ remove(object: any): void;
8
+ }
9
+ export interface ThreeBufferAttributeLike {
10
+ array: Float32Array;
11
+ count: number;
12
+ itemSize: number;
13
+ needsUpdate?: boolean;
14
+ setUsage?(usage: number): void;
15
+ }
16
+ export interface ThreeBufferGeometryLike {
17
+ getAttribute(name: string): ThreeBufferAttributeLike | undefined;
18
+ setAttribute(name: string, attr: ThreeBufferAttributeLike): void;
19
+ deleteAttribute?(name: string): void;
20
+ setDrawRange(start: number, count: number): void;
21
+ computeBoundingSphere(): void;
22
+ dispose(): void;
23
+ }
24
+ export interface ThreeMaterialLike {
25
+ size: number;
26
+ vertexColors: boolean;
27
+ opacity: number;
28
+ transparent: boolean;
29
+ needsUpdate: boolean;
30
+ color: {
31
+ setHex(hex: number): void;
32
+ };
33
+ dispose(): void;
34
+ }
35
+ export interface ThreePointsLike {
36
+ geometry: ThreeBufferGeometryLike;
37
+ material: ThreeMaterialLike;
38
+ }
39
+ //# sourceMappingURL=three-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"three-types.d.ts","sourceRoot":"","sources":["../../src/three/three-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IACvB,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,YAAY,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,uBAAuB;IACtC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,wBAAwB,GAAG,SAAS,CAAC;IACjE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAwB,GAAG,IAAI,CAAC;IACjE,eAAe,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACjD,qBAAqB,IAAI,IAAI,CAAC;IAC9B,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,OAAO,CAAC;IACrB,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE;QACL,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B,CAAC;IACF,OAAO,IAAI,IAAI,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,uBAAuB,CAAC;IAClC,QAAQ,EAAE,iBAAiB,CAAC;CAC7B"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Minimal structural typings for Three.js objects
3
+ * We avoid importing THREE types to prevent duplicate type conflicts.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=three-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"three-types.js","sourceRoot":"","sources":["../../src/three/three-types.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @streamkit/pointcloud - Core Type Definitions
3
+ *
4
+ * Stable, runtime-agnostic types for PointCloud data.
5
+ * These types intentionally avoid importing Three.js typings
6
+ * to prevent duplicate type conflicts.
7
+ */
8
+ /**
9
+ * Represents a single point in 3D space.
10
+ */
11
+ export interface PointCloudPoint {
12
+ x: number;
13
+ y: number;
14
+ z: number;
15
+ }
16
+ /**
17
+ * Represents an RGB color with values in the 0-255 range.
18
+ */
19
+ export interface PointCloudColor {
20
+ r: number;
21
+ g: number;
22
+ b: number;
23
+ }
24
+ /**
25
+ * Core data structure for PointCloud data.
26
+ *
27
+ * This is the primary data exchange format used throughout the library.
28
+ * It is designed to be serializable and network-friendly.
29
+ */
30
+ export interface PointCloudData {
31
+ /** Array of 3D points */
32
+ points: PointCloudPoint[];
33
+ /** Optional per-vertex colors (0-255 range) */
34
+ colors?: PointCloudColor[];
35
+ /** Point size override for rendering */
36
+ size?: number;
37
+ /** Uniform color override (hex format, e.g., 0xff0000) */
38
+ color?: number;
39
+ /** Opacity value (0-1) */
40
+ opacity?: number;
41
+ }
42
+ /**
43
+ * Minimal structural contract for a Three.js Scene.
44
+ * The consumer provides a real THREE.Scene at runtime.
45
+ */
46
+ export interface ThreeSceneLike {
47
+ add(object: any): void;
48
+ remove(object: any): void;
49
+ }
50
+ /**
51
+ * Options for creating a PointCloud layer.
52
+ */
53
+ export interface PointCloudLayerOptions {
54
+ /** Scene-like object to render into (typically THREE.Scene) */
55
+ scene: ThreeSceneLike;
56
+ /** Default point size when not specified in data */
57
+ defaultSize?: number;
58
+ /** Default color when not specified in data (hex format) */
59
+ defaultColor?: number;
60
+ }
61
+ /**
62
+ * Interface for the PointCloud layer controller.
63
+ */
64
+ export interface PointCloudLayer {
65
+ build(data: PointCloudData): void;
66
+ update(data: PointCloudData, options?: PointCloudUpdateOptions): void;
67
+ clear(): void;
68
+ dispose(): void;
69
+ }
70
+ /**
71
+ * Options for the Draco decoder.
72
+ */
73
+ export interface DracoDecoderOptions {
74
+ /** Path to Draco decoder WASM/JS files */
75
+ decoderPath?: string;
76
+ }
77
+ /**
78
+ * A timestamped frame of point cloud data.
79
+ */
80
+ export interface PointCloudFrame {
81
+ frameId: number;
82
+ timestamp: number;
83
+ data: PointCloudData;
84
+ }
85
+ /**
86
+ * Update mode for incremental point cloud operations.
87
+ */
88
+ export type PointCloudUpdateMode = "replace" | "append" | "partial";
89
+ /**
90
+ * Options for incremental point cloud updates.
91
+ */
92
+ export interface PointCloudUpdateOptions {
93
+ mode: PointCloudUpdateMode;
94
+ offset?: number;
95
+ maxPoints?: number;
96
+ }
97
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,W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