@luma.gl/engine 9.0.0-alpha.31 → 9.0.0-alpha.32

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 (48) hide show
  1. package/dist/dist.dev.js +539 -286
  2. package/dist/geometries/truncated-cone-geometry.d.ts +0 -2
  3. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  4. package/dist/geometries/truncated-cone-geometry.js +0 -11
  5. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  6. package/dist/geometry/geometry.d.ts +6 -7
  7. package/dist/geometry/geometry.d.ts.map +1 -1
  8. package/dist/geometry/geometry.js.map +1 -1
  9. package/dist/geometry/gpu-geometry.d.ts +45 -0
  10. package/dist/geometry/gpu-geometry.d.ts.map +1 -0
  11. package/dist/geometry/gpu-geometry.js +123 -0
  12. package/dist/geometry/gpu-geometry.js.map +1 -0
  13. package/dist/geometry/gpu-table.d.ts +1 -0
  14. package/dist/geometry/gpu-table.d.ts.map +1 -0
  15. package/dist/geometry/gpu-table.js +2 -0
  16. package/dist/geometry/gpu-table.js.map +1 -0
  17. package/dist/index.cjs +311 -211
  18. package/dist/lib/pipeline-factory.d.ts +11 -44
  19. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  20. package/dist/lib/pipeline-factory.js +28 -119
  21. package/dist/lib/pipeline-factory.js.map +1 -1
  22. package/dist/model/model-shaders.d.ts +35 -0
  23. package/dist/model/model-shaders.d.ts.map +1 -0
  24. package/dist/model/model-shaders.js +38 -0
  25. package/dist/model/model-shaders.js.map +1 -0
  26. package/dist/model/model-utils.d.ts +1 -1
  27. package/dist/model/model-utils.d.ts.map +1 -1
  28. package/dist/model/model-utils.js +1 -1
  29. package/dist/model/model-utils.js.map +1 -1
  30. package/dist/model/model.d.ts +107 -22
  31. package/dist/model/model.d.ts.map +1 -1
  32. package/dist/model/model.js +144 -93
  33. package/dist/model/model.js.map +1 -1
  34. package/dist.min.js +67 -67
  35. package/package.json +6 -6
  36. package/src/geometries/truncated-cone-geometry.ts +0 -10
  37. package/src/geometry/geometry.ts +7 -7
  38. package/src/geometry/gpu-geometry.ts +159 -0
  39. package/src/geometry/gpu-table.ts +41 -0
  40. package/src/lib/pipeline-factory.ts +43 -164
  41. package/src/model/model-shaders.ts +76 -0
  42. package/src/model/model-utils.ts +2 -2
  43. package/src/model/model.ts +268 -126
  44. package/dist/geometry/primitive-utils.d.ts +0 -1
  45. package/dist/geometry/primitive-utils.d.ts.map +0 -1
  46. package/dist/geometry/primitive-utils.js +0 -2
  47. package/dist/geometry/primitive-utils.js.map +0 -1
  48. package/src/geometry/primitive-utils.ts +0 -30
@@ -1,5 +1,4 @@
1
1
  import { Geometry } from '../geometry/geometry';
2
- import { GeometryTable } from '../geometry/geometry-table';
3
2
  export type TruncatedConeGeometryProps = {
4
3
  topRadius?: number;
5
4
  bottomRadius?: number;
@@ -15,7 +14,6 @@ export type TruncatedConeGeometryProps = {
15
14
  * copyright 2011 Google Inc. new BSD License
16
15
  * (http://www.opensource.org/licenses/bsd-license.php).
17
16
  */
18
- export declare function makeTruncatedConeGeometry(props?: TruncatedConeGeometryProps): GeometryTable;
19
17
  export declare class TruncatedConeGeometry extends Geometry {
20
18
  constructor(props?: TruncatedConeGeometryProps & {
21
19
  id?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"truncated-cone-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/truncated-cone-geometry.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAQzD,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAChC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,CAAC,EAAE,0BAA0B,GAAG,aAAa,CAO3F;AAED,qBAAa,qBAAsB,SAAQ,QAAQ;gBACrC,KAAK,GAAE,0BAA0B,GAAG;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,GAAG,CAAA;KAAM;CAerF"}
1
+ {"version":3,"file":"truncated-cone-geometry.d.ts","sourceRoot":"","sources":["../../src/geometries/truncated-cone-geometry.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAQ9C,MAAM,MAAM,0BAA0B,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;CAChC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,qBAAsB,SAAQ,QAAQ;gBACrC,KAAK,GAAE,0BAA0B,GAAG;QAAC,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,GAAG,CAAA;KAAM;CAerF"}
@@ -5,17 +5,6 @@ const INDEX_OFFSETS = {
5
5
  y: [0, 1, 2],
6
6
  z: [1, 2, 0]
7
7
  };
8
- export function makeTruncatedConeGeometry(props) {
9
- const {
10
- indices,
11
- attributes
12
- } = tesselateTruncatedCone(props);
13
- return {
14
- length: indices.length,
15
- indices,
16
- attributes
17
- };
18
- }
19
8
  export class TruncatedConeGeometry extends Geometry {
20
9
  constructor() {
21
10
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
@@ -1 +1 @@
1
- {"version":3,"file":"truncated-cone-geometry.js","names":["uid","Geometry","INDEX_OFFSETS","x","y","z","makeTruncatedConeGeometry","props","indices","attributes","tesselateTruncatedCone","length","TruncatedConeGeometry","constructor","arguments","undefined","id","topology","POSITION","size","value","NORMAL","TEXCOORD_0","bottomRadius","topRadius","height","nradial","nvertical","verticalAxis","topCap","bottomCap","extra","numVertices","slant","Math","atan2","msin","sin","mcos","cos","mpi","PI","cosSlant","sinSlant","start","end","vertsAroundEdge","Uint16Array","indexOffset","positions","Float32Array","normals","texCoords","i3","i2","i","v","ringRadius","j","index"],"sources":["../../src/geometries/truncated-cone-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/core';\nimport {Geometry} from '../geometry/geometry';\nimport {GeometryTable} from '../geometry/geometry-table';\n\nconst INDEX_OFFSETS = {\n x: [2, 0, 1],\n y: [0, 1, 2],\n z: [1, 2, 0]\n};\n\nexport type TruncatedConeGeometryProps = {\n topRadius?: number;\n bottomRadius?: number;\n topCap?: boolean;\n bottomCap?: boolean;\n height?: number;\n nradial?: number;\n nvertical?: number;\n verticalAxis?: 'x' | 'y' | 'z';\n};\n\n/**\n * Primitives inspired by TDL http://code.google.com/p/webglsamples/,\n * copyright 2011 Google Inc. new BSD License\n * (http://www.opensource.org/licenses/bsd-license.php).\n */\nexport function makeTruncatedConeGeometry(props?: TruncatedConeGeometryProps): GeometryTable {\n const {indices, attributes} = tesselateTruncatedCone(props);\n return {\n length: indices.length,\n indices,\n attributes\n };\n}\n\nexport class TruncatedConeGeometry extends Geometry {\n constructor(props: TruncatedConeGeometryProps & {id?: string; attributes?: any} = {}) {\n const {id = uid('truncated-code-geometry')} = props;\n const {indices, attributes} = tesselateTruncatedCone(props);\n super({\n ...props,\n id,\n topology: 'triangle-list',\n indices,\n attributes: {\n POSITION: {size: 3, value: attributes.POSITION},\n NORMAL: {size: 3, value: attributes.NORMAL},\n TEXCOORD_0: {size: 2, value: attributes.TEXCOORD_0},\n ...props.attributes}\n });\n }\n}\n\n/* eslint-disable max-statements, complexity */\nfunction tesselateTruncatedCone(props: TruncatedConeGeometryProps = {}) {\n const {\n bottomRadius = 0,\n topRadius = 0,\n height = 1,\n nradial = 10,\n nvertical = 10,\n verticalAxis = 'y',\n topCap = false,\n bottomCap = false\n } = props;\n\n const extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);\n const numVertices = (nradial + 1) * (nvertical + 1 + extra);\n\n const slant = Math.atan2(bottomRadius - topRadius, height);\n const msin = Math.sin;\n const mcos = Math.cos;\n const mpi = Math.PI;\n const cosSlant = mcos(slant);\n const sinSlant = msin(slant);\n const start = topCap ? -2 : 0;\n const end = nvertical + (bottomCap ? 2 : 0);\n const vertsAroundEdge = nradial + 1;\n\n const indices = new Uint16Array(nradial * (nvertical + extra) * 6);\n const indexOffset = INDEX_OFFSETS[verticalAxis];\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(numVertices * 2);\n\n let i3 = 0;\n let i2 = 0;\n for (let i = start; i <= end; i++) {\n let v = i / nvertical;\n let y = height * v;\n let ringRadius;\n\n if (i < 0) {\n y = 0;\n v = 1;\n ringRadius = bottomRadius;\n } else if (i > nvertical) {\n y = height;\n v = 1;\n ringRadius = topRadius;\n } else {\n ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);\n }\n if (i === -2 || i === nvertical + 2) {\n ringRadius = 0;\n v = 0;\n }\n y -= height / 2;\n for (let j = 0; j < vertsAroundEdge; j++) {\n const sin = msin((j * mpi * 2) / nradial);\n const cos = mcos((j * mpi * 2) / nradial);\n\n positions[i3 + indexOffset[0]] = sin * ringRadius;\n positions[i3 + indexOffset[1]] = y;\n positions[i3 + indexOffset[2]] = cos * ringRadius;\n\n normals[i3 + indexOffset[0]] = i < 0 || i > nvertical ? 0 : sin * cosSlant;\n normals[i3 + indexOffset[1]] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant;\n normals[i3 + indexOffset[2]] = i < 0 || i > nvertical ? 0 : cos * cosSlant;\n\n texCoords[i2 + 0] = j / nradial;\n texCoords[i2 + 1] = v;\n\n i2 += 2;\n i3 += 3;\n }\n }\n\n for (let i = 0; i < nvertical + extra; i++) {\n for (let j = 0; j < nradial; j++) {\n const index = (i * nradial + j) * 6;\n indices[index + 0] = vertsAroundEdge * (i + 0) + 0 + j;\n indices[index + 1] = vertsAroundEdge * (i + 0) + 1 + j;\n indices[index + 2] = vertsAroundEdge * (i + 1) + 1 + j;\n indices[index + 3] = vertsAroundEdge * (i + 0) + 0 + j;\n indices[index + 4] = vertsAroundEdge * (i + 1) + 1 + j;\n indices[index + 5] = vertsAroundEdge * (i + 1) + 0 + j;\n }\n }\n\n return {\n indices,\n attributes: {\n POSITION: positions,\n NORMAL: normals,\n TEXCOORD_0: texCoords\n }\n };\n}\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,eAAe;AAAC,SAC1BC,QAAQ;AAGhB,MAAMC,aAAa,GAAG;EACpBC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACZC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACZC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACb,CAAC;AAkBD,OAAO,SAASC,yBAAyBA,CAACC,KAAkC,EAAiB;EAC3F,MAAM;IAACC,OAAO;IAAEC;EAAU,CAAC,GAAGC,sBAAsB,CAACH,KAAK,CAAC;EAC3D,OAAO;IACLI,MAAM,EAAEH,OAAO,CAACG,MAAM;IACtBH,OAAO;IACPC;EACF,CAAC;AACH;AAEA,OAAO,MAAMG,qBAAqB,SAASX,QAAQ,CAAC;EAClDY,WAAWA,CAAA,EAA2E;IAAA,IAA1EN,KAAmE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CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;MACtDlD,OAAO,CAACmD,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;IACxD;EACF;EAEA,OAAO;IACLlD,OAAO;IACPC,UAAU,EAAE;MACVS,QAAQ,EAAE+B,SAAS;MACnB5B,MAAM,EAAE8B,OAAO;MACf7B,UAAU,EAAE8B;IACd;EACF,CAAC;AACH"}
1
+ {"version":3,"file":"truncated-cone-geometry.js","names":["uid","Geometry","INDEX_OFFSETS","x","y","z","TruncatedConeGeometry","constructor","props","arguments","length","undefined","id","indices","attributes","tesselateTruncatedCone","topology","POSITION","size","value","NORMAL","TEXCOORD_0","bottomRadius","topRadius","height","nradial","nvertical","verticalAxis","topCap","bottomCap","extra","numVertices","slant","Math","atan2","msin","sin","mcos","cos","mpi","PI","cosSlant","sinSlant","start","end","vertsAroundEdge","Uint16Array","indexOffset","positions","Float32Array","normals","texCoords","i3","i2","i","v","ringRadius","j","index"],"sources":["../../src/geometries/truncated-cone-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/core';\nimport {Geometry} from '../geometry/geometry';\n\nconst INDEX_OFFSETS = {\n x: [2, 0, 1],\n y: [0, 1, 2],\n z: [1, 2, 0]\n};\n\nexport type TruncatedConeGeometryProps = {\n topRadius?: number;\n bottomRadius?: number;\n topCap?: boolean;\n bottomCap?: boolean;\n height?: number;\n nradial?: number;\n nvertical?: number;\n verticalAxis?: 'x' | 'y' | 'z';\n};\n\n/**\n * Primitives inspired by TDL http://code.google.com/p/webglsamples/,\n * copyright 2011 Google Inc. new BSD License\n * (http://www.opensource.org/licenses/bsd-license.php).\n */\nexport class TruncatedConeGeometry extends Geometry {\n constructor(props: TruncatedConeGeometryProps & {id?: string; attributes?: any} = {}) {\n const {id = uid('truncated-code-geometry')} = props;\n const {indices, attributes} = tesselateTruncatedCone(props);\n super({\n ...props,\n id,\n topology: 'triangle-list',\n indices,\n attributes: {\n POSITION: {size: 3, value: attributes.POSITION},\n NORMAL: {size: 3, value: attributes.NORMAL},\n TEXCOORD_0: {size: 2, value: attributes.TEXCOORD_0},\n ...props.attributes}\n });\n }\n}\n\n/* eslint-disable max-statements, complexity */\nfunction tesselateTruncatedCone(props: TruncatedConeGeometryProps = {}) {\n const {\n bottomRadius = 0,\n topRadius = 0,\n height = 1,\n nradial = 10,\n nvertical = 10,\n verticalAxis = 'y',\n topCap = false,\n bottomCap = false\n } = props;\n\n const extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0);\n const numVertices = (nradial + 1) * (nvertical + 1 + extra);\n\n const slant = Math.atan2(bottomRadius - topRadius, height);\n const msin = Math.sin;\n const mcos = Math.cos;\n const mpi = Math.PI;\n const cosSlant = mcos(slant);\n const sinSlant = msin(slant);\n const start = topCap ? -2 : 0;\n const end = nvertical + (bottomCap ? 2 : 0);\n const vertsAroundEdge = nradial + 1;\n\n const indices = new Uint16Array(nradial * (nvertical + extra) * 6);\n const indexOffset = INDEX_OFFSETS[verticalAxis];\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(numVertices * 2);\n\n let i3 = 0;\n let i2 = 0;\n for (let i = start; i <= end; i++) {\n let v = i / nvertical;\n let y = height * v;\n let ringRadius;\n\n if (i < 0) {\n y = 0;\n v = 1;\n ringRadius = bottomRadius;\n } else if (i > nvertical) {\n y = height;\n v = 1;\n ringRadius = topRadius;\n } else {\n ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);\n }\n if (i === -2 || i === nvertical + 2) {\n ringRadius = 0;\n v = 0;\n }\n y -= height / 2;\n for (let j = 0; j < vertsAroundEdge; j++) {\n const sin = msin((j * mpi * 2) / nradial);\n const cos = mcos((j * mpi * 2) / nradial);\n\n positions[i3 + indexOffset[0]] = sin * ringRadius;\n positions[i3 + indexOffset[1]] = y;\n positions[i3 + indexOffset[2]] = cos * ringRadius;\n\n normals[i3 + indexOffset[0]] = i < 0 || i > nvertical ? 0 : sin * cosSlant;\n normals[i3 + indexOffset[1]] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant;\n normals[i3 + indexOffset[2]] = i < 0 || i > nvertical ? 0 : cos * cosSlant;\n\n texCoords[i2 + 0] = j / nradial;\n texCoords[i2 + 1] = v;\n\n i2 += 2;\n i3 += 3;\n }\n }\n\n for (let i = 0; i < nvertical + extra; i++) {\n for (let j = 0; j < nradial; j++) {\n const index = (i * nradial + j) * 6;\n indices[index + 0] = vertsAroundEdge * (i + 0) + 0 + j;\n indices[index + 1] = vertsAroundEdge * (i + 0) + 1 + j;\n indices[index + 2] = vertsAroundEdge * (i + 1) + 1 + j;\n indices[index + 3] = vertsAroundEdge * (i + 0) + 0 + j;\n indices[index + 4] = vertsAroundEdge * (i + 1) + 1 + j;\n indices[index + 5] = vertsAroundEdge * (i + 1) + 0 + j;\n }\n }\n\n return {\n indices,\n attributes: {\n POSITION: positions,\n NORMAL: normals,\n TEXCOORD_0: texCoords\n }\n };\n}\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,eAAe;AAAC,SAC1BC,QAAQ;AAEhB,MAAMC,aAAa,GAAG;EACpBC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACZC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACZC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACb,CAAC;AAkBD,OAAO,MAAMC,qBAAqB,SAASL,QAAQ,CAAC;EAClDM,WAAWA,CAAA,EAA2E;IAAA,IAA1EC,KAAmE,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;IAClF,MAAM;MAACG,EAAE,GAAGZ,GAAG,CAAC,yBAAyB;IAAC,CAAC,GAAGQ,KAAK;IACnD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AAC,GAAG,CAAC,GAAGG,CAAC;IACxD;EACF;EAEA,OAAO;IACL5C,OAAO;IACPC,UAAU,EAAE;MACVG,QAAQ,EAAE+B,SAAS;MACnB5B,MAAM,EAAE8B,OAAO;MACf7B,UAAU,EAAE8B;IACd;EACF,CAAC;AACH"}
@@ -1,9 +1,4 @@
1
1
  import type { PrimitiveTopology, TypedArray } from '@luma.gl/core';
2
- export type GeometryAttribute = {
3
- size?: number;
4
- value: TypedArray;
5
- [key: string]: any;
6
- };
7
2
  export type GeometryProps = {
8
3
  id?: string;
9
4
  /** Determines how vertices are read from the 'vertex' attributes */
@@ -13,7 +8,7 @@ export type GeometryProps = {
13
8
  attributes?: Record<string, GeometryAttribute | TypedArray>;
14
9
  indices?: GeometryAttribute | TypedArray;
15
10
  };
16
- type GeometryAttributes = {
11
+ export type GeometryAttributes = {
17
12
  POSITION: GeometryAttribute;
18
13
  NORMAL: GeometryAttribute;
19
14
  TEXCOORD_0: GeometryAttribute;
@@ -23,6 +18,11 @@ type GeometryAttributes = {
23
18
  value: Uint32Array | Uint16Array;
24
19
  };
25
20
  };
21
+ export type GeometryAttribute = {
22
+ size?: number;
23
+ value: TypedArray;
24
+ [key: string]: any;
25
+ };
26
26
  export declare class Geometry {
27
27
  readonly id: string;
28
28
  /** Determines how vertices are read from the 'vertex' attributes */
@@ -44,5 +44,4 @@ export declare class Geometry {
44
44
  _setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this;
45
45
  _calculateVertexCount(attributes: any, indices: any): number;
46
46
  }
47
- export {};
48
47
  //# sourceMappingURL=geometry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAGjE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,U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AAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,UAAU,CAAC;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB,CAAC;AAEF,qBAAa,QAAQ;IACnB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IAC7C,QAAQ,CAAC,UAAU,EAAE;QACnB,QAAQ,EAAE,iBAAiB,CAAC;QAC5B,MAAM,EAAE,iBAAiB,CAAC;QAC1B,UAAU,EAAE,iBAAiB,CAAC;QAC9B,OAAO,CAAC,EAAE,iBAAiB,CAAC;QAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAAC;KAC9C,CAAC;IAEF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;gBAE3B,KAAK,EAAE,aAAa;IAiDhC,cAAc,IAAI,MAAM;IAKxB,aAAa,IAAI,kBAAkB;IAOnC,MAAM,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM;IASrC,cAAc,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAAE,OAAO,EAAE,GAAG,GAAG,IAAI;IAIjF,qBAAqB,CAAC,UAAU,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,GAAG,MAAM;CAgB7D"}
@@ -1 +1 @@
1
- {"version":3,"file":"geometry.js","names":["uid","assert","Geometry","constructor","props","_defineProperty","attributes","indices","vertexCount","id","topology","ArrayBuffer","isView","value","size","attributeName","attributeValue","Object","entries","attribute","concat","_print","isIndexed","undefined","assign","_calculateVertexCount","getVertexCount","getAttributes","_setAttributes","length","Infinity","constant","Math","min","Number","isFinite"],"sources":["../../src/geometry/geometry.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {PrimitiveTopology, TypedArray} from '@luma.gl/core';\nimport {uid, assert} from '@luma.gl/core';\n\nexport type GeometryAttribute = {\n size?: number;\n value: TypedArray;\n [key: string]: any;\n};\n\nexport type GeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount?: number;\n attributes?: Record<string, GeometryAttribute | TypedArray>;\n indices?: GeometryAttribute | TypedArray;\n};\n\ntype GeometryAttributes = {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n indices?: {size?: number; value: Uint32Array | Uint16Array};\n};\n\nexport class Geometry {\n readonly id: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly vertexCount: number;\n readonly indices?: Uint16Array | Uint32Array;\n readonly attributes: {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n [key: string]: GeometryAttribute | undefined;\n };\n\n userData: Record<string, unknown> = {};\n\n constructor(props: GeometryProps) {\n const {attributes = {}, indices = null, vertexCount = null} = props;\n\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n\n if (indices) {\n // @ts-expect-error\n this.indices = ArrayBuffer.isView(indices) ? {value: indices, size: 1} : indices;\n }\n\n // @ts-expect-error\n this.attributes = {};\n\n for (const [attributeName, attributeValue] of Object.entries(attributes)) {\n // Wrap \"unwrapped\" arrays and try to autodetect their type\n const attribute: GeometryAttribute = ArrayBuffer.isView(attributeValue)\n ? {value: attributeValue}\n : attributeValue;\n\n assert(\n ArrayBuffer.isView(attribute.value),\n `${this._print(attributeName)}: must be typed array or object with value as typed array`\n );\n\n if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {\n attribute.size = 3;\n }\n\n // Move indices to separate field\n if (attributeName === 'indices') {\n assert(!this.indices);\n // @ts-expect-error\n this.indices = attribute;\n } else {\n this.attributes[attributeName] = attribute;\n }\n }\n\n // @ts-expect-error\n if (this.indices && this.indices.isIndexed !== undefined) {\n this.indices = Object.assign({}, this.indices);\n // @ts-expect-error\n delete this.indices.isIndexed;\n }\n\n this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n // Return an object with all attributes plus indices added as a field.\n getAttributes(): GeometryAttributes {\n // @ts-expect-error Geometry types are a mess\n return this.indices ? {indices: this.indices, ...this.attributes} : this.attributes;\n }\n\n // PRIVATE\n\n _print(attributeName: string): string {\n return `Geometry ${this.id} attribute ${attributeName}`;\n }\n\n // GeometryAttribute\n // value: typed array\n // type: indices, vertices, uvs\n // size: elements per vertex\n // target: WebGL buffer type (string or constant)\n _setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this {\n return this;\n }\n\n _calculateVertexCount(attributes: any, indices: any): number {\n if (indices) {\n return indices.value.length;\n }\n let vertexCount = Infinity;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {value, size, constant} = attribute;\n if (!constant && value && size >= 1) {\n vertexCount = Math.min(vertexCount, value.length / size);\n }\n }\n\n assert(Number.isFinite(vertexCount));\n return vertexCount;\n }\n}\n"],"mappings":";AAEA,SAAQA,GAAG,EAAEC,MAAM,QAAO,eAAe;AAiCzC,OAAO,MAAMC,QAAQ,CAAC;EAgBpBC,WAAWA,CAACC,KAAoB,EAAE;IAAAC,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA,mBAFE,CAAC,CAAC;IAGpC,MAAM;MAACC,UAAU,GAAG,CAAC,CAAC;MAAEC,OAAO,GAA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AC,CAAC;IACpC,OAAOA,WAAW;EACpB;AACF"}
1
+ {"version":3,"file":"geometry.js","names":["uid","assert","Geometry","constructor","props","_defineProperty","attributes","indices","vertexCount","id","topology","ArrayBuffer","isView","value","size","attributeName","attributeValue","Object","entries","attribute","concat","_print","isIndexed","undefined","assign","_calculateVertexCount","getVertexCount","getAttributes","_setAttributes","length","Infinity","constant","Math","min","Number","isFinite"],"sources":["../../src/geometry/geometry.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {PrimitiveTopology, TypedArray} from '@luma.gl/core';\nimport {uid, assert} from '@luma.gl/core';\n\nexport type GeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount?: number;\n attributes?: Record<string, GeometryAttribute | TypedArray>;\n indices?: GeometryAttribute | TypedArray;\n};\n\nexport type GeometryAttributes = {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n indices?: {size?: number; value: Uint32Array | Uint16Array};\n};\n\nexport type GeometryAttribute = {\n size?: number;\n value: TypedArray;\n [key: string]: any;\n};\n\nexport class Geometry {\n readonly id: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly vertexCount: number;\n readonly indices?: Uint16Array | Uint32Array;\n readonly attributes: {\n POSITION: GeometryAttribute;\n NORMAL: GeometryAttribute;\n TEXCOORD_0: GeometryAttribute;\n COLOR_0?: GeometryAttribute;\n [key: string]: GeometryAttribute | undefined;\n };\n\n userData: Record<string, unknown> = {};\n\n constructor(props: GeometryProps) {\n const {attributes = {}, indices = null, vertexCount = null} = props;\n\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n\n if (indices) {\n // @ts-expect-error\n this.indices = ArrayBuffer.isView(indices) ? {value: indices, size: 1} : indices;\n }\n\n // @ts-expect-error\n this.attributes = {};\n\n for (const [attributeName, attributeValue] of Object.entries(attributes)) {\n // Wrap \"unwrapped\" arrays and try to autodetect their type\n const attribute: GeometryAttribute = ArrayBuffer.isView(attributeValue)\n ? {value: attributeValue}\n : attributeValue;\n\n assert(\n ArrayBuffer.isView(attribute.value),\n `${this._print(attributeName)}: must be typed array or object with value as typed array`\n );\n\n if ((attributeName === 'POSITION' || attributeName === 'positions') && !attribute.size) {\n attribute.size = 3;\n }\n\n // Move indices to separate field\n if (attributeName === 'indices') {\n assert(!this.indices);\n // @ts-expect-error\n this.indices = attribute;\n } else {\n this.attributes[attributeName] = attribute;\n }\n }\n\n // @ts-expect-error\n if (this.indices && this.indices.isIndexed !== undefined) {\n this.indices = Object.assign({}, this.indices);\n // @ts-expect-error\n delete this.indices.isIndexed;\n }\n\n this.vertexCount = vertexCount || this._calculateVertexCount(this.attributes, this.indices);\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n // Return an object with all attributes plus indices added as a field.\n getAttributes(): GeometryAttributes {\n // @ts-expect-error Geometry types are a mess\n return this.indices ? {indices: this.indices, ...this.attributes} : this.attributes;\n }\n\n // PRIVATE\n\n _print(attributeName: string): string {\n return `Geometry ${this.id} attribute ${attributeName}`;\n }\n\n // GeometryAttribute\n // value: typed array\n // type: indices, vertices, uvs\n // size: elements per vertex\n // target: WebGL buffer type (string or constant)\n _setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this {\n return this;\n }\n\n _calculateVertexCount(attributes: any, indices: any): number {\n if (indices) {\n return indices.value.length;\n }\n let vertexCount = Infinity;\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {value, size, constant} = attribute;\n if (!constant && value && size >= 1) {\n vertexCount = Math.min(vertexCount, value.length / size);\n }\n }\n\n assert(Number.isFinite(vertexCount));\n return vertexCount;\n }\n}\n"],"mappings":";AAEA,SAAQA,GAAG,EAAEC,MAAM,Q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S;MACzC,IAAI,CAACY,QAAQ,IAAIlB,KAAK,IAAIC,IAAI,IAAI,CAAC,EAAE;QACnCN,WAAW,GAAGwB,IAAI,CAACC,GAAG,CAACzB,WAAW,EAAEK,KAAK,CAACgB,MAAM,GAAGf,IAAI,CAAC;MAC1D;IACF;IAEAb,MAAM,CAACiC,MAAM,CAACC,QAAQ,CAAC3B,WAAW,CAAC,CAAC;IACpC,OAAOA,WAAW;EACpB;AACF"}
@@ -0,0 +1,45 @@
1
+ import type { PrimitiveTopology, BufferLayout } from '@luma.gl/core';
2
+ import { Device, Buffer } from '@luma.gl/core';
3
+ import type { Geometry } from '../geometry/geometry';
4
+ export type GPUGeometryProps = {
5
+ id?: string;
6
+ /** Determines how vertices are read from the 'vertex' attributes */
7
+ topology: 'point-list' | 'line-list' | 'line-strip' | 'line-loop-webgl' | 'triangle-list' | 'triangle-strip' | 'triangle-fan-webgl';
8
+ /** Auto calculated from attributes if not provided */
9
+ vertexCount?: number;
10
+ bufferLayout?: BufferLayout[];
11
+ indices?: Buffer | null;
12
+ attributes: GPUGeometryAttributes;
13
+ };
14
+ export type GPUGeometryAttributes = {
15
+ positions: Buffer;
16
+ normals: Buffer;
17
+ texCoords: Buffer;
18
+ colors?: Buffer;
19
+ };
20
+ export declare class GPUGeometry {
21
+ readonly id: string;
22
+ userData: Record<string, unknown>;
23
+ /** Determines how vertices are read from the 'vertex' attributes */
24
+ readonly topology?: PrimitiveTopology;
25
+ readonly bufferLayout: BufferLayout[];
26
+ readonly vertexCount: number;
27
+ readonly indices?: Buffer | null;
28
+ readonly attributes: {
29
+ positions: Buffer;
30
+ normals: Buffer;
31
+ texCoords: Buffer;
32
+ colors?: Buffer;
33
+ };
34
+ constructor(props: GPUGeometryProps);
35
+ destroy(): void;
36
+ getVertexCount(): number;
37
+ getAttributes(): GPUGeometryAttributes;
38
+ getIndexes(): Buffer | null;
39
+ _calculateVertexCount(positions: Buffer): number;
40
+ }
41
+ export declare function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry;
42
+ export declare function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined;
43
+ export declare function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry): GPUGeometryAttributes;
44
+ export declare function mapAttributeName(name: string): string;
45
+ //# sourceMappingURL=gpu-geometry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpu-geometry.d.ts","sourceRoot":"","sources":["../../src/geometry/gpu-geometry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,iBAAiB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,MAAM,EAAE,MAAM,EAAc,MAAM,eAAe,CAAC;AAC1D,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,sBAAsB,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,oEAAoE;IACpE,QAAQ,EACJ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,eAAe,GACf,gBAAgB,GAChB,oBAAoB,CAAC;IACzB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,qBAAqB,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,qBAAa,WAAW;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAEvC,oEAAoE;IACpE,QAAQ,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,YAAY,EAAE,CAAM;IAE3C,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,UAAU,EAAE;QACnB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;gBAEU,KAAK,EAAE,gBAAgB;IA6BnC,OAAO,IAAI,IAAI;IAQf,cAAc,IAAI,MAAM;IAIxB,aAAa,IAAI,qBAAqB;IAItC,UAAU,IAAI,MAAM,GAAG,IAAI;IAI3B,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAKjD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,WAAW,GAAG,WAAW,CAa7F;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,SAAS,CAYjG;AAED,wBAAgB,+BAA+B,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,qBAAqB,CAYzG;AAYD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD"}
@@ -0,0 +1,123 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import { Buffer, uid, assert } from '@luma.gl/core';
3
+ export class GPUGeometry {
4
+ constructor(props) {
5
+ _defineProperty(this, "id", void 0);
6
+ _defineProperty(this, "userData", {});
7
+ _defineProperty(this, "topology", void 0);
8
+ _defineProperty(this, "bufferLayout", []);
9
+ _defineProperty(this, "vertexCount", void 0);
10
+ _defineProperty(this, "indices", void 0);
11
+ _defineProperty(this, "attributes", void 0);
12
+ this.id = props.id || uid('geometry');
13
+ this.topology = props.topology;
14
+ this.indices = props.indices || null;
15
+ this.attributes = props.attributes;
16
+ this.vertexCount = props.vertexCount || this._calculateVertexCount(this.attributes.positions);
17
+ this.bufferLayout = props.bufferLayout || [];
18
+ if (!this.bufferLayout.find(layout => layout.name === 'positions')) {
19
+ this.bufferLayout.push({
20
+ name: 'positions',
21
+ format: 'float32x3'
22
+ });
23
+ }
24
+ if (!this.bufferLayout.find(layout => layout.name === 'normals')) {
25
+ this.bufferLayout.push({
26
+ name: 'normals',
27
+ format: 'float32x3'
28
+ });
29
+ }
30
+ if (!this.bufferLayout.find(layout => layout.name === 'texCoords')) {
31
+ this.bufferLayout.push({
32
+ name: 'texCoords',
33
+ format: 'float32x2'
34
+ });
35
+ }
36
+ if (!this.bufferLayout.find(layout => layout.name === 'colors')) {
37
+ this.bufferLayout.push({
38
+ name: 'colors',
39
+ format: 'float32x3'
40
+ });
41
+ }
42
+ if (this.indices) {
43
+ assert(this.indices.usage === Buffer.INDEX);
44
+ }
45
+ }
46
+ destroy() {
47
+ var _this$attributes$colo;
48
+ this.indices.destroy();
49
+ this.attributes.positions.destroy();
50
+ this.attributes.normals.destroy();
51
+ this.attributes.texCoords.destroy();
52
+ (_this$attributes$colo = this.attributes.colors) === null || _this$attributes$colo === void 0 ? void 0 : _this$attributes$colo.destroy();
53
+ }
54
+ getVertexCount() {
55
+ return this.vertexCount;
56
+ }
57
+ getAttributes() {
58
+ return this.attributes;
59
+ }
60
+ getIndexes() {
61
+ return this.indices;
62
+ }
63
+ _calculateVertexCount(positions) {
64
+ const vertexCount = positions.byteLength / 12;
65
+ return vertexCount;
66
+ }
67
+ }
68
+ export function makeGPUGeometry(device, geometry) {
69
+ if (geometry instanceof GPUGeometry) {
70
+ return geometry;
71
+ }
72
+ const indices = getIndexBufferFromGeometry(device, geometry);
73
+ const attributes = getAttributeBuffersFromGeometry(device, geometry);
74
+ return new GPUGeometry({
75
+ topology: geometry.topology,
76
+ vertexCount: geometry.vertexCount,
77
+ indices,
78
+ attributes
79
+ });
80
+ }
81
+ export function getIndexBufferFromGeometry(device, geometry) {
82
+ if (!geometry.indices) {
83
+ return undefined;
84
+ }
85
+ const data = geometry.indices.value || geometry.indices;
86
+ assert(data instanceof Uint16Array || data instanceof Uint32Array, 'attribute array for "indices" must be of integer type');
87
+ return device.createBuffer({
88
+ usage: Buffer.INDEX,
89
+ data
90
+ });
91
+ }
92
+ export function getAttributeBuffersFromGeometry(device, geometry) {
93
+ const positions = geometry.attributes.positions || geometry.attributes.POSITION;
94
+ const normals = geometry.attributes.normals || geometry.attributes.NORMAL;
95
+ const texCoords = geometry.attributes.texCoords || geometry.attributes.TEXCOORD_0;
96
+ const buffers = {
97
+ positions: device.createBuffer({
98
+ data: positions.value,
99
+ id: 'positions-buffer'
100
+ }),
101
+ normals: device.createBuffer({
102
+ data: normals.value,
103
+ id: 'normals-buffer'
104
+ }),
105
+ texCoords: device.createBuffer({
106
+ data: texCoords.value,
107
+ id: 'texCoords-buffer'
108
+ })
109
+ };
110
+ return buffers;
111
+ }
112
+ const GLTF_TO_LUMA_ATTRIBUTE_MAP = {
113
+ POSITION: 'positions',
114
+ NORMAL: 'normals',
115
+ COLOR_0: 'colors',
116
+ TEXCOORD_0: 'texCoords',
117
+ TEXCOORD_1: 'texCoords1',
118
+ TEXCOORD_2: 'texCoords2'
119
+ };
120
+ export function mapAttributeName(name) {
121
+ return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;
122
+ }
123
+ //# sourceMappingURL=gpu-geometry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpu-geometry.js","names":["Buffer","uid","assert","GPUGeometry","constructor","props","_defineProperty","id","topology","indices","attributes","vertexCount","_calculateVertexCount","positions","bufferLayout","find","layout","name","push","format","usage","INDEX","destroy","_this$attributes$colo","normals","texCoords","colors","getVertexCount","getAttributes","getIndexes","byteLength","makeGPUGeometry","device","geometry","getIndexBufferFromGeometry","getAttributeBuffersFromGeometry","undefined","data","value","Uint16Array","Uint32Array","createBuffer","POSITION","NORMAL","TEXCOORD_0","buffers","GLTF_TO_LUMA_ATTRIBUTE_MAP","COLOR_0","TEXCOORD_1","TEXCOORD_2","mapAttributeName"],"sources":["../../src/geometry/gpu-geometry.ts"],"sourcesContent":["import type {PrimitiveTopology, BufferLayout} from '@luma.gl/core';\nimport {Device, Buffer, uid, assert} from '@luma.gl/core';\nimport type {Geometry} from '../geometry/geometry';\n\nexport type GPUGeometryProps = {\n id?: string;\n /** Determines how vertices are read from the 'vertex' attributes */\n topology:\n | 'point-list'\n | 'line-list'\n | 'line-strip'\n | 'line-loop-webgl'\n | 'triangle-list'\n | 'triangle-strip'\n | 'triangle-fan-webgl';\n /** Auto calculated from attributes if not provided */\n vertexCount?: number;\n bufferLayout?: BufferLayout[];\n indices?: Buffer | null;\n attributes: GPUGeometryAttributes;\n};\n\nexport type GPUGeometryAttributes = {\n positions: Buffer;\n normals: Buffer;\n texCoords: Buffer;\n colors?: Buffer;\n};\n\nexport class GPUGeometry {\n readonly id: string;\n userData: Record<string, unknown> = {};\n\n /** Determines how vertices are read from the 'vertex' attributes */\n readonly topology?: PrimitiveTopology;\n readonly bufferLayout: BufferLayout[] = [];\n\n readonly vertexCount: number;\n readonly indices?: Buffer | null;\n readonly attributes: {\n positions: Buffer;\n normals: Buffer;\n texCoords: Buffer;\n colors?: Buffer;\n };\n\n constructor(props: GPUGeometryProps) {\n this.id = props.id || uid('geometry');\n this.topology = props.topology;\n this.indices = props.indices || null;\n this.attributes = props.attributes;\n\n // \n this.vertexCount = props.vertexCount || this._calculateVertexCount(this.attributes.positions);\n\n // Populate default bufferLayout\n this.bufferLayout = props.bufferLayout || [];\n if (!this.bufferLayout.find(layout => layout.name === 'positions')) {\n this.bufferLayout.push({name: 'positions', format: 'float32x3'});\n }\n if (!this.bufferLayout.find(layout => layout.name === 'normals')) {\n this.bufferLayout.push({name: 'normals', format: 'float32x3'});\n }\n if (!this.bufferLayout.find(layout => layout.name === 'texCoords')) {\n this.bufferLayout.push({name: 'texCoords', format: 'float32x2'});\n }\n if (!this.bufferLayout.find(layout => layout.name === 'colors')) {\n this.bufferLayout.push({name: 'colors', format: 'float32x3'});\n }\n\n if (this.indices) {\n assert(this.indices.usage === Buffer.INDEX);\n }\n }\n\n destroy(): void {\n this.indices.destroy();\n this.attributes.positions.destroy();\n this.attributes.normals.destroy();\n this.attributes.texCoords.destroy();\n this.attributes.colors?.destroy();\n }\n\n getVertexCount(): number {\n return this.vertexCount;\n }\n\n getAttributes(): GPUGeometryAttributes {\n return this.attributes;\n }\n\n getIndexes(): Buffer | null {\n return this.indices;\n }\n\n _calculateVertexCount(positions: Buffer): number {\n // Assume that positions is a fully packed float32x3 buffer\n const vertexCount = positions.byteLength / 12;\n return vertexCount;\n }\n}\n\nexport function makeGPUGeometry(device: Device, geometry: Geometry | GPUGeometry): GPUGeometry {\n if (geometry instanceof GPUGeometry) {\n return geometry;\n }\n\n const indices = getIndexBufferFromGeometry(device, geometry);\n const attributes = getAttributeBuffersFromGeometry(device, geometry);\n return new GPUGeometry({\n topology: geometry.topology, \n vertexCount: geometry.vertexCount, \n indices, \n attributes\n });\n}\n\nexport function getIndexBufferFromGeometry(device: Device, geometry: Geometry): Buffer | undefined {\n if (!geometry.indices) {\n return undefined;\n }\n\n // @ts-expect-error\n const data = geometry.indices.value || geometry.indices;\n assert(\n data instanceof Uint16Array || data instanceof Uint32Array,\n 'attribute array for \"indices\" must be of integer type'\n );\n return device.createBuffer({usage: Buffer.INDEX, data});\n}\n\nexport function getAttributeBuffersFromGeometry(device: Device, geometry: Geometry): GPUGeometryAttributes {\n const positions = geometry.attributes.positions || geometry.attributes.POSITION;\n const normals = geometry.attributes.normals || geometry.attributes.NORMAL;\n const texCoords = geometry.attributes.texCoords || geometry.attributes.TEXCOORD_0;\n\n const buffers: GPUGeometryAttributes = {\n positions: device.createBuffer({data: positions.value, id: 'positions-buffer'}),\n normals: device.createBuffer({data: normals.value, id: 'normals-buffer'}),\n texCoords: device.createBuffer({data: texCoords.value, id: 'texCoords-buffer'})\n };\n\n return buffers;\n}\n\n// Support for mapping new geometries with glTF attribute names to \"classic\" luma.gl shader names\nconst GLTF_TO_LUMA_ATTRIBUTE_MAP = {\n POSITION: 'positions',\n NORMAL: 'normals',\n COLOR_0: 'colors',\n TEXCOORD_0: 'texCoords',\n TEXCOORD_1: 'texCoords1',\n TEXCOORD_2: 'texCoords2'\n};\n\nexport function mapAttributeName(name: string): string {\n // @ts-ignore-error\n return GLTF_TO_LUMA_ATTRIBUTE_MAP[name] || name;\n}\n"],"mappings":";AACA,SAAgBA,MAAM,EAAEC,GAAG,EAAEC,MAAM,QAAO,eAAe;AA4BzD,OAAO,MAAMC,WAAW,CAAC;EAiBvBC,WAAWA,CAACC,KAAuB,EAAE;IAAAC,eAAA;IAAAA,eAAA,mBAfD,CAAC,CAAC;IAAAA,eAAA;IAAAA,eAAA,uBAIE,EAAE;IAAAA,eAAA;IAAAA,eAAA;IAAAA,eAAA;IAYxC,IAAI,CAACC,EAAE,GAAGF,KAAK,CAACE,EAAE,IAAIN,GAAG,CAAC,UAAU,CAAC;IACrC,IAAI,CAACO,QAAQ,GAAGH,KAAK,CAACG,QAAQ;IAC9B,IAAI,CAACC,OAAO,GAAGJ,KAAK,CAACI,OAAO,IAAI,IAAI;IACpC,IAAI,CAACC,UAAU,GAAGL,KAAK,CAACK,UAAU;IAGlC,IAAI,CAACC,WAAW,GAAGN,KAAK,CAACM,WAAW,IAAI,IAAI,CAACC,qBAAqB,CAAC,IAAI,CAACF,UAAU,CAACG,SAAS,CAAC;IAG7F,IAAI,CAACC,YAAY,GAAGT,KAAK,CAACS,YAAY,IAAI,EAAE;IAC5C,IAAI,CAAC,IAAI,CAACA,YAAY,CAACC,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,IAAI,KAAK,WAAW,CAAC,EAAE;MAClE,IAAI,CAACH,YAAY,CAACI,IAAI,CAAC;QAACD,IAAI,EAAE,WAAW;QAAEE,MA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pB,SAAS,GAAGoB,QAAQ,CAACvB,UAAU,CAACG,SAAS,IAAIoB,QAAQ,CAACvB,UAAU,CAACgC,QAAQ;EAC/E,MAAMlB,OAAO,GAAGS,QAAQ,CAACvB,UAAU,CAACc,OAAO,IAAIS,QAAQ,CAACvB,UAAU,CAACiC,MAAM;EACzE,MAAMlB,SAAS,GAAGQ,QAAQ,CAACvB,UAAU,CAACe,SAAS,IAAIQ,QAAQ,CAACvB,UAAU,CAACkC,UAAU;EAEjF,MAAMC,OAA8B,GAAG;IACrChC,SAAS,EAAEmB,MAAM,CAACS,YAAY,CAAC;MAACJ,IAAI,EAAExB,SAAS,CAACyB,KAAK;MAAE/B,EAAE,EAAE;IAAkB,CAAC,CAAC;IAC/EiB,OAAO,EAAEQ,MAAM,CAACS,YAAY,CAAC;MAACJ,IAAI,EAAEb,OAAO,CAACc,KAAK;MAAE/B,EAAE,EAAE;IAAgB,CAAC,CAAC;IACzEkB,SAAS,EAAEO,MAAM,CAACS,YAAY,CAAC;MAACJ,IAAI,EAAEZ,SAAS,CAACa,KAAK;MAAE/B,EAAE,EAAE;IAAkB,CAAC;EAChF,CAAC;EAED,OAAOsC,OAAO;AAChB;AAGA,MAAMC,0BAA0B,GAAG;EACjCJ,QAAQ,EAAE,WAAW;EACrBC,MAAM,EAAE,SAAS;EACjBI,OAAO,EAAE,QAAQ;EACjBH,UAAU,EAAE,WAAW;EACvBI,UAAU,EAAE,YAAY;EACxBC,UAAU,EAAE;AACd,CAAC;AAED,OAAO,SAASC,gBAAgBA,CAACjC,IAAY,EAAU;EAErD,OAAO6B,0BAA0B,CAAC7B,IAAI,CAAC,IAAIA,IAAI;AACjD"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=gpu-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpu-table.d.ts","sourceRoot":"","sources":["../../src/geometry/gpu-table.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=gpu-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gpu-table.js","names":[],"sources":["../../src/geometry/gpu-table.ts"],"sourcesContent":["/*\nexport function getAttributeLayoutsFromGeometry(geometry: Geometry) {\n const layouts: Record<string, {}> = {};\n let indices = geometry.indices;\n\n for (const [name, attribute] of Object.entries(geometry.attributes)) {\n const remappedName = mapAttributeName(name);\n\n if (attribute.constant) {\n throw new Error('constant attributes not supported');\n } else {\n const typedArray = attribute.value;\n // Create accessor by copying the attribute and removing `value``\n const accessor = {...attribute};\n delete accessor.value;\n buffers[remappedName] = [device.createBuffer(typedArray), accessor];\n\n inferAttributeAccessor(name, accessor);\n }\n }\n}\n\nexport class Table {\n length: number;\n // columns: Record<string, TypedArray> = {};\n}\n\nexport class GPUTable {\n length: number;\n columns: Record<string, Buffer> = {};\n}\n\nexport function convertTableToGPUTable(table: Table) {\n // for (const ) {}\n}\n\nexport function renameTableColumns(table: Table, map: (name: string) => string) {\n const newColumns = table.columns.reduce()\n table.clone();\n}\n*/\n"],"mappings":""}