@loaders.gl/schema 5.0.0-alpha.1 → 5.0.0-alpha.10

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.
Files changed (44) hide show
  1. package/LICENSE +14 -3
  2. package/dist/categories/category-mesh.d.ts +31 -5
  3. package/dist/categories/category-mesh.d.ts.map +1 -1
  4. package/dist/categories/category-mesh.js +1 -1
  5. package/dist/categories/category-mesh.js.map +1 -1
  6. package/dist/deprecated/mesh-utils.d.ts +5 -18
  7. package/dist/deprecated/mesh-utils.d.ts.map +1 -1
  8. package/dist/deprecated/mesh-utils.js +13 -25
  9. package/dist/deprecated/mesh-utils.js.map +1 -1
  10. package/dist/dist.dev.js +1246 -227
  11. package/dist/dist.min.js +3 -3
  12. package/dist/float16.d.ts +19 -0
  13. package/dist/float16.d.ts.map +1 -0
  14. package/dist/float16.js +90 -0
  15. package/dist/float16.js.map +1 -0
  16. package/dist/geometry/geoarrow.d.ts +69 -0
  17. package/dist/geometry/geoarrow.d.ts.map +1 -0
  18. package/dist/geometry/geoarrow.js +5 -0
  19. package/dist/geometry/geoarrow.js.map +1 -0
  20. package/dist/index.cjs +162 -21
  21. package/dist/index.cjs.map +2 -3
  22. package/dist/index.d.ts +7 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +4 -3
  25. package/dist/index.js.map +1 -1
  26. package/dist/metadata.d.ts +40 -0
  27. package/dist/metadata.d.ts.map +1 -0
  28. package/dist/metadata.js +86 -0
  29. package/dist/metadata.js.map +1 -0
  30. package/dist/types/schema.d.ts +4 -1
  31. package/dist/types/schema.d.ts.map +1 -1
  32. package/dist/types/types.d.ts +3 -2
  33. package/dist/types/types.d.ts.map +1 -1
  34. package/dist/types/types.js +1 -0
  35. package/dist/types/types.js.map +1 -1
  36. package/package.json +3 -2
  37. package/src/categories/category-mesh.ts +45 -6
  38. package/src/deprecated/mesh-utils.ts +15 -35
  39. package/src/float16.ts +111 -0
  40. package/src/geometry/geoarrow.ts +116 -0
  41. package/src/index.ts +43 -8
  42. package/src/metadata.ts +115 -0
  43. package/src/types/schema.ts +3 -0
  44. package/src/types/types.ts +7 -0
package/LICENSE CHANGED
@@ -24,8 +24,20 @@ THE SOFTWARE.
24
24
 
25
25
  Copyright (c) 2015 Uber Technologies, Inc.
26
26
 
27
- loaders.gl includes certain files from Cesium (https://github.com/AnalyticalGraphicsInc/cesium)
28
- under the Apache 2 License (found in the submodule: modules/3d-tiles):)
27
+ Portions of modules/images/src/lib/category-api/binary-image-api.ts are based on
28
+ binary-gltf-utils (https://github.com/Qantas94Heavy/binary-gltf-utils) under the
29
+ MIT License reproduced above.
30
+
31
+ Copyright (c) 2016-17 Karl Cheng
32
+
33
+ Portions of modules/schema-utils/src/lib/utils/async-queue.ts are adapted from
34
+ async-iter-demo (https://github.com/rauschma/async-iter-demo) under the MIT
35
+ License reproduced above.
36
+
37
+ Copyright (c) 2016 Axel Rauschmayer
38
+
39
+ loaders.gl includes certain files from Cesium (https://github.com/CesiumGS/cesium)
40
+ under the Apache 2.0 License, including files in modules/3d-tiles.
29
41
 
30
42
  Copyright 2011-2018 CesiumJS Contributors
31
43
 
@@ -38,4 +50,3 @@ Unless required by applicable law or agreed to in writing, software
38
50
  distributed under the License is distributed on an "AS IS" BASIS,
39
51
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
40
52
  See the License for the specific language governing permissions and limitations under the License.
41
-
@@ -4,13 +4,13 @@ import type { ColumnarTable, ArrowTable } from "./category-table.js";
4
4
  import * as arrow from 'apache-arrow';
5
5
  /** Mesh as columnar table */
6
6
  export interface MeshTable extends ColumnarTable {
7
- topology: 'point-list' | 'triangle-list' | 'triangle-strip';
7
+ topology: MeshTopology;
8
8
  indices?: MeshAttribute;
9
9
  }
10
10
  /** Mesh as arrow table */
11
11
  export interface MeshArrowTable extends ArrowTable {
12
12
  /** Mesh topology represented by the Arrow table rows and indices. */
13
- topology: 'point-list' | 'triangle-list' | 'triangle-strip';
13
+ topology: MeshTopology;
14
14
  /** Optional top-level primitive indices accessor for indexed meshes. */
15
15
  indices?: MeshAttribute;
16
16
  /** Raw Apache Arrow table data for Mesh or IndexedMesh columns. */
@@ -23,10 +23,12 @@ export type MeshArrowColumns = {
23
23
  /** Loader-specific vertex attribute columns appended after predefined fields. */
24
24
  [attributeName: string]: arrow.DataType;
25
25
  };
26
+ /** Primitive topology names shared by columnar and Arrow mesh representations. */
27
+ export type MeshTopology = 'point-list' | 'line-list' | 'line-loop' | 'line-strip' | 'triangle-list' | 'triangle-strip' | 'triangle-fan';
26
28
  /** Apache Arrow columns for an indexed mesh vertex table. */
27
29
  export type IndexedMeshArrowColumns = MeshArrowColumns & {
28
- /** Primitive indices, stored in row 0 and null for remaining vertex rows. */
29
- indices: arrow.List<arrow.Int32>;
30
+ /** Unsigned 32-bit primitive indices, stored in row 0 and null for remaining vertex rows. */
31
+ indices: arrow.List<arrow.Uint32>;
30
32
  };
31
33
  /** Raw Apache Arrow table data for a mesh vertex table. */
32
34
  export type MeshArrowTableData = arrow.Table<MeshArrowColumns>;
@@ -42,7 +44,7 @@ export type MeshGeometry = {
42
44
  [attributeName: string]: MeshAttribute;
43
45
  };
44
46
  indices?: MeshAttribute;
45
- topology: 'point-list' | 'triangle-list' | 'triangle-strip';
47
+ topology: MeshTopology;
46
48
  mode: number;
47
49
  };
48
50
  /** Geometry and metadata for a Mesh (compatible with a standard luma.gl "mesh") */
@@ -57,6 +59,26 @@ export type Mesh = MeshGeometry & {
57
59
  };
58
60
  schema: Schema;
59
61
  };
62
+ /** Quantization transform required to reconstruct floating-point attribute values. */
63
+ export type MeshAttributeQuantizationTransform = {
64
+ /** Transform discriminator. */
65
+ type: 'quantization';
66
+ /** Number of quantization bits. */
67
+ bits: number;
68
+ /** Per-component quantization origin. */
69
+ origin: number[];
70
+ /** Quantization range shared by every component. */
71
+ range: number;
72
+ };
73
+ /** Octahedral transform required to reconstruct directional attribute values. */
74
+ export type MeshAttributeOctahedronTransform = {
75
+ /** Transform discriminator. */
76
+ type: 'octahedron';
77
+ /** Number of quantization bits. */
78
+ bits: number;
79
+ };
80
+ /** Encoded transform retained on an attribute for deferred CPU or GPU reconstruction. */
81
+ export type MeshAttributeTransform = MeshAttributeQuantizationTransform | MeshAttributeOctahedronTransform;
60
82
  /**
61
83
  * luma.gl compatible attribute descriptors
62
84
  * Can be mapped to any WebGL framework
@@ -67,6 +89,10 @@ export type MeshAttribute = {
67
89
  byteOffset?: number;
68
90
  byteStride?: number;
69
91
  normalized?: boolean;
92
+ /** Logical component type when the storage array does not expose it directly. */
93
+ componentType?: 'float16';
94
+ /** Transform required to reconstruct the logical attribute values. */
95
+ transform?: MeshAttributeTransform;
70
96
  };
71
97
  /** A map of mesh attributes keyed by attribute names */
72
98
  export type MeshAttributes = Record<string, MeshAttribute>;
@@ -1 +1 @@
1
- {"version":3,"file":"category-mesh.d.ts","sourceRoot":"","sources":["../../src/categories/category-mesh.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAC,2BAAwB;AAC5C,OAAO,KAAK,EAAC,UAAU,EAAC,0BAAuB;AAC/C,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,4BAAyB;AAChE,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAEtC,6BAA6B;AAC7B,MAAM,WAAW,SAAU,SAAQ,aAAa;IAE9C,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,0BAA0B;AAC1B,MAAM,WAAW,cAAe,SAAQ,UAAU;IAEhD,qEAAqE;IACrE,QAAQ,EAAE,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC5D,wEAAwE;IACxE,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,mEAAmE;IACnE,IAAI,EAAE,kBAAkB,GAAG,yBAAyB,CAAC;CACtD;AAED,oDAAoD;AACpD,MAAM,MAAM,gBA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IACnC,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,+BAA+B;IAC/B,IAAI,EAAE,YAAY,CAAC;IACnB,mCAAmC;IACnC,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAC9B,kCAAkC,GAClC,gCAAgC,CAAC;AAErC;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,UAAU,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iFAAiF;IACjF,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,sEAAsE;IACtE,SAAS,CAAC,EAAE,sBAAsB,CAAC;CACpC,CAAC;AAEF,wDAAwD;AACxD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC"}
@@ -9,6 +9,6 @@ export const meshArrowSchema = new arrow.Schema([
9
9
  /** Predefined Apache Arrow schema for indexed mesh vertex tables. */
10
10
  export const indexedMeshArrowSchema = new arrow.Schema([
11
11
  ...meshArrowSchema.fields,
12
- new arrow.Field('indices', new arrow.List(new arrow.Field('item', new arrow.Int32(), false)), true)
12
+ new arrow.Field('indices', new arrow.List(new arrow.Field('item', new arrow.Uint32(), false)), true)
13
13
  ]);
14
14
  //# sourceMappingURL=category-mesh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"category-mesh.js","sourceRoot":"","sources":["../../src/categories/category-mesh.ts"],"names":[],"mappings":"AAAA,aAAa;AACb,+BAA+B;AAC/B,oCAAoC;AAKpC,OAAO,KAAK,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,IAAI,KAAK,CAAC,KAAK,CACb,SAAS,EACT,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,CAAC,EAClE,IAAI,CACL;CACF,CAAC,CAAC"}
@@ -1,24 +1,11 @@
1
1
  import { MeshAttributes } from "../categories/category-mesh.js";
2
- import { TypedArray } from "../types/types.js";
3
- type TypedArrays = {
4
- [key: string]: TypedArray;
5
- };
6
- /**
7
- * Holds an axis aligned bounding box
8
- * TODO - make sure AxisAlignedBoundingBox in math.gl/culling understands this format (or change this format)
9
- */
10
2
  type BoundingBox = [[number, number, number], [number, number, number]];
11
3
  /**
12
- * Get number of vertices in mesh
13
- * @param attributes
14
- * @deprecated Import from shema-utils
15
- */
16
- export declare function getMeshSize(attributes: TypedArrays): number;
17
- /**
18
- * Get the (axis aligned) bounding box of a mesh
19
- * @param attributes
20
- * @returns array of two vectors representing the axis aligned bounding box
21
- * @deprecated Import from shema-utils
4
+ * Get the (axis aligned) bounding box of a mesh.
5
+ * @param attributes Mesh attributes.
6
+ * @returns The axis aligned bounding box as minimum and maximum vectors.
7
+ * @deprecated Import `getMeshBoundingBox` from `@loaders.gl/schema-utils` instead. This root
8
+ * export remains temporarily for deck.gl 9.4 compatibility.
22
9
  */
23
10
  export declare function getMeshBoundingBox(attributes: MeshAttributes): BoundingBox;
24
11
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-utils.d.ts","sourceRoot":"","sources":["../../src/deprecated/mesh-utils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,cAAc,EAAC,uCAAoC;AAC3D,OAAO,EAAC,UAAU,EAAC,0BAAuB;AAE1C,KAAK,WAAW,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAA;CAAC,CAAC;AAE/C;;;GAGG;AACH,KAAK,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,WAAW,GAAG,MAAM,CAU3D;AAED;;;;;GAKG;AAEH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,GAAG,WAAW,CA4B1E"}
1
+ {"version":3,"file":"mesh-utils.d.ts","sourceRoot":"","sources":["../../src/deprecated/mesh-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAC,uCAAoC;AAE3D,KAAK,WAAW,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAExE;;;;;;GAMG;AAEH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,cAAc,GAAG,WAAW,CA6B1E"}
@@ -1,24 +1,12 @@
1
+ // loaders.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
1
4
  /**
2
- * Get number of vertices in mesh
3
- * @param attributes
4
- * @deprecated Import from shema-utils
5
- */
6
- export function getMeshSize(attributes) {
7
- let size = 0;
8
- for (const attributeName in attributes) {
9
- const attribute = attributes[attributeName];
10
- if (ArrayBuffer.isView(attribute)) {
11
- // @ts-ignore DataView doesn't have BYTES_PER_ELEMENT
12
- size += attribute.byteLength * attribute.BYTES_PER_ELEMENT;
13
- }
14
- }
15
- return size;
16
- }
17
- /**
18
- * Get the (axis aligned) bounding box of a mesh
19
- * @param attributes
20
- * @returns array of two vectors representing the axis aligned bounding box
21
- * @deprecated Import from shema-utils
5
+ * Get the (axis aligned) bounding box of a mesh.
6
+ * @param attributes Mesh attributes.
7
+ * @returns The axis aligned bounding box as minimum and maximum vectors.
8
+ * @deprecated Import `getMeshBoundingBox` from `@loaders.gl/schema-utils` instead. This root
9
+ * export remains temporarily for deck.gl 9.4 compatibility.
22
10
  */
23
11
  // eslint-disable-next-line complexity
24
12
  export function getMeshBoundingBox(attributes) {
@@ -29,11 +17,11 @@ export function getMeshBoundingBox(attributes) {
29
17
  let maxY = -Infinity;
30
18
  let maxZ = -Infinity;
31
19
  const positions = attributes.POSITION ? attributes.POSITION.value : [];
32
- const len = positions && positions.length;
33
- for (let i = 0; i < len; i += 3) {
34
- const x = positions[i];
35
- const y = positions[i + 1];
36
- const z = positions[i + 2];
20
+ const length = positions && positions.length;
21
+ for (let index = 0; index < length; index += 3) {
22
+ const x = positions[index];
23
+ const y = positions[index + 1];
24
+ const z = positions[index + 2];
37
25
  minX = x < minX ? x : minX;
38
26
  minY = y < minY ? y : minY;
39
27
  minZ = z < minZ ? z : minZ;
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-utils.js","sourceRoot":"","sources":["../../src/deprecated/mesh-utils.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAAuB;IACjD,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,aAAa,IAAI,UAAU,EAAE,CAAC;QACvC,MAAM,SAAS,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;QAC5C,IAAI,WAAW,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YAClC,qDAAqD;YACrD,IAAI,IAAI,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC,iBAAiB,CAAC;QAC7D,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,sCAAsC;AACtC,MAAM,UAAU,kBAAkB,CAAC,UAA0B;IAC3D,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IACrB,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IACrB,IAAI,IAAI,GAA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