UNPKG

@loaders.gl/pcd

Version:

Framework-independent loader for the PCD format

30 lines (29 loc) 875 B
/** * Gets schema from PCD header * @param PCDheader * @param metadata * @returns Schema */ export function getPCDSchema(PCDheader, metadata) { const offset = PCDheader.offset; const fields = []; if (offset.x !== undefined) { fields.push({ name: 'POSITION', type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] } }); } if (offset.normal_x !== undefined) { fields.push({ name: 'NORMAL', type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'xyz', type: 'float32' }] } }); } if (offset.rgb !== undefined) { fields.push({ name: 'COLOR_0', type: { type: 'fixed-size-list', listSize: 3, children: [{ name: 'rgb', type: 'uint8' }] } }); } return { fields, metadata }; }