-
Notifications
You must be signed in to change notification settings - Fork 2.2k
fix(PointCloudLayer): add TypeScript types for loaders.gl point cloud data format #10272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
0a327af
aadac92
1724ddf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 = { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we import the type
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Used Mesh from @loaders.gl/schema as suggested. Typed it as Partial & |
||
| header: { | ||
| vertexCount: number; | ||
| }; | ||
| attributes: { | ||
| POSITION?: LoadersGLAttribute; | ||
| NORMAL?: LoadersGLAttribute; | ||
| COLOR_0?: LoadersGLAttribute; | ||
| [key: string]: LoadersGLAttribute | undefined; | ||
| }; | ||
| }; | ||
|
|
||
| const defaultProps: DefaultProps<PointCloudLayerProps> = { | ||
| sizeUnits: 'pixels', | ||
| pointSize: {type: 'number', min: 0, value: 10}, // point radius in pixels | ||
|
|
@@ -70,7 +88,7 @@ export type PointCloudLayerProps<DataT = unknown> = _PointCloudLayerProps<DataT> | |
|
|
||
| /** Properties added by PointCloudLayer. */ | ||
| type _PointCloudLayerProps<DataT> = { | ||
| data: LayerDataSource<DataT>; | ||
| data: LayerDataSource<DataT> | LoadersGLPointCloudData; | ||
| /** | ||
| * The units of the point size, one of `'meters'`, `'common'`, and `'pixels'`. | ||
| * @default 'pixels' | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not import this type from loaders?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, I imported MeshAttributes directly from @loaders.gl/schema and removed the manual type definition.