@luma.gl/engine 9.0.0-alpha.5 → 9.0.0-alpha.51

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 (171) hide show
  1. package/LICENSE +3 -1
  2. package/dist/animation/key-frames.d.ts +1 -1
  3. package/dist/animation/key-frames.d.ts.map +1 -1
  4. package/dist/animation/key-frames.js +6 -27
  5. package/dist/animation/key-frames.js.map +1 -1
  6. package/dist/animation/timeline.d.ts +9 -9
  7. package/dist/animation/timeline.d.ts.map +1 -1
  8. package/dist/animation/timeline.js +18 -49
  9. package/dist/animation/timeline.js.map +1 -1
  10. package/dist/{lib → animation-loop}/animation-loop.d.ts +30 -31
  11. package/dist/animation-loop/animation-loop.d.ts.map +1 -0
  12. package/dist/{lib → animation-loop}/animation-loop.js +115 -199
  13. package/dist/animation-loop/animation-loop.js.map +1 -0
  14. package/dist/{lib → animation-loop}/animation-props.d.ts +6 -7
  15. package/dist/animation-loop/animation-props.d.ts.map +1 -0
  16. package/dist/animation-loop/animation-props.js.map +1 -0
  17. package/dist/animation-loop/make-animation-loop.d.ts +6 -0
  18. package/dist/animation-loop/make-animation-loop.d.ts.map +1 -0
  19. package/dist/animation-loop/make-animation-loop.js +28 -0
  20. package/dist/animation-loop/make-animation-loop.js.map +1 -0
  21. package/dist/animation-loop/render-loop.d.ts +23 -0
  22. package/dist/animation-loop/render-loop.d.ts.map +1 -0
  23. package/dist/animation-loop/render-loop.js +7 -0
  24. package/dist/animation-loop/render-loop.js.map +1 -0
  25. package/dist/dist.dev.js +7064 -0
  26. package/dist/geometries/cone-geometry.d.ts +1 -1
  27. package/dist/geometries/cone-geometry.d.ts.map +1 -1
  28. package/dist/geometries/cone-geometry.js +6 -5
  29. package/dist/geometries/cone-geometry.js.map +1 -1
  30. package/dist/geometries/cube-geometry.d.ts +2 -2
  31. package/dist/geometries/cube-geometry.d.ts.map +1 -1
  32. package/dist/geometries/cube-geometry.js +15 -8
  33. package/dist/geometries/cube-geometry.js.map +1 -1
  34. package/dist/geometries/cylinder-geometry.d.ts +1 -1
  35. package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
  36. package/dist/geometries/cylinder-geometry.js +6 -5
  37. package/dist/geometries/cylinder-geometry.js.map +1 -1
  38. package/dist/geometries/ico-sphere-geometry.d.ts +2 -2
  39. package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
  40. package/dist/geometries/ico-sphere-geometry.js +10 -19
  41. package/dist/geometries/ico-sphere-geometry.js.map +1 -1
  42. package/dist/geometries/plane-geometry.d.ts +2 -2
  43. package/dist/geometries/plane-geometry.d.ts.map +1 -1
  44. package/dist/geometries/plane-geometry.js +14 -23
  45. package/dist/geometries/plane-geometry.js.map +1 -1
  46. package/dist/geometries/sphere-geometry.d.ts +2 -2
  47. package/dist/geometries/sphere-geometry.d.ts.map +1 -1
  48. package/dist/geometries/sphere-geometry.js +9 -13
  49. package/dist/geometries/sphere-geometry.js.map +1 -1
  50. package/dist/geometries/truncated-cone-geometry.d.ts +2 -4
  51. package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
  52. package/dist/geometries/truncated-cone-geometry.js +9 -25
  53. package/dist/geometries/truncated-cone-geometry.js.map +1 -1
  54. package/dist/geometry/geometry-table.d.ts +2 -2
  55. package/dist/geometry/geometry-table.d.ts.map +1 -1
  56. package/dist/geometry/geometry-table.js.map +1 -1
  57. package/dist/geometry/geometry-utils.d.ts.map +1 -1
  58. package/dist/geometry/geometry-utils.js +0 -9
  59. package/dist/geometry/geometry-utils.js.map +1 -1
  60. package/dist/geometry/geometry.d.ts +50 -59
  61. package/dist/geometry/geometry.d.ts.map +1 -1
  62. package/dist/geometry/geometry.js +32 -97
  63. package/dist/geometry/geometry.js.map +1 -1
  64. package/dist/geometry/gpu-geometry.d.ts +37 -0
  65. package/dist/geometry/gpu-geometry.d.ts.map +1 -0
  66. package/dist/geometry/gpu-geometry.js +107 -0
  67. package/dist/geometry/gpu-geometry.js.map +1 -0
  68. package/dist/geometry/gpu-table.d.ts +1 -0
  69. package/dist/geometry/gpu-table.d.ts.map +1 -0
  70. package/dist/geometry/gpu-table.js +2 -0
  71. package/dist/geometry/gpu-table.js.map +1 -0
  72. package/dist/index.cjs +2959 -0
  73. package/dist/index.d.ts +26 -9
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +23 -13
  76. package/dist/index.js.map +1 -1
  77. package/dist/lib/clip-space.d.ts +8 -0
  78. package/dist/lib/clip-space.d.ts.map +1 -1
  79. package/dist/lib/clip-space.js +47 -0
  80. package/dist/lib/clip-space.js.map +1 -1
  81. package/dist/lib/pipeline-factory.d.ts +12 -40
  82. package/dist/lib/pipeline-factory.d.ts.map +1 -1
  83. package/dist/lib/pipeline-factory.js +50 -148
  84. package/dist/lib/pipeline-factory.js.map +1 -1
  85. package/dist/model/model.d.ts +192 -0
  86. package/dist/model/model.d.ts.map +1 -0
  87. package/dist/model/model.js +312 -0
  88. package/dist/model/model.js.map +1 -0
  89. package/dist/scenegraph/group-node.d.ts +21 -0
  90. package/dist/scenegraph/group-node.d.ts.map +1 -0
  91. package/dist/scenegraph/group-node.js +94 -0
  92. package/dist/scenegraph/group-node.js.map +1 -0
  93. package/dist/scenegraph/model-node.d.ts +18 -0
  94. package/dist/scenegraph/model-node.d.ts.map +1 -0
  95. package/dist/scenegraph/model-node.js +28 -0
  96. package/dist/scenegraph/model-node.js.map +1 -0
  97. package/dist/scenegraph/scenegraph-node.d.ts +56 -0
  98. package/dist/scenegraph/scenegraph-node.d.ts.map +1 -0
  99. package/dist/scenegraph/scenegraph-node.js +141 -0
  100. package/dist/scenegraph/scenegraph-node.js.map +1 -0
  101. package/dist/shader-inputs.d.ts +62 -0
  102. package/dist/shader-inputs.d.ts.map +1 -0
  103. package/dist/shader-inputs.js +49 -0
  104. package/dist/shader-inputs.js.map +1 -0
  105. package/dist/transform/buffer-transform.d.ts +35 -0
  106. package/dist/transform/buffer-transform.d.ts.map +1 -0
  107. package/dist/transform/buffer-transform.js +62 -0
  108. package/dist/transform/buffer-transform.js.map +1 -0
  109. package/dist/transform/texture-transform.d.ts +57 -0
  110. package/dist/transform/texture-transform.d.ts.map +1 -0
  111. package/dist/transform/texture-transform.js +122 -0
  112. package/dist/transform/texture-transform.js.map +1 -0
  113. package/dist.min.js +286 -0
  114. package/package.json +21 -12
  115. package/src/animation/timeline.ts +16 -15
  116. package/src/{lib → animation-loop}/animation-loop.ts +120 -107
  117. package/src/{lib → animation-loop}/animation-props.ts +5 -5
  118. package/src/animation-loop/make-animation-loop.ts +44 -0
  119. package/src/animation-loop/render-loop.ts +23 -0
  120. package/src/geometries/cone-geometry.ts +1 -1
  121. package/src/geometries/cube-geometry.ts +6 -3
  122. package/src/geometries/cylinder-geometry.ts +2 -2
  123. package/src/geometries/ico-sphere-geometry.ts +7 -6
  124. package/src/geometries/plane-geometry.ts +5 -4
  125. package/src/geometries/sphere-geometry.ts +4 -3
  126. package/src/geometries/truncated-cone-geometry.ts +4 -13
  127. package/src/geometry/geometry-table.ts +1 -1
  128. package/src/geometry/geometry-utils.ts +3 -3
  129. package/src/geometry/geometry.ts +79 -119
  130. package/src/geometry/gpu-geometry.ts +124 -0
  131. package/src/geometry/gpu-table.ts +41 -0
  132. package/src/index.ts +38 -12
  133. package/src/lib/clip-space.ts +22 -21
  134. package/src/lib/pipeline-factory.ts +60 -168
  135. package/src/model/model.ts +549 -0
  136. package/src/scenegraph/group-node.ts +103 -0
  137. package/src/scenegraph/model-node.ts +50 -0
  138. package/src/scenegraph/scenegraph-node.ts +204 -0
  139. package/src/shader-inputs.ts +132 -0
  140. package/src/transform/buffer-transform.ts +94 -0
  141. package/src/transform/texture-transform.ts +169 -0
  142. package/dist/bundle.d.ts +0 -2
  143. package/dist/bundle.d.ts.map +0 -1
  144. package/dist/bundle.js +0 -5
  145. package/dist/bundle.js.map +0 -1
  146. package/dist/geometry/primitive-utils.d.ts +0 -1
  147. package/dist/geometry/primitive-utils.d.ts.map +0 -1
  148. package/dist/geometry/primitive-utils.js +0 -2
  149. package/dist/geometry/primitive-utils.js.map +0 -1
  150. package/dist/lib/animation-loop.d.ts.map +0 -1
  151. package/dist/lib/animation-loop.js.map +0 -1
  152. package/dist/lib/animation-props.d.ts.map +0 -1
  153. package/dist/lib/animation-props.js.map +0 -1
  154. package/dist/lib/model-utils.d.ts +0 -5
  155. package/dist/lib/model-utils.d.ts.map +0 -1
  156. package/dist/lib/model-utils.js +0 -45
  157. package/dist/lib/model-utils.js.map +0 -1
  158. package/dist/lib/model.d.ts +0 -41
  159. package/dist/lib/model.d.ts.map +0 -1
  160. package/dist/lib/model.js +0 -176
  161. package/dist/lib/model.js.map +0 -1
  162. package/dist/lib/render-loop.d.ts +0 -14
  163. package/dist/lib/render-loop.d.ts.map +0 -1
  164. package/dist/lib/render-loop.js +0 -49
  165. package/dist/lib/render-loop.js.map +0 -1
  166. package/src/bundle.ts +0 -4
  167. package/src/geometry/primitive-utils.ts +0 -30
  168. package/src/lib/model-utils.ts +0 -124
  169. package/src/lib/model.ts +0 -179
  170. package/src/lib/render-loop.ts +0 -58
  171. /package/dist/{lib → animation-loop}/animation-props.js +0 -0
@@ -1,7 +1,8 @@
1
- import { uid } from '@luma.gl/api';
2
- import Geometry from '../geometry/geometry';
1
+ import { uid } from '@luma.gl/core';
2
+ import { Geometry } from "../geometry/geometry.js";
3
3
  export class SphereGeometry extends Geometry {
4
- constructor(props = {}) {
4
+ constructor() {
5
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5
6
  const {
6
7
  id = uid('sphere-geometry')
7
8
  } = props;
@@ -9,17 +10,18 @@ export class SphereGeometry extends Geometry {
9
10
  indices,
10
11
  attributes
11
12
  } = tesselateSphere(props);
12
- super({ ...props,
13
+ super({
14
+ ...props,
13
15
  id,
16
+ topology: 'triangle-list',
14
17
  indices,
15
- attributes: { ...attributes,
18
+ attributes: {
19
+ ...attributes,
16
20
  ...props.attributes
17
21
  }
18
22
  });
19
23
  }
20
-
21
24
  }
22
-
23
25
  function tesselateSphere(props) {
24
26
  const {
25
27
  nlat = 10,
@@ -32,15 +34,12 @@ function tesselateSphere(props) {
32
34
  const endLong = 2 * Math.PI;
33
35
  const longRange = endLong - startLong;
34
36
  const numVertices = (nlat + 1) * (nlong + 1);
35
-
36
37
  const radius = (n1, n2, n3, u, v) => props.radius || 1;
37
-
38
38
  const positions = new Float32Array(numVertices * 3);
39
39
  const normals = new Float32Array(numVertices * 3);
40
40
  const texCoords = new Float32Array(numVertices * 2);
41
41
  const IndexType = numVertices > 0xffff ? Uint32Array : Uint16Array;
42
42
  const indices = new IndexType(nlat * nlong * 6);
43
-
44
43
  for (let y = 0; y <= nlat; y++) {
45
44
  for (let x = 0; x <= nlong; x++) {
46
45
  const u = x / nlong;
@@ -68,9 +67,7 @@ function tesselateSphere(props) {
68
67
  texCoords[i2 + 1] = 1 - v;
69
68
  }
70
69
  }
71
-
72
70
  const numVertsAround = nlong + 1;
73
-
74
71
  for (let x = 0; x < nlong; x++) {
75
72
  for (let y = 0; y < nlat; y++) {
76
73
  const index = (x * nlat + y) * 6;
@@ -82,7 +79,6 @@ function tesselateSphere(props) {
82
79
  indices[index + 5] = (y + 1) * numVertsAround + x + 1;
83
80
  }
84
81
  }
85
-
86
82
  return {
87
83
  indices: {
88
84
  size: 1,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/geometries/sphere-geometry.ts"],"names":["uid","Geometry","SphereGeometry","constructor","props","id","indices","attributes","tesselateSphere","nlat","nlong","startLat","endLat","Math","PI","latRange","startLong","endLong","longRange","numVertices","radius","n1","n2","n3","u","v","positions","Float32Array","normals","texCoords","IndexType","Uint32Array","Uint16Array","y","x","index","i2","i3","theta","phi","sinTheta","sin","cosTheta","cos","sinPhi","cosPhi","ux","uy","uz","r","numVertsAround","size","value","POSITION","NORMAL","TEXCOORD_0"],"mappings":"AAAA,SAAQA,GAAR,QAAkB,cAAlB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAaA,OAAO,MAAMC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UiB,cAAV,GAA2BhB,CAAhD;AAEA5B,MAAAA,OAAO,CAAC6B,KAAK,GAAG,CAAT,CAAP,GAAqB,CAACF,CAAC,GAAG,CAAL,IAAUiB,cAAV,GAA2BhB,CAAhD;AACA5B,MAAAA,OAAO,CAAC6B,KAAK,GAAG,CAAT,CAAP,GAAqBF,CAAC,GAAGiB,cAAJ,GAAqBhB,CAArB,GAAyB,CAA9C;AACA5B,MAAAA,OAAO,CAAC6B,KAAK,GAAG,CAAT,CAAP,GAAqB,CAACF,CAAC,GAAG,CAAL,IAAUiB,cAAV,GAA2BhB,CAA3B,GAA+B,CAApD;AACD;AACF;;AAED,SAAO;AACL5B,IAAAA,OAAO,EAAE;AAAC6C,MAAAA,IAAI,EAAE,CAAP;AAAUC,MAAAA,KAAK,EAAE9C;AAAjB,KADJ;AAELC,IAAAA,UAAU,EAAE;AACV8C,MAAAA,QAAQ,EAAE;AAACF,QAAAA,IAAI,EAAE,CAAP;AAAUC,QAAAA,KAAK,EAAE1B;AAAjB,OADA;AAEV4B,MAAAA,MAAM,EAAE;AAACH,QAAAA,IAAI,EAAE,CAAP;AAAUC,QAAAA,KAAK,EAAExB;AAAjB,OAFE;AAGV2B,MAAAA,UAAU,EAAE;AAACJ,QAAAA,IAAI,EAAE,CAAP;AAAUC,QAAAA,KAAK,EAAEvB;AAAjB;AAHF;AAFP,GAAP;AAQD","sourcesContent":["import {uid} from '@luma.gl/api';\nimport Geometry from '../geometry/geometry';\n\nexport type SphereGeometryProps = {\n id?: string;\n radius?: number;\n nlat?: number;\n nlong?: number;\n attributes?\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).\nexport class SphereGeometry extends Geometry {\n constructor(props: SphereGeometryProps = {}) {\n const {id = uid('sphere-geometry')} = props;\n const {indices, attributes} = tesselateSphere(props);\n super({\n ...props,\n id,\n indices,\n attributes: {...attributes, ...props.attributes}\n });\n }\n}\n\n/* eslint-disable max-statements, complexity */\nfunction tesselateSphere(props: SphereGeometryProps) {\n const {nlat = 10, nlong = 10} = props;\n\n const startLat = 0;\n const endLat = Math.PI;\n const latRange = endLat - startLat;\n const startLong = 0;\n const endLong = 2 * Math.PI;\n const longRange = endLong - startLong;\n const numVertices = (nlat + 1) * (nlong + 1);\n\n const radius = (n1: number, n2: number, n3: number, u: number, v: number) => props.radius || 1;\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(numVertices * 2);\n\n const IndexType = numVertices > 0xffff ? Uint32Array : Uint16Array;\n const indices = new IndexType(nlat * nlong * 6);\n\n // Create positions, normals and texCoords\n for (let y = 0; y <= nlat; y++) {\n for (let x = 0; x <= nlong; x++) {\n const u = x / nlong;\n const v = y / nlat;\n\n const index = x + y * (nlong + 1);\n const i2 = index * 2;\n const i3 = index * 3;\n\n const theta = longRange * u;\n const phi = latRange * v;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n const sinPhi = Math.sin(phi);\n const cosPhi = Math.cos(phi);\n const ux = cosTheta * sinPhi;\n const uy = cosPhi;\n const uz = sinTheta * sinPhi;\n\n const r = radius(ux, uy, uz, u, v);\n\n positions[i3 + 0] = r * ux;\n positions[i3 + 1] = r * uy;\n positions[i3 + 2] = r * uz;\n\n normals[i3 + 0] = ux;\n normals[i3 + 1] = uy;\n normals[i3 + 2] = uz;\n\n texCoords[i2 + 0] = u;\n texCoords[i2 + 1] = 1 - v;\n }\n }\n\n // Create indices\n const numVertsAround = nlong + 1;\n for (let x = 0; x < nlong; x++) {\n for (let y = 0; y < nlat; y++) {\n const index = (x * nlat + y) * 6;\n\n indices[index + 0] = y * numVertsAround + x;\n indices[index + 1] = y * numVertsAround + x + 1;\n indices[index + 2] = (y + 1) * numVertsAround + x;\n\n indices[index + 3] = (y + 1) * numVertsAround + x;\n indices[index + 4] = y * numVertsAround + x + 1;\n indices[index + 5] = (y + 1) * numVertsAround + x + 1;\n }\n }\n\n return {\n indices: {size: 1, value: indices},\n attributes: {\n POSITION: {size: 3, value: positions},\n NORMAL: {size: 3, value: normals},\n TEXCOORD_0: {size: 2, value: texCoords}\n }\n };\n}\n"],"file":"sphere-geometry.js"}
1
+ {"version":3,"file":"sphere-geometry.js","names":["uid","Geometry","SphereGeometry","constructor","props","arguments","length","undefined","id","indices","attributes","tesselateSphere","topology","nlat","nlong","startLat","endLat","Math","PI","latRange","startLong","endLong","longRange","numVertices","radius","n1","n2","n3","u","v","positions","Float32Array","normals","texCoords","IndexType","Uint32Array","Uint16Array","y","x","index","i2","i3","theta","phi","sinTheta","sin","cosTheta","cos","sinPhi","cosPhi","ux","uy","uz","r","numVertsAround","size","value","POSITION","NORMAL","TEXCOORD_0"],"sources":["../../src/geometries/sphere-geometry.ts"],"sourcesContent":["import {uid} from '@luma.gl/core';\nimport {Geometry} from '../geometry/geometry';\n\nexport type SphereGeometryProps = {\n id?: string;\n radius?: number;\n nlat?: number;\n nlong?: number;\n attributes?: any\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).\nexport class SphereGeometry extends Geometry {\n constructor(props: SphereGeometryProps = {}) {\n const {id = uid('sphere-geometry')} = props;\n const {indices, attributes} = tesselateSphere(props);\n super({\n ...props,\n id,\n topology: 'triangle-list',\n indices,\n attributes: {...attributes, ...props.attributes}\n });\n }\n}\n\n/* eslint-disable max-statements, complexity */\nfunction tesselateSphere(props: SphereGeometryProps) {\n const {nlat = 10, nlong = 10} = props;\n\n const startLat = 0;\n const endLat = Math.PI;\n const latRange = endLat - startLat;\n const startLong = 0;\n const endLong = 2 * Math.PI;\n const longRange = endLong - startLong;\n const numVertices = (nlat + 1) * (nlong + 1);\n\n const radius = (n1: number, n2: number, n3: number, u: number, v: number) => props.radius || 1;\n\n const positions = new Float32Array(numVertices * 3);\n const normals = new Float32Array(numVertices * 3);\n const texCoords = new Float32Array(numVertices * 2);\n\n const IndexType = numVertices > 0xffff ? Uint32Array : Uint16Array;\n const indices = new IndexType(nlat * nlong * 6);\n\n // Create positions, normals and texCoords\n for (let y = 0; y <= nlat; y++) {\n for (let x = 0; x <= nlong; x++) {\n const u = x / nlong;\n const v = y / nlat;\n\n const index = x + y * (nlong + 1);\n const i2 = index * 2;\n const i3 = index * 3;\n\n const theta = longRange * u;\n const phi = latRange * v;\n const sinTheta = Math.sin(theta);\n const cosTheta = Math.cos(theta);\n const sinPhi = Math.sin(phi);\n const cosPhi = Math.cos(phi);\n const ux = cosTheta * sinPhi;\n const uy = cosPhi;\n const uz = sinTheta * sinPhi;\n\n const r = radius(ux, uy, uz, u, v);\n\n positions[i3 + 0] = r * ux;\n positions[i3 + 1] = r * uy;\n positions[i3 + 2] = r * uz;\n\n normals[i3 + 0] = ux;\n normals[i3 + 1] = uy;\n normals[i3 + 2] = uz;\n\n texCoords[i2 + 0] = u;\n texCoords[i2 + 1] = 1 - v;\n }\n }\n\n // Create indices\n const numVertsAround = nlong + 1;\n for (let x = 0; x < nlong; x++) {\n for (let y = 0; y < nlat; y++) {\n const index = (x * nlat + y) * 6;\n\n indices[index + 0] = y * numVertsAround + x;\n indices[index + 1] = y * numVertsAround + x + 1;\n indices[index + 2] = (y + 1) * numVertsAround + x;\n\n indices[index + 3] = (y + 1) * numVertsAround + x;\n indices[index + 4] = y * numVertsAround + x + 1;\n indices[index + 5] = (y + 1) * numVertsAround + x + 1;\n }\n }\n\n return {\n indices: {size: 1, value: indices},\n attributes: {\n POSITION: {size: 3, value: positions},\n NORMAL: {size: 3, value: normals},\n TEXCOORD_0: {size: 2, value: texCoords}\n }\n };\n}\n"],"mappings":"AAAA,SAAQA,GAAG,QAAO,eAAe;AAAC,SAC1BC,QAAQ;AAahB,OAAO,MAAMC,cAAc,SAASD,QAAQ,CAAC;EAC3CE,WAAWA,CAAA,EAAkC;IAAA,IAAjCC,KAA0B,GAAAC,SAAA,CAAAC,MA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C,CAAC,GAAGF,CAAC,GAAGiB,cAAc,GAAGhB,CAAC,GAAG,CAAC;MAC/C7B,OAAO,CAAC8B,KAAK,GAAG,CAAC,CAAC,GAAG,CAACF,CAAC,GAAG,CAAC,IAAIiB,cAAc,GAAGhB,CAAC,GAAG,CAAC;IACvD;EACF;EAEA,OAAO;IACL7B,OAAO,EAAE;MAAC8C,IAAI,EAAE,CAAC;MAAEC,KAAK,EAAE/C;IAAO,CAAC;IAClCC,UAAU,EAAE;MACV+C,QAAQ,EAAE;QAACF,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAE1B;MAAS,CAAC;MACrC4B,MAAM,EAAE;QAACH,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAExB;MAAO,CAAC;MACjC2B,UAAU,EAAE;QAACJ,IAAI,EAAE,CAAC;QAAEC,KAAK,EAAEvB;MAAS;IACxC;EACF,CAAC;AACH"}
@@ -1,6 +1,5 @@
1
- import Geometry from '../geometry/geometry';
2
- import { GeometryTable } from '../geometry/geometry-table';
3
- export declare type TruncatedConeGeometryProps = {
1
+ import { Geometry } from '../geometry/geometry';
2
+ export type TruncatedConeGeometryProps = {
4
3
  topRadius?: number;
5
4
  bottomRadius?: number;
6
5
  topCap?: boolean;
@@ -15,7 +14,6 @@ export declare 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,QAAQ,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAC;AAQzD,oBAAY,0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AM;CAerF"}
@@ -1,23 +1,13 @@
1
- import { uid } from '@luma.gl/api';
2
- import Geometry from '../geometry/geometry';
1
+ import { uid } from '@luma.gl/core';
2
+ import { Geometry } from "../geometry/geometry.js";
3
3
  const INDEX_OFFSETS = {
4
4
  x: [2, 0, 1],
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
- constructor(props = {}) {
9
+ constructor() {
10
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21
11
  const {
22
12
  id = uid('truncated-code-geometry')
23
13
  } = props;
@@ -25,8 +15,10 @@ export class TruncatedConeGeometry extends Geometry {
25
15
  indices,
26
16
  attributes
27
17
  } = tesselateTruncatedCone(props);
28
- super({ ...props,
18
+ super({
19
+ ...props,
29
20
  id,
21
+ topology: 'triangle-list',
30
22
  indices,
31
23
  attributes: {
32
24
  POSITION: {
@@ -45,10 +37,9 @@ export class TruncatedConeGeometry extends Geometry {
45
37
  }
46
38
  });
47
39
  }
48
-
49
40
  }
50
-
51
- function tesselateTruncatedCone(props = {}) {
41
+ function tesselateTruncatedCone() {
42
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
52
43
  const {
53
44
  bottomRadius = 0,
54
45
  topRadius = 0,
@@ -77,12 +68,10 @@ function tesselateTruncatedCone(props = {}) {
77
68
  const texCoords = new Float32Array(numVertices * 2);
78
69
  let i3 = 0;
79
70
  let i2 = 0;
80
-
81
71
  for (let i = start; i <= end; i++) {
82
72
  let v = i / nvertical;
83
73
  let y = height * v;
84
74
  let ringRadius;
85
-
86
75
  if (i < 0) {
87
76
  y = 0;
88
77
  v = 1;
@@ -94,14 +83,11 @@ function tesselateTruncatedCone(props = {}) {
94
83
  } else {
95
84
  ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical);
96
85
  }
97
-
98
86
  if (i === -2 || i === nvertical + 2) {
99
87
  ringRadius = 0;
100
88
  v = 0;
101
89
  }
102
-
103
90
  y -= height / 2;
104
-
105
91
  for (let j = 0; j < vertsAroundEdge; j++) {
106
92
  const sin = msin(j * mpi * 2 / nradial);
107
93
  const cos = mcos(j * mpi * 2 / nradial);
@@ -117,7 +103,6 @@ function tesselateTruncatedCone(props = {}) {
117
103
  i3 += 3;
118
104
  }
119
105
  }
120
-
121
106
  for (let i = 0; i < nvertical + extra; i++) {
122
107
  for (let j = 0; j < nradial; j++) {
123
108
  const index = (i * nradial + j) * 6;
@@ -129,7 +114,6 @@ function tesselateTruncatedCone(props = {}) {
129
114
  indices[index + 5] = vertsAroundEdge * (i + 1) + 0 + j;
130
115
  }
131
116
  }
132
-
133
117
  return {
134
118
  indices,
135
119
  attributes: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/geometries/truncated-cone-geometry.ts"],"names":["uid","Geometry","INDEX_OFFSETS","x","y","z","makeTruncatedConeGeometry","props","indices","attributes","tesselateTruncatedCone","length","TruncatedConeGeometry","constructor","id","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"],"mappings":"AAAA,SAAQA,GAAR,QAAkB,cAAlB;AACA,OAAOC,QAAP,MAAqB,sBAArB;AAGA,MAAMC,aAAa,GAAG;AACpBC,EAAAA,CAAC,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CADiB;AAEpBC,EAAAA,CAAC,EAAE,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAFiB;AAGpBC,EAAAA,CAAC,EAAE,CAAC,CAAD,EAA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AG,CAACJ,CAAC,GAAG7B,OAAJ,GAAcgC,CAAf,IAAoB,CAAlC;AACA/C,MAAAA,OAAO,CAACgD,KAAK,GAAG,CAAT,CAAP,GAAqBb,eAAe,IAAIS,CAAC,GAAG,CAAR,CAAf,GAA4B,CAA5B,GAAgCG,CAArD;AACA/C,MAAAA,OAAO,CAACgD,KAAK,GAAG,CAAT,CAAP,GAAqBb,eAAe,IAAIS,CAAC,GAAG,CAAR,CAAf,GAA4B,CAA5B,GAAgCG,CAArD;AACA/C,MAAAA,OAAO,CAACgD,KAAK,GAAG,CAAT,CAAP,GAAqBb,eAAe,IAAIS,CAAC,GAAG,CAAR,CAAf,GAA4B,CAA5B,GAAgCG,CAArD;AACA/C,MAAAA,OAAO,CAACgD,KAAK,GAAG,CAAT,CAAP,GAAqBb,eAAe,IAAIS,CAAC,GAAG,CAAR,CAAf,GAA4B,CAA5B,GAAgCG,CAArD;AACA/C,MAAAA,OAAO,CAACgD,KAAK,GAAG,CAAT,CAAP,GAAqBb,eAAe,IAAIS,CAAC,GAAG,CAAR,CAAf,GAA4B,CAA5B,GAAgCG,CAArD;AACA/C,MAAAA,OAAO,CAACgD,KAAK,GAAG,CAAT,CAAP,GAAqBb,eAAe,IAAIS,CAAC,GAAG,CAAR,CAAf,GAA4B,CAA5B,GAAgCG,CAArD;AACD;AACF;;AAED,SAAO;AACL/C,IAAAA,OADK;AAELC,IAAAA,UAAU,EAAE;AACVM,MAAAA,QAAQ,EAAE+B,SADA;AAEV5B,MAAAA,MAAM,EAAE8B,OAFE;AAGV7B,MAAAA,UAAU,EAAE8B;AAHF;AAFP,GAAP;AAQD","sourcesContent":["import {uid} from '@luma.gl/api';\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?} = {}) {\n const {id = uid('truncated-code-geometry')} = props;\n const {indices, attributes} = tesselateTruncatedCone(props);\n super({\n ...props,\n id,\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"],"file":"truncated-cone-geometry.js"}
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,MAAM;MAACK,OAAO;MAAEC;IAAU,CAAC,GAAGC,sBAAsB,CAACP,KAAK,CAAC;IAC3D,KAAK,CAAC;MACJ,GAAGA,KAAK;MACRI,EAAE;MACFI,QAAQ,EAAE,eAAe;MACzBH,OAAO;MACPC,UAAU,EAAE;QACVG,QAAQ,EAAE;UAACC,IAAI,EAAE,CAAC;UAAEC,KAAK,EAAEL,UAAU,CAACG;QAAQ,CAAC;QAC/CG,MAAM,EAAE;UAACF,IAAI,EAAE,CAAC;UAAEC,KAAK,EAAEL,UAAU,CAACM;QAAM,CAAC;QAC3CC,UAAU,EAAE;UAACH,IAAI,EAAE,CAAC;UAAEC,KAAK,EAAEL,UAAU,CAACO;QAAU,CAAC;QACnD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AAO,EAAEgC,CAAC,EAAE,EAAE;MAChC,MAAMC,KAAK,GAAG,CAACJ,CAAC,GAAG7B,OAAO,GAAGgC,CAAC,IAAI,CAAC;MACnC5C,OAAO,CAAC6C,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;MACtD5C,OAAO,CAAC6C,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;MACtD5C,OAAO,CAAC6C,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;MACtD5C,OAAO,CAAC6C,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;MACtD5C,OAAO,CAAC6C,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAGG,CAAC;MACtD5C,OAAO,CAAC6C,KAAK,GAAG,CAAC,CAAC,GAAGb,eAAe,IAAIS,CAAC,GAAG,CAAC,CAAC,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,6 +1,6 @@
1
- import type { TypedArray, VertexFormat } from '@luma.gl/api';
1
+ import type { TypedArray, VertexFormat } from '@luma.gl/core';
2
2
  /** Holds one geometry */
3
- export declare type GeometryTable = {
3
+ export type GeometryTable = {
4
4
  length: number;
5
5
  schema?: Record<string, VertexFormat>;
6
6
  attributes: {
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-table.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAE3D,yBAAyB;AACzB,oBAAY,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,QAAQ,EAAE,UAAU,CAAC;QACrB,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,UAAU,CAAC;QACvB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACpC,QAAQ,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;CAC3F,CAAA"}
1
+ {"version":3,"file":"geometry-table.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-table.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,UAAU,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAE5D,yBAAyB;AACzB,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,UAAU,EAAE;QACV,QAAQ,EAAE,UAAU,CAAC;QACrB,MAAM,EAAE,UAAU,CAAC;QACnB,UAAU,EAAE,UAAU,CAAC;QACvB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CAAC;KAC3B,CAAC;IACF,OAAO,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACpC,QAAQ,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;CAC3F,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"geometry-table.js"}
1
+ {"version":3,"file":"geometry-table.js","names":[],"sources":["../../src/geometry/geometry-table.ts"],"sourcesContent":["// luma.gl, MIT license\nimport type {TypedArray, VertexFormat} from '@luma.gl/core';\n\n/** Holds one geometry */\nexport type GeometryTable = {\n length: number;\n schema?: Record<string, VertexFormat>;\n attributes: {\n POSITION: TypedArray,\n NORMAL: TypedArray,\n TEXCOORD_0: TypedArray,\n [key: string]: TypedArray,\n };\n indices?: Uint16Array | Uint32Array;\n topology?: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"geometry-utils.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CAAC,QAAQ,KAAA,OA4B7C"}
1
+ {"version":3,"file":"geometry-utils.d.ts","sourceRoot":"","sources":["../../src/geometry/geometry-utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,GAAG,OA4BlD"}
@@ -3,14 +3,11 @@ export function unpackIndexedGeometry(geometry) {
3
3
  indices,
4
4
  attributes
5
5
  } = geometry;
6
-
7
6
  if (!indices) {
8
7
  return geometry;
9
8
  }
10
-
11
9
  const vertexCount = indices.value.length;
12
10
  const unpackedAttributes = {};
13
-
14
11
  for (const attributeName in attributes) {
15
12
  const attribute = attributes[attributeName];
16
13
  const {
@@ -18,27 +15,21 @@ export function unpackIndexedGeometry(geometry) {
18
15
  value,
19
16
  size
20
17
  } = attribute;
21
-
22
18
  if (constant || !size) {
23
19
  continue;
24
20
  }
25
-
26
21
  const unpackedValue = new value.constructor(vertexCount * size);
27
-
28
22
  for (let x = 0; x < vertexCount; ++x) {
29
23
  const index = indices.value[x];
30
-
31
24
  for (let i = 0; i < size; i++) {
32
25
  unpackedValue[x * size + i] = value[index * size + i];
33
26
  }
34
27
  }
35
-
36
28
  unpackedAttributes[attributeName] = {
37
29
  size,
38
30
  value: unpackedValue
39
31
  };
40
32
  }
41
-
42
33
  return {
43
34
  attributes: Object.assign({}, attributes, unpackedAttributes)
44
35
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/geometry/geometry-utils.ts"],"names":["unpackIndexedGeometry","geometry","indices","attributes","vertexCount","value","length","unpackedAttributes","attributeName","attribute","constant","size","unpackedValue","constructor","x","index","i","Object","assign"],"mappings":"AAEA,OAAO,SAASA,qBAAT,CAA+BC,QAA/B,EAAyC;AAC9C,QAAM;AAACC,IAAAA,OAAD;AAAUC,IAAAA;AAAV,MAAwBF,QAA9B;;AACA,MAAI,CAACC,OAAL,EAAc;AACZ,WAAOD,QAAP;AACD;;AAED,QAAMG,WAAW,GAAGF,OAAO,CAACG,KAAR,CAAcC,MAAlC;AACA,QAAMC,kBAAkB,GAAG,EAA3B;;AAEA,OAAK,MAAMC,aAAX,IAA4BL,UAA5B,EAAwC;AACtC,UAAMM,SAAS,GAAGN,UAAU,CAACK,aAAD,CAA5B;AACA,UAAM;AAACE,MAAAA,QAAD;AAAWL,MAAAA,KAAX;AAAkBM,MAAAA;AAAlB,QAA0BF,SAAhC;;AACA,QAAIC,QAAQ,IAAI,CAACC,IAAjB,EAAuB;AACrB;AACD;;AACD,UAAMC,aAAa,GAAG,IAAIP,KAAK,CAACQ,WAAV,CAAsBT,WAAW,GAAGO,IAApC,CAAtB;;AACA,SAAK,IAAIG,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGV,WAApB,EAAiC,EAAEU,CAAnC,EAAsC;AACpC,YAAMC,KAAK,GAAGb,OAAO,CAACG,KAAR,CAAcS,CAAd,CAAd;;AACA,WAAK,IAAIE,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGL,IAApB,EAA0BK,CAAC,EAA3B,EAA+B;AAC7BJ,QAAAA,aAAa,CAACE,CAAC,GAAGH,IAAJ,GAAWK,CAAZ,CAAb,GAA8BX,KAAK,CAACU,KAAK,GAAGJ,IAAR,GAAeK,CAAhB,CAAnC;AACD;AACF;;AACDT,IAAAA,kBAAkB,CAACC,aAAD,CAAlB,GAAoC;AAACG,MAAAA,IAAD;AAAON,MAAAA,KAAK,EAAEO;AAAd,KAApC;AACD;;AAED,SAAO;AACLT,IAAAA,UAAU,EAAEc,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBf,UAAlB,EAA8BI,kBAA9B;AADP,GAAP;AAGD","sourcesContent":["// import type Geometry from './geometry';\n\nexport function unpackIndexedGeometry(geometry) {\n const {indices, attributes} = geometry;\n if (!indices) {\n return geometry;\n }\n\n const vertexCount = indices.value.length;\n const unpackedAttributes = {};\n\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {constant, value, size} = attribute;\n if (constant || !size) {\n continue; // eslint-disable-line\n }\n const unpackedValue = new value.constructor(vertexCount * size);\n for (let x = 0; x < vertexCount; ++x) {\n const index = indices.value[x];\n for (let i = 0; i < size; i++) {\n unpackedValue[x * size + i] = value[index * size + i];\n }\n }\n unpackedAttributes[attributeName] = {size, value: unpackedValue};\n }\n\n return {\n attributes: Object.assign({}, attributes, unpackedAttributes)\n };\n}\n"],"file":"geometry-utils.js"}
1
+ {"version":3,"file":"geometry-utils.js","names":["unpackIndexedGeometry","geometry","indices","attributes","vertexCount","value","length","unpackedAttributes","attributeName","attribute","constant","size","unpackedValue","constructor","x","index","i","Object","assign"],"sources":["../../src/geometry/geometry-utils.ts"],"sourcesContent":["// import type {Geometry} from './geometry';\n\nexport function unpackIndexedGeometry(geometry: any) {\n const {indices, attributes} = geometry;\n if (!indices) {\n return geometry;\n }\n\n const vertexCount = indices.value.length;\n const unpackedAttributes: Record<string, any> = {};\n\n for (const attributeName in attributes) {\n const attribute = attributes[attributeName];\n const {constant, value, size} = attribute;\n if (constant || !size) {\n continue; // eslint-disable-line\n }\n const unpackedValue = new value.constructor(vertexCount * size);\n for (let x = 0; x < vertexCount; ++x) {\n const index = indices.value[x];\n for (let i = 0; i < size; i++) {\n unpackedValue[x * size + i] = value[index * size + i];\n }\n }\n unpackedAttributes[attributeName] = {size, value: unpackedValue};\n }\n\n return {\n attributes: Object.assign({}, attributes, unpackedAttributes)\n };\n}\n"],"mappings":"AAEA,OAAO,SAASA,qBAAqBA,CAACC,QAAa,EAAE;EACnD,MAAM;IAACC,OAAO;IAAEC;EAAU,CAAC,GAAGF,QAAQ;EACtC,IAAI,CAACC,OAAO,EAAE;IACZ,OAAOD,QAAQ;EACjB;EAEA,MAAMG,WAAW,GAAGF,OAAO,CAACG,KAAK,CAACC,MAAM;EACxC,MAAMC,kBAAuC,GAAG,CAAC,CAAC;EAElD,KAAK,MAAMC,aAAa,IAAIL,UAAU,EAAE;IACtC,MAAMM,SAAS,GAAGN,UAAU,CAACK,aAAa,CAAC;IAC3C,MAAM;MAACE,QAAQ;MAAEL,KAAK;MAAEM;IAAI,CAAC,GAAGF,SAAS;IACzC,IAAIC,QAAQ,IAAI,CAACC,IAAI,EAAE;MACrB;IACF;IACA,MAAMC,aAAa,GAAG,IAAIP,KAAK,CAACQ,WAAW,CAACT,WAAW,GAAGO,IAAI,CAAC;IAC/D,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGV,WAAW,EAAE,EAAEU,CAAC,EAAE;MACpC,MAAMC,KAAK,GAAGb,OAAO,CAACG,KAAK,CAACS,CAAC,CAAC;MAC9B,KAAK,IAAIE,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,EAAEK,CAAC,EAAE,EAAE;QAC7BJ,aAAa,CAACE,CAAC,GAAGH,IAAI,GAAGK,CAAC,CAAC,GAAGX,KAAK,CAACU,KAAK,GAAGJ,IAAI,GAAGK,CAAC,CAAC;MACvD;IACF;IACAT,kBAAkB,CAACC,aAAa,CAAC,GAAG;MAACG,IAAI;MAAEN,KAAK,EAAEO;IAAa,CAAC;EAClE;EAEA,OAAO;IACLT,UAAU,EAAEc,MAAM,CAACC,MAAM,CAAC,CAAC,CAAC,EAAEf,UAAU,EAAEI,kBAAkB;EAC9D,CAAC;AACH"}
@@ -1,71 +1,62 @@
1
- import type { TypedArray } from '@luma.gl/api';
2
- import GL from '@luma.gl/constants';
3
- /**
4
- * Rendering primitives - "topology" specifies how to extract primitives from vertices.
5
- */
6
- export declare type Topology = GL.POINTS | // draw single points.
7
- GL.LINES | // draw lines. Each vertex connects to the one after it.
8
- GL.LINE_LOOP | // draw lines. Each set of two vertices is treated as a separate line segment.
9
- GL.LINE_STRIP | // draw a connected group of line segments from the first vertex to the last
10
- GL.TRIANGLES | // draw triangles. Each set of three vertices creates a separate triangle.
11
- GL.TRIANGLE_STRIP | // draw a connected group of triangles.
12
- GL.TRIANGLE_FAN;
13
- export declare type GeometryProps = {
1
+ import type { PrimitiveTopology, TypedArray } from '@luma.gl/core';
2
+ export type GeometryProps = {
14
3
  id?: string;
15
- attributes?: {};
16
- indices?: any;
17
- vertexCount?: number;
18
4
  /** Determines how vertices are read from the 'vertex' attributes */
19
- topology?: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
20
- /** @deprecated */
21
- drawMode?: Topology;
5
+ topology: 'point-list' | 'line-list' | 'line-strip' | 'line-loop-webgl' | 'triangle-list' | 'triangle-strip' | 'triangle-fan-webgl';
6
+ /** Auto calculated from attributes if not provided */
7
+ vertexCount?: number;
8
+ attributes?: Record<string, GeometryAttribute | TypedArray>;
9
+ indices?: GeometryAttribute | TypedArray;
22
10
  };
23
- export default class Geometry {
24
- /** @deprecated */
25
- static DRAW_MODE: {
26
- POINTS: GL;
27
- LINES: GL;
28
- LINE_LOOP: GL;
29
- LINE_STRIP: GL;
30
- TRIANGLES: GL;
31
- TRIANGLE_STRIP: GL;
32
- TRIANGLE_FAN: GL;
11
+ export type GeometryAttributes = {
12
+ POSITION: GeometryAttribute;
13
+ NORMAL: GeometryAttribute;
14
+ TEXCOORD_0: GeometryAttribute;
15
+ COLOR_0?: GeometryAttribute;
16
+ indices?: GeometryAttribute & {
17
+ size: 1;
18
+ value: Uint32Array | Uint16Array;
33
19
  };
20
+ };
21
+ export type GeometryAttribute = {
22
+ size?: number;
23
+ value: TypedArray;
24
+ [key: string]: any;
25
+ };
26
+ export declare class Geometry {
34
27
  readonly id: string;
35
- userData: Record<string, any>;
36
28
  /** Determines how vertices are read from the 'vertex' attributes */
37
- topology?: 'point-list' | 'line-list' | 'line-strip' | 'triangle-list' | 'triangle-strip';
38
- /** @deprecated */
39
- readonly drawMode: Topology;
29
+ readonly topology?: PrimitiveTopology;
40
30
  readonly vertexCount: number;
31
+ readonly indices?: GeometryAttribute;
41
32
  readonly attributes: {
42
- POSITION: {
43
- size: number;
44
- value: TypedArray;
45
- [key: string]: any;
46
- };
47
- NORMAL: {
48
- size: number;
49
- value: TypedArray;
50
- [key: string]: any;
51
- };
52
- TEXCOORD_0: {
53
- size: number;
54
- value: TypedArray;
55
- [key: string]: any;
56
- };
57
- COLOR_0?: {
58
- size: number;
59
- value: TypedArray;
60
- [key: string]: any;
61
- };
33
+ POSITION: GeometryAttribute;
34
+ NORMAL: GeometryAttribute;
35
+ TEXCOORD_0: GeometryAttribute;
36
+ COLOR_0?: GeometryAttribute;
37
+ [key: string]: GeometryAttribute | undefined;
62
38
  };
63
- readonly indices?: Uint16Array | Uint32Array;
64
- constructor(props?: GeometryProps);
65
- get mode(): Topology;
39
+ userData: Record<string, unknown>;
40
+ constructor(props: GeometryProps);
66
41
  getVertexCount(): number;
67
- _print(attributeName: any): string;
68
- _setAttributes(attributes: any, indices: any): this;
69
- _calculateVertexCount(attributes: any, indices: any): number;
42
+ /**
43
+ * Return an object with all attributes plus indices added as a field.
44
+ * TODO Geometry types are a mess
45
+ */
46
+ getAttributes(): GeometryAttributes;
47
+ _print(attributeName: string): string;
48
+ /**
49
+ * GeometryAttribute
50
+ * value: typed array
51
+ * type: indices, vertices, uvs
52
+ * size: elements per vertex
53
+ * target: WebGL buffer type (string or constant)
54
+ *
55
+ * @param attributes
56
+ * @param indices
57
+ * @returns
58
+ */
59
+ _setAttributes(attributes: Record<string, GeometryAttribute>, indices: any): this;
60
+ _calculateVertexCount(attributes: GeometryAttributes, indices: GeometryAttribute): number;
70
61
  }
71
62
  //# 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,UAAU,EAAC,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC;;GAEG;AACH,oBAAY,QAAQ,GAClB,EAAE,CAAC,MAAM,GAAI,sBAAsB;AACnC,EAAE,CAAC,KAAK,GAAI,wDAAwD;AACpE,EAAE,CAAC,SAAS,GAAI,8EAA8E;AAC9F,EAAE,CAAC,UAAU,GAAI,4EAA4E;AAC7F,EAAE,CAAC,SAAS,GAAI,0EAA0E;AAC1F,EAAE,CAAC,cAAc,GAAI,uCAAuC;AAC5D,EAAE,CAAC,YAAY,CACd;AAEH,oBAAY,aAAa,GAAG;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,EAAE,CAAC;IAChB,OAAO,CAAC,MAAC;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC1F,kBAAkB;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,kBAAkB;IAClB,MAAM,CAAC,SAAS;;;;;;;;MAQd;IAEF,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAM;IAEnC,oEAAoE;IACpE,QAAQ,CAAC,EAAE,YAAY,GAAG,WAAW,GAAG,YAAY,GAAG,eAAe,GAAG,gBAAgB,CAAC;IAC1F,kBAAkB;IAClB,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