From 0a327af666fa36564b10caaaf238d2819d8e8c65 Mon Sep 17 00:00:00 2001 From: subodhisawake Date: Sun, 3 May 2026 23:18:20 -0400 Subject: [PATCH 1/3] fix(PointCloudLayer): add TypeScript types for loaders.gl point cloud data format --- .../point-cloud-layer/point-cloud-layer.ts | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/modules/layers/src/point-cloud-layer/point-cloud-layer.ts b/modules/layers/src/point-cloud-layer/point-cloud-layer.ts index 7ed5c0231d9..7859c2206c0 100644 --- a/modules/layers/src/point-cloud-layer/point-cloud-layer.ts +++ b/modules/layers/src/point-cloud-layer/point-cloud-layer.ts @@ -30,6 +30,24 @@ import source from './point-cloud-layer.wgsl'; const DEFAULT_COLOR = [0, 0, 0, 255] as const; const DEFAULT_NORMAL = [0, 0, 1] as const; +type LoadersGLAttribute = { + size: number; + value: ArrayBufferView; + type?: number; +}; + +export type LoadersGLPointCloudData = { + header: { + vertexCount: number; + }; + attributes: { + POSITION?: LoadersGLAttribute; + NORMAL?: LoadersGLAttribute; + COLOR_0?: LoadersGLAttribute; + [key: string]: LoadersGLAttribute | undefined; + }; +}; + const defaultProps: DefaultProps = { sizeUnits: 'pixels', pointSize: {type: 'number', min: 0, value: 10}, // point radius in pixels @@ -70,7 +88,7 @@ export type PointCloudLayerProps = _PointCloudLayerProps /** Properties added by PointCloudLayer. */ type _PointCloudLayerProps = { - data: LayerDataSource; + data: LayerDataSource | LoadersGLPointCloudData; /** * The units of the point size, one of `'meters'`, `'common'`, and `'pixels'`. * @default 'pixels' From aadac928701c00c10d766b44099e94b388ad3075 Mon Sep 17 00:00:00 2001 From: subodhisawake Date: Mon, 4 May 2026 19:30:28 -0400 Subject: [PATCH 2/3] fix(PointCloudLayer): import MeshAttributes from @loaders.gl/schema instead of redefining --- .../src/point-cloud-layer/point-cloud-layer.ts | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/modules/layers/src/point-cloud-layer/point-cloud-layer.ts b/modules/layers/src/point-cloud-layer/point-cloud-layer.ts index 7859c2206c0..f82f936e33b 100644 --- a/modules/layers/src/point-cloud-layer/point-cloud-layer.ts +++ b/modules/layers/src/point-cloud-layer/point-cloud-layer.ts @@ -26,26 +26,16 @@ import {pointCloudUniforms, PointCloudProps} from './point-cloud-layer-uniforms' import vs from './point-cloud-layer-vertex.glsl'; import fs from './point-cloud-layer-fragment.glsl'; import source from './point-cloud-layer.wgsl'; +import type {MeshAttributes} from '@loaders.gl/schema'; const DEFAULT_COLOR = [0, 0, 0, 255] as const; const DEFAULT_NORMAL = [0, 0, 1] as const; -type LoadersGLAttribute = { - size: number; - value: ArrayBufferView; - type?: number; -}; - export type LoadersGLPointCloudData = { header: { vertexCount: number; }; - attributes: { - POSITION?: LoadersGLAttribute; - NORMAL?: LoadersGLAttribute; - COLOR_0?: LoadersGLAttribute; - [key: string]: LoadersGLAttribute | undefined; - }; + attributes: MeshAttributes; }; const defaultProps: DefaultProps = { From 1724ddf46c93cef1fa7218c497980eea6e5d72a8 Mon Sep 17 00:00:00 2001 From: subodhisawake Date: Fri, 8 May 2026 22:10:51 -0400 Subject: [PATCH 3/3] fix(PointCloudLayer): use Mesh type from @loaders.gl/schema instead of MeshAttributes --- .../layers/src/point-cloud-layer/point-cloud-layer.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/layers/src/point-cloud-layer/point-cloud-layer.ts b/modules/layers/src/point-cloud-layer/point-cloud-layer.ts index f82f936e33b..0c2176f1d83 100644 --- a/modules/layers/src/point-cloud-layer/point-cloud-layer.ts +++ b/modules/layers/src/point-cloud-layer/point-cloud-layer.ts @@ -26,16 +26,14 @@ import {pointCloudUniforms, PointCloudProps} from './point-cloud-layer-uniforms' import vs from './point-cloud-layer-vertex.glsl'; import fs from './point-cloud-layer-fragment.glsl'; import source from './point-cloud-layer.wgsl'; -import type {MeshAttributes} from '@loaders.gl/schema'; +import type {Mesh} from '@loaders.gl/schema'; const DEFAULT_COLOR = [0, 0, 0, 255] as const; const DEFAULT_NORMAL = [0, 0, 1] as const; -export type LoadersGLPointCloudData = { - header: { - vertexCount: number; - }; - attributes: MeshAttributes; +export type LoadersGLPointCloudData = Partial & { + header: {vertexCount: number}; + attributes: Mesh['attributes']; }; const defaultProps: DefaultProps = {