@loaders.gl/math 3.2.12 → 3.3.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/es5/geometry/attributes/compute-bounding-box.js +1 -11
  2. package/dist/es5/geometry/attributes/compute-bounding-box.js.map +1 -1
  3. package/dist/es5/geometry/attributes/compute-bounding-sphere.js +1 -0
  4. package/dist/es5/geometry/attributes/compute-bounding-sphere.js.map +1 -1
  5. package/dist/es5/geometry/attributes/compute-tangents.js +1 -0
  6. package/dist/es5/geometry/attributes/compute-tangents.js.map +1 -1
  7. package/dist/es5/geometry/attributes/compute-vertex-normals.js +2 -17
  8. package/dist/es5/geometry/attributes/compute-vertex-normals.js.map +1 -1
  9. package/dist/es5/geometry/attributes/convert-to-non-indexed.js +3 -14
  10. package/dist/es5/geometry/attributes/convert-to-non-indexed.js.map +1 -1
  11. package/dist/es5/geometry/attributes/get-attribute-from-geometry.js +0 -4
  12. package/dist/es5/geometry/attributes/get-attribute-from-geometry.js.map +1 -1
  13. package/dist/es5/geometry/attributes/normalize.js +0 -1
  14. package/dist/es5/geometry/attributes/normalize.js.map +1 -1
  15. package/dist/es5/geometry/colors/rgb565.js +0 -1
  16. package/dist/es5/geometry/colors/rgb565.js.map +1 -1
  17. package/dist/es5/geometry/compression/attribute-compression.js +8 -23
  18. package/dist/es5/geometry/compression/attribute-compression.js.map +1 -1
  19. package/dist/es5/geometry/constants.js +4 -9
  20. package/dist/es5/geometry/constants.js.map +1 -1
  21. package/dist/es5/geometry/gl/gl-type.js +12 -26
  22. package/dist/es5/geometry/gl/gl-type.js.map +1 -1
  23. package/dist/es5/geometry/is-geometry.js +0 -3
  24. package/dist/es5/geometry/is-geometry.js.map +1 -1
  25. package/dist/es5/geometry/iterators/attribute-iterator.js +0 -9
  26. package/dist/es5/geometry/iterators/attribute-iterator.js.map +1 -1
  27. package/dist/es5/geometry/iterators/primitive-iterator.js +6 -28
  28. package/dist/es5/geometry/iterators/primitive-iterator.js.map +1 -1
  29. package/dist/es5/geometry/primitives/modes.js +1 -15
  30. package/dist/es5/geometry/primitives/modes.js.map +1 -1
  31. package/dist/es5/geometry/typed-arrays/typed-array-utils.js +0 -6
  32. package/dist/es5/geometry/typed-arrays/typed-array-utils.js.map +1 -1
  33. package/dist/es5/geometry/utils/assert.js +0 -1
  34. package/dist/es5/geometry/utils/assert.js.map +1 -1
  35. package/dist/es5/index.js +40 -50
  36. package/dist/es5/index.js.map +1 -1
  37. package/dist/es5/utils/assert.js +0 -1
  38. package/dist/es5/utils/assert.js.map +1 -1
  39. package/dist/esm/geometry/attributes/compute-bounding-box.js +3 -4
  40. package/dist/esm/geometry/attributes/compute-bounding-box.js.map +1 -1
  41. package/dist/esm/geometry/attributes/compute-bounding-sphere.js.map +1 -1
  42. package/dist/esm/geometry/attributes/compute-tangents.js.map +1 -1
  43. package/dist/esm/geometry/attributes/compute-vertex-normals.js +0 -2
  44. package/dist/esm/geometry/attributes/compute-vertex-normals.js.map +1 -1
  45. package/dist/esm/geometry/attributes/convert-to-non-indexed.js +7 -11
  46. package/dist/esm/geometry/attributes/convert-to-non-indexed.js.map +1 -1
  47. package/dist/esm/geometry/attributes/get-attribute-from-geometry.js +1 -1
  48. package/dist/esm/geometry/attributes/get-attribute-from-geometry.js.map +1 -1
  49. package/dist/esm/geometry/attributes/normalize.js +5 -2
  50. package/dist/esm/geometry/attributes/normalize.js.map +1 -1
  51. package/dist/esm/geometry/colors/rgb565.js +4 -1
  52. package/dist/esm/geometry/colors/rgb565.js.map +1 -1
  53. package/dist/esm/geometry/compression/attribute-compression.js +19 -15
  54. package/dist/esm/geometry/compression/attribute-compression.js.map +1 -1
  55. package/dist/esm/geometry/constants.js +6 -1
  56. package/dist/esm/geometry/constants.js.map +1 -1
  57. package/dist/esm/geometry/gl/gl-type.js +3 -16
  58. package/dist/esm/geometry/gl/gl-type.js.map +1 -1
  59. package/dist/esm/geometry/is-geometry.js +1 -0
  60. package/dist/esm/geometry/is-geometry.js.map +1 -1
  61. package/dist/esm/geometry/iterators/attribute-iterator.js +1 -2
  62. package/dist/esm/geometry/iterators/attribute-iterator.js.map +1 -1
  63. package/dist/esm/geometry/iterators/primitive-iterator.js +6 -10
  64. package/dist/esm/geometry/iterators/primitive-iterator.js.map +1 -1
  65. package/dist/esm/geometry/primitives/modes.js +1 -10
  66. package/dist/esm/geometry/primitives/modes.js.map +1 -1
  67. package/dist/esm/geometry/typed-arrays/typed-array-utils.js +3 -6
  68. package/dist/esm/geometry/typed-arrays/typed-array-utils.js.map +1 -1
  69. package/dist/esm/geometry/utils/assert.js +1 -0
  70. package/dist/esm/geometry/utils/assert.js.map +1 -1
  71. package/dist/esm/index.js +6 -0
  72. package/dist/esm/index.js.map +1 -1
  73. package/dist/esm/utils/assert.js +1 -0
  74. package/dist/esm/utils/assert.js.map +1 -1
  75. package/dist/geometry/attributes/compute-vertex-normals.d.ts +1 -1
  76. package/dist/geometry/attributes/compute-vertex-normals.d.ts.map +1 -1
  77. package/dist/geometry/compression/attribute-compression.d.ts +1 -1
  78. package/dist/geometry/compression/attribute-compression.d.ts.map +1 -1
  79. package/dist/geometry/constants.d.ts +1 -1
  80. package/dist/geometry/constants.d.ts.map +1 -1
  81. package/package.json +4 -4
package/dist/es5/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -11,34 +10,22 @@ Object.defineProperty(exports, "GL", {
11
10
  return _constants.GL;
12
11
  }
13
12
  });
14
- Object.defineProperty(exports, "GL_TYPE", {
15
- enumerable: true,
16
- get: function get() {
17
- return _constants.GL_TYPE;
18
- }
19
- });
20
13
  Object.defineProperty(exports, "GLType", {
21
14
  enumerable: true,
22
15
  get: function get() {
23
16
  return _glType.default;
24
17
  }
25
18
  });
26
- Object.defineProperty(exports, "isGeometry", {
27
- enumerable: true,
28
- get: function get() {
29
- return _isGeometry.default;
30
- }
31
- });
32
- Object.defineProperty(exports, "makeAttributeIterator", {
19
+ Object.defineProperty(exports, "GL_TYPE", {
33
20
  enumerable: true,
34
21
  get: function get() {
35
- return _attributeIterator.makeAttributeIterator;
22
+ return _constants.GL_TYPE;
36
23
  }
37
24
  });
38
- Object.defineProperty(exports, "makePrimitiveIterator", {
25
+ Object.defineProperty(exports, "compressTextureCoordinates", {
39
26
  enumerable: true,
40
27
  get: function get() {
41
- return _primitiveIterator.makePrimitiveIterator;
28
+ return _attributeCompression.compressTextureCoordinates;
42
29
  }
43
30
  });
44
31
  Object.defineProperty(exports, "computeVertexNormals", {
@@ -47,10 +34,10 @@ Object.defineProperty(exports, "computeVertexNormals", {
47
34
  return _computeVertexNormals.computeVertexNormals;
48
35
  }
49
36
  });
50
- Object.defineProperty(exports, "encodeRGB565", {
37
+ Object.defineProperty(exports, "concatTypedArrays", {
51
38
  enumerable: true,
52
39
  get: function get() {
53
- return _rgb.encodeRGB565;
40
+ return _typedArrayUtils.concatTypedArrays;
54
41
  }
55
42
  });
56
43
  Object.defineProperty(exports, "decodeRGB565", {
@@ -59,34 +46,34 @@ Object.defineProperty(exports, "decodeRGB565", {
59
46
  return _rgb.decodeRGB565;
60
47
  }
61
48
  });
62
- Object.defineProperty(exports, "concatTypedArrays", {
49
+ Object.defineProperty(exports, "decompressTextureCoordinates", {
63
50
  enumerable: true,
64
51
  get: function get() {
65
- return _typedArrayUtils.concatTypedArrays;
52
+ return _attributeCompression.decompressTextureCoordinates;
66
53
  }
67
54
  });
68
- Object.defineProperty(exports, "octEncodeInRange", {
55
+ Object.defineProperty(exports, "encodeRGB565", {
69
56
  enumerable: true,
70
57
  get: function get() {
71
- return _attributeCompression.octEncodeInRange;
58
+ return _rgb.encodeRGB565;
72
59
  }
73
60
  });
74
- Object.defineProperty(exports, "octEncode", {
61
+ Object.defineProperty(exports, "isGeometry", {
75
62
  enumerable: true,
76
63
  get: function get() {
77
- return _attributeCompression.octEncode;
64
+ return _isGeometry.default;
78
65
  }
79
66
  });
80
- Object.defineProperty(exports, "octEncodeToVector4", {
67
+ Object.defineProperty(exports, "makeAttributeIterator", {
81
68
  enumerable: true,
82
69
  get: function get() {
83
- return _attributeCompression.octEncodeToVector4;
70
+ return _attributeIterator.makeAttributeIterator;
84
71
  }
85
72
  });
86
- Object.defineProperty(exports, "octDecodeInRange", {
73
+ Object.defineProperty(exports, "makePrimitiveIterator", {
87
74
  enumerable: true,
88
75
  get: function get() {
89
- return _attributeCompression.octDecodeInRange;
76
+ return _primitiveIterator.makePrimitiveIterator;
90
77
  }
91
78
  });
92
79
  Object.defineProperty(exports, "octDecode", {
@@ -95,16 +82,28 @@ Object.defineProperty(exports, "octDecode", {
95
82
  return _attributeCompression.octDecode;
96
83
  }
97
84
  });
85
+ Object.defineProperty(exports, "octDecodeFloat", {
86
+ enumerable: true,
87
+ get: function get() {
88
+ return _attributeCompression.octDecodeFloat;
89
+ }
90
+ });
98
91
  Object.defineProperty(exports, "octDecodeFromVector4", {
99
92
  enumerable: true,
100
93
  get: function get() {
101
94
  return _attributeCompression.octDecodeFromVector4;
102
95
  }
103
96
  });
104
- Object.defineProperty(exports, "octPackFloat", {
97
+ Object.defineProperty(exports, "octDecodeInRange", {
105
98
  enumerable: true,
106
99
  get: function get() {
107
- return _attributeCompression.octPackFloat;
100
+ return _attributeCompression.octDecodeInRange;
101
+ }
102
+ });
103
+ Object.defineProperty(exports, "octEncode", {
104
+ enumerable: true,
105
+ get: function get() {
106
+ return _attributeCompression.octEncode;
108
107
  }
109
108
  });
110
109
  Object.defineProperty(exports, "octEncodeFloat", {
@@ -113,34 +112,34 @@ Object.defineProperty(exports, "octEncodeFloat", {
113
112
  return _attributeCompression.octEncodeFloat;
114
113
  }
115
114
  });
116
- Object.defineProperty(exports, "octDecodeFloat", {
115
+ Object.defineProperty(exports, "octEncodeInRange", {
117
116
  enumerable: true,
118
117
  get: function get() {
119
- return _attributeCompression.octDecodeFloat;
118
+ return _attributeCompression.octEncodeInRange;
120
119
  }
121
120
  });
122
- Object.defineProperty(exports, "octPack", {
121
+ Object.defineProperty(exports, "octEncodeToVector4", {
123
122
  enumerable: true,
124
123
  get: function get() {
125
- return _attributeCompression.octPack;
124
+ return _attributeCompression.octEncodeToVector4;
126
125
  }
127
126
  });
128
- Object.defineProperty(exports, "octUnpack", {
127
+ Object.defineProperty(exports, "octPack", {
129
128
  enumerable: true,
130
129
  get: function get() {
131
- return _attributeCompression.octUnpack;
130
+ return _attributeCompression.octPack;
132
131
  }
133
132
  });
134
- Object.defineProperty(exports, "compressTextureCoordinates", {
133
+ Object.defineProperty(exports, "octPackFloat", {
135
134
  enumerable: true,
136
135
  get: function get() {
137
- return _attributeCompression.compressTextureCoordinates;
136
+ return _attributeCompression.octPackFloat;
138
137
  }
139
138
  });
140
- Object.defineProperty(exports, "decompressTextureCoordinates", {
139
+ Object.defineProperty(exports, "octUnpack", {
141
140
  enumerable: true,
142
141
  get: function get() {
143
- return _attributeCompression.decompressTextureCoordinates;
142
+ return _attributeCompression.octUnpack;
144
143
  }
145
144
  });
146
145
  Object.defineProperty(exports, "zigZagDeltaDecode", {
@@ -149,22 +148,13 @@ Object.defineProperty(exports, "zigZagDeltaDecode", {
149
148
  return _attributeCompression.zigZagDeltaDecode;
150
149
  }
151
150
  });
152
-
153
151
  var _constants = require("./geometry/constants");
154
-
155
152
  var _glType = _interopRequireDefault(require("./geometry/gl/gl-type"));
156
-
157
153
  var _isGeometry = _interopRequireDefault(require("./geometry/is-geometry"));
158
-
159
154
  var _attributeIterator = require("./geometry/iterators/attribute-iterator");
160
-
161
155
  var _primitiveIterator = require("./geometry/iterators/primitive-iterator");
162
-
163
156
  var _computeVertexNormals = require("./geometry/attributes/compute-vertex-normals");
164
-
165
157
  var _rgb = require("./geometry/colors/rgb565");
166
-
167
158
  var _typedArrayUtils = require("./geometry/typed-arrays/typed-array-utils");
168
-
169
159
  var _attributeCompression = require("./geometry/compression/attribute-compression");
170
160
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAIA;;AAGA;;AAGA;;AACA;;AAGA;;AAEA;;AAGA;;AAGA","sourcesContent":["export {GL} from './geometry/constants';\n\n// GL support\nexport {GL_TYPE} from './geometry/constants';\nexport {default as GLType} from './geometry/gl/gl-type';\n\n// Geometry\nexport {default as isGeometry} from './geometry/is-geometry';\n\n// Iterators\nexport {makeAttributeIterator} from './geometry/iterators/attribute-iterator';\nexport {makePrimitiveIterator} from './geometry/iterators/primitive-iterator';\n\n// Helper methods\nexport {computeVertexNormals} from './geometry/attributes/compute-vertex-normals';\n\nexport {encodeRGB565, decodeRGB565} from './geometry/colors/rgb565';\n\n// Typed array utils\nexport {concatTypedArrays} from './geometry/typed-arrays/typed-array-utils';\n\n// Compression\nexport {\n octEncodeInRange,\n octEncode,\n octEncodeToVector4,\n octDecodeInRange,\n octDecode,\n octDecodeFromVector4,\n octPackFloat,\n octEncodeFloat,\n octDecodeFloat,\n octPack,\n octUnpack,\n compressTextureCoordinates,\n decompressTextureCoordinates,\n zigZagDeltaDecode\n} from './geometry/compression/attribute-compression';\n"],"file":"index.js"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["export {GL} from './geometry/constants';\n\n// GL support\nexport {GL_TYPE} from './geometry/constants';\nexport {default as GLType} from './geometry/gl/gl-type';\n\n// Geometry\nexport {default as isGeometry} from './geometry/is-geometry';\n\n// Iterators\nexport {makeAttributeIterator} from './geometry/iterators/attribute-iterator';\nexport {makePrimitiveIterator} from './geometry/iterators/primitive-iterator';\n\n// Helper methods\nexport {computeVertexNormals} from './geometry/attributes/compute-vertex-normals';\n\nexport {encodeRGB565, decodeRGB565} from './geometry/colors/rgb565';\n\n// Typed array utils\nexport {concatTypedArrays} from './geometry/typed-arrays/typed-array-utils';\n\n// Compression\nexport {\n octEncodeInRange,\n octEncode,\n octEncodeToVector4,\n octDecodeInRange,\n octDecode,\n octDecodeFromVector4,\n octPackFloat,\n octEncodeFloat,\n octDecodeFloat,\n octPack,\n octUnpack,\n compressTextureCoordinates,\n decompressTextureCoordinates,\n zigZagDeltaDecode\n} from './geometry/compression/attribute-compression';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAIA;AAGA;AAGA;AACA;AAGA;AAEA;AAGA;AAGA"}
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.assert = assert;
7
-
8
7
  function assert(condition, message) {
9
8
  if (!condition) {
10
9
  throw new Error(message || '3d-tile loader: assertion failed.');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/assert.ts"],"names":["assert","condition","message","Error"],"mappings":";;;;;;;AAGO,SAASA,MAAT,CAAgBC,SAAhB,EAAoCC,OAApC,EAA4D;AACjE,MAAI,CAACD,SAAL,EAAgB;AACd,UAAM,IAAIE,KAAJ,CAAUD,OAAO,IAAI,mCAArB,CAAN;AACD;AACF","sourcesContent":["// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport function assert(condition: Boolean, message?: string): void {\n if (!condition) {\n throw new Error(message || '3d-tile loader: assertion failed.');\n }\n}\n"],"file":"assert.js"}
1
+ {"version":3,"file":"assert.js","names":["assert","condition","message","Error"],"sources":["../../../src/utils/assert.ts"],"sourcesContent":["// Replacement for the external assert method to reduce bundle size\n// Note: We don't use the second \"message\" argument in calling code,\n// so no need to support it here\nexport function assert(condition: Boolean, message?: string): void {\n if (!condition) {\n throw new Error(message || '3d-tile loader: assertion failed.');\n }\n}\n"],"mappings":";;;;;;AAGO,SAASA,MAAM,CAACC,SAAkB,EAAEC,OAAgB,EAAQ;EACjE,IAAI,CAACD,SAAS,EAAE;IACd,MAAM,IAAIE,KAAK,CAACD,OAAO,IAAI,mCAAmC,CAAC;EACjE;AACF"}
@@ -1,9 +1,10 @@
1
1
  import { makeAttributeIterator } from '../iterators/attribute-iterator';
2
2
  import { assert } from '../utils/assert';
3
- export function computeBoundingBox(positions = []) {
3
+
4
+ export function computeBoundingBox() {
5
+ let positions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
4
6
  const min = [Number(Infinity), Number(Infinity), Number(Infinity)];
5
7
  const max = [-Infinity, -Infinity, -Infinity];
6
-
7
8
  for (const position of makeAttributeIterator(positions)) {
8
9
  const x = position[0];
9
10
  const y = position[1];
@@ -15,7 +16,6 @@ export function computeBoundingBox(positions = []) {
15
16
  if (y > max[1]) max[1] = y;
16
17
  if (z > max[2]) max[2] = z;
17
18
  }
18
-
19
19
  const boundingBox = {
20
20
  min,
21
21
  max
@@ -23,7 +23,6 @@ export function computeBoundingBox(positions = []) {
23
23
  validateBoundingBox(boundingBox);
24
24
  return boundingBox;
25
25
  }
26
-
27
26
  function validateBoundingBox(boundingBox) {
28
27
  assert(Number.isFinite(boundingBox.min[0]) && Number.isFinite(boundingBox.min[1]) && Number.isFinite(boundingBox.min[2]) && Number.isFinite(boundingBox.max[0]) && Number.isFinite(boundingBox.max[1]) && Number.isFinite(boundingBox.max[2]));
29
28
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/geometry/attributes/compute-bounding-box.ts"],"names":["makeAttributeIterator","assert","computeBoundingBox","positions","min","Number","Infinity","max","position","x","y","z","boundingBox","validateBoundingBox","isFinite"],"mappings":"AAAA,SAAQA,qBAAR,QAAoC,iCAApC;AACA,SAAQC,MAAR,QAAqB,iBAArB;AAcA,OAAO,SAASC,kBAAT,CAA4BC,SAAc,GAAG,EAA7C,EAAiD;AACtD,QAAMC,GAAG,GAAG,CAACC,MAAM,CAACC,QAAD,CAAP,EAAmBD,MAAM,CAACC,QAAD,CAAzB,EAAqCD,MAAM,CAACC,QAAD,CAA3C,CAAZ;AACA,QAAMC,GAAG,GAAG,CAAC,CAACD,QAAF,EAAY,CAACA,QAAb,EAAuB,CAACA,QAAxB,CAAZ;;AAEA,OAAK,MAAME,QAAX,IAAuBR,qBAAqB,CAACG,SAAD,CAA5C,EAAyD;AACvD,UAAMM,CAAC,GAAGD,QAAQ,CAAC,CAAD,CAAlB;AACA,UAAME,CAAC,GAAGF,QAAQ,CAAC,CAAD,CAAlB;AACA,UAAMG,CAAC,GAAGH,QAAQ,CAAC,CAAD,CAAlB;AAEA,QAAIC,CAAC,GAAGL,GAAG,CAAC,CAAD,CAAX,EAAgBA,GAAG,CAAC,CAAD,CAAH,GAASK,CAAT;AAChB,QAAIC,CAAC,GAAGN,GAAG,CAAC,CAAD,CAAX,EAAgBA,GAAG,CAAC,CAAD,CAAH,GAASM,CAAT;AAChB,QAAIC,CAAC,GAAGP,GAAG,CAAC,CAAD,CAAX,EAAgBA,GAAG,CAAC,CAAD,CAAH,GAASO,CAAT;AAEhB,QAAIF,CAAC,GAAGF,GAAG,CAAC,CAAD,CAAX,EAAgBA,GAAG,CAAC,CAAD,CAAH,GAASE,CAAT;AAChB,QAAIC,CAAC,GAAGH,GAAG,CAAC,CAAD,CAAX,EAAgBA,GAAG,CAAC,CAAD,CAAH,GAASG,CAAT;AAChB,QAAIC,CAAC,GAAGJ,GAAG,CAAC,CAAD,CAAX,EAAgBA,GAAG,CAAC,CAAD,CAAH,GAASI,CAAT;AACjB;;AAED,QAAMC,WAAW,GAAG;AAACR,IAAAA,GAAD;AAAMG,IAAAA;AAAN,GAApB;AACAM,EAAAA,mBAAmB,CAACD,WAAD,CAAnB;AACA,SAAOA,WAAP;AACD;;AAED,SAASC,mBAAT,CAA6BD,WAA7B,EAAuD;AACrDX,EAAAA,MAAM,CACJI,MAAM,CAACS,QAAP,CAAgBF,WAAW,CAACR,GAAZ,CAAgB,CAAhB,CAAhB,KACEC,MAAM,CAACS,QAAP,CAAgBF,WAAW,CAACR,GAAZ,CAAgB,CAAhB,CAAhB,CADF,IAEEC,MAAM,CAACS,QAAP,CAAgBF,WAAW,CAACR,GAAZ,CAAgB,CAAhB,CAAhB,CAFF,IAGEC,MAAM,CAACS,QAAP,CAAgBF,WAAW,CAACL,GAAZ,CAAgB,CAAhB,CAAhB,CAHF,IAIEF,MAAM,CAACS,QAAP,CAAgBF,WAAW,CAACL,GAAZ,CAAgB,CAAhB,CAAhB,CAJF,IAKEF,MAAM,CAACS,QAAP,CAAgBF,WAAW,CAACL,GAAZ,CAAgB,CAAhB,CAAhB,CANE,CAAN;AAQD","sourcesContent":["import {makeAttributeIterator} from '../iterators/attribute-iterator';\nimport {assert} from '../utils/assert';\n\n/**\n * Type for Bounding Box computing\n */\ntype BoundingBox = {\n min: number[];\n max: number[];\n};\n/**\n * Getting bounding box geometry according to positions parameters\n * @param positions\n * @returns Bounding Box\n */\nexport function computeBoundingBox(positions: any = []) {\n const min = [Number(Infinity), Number(Infinity), Number(Infinity)];\n const max = [-Infinity, -Infinity, -Infinity];\n // @ts-ignore\n for (const position of makeAttributeIterator(positions)) {\n const x = position[0];\n const y = position[1];\n const z = position[2];\n\n if (x < min[0]) min[0] = x;\n if (y < min[1]) min[1] = y;\n if (z < min[2]) min[2] = z;\n\n if (x > max[0]) max[0] = x;\n if (y > max[1]) max[1] = y;\n if (z > max[2]) max[2] = z;\n }\n\n const boundingBox = {min, max};\n validateBoundingBox(boundingBox);\n return boundingBox;\n}\n\nfunction validateBoundingBox(boundingBox: BoundingBox) {\n assert(\n Number.isFinite(boundingBox.min[0]) &&\n Number.isFinite(boundingBox.min[1]) &&\n Number.isFinite(boundingBox.min[2]) &&\n Number.isFinite(boundingBox.max[0]) &&\n Number.isFinite(boundingBox.max[1]) &&\n Number.isFinite(boundingBox.max[2])\n );\n}\n"],"file":"compute-bounding-box.js"}
1
+ {"version":3,"file":"compute-bounding-box.js","names":["makeAttributeIterator","assert","computeBoundingBox","positions","min","Number","Infinity","max","position","x","y","z","boundingBox","validateBoundingBox","isFinite"],"sources":["../../../../src/geometry/attributes/compute-bounding-box.ts"],"sourcesContent":["import {makeAttributeIterator} from '../iterators/attribute-iterator';\nimport {assert} from '../utils/assert';\n\n/**\n * Type for Bounding Box computing\n */\ntype BoundingBox = {\n min: number[];\n max: number[];\n};\n/**\n * Getting bounding box geometry according to positions parameters\n * @param positions\n * @returns Bounding Box\n */\nexport function computeBoundingBox(positions: any = []) {\n const min = [Number(Infinity), Number(Infinity), Number(Infinity)];\n const max = [-Infinity, -Infinity, -Infinity];\n // @ts-ignore\n for (const position of makeAttributeIterator(positions)) {\n const x = position[0];\n const y = position[1];\n const z = position[2];\n\n if (x < min[0]) min[0] = x;\n if (y < min[1]) min[1] = y;\n if (z < min[2]) min[2] = z;\n\n if (x > max[0]) max[0] = x;\n if (y > max[1]) max[1] = y;\n if (z > max[2]) max[2] = z;\n }\n\n const boundingBox = {min, max};\n validateBoundingBox(boundingBox);\n return boundingBox;\n}\n\nfunction validateBoundingBox(boundingBox: BoundingBox) {\n assert(\n Number.isFinite(boundingBox.min[0]) &&\n Number.isFinite(boundingBox.min[1]) &&\n Number.isFinite(boundingBox.min[2]) &&\n Number.isFinite(boundingBox.max[0]) &&\n Number.isFinite(boundingBox.max[1]) &&\n Number.isFinite(boundingBox.max[2])\n );\n}\n"],"mappings":"AAAA,SAAQA,qBAAqB,QAAO,iCAAiC;AACrE,SAAQC,MAAM,QAAO,iBAAiB;;AActC,OAAO,SAASC,kBAAkB,GAAsB;EAAA,IAArBC,SAAc,uEAAG,EAAE;EACpD,MAAMC,GAAG,GAAG,CAACC,MAAM,CAACC,QAAQ,CAAC,EAAED,MAAM,CAACC,QAAQ,CAAC,EAAED,MAAM,CAACC,QAAQ,CAAC,CAAC;EAClE,MAAMC,GAAG,GAAG,CAAC,CAACD,QAAQ,EAAE,CAACA,QAAQ,EAAE,CAACA,QAAQ,CAAC;EAE7C,KAAK,MAAME,QAAQ,IAAIR,qBAAqB,CAACG,SAAS,CAAC,EAAE;IACvD,MAAMM,CAAC,GAAGD,QAAQ,CAAC,CAAC,CAAC;IACrB,MAAME,CAAC,GAAGF,QAAQ,CAAC,CAAC,CAAC;IACrB,MAAMG,CAAC,GAAGH,QAAQ,CAAC,CAAC,CAAC;IAErB,IAAIC,CAAC,GAAGL,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,GAAGK,CAAC;IAC1B,IAAIC,CAAC,GAAGN,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,GAAGM,CAAC;IAC1B,IAAIC,CAAC,GAAGP,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,GAAGO,CAAC;IAE1B,IAAIF,CAAC,GAAGF,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,GAAGE,CAAC;IAC1B,IAAIC,CAAC,GAAGH,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,GAAGG,CAAC;IAC1B,IAAIC,CAAC,GAAGJ,GAAG,CAAC,CAAC,CAAC,EAAEA,GAAG,CAAC,CAAC,CAAC,GAAGI,CAAC;EAC5B;EAEA,MAAMC,WAAW,GAAG;IAACR,GAAG;IAAEG;EAAG,CAAC;EAC9BM,mBAAmB,CAACD,WAAW,CAAC;EAChC,OAAOA,WAAW;AACpB;AAEA,SAASC,mBAAmB,CAACD,WAAwB,EAAE;EACrDX,MAAM,CACJI,MAAM,CAACS,QAAQ,CAACF,WAAW,CAACR,GAAG,CAAC,CAAC,CAAC,CAAC,IACjCC,MAAM,CAACS,QAAQ,CAACF,WAAW,CAACR,GAAG,CAAC,CAAC,CAAC,CAAC,IACnCC,MAAM,CAACS,QAAQ,CAACF,WAAW,CAACR,GAAG,CAAC,CAAC,CAAC,CAAC,IACnCC,MAAM,CAACS,QAAQ,CAACF,WAAW,CAACL,GAAG,CAAC,CAAC,CAAC,CAAC,IACnCF,MAAM,CAACS,QAAQ,CAACF,WAAW,CAACL,GAAG,CAAC,CAAC,CAAC,CAAC,IACnCF,MAAM,CAACS,QAAQ,CAACF,WAAW,CAACL,GAAG,CAAC,CAAC,CAAC,CAAC,CACtC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"compute-bounding-sphere.js"}
1
+ {"version":3,"file":"compute-bounding-sphere.js","names":[],"sources":["../../../../src/geometry/attributes/compute-bounding-sphere.ts"],"sourcesContent":["/* eslint-disable */\n/**\nimport {getPositions} from './get-attribute-from-geometry';\n\nexport function computeBoundingSphere(geometry: any, boundingBox: object, vector: Vector3 ) {\n const positions = getPositions(geometry);\n\n const center = getBoundingBox(center);\n box.setFromBufferAttribute(position);\n box.getCenter(center);\n\n // hoping to find a boundingSphere with a radius smaller than the\n // boundingSphere of the boundingBox: sqrt(3) smaller in the best case\n\n var maxRadiusSq = 0;\n\n for (const position of makeAttributeIterator(positions)) {\n vector.x = position[0];\n vector.y = position[1];\n vector.z = position[2];\n maxRadiusSq = Math.max(maxRadiusSq, center.distanceToSquared(vector));\n }\n\n const radius = Math.sqrt(maxRadiusSq);\n assert(Number.isFinite(radius));\n\n return {center, radius};\n}\n*/\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"compute-tangents.js"}
1
+ {"version":3,"file":"compute-tangents.js","names":[],"sources":["../../../../src/geometry/attributes/compute-tangents.ts"],"sourcesContent":["/*\nexport function computeTangents({indices, positions, normals, uvs}) {\n var index = geometry.index;\n var attributes = geometry.attributes;\n\n // based on http://www.terathon.com/code/tangent.html\n // (per vertex tangents)\n\n if (\n index === null ||\n attributes.position === undefined ||\n attributes.normal === undefined ||\n attributes.uv === undefined\n ) {\n console.warn(\n 'THREE.BufferGeometry: Missing required attributes (index, position, normal or uv) in BufferGeometry.computeTangents()'\n );\n return;\n }\n\n var nVertices = positions.length / 3;\n\n var tangents = new Float32Array(4 * nVertices); // size: 4\n\n var tan1 = [],\n tan2 = [];\n\n for (var k = 0; k < nVertices; k++) {\n tan1[k] = new THREE.Vector3();\n tan2[k] = new THREE.Vector3();\n }\n\n var vA = new THREE.Vector3(),\n vB = new THREE.Vector3(),\n vC = new THREE.Vector3(),\n uvA = new THREE.Vector2(),\n uvB = new THREE.Vector2(),\n uvC = new THREE.Vector2(),\n sdir = new THREE.Vector3(),\n tdir = new THREE.Vector3();\n\n function handleTriangle(a, b, c) {\n vA.fromArray(positions, a * 3);\n vB.fromArray(positions, b * 3);\n vC.fromArray(positions, c * 3);\n\n uvA.fromArray(uvs, a * 2);\n uvB.fromArray(uvs, b * 2);\n uvC.fromArray(uvs, c * 2);\n\n var x1 = vB.x - vA.x;\n var x2 = vC.x - vA.x;\n\n var y1 = vB.y - vA.y;\n var y2 = vC.y - vA.y;\n\n var z1 = vB.z - vA.z;\n var z2 = vC.z - vA.z;\n\n var s1 = uvB.x - uvA.x;\n var s2 = uvC.x - uvA.x;\n\n var t1 = uvB.y - uvA.y;\n var t2 = uvC.y - uvA.y;\n\n var r = 1.0 / (s1 * t2 - s2 * t1);\n\n sdir.set((t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r, (t2 * z1 - t1 * z2) * r);\n\n tdir.set((s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) * r, (s1 * z2 - s2 * z1) * r);\n\n tan1[a].add(sdir);\n tan1[b].add(sdir);\n tan1[c].add(sdir);\n\n tan2[a].add(tdir);\n tan2[b].add(tdir);\n tan2[c].add(tdir);\n }\n\n var groups = geometry.groups;\n\n if (groups.length === 0) {\n groups = [\n {\n start: 0,\n count: indices.length\n }\n ];\n }\n\n for (var j = 0, jl = groups.length; j < jl; ++j) {\n var group = groups[j];\n\n var start = group.start;\n var count = group.count;\n\n for (var i = start, il = start + count; i < il; i += 3) {\n handleTriangle(indices[i + 0], indices[i + 1], indices[i + 2]);\n }\n }\n\n var tmp = new THREE.Vector3(),\n tmp2 = new THREE.Vector3();\n var n = new THREE.Vector3(),\n n2 = new THREE.Vector3();\n var w, t, test;\n\n function handleVertex(v) {\n n.fromArray(normals, v * 3);\n n2.copy(n);\n\n t = tan1[v];\n\n // Gram-Schmidt orthogonalize\n\n tmp.copy(t);\n tmp.sub(n.multiplyScalar(n.dot(t))).normalize();\n\n // Calculate handedness\n\n tmp2.crossVectors(n2, t);\n test = tmp2.dot(tan2[v]);\n w = test < 0.0 ? -1.0 : 1.0;\n\n tangents[v * 4] = tmp.x;\n tangents[v * 4 + 1] = tmp.y;\n tangents[v * 4 + 2] = tmp.z;\n tangents[v * 4 + 3] = w;\n }\n\n for (var j = 0, jl = groups.length; j < jl; ++j) {\n var group = groups[j];\n\n var start = group.start;\n var count = group.count;\n\n for (var i = start, il = start + count; i < il; i += 3) {\n handleVertex(indices[i + 0]);\n handleVertex(indices[i + 1]);\n handleVertex(indices[i + 2]);\n }\n }\n}\n*/\n"],"mappings":""}
@@ -15,7 +15,6 @@ export function computeVertexNormals(geometry) {
15
15
  const vectorC = new Vector3();
16
16
  const vectorCB = new Vector3();
17
17
  const vectorAB = new Vector3();
18
-
19
18
  for (const primitive of makePrimitiveIterator(geometry)) {
20
19
  vectorA.fromArray(positions, primitive.i1 * 3);
21
20
  vectorB.fromArray(positions, primitive.i2 * 3 + 3);
@@ -37,7 +36,6 @@ export function computeVertexNormals(geometry) {
37
36
  normals[primitiveIndex * 9 + 7] = normal.y;
38
37
  normals[primitiveIndex * 9 + 8] = normal.z;
39
38
  }
40
-
41
39
  return normals;
42
40
  }
43
41
  //# sourceMappingURL=compute-vertex-normals.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/geometry/attributes/compute-vertex-normals.ts"],"names":["Vector3","GL","assert","makePrimitiveIterator","getPrimitiveModeType","getPositions","computeVertexNormals","geometry","mode","TRIANGLES","values","positions","normals","Float32Array","length","vectorA","vectorB","vectorC","vectorCB","vectorAB","primitive","fromArray","i1","i2","i3","subVectors","normal","cross","normalize","primitiveIndex","x","y","z"],"mappings":"AACA,SAAQA,OAAR,QAAsB,eAAtB;AACA,SAAQC,EAAR,QAAiB,cAAjB;AACA,SAAQC,MAAR,QAAqB,iBAArB;AACA,SAAQC,qBAAR,QAAoC,iCAApC;AACA,SAAQC,oBAAR,QAAmC,qBAAnC;AACA,SAAQC,YAAR,QAA2B,+BAA3B;AAaA,OAAO,SAASC,oBAAT,CAA8BC,QAA9B,EAAgE;AAErEL,EAAAA,MAAM,CAACE,oBAAoB,CAACG,QAAQ,CAACC,IAAV,CAApB,KAAwCP,EAAE,CAACQ,SAA5C,EAAuD,oBAAvD,CAAN;AAEA,QAAM;AAACC,IAAAA,MAAM,EAAEC;AAAT,MAAsBN,YAAY,CAACE,QAAD,CAAxC;AAEA,QAAMK,OAAO,GAAG,IAAIC,YAAJ,CAAiBF,SAAS,CAACG,MAA3B,CAAhB;AAEA,QAAMC,OAAO,GAAG,IAAIf,OAAJ,EAAhB;AACA,QAAMgB,OAAO,GAAG,IAAIhB,OAAJ,EAAhB;AACA,QAAMiB,OAAO,GAAG,IAAIjB,OAAJ,EAAhB;AAEA,QAAMkB,QAAQ,GAAG,IAAIlB,OAAJ,EAAjB;AACA,QAAMmB,QAAQ,GAAG,IAAInB,OAAJ,EAAjB;;AAEA,OAAK,MAAMoB,SAAX,IAAwBjB,qBAAqB,CAACI,QAAD,CAA7C,EAAyD;AACvDQ,IAAAA,OAAO,CAACM,SAAR,CAAkBV,SAAlB,EAA6BS,SAAS,CAACE,EAAV,GAAe,CAA5C;AACAN,IAAAA,OAAO,CAACK,SAAR,CAAkBV,SAAlB,EAA6BS,SAAS,CAACG,EAAV,GAAe,CAAf,GAAmB,CAAhD;AACAN,IAAAA,OAAO,CAACI,SAAR,CAAkBV,SAAlB,EAA6BS,SAAS,CAACI,EAAV,GAAe,CAAf,GAAmB,CAAhD;AAEAN,IAAAA,QAAQ,CAACO,UAAT,CAAoBR,OAApB,EAA6BD,OAA7B;AACAG,IAAAA,QAAQ,CAACM,UAAT,CAAoBV,OAApB,EAA6BC,OAA7B;AACA,UAAMU,MAAM,GAAGR,QAAQ,CAACS,KAAT,CAAeR,QAAf,CAAf;AACAO,IAAAA,MAAM,CAACE,SAAP;AAEA,UAAM;AAACC,MAAAA;AAAD,QAAmBT,SAAzB;AAEAR,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACI,CAAzC;AACAlB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACK,CAAzC;AACAnB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACM,CAAzC;AAEApB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACI,CAAzC;AACAlB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACK,CAAzC;AACAnB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACM,CAAzC;AAEApB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACI,CAAzC;AACAlB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACK,CAAzC;AACAnB,IAAAA,OAAO,CAACiB,cAAc,GAAG,CAAjB,GAAqB,CAAtB,CAAP,GAAkCH,MAAM,CAACM,CAAzC;AACD;;AAED,SAAOpB,OAAP;AACD","sourcesContent":["import type {TypedArray} from '@math.gl/core';\nimport {Vector3} from '@math.gl/core';\nimport {GL} from '../constants';\nimport {assert} from '../utils/assert';\nimport {makePrimitiveIterator} from '../iterators/primitive-iterator';\nimport {getPrimitiveModeType} from '../primitives/modes';\nimport {getPositions} from './get-attribute-from-geometry';\n\ntype Geometry = {\n mode: any;\n indices?: {size: number; values: TypedArray};\n attributes?: {};\n};\n/**\n * Computes vertex normals for a geometry\n * @param param0\n * @returns\n */\n// eslint-disable-next-line max-statements\nexport function computeVertexNormals(geometry: Geometry): Float32Array {\n // Only support GL.TRIANGLES, GL.TRIANGLE_STRIP, GL.TRIANGLE_FAN\n assert(getPrimitiveModeType(geometry.mode) === GL.TRIANGLES, 'TRIANGLES required');\n\n const {values: positions} = getPositions(geometry);\n\n const normals = new Float32Array(positions.length);\n\n const vectorA = new Vector3();\n const vectorB = new Vector3();\n const vectorC = new Vector3();\n\n const vectorCB = new Vector3();\n const vectorAB = new Vector3();\n\n for (const primitive of makePrimitiveIterator(geometry)) {\n vectorA.fromArray(positions, primitive.i1 * 3);\n vectorB.fromArray(positions, primitive.i2 * 3 + 3);\n vectorC.fromArray(positions, primitive.i3 * 3 + 6);\n\n vectorCB.subVectors(vectorC, vectorB);\n vectorAB.subVectors(vectorA, vectorB);\n const normal = vectorCB.cross(vectorAB);\n normal.normalize();\n // @ts-ignore\n const {primitiveIndex} = primitive;\n\n normals[primitiveIndex * 9 + 0] = normal.x;\n normals[primitiveIndex * 9 + 1] = normal.y;\n normals[primitiveIndex * 9 + 2] = normal.z;\n\n normals[primitiveIndex * 9 + 3] = normal.x;\n normals[primitiveIndex * 9 + 4] = normal.y;\n normals[primitiveIndex * 9 + 5] = normal.z;\n\n normals[primitiveIndex * 9 + 6] = normal.x;\n normals[primitiveIndex * 9 + 7] = normal.y;\n normals[primitiveIndex * 9 + 8] = normal.z;\n }\n\n return normals;\n}\n"],"file":"compute-vertex-normals.js"}
1
+ {"version":3,"file":"compute-vertex-normals.js","names":["Vector3","GL","assert","makePrimitiveIterator","getPrimitiveModeType","getPositions","computeVertexNormals","geometry","mode","TRIANGLES","values","positions","normals","Float32Array","length","vectorA","vectorB","vectorC","vectorCB","vectorAB","primitive","fromArray","i1","i2","i3","subVectors","normal","cross","normalize","primitiveIndex","x","y","z"],"sources":["../../../../src/geometry/attributes/compute-vertex-normals.ts"],"sourcesContent":["import type {TypedArray} from '@math.gl/core';\nimport {Vector3} from '@math.gl/core';\nimport {GL} from '../constants';\nimport {assert} from '../utils/assert';\nimport {makePrimitiveIterator} from '../iterators/primitive-iterator';\nimport {getPrimitiveModeType} from '../primitives/modes';\nimport {getPositions} from './get-attribute-from-geometry';\n\ntype Geometry = {\n mode: any;\n indices?: {size: number; values: TypedArray};\n attributes?: {};\n};\n/**\n * Computes vertex normals for a geometry\n * @param param0\n * @returns\n */\n// eslint-disable-next-line max-statements\nexport function computeVertexNormals(geometry: Geometry): Float32Array {\n // Only support GL.TRIANGLES, GL.TRIANGLE_STRIP, GL.TRIANGLE_FAN\n assert(getPrimitiveModeType(geometry.mode) === GL.TRIANGLES, 'TRIANGLES required');\n\n const {values: positions} = getPositions(geometry);\n\n const normals = new Float32Array(positions.length);\n\n const vectorA = new Vector3();\n const vectorB = new Vector3();\n const vectorC = new Vector3();\n\n const vectorCB = new Vector3();\n const vectorAB = new Vector3();\n\n for (const primitive of makePrimitiveIterator(geometry)) {\n vectorA.fromArray(positions, primitive.i1 * 3);\n vectorB.fromArray(positions, primitive.i2 * 3 + 3);\n vectorC.fromArray(positions, primitive.i3 * 3 + 6);\n\n vectorCB.subVectors(vectorC, vectorB);\n vectorAB.subVectors(vectorA, vectorB);\n const normal = vectorCB.cross(vectorAB);\n normal.normalize();\n // @ts-ignore\n const {primitiveIndex} = primitive;\n\n normals[primitiveIndex * 9 + 0] = normal.x;\n normals[primitiveIndex * 9 + 1] = normal.y;\n normals[primitiveIndex * 9 + 2] = normal.z;\n\n normals[primitiveIndex * 9 + 3] = normal.x;\n normals[primitiveIndex * 9 + 4] = normal.y;\n normals[primitiveIndex * 9 + 5] = normal.z;\n\n normals[primitiveIndex * 9 + 6] = normal.x;\n normals[primitiveIndex * 9 + 7] = normal.y;\n normals[primitiveIndex * 9 + 8] = normal.z;\n }\n\n return normals;\n}\n"],"mappings":"AACA,SAAQA,OAAO,QAAO,eAAe;AACrC,SAAQC,EAAE,QAAO,cAAc;AAC/B,SAAQC,MAAM,QAAO,iBAAiB;AACtC,SAAQC,qBAAqB,QAAO,iCAAiC;AACrE,SAAQC,oBAAoB,QAAO,qBAAqB;AACxD,SAAQC,YAAY,QAAO,+BAA+B;AAa1D,OAAO,SAASC,oBAAoB,CAACC,QAAkB,EAAgB;EAErEL,MAAM,CAACE,oBAAoB,CAACG,QAAQ,CAACC,IAAI,CAAC,KAAKP,EAAE,CAACQ,SAAS,EAAE,oBAAoB,CAAC;EAElF,MAAM;IAACC,MAAM,EAAEC;EAAS,CAAC,GAAGN,YAAY,CAACE,QAAQ,CAAC;EAElD,MAAMK,OAAO,GAAG,IAAIC,YAAY,CAACF,SAAS,CAACG,MAAM,CAAC;EAElD,MAAMC,OAAO,GAAG,IAAIf,OAAO,EAAE;EAC7B,MAAMgB,OAAO,GAAG,IAAIhB,OAAO,EAAE;EAC7B,MAAMiB,OAAO,GAAG,IAAIjB,OAAO,EAAE;EAE7B,MAAMkB,QAAQ,GAAG,IAAIlB,OAAO,EAAE;EAC9B,MAAMmB,QAAQ,GAAG,IAAInB,OAAO,EAAE;EAE9B,KAAK,MAAMoB,SAAS,IAAIjB,qBAAqB,CAACI,QAAQ,CAAC,EAAE;IACvDQ,OAAO,CAACM,SAAS,CAACV,SAAS,EAAES,SAAS,CAACE,EAAE,GAAG,CAAC,CAAC;IAC9CN,OAAO,CAACK,SAAS,CAACV,SAAS,EAAES,SAAS,CAACG,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAClDN,OAAO,CAACI,SAAS,CAACV,SAAS,EAAES,SAAS,CAACI,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAElDN,QAAQ,CAACO,UAAU,CAACR,OAAO,EAAED,OAAO,CAAC;IACrCG,QAAQ,CAACM,UAAU,CAACV,OAAO,EAAEC,OAAO,CAAC;IACrC,MAAMU,MAAM,GAAGR,QAAQ,CAACS,KAAK,CAACR,QAAQ,CAAC;IACvCO,MAAM,CAACE,SAAS,EAAE;IAElB,MAAM;MAACC;IAAc,CAAC,GAAGT,SAAS;IAElCR,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACI,CAAC;IAC1ClB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACK,CAAC;IAC1CnB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACM,CAAC;IAE1CpB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACI,CAAC;IAC1ClB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACK,CAAC;IAC1CnB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACM,CAAC;IAE1CpB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACI,CAAC;IAC1ClB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACK,CAAC;IAC1CnB,OAAO,CAACiB,cAAc,GAAG,CAAC,GAAG,CAAC,CAAC,GAAGH,MAAM,CAACM,CAAC;EAC5C;EAEA,OAAOpB,OAAO;AAChB"}
@@ -1,32 +1,28 @@
1
- export function convertBuffersToNonIndexed({
2
- indices,
3
- attributes
4
- }) {
5
- const geometry2 = new BufferGeometry();
6
1
 
2
+ export function convertBuffersToNonIndexed(_ref) {
3
+ let {
4
+ indices,
5
+ attributes
6
+ } = _ref;
7
+ const geometry2 = new BufferGeometry();
7
8
  for (const name in attributes) {
8
9
  const attribute = attributes[name];
9
10
  const array = attribute.array;
10
11
  const itemSize = attribute.itemSize;
11
12
  const array2 = new array.constructor(indices.length * itemSize);
12
13
  let index = 0,
13
- index2 = 0;
14
-
14
+ index2 = 0;
15
15
  for (var i = 0, l = indices.length; i < l; i++) {
16
16
  index = indices[i] * itemSize;
17
-
18
17
  for (var j = 0; j < itemSize; j++) {
19
18
  array2[index2++] = array[index++];
20
19
  }
21
20
  }
22
-
23
21
  geometry2.addAttribute(name, new BufferAttribute(array2, itemSize));
24
22
  }
25
-
26
23
  for (const group of this.groups) {
27
24
  geometry2.addGroup(group.start, group.count, group.materialIndex);
28
25
  }
29
-
30
26
  return geometry2;
31
27
  }
32
28
  //# sourceMappingURL=convert-to-non-indexed.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/geometry/attributes/convert-to-non-indexed.ts"],"names":["convertBuffersToNonIndexed","indices","attributes","geometry2","BufferGeometry","name","attribute","array","itemSize","array2","constructor","length","index","index2","i","l","j","addAttribute","BufferAttribute","group","groups","addGroup","start","count","materialIndex"],"mappings":"AAQA,OAAO,SAASA,0BAAT,CAAoC;AAACC,EAAAA,OAAD;AAAUC,EAAAA;AAAV,CAApC,EAAgE;AACrE,QAAMC,SAAS,GAAG,IAAIC,cAAJ,EAAlB;;AAEA,OAAK,MAAMC,IAAX,IAAmBH,UAAnB,EAA+B;AAC7B,UAAMI,SAAS,GAAGJ,UAAU,CAACG,IAAD,CAA5B;AAEA,UAAME,KAAK,GAAGD,SAAS,CAACC,KAAxB;AACA,UAAMC,QAAQ,GAAGF,SAAS,CAACE,QAA3B;AAEA,UAAMC,MAAM,GAAG,IAAIF,KAAK,CAACG,WAAV,CAAsBT,OAAO,CAACU,MAAR,GAAiBH,QAAvC,CAAf;AACA,QAAII,KAAK,GAAG,CAAZ;AAAA,QACEC,MAAM,GAAG,CADX;;AAGA,SAAK,IAAIC,CAAC,GAAG,CAAR,EAAWC,CAAC,GAAGd,OAAO,CAACU,MAA5B,EAAoCG,CAAC,GAAGC,CAAxC,EAA2CD,CAAC,EAA5C,EAAgD;AAC9CF,MAAAA,KAAK,GAAGX,OAAO,CAACa,CAAD,CAAP,GAAaN,QAArB;;AACA,WAAK,IAAIQ,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGR,QAApB,EAA8BQ,CAAC,EAA/B,EAAmC;AACjCP,QAAAA,MAAM,CAACI,MAAM,EAAP,CAAN,GAAmBN,KAAK,CAACK,KAAK,EAAN,CAAxB;AACD;AACF;;AACDT,IAAAA,SAAS,CAACc,YAAV,CAAuBZ,IAAvB,EAA6B,IAAIa,eAAJ,CAAoBT,MAApB,EAA4BD,QAA5B,CAA7B;AACD;;AAED,OAAK,MAAMW,KAAX,IAAoB,KAAKC,MAAzB,EAAiC;AAC/BjB,IAAAA,SAAS,CAACkB,QAAV,CAAmBF,KAAK,CAACG,KAAzB,EAAgCH,KAAK,CAACI,KAAtC,EAA6CJ,KAAK,CAACK,aAAnD;AACD;;AAED,SAAOrB,SAAP;AACD","sourcesContent":["/* eslint-disable */\n// @ts-nocheck\n/**\n * Converts indices of geometry.\n *\n * @param param0\n * @returns no indexed geometry\n */\nexport function convertBuffersToNonIndexed({indices, attributes}): any {\n const geometry2 = new BufferGeometry();\n\n for (const name in attributes) {\n const attribute = attributes[name];\n\n const array = attribute.array;\n const itemSize = attribute.itemSize;\n\n const array2 = new array.constructor(indices.length * itemSize);\n let index = 0,\n index2 = 0;\n\n for (var i = 0, l = indices.length; i < l; i++) {\n index = indices[i] * itemSize;\n for (var j = 0; j < itemSize; j++) {\n array2[index2++] = array[index++];\n }\n }\n geometry2.addAttribute(name, new BufferAttribute(array2, itemSize));\n }\n\n for (const group of this.groups) {\n geometry2.addGroup(group.start, group.count, group.materialIndex);\n }\n\n return geometry2;\n}\n"],"file":"convert-to-non-indexed.js"}
1
+ {"version":3,"file":"convert-to-non-indexed.js","names":["convertBuffersToNonIndexed","indices","attributes","geometry2","BufferGeometry","name","attribute","array","itemSize","array2","constructor","length","index","index2","i","l","j","addAttribute","BufferAttribute","group","groups","addGroup","start","count","materialIndex"],"sources":["../../../../src/geometry/attributes/convert-to-non-indexed.ts"],"sourcesContent":["/* eslint-disable */\n// @ts-nocheck\n/**\n * Converts indices of geometry.\n *\n * @param param0\n * @returns no indexed geometry\n */\nexport function convertBuffersToNonIndexed({indices, attributes}): any {\n const geometry2 = new BufferGeometry();\n\n for (const name in attributes) {\n const attribute = attributes[name];\n\n const array = attribute.array;\n const itemSize = attribute.itemSize;\n\n const array2 = new array.constructor(indices.length * itemSize);\n let index = 0,\n index2 = 0;\n\n for (var i = 0, l = indices.length; i < l; i++) {\n index = indices[i] * itemSize;\n for (var j = 0; j < itemSize; j++) {\n array2[index2++] = array[index++];\n }\n }\n geometry2.addAttribute(name, new BufferAttribute(array2, itemSize));\n }\n\n for (const group of this.groups) {\n geometry2.addGroup(group.start, group.count, group.materialIndex);\n }\n\n return geometry2;\n}\n"],"mappings":";AAQA,OAAO,SAASA,0BAA0B,OAA6B;EAAA,IAA5B;IAACC,OAAO;IAAEC;EAAU,CAAC;EAC9D,MAAMC,SAAS,GAAG,IAAIC,cAAc,EAAE;EAEtC,KAAK,MAAMC,IAAI,IAAIH,UAAU,EAAE;IAC7B,MAAMI,SAAS,GAAGJ,UAAU,CAACG,IAAI,CAAC;IAElC,MAAME,KAAK,GAAGD,SAAS,CAACC,KAAK;IAC7B,MAAMC,QAAQ,GAAGF,SAAS,CAACE,QAAQ;IAEnC,MAAMC,MAAM,GAAG,IAAIF,KAAK,CAACG,WAAW,CAACT,OAAO,CAACU,MAAM,GAAGH,QAAQ,CAAC;IAC/D,IAAII,KAAK,GAAG,CAAC;MACXC,MAAM,GAAG,CAAC;IAEZ,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,CAAC,GAAGd,OAAO,CAACU,MAAM,EAAEG,CAAC,GAAGC,CAAC,EAAED,CAAC,EAAE,EAAE;MAC9CF,KAAK,GAAGX,OAAO,CAACa,CAAC,CAAC,GAAGN,QAAQ;MAC7B,KAAK,IAAIQ,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGR,QAAQ,EAAEQ,CAAC,EAAE,EAAE;QACjCP,MAAM,CAACI,MAAM,EAAE,CAAC,GAAGN,KAAK,CAACK,KAAK,EAAE,CAAC;MACnC;IACF;IACAT,SAAS,CAACc,YAAY,CAACZ,IAAI,EAAE,IAAIa,eAAe,CAACT,MAAM,EAAED,QAAQ,CAAC,CAAC;EACrE;EAEA,KAAK,MAAMW,KAAK,IAAI,IAAI,CAACC,MAAM,EAAE;IAC/BjB,SAAS,CAACkB,QAAQ,CAACF,KAAK,CAACG,KAAK,EAAEH,KAAK,CAACI,KAAK,EAAEJ,KAAK,CAACK,aAAa,CAAC;EACnE;EAEA,OAAOrB,SAAS;AAClB"}
@@ -1,5 +1,6 @@
1
1
  import isGeometry from '../is-geometry';
2
2
  import { assert } from '../utils/assert';
3
+
3
4
  export function getPositions(geometry) {
4
5
  if (isGeometry(geometry)) {
5
6
  const {
@@ -21,7 +22,6 @@ export function getPositions(geometry) {
21
22
  assert(geometry.values);
22
23
  return geometry;
23
24
  }
24
-
25
25
  return assert(false);
26
26
  }
27
27
  //# sourceMappingURL=get-attribute-from-geometry.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/geometry/attributes/get-attribute-from-geometry.ts"],"names":["isGeometry","assert","getPositions","geometry","attributes","position","POSITION","positions","ArrayBuffer","isView","values","size"],"mappings":"AAAA,OAAOA,UAAP,MAAuB,gBAAvB;AACA,SAAQC,MAAR,QAAqB,iBAArB;AASA,OAAO,SAASC,YAAT,CAAsBC,QAAtB,EAAqC;AAE1C,MAAIH,UAAU,CAACG,QAAD,CAAd,EAA0B;AACxB,UAAM;AAACC,MAAAA;AAAD,QAAeD,QAArB;AACA,UAAME,QAAQ,GAAGD,UAAU,CAACE,QAAX,IAAuBF,UAAU,CAACG,SAAnD;AACAN,IAAAA,MAAM,CAACI,QAAD,CAAN;AACA,WAAOA,QAAP;AACD;;AAGD,MAAIG,WAAW,CAACC,MAAZ,CAAmBN,QAAnB,CAAJ,EAAkC;AAChC,WAAO;AAACO,MAAAA,MAAM,EAAEP,QAAT;AAAmBQ,MAAAA,IAAI,EAAE;AAAzB,KAAP;AACD;;AAGD,MAAIR,QAAJ,EAAc;AACZF,IAAAA,MAAM,CAACE,QAAQ,CAACO,MAAV,CAAN;AACA,WAAOP,QAAP;AACD;;AAED,SAAOF,MAAM,CAAC,KAAD,CAAb;AACD","sourcesContent":["import isGeometry from '../is-geometry';\nimport {assert} from '../utils/assert';\n\n/**\n * analyze positions of geometry\n *\n * @param geometry\n * @returns Position| New geometry |assert\n */\n\nexport function getPositions(geometry: any) {\n // If geometry, extract positions\n if (isGeometry(geometry)) {\n const {attributes} = geometry;\n const position = attributes.POSITION || attributes.positions;\n assert(position);\n return position;\n }\n\n // If arraybuffer, assume 3 components\n if (ArrayBuffer.isView(geometry)) {\n return {values: geometry, size: 3};\n }\n\n // Else assume accessor object\n if (geometry) {\n assert(geometry.values);\n return geometry;\n }\n\n return assert(false);\n}\n"],"file":"get-attribute-from-geometry.js"}
1
+ {"version":3,"file":"get-attribute-from-geometry.js","names":["isGeometry","assert","getPositions","geometry","attributes","position","POSITION","positions","ArrayBuffer","isView","values","size"],"sources":["../../../../src/geometry/attributes/get-attribute-from-geometry.ts"],"sourcesContent":["import isGeometry from '../is-geometry';\nimport {assert} from '../utils/assert';\n\n/**\n * analyze positions of geometry\n *\n * @param geometry\n * @returns Position| New geometry |assert\n */\n\nexport function getPositions(geometry: any) {\n // If geometry, extract positions\n if (isGeometry(geometry)) {\n const {attributes} = geometry;\n const position = attributes.POSITION || attributes.positions;\n assert(position);\n return position;\n }\n\n // If arraybuffer, assume 3 components\n if (ArrayBuffer.isView(geometry)) {\n return {values: geometry, size: 3};\n }\n\n // Else assume accessor object\n if (geometry) {\n assert(geometry.values);\n return geometry;\n }\n\n return assert(false);\n}\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,gBAAgB;AACvC,SAAQC,MAAM,QAAO,iBAAiB;;AAStC,OAAO,SAASC,YAAY,CAACC,QAAa,EAAE;EAE1C,IAAIH,UAAU,CAACG,QAAQ,CAAC,EAAE;IACxB,MAAM;MAACC;IAAU,CAAC,GAAGD,QAAQ;IAC7B,MAAME,QAAQ,GAAGD,UAAU,CAACE,QAAQ,IAAIF,UAAU,CAACG,SAAS;IAC5DN,MAAM,CAACI,QAAQ,CAAC;IAChB,OAAOA,QAAQ;EACjB;;EAGA,IAAIG,WAAW,CAACC,MAAM,CAACN,QAAQ,CAAC,EAAE;IAChC,OAAO;MAACO,MAAM,EAAEP,QAAQ;MAAEQ,IAAI,EAAE;IAAC,CAAC;EACpC;;EAGA,IAAIR,QAAQ,EAAE;IACZF,MAAM,CAACE,QAAQ,CAACO,MAAM,CAAC;IACvB,OAAOP,QAAQ;EACjB;EAEA,OAAOF,MAAM,CAAC,KAAK,CAAC;AACtB"}
@@ -1,6 +1,9 @@
1
- export function normalize(normals = {}, vector) {
2
- normals = this.attributes.normal;
3
1
 
2
+
3
+ export function normalize() {
4
+ let normals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5
+ let vector = arguments.length > 1 ? arguments[1] : undefined;
6
+ normals = this.attributes.normal;
4
7
  for (let i = 0, il = normals.count; i < il; i++) {
5
8
  vector.x = normals.getX(i);
6
9
  vector.y = normals.getY(i);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/geometry/attributes/normalize.ts"],"names":["normalize","normals","vector","attributes","normal","i","il","count","x","getX","y","getY","z","getZ","setXYZ"],"mappings":"AAQA,OAAO,SAASA,SAAT,CAAmBC,OAAY,GAAG,EAAlC,EAAsCC,MAAtC,EAAuD;AAE5DD,EAAAA,OAAO,GAAG,KAAKE,UAAL,CAAgBC,MAA1B;;AACA,OAAK,IAAIC,CAAC,GAAG,CAAR,EAAWC,EAAE,GAAGL,OAAO,CAACM,KAA7B,EAAoCF,CAAC,GAAGC,EAAxC,EAA4CD,CAAC,EAA7C,EAAiD;AAC/CH,IAAAA,MAAM,CAACM,CAAP,GAAWP,OAAO,CAACQ,IAAR,CAAaJ,CAAb,CAAX;AACAH,IAAAA,MAAM,CAACQ,CAAP,GAAWT,OAAO,CAACU,IAAR,CAAaN,CAAb,CAAX;AACAH,IAAAA,MAAM,CAACU,CAAP,GAAWX,OAAO,CAACY,IAAR,CAAaR,CAAb,CAAX;AACAH,IAAAA,MAAM,CAACF,SAAP;AACAC,IAAAA,OAAO,CAACa,MAAR,CAAeT,CAAf,EAAkBH,MAAM,CAACM,CAAzB,EAA4BN,MAAM,CAACQ,CAAnC,EAAsCR,MAAM,CAACU,CAA7C;AACD;AACF","sourcesContent":["/* eslint-disable */\nimport {Vector3} from '@math.gl/core';\n\n/**\n * Setting X, Y, Z for Vector\n * @param normals\n * @param vector\n */\nexport function normalize(normals: any = {}, vector: Vector3) {\n //@ts-ignore\n normals = this.attributes.normal;\n for (let i = 0, il = normals.count; i < il; i++) {\n vector.x = normals.getX(i);\n vector.y = normals.getY(i);\n vector.z = normals.getZ(i);\n vector.normalize();\n normals.setXYZ(i, vector.x, vector.y, vector.z);\n }\n}\n"],"file":"normalize.js"}
1
+ {"version":3,"file":"normalize.js","names":["normalize","normals","vector","attributes","normal","i","il","count","x","getX","y","getY","z","getZ","setXYZ"],"sources":["../../../../src/geometry/attributes/normalize.ts"],"sourcesContent":["/* eslint-disable */\nimport {Vector3} from '@math.gl/core';\n\n/**\n * Setting X, Y, Z for Vector\n * @param normals\n * @param vector\n */\nexport function normalize(normals: any = {}, vector: Vector3) {\n //@ts-ignore\n normals = this.attributes.normal;\n for (let i = 0, il = normals.count; i < il; i++) {\n vector.x = normals.getX(i);\n vector.y = normals.getY(i);\n vector.z = normals.getZ(i);\n vector.normalize();\n normals.setXYZ(i, vector.x, vector.y, vector.z);\n }\n}\n"],"mappings":";;AAQA,OAAO,SAASA,SAAS,GAAqC;EAAA,IAApCC,OAAY,uEAAG,CAAC,CAAC;EAAA,IAAEC,MAAe;EAE1DD,OAAO,GAAG,IAAI,CAACE,UAAU,CAACC,MAAM;EAChC,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEC,EAAE,GAAGL,OAAO,CAACM,KAAK,EAAEF,CAAC,GAAGC,EAAE,EAAED,CAAC,EAAE,EAAE;IAC/CH,MAAM,CAACM,CAAC,GAAGP,OAAO,CAACQ,IAAI,CAACJ,CAAC,CAAC;IAC1BH,MAAM,CAACQ,CAAC,GAAGT,OAAO,CAACU,IAAI,CAACN,CAAC,CAAC;IAC1BH,MAAM,CAACU,CAAC,GAAGX,OAAO,CAACY,IAAI,CAACR,CAAC,CAAC;IAC1BH,MAAM,CAACF,SAAS,EAAE;IAClBC,OAAO,CAACa,MAAM,CAACT,CAAC,EAAEH,MAAM,CAACM,CAAC,EAAEN,MAAM,CAACQ,CAAC,EAAER,MAAM,CAACU,CAAC,CAAC;EACjD;AACF"}
@@ -1,4 +1,6 @@
1
- export function decodeRGB565(rgb565, target = [0, 0, 0]) {
1
+
2
+ export function decodeRGB565(rgb565) {
3
+ let target = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [0, 0, 0];
2
4
  const r5 = rgb565 >> 11 & 31;
3
5
  const g6 = rgb565 >> 5 & 63;
4
6
  const b5 = rgb565 & 31;
@@ -7,6 +9,7 @@ export function decodeRGB565(rgb565, target = [0, 0, 0]) {
7
9
  target[2] = b5 << 3;
8
10
  return target;
9
11
  }
12
+
10
13
  export function encodeRGB565(rgb) {
11
14
  const r5 = Math.floor(rgb[0] / 8) + 4;
12
15
  const g6 = Math.floor(rgb[1] / 4) + 2;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/geometry/colors/rgb565.ts"],"names":["decodeRGB565","rgb565","target","r5","g6","b5","encodeRGB565","rgb","Math","floor"],"mappings":"AAMA,OAAO,SAASA,YAAT,CAAsBC,MAAtB,EAAsCC,MAAgB,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAzD,EAA8E;AACnF,QAAMC,EAAE,GAAIF,MAAM,IAAI,EAAX,GAAiB,EAA5B;AACA,QAAMG,EAAE,GAAIH,MAAM,IAAI,CAAX,GAAgB,EAA3B;AACA,QAAMI,EAAE,GAAGJ,MAAM,GAAG,EAApB;AAEAC,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAYC,EAAE,IAAI,CAAlB;AACAD,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAYE,EAAE,IAAI,CAAlB;AACAF,EAAAA,MAAM,CAAC,CAAD,CAAN,GAAYG,EAAE,IAAI,CAAlB;AAEA,SAAOH,MAAP;AACD;AAOD,OAAO,SAASI,YAAT,CAAsBC,GAAtB,EAA6C;AAClD,QAAMJ,EAAE,GAAGK,IAAI,CAACC,KAAL,CAAWF,GAAG,CAAC,CAAD,CAAH,GAAS,CAApB,IAAyB,CAApC;AACA,QAAMH,EAAE,GAAGI,IAAI,CAACC,KAAL,CAAWF,GAAG,CAAC,CAAD,CAAH,GAAS,CAApB,IAAyB,CAApC;AACA,QAAMF,EAAE,GAAGG,IAAI,CAACC,KAAL,CAAWF,GAAG,CAAC,CAAD,CAAH,GAAS,CAApB,IAAyB,CAApC;AACA,SAAOJ,EAAE,IAAIC,EAAE,IAAI,CAAV,CAAF,IAAkBC,EAAE,IAAI,EAAxB,CAAP;AACD","sourcesContent":["/**\n * Decode color values\n * @param rgb565\n * @param target\n * @returns target\n */\nexport function decodeRGB565(rgb565: number, target: number[] = [0, 0, 0]): number[] {\n const r5 = (rgb565 >> 11) & 31;\n const g6 = (rgb565 >> 5) & 63;\n const b5 = rgb565 & 31;\n\n target[0] = r5 << 3;\n target[1] = g6 << 2;\n target[2] = b5 << 3;\n\n return target;\n}\n\n/**\n * Encode color values\n * @param rgb\n * @returns color\n */\nexport function encodeRGB565(rgb: number[]): number {\n const r5 = Math.floor(rgb[0] / 8) + 4;\n const g6 = Math.floor(rgb[1] / 4) + 2;\n const b5 = Math.floor(rgb[2] / 8) + 4;\n return r5 + (g6 << 5) + (b5 << 11);\n}\n"],"file":"rgb565.js"}
1
+ {"version":3,"file":"rgb565.js","names":["decodeRGB565","rgb565","target","r5","g6","b5","encodeRGB565","rgb","Math","floor"],"sources":["../../../../src/geometry/colors/rgb565.ts"],"sourcesContent":["/**\n * Decode color values\n * @param rgb565\n * @param target\n * @returns target\n */\nexport function decodeRGB565(rgb565: number, target: number[] = [0, 0, 0]): number[] {\n const r5 = (rgb565 >> 11) & 31;\n const g6 = (rgb565 >> 5) & 63;\n const b5 = rgb565 & 31;\n\n target[0] = r5 << 3;\n target[1] = g6 << 2;\n target[2] = b5 << 3;\n\n return target;\n}\n\n/**\n * Encode color values\n * @param rgb\n * @returns color\n */\nexport function encodeRGB565(rgb: number[]): number {\n const r5 = Math.floor(rgb[0] / 8) + 4;\n const g6 = Math.floor(rgb[1] / 4) + 2;\n const b5 = Math.floor(rgb[2] / 8) + 4;\n return r5 + (g6 << 5) + (b5 << 11);\n}\n"],"mappings":";AAMA,OAAO,SAASA,YAAY,CAACC,MAAc,EAA0C;EAAA,IAAxCC,MAAgB,uEAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;EACvE,MAAMC,EAAE,GAAIF,MAAM,IAAI,EAAE,GAAI,EAAE;EAC9B,MAAMG,EAAE,GAAIH,MAAM,IAAI,CAAC,GAAI,EAAE;EAC7B,MAAMI,EAAE,GAAGJ,MAAM,GAAG,EAAE;EAEtBC,MAAM,CAAC,CAAC,CAAC,GAAGC,EAAE,IAAI,CAAC;EACnBD,MAAM,CAAC,CAAC,CAAC,GAAGE,EAAE,IAAI,CAAC;EACnBF,MAAM,CAAC,CAAC,CAAC,GAAGG,EAAE,IAAI,CAAC;EAEnB,OAAOH,MAAM;AACf;;AAOA,OAAO,SAASI,YAAY,CAACC,GAAa,EAAU;EAClD,MAAMJ,EAAE,GAAGK,IAAI,CAACC,KAAK,CAACF,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;EACrC,MAAMH,EAAE,GAAGI,IAAI,CAACC,KAAK,CAACF,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;EACrC,MAAMF,EAAE,GAAGG,IAAI,CAACC,KAAK,CAACF,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC;EACrC,OAAOJ,EAAE,IAAIC,EAAE,IAAI,CAAC,CAAC,IAAIC,EAAE,IAAI,EAAE,CAAC;AACpC"}
@@ -1,3 +1,5 @@
1
+
2
+
1
3
  import { Vector2, Vector3, clamp, _MathUtils } from '@math.gl/core';
2
4
  import { assert } from '../utils/assert';
3
5
  const RIGHT_SHIFT = 1.0 / 256.0;
@@ -13,11 +15,13 @@ function forceUint8(value) {
13
15
  return uint8ForceArray[0];
14
16
  }
15
17
 
16
- function fromSNorm(value, rangeMaximum = 255) {
18
+ function fromSNorm(value) {
19
+ let rangeMaximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
17
20
  return clamp(value, 0.0, rangeMaximum) / rangeMaximum * 2.0 - 1.0;
18
21
  }
19
22
 
20
- function toSNorm(value, rangeMaximum = 255) {
23
+ function toSNorm(value) {
24
+ let rangeMaximum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 255;
21
25
  return Math.round((clamp(value, -1.0, 1.0) * 0.5 + 0.5) * rangeMaximum);
22
26
  }
23
27
 
@@ -32,21 +36,21 @@ export function octEncodeInRange(vector, rangeMax, result) {
32
36
  assert(Math.abs(vector3.magnitudeSquared() - 1.0) <= _MathUtils.EPSILON6);
33
37
  result.x = vector.x / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
34
38
  result.y = vector.y / (Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z));
35
-
36
39
  if (vector.z < 0) {
37
40
  const x = result.x;
38
41
  const y = result.y;
39
42
  result.x = (1.0 - Math.abs(y)) * signNotZero(x);
40
43
  result.y = (1.0 - Math.abs(x)) * signNotZero(y);
41
44
  }
42
-
43
45
  result.x = toSNorm(result.x, rangeMax);
44
46
  result.y = toSNorm(result.y, rangeMax);
45
47
  return result;
46
48
  }
49
+
47
50
  export function octEncode(vector, result) {
48
51
  return octEncodeInRange(vector, 255, result);
49
52
  }
53
+
50
54
  export function octEncodeToVector4(vector, result) {
51
55
  octEncodeInRange(vector, 65535, octEncodeScratch);
52
56
  result.x = forceUint8(octEncodeScratch.x * RIGHT_SHIFT);
@@ -55,28 +59,27 @@ export function octEncodeToVector4(vector, result) {
55
59
  result.w = forceUint8(octEncodeScratch.y);
56
60
  return result;
57
61
  }
62
+
58
63
  export function octDecodeInRange(x, y, rangeMax, result) {
59
64
  assert(result);
60
-
61
65
  if (x < 0 || x > rangeMax || y < 0 || y > rangeMax) {
62
66
  throw new Error("x and y must be unsigned normalized integers between 0 and ".concat(rangeMax));
63
67
  }
64
-
65
68
  result.x = fromSNorm(x, rangeMax);
66
69
  result.y = fromSNorm(y, rangeMax);
67
70
  result.z = 1.0 - (Math.abs(result.x) + Math.abs(result.y));
68
-
69
71
  if (result.z < 0.0) {
70
72
  const oldVX = result.x;
71
73
  result.x = (1.0 - Math.abs(result.y)) * signNotZero(oldVX);
72
74
  result.y = (1.0 - Math.abs(oldVX)) * signNotZero(result.y);
73
75
  }
74
-
75
76
  return result.normalize();
76
77
  }
78
+
77
79
  export function octDecode(x, y, result) {
78
80
  return octDecodeInRange(x, y, 255, result);
79
81
  }
82
+
80
83
  export function octDecodeFromVector4(encoded, result) {
81
84
  assert(encoded);
82
85
  assert(result);
@@ -84,23 +87,24 @@ export function octDecodeFromVector4(encoded, result) {
84
87
  const y = encoded.y;
85
88
  const z = encoded.z;
86
89
  const w = encoded.w;
87
-
88
90
  if (x < 0 || x > 255 || y < 0 || y > 255 || z < 0 || z > 255 || w < 0 || w > 255) {
89
91
  throw new Error('x, y, z, and w must be unsigned normalized integers between 0 and 255');
90
92
  }
91
-
92
93
  const xOct16 = x * LEFT_SHIFT + y;
93
94
  const yOct16 = z * LEFT_SHIFT + w;
94
95
  return octDecodeInRange(xOct16, yOct16, 65535, result);
95
96
  }
97
+
96
98
  export function octPackFloat(encoded) {
97
99
  const vector2 = scratchVector2.from(encoded);
98
100
  return 256.0 * vector2.x + vector2.y;
99
101
  }
102
+
100
103
  export function octEncodeFloat(vector) {
101
104
  octEncode(vector, scratchEncodeVector2);
102
105
  return octPackFloat(scratchEncodeVector2);
103
106
  }
107
+
104
108
  export function octDecodeFloat(value, result) {
105
109
  assert(Number.isFinite(value));
106
110
  const temp = value / 256.0;
@@ -108,6 +112,7 @@ export function octDecodeFloat(value, result) {
108
112
  const y = (temp - x) * 256.0;
109
113
  return octDecode(x, y, result);
110
114
  }
115
+
111
116
  export function octPack(v1, v2, v3, result) {
112
117
  assert(v1);
113
118
  assert(v2);
@@ -120,6 +125,7 @@ export function octPack(v1, v2, v3, result) {
120
125
  result.y = 65536.0 * encoded3.y + encoded2;
121
126
  return result;
122
127
  }
128
+
123
129
  export function octUnpack(packed, v1, v2, v3) {
124
130
  let temp = packed.x / 65536.0;
125
131
  const x = Math.floor(temp);
@@ -131,11 +137,13 @@ export function octUnpack(packed, v1, v2, v3) {
131
137
  octDecodeFloat(encodedFloat2, v2);
132
138
  octDecode(x, y, v3);
133
139
  }
140
+
134
141
  export function compressTextureCoordinates(textureCoordinates) {
135
142
  const x = textureCoordinates.x * 4095.0 | 0;
136
143
  const y = textureCoordinates.y * 4095.0 | 0;
137
144
  return 4096.0 * x + y;
138
145
  }
146
+
139
147
  export function decompressTextureCoordinates(compressed, result) {
140
148
  const temp = compressed / 4096.0;
141
149
  const xZeroTo4095 = Math.floor(temp);
@@ -143,29 +151,25 @@ export function decompressTextureCoordinates(compressed, result) {
143
151
  result.y = (compressed - xZeroTo4095 * 4096) / 4095;
144
152
  return result;
145
153
  }
154
+
146
155
  export function zigZagDeltaDecode(uBuffer, vBuffer, heightBuffer) {
147
156
  assert(uBuffer);
148
157
  assert(vBuffer);
149
158
  assert(uBuffer.length === vBuffer.length);
150
-
151
159
  if (heightBuffer) {
152
160
  assert(uBuffer.length === heightBuffer.length);
153
161
  }
154
-
155
162
  function zigZagDecode(value) {
156
163
  return value >> 1 ^ -(value & 1);
157
164
  }
158
-
159
165
  let u = 0;
160
166
  let v = 0;
161
167
  let height = 0;
162
-
163
168
  for (let i = 0; i < uBuffer.length; ++i) {
164
169
  u += zigZagDecode(uBuffer[i]);
165
170
  v += zigZagDecode(vBuffer[i]);
166
171
  uBuffer[i] = u;
167
172
  vBuffer[i] = v;
168
-
169
173
  if (heightBuffer) {
170
174
  height += zigZagDecode(heightBuffer[i]);
171
175
  heightBuffer[i] = height;