twgl.js 5.0.4 → 5.1.0

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.
@@ -1,4 +1,4 @@
1
- /* @license twgl.js 5.0.4 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
1
+ /* @license twgl.js 5.1.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
2
  Available via the MIT license.
3
3
  see: http://github.com/greggman/twgl.js for details */
4
4
  /*
@@ -63,7 +63,7 @@ let VecType = Float32Array;
63
63
  * @return {constructor} previous constructor for Vec3
64
64
  * @memberOf module:twgl/v3
65
65
  */
66
- function setDefaultType(ctor) {
66
+ function setDefaultType$1(ctor) {
67
67
  const oldType = VecType;
68
68
  VecType = ctor;
69
69
  return oldType;
@@ -77,7 +77,7 @@ function setDefaultType(ctor) {
77
77
  * @return {module:twgl/v3.Vec3} the created vector
78
78
  * @memberOf module:twgl/v3
79
79
  */
80
- function create(x, y, z) {
80
+ function create$1(x, y, z) {
81
81
  const dst = new VecType(3);
82
82
  if (x) {
83
83
  dst[0] = x;
@@ -358,7 +358,7 @@ function normalize(a, dst) {
358
358
  * @return {module:twgl/v3.Vec3} -v.
359
359
  * @memberOf module:twgl/v3
360
360
  */
361
- function negate(v, dst) {
361
+ function negate$1(v, dst) {
362
362
  dst = dst || new VecType(3);
363
363
 
364
364
  dst[0] = -v[0];
@@ -375,7 +375,7 @@ function negate(v, dst) {
375
375
  * @return {module:twgl/v3.Vec3} A copy of v.
376
376
  * @memberOf module:twgl/v3
377
377
  */
378
- function copy(v, dst) {
378
+ function copy$1(v, dst) {
379
379
  dst = dst || new VecType(3);
380
380
 
381
381
  dst[0] = v[0];
@@ -395,7 +395,7 @@ function copy(v, dst) {
395
395
  * b.
396
396
  * @memberOf module:twgl/v3
397
397
  */
398
- function multiply(a, b, dst) {
398
+ function multiply$1(a, b, dst) {
399
399
  dst = dst || new VecType(3);
400
400
 
401
401
  dst[0] = a[0] * b[0];
@@ -428,8 +428,8 @@ function divide(a, b, dst) {
428
428
  var v3 = /*#__PURE__*/Object.freeze({
429
429
  __proto__: null,
430
430
  add: add,
431
- copy: copy,
432
- create: create,
431
+ copy: copy$1,
432
+ create: create$1,
433
433
  cross: cross,
434
434
  distance: distance,
435
435
  distanceSq: distanceSq,
@@ -443,10 +443,10 @@ var v3 = /*#__PURE__*/Object.freeze({
443
443
  max: max,
444
444
  min: min,
445
445
  mulScalar: mulScalar,
446
- multiply: multiply,
447
- negate: negate,
446
+ multiply: multiply$1,
447
+ negate: negate$1,
448
448
  normalize: normalize,
449
- setDefaultType: setDefaultType,
449
+ setDefaultType: setDefaultType$1,
450
450
  subtract: subtract
451
451
  });
452
452
 
@@ -512,7 +512,7 @@ let MatType = Float32Array;
512
512
  * @return {constructor} previous constructor for Mat4
513
513
  * @memberOf module:twgl/m4
514
514
  */
515
- function setDefaultType$1(ctor) {
515
+ function setDefaultType(ctor) {
516
516
  const oldType = MatType;
517
517
  MatType = ctor;
518
518
  return oldType;
@@ -525,7 +525,7 @@ function setDefaultType$1(ctor) {
525
525
  * @return {module:twgl/m4.Mat4} -m.
526
526
  * @memberOf module:twgl/m4
527
527
  */
528
- function negate$1(m, dst) {
528
+ function negate(m, dst) {
529
529
  dst = dst || new MatType(16);
530
530
 
531
531
  dst[ 0] = -m[ 0];
@@ -553,7 +553,7 @@ function negate$1(m, dst) {
553
553
  * @return {module:twgl/m4.Mat4} A new matrix.
554
554
  * @memberOf module:twgl/m4
555
555
  */
556
- function create$1() {
556
+ function create() {
557
557
  return new MatType(16).fill(0);
558
558
  }
559
559
 
@@ -564,7 +564,7 @@ function create$1() {
564
564
  * @return {module:twgl/m4.Mat4} A copy of m.
565
565
  * @memberOf module:twgl/m4
566
566
  */
567
- function copy$1(m, dst) {
567
+ function copy(m, dst) {
568
568
  dst = dst || new MatType(16);
569
569
 
570
570
  dst[ 0] = m[ 0];
@@ -794,7 +794,7 @@ function inverse(m, dst) {
794
794
  * @return {module:twgl/m4.Mat4} The matrix product of a and b.
795
795
  * @memberOf module:twgl/m4
796
796
  */
797
- function multiply$1(a, b, dst) {
797
+ function multiply(a, b, dst) {
798
798
  dst = dst || new MatType(16);
799
799
 
800
800
  const a00 = a[0];
@@ -891,7 +891,7 @@ function setTranslation(a, v, dst) {
891
891
  * @memberOf module:twgl/m4
892
892
  */
893
893
  function getTranslation(m, dst) {
894
- dst = dst || create();
894
+ dst = dst || create$1();
895
895
  dst[0] = m[12];
896
896
  dst[1] = m[13];
897
897
  dst[2] = m[14];
@@ -907,7 +907,7 @@ function getTranslation(m, dst) {
907
907
  * @memberOf module:twgl/m4
908
908
  */
909
909
  function getAxis(m, axis, dst) {
910
- dst = dst || create();
910
+ dst = dst || create$1();
911
911
  const off = axis * 4;
912
912
  dst[0] = m[off + 0];
913
913
  dst[1] = m[off + 1];
@@ -926,7 +926,7 @@ function getAxis(m, axis, dst) {
926
926
  */
927
927
  function setAxis(a, v, axis, dst) {
928
928
  if (dst !== a) {
929
- dst = copy$1(a, dst);
929
+ dst = copy(a, dst);
930
930
  }
931
931
  const off = axis * 4;
932
932
  dst[off + 0] = v[0];
@@ -1094,9 +1094,9 @@ let zAxis;
1094
1094
  function lookAt(eye, target, up, dst) {
1095
1095
  dst = dst || new MatType(16);
1096
1096
 
1097
- xAxis = xAxis || create();
1098
- yAxis = yAxis || create();
1099
- zAxis = zAxis || create();
1097
+ xAxis = xAxis || create$1();
1098
+ yAxis = yAxis || create$1();
1099
+ zAxis = zAxis || create$1();
1100
1100
 
1101
1101
  normalize(
1102
1102
  subtract(eye, target, zAxis), zAxis);
@@ -1652,7 +1652,7 @@ function scale(m, v, dst) {
1652
1652
  * @memberOf module:twgl/m4
1653
1653
  */
1654
1654
  function transformPoint(m, v, dst) {
1655
- dst = dst || create();
1655
+ dst = dst || create$1();
1656
1656
  const v0 = v[0];
1657
1657
  const v1 = v[1];
1658
1658
  const v2 = v[2];
@@ -1679,7 +1679,7 @@ function transformPoint(m, v, dst) {
1679
1679
  * @memberOf module:twgl/m4
1680
1680
  */
1681
1681
  function transformDirection(m, v, dst) {
1682
- dst = dst || create();
1682
+ dst = dst || create$1();
1683
1683
 
1684
1684
  const v0 = v[0];
1685
1685
  const v1 = v[1];
@@ -1707,8 +1707,8 @@ function transformDirection(m, v, dst) {
1707
1707
  * @return {module:twgl/v3.Vec3} The transformed normal.
1708
1708
  * @memberOf module:twgl/m4
1709
1709
  */
1710
- function transformNormal(m, v, dst) {
1711
- dst = dst || create();
1710
+ function transformNormal$1(m, v, dst) {
1711
+ dst = dst || create$1();
1712
1712
  const mi = inverse(m);
1713
1713
  const v0 = v[0];
1714
1714
  const v1 = v[1];
@@ -1725,16 +1725,16 @@ var m4 = /*#__PURE__*/Object.freeze({
1725
1725
  __proto__: null,
1726
1726
  axisRotate: axisRotate,
1727
1727
  axisRotation: axisRotation,
1728
- copy: copy$1,
1729
- create: create$1,
1728
+ copy: copy,
1729
+ create: create,
1730
1730
  frustum: frustum,
1731
1731
  getAxis: getAxis,
1732
1732
  getTranslation: getTranslation,
1733
1733
  identity: identity,
1734
1734
  inverse: inverse,
1735
1735
  lookAt: lookAt,
1736
- multiply: multiply$1,
1737
- negate: negate$1,
1736
+ multiply: multiply,
1737
+ negate: negate,
1738
1738
  ortho: ortho,
1739
1739
  perspective: perspective,
1740
1740
  rotateX: rotateX,
@@ -1746,10 +1746,10 @@ var m4 = /*#__PURE__*/Object.freeze({
1746
1746
  scale: scale,
1747
1747
  scaling: scaling,
1748
1748
  setAxis: setAxis,
1749
- setDefaultType: setDefaultType$1,
1749
+ setDefaultType: setDefaultType,
1750
1750
  setTranslation: setTranslation,
1751
1751
  transformDirection: transformDirection,
1752
- transformNormal: transformNormal,
1752
+ transformNormal: transformNormal$1,
1753
1753
  transformPoint: transformPoint,
1754
1754
  translate: translate,
1755
1755
  translation: translation,
@@ -1779,42 +1779,42 @@ var m4 = /*#__PURE__*/Object.freeze({
1779
1779
  */
1780
1780
 
1781
1781
  /* DataType */
1782
- const BYTE = 0x1400;
1783
- const UNSIGNED_BYTE = 0x1401;
1784
- const SHORT = 0x1402;
1785
- const UNSIGNED_SHORT = 0x1403;
1786
- const INT = 0x1404;
1787
- const UNSIGNED_INT = 0x1405;
1788
- const FLOAT = 0x1406;
1789
- const UNSIGNED_SHORT_4_4_4_4 = 0x8033;
1790
- const UNSIGNED_SHORT_5_5_5_1 = 0x8034;
1791
- const UNSIGNED_SHORT_5_6_5 = 0x8363;
1792
- const HALF_FLOAT = 0x140B;
1793
- const UNSIGNED_INT_2_10_10_10_REV = 0x8368;
1794
- const UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
1795
- const UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
1796
- const FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
1797
- const UNSIGNED_INT_24_8 = 0x84FA;
1782
+ const BYTE$2 = 0x1400;
1783
+ const UNSIGNED_BYTE$3 = 0x1401;
1784
+ const SHORT$2 = 0x1402;
1785
+ const UNSIGNED_SHORT$3 = 0x1403;
1786
+ const INT$3 = 0x1404;
1787
+ const UNSIGNED_INT$3 = 0x1405;
1788
+ const FLOAT$3 = 0x1406;
1789
+ const UNSIGNED_SHORT_4_4_4_4$1 = 0x8033;
1790
+ const UNSIGNED_SHORT_5_5_5_1$1 = 0x8034;
1791
+ const UNSIGNED_SHORT_5_6_5$1 = 0x8363;
1792
+ const HALF_FLOAT$1 = 0x140B;
1793
+ const UNSIGNED_INT_2_10_10_10_REV$1 = 0x8368;
1794
+ const UNSIGNED_INT_10F_11F_11F_REV$1 = 0x8C3B;
1795
+ const UNSIGNED_INT_5_9_9_9_REV$1 = 0x8C3E;
1796
+ const FLOAT_32_UNSIGNED_INT_24_8_REV$1 = 0x8DAD;
1797
+ const UNSIGNED_INT_24_8$1 = 0x84FA;
1798
1798
 
1799
1799
  const glTypeToTypedArray = {};
1800
1800
  {
1801
1801
  const tt = glTypeToTypedArray;
1802
- tt[BYTE] = Int8Array;
1803
- tt[UNSIGNED_BYTE] = Uint8Array;
1804
- tt[SHORT] = Int16Array;
1805
- tt[UNSIGNED_SHORT] = Uint16Array;
1806
- tt[INT] = Int32Array;
1807
- tt[UNSIGNED_INT] = Uint32Array;
1808
- tt[FLOAT] = Float32Array;
1809
- tt[UNSIGNED_SHORT_4_4_4_4] = Uint16Array;
1810
- tt[UNSIGNED_SHORT_5_5_5_1] = Uint16Array;
1811
- tt[UNSIGNED_SHORT_5_6_5] = Uint16Array;
1812
- tt[HALF_FLOAT] = Uint16Array;
1813
- tt[UNSIGNED_INT_2_10_10_10_REV] = Uint32Array;
1814
- tt[UNSIGNED_INT_10F_11F_11F_REV] = Uint32Array;
1815
- tt[UNSIGNED_INT_5_9_9_9_REV] = Uint32Array;
1816
- tt[FLOAT_32_UNSIGNED_INT_24_8_REV] = Uint32Array;
1817
- tt[UNSIGNED_INT_24_8] = Uint32Array;
1802
+ tt[BYTE$2] = Int8Array;
1803
+ tt[UNSIGNED_BYTE$3] = Uint8Array;
1804
+ tt[SHORT$2] = Int16Array;
1805
+ tt[UNSIGNED_SHORT$3] = Uint16Array;
1806
+ tt[INT$3] = Int32Array;
1807
+ tt[UNSIGNED_INT$3] = Uint32Array;
1808
+ tt[FLOAT$3] = Float32Array;
1809
+ tt[UNSIGNED_SHORT_4_4_4_4$1] = Uint16Array;
1810
+ tt[UNSIGNED_SHORT_5_5_5_1$1] = Uint16Array;
1811
+ tt[UNSIGNED_SHORT_5_6_5$1] = Uint16Array;
1812
+ tt[HALF_FLOAT$1] = Uint16Array;
1813
+ tt[UNSIGNED_INT_2_10_10_10_REV$1] = Uint32Array;
1814
+ tt[UNSIGNED_INT_10F_11F_11F_REV$1] = Uint32Array;
1815
+ tt[UNSIGNED_INT_5_9_9_9_REV$1] = Uint32Array;
1816
+ tt[FLOAT_32_UNSIGNED_INT_24_8_REV$1] = Uint32Array;
1817
+ tt[UNSIGNED_INT_24_8$1] = Uint32Array;
1818
1818
  }
1819
1819
 
1820
1820
  /**
@@ -1825,14 +1825,14 @@ const glTypeToTypedArray = {};
1825
1825
  * @memberOf module:twgl/typedArray
1826
1826
  */
1827
1827
  function getGLTypeForTypedArray(typedArray) {
1828
- if (typedArray instanceof Int8Array) { return BYTE; } // eslint-disable-line
1829
- if (typedArray instanceof Uint8Array) { return UNSIGNED_BYTE; } // eslint-disable-line
1830
- if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE; } // eslint-disable-line
1831
- if (typedArray instanceof Int16Array) { return SHORT; } // eslint-disable-line
1832
- if (typedArray instanceof Uint16Array) { return UNSIGNED_SHORT; } // eslint-disable-line
1833
- if (typedArray instanceof Int32Array) { return INT; } // eslint-disable-line
1834
- if (typedArray instanceof Uint32Array) { return UNSIGNED_INT; } // eslint-disable-line
1835
- if (typedArray instanceof Float32Array) { return FLOAT; } // eslint-disable-line
1828
+ if (typedArray instanceof Int8Array) { return BYTE$2; } // eslint-disable-line
1829
+ if (typedArray instanceof Uint8Array) { return UNSIGNED_BYTE$3; } // eslint-disable-line
1830
+ if (typedArray instanceof Uint8ClampedArray) { return UNSIGNED_BYTE$3; } // eslint-disable-line
1831
+ if (typedArray instanceof Int16Array) { return SHORT$2; } // eslint-disable-line
1832
+ if (typedArray instanceof Uint16Array) { return UNSIGNED_SHORT$3; } // eslint-disable-line
1833
+ if (typedArray instanceof Int32Array) { return INT$3; } // eslint-disable-line
1834
+ if (typedArray instanceof Uint32Array) { return UNSIGNED_INT$3; } // eslint-disable-line
1835
+ if (typedArray instanceof Float32Array) { return FLOAT$3; } // eslint-disable-line
1836
1836
  throw new Error('unsupported typed array type');
1837
1837
  }
1838
1838
 
@@ -1844,14 +1844,14 @@ function getGLTypeForTypedArray(typedArray) {
1844
1844
  * @memberOf module:twgl/typedArray
1845
1845
  */
1846
1846
  function getGLTypeForTypedArrayType(typedArrayType) {
1847
- if (typedArrayType === Int8Array) { return BYTE; } // eslint-disable-line
1848
- if (typedArrayType === Uint8Array) { return UNSIGNED_BYTE; } // eslint-disable-line
1849
- if (typedArrayType === Uint8ClampedArray) { return UNSIGNED_BYTE; } // eslint-disable-line
1850
- if (typedArrayType === Int16Array) { return SHORT; } // eslint-disable-line
1851
- if (typedArrayType === Uint16Array) { return UNSIGNED_SHORT; } // eslint-disable-line
1852
- if (typedArrayType === Int32Array) { return INT; } // eslint-disable-line
1853
- if (typedArrayType === Uint32Array) { return UNSIGNED_INT; } // eslint-disable-line
1854
- if (typedArrayType === Float32Array) { return FLOAT; } // eslint-disable-line
1847
+ if (typedArrayType === Int8Array) { return BYTE$2; } // eslint-disable-line
1848
+ if (typedArrayType === Uint8Array) { return UNSIGNED_BYTE$3; } // eslint-disable-line
1849
+ if (typedArrayType === Uint8ClampedArray) { return UNSIGNED_BYTE$3; } // eslint-disable-line
1850
+ if (typedArrayType === Int16Array) { return SHORT$2; } // eslint-disable-line
1851
+ if (typedArrayType === Uint16Array) { return UNSIGNED_SHORT$3; } // eslint-disable-line
1852
+ if (typedArrayType === Int32Array) { return INT$3; } // eslint-disable-line
1853
+ if (typedArrayType === Uint32Array) { return UNSIGNED_INT$3; } // eslint-disable-line
1854
+ if (typedArrayType === Float32Array) { return FLOAT$3; } // eslint-disable-line
1855
1855
  throw new Error('unsupported typed array type');
1856
1856
  }
1857
1857
 
@@ -1869,7 +1869,7 @@ function getTypedArrayTypeForGLType(type) {
1869
1869
  return CTOR;
1870
1870
  }
1871
1871
 
1872
- const isArrayBuffer = typeof SharedArrayBuffer !== 'undefined'
1872
+ const isArrayBuffer$1 = typeof SharedArrayBuffer !== 'undefined'
1873
1873
  ? function isArrayBufferOrSharedArrayBuffer(a) {
1874
1874
  return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);
1875
1875
  }
@@ -1882,7 +1882,7 @@ var typedarrays = /*#__PURE__*/Object.freeze({
1882
1882
  getGLTypeForTypedArray: getGLTypeForTypedArray,
1883
1883
  getGLTypeForTypedArrayType: getGLTypeForTypedArrayType,
1884
1884
  getTypedArrayTypeForGLType: getTypedArrayTypeForGLType,
1885
- isArrayBuffer: isArrayBuffer
1885
+ isArrayBuffer: isArrayBuffer$1
1886
1886
  });
1887
1887
 
1888
1888
  /*
@@ -1941,11 +1941,11 @@ function copyExistingProperties(src, dst) {
1941
1941
  });
1942
1942
  }
1943
1943
 
1944
- function error(...args) {
1944
+ function error$1(...args) {
1945
1945
  console.error(...args);
1946
1946
  }
1947
1947
 
1948
- function warn(...args) {
1948
+ function warn$1(...args) {
1949
1949
  console.warn(...args);
1950
1950
  }
1951
1951
 
@@ -2012,18 +2012,18 @@ function isSampler(gl, t) {
2012
2012
  */
2013
2013
 
2014
2014
  const STATIC_DRAW = 0x88e4;
2015
- const ARRAY_BUFFER = 0x8892;
2016
- const ELEMENT_ARRAY_BUFFER = 0x8893;
2015
+ const ARRAY_BUFFER$1 = 0x8892;
2016
+ const ELEMENT_ARRAY_BUFFER$2 = 0x8893;
2017
2017
  const BUFFER_SIZE = 0x8764;
2018
2018
 
2019
2019
  const BYTE$1 = 0x1400;
2020
- const UNSIGNED_BYTE$1 = 0x1401;
2020
+ const UNSIGNED_BYTE$2 = 0x1401;
2021
2021
  const SHORT$1 = 0x1402;
2022
- const UNSIGNED_SHORT$1 = 0x1403;
2023
- const INT$1 = 0x1404;
2024
- const UNSIGNED_INT$1 = 0x1405;
2025
- const FLOAT$1 = 0x1406;
2026
- const defaults = {
2022
+ const UNSIGNED_SHORT$2 = 0x1403;
2023
+ const INT$2 = 0x1404;
2024
+ const UNSIGNED_INT$2 = 0x1405;
2025
+ const FLOAT$2 = 0x1406;
2026
+ const defaults$2 = {
2027
2027
  attribPrefix: "",
2028
2028
  };
2029
2029
 
@@ -2048,11 +2048,11 @@ const defaults = {
2048
2048
  * @memberOf module:twgl/attributes
2049
2049
  */
2050
2050
  function setAttributePrefix(prefix) {
2051
- defaults.attribPrefix = prefix;
2051
+ defaults$2.attribPrefix = prefix;
2052
2052
  }
2053
2053
 
2054
- function setDefaults(newDefaults) {
2055
- copyExistingProperties(newDefaults, defaults);
2054
+ function setDefaults$2(newDefaults) {
2055
+ copyExistingProperties(newDefaults, defaults$2);
2056
2056
  }
2057
2057
 
2058
2058
  function setBufferFromTypedArray(gl, type, buffer, array, drawType) {
@@ -2075,7 +2075,7 @@ function createBufferFromTypedArray(gl, typedArray, type, drawType) {
2075
2075
  if (isBuffer(gl, typedArray)) {
2076
2076
  return typedArray;
2077
2077
  }
2078
- type = type || ARRAY_BUFFER;
2078
+ type = type || ARRAY_BUFFER$1;
2079
2079
  const buffer = gl.createBuffer();
2080
2080
  setBufferFromTypedArray(gl, type, buffer, typedArray, drawType);
2081
2081
  return buffer;
@@ -2085,14 +2085,6 @@ function isIndices(name) {
2085
2085
  return name === "indices";
2086
2086
  }
2087
2087
 
2088
- // This is really just a guess. Though I can't really imagine using
2089
- // anything else? Maybe for some compression?
2090
- function getNormalizationForTypedArray(typedArray) {
2091
- if (typedArray instanceof Int8Array) { return true; } // eslint-disable-line
2092
- if (typedArray instanceof Uint8Array) { return true; } // eslint-disable-line
2093
- return false;
2094
- }
2095
-
2096
2088
  // This is really just a guess. Though I can't really imagine using
2097
2089
  // anything else? Maybe for some compression?
2098
2090
  function getNormalizationForTypedArrayType(typedArrayType) {
@@ -2101,7 +2093,7 @@ function getNormalizationForTypedArrayType(typedArrayType) {
2101
2093
  return false;
2102
2094
  }
2103
2095
 
2104
- function getArray(array) {
2096
+ function getArray$1(array) {
2105
2097
  return array.length ? array : array.data;
2106
2098
  }
2107
2099
 
@@ -2125,16 +2117,16 @@ function guessNumComponentsFromName(name, length) {
2125
2117
  return numComponents;
2126
2118
  }
2127
2119
 
2128
- function getNumComponents(array, arrayName) {
2129
- return array.numComponents || array.size || guessNumComponentsFromName(arrayName, getArray(array).length);
2120
+ function getNumComponents$1(array, arrayName, numValues) {
2121
+ return array.numComponents || array.size || guessNumComponentsFromName(arrayName, numValues || getArray$1(array).length);
2130
2122
  }
2131
2123
 
2132
2124
  function makeTypedArray(array, name) {
2133
- if (isArrayBuffer(array)) {
2125
+ if (isArrayBuffer$1(array)) {
2134
2126
  return array;
2135
2127
  }
2136
2128
 
2137
- if (isArrayBuffer(array.data)) {
2129
+ if (isArrayBuffer$1(array.data)) {
2138
2130
  return array.data;
2139
2131
  }
2140
2132
 
@@ -2144,7 +2136,7 @@ function makeTypedArray(array, name) {
2144
2136
  };
2145
2137
  }
2146
2138
 
2147
- let Type = array.type;
2139
+ let Type = array.type ? typedArrayTypeFromGLTypeOrTypedArrayCtor(array.type) : undefined;
2148
2140
  if (!Type) {
2149
2141
  if (isIndices(name)) {
2150
2142
  Type = Uint16Array;
@@ -2155,6 +2147,52 @@ function makeTypedArray(array, name) {
2155
2147
  return new Type(array.data);
2156
2148
  }
2157
2149
 
2150
+ function glTypeFromGLTypeOrTypedArrayType(glTypeOrTypedArrayCtor) {
2151
+ return typeof glTypeOrTypedArrayCtor === 'number'
2152
+ ? glTypeOrTypedArrayCtor
2153
+ : glTypeOrTypedArrayCtor ? getGLTypeForTypedArrayType(glTypeOrTypedArrayCtor) : FLOAT$2;
2154
+ }
2155
+
2156
+ function typedArrayTypeFromGLTypeOrTypedArrayCtor(glTypeOrTypedArrayCtor) {
2157
+ return typeof glTypeOrTypedArrayCtor === 'number'
2158
+ ? getTypedArrayTypeForGLType(glTypeOrTypedArrayCtor)
2159
+ : glTypeOrTypedArrayCtor || Float32Array;
2160
+ }
2161
+
2162
+ function attribBufferFromBuffer(gl, array/*, arrayName */) {
2163
+ return {
2164
+ buffer: array.buffer,
2165
+ numValues: 2 * 3 * 4, // safely divided by 2, 3, 4
2166
+ type: glTypeFromGLTypeOrTypedArrayType(array.type),
2167
+ arrayType: typedArrayTypeFromGLTypeOrTypedArrayCtor(array.type),
2168
+ };
2169
+ }
2170
+
2171
+ function attribBufferFromSize(gl, array/*, arrayName*/) {
2172
+ const numValues = array.data || array;
2173
+ const arrayType = typedArrayTypeFromGLTypeOrTypedArrayCtor(array.type);
2174
+ const numBytes = numValues * arrayType.BYTES_PER_ELEMENT;
2175
+ const buffer = gl.createBuffer();
2176
+ gl.bindBuffer(ARRAY_BUFFER$1, buffer);
2177
+ gl.bufferData(ARRAY_BUFFER$1, numBytes, array.drawType || STATIC_DRAW);
2178
+ return {
2179
+ buffer,
2180
+ numValues,
2181
+ type: getGLTypeForTypedArrayType(arrayType),
2182
+ arrayType,
2183
+ };
2184
+ }
2185
+
2186
+ function attribBufferFromArrayLike(gl, array, arrayName) {
2187
+ const typedArray = makeTypedArray(array, arrayName);
2188
+ return {
2189
+ arrayType: typedArray.constructor,
2190
+ buffer: createBufferFromTypedArray(gl, typedArray, undefined, array.drawType),
2191
+ type: getGLTypeForTypedArray(typedArray),
2192
+ numValues: 0,
2193
+ };
2194
+ }
2195
+
2158
2196
  /**
2159
2197
  * The info for an attribute. This is effectively just the arguments to `gl.vertexAttribPointer` plus the WebGLBuffer
2160
2198
  * for the attribute.
@@ -2170,24 +2208,29 @@ function makeTypedArray(array, name) {
2170
2208
  * @property {number} [stride] the stride in bytes per element. Default = 0
2171
2209
  * @property {number} [divisor] the divisor in instances. Default = 0.
2172
2210
  * Requires WebGL2 or the ANGLE_instanced_arrays extension.
2173
- * and, if you using WebGL1 you must have called {@link module:twgl.addExtensionsToContext}
2211
+ * and, if you're using WebGL1 you must have called {@link module:twgl.addExtensionsToContext}
2174
2212
  * @property {WebGLBuffer} buffer the buffer that contains the data for this attribute
2175
2213
  * @property {number} [drawType] the draw type passed to gl.bufferData. Default = gl.STATIC_DRAW
2176
2214
  * @memberOf module:twgl
2177
2215
  */
2178
2216
 
2217
+ /**
2218
+ * @typedef {(Int8ArrayConstructor|Uint8ArrayConstructor|Int16ArrayConstructor|Uint16ArrayConstructor|Int32ArrayConstructor|Uint32ArrayConstructor|Float32ArrayConstructor)} TypedArrayConstructor
2219
+ */
2220
+
2179
2221
  /**
2180
2222
  * Use this type of array spec when TWGL can't guess the type or number of components of an array
2181
2223
  * @typedef {Object} FullArraySpec
2182
2224
  * @property {number[]|ArrayBufferView} [value] a constant value for the attribute. Note: if this is set the attribute will be
2183
2225
  * disabled and set to this constant value and all other values will be ignored.
2184
- * @property {(number|number[]|ArrayBufferView)} data The data of the array. A number alone becomes the number of elements of type.
2226
+ * @property {(number|number[]|ArrayBufferView)} [data] The data of the array. A number alone becomes the number of elements of type.
2185
2227
  * @property {number} [numComponents] number of components for `vertexAttribPointer`. Default is based on the name of the array.
2186
2228
  * If `coord` is in the name assumes `numComponents = 2`.
2187
2229
  * If `color` is in the name assumes `numComponents = 4`.
2188
2230
  * otherwise assumes `numComponents = 3`
2189
- * @property {constructor} [type] type. This is only used if `data` is a JavaScript array. It is the constructor for the typedarray. (eg. `Uint8Array`).
2190
- * For example if you want colors in a `Uint8Array` you might have a `FullArraySpec` like `{ type: Uint8Array, data: [255,0,255,255, ...], }`.
2231
+ * @property {number|TypedArrayConstructor} [type] type. This is used if `data` is a JavaScript array, or `buffer` is passed in, or `data` is a number.
2232
+ * It can either be the constructor for a typedarray. (eg. `Uint8Array`) OR a WebGL type, (eg `gl.UNSIGNED_BYTE`).
2233
+ * For example if you want colors in a `Uint8Array` you might have a `FullArraySpec` like `{ type: gl.UNSIGNED_BYTE, data: [255,0,255,255, ...], }`.
2191
2234
  * @property {number} [size] synonym for `numComponents`.
2192
2235
  * @property {boolean} [normalize] normalize for `vertexAttribPointer`. Default is true if type is `Int8Array` or `Uint8Array` otherwise false.
2193
2236
  * @property {number} [stride] stride for `vertexAttribPointer`. Default = 0
@@ -2328,41 +2371,26 @@ function createAttribsFromArrays(gl, arrays) {
2328
2371
  Object.keys(arrays).forEach(function(arrayName) {
2329
2372
  if (!isIndices(arrayName)) {
2330
2373
  const array = arrays[arrayName];
2331
- const attribName = array.attrib || array.name || array.attribName || (defaults.attribPrefix + arrayName);
2374
+ const attribName = array.attrib || array.name || array.attribName || (defaults$2.attribPrefix + arrayName);
2332
2375
  if (array.value) {
2333
- if (!Array.isArray(array.value) && !isArrayBuffer(array.value)) {
2376
+ if (!Array.isArray(array.value) && !isArrayBuffer$1(array.value)) {
2334
2377
  throw new Error('array.value is not array or typedarray');
2335
2378
  }
2336
2379
  attribs[attribName] = {
2337
2380
  value: array.value,
2338
2381
  };
2339
2382
  } else {
2340
- let buffer;
2341
- let type;
2342
- let normalization;
2343
- let numComponents;
2383
+ let fn;
2344
2384
  if (array.buffer && array.buffer instanceof WebGLBuffer) {
2345
- buffer = array.buffer;
2346
- numComponents = array.numComponents || array.size;
2347
- type = array.type;
2348
- normalization = array.normalize;
2385
+ fn = attribBufferFromBuffer;
2349
2386
  } else if (typeof array === "number" || typeof array.data === "number") {
2350
- const numValues = array.data || array;
2351
- const arrayType = array.type || Float32Array;
2352
- const numBytes = numValues * arrayType.BYTES_PER_ELEMENT;
2353
- type = getGLTypeForTypedArrayType(arrayType);
2354
- normalization = array.normalize !== undefined ? array.normalize : getNormalizationForTypedArrayType(arrayType);
2355
- numComponents = array.numComponents || array.size || guessNumComponentsFromName(arrayName, numValues);
2356
- buffer = gl.createBuffer();
2357
- gl.bindBuffer(ARRAY_BUFFER, buffer);
2358
- gl.bufferData(ARRAY_BUFFER, numBytes, array.drawType || STATIC_DRAW);
2387
+ fn = attribBufferFromSize;
2359
2388
  } else {
2360
- const typedArray = makeTypedArray(array, arrayName);
2361
- buffer = createBufferFromTypedArray(gl, typedArray, undefined, array.drawType);
2362
- type = getGLTypeForTypedArray(typedArray);
2363
- normalization = array.normalize !== undefined ? array.normalize : getNormalizationForTypedArray(typedArray);
2364
- numComponents = getNumComponents(array, arrayName);
2389
+ fn = attribBufferFromArrayLike;
2365
2390
  }
2391
+ const {buffer, type, numValues, arrayType} = fn(gl, array, arrayName);
2392
+ const normalization = array.normalize !== undefined ? array.normalize : getNormalizationForTypedArrayType(arrayType);
2393
+ const numComponents = getNumComponents$1(array, arrayName, numValues);
2366
2394
  attribs[attribName] = {
2367
2395
  buffer: buffer,
2368
2396
  numComponents: numComponents,
@@ -2376,7 +2404,7 @@ function createAttribsFromArrays(gl, arrays) {
2376
2404
  }
2377
2405
  }
2378
2406
  });
2379
- gl.bindBuffer(ARRAY_BUFFER, null);
2407
+ gl.bindBuffer(ARRAY_BUFFER$1, null);
2380
2408
  return attribs;
2381
2409
  }
2382
2410
 
@@ -2419,21 +2447,21 @@ function createAttribsFromArrays(gl, arrays) {
2419
2447
  function setAttribInfoBufferFromArray(gl, attribInfo, array, offset) {
2420
2448
  array = makeTypedArray(array);
2421
2449
  if (offset !== undefined) {
2422
- gl.bindBuffer(ARRAY_BUFFER, attribInfo.buffer);
2423
- gl.bufferSubData(ARRAY_BUFFER, offset, array);
2450
+ gl.bindBuffer(ARRAY_BUFFER$1, attribInfo.buffer);
2451
+ gl.bufferSubData(ARRAY_BUFFER$1, offset, array);
2424
2452
  } else {
2425
- setBufferFromTypedArray(gl, ARRAY_BUFFER, attribInfo.buffer, array, attribInfo.drawType);
2453
+ setBufferFromTypedArray(gl, ARRAY_BUFFER$1, attribInfo.buffer, array, attribInfo.drawType);
2426
2454
  }
2427
2455
  }
2428
2456
 
2429
2457
  function getBytesPerValueForGLType(gl, type) {
2430
2458
  if (type === BYTE$1) return 1; // eslint-disable-line
2431
- if (type === UNSIGNED_BYTE$1) return 1; // eslint-disable-line
2459
+ if (type === UNSIGNED_BYTE$2) return 1; // eslint-disable-line
2432
2460
  if (type === SHORT$1) return 2; // eslint-disable-line
2433
- if (type === UNSIGNED_SHORT$1) return 2; // eslint-disable-line
2434
- if (type === INT$1) return 4; // eslint-disable-line
2435
- if (type === UNSIGNED_INT$1) return 4; // eslint-disable-line
2436
- if (type === FLOAT$1) return 4; // eslint-disable-line
2461
+ if (type === UNSIGNED_SHORT$2) return 2; // eslint-disable-line
2462
+ if (type === INT$2) return 4; // eslint-disable-line
2463
+ if (type === UNSIGNED_INT$2) return 4; // eslint-disable-line
2464
+ if (type === FLOAT$2) return 4; // eslint-disable-line
2437
2465
  return 0;
2438
2466
  }
2439
2467
 
@@ -2452,11 +2480,11 @@ function getNumElementsFromNonIndexedArrays(arrays) {
2452
2480
  key = Object.keys(arrays)[0];
2453
2481
  }
2454
2482
  const array = arrays[key];
2455
- const length = getArray(array).length;
2483
+ const length = getArray$1(array).length;
2456
2484
  if (length === undefined) {
2457
2485
  return 1; // There's no arrays
2458
2486
  }
2459
- const numComponents = getNumComponents(array, key);
2487
+ const numComponents = getNumComponents$1(array, key);
2460
2488
  const numElements = length / numComponents;
2461
2489
  if (length % numComponents > 0) {
2462
2490
  throw new Error(`numComponents ${numComponents} not correct for length ${length}`);
@@ -2472,7 +2500,7 @@ function getNumElementsFromAttributes(gl, attribs) {
2472
2500
  if (key in attribs) {
2473
2501
  break;
2474
2502
  }
2475
- key = defaults.attribPrefix + key;
2503
+ key = defaults$2.attribPrefix + key;
2476
2504
  if (key in attribs) {
2477
2505
  break;
2478
2506
  }
@@ -2484,9 +2512,9 @@ function getNumElementsFromAttributes(gl, attribs) {
2484
2512
  if (!attrib.buffer) {
2485
2513
  return 1; // There's no buffer
2486
2514
  }
2487
- gl.bindBuffer(ARRAY_BUFFER, attrib.buffer);
2488
- const numBytes = gl.getBufferParameter(ARRAY_BUFFER, BUFFER_SIZE);
2489
- gl.bindBuffer(ARRAY_BUFFER, null);
2515
+ gl.bindBuffer(ARRAY_BUFFER$1, attrib.buffer);
2516
+ const numBytes = gl.getBufferParameter(ARRAY_BUFFER$1, BUFFER_SIZE);
2517
+ gl.bindBuffer(ARRAY_BUFFER$1, null);
2490
2518
 
2491
2519
  const bytesPerValue = getBytesPerValueForGLType(gl, attrib.type);
2492
2520
  const totalElements = numBytes / bytesPerValue;
@@ -2611,7 +2639,7 @@ function createBufferInfoFromArrays(gl, arrays, srcBufferInfo) {
2611
2639
  const indices = arrays.indices;
2612
2640
  if (indices) {
2613
2641
  const newIndices = makeTypedArray(indices, "indices");
2614
- bufferInfo.indices = createBufferFromTypedArray(gl, newIndices, ELEMENT_ARRAY_BUFFER);
2642
+ bufferInfo.indices = createBufferFromTypedArray(gl, newIndices, ELEMENT_ARRAY_BUFFER$2);
2615
2643
  bufferInfo.numElements = newIndices.length;
2616
2644
  bufferInfo.elementType = getGLTypeForTypedArray(newIndices);
2617
2645
  } else if (!bufferInfo.numElements) {
@@ -2648,7 +2676,7 @@ function createBufferInfoFromArrays(gl, arrays, srcBufferInfo) {
2648
2676
  * @memberOf module:twgl/attributes
2649
2677
  */
2650
2678
  function createBufferFromArray(gl, array, arrayName) {
2651
- const type = arrayName === "indices" ? ELEMENT_ARRAY_BUFFER : ARRAY_BUFFER;
2679
+ const type = arrayName === "indices" ? ELEMENT_ARRAY_BUFFER$2 : ARRAY_BUFFER$1;
2652
2680
  const typedArray = makeTypedArray(array, arrayName);
2653
2681
  return createBufferFromTypedArray(gl, typedArray, type);
2654
2682
  }
@@ -2703,9 +2731,9 @@ var attributes = /*#__PURE__*/Object.freeze({
2703
2731
  createBufferInfoFromArrays: createBufferInfoFromArrays,
2704
2732
  setAttribInfoBufferFromArray: setAttribInfoBufferFromArray,
2705
2733
  setAttributePrefix: setAttributePrefix,
2706
- setAttributeDefaults_: setDefaults,
2707
- getNumComponents_: getNumComponents,
2708
- getArray_: getArray
2734
+ setAttributeDefaults_: setDefaults$2,
2735
+ getNumComponents_: getNumComponents$1,
2736
+ getArray_: getArray$1
2709
2737
  });
2710
2738
 
2711
2739
  /*
@@ -2730,8 +2758,8 @@ var attributes = /*#__PURE__*/Object.freeze({
2730
2758
  * DEALINGS IN THE SOFTWARE.
2731
2759
  */
2732
2760
 
2733
- const getArray$1 = getArray; // eslint-disable-line
2734
- const getNumComponents$1 = getNumComponents; // eslint-disable-line
2761
+ const getArray = getArray$1; // eslint-disable-line
2762
+ const getNumComponents = getNumComponents$1; // eslint-disable-line
2735
2763
 
2736
2764
  /**
2737
2765
  * @typedef {(Int8Array|Uint8Array|Int16Array|Uint16Array|Int32Array|Uint32Array|Float32Array)} TypedArray
@@ -2750,7 +2778,7 @@ function augmentTypedArray(typedArray, numComponents) {
2750
2778
  typedArray.push = function() {
2751
2779
  for (let ii = 0; ii < arguments.length; ++ii) {
2752
2780
  const value = arguments[ii];
2753
- if (value instanceof Array || isArrayBuffer(value)) {
2781
+ if (value instanceof Array || isArrayBuffer$1(value)) {
2754
2782
  for (let jj = 0; jj < value.length; ++jj) {
2755
2783
  typedArray[cursor++] = value[jj];
2756
2784
  }
@@ -2899,8 +2927,8 @@ function applyFuncToV3Array(array, matrix, fn) {
2899
2927
  }
2900
2928
  }
2901
2929
 
2902
- function transformNormal$1(mi, v, dst) {
2903
- dst = dst || create();
2930
+ function transformNormal(mi, v, dst) {
2931
+ dst = dst || create$1();
2904
2932
  const v0 = v[0];
2905
2933
  const v1 = v[1];
2906
2934
  const v2 = v[2];
@@ -2933,7 +2961,7 @@ function reorientDirections(array, matrix) {
2933
2961
  * @memberOf module:twgl/primitives
2934
2962
  */
2935
2963
  function reorientNormals(array, matrix) {
2936
- applyFuncToV3Array(array, inverse(matrix), transformNormal$1);
2964
+ applyFuncToV3Array(array, inverse(matrix), transformNormal);
2937
2965
  return array;
2938
2966
  }
2939
2967
 
@@ -4134,7 +4162,7 @@ function create3DFVertices() {
4134
4162
  const py = c * verticalRadius;
4135
4163
  const pz = s * radius;
4136
4164
  positions.push(px, py, pz);
4137
- const n = add(multiply([0, s, c], normalMult), normalAdd);
4165
+ const n = add(multiply$1([0, s, c], normalMult), normalAdd);
4138
4166
  normals.push(n);
4139
4167
  texcoords.push(uBack * uMult + uAdd, v);
4140
4168
  }
@@ -4632,7 +4660,7 @@ function copyElements(src, dst, dstNdx, offset) {
4632
4660
  * @private
4633
4661
  */
4634
4662
  function createArrayOfSameType(srcArray, length) {
4635
- const arraySrc = getArray$1(srcArray);
4663
+ const arraySrc = getArray(srcArray);
4636
4664
  const newArray = new arraySrc.constructor(length);
4637
4665
  let newArraySpec = newArray;
4638
4666
  // If it appears to have been augmented make new one augmented
@@ -4689,8 +4717,8 @@ function concatVertices(arrayOfArrays) {
4689
4717
  baseName = name;
4690
4718
  }
4691
4719
  const arrayInfo = arrays[name];
4692
- const numComponents = getNumComponents$1(arrayInfo, name);
4693
- const array = getArray$1(arrayInfo);
4720
+ const numComponents = getNumComponents(arrayInfo, name);
4721
+ const array = getArray(arrayInfo);
4694
4722
  const numElements = array.length / numComponents;
4695
4723
  names[name].push(numElements);
4696
4724
  });
@@ -4704,7 +4732,7 @@ function concatVertices(arrayOfArrays) {
4704
4732
  for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
4705
4733
  const arrays = arrayOfArrays[ii];
4706
4734
  const arrayInfo = arrays[name];
4707
- const array = getArray$1(arrayInfo);
4735
+ const array = getArray(arrayInfo);
4708
4736
  length += array.length;
4709
4737
  if (!arraySpec || arrayInfo.data) {
4710
4738
  arraySpec = arrayInfo;
@@ -4722,7 +4750,7 @@ function concatVertices(arrayOfArrays) {
4722
4750
  for (let ii = 0; ii < arrayOfArrays.length; ++ii) {
4723
4751
  const arrays = arrayOfArrays[ii];
4724
4752
  const arrayInfo = arrays[name];
4725
- const array = getArray$1(arrayInfo);
4753
+ const array = getArray(arrayInfo);
4726
4754
  if (name === 'indices') {
4727
4755
  copyElements(array, newArray, offset, baseIndex);
4728
4756
  baseIndex += base[ii];
@@ -4739,7 +4767,7 @@ function concatVertices(arrayOfArrays) {
4739
4767
  Object.keys(names).forEach(function(name) {
4740
4768
  const info = getLengthOfCombinedArrays(name);
4741
4769
  const newArraySpec = createArrayOfSameType(info.spec, info.length);
4742
- copyArraysToNewArray(name, base, getArray$1(newArraySpec));
4770
+ copyArraysToNewArray(name, base, getArray(newArraySpec));
4743
4771
  newArrays[name] = newArraySpec;
4744
4772
  });
4745
4773
  return newArrays;
@@ -4759,9 +4787,9 @@ function duplicateVertices(arrays) {
4759
4787
  const newArrays = {};
4760
4788
  Object.keys(arrays).forEach(function(name) {
4761
4789
  const arraySpec = arrays[name];
4762
- const srcArray = getArray$1(arraySpec);
4790
+ const srcArray = getArray(arraySpec);
4763
4791
  const newArraySpec = createArrayOfSameType(arraySpec, srcArray.length);
4764
- copyElements(srcArray, getArray$1(newArraySpec), 0);
4792
+ copyElements(srcArray, getArray(newArraySpec), 0);
4765
4793
  newArrays[name] = newArraySpec;
4766
4794
  });
4767
4795
  return newArrays;
@@ -5005,7 +5033,7 @@ const defaults$1 = {
5005
5033
  textureOptions: {},
5006
5034
  crossOrigin: undefined,
5007
5035
  };
5008
- const isArrayBuffer$1 = isArrayBuffer;
5036
+ const isArrayBuffer = isArrayBuffer$1;
5009
5037
 
5010
5038
  // Should we make this on demand?
5011
5039
  const getShared2DContext = function() {
@@ -5034,20 +5062,20 @@ const getShared2DContext = function() {
5034
5062
  /* PixelFormat */
5035
5063
  const ALPHA = 0x1906;
5036
5064
  const RGB = 0x1907;
5037
- const RGBA = 0x1908;
5065
+ const RGBA$1 = 0x1908;
5038
5066
  const LUMINANCE = 0x1909;
5039
5067
  const LUMINANCE_ALPHA = 0x190A;
5040
- const DEPTH_COMPONENT = 0x1902;
5041
- const DEPTH_STENCIL = 0x84F9;
5068
+ const DEPTH_COMPONENT$1 = 0x1902;
5069
+ const DEPTH_STENCIL$1 = 0x84F9;
5042
5070
 
5043
5071
  /* TextureWrapMode */
5044
5072
  // const REPEAT = 0x2901;
5045
5073
  // const MIRRORED_REPEAT = 0x8370;
5046
- const CLAMP_TO_EDGE = 0x812f;
5074
+ const CLAMP_TO_EDGE$1 = 0x812f;
5047
5075
 
5048
5076
  /* TextureMagFilter */
5049
5077
  const NEAREST = 0x2600;
5050
- const LINEAR = 0x2601;
5078
+ const LINEAR$1 = 0x2601;
5051
5079
 
5052
5080
  /* TextureMinFilter */
5053
5081
  // const NEAREST_MIPMAP_NEAREST = 0x2700;
@@ -5056,10 +5084,10 @@ const LINEAR = 0x2601;
5056
5084
  // const LINEAR_MIPMAP_LINEAR = 0x2703;
5057
5085
 
5058
5086
  /* Texture Target */
5059
- const TEXTURE_2D = 0x0de1;
5060
- const TEXTURE_CUBE_MAP = 0x8513;
5061
- const TEXTURE_3D = 0x806f;
5062
- const TEXTURE_2D_ARRAY = 0x8c1a;
5087
+ const TEXTURE_2D$2 = 0x0de1;
5088
+ const TEXTURE_CUBE_MAP$1 = 0x8513;
5089
+ const TEXTURE_3D$1 = 0x806f;
5090
+ const TEXTURE_2D_ARRAY$1 = 0x8c1a;
5063
5091
 
5064
5092
  /* Cubemap Targets */
5065
5093
  const TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
@@ -5114,7 +5142,7 @@ const R32UI = 0x8236;
5114
5142
  const R32I = 0x8235;
5115
5143
  const RGB8 = 0x8051;
5116
5144
  const SRGB8 = 0x8C41;
5117
- const RGB565 = 0x8D62;
5145
+ const RGB565$1 = 0x8D62;
5118
5146
  const RGB8_SNORM = 0x8F96;
5119
5147
  const R11F_G11F_B10F = 0x8C3A;
5120
5148
  const RGB9_E5 = 0x8C3D;
@@ -5129,8 +5157,8 @@ const RGB32I = 0x8D83;
5129
5157
  const RGBA8 = 0x8058;
5130
5158
  const SRGB8_ALPHA8 = 0x8C43;
5131
5159
  const RGBA8_SNORM = 0x8F97;
5132
- const RGB5_A1 = 0x8057;
5133
- const RGBA4 = 0x8056;
5160
+ const RGB5_A1$1 = 0x8057;
5161
+ const RGBA4$1 = 0x8056;
5134
5162
  const RGB10_A2 = 0x8059;
5135
5163
  const RGBA16F = 0x881A;
5136
5164
  const RGBA32F = 0x8814;
@@ -5142,30 +5170,30 @@ const RGBA16I = 0x8D88;
5142
5170
  const RGBA32I = 0x8D82;
5143
5171
  const RGBA32UI = 0x8D70;
5144
5172
 
5145
- const DEPTH_COMPONENT16 = 0x81A5;
5146
- const DEPTH_COMPONENT24 = 0x81A6;
5147
- const DEPTH_COMPONENT32F = 0x8CAC;
5148
- const DEPTH32F_STENCIL8 = 0x8CAD;
5149
- const DEPTH24_STENCIL8 = 0x88F0;
5173
+ const DEPTH_COMPONENT16$1 = 0x81A5;
5174
+ const DEPTH_COMPONENT24$1 = 0x81A6;
5175
+ const DEPTH_COMPONENT32F$1 = 0x8CAC;
5176
+ const DEPTH32F_STENCIL8$1 = 0x8CAD;
5177
+ const DEPTH24_STENCIL8$1 = 0x88F0;
5150
5178
 
5151
5179
  /* DataType */
5152
- const BYTE$2 = 0x1400;
5153
- const UNSIGNED_BYTE$2 = 0x1401;
5154
- const SHORT$2 = 0x1402;
5155
- const UNSIGNED_SHORT$2 = 0x1403;
5156
- const INT$2 = 0x1404;
5157
- const UNSIGNED_INT$2 = 0x1405;
5158
- const FLOAT$2 = 0x1406;
5159
- const UNSIGNED_SHORT_4_4_4_4$1 = 0x8033;
5160
- const UNSIGNED_SHORT_5_5_5_1$1 = 0x8034;
5161
- const UNSIGNED_SHORT_5_6_5$1 = 0x8363;
5162
- const HALF_FLOAT$1 = 0x140B;
5180
+ const BYTE = 0x1400;
5181
+ const UNSIGNED_BYTE$1 = 0x1401;
5182
+ const SHORT = 0x1402;
5183
+ const UNSIGNED_SHORT$1 = 0x1403;
5184
+ const INT$1 = 0x1404;
5185
+ const UNSIGNED_INT$1 = 0x1405;
5186
+ const FLOAT$1 = 0x1406;
5187
+ const UNSIGNED_SHORT_4_4_4_4 = 0x8033;
5188
+ const UNSIGNED_SHORT_5_5_5_1 = 0x8034;
5189
+ const UNSIGNED_SHORT_5_6_5 = 0x8363;
5190
+ const HALF_FLOAT = 0x140B;
5163
5191
  const HALF_FLOAT_OES = 0x8D61; // Thanks Khronos for making this different >:(
5164
- const UNSIGNED_INT_2_10_10_10_REV$1 = 0x8368;
5165
- const UNSIGNED_INT_10F_11F_11F_REV$1 = 0x8C3B;
5166
- const UNSIGNED_INT_5_9_9_9_REV$1 = 0x8C3E;
5167
- const FLOAT_32_UNSIGNED_INT_24_8_REV$1 = 0x8DAD;
5168
- const UNSIGNED_INT_24_8$1 = 0x84FA;
5192
+ const UNSIGNED_INT_2_10_10_10_REV = 0x8368;
5193
+ const UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
5194
+ const UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
5195
+ const FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
5196
+ const UNSIGNED_INT_24_8 = 0x84FA;
5169
5197
 
5170
5198
  const RG = 0x8227;
5171
5199
  const RG_INTEGER = 0x8228;
@@ -5183,17 +5211,17 @@ const formatInfo = {};
5183
5211
  f[LUMINANCE] = { numColorComponents: 1, };
5184
5212
  f[LUMINANCE_ALPHA] = { numColorComponents: 2, };
5185
5213
  f[RGB] = { numColorComponents: 3, };
5186
- f[RGBA] = { numColorComponents: 4, };
5214
+ f[RGBA$1] = { numColorComponents: 4, };
5187
5215
  f[RED] = { numColorComponents: 1, };
5188
5216
  f[RED_INTEGER] = { numColorComponents: 1, };
5189
5217
  f[RG] = { numColorComponents: 2, };
5190
5218
  f[RG_INTEGER] = { numColorComponents: 2, };
5191
5219
  f[RGB] = { numColorComponents: 3, };
5192
5220
  f[RGB_INTEGER] = { numColorComponents: 3, };
5193
- f[RGBA] = { numColorComponents: 4, };
5221
+ f[RGBA$1] = { numColorComponents: 4, };
5194
5222
  f[RGBA_INTEGER] = { numColorComponents: 4, };
5195
- f[DEPTH_COMPONENT] = { numColorComponents: 1, };
5196
- f[DEPTH_STENCIL] = { numColorComponents: 2, };
5223
+ f[DEPTH_COMPONENT$1] = { numColorComponents: 1, };
5224
+ f[DEPTH_STENCIL$1] = { numColorComponents: 2, };
5197
5225
  }
5198
5226
 
5199
5227
  /**
@@ -5212,69 +5240,69 @@ function getTextureInternalFormatInfo(internalFormat) {
5212
5240
  // NOTE: these properties need unique names so we can let Uglify mangle the name.
5213
5241
  const t = {};
5214
5242
  // unsized formats
5215
- t[ALPHA] = { textureFormat: ALPHA, colorRenderable: true, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE$2, HALF_FLOAT$1, HALF_FLOAT_OES, FLOAT$2], };
5216
- t[LUMINANCE] = { textureFormat: LUMINANCE, colorRenderable: true, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE$2, HALF_FLOAT$1, HALF_FLOAT_OES, FLOAT$2], };
5217
- t[LUMINANCE_ALPHA] = { textureFormat: LUMINANCE_ALPHA, colorRenderable: true, textureFilterable: true, bytesPerElement: [2, 4, 4, 8], type: [UNSIGNED_BYTE$2, HALF_FLOAT$1, HALF_FLOAT_OES, FLOAT$2], };
5218
- t[RGB] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 6, 6, 12, 2], type: [UNSIGNED_BYTE$2, HALF_FLOAT$1, HALF_FLOAT_OES, FLOAT$2, UNSIGNED_SHORT_5_6_5$1], };
5219
- t[RGBA] = { textureFormat: RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE$2, HALF_FLOAT$1, HALF_FLOAT_OES, FLOAT$2, UNSIGNED_SHORT_4_4_4_4$1, UNSIGNED_SHORT_5_5_5_1$1], };
5220
- t[DEPTH_COMPONENT] = { textureFormat: DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [UNSIGNED_INT$2, UNSIGNED_SHORT$2], };
5243
+ t[ALPHA] = { textureFormat: ALPHA, colorRenderable: true, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1], };
5244
+ t[LUMINANCE] = { textureFormat: LUMINANCE, colorRenderable: true, textureFilterable: true, bytesPerElement: [1, 2, 2, 4], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1], };
5245
+ t[LUMINANCE_ALPHA] = { textureFormat: LUMINANCE_ALPHA, colorRenderable: true, textureFilterable: true, bytesPerElement: [2, 4, 4, 8], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1], };
5246
+ t[RGB] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 6, 6, 12, 2], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1, UNSIGNED_SHORT_5_6_5], };
5247
+ t[RGBA$1] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 8, 8, 16, 2, 2], type: [UNSIGNED_BYTE$1, HALF_FLOAT, HALF_FLOAT_OES, FLOAT$1, UNSIGNED_SHORT_4_4_4_4, UNSIGNED_SHORT_5_5_5_1], };
5248
+ t[DEPTH_COMPONENT$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [UNSIGNED_INT$1, UNSIGNED_SHORT$1], };
5221
5249
 
5222
5250
  // sized formats
5223
- t[R8] = { textureFormat: RED, colorRenderable: true, textureFilterable: true, bytesPerElement: [1], type: [UNSIGNED_BYTE$2], };
5224
- t[R8_SNORM] = { textureFormat: RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [1], type: [BYTE$2], };
5225
- t[R16F] = { textureFormat: RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [4, 2], type: [FLOAT$2, HALF_FLOAT$1], };
5226
- t[R32F] = { textureFormat: RED, colorRenderable: false, textureFilterable: false, bytesPerElement: [4], type: [FLOAT$2], };
5227
- t[R8UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [UNSIGNED_BYTE$2], };
5228
- t[R8I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [BYTE$2], };
5229
- t[R16UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [UNSIGNED_SHORT$2], };
5230
- t[R16I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [SHORT$2], };
5231
- t[R32UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT$2], };
5232
- t[R32I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [INT$2], };
5233
- t[RG8] = { textureFormat: RG, colorRenderable: true, textureFilterable: true, bytesPerElement: [2], type: [UNSIGNED_BYTE$2], };
5234
- t[RG8_SNORM] = { textureFormat: RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [2], type: [BYTE$2], };
5235
- t[RG16F] = { textureFormat: RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [8, 4], type: [FLOAT$2, HALF_FLOAT$1], };
5236
- t[RG32F] = { textureFormat: RG, colorRenderable: false, textureFilterable: false, bytesPerElement: [8], type: [FLOAT$2], };
5237
- t[RG8UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [UNSIGNED_BYTE$2], };
5238
- t[RG8I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [BYTE$2], };
5239
- t[RG16UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_SHORT$2], };
5240
- t[RG16I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [SHORT$2], };
5241
- t[RG32UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [UNSIGNED_INT$2], };
5242
- t[RG32I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [INT$2], };
5243
- t[RGB8] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3], type: [UNSIGNED_BYTE$2], };
5244
- t[SRGB8] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [UNSIGNED_BYTE$2], };
5245
- t[RGB565] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 2], type: [UNSIGNED_BYTE$2, UNSIGNED_SHORT_5_6_5$1], };
5246
- t[RGB8_SNORM] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [BYTE$2], };
5247
- t[R11F_G11F_B10F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [FLOAT$2, HALF_FLOAT$1, UNSIGNED_INT_10F_11F_11F_REV$1], };
5248
- t[RGB9_E5] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [FLOAT$2, HALF_FLOAT$1, UNSIGNED_INT_5_9_9_9_REV$1], };
5249
- t[RGB16F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6], type: [FLOAT$2, HALF_FLOAT$1], };
5250
- t[RGB32F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [FLOAT$2], };
5251
- t[RGB8UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [UNSIGNED_BYTE$2], };
5252
- t[RGB8I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [BYTE$2], };
5253
- t[RGB16UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [UNSIGNED_SHORT$2], };
5254
- t[RGB16I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [SHORT$2], };
5255
- t[RGB32UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [UNSIGNED_INT$2], };
5256
- t[RGB32I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [INT$2], };
5257
- t[RGBA8] = { textureFormat: RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_BYTE$2], };
5258
- t[SRGB8_ALPHA8] = { textureFormat: RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_BYTE$2], };
5259
- t[RGBA8_SNORM] = { textureFormat: RGBA, colorRenderable: false, textureFilterable: true, bytesPerElement: [4], type: [BYTE$2], };
5260
- t[RGB5_A1] = { textureFormat: RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2, 4], type: [UNSIGNED_BYTE$2, UNSIGNED_SHORT_5_5_5_1$1, UNSIGNED_INT_2_10_10_10_REV$1], };
5261
- t[RGBA4] = { textureFormat: RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2], type: [UNSIGNED_BYTE$2, UNSIGNED_SHORT_4_4_4_4$1], };
5262
- t[RGB10_A2] = { textureFormat: RGBA, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_INT_2_10_10_10_REV$1], };
5263
- t[RGBA16F] = { textureFormat: RGBA, colorRenderable: false, textureFilterable: true, bytesPerElement: [16, 8], type: [FLOAT$2, HALF_FLOAT$1], };
5264
- t[RGBA32F] = { textureFormat: RGBA, colorRenderable: false, textureFilterable: false, bytesPerElement: [16], type: [FLOAT$2], };
5265
- t[RGBA8UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_BYTE$2], };
5266
- t[RGBA8I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [BYTE$2], };
5267
- t[RGB10_A2UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT_2_10_10_10_REV$1], };
5268
- t[RGBA16UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [UNSIGNED_SHORT$2], };
5269
- t[RGBA16I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [SHORT$2], };
5270
- t[RGBA32I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [INT$2], };
5271
- t[RGBA32UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [UNSIGNED_INT$2], };
5251
+ t[R8] = { textureFormat: RED, colorRenderable: true, textureFilterable: true, bytesPerElement: [1], type: [UNSIGNED_BYTE$1], };
5252
+ t[R8_SNORM] = { textureFormat: RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [1], type: [BYTE], };
5253
+ t[R16F] = { textureFormat: RED, colorRenderable: false, textureFilterable: true, bytesPerElement: [4, 2], type: [FLOAT$1, HALF_FLOAT], };
5254
+ t[R32F] = { textureFormat: RED, colorRenderable: false, textureFilterable: false, bytesPerElement: [4], type: [FLOAT$1], };
5255
+ t[R8UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [UNSIGNED_BYTE$1], };
5256
+ t[R8I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [1], type: [BYTE], };
5257
+ t[R16UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [UNSIGNED_SHORT$1], };
5258
+ t[R16I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [SHORT], };
5259
+ t[R32UI] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT$1], };
5260
+ t[R32I] = { textureFormat: RED_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [INT$1], };
5261
+ t[RG8] = { textureFormat: RG, colorRenderable: true, textureFilterable: true, bytesPerElement: [2], type: [UNSIGNED_BYTE$1], };
5262
+ t[RG8_SNORM] = { textureFormat: RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [2], type: [BYTE], };
5263
+ t[RG16F] = { textureFormat: RG, colorRenderable: false, textureFilterable: true, bytesPerElement: [8, 4], type: [FLOAT$1, HALF_FLOAT], };
5264
+ t[RG32F] = { textureFormat: RG, colorRenderable: false, textureFilterable: false, bytesPerElement: [8], type: [FLOAT$1], };
5265
+ t[RG8UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [UNSIGNED_BYTE$1], };
5266
+ t[RG8I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [2], type: [BYTE], };
5267
+ t[RG16UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_SHORT$1], };
5268
+ t[RG16I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [SHORT], };
5269
+ t[RG32UI] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [UNSIGNED_INT$1], };
5270
+ t[RG32I] = { textureFormat: RG_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [INT$1], };
5271
+ t[RGB8] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3], type: [UNSIGNED_BYTE$1], };
5272
+ t[SRGB8] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [UNSIGNED_BYTE$1], };
5273
+ t[RGB565$1] = { textureFormat: RGB, colorRenderable: true, textureFilterable: true, bytesPerElement: [3, 2], type: [UNSIGNED_BYTE$1, UNSIGNED_SHORT_5_6_5], };
5274
+ t[RGB8_SNORM] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [3], type: [BYTE], };
5275
+ t[R11F_G11F_B10F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [FLOAT$1, HALF_FLOAT, UNSIGNED_INT_10F_11F_11F_REV], };
5276
+ t[RGB9_E5] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6, 4], type: [FLOAT$1, HALF_FLOAT, UNSIGNED_INT_5_9_9_9_REV], };
5277
+ t[RGB16F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: true, bytesPerElement: [12, 6], type: [FLOAT$1, HALF_FLOAT], };
5278
+ t[RGB32F] = { textureFormat: RGB, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [FLOAT$1], };
5279
+ t[RGB8UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [UNSIGNED_BYTE$1], };
5280
+ t[RGB8I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [3], type: [BYTE], };
5281
+ t[RGB16UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [UNSIGNED_SHORT$1], };
5282
+ t[RGB16I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [6], type: [SHORT], };
5283
+ t[RGB32UI] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [UNSIGNED_INT$1], };
5284
+ t[RGB32I] = { textureFormat: RGB_INTEGER, colorRenderable: false, textureFilterable: false, bytesPerElement: [12], type: [INT$1], };
5285
+ t[RGBA8] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_BYTE$1], };
5286
+ t[SRGB8_ALPHA8] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_BYTE$1], };
5287
+ t[RGBA8_SNORM] = { textureFormat: RGBA$1, colorRenderable: false, textureFilterable: true, bytesPerElement: [4], type: [BYTE], };
5288
+ t[RGB5_A1$1] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2, 4], type: [UNSIGNED_BYTE$1, UNSIGNED_SHORT_5_5_5_1, UNSIGNED_INT_2_10_10_10_REV], };
5289
+ t[RGBA4$1] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4, 2], type: [UNSIGNED_BYTE$1, UNSIGNED_SHORT_4_4_4_4], };
5290
+ t[RGB10_A2] = { textureFormat: RGBA$1, colorRenderable: true, textureFilterable: true, bytesPerElement: [4], type: [UNSIGNED_INT_2_10_10_10_REV], };
5291
+ t[RGBA16F] = { textureFormat: RGBA$1, colorRenderable: false, textureFilterable: true, bytesPerElement: [16, 8], type: [FLOAT$1, HALF_FLOAT], };
5292
+ t[RGBA32F] = { textureFormat: RGBA$1, colorRenderable: false, textureFilterable: false, bytesPerElement: [16], type: [FLOAT$1], };
5293
+ t[RGBA8UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_BYTE$1], };
5294
+ t[RGBA8I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [BYTE], };
5295
+ t[RGB10_A2UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT_2_10_10_10_REV], };
5296
+ t[RGBA16UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [UNSIGNED_SHORT$1], };
5297
+ t[RGBA16I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [8], type: [SHORT], };
5298
+ t[RGBA32I] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [INT$1], };
5299
+ t[RGBA32UI] = { textureFormat: RGBA_INTEGER, colorRenderable: true, textureFilterable: false, bytesPerElement: [16], type: [UNSIGNED_INT$1], };
5272
5300
  // Sized Internal
5273
- t[DEPTH_COMPONENT16] = { textureFormat: DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [UNSIGNED_SHORT$2, UNSIGNED_INT$2], };
5274
- t[DEPTH_COMPONENT24] = { textureFormat: DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT$2], };
5275
- t[DEPTH_COMPONENT32F] = { textureFormat: DEPTH_COMPONENT, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [FLOAT$2], };
5276
- t[DEPTH24_STENCIL8] = { textureFormat: DEPTH_STENCIL, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT_24_8$1], };
5277
- t[DEPTH32F_STENCIL8] = { textureFormat: DEPTH_STENCIL, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [FLOAT_32_UNSIGNED_INT_24_8_REV$1], };
5301
+ t[DEPTH_COMPONENT16$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [2, 4], type: [UNSIGNED_SHORT$1, UNSIGNED_INT$1], };
5302
+ t[DEPTH_COMPONENT24$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT$1], };
5303
+ t[DEPTH_COMPONENT32F$1] = { textureFormat: DEPTH_COMPONENT$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [FLOAT$1], };
5304
+ t[DEPTH24_STENCIL8$1] = { textureFormat: DEPTH_STENCIL$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [UNSIGNED_INT_24_8], };
5305
+ t[DEPTH32F_STENCIL8$1] = { textureFormat: DEPTH_STENCIL$1, colorRenderable: true, textureFilterable: false, bytesPerElement: [4], type: [FLOAT_32_UNSIGNED_INT_24_8_REV], };
5278
5306
 
5279
5307
  Object.keys(t).forEach(function(internalFormat) {
5280
5308
  const info = t[internalFormat];
@@ -5403,10 +5431,10 @@ function getNumComponentsForFormat(format) {
5403
5431
  * @private
5404
5432
  */
5405
5433
  function getTextureTypeForArrayType(gl, src, defaultType) {
5406
- if (isArrayBuffer$1(src)) {
5434
+ if (isArrayBuffer(src)) {
5407
5435
  return getGLTypeForTypedArray(src);
5408
5436
  }
5409
- return defaultType || UNSIGNED_BYTE$2;
5437
+ return defaultType || UNSIGNED_BYTE$1;
5410
5438
  }
5411
5439
 
5412
5440
  function guessDimensions(gl, target, width, height, numElements) {
@@ -5414,7 +5442,7 @@ function guessDimensions(gl, target, width, height, numElements) {
5414
5442
  throw "can't guess dimensions";
5415
5443
  }
5416
5444
  if (!width && !height) {
5417
- const size = Math.sqrt(numElements / (target === TEXTURE_CUBE_MAP ? 6 : 1));
5445
+ const size = Math.sqrt(numElements / (target === TEXTURE_CUBE_MAP$1 ? 6 : 1));
5418
5446
  if (size % 1 === 0) {
5419
5447
  width = size;
5420
5448
  height = size;
@@ -5623,7 +5651,7 @@ function setTextureSamplerParameters(gl, target, parameteriFn, options) {
5623
5651
  if (options.wrap) {
5624
5652
  parameteriFn.call(gl, target, TEXTURE_WRAP_S, options.wrap);
5625
5653
  parameteriFn.call(gl, target, TEXTURE_WRAP_T, options.wrap);
5626
- if (target === TEXTURE_3D || isSampler(gl, target)) {
5654
+ if (target === TEXTURE_3D$1 || isSampler(gl, target)) {
5627
5655
  parameteriFn.call(gl, target, TEXTURE_WRAP_R, options.wrap);
5628
5656
  }
5629
5657
  }
@@ -5659,7 +5687,7 @@ function setTextureSamplerParameters(gl, target, parameteriFn, options) {
5659
5687
  * @memberOf module:twgl/textures
5660
5688
  */
5661
5689
  function setTextureParameters(gl, tex, options) {
5662
- const target = options.target || TEXTURE_2D;
5690
+ const target = options.target || TEXTURE_2D$2;
5663
5691
  gl.bindTexture(target, tex);
5664
5692
  setTextureSamplerParameters(gl, target, gl.texParameteri, options);
5665
5693
  }
@@ -5747,7 +5775,7 @@ function createSamplers(gl, samplerOptions) {
5747
5775
  */
5748
5776
  function make1Pixel(color) {
5749
5777
  color = color || defaults$1.textureColor;
5750
- if (isArrayBuffer$1(color)) {
5778
+ if (isArrayBuffer(color)) {
5751
5779
  return color;
5752
5780
  }
5753
5781
  return new Uint8Array([color[0] * 255, color[1] * 255, color[2] * 255, color[3] * 255]);
@@ -5768,19 +5796,19 @@ function make1Pixel(color) {
5768
5796
  */
5769
5797
  function setTextureFilteringForSize(gl, tex, options, width, height, internalFormat) {
5770
5798
  options = options || defaults$1.textureOptions;
5771
- internalFormat = internalFormat || RGBA;
5772
- const target = options.target || TEXTURE_2D;
5799
+ internalFormat = internalFormat || RGBA$1;
5800
+ const target = options.target || TEXTURE_2D$2;
5773
5801
  width = width || options.width;
5774
5802
  height = height || options.height;
5775
5803
  gl.bindTexture(target, tex);
5776
5804
  if (canGenerateMipmap(gl, width, height, internalFormat)) {
5777
5805
  gl.generateMipmap(target);
5778
5806
  } else {
5779
- const filtering = canFilter(internalFormat) ? LINEAR : NEAREST;
5807
+ const filtering = canFilter(internalFormat) ? LINEAR$1 : NEAREST;
5780
5808
  gl.texParameteri(target, TEXTURE_MIN_FILTER, filtering);
5781
5809
  gl.texParameteri(target, TEXTURE_MAG_FILTER, filtering);
5782
- gl.texParameteri(target, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
5783
- gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
5810
+ gl.texParameteri(target, TEXTURE_WRAP_S, CLAMP_TO_EDGE$1);
5811
+ gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE$1);
5784
5812
  }
5785
5813
  }
5786
5814
 
@@ -5855,17 +5883,17 @@ function getCubeFacesWithNdx(gl, options) {
5855
5883
  */
5856
5884
  function setTextureFromElement(gl, tex, element, options) {
5857
5885
  options = options || defaults$1.textureOptions;
5858
- const target = options.target || TEXTURE_2D;
5886
+ const target = options.target || TEXTURE_2D$2;
5859
5887
  const level = options.level || 0;
5860
5888
  let width = element.width;
5861
5889
  let height = element.height;
5862
- const internalFormat = options.internalFormat || options.format || RGBA;
5890
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
5863
5891
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
5864
5892
  const format = options.format || formatType.format;
5865
5893
  const type = options.type || formatType.type;
5866
5894
  setPackState(gl, options);
5867
5895
  gl.bindTexture(target, tex);
5868
- if (target === TEXTURE_CUBE_MAP) {
5896
+ if (target === TEXTURE_CUBE_MAP$1) {
5869
5897
  // guess the parts
5870
5898
  const imgWidth = element.width;
5871
5899
  const imgHeight = element.height;
@@ -5933,7 +5961,7 @@ function setTextureFromElement(gl, tex, element, options) {
5933
5961
  });
5934
5962
  });
5935
5963
  }
5936
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
5964
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
5937
5965
  const smallest = Math.min(element.width, element.height);
5938
5966
  const largest = Math.max(element.width, element.height);
5939
5967
  const depth = largest / smallest;
@@ -6022,7 +6050,7 @@ function loadImage(url, crossOrigin, callback) {
6022
6050
 
6023
6051
  const onError = function onError() {
6024
6052
  const msg = "couldn't load image: " + url;
6025
- error(msg);
6053
+ error$1(msg);
6026
6054
  callback(msg, img);
6027
6055
  clearEventHandlers();
6028
6056
  };
@@ -6120,7 +6148,7 @@ function loadAndUseImage(obj, crossOrigin, callback) {
6120
6148
  */
6121
6149
  function setTextureTo1PixelColor(gl, tex, options) {
6122
6150
  options = options || defaults$1.textureOptions;
6123
- const target = options.target || TEXTURE_2D;
6151
+ const target = options.target || TEXTURE_2D$2;
6124
6152
  gl.bindTexture(target, tex);
6125
6153
  if (options.color === false) {
6126
6154
  return;
@@ -6128,14 +6156,14 @@ function setTextureTo1PixelColor(gl, tex, options) {
6128
6156
  // Assume it's a URL
6129
6157
  // Put 1x1 pixels in texture. That makes it renderable immediately regardless of filtering.
6130
6158
  const color = make1Pixel(options.color);
6131
- if (target === TEXTURE_CUBE_MAP) {
6159
+ if (target === TEXTURE_CUBE_MAP$1) {
6132
6160
  for (let ii = 0; ii < 6; ++ii) {
6133
- gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, 0, RGBA, 1, 1, 0, RGBA, UNSIGNED_BYTE$2, color);
6161
+ gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, 0, RGBA$1, 1, 1, 0, RGBA$1, UNSIGNED_BYTE$1, color);
6134
6162
  }
6135
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
6136
- gl.texImage3D(target, 0, RGBA, 1, 1, 1, 0, RGBA, UNSIGNED_BYTE$2, color);
6163
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
6164
+ gl.texImage3D(target, 0, RGBA$1, 1, 1, 1, 0, RGBA$1, UNSIGNED_BYTE$1, color);
6137
6165
  } else {
6138
- gl.texImage2D(target, 0, RGBA, 1, 1, 0, RGBA, UNSIGNED_BYTE$2, color);
6166
+ gl.texImage2D(target, 0, RGBA$1, 1, 1, 0, RGBA$1, UNSIGNED_BYTE$1, color);
6139
6167
  }
6140
6168
  }
6141
6169
 
@@ -6235,12 +6263,12 @@ function loadCubemapFromUrls(gl, tex, options, callback) {
6235
6263
  throw "there must be 6 urls for a cubemap";
6236
6264
  }
6237
6265
  const level = options.level || 0;
6238
- const internalFormat = options.internalFormat || options.format || RGBA;
6266
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
6239
6267
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
6240
6268
  const format = options.format || formatType.format;
6241
- const type = options.type || UNSIGNED_BYTE$2;
6242
- const target = options.target || TEXTURE_2D;
6243
- if (target !== TEXTURE_CUBE_MAP) {
6269
+ const type = options.type || UNSIGNED_BYTE$1;
6270
+ const target = options.target || TEXTURE_2D$2;
6271
+ if (target !== TEXTURE_CUBE_MAP$1) {
6244
6272
  throw "target must be TEXTURE_CUBE_MAP";
6245
6273
  }
6246
6274
  setTextureTo1PixelColor(gl, tex, options);
@@ -6315,12 +6343,12 @@ function loadCubemapFromUrls(gl, tex, options, callback) {
6315
6343
  function loadSlicesFromUrls(gl, tex, options, callback) {
6316
6344
  callback = callback || noop;
6317
6345
  const urls = options.src;
6318
- const internalFormat = options.internalFormat || options.format || RGBA;
6346
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
6319
6347
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
6320
6348
  const format = options.format || formatType.format;
6321
- const type = options.type || UNSIGNED_BYTE$2;
6322
- const target = options.target || TEXTURE_2D_ARRAY;
6323
- if (target !== TEXTURE_3D && target !== TEXTURE_2D_ARRAY) {
6349
+ const type = options.type || UNSIGNED_BYTE$1;
6350
+ const target = options.target || TEXTURE_2D_ARRAY$1;
6351
+ if (target !== TEXTURE_3D$1 && target !== TEXTURE_2D_ARRAY$1) {
6324
6352
  throw "target must be TEXTURE_3D or TEXTURE_2D_ARRAY";
6325
6353
  }
6326
6354
  setTextureTo1PixelColor(gl, tex, options);
@@ -6403,17 +6431,17 @@ function loadSlicesFromUrls(gl, tex, options, callback) {
6403
6431
  */
6404
6432
  function setTextureFromArray(gl, tex, src, options) {
6405
6433
  options = options || defaults$1.textureOptions;
6406
- const target = options.target || TEXTURE_2D;
6434
+ const target = options.target || TEXTURE_2D$2;
6407
6435
  gl.bindTexture(target, tex);
6408
6436
  let width = options.width;
6409
6437
  let height = options.height;
6410
6438
  let depth = options.depth;
6411
6439
  const level = options.level || 0;
6412
- const internalFormat = options.internalFormat || options.format || RGBA;
6440
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
6413
6441
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
6414
6442
  const format = options.format || formatType.format;
6415
6443
  const type = options.type || getTextureTypeForArrayType(gl, src, formatType.type);
6416
- if (!isArrayBuffer$1(src)) {
6444
+ if (!isArrayBuffer(src)) {
6417
6445
  const Type = getTypedArrayTypeForGLType(type);
6418
6446
  src = new Type(src);
6419
6447
  } else if (src instanceof Uint8ClampedArray) {
@@ -6426,7 +6454,7 @@ function setTextureFromArray(gl, tex, src, options) {
6426
6454
  throw "length wrong size for format: " + glEnumToString(gl, format);
6427
6455
  }
6428
6456
  let dimensions;
6429
- if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
6457
+ if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
6430
6458
  if (!width && !height && !depth) {
6431
6459
  const size = Math.cbrt(numElements);
6432
6460
  if (size % 1 !== 0) {
@@ -6456,7 +6484,7 @@ function setTextureFromArray(gl, tex, src, options) {
6456
6484
  setSkipStateToDefault(gl);
6457
6485
  gl.pixelStorei(UNPACK_ALIGNMENT, options.unpackAlignment || 1);
6458
6486
  setPackState(gl, options);
6459
- if (target === TEXTURE_CUBE_MAP) {
6487
+ if (target === TEXTURE_CUBE_MAP$1) {
6460
6488
  const elementsPerElement = bytesPerElement / src.BYTES_PER_ELEMENT;
6461
6489
  const faceSize = numElements / 6 * elementsPerElement;
6462
6490
 
@@ -6465,7 +6493,7 @@ function setTextureFromArray(gl, tex, src, options) {
6465
6493
  const data = src.subarray(offset, offset + faceSize);
6466
6494
  gl.texImage2D(f.face, level, internalFormat, width, height, 0, format, type, data);
6467
6495
  });
6468
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
6496
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
6469
6497
  gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, src);
6470
6498
  } else {
6471
6499
  gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, src);
@@ -6487,19 +6515,19 @@ function setTextureFromArray(gl, tex, src, options) {
6487
6515
  * @memberOf module:twgl/textures
6488
6516
  */
6489
6517
  function setEmptyTexture(gl, tex, options) {
6490
- const target = options.target || TEXTURE_2D;
6518
+ const target = options.target || TEXTURE_2D$2;
6491
6519
  gl.bindTexture(target, tex);
6492
6520
  const level = options.level || 0;
6493
- const internalFormat = options.internalFormat || options.format || RGBA;
6521
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
6494
6522
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
6495
6523
  const format = options.format || formatType.format;
6496
6524
  const type = options.type || formatType.type;
6497
6525
  setPackState(gl, options);
6498
- if (target === TEXTURE_CUBE_MAP) {
6526
+ if (target === TEXTURE_CUBE_MAP$1) {
6499
6527
  for (let ii = 0; ii < 6; ++ii) {
6500
6528
  gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, options.width, options.height, 0, format, type, null);
6501
6529
  }
6502
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
6530
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
6503
6531
  gl.texImage3D(target, level, internalFormat, options.width, options.height, options.depth, 0, format, type, null);
6504
6532
  } else {
6505
6533
  gl.texImage2D(target, level, internalFormat, options.width, options.height, 0, format, type, null);
@@ -6522,15 +6550,15 @@ function createTexture(gl, options, callback) {
6522
6550
  callback = callback || noop;
6523
6551
  options = options || defaults$1.textureOptions;
6524
6552
  const tex = gl.createTexture();
6525
- const target = options.target || TEXTURE_2D;
6553
+ const target = options.target || TEXTURE_2D$2;
6526
6554
  let width = options.width || 1;
6527
6555
  let height = options.height || 1;
6528
- const internalFormat = options.internalFormat || RGBA;
6556
+ const internalFormat = options.internalFormat || RGBA$1;
6529
6557
  gl.bindTexture(target, tex);
6530
- if (target === TEXTURE_CUBE_MAP) {
6558
+ if (target === TEXTURE_CUBE_MAP$1) {
6531
6559
  // this should have been the default for cubemaps :(
6532
- gl.texParameteri(target, TEXTURE_WRAP_S, CLAMP_TO_EDGE);
6533
- gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE);
6560
+ gl.texParameteri(target, TEXTURE_WRAP_S, CLAMP_TO_EDGE$1);
6561
+ gl.texParameteri(target, TEXTURE_WRAP_T, CLAMP_TO_EDGE$1);
6534
6562
  }
6535
6563
  let src = options.src;
6536
6564
  if (src) {
@@ -6539,18 +6567,18 @@ function createTexture(gl, options, callback) {
6539
6567
  }
6540
6568
  if (typeof (src) === "string") {
6541
6569
  loadTextureFromUrl(gl, tex, options, callback);
6542
- } else if (isArrayBuffer$1(src) ||
6570
+ } else if (isArrayBuffer(src) ||
6543
6571
  (Array.isArray(src) && (
6544
6572
  typeof src[0] === 'number' ||
6545
6573
  Array.isArray(src[0]) ||
6546
- isArrayBuffer$1(src[0]))
6574
+ isArrayBuffer(src[0]))
6547
6575
  )
6548
6576
  ) {
6549
6577
  const dimensions = setTextureFromArray(gl, tex, src, options);
6550
6578
  width = dimensions.width;
6551
6579
  height = dimensions.height;
6552
6580
  } else if (Array.isArray(src) && (typeof (src[0]) === 'string' || isTexImageSource(src[0]))) {
6553
- if (target === TEXTURE_CUBE_MAP) {
6581
+ if (target === TEXTURE_CUBE_MAP$1) {
6554
6582
  loadCubemapFromUrls(gl, tex, options, callback);
6555
6583
  } else {
6556
6584
  loadSlicesFromUrls(gl, tex, options, callback);
@@ -6591,26 +6619,26 @@ function resizeTexture(gl, tex, options, width, height, depth) {
6591
6619
  width = width || options.width;
6592
6620
  height = height || options.height;
6593
6621
  depth = depth || options.depth;
6594
- const target = options.target || TEXTURE_2D;
6622
+ const target = options.target || TEXTURE_2D$2;
6595
6623
  gl.bindTexture(target, tex);
6596
6624
  const level = options.level || 0;
6597
- const internalFormat = options.internalFormat || options.format || RGBA;
6625
+ const internalFormat = options.internalFormat || options.format || RGBA$1;
6598
6626
  const formatType = getFormatAndTypeForInternalFormat(internalFormat);
6599
6627
  const format = options.format || formatType.format;
6600
6628
  let type;
6601
6629
  const src = options.src;
6602
6630
  if (!src) {
6603
6631
  type = options.type || formatType.type;
6604
- } else if (isArrayBuffer$1(src) || (Array.isArray(src) && typeof (src[0]) === 'number')) {
6632
+ } else if (isArrayBuffer(src) || (Array.isArray(src) && typeof (src[0]) === 'number')) {
6605
6633
  type = options.type || getTextureTypeForArrayType(gl, src, formatType.type);
6606
6634
  } else {
6607
6635
  type = options.type || formatType.type;
6608
6636
  }
6609
- if (target === TEXTURE_CUBE_MAP) {
6637
+ if (target === TEXTURE_CUBE_MAP$1) {
6610
6638
  for (let ii = 0; ii < 6; ++ii) {
6611
6639
  gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, width, height, 0, format, type, null);
6612
6640
  }
6613
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
6641
+ } else if (target === TEXTURE_3D$1 || target === TEXTURE_2D_ARRAY$1) {
6614
6642
  gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, null);
6615
6643
  } else {
6616
6644
  gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, null);
@@ -6806,8 +6834,8 @@ var textures = /*#__PURE__*/Object.freeze({
6806
6834
  * @module twgl/programs
6807
6835
  */
6808
6836
 
6809
- const error$1 = error;
6810
- const warn$1 = warn;
6837
+ const error = error$1;
6838
+ const warn = warn$1;
6811
6839
  function getElementById(id) {
6812
6840
  return (typeof document !== 'undefined' && document.getElementById)
6813
6841
  ? document.getElementById(id)
@@ -6817,7 +6845,7 @@ function getElementById(id) {
6817
6845
  const TEXTURE0 = 0x84c0;
6818
6846
  const DYNAMIC_DRAW = 0x88e8;
6819
6847
 
6820
- const ARRAY_BUFFER$1 = 0x8892;
6848
+ const ARRAY_BUFFER = 0x8892;
6821
6849
  const ELEMENT_ARRAY_BUFFER$1 = 0x8893;
6822
6850
  const UNIFORM_BUFFER = 0x8a11;
6823
6851
  const TRANSFORM_FEEDBACK_BUFFER = 0x8c8e;
@@ -6839,11 +6867,11 @@ const UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8a46;
6839
6867
  const UNIFORM_BLOCK_DATA_SIZE = 0x8a40;
6840
6868
  const UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8a43;
6841
6869
 
6842
- const FLOAT$3 = 0x1406;
6870
+ const FLOAT = 0x1406;
6843
6871
  const FLOAT_VEC2 = 0x8B50;
6844
6872
  const FLOAT_VEC3 = 0x8B51;
6845
6873
  const FLOAT_VEC4 = 0x8B52;
6846
- const INT$3 = 0x1404;
6874
+ const INT = 0x1404;
6847
6875
  const INT_VEC2 = 0x8B53;
6848
6876
  const INT_VEC3 = 0x8B54;
6849
6877
  const INT_VEC4 = 0x8B55;
@@ -6867,7 +6895,7 @@ const FLOAT_MAT4x3 = 0x8B6A;
6867
6895
  const SAMPLER_2D_ARRAY = 0x8DC1;
6868
6896
  const SAMPLER_2D_ARRAY_SHADOW = 0x8DC4;
6869
6897
  const SAMPLER_CUBE_SHADOW = 0x8DC5;
6870
- const UNSIGNED_INT$3 = 0x1405;
6898
+ const UNSIGNED_INT = 0x1405;
6871
6899
  const UNSIGNED_INT_VEC2 = 0x8DC6;
6872
6900
  const UNSIGNED_INT_VEC3 = 0x8DC7;
6873
6901
  const UNSIGNED_INT_VEC4 = 0x8DC8;
@@ -6881,9 +6909,9 @@ const UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4;
6881
6909
  const UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7;
6882
6910
 
6883
6911
  const TEXTURE_2D$1 = 0x0DE1;
6884
- const TEXTURE_CUBE_MAP$1 = 0x8513;
6885
- const TEXTURE_3D$1 = 0x806F;
6886
- const TEXTURE_2D_ARRAY$1 = 0x8C1A;
6912
+ const TEXTURE_CUBE_MAP = 0x8513;
6913
+ const TEXTURE_3D = 0x806F;
6914
+ const TEXTURE_2D_ARRAY = 0x8C1A;
6887
6915
 
6888
6916
  const typeMap = {};
6889
6917
 
@@ -7097,15 +7125,15 @@ function samplerArraySetter(gl, type, unit, location, size) {
7097
7125
  };
7098
7126
  }
7099
7127
 
7100
- typeMap[FLOAT$3] = { Type: Float32Array, size: 4, setter: floatSetter, arraySetter: floatArraySetter, };
7128
+ typeMap[FLOAT] = { Type: Float32Array, size: 4, setter: floatSetter, arraySetter: floatArraySetter, };
7101
7129
  typeMap[FLOAT_VEC2] = { Type: Float32Array, size: 8, setter: floatVec2Setter, cols: 2, };
7102
7130
  typeMap[FLOAT_VEC3] = { Type: Float32Array, size: 12, setter: floatVec3Setter, cols: 3, };
7103
7131
  typeMap[FLOAT_VEC4] = { Type: Float32Array, size: 16, setter: floatVec4Setter, cols: 4, };
7104
- typeMap[INT$3] = { Type: Int32Array, size: 4, setter: intSetter, arraySetter: intArraySetter, };
7132
+ typeMap[INT] = { Type: Int32Array, size: 4, setter: intSetter, arraySetter: intArraySetter, };
7105
7133
  typeMap[INT_VEC2] = { Type: Int32Array, size: 8, setter: intVec2Setter, cols: 2, };
7106
7134
  typeMap[INT_VEC3] = { Type: Int32Array, size: 12, setter: intVec3Setter, cols: 3, };
7107
7135
  typeMap[INT_VEC4] = { Type: Int32Array, size: 16, setter: intVec4Setter, cols: 4, };
7108
- typeMap[UNSIGNED_INT$3] = { Type: Uint32Array, size: 4, setter: uintSetter, arraySetter: uintArraySetter, };
7136
+ typeMap[UNSIGNED_INT] = { Type: Uint32Array, size: 4, setter: uintSetter, arraySetter: uintArraySetter, };
7109
7137
  typeMap[UNSIGNED_INT_VEC2] = { Type: Uint32Array, size: 8, setter: uintVec2Setter, cols: 2, };
7110
7138
  typeMap[UNSIGNED_INT_VEC3] = { Type: Uint32Array, size: 12, setter: uintVec3Setter, cols: 3, };
7111
7139
  typeMap[UNSIGNED_INT_VEC4] = { Type: Uint32Array, size: 16, setter: uintVec4Setter, cols: 4, };
@@ -7123,20 +7151,20 @@ typeMap[FLOAT_MAT3x4] = { Type: Float32Array, size: 48, setter:
7123
7151
  typeMap[FLOAT_MAT4x2] = { Type: Float32Array, size: 64, setter: floatMat42Setter, rows: 4, cols: 2, };
7124
7152
  typeMap[FLOAT_MAT4x3] = { Type: Float32Array, size: 64, setter: floatMat43Setter, rows: 4, cols: 3, };
7125
7153
  typeMap[SAMPLER_2D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
7126
- typeMap[SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP$1, };
7127
- typeMap[SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D$1, };
7154
+ typeMap[SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
7155
+ typeMap[SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D, };
7128
7156
  typeMap[SAMPLER_2D_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
7129
- typeMap[SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY$1, };
7130
- typeMap[SAMPLER_2D_ARRAY_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY$1, };
7131
- typeMap[SAMPLER_CUBE_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP$1, };
7157
+ typeMap[SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
7158
+ typeMap[SAMPLER_2D_ARRAY_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
7159
+ typeMap[SAMPLER_CUBE_SHADOW] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
7132
7160
  typeMap[INT_SAMPLER_2D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
7133
- typeMap[INT_SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D$1, };
7134
- typeMap[INT_SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP$1, };
7135
- typeMap[INT_SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY$1, };
7161
+ typeMap[INT_SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D, };
7162
+ typeMap[INT_SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
7163
+ typeMap[INT_SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
7136
7164
  typeMap[UNSIGNED_INT_SAMPLER_2D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D$1, };
7137
- typeMap[UNSIGNED_INT_SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D$1, };
7138
- typeMap[UNSIGNED_INT_SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP$1, };
7139
- typeMap[UNSIGNED_INT_SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY$1, };
7165
+ typeMap[UNSIGNED_INT_SAMPLER_3D] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_3D, };
7166
+ typeMap[UNSIGNED_INT_SAMPLER_CUBE] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_CUBE_MAP, };
7167
+ typeMap[UNSIGNED_INT_SAMPLER_2D_ARRAY] = { Type: null, size: 0, setter: samplerSetter, arraySetter: samplerArraySetter, bindPoint: TEXTURE_2D_ARRAY, };
7140
7168
 
7141
7169
  function floatAttribSetter(gl, index) {
7142
7170
  return function(b) {
@@ -7159,10 +7187,10 @@ function floatAttribSetter(gl, index) {
7159
7187
  throw new Error('the length of a float constant value must be between 1 and 4!');
7160
7188
  }
7161
7189
  } else {
7162
- gl.bindBuffer(ARRAY_BUFFER$1, b.buffer);
7190
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
7163
7191
  gl.enableVertexAttribArray(index);
7164
7192
  gl.vertexAttribPointer(
7165
- index, b.numComponents || b.size, b.type || FLOAT$3, b.normalize || false, b.stride || 0, b.offset || 0);
7193
+ index, b.numComponents || b.size, b.type || FLOAT, b.normalize || false, b.stride || 0, b.offset || 0);
7166
7194
  if (gl.vertexAttribDivisor) {
7167
7195
  gl.vertexAttribDivisor(index, b.divisor || 0);
7168
7196
  }
@@ -7180,10 +7208,10 @@ function intAttribSetter(gl, index) {
7180
7208
  throw new Error('The length of an integer constant value must be 4!');
7181
7209
  }
7182
7210
  } else {
7183
- gl.bindBuffer(ARRAY_BUFFER$1, b.buffer);
7211
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
7184
7212
  gl.enableVertexAttribArray(index);
7185
7213
  gl.vertexAttribIPointer(
7186
- index, b.numComponents || b.size, b.type || INT$3, b.stride || 0, b.offset || 0);
7214
+ index, b.numComponents || b.size, b.type || INT, b.stride || 0, b.offset || 0);
7187
7215
  if (gl.vertexAttribDivisor) {
7188
7216
  gl.vertexAttribDivisor(index, b.divisor || 0);
7189
7217
  }
@@ -7201,10 +7229,10 @@ function uintAttribSetter(gl, index) {
7201
7229
  throw new Error('The length of an unsigned integer constant value must be 4!');
7202
7230
  }
7203
7231
  } else {
7204
- gl.bindBuffer(ARRAY_BUFFER$1, b.buffer);
7232
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
7205
7233
  gl.enableVertexAttribArray(index);
7206
7234
  gl.vertexAttribIPointer(
7207
- index, b.numComponents || b.size, b.type || UNSIGNED_INT$3, b.stride || 0, b.offset || 0);
7235
+ index, b.numComponents || b.size, b.type || UNSIGNED_INT, b.stride || 0, b.offset || 0);
7208
7236
  if (gl.vertexAttribDivisor) {
7209
7237
  gl.vertexAttribDivisor(index, b.divisor || 0);
7210
7238
  }
@@ -7217,10 +7245,10 @@ function matAttribSetter(gl, index, typeInfo) {
7217
7245
  const count = typeInfo.count;
7218
7246
 
7219
7247
  return function(b) {
7220
- gl.bindBuffer(ARRAY_BUFFER$1, b.buffer);
7248
+ gl.bindBuffer(ARRAY_BUFFER, b.buffer);
7221
7249
  const numComponents = b.size || b.numComponents || defaultSize;
7222
7250
  const size = numComponents / count;
7223
- const type = b.type || FLOAT$3;
7251
+ const type = b.type || FLOAT;
7224
7252
  const typeInfo = typeMap[type];
7225
7253
  const stride = typeInfo.size * numComponents;
7226
7254
  const normalize = b.normalize || false;
@@ -7240,15 +7268,15 @@ function matAttribSetter(gl, index, typeInfo) {
7240
7268
 
7241
7269
 
7242
7270
  const attrTypeMap = {};
7243
- attrTypeMap[FLOAT$3] = { size: 4, setter: floatAttribSetter, };
7271
+ attrTypeMap[FLOAT] = { size: 4, setter: floatAttribSetter, };
7244
7272
  attrTypeMap[FLOAT_VEC2] = { size: 8, setter: floatAttribSetter, };
7245
7273
  attrTypeMap[FLOAT_VEC3] = { size: 12, setter: floatAttribSetter, };
7246
7274
  attrTypeMap[FLOAT_VEC4] = { size: 16, setter: floatAttribSetter, };
7247
- attrTypeMap[INT$3] = { size: 4, setter: intAttribSetter, };
7275
+ attrTypeMap[INT] = { size: 4, setter: intAttribSetter, };
7248
7276
  attrTypeMap[INT_VEC2] = { size: 8, setter: intAttribSetter, };
7249
7277
  attrTypeMap[INT_VEC3] = { size: 12, setter: intAttribSetter, };
7250
7278
  attrTypeMap[INT_VEC4] = { size: 16, setter: intAttribSetter, };
7251
- attrTypeMap[UNSIGNED_INT$3] = { size: 4, setter: uintAttribSetter, };
7279
+ attrTypeMap[UNSIGNED_INT] = { size: 4, setter: uintAttribSetter, };
7252
7280
  attrTypeMap[UNSIGNED_INT_VEC2] = { size: 8, setter: uintAttribSetter, };
7253
7281
  attrTypeMap[UNSIGNED_INT_VEC3] = { size: 12, setter: uintAttribSetter, };
7254
7282
  attrTypeMap[UNSIGNED_INT_VEC4] = { size: 16, setter: uintAttribSetter, };
@@ -7372,7 +7400,7 @@ function loadShader(gl, shaderSource, shaderType, progOptions) {
7372
7400
  * @private
7373
7401
  */
7374
7402
  function checkShaderStatus(gl, shaderType, shader, errFn) {
7375
- errFn = errFn || error$1;
7403
+ errFn = errFn || error;
7376
7404
  // Check the compile status
7377
7405
  const compiled = gl.getShaderParameter(shader, COMPILE_STATUS);
7378
7406
  if (!compiled) {
@@ -7430,7 +7458,7 @@ function getProgramOptions(opt_attribs, opt_locations, opt_errorCallback) {
7430
7458
  callback = opt.callback;
7431
7459
  }
7432
7460
 
7433
- const errorCallback = opt_errorCallback || error$1;
7461
+ const errorCallback = opt_errorCallback || error;
7434
7462
  const errors = [];
7435
7463
  const options = {
7436
7464
  errorCallback(msg, ...args) {
@@ -7649,7 +7677,7 @@ async function checkForProgramLinkCompletionAsync(gl, program, progOptions) {
7649
7677
  const success = checkProgramStatus(gl, program, progOptions.errorCallback);
7650
7678
  const err = success ? undefined : progOptions.errors.join('\n');
7651
7679
  if (!success) {
7652
- const errFn = progOptions.errorCallback || error$1;
7680
+ const errFn = progOptions.errorCallback || error;
7653
7681
  errFn(err);
7654
7682
  gl.deleteProgram(program);
7655
7683
  // TODO: delete shaders, but only shaders that were created newly for this
@@ -7668,7 +7696,7 @@ async function checkForProgramLinkCompletionAsync(gl, program, progOptions) {
7668
7696
  * @private
7669
7697
  */
7670
7698
  function checkProgramStatus(gl, program, errFn) {
7671
- errFn = errFn || error$1;
7699
+ errFn = errFn || error;
7672
7700
  // Check the link status
7673
7701
  const linked = gl.getProgramParameter(program, LINK_STATUS);
7674
7702
  if (!linked) {
@@ -8158,7 +8186,7 @@ function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockN
8158
8186
  const uniformData = uniformBlockSpec.uniformData;
8159
8187
  const blockSpec = blockSpecs[blockName];
8160
8188
  if (!blockSpec) {
8161
- warn$1("no uniform block object named:", blockName);
8189
+ warn("no uniform block object named:", blockName);
8162
8190
  return {
8163
8191
  name: blockName,
8164
8192
  uniforms: {},
@@ -8904,7 +8932,7 @@ var programs = /*#__PURE__*/Object.freeze({
8904
8932
  */
8905
8933
 
8906
8934
  const TRIANGLES = 0x0004;
8907
- const UNSIGNED_SHORT$3 = 0x1403;
8935
+ const UNSIGNED_SHORT = 0x1403;
8908
8936
 
8909
8937
  /**
8910
8938
  * Drawing related functions
@@ -8941,9 +8969,9 @@ function drawBufferInfo(gl, bufferInfo, type, count, offset, instanceCount) {
8941
8969
  offset = offset === undefined ? 0 : offset;
8942
8970
  if (elementType || indices) {
8943
8971
  if (instanceCount !== undefined) {
8944
- gl.drawElementsInstanced(type, numElements, elementType === undefined ? UNSIGNED_SHORT$3 : bufferInfo.elementType, offset, instanceCount);
8972
+ gl.drawElementsInstanced(type, numElements, elementType === undefined ? UNSIGNED_SHORT : bufferInfo.elementType, offset, instanceCount);
8945
8973
  } else {
8946
- gl.drawElements(type, numElements, elementType === undefined ? UNSIGNED_SHORT$3 : bufferInfo.elementType, offset);
8974
+ gl.drawElements(type, numElements, elementType === undefined ? UNSIGNED_SHORT : bufferInfo.elementType, offset);
8947
8975
  }
8948
8976
  } else {
8949
8977
  if (instanceCount !== undefined) {
@@ -9072,36 +9100,36 @@ var draw = /*#__PURE__*/Object.freeze({
9072
9100
 
9073
9101
  const FRAMEBUFFER = 0x8d40;
9074
9102
  const RENDERBUFFER = 0x8d41;
9075
- const TEXTURE_2D$2 = 0x0de1;
9103
+ const TEXTURE_2D = 0x0de1;
9076
9104
 
9077
- const UNSIGNED_BYTE$3 = 0x1401;
9105
+ const UNSIGNED_BYTE = 0x1401;
9078
9106
 
9079
9107
  /* PixelFormat */
9080
- const DEPTH_COMPONENT$1 = 0x1902;
9081
- const RGBA$1 = 0x1908;
9082
- const DEPTH_COMPONENT24$1 = 0x81a6;
9083
- const DEPTH_COMPONENT32F$1 = 0x8cac;
9084
- const DEPTH24_STENCIL8$1 = 0x88f0;
9085
- const DEPTH32F_STENCIL8$1 = 0x8cad;
9108
+ const DEPTH_COMPONENT = 0x1902;
9109
+ const RGBA = 0x1908;
9110
+ const DEPTH_COMPONENT24 = 0x81a6;
9111
+ const DEPTH_COMPONENT32F = 0x8cac;
9112
+ const DEPTH24_STENCIL8 = 0x88f0;
9113
+ const DEPTH32F_STENCIL8 = 0x8cad;
9086
9114
 
9087
9115
  /* Framebuffer Object. */
9088
- const RGBA4$1 = 0x8056;
9089
- const RGB5_A1$1 = 0x8057;
9090
- const RGB565$1 = 0x8D62;
9091
- const DEPTH_COMPONENT16$1 = 0x81A5;
9116
+ const RGBA4 = 0x8056;
9117
+ const RGB5_A1 = 0x8057;
9118
+ const RGB565 = 0x8D62;
9119
+ const DEPTH_COMPONENT16 = 0x81A5;
9092
9120
  const STENCIL_INDEX = 0x1901;
9093
9121
  const STENCIL_INDEX8 = 0x8D48;
9094
- const DEPTH_STENCIL$1 = 0x84F9;
9122
+ const DEPTH_STENCIL = 0x84F9;
9095
9123
  const COLOR_ATTACHMENT0 = 0x8CE0;
9096
9124
  const DEPTH_ATTACHMENT = 0x8D00;
9097
9125
  const STENCIL_ATTACHMENT = 0x8D20;
9098
9126
  const DEPTH_STENCIL_ATTACHMENT = 0x821A;
9099
9127
 
9100
9128
  /* TextureWrapMode */
9101
- const CLAMP_TO_EDGE$1 = 0x812F;
9129
+ const CLAMP_TO_EDGE = 0x812F;
9102
9130
 
9103
9131
  /* TextureMagFilter */
9104
- const LINEAR$1 = 0x2601;
9132
+ const LINEAR = 0x2601;
9105
9133
 
9106
9134
  /**
9107
9135
  * The options for a framebuffer attachment.
@@ -9136,31 +9164,31 @@ const LINEAR$1 = 0x2601;
9136
9164
  */
9137
9165
 
9138
9166
  const defaultAttachments = [
9139
- { format: RGBA$1, type: UNSIGNED_BYTE$3, min: LINEAR$1, wrap: CLAMP_TO_EDGE$1, },
9140
- { format: DEPTH_STENCIL$1, },
9167
+ { format: RGBA, type: UNSIGNED_BYTE, min: LINEAR, wrap: CLAMP_TO_EDGE, },
9168
+ { format: DEPTH_STENCIL, },
9141
9169
  ];
9142
9170
 
9143
9171
  const attachmentsByFormat = {};
9144
- attachmentsByFormat[DEPTH_STENCIL$1] = DEPTH_STENCIL_ATTACHMENT;
9172
+ attachmentsByFormat[DEPTH_STENCIL] = DEPTH_STENCIL_ATTACHMENT;
9145
9173
  attachmentsByFormat[STENCIL_INDEX] = STENCIL_ATTACHMENT;
9146
9174
  attachmentsByFormat[STENCIL_INDEX8] = STENCIL_ATTACHMENT;
9147
- attachmentsByFormat[DEPTH_COMPONENT$1] = DEPTH_ATTACHMENT;
9148
- attachmentsByFormat[DEPTH_COMPONENT16$1] = DEPTH_ATTACHMENT;
9149
- attachmentsByFormat[DEPTH_COMPONENT24$1] = DEPTH_ATTACHMENT;
9150
- attachmentsByFormat[DEPTH_COMPONENT32F$1] = DEPTH_ATTACHMENT;
9151
- attachmentsByFormat[DEPTH24_STENCIL8$1] = DEPTH_STENCIL_ATTACHMENT;
9152
- attachmentsByFormat[DEPTH32F_STENCIL8$1] = DEPTH_STENCIL_ATTACHMENT;
9175
+ attachmentsByFormat[DEPTH_COMPONENT] = DEPTH_ATTACHMENT;
9176
+ attachmentsByFormat[DEPTH_COMPONENT16] = DEPTH_ATTACHMENT;
9177
+ attachmentsByFormat[DEPTH_COMPONENT24] = DEPTH_ATTACHMENT;
9178
+ attachmentsByFormat[DEPTH_COMPONENT32F] = DEPTH_ATTACHMENT;
9179
+ attachmentsByFormat[DEPTH24_STENCIL8] = DEPTH_STENCIL_ATTACHMENT;
9180
+ attachmentsByFormat[DEPTH32F_STENCIL8] = DEPTH_STENCIL_ATTACHMENT;
9153
9181
 
9154
9182
  function getAttachmentPointForFormat(format, internalFormat) {
9155
9183
  return attachmentsByFormat[format] || attachmentsByFormat[internalFormat];
9156
9184
  }
9157
9185
 
9158
9186
  const renderbufferFormats = {};
9159
- renderbufferFormats[RGBA4$1] = true;
9160
- renderbufferFormats[RGB5_A1$1] = true;
9161
- renderbufferFormats[RGB565$1] = true;
9162
- renderbufferFormats[DEPTH_STENCIL$1] = true;
9163
- renderbufferFormats[DEPTH_COMPONENT16$1] = true;
9187
+ renderbufferFormats[RGBA4] = true;
9188
+ renderbufferFormats[RGB5_A1] = true;
9189
+ renderbufferFormats[RGB565] = true;
9190
+ renderbufferFormats[DEPTH_STENCIL] = true;
9191
+ renderbufferFormats[DEPTH_COMPONENT16] = true;
9164
9192
  renderbufferFormats[STENCIL_INDEX] = true;
9165
9193
  renderbufferFormats[STENCIL_INDEX8] = true;
9166
9194
 
@@ -9263,10 +9291,10 @@ function createFramebufferInfo(gl, attachments, width, height) {
9263
9291
  textureOptions.height = height;
9264
9292
  if (textureOptions.auto === undefined) {
9265
9293
  textureOptions.auto = false;
9266
- textureOptions.min = textureOptions.min || textureOptions.minMag || LINEAR$1;
9267
- textureOptions.mag = textureOptions.mag || textureOptions.minMag || LINEAR$1;
9268
- textureOptions.wrapS = textureOptions.wrapS || textureOptions.wrap || CLAMP_TO_EDGE$1;
9269
- textureOptions.wrapT = textureOptions.wrapT || textureOptions.wrap || CLAMP_TO_EDGE$1;
9294
+ textureOptions.min = textureOptions.min || textureOptions.minMag || LINEAR;
9295
+ textureOptions.mag = textureOptions.mag || textureOptions.minMag || LINEAR;
9296
+ textureOptions.wrapS = textureOptions.wrapS || textureOptions.wrap || CLAMP_TO_EDGE;
9297
+ textureOptions.wrapT = textureOptions.wrapT || textureOptions.wrap || CLAMP_TO_EDGE;
9270
9298
  }
9271
9299
  attachment = createTexture(gl, textureOptions);
9272
9300
  }
@@ -9285,7 +9313,7 @@ function createFramebufferInfo(gl, attachments, width, height) {
9285
9313
  gl.framebufferTexture2D(
9286
9314
  target,
9287
9315
  attachmentPoint,
9288
- attachmentOptions.target || TEXTURE_2D$2,
9316
+ attachmentOptions.target || TEXTURE_2D,
9289
9317
  attachment,
9290
9318
  attachmentOptions.level || 0);
9291
9319
  }
@@ -9443,7 +9471,7 @@ var framebuffers = /*#__PURE__*/Object.freeze({
9443
9471
  * @module twgl/vertexArrays
9444
9472
  */
9445
9473
 
9446
- const ELEMENT_ARRAY_BUFFER$2 = 0x8893;
9474
+ const ELEMENT_ARRAY_BUFFER = 0x8893;
9447
9475
 
9448
9476
  /**
9449
9477
  * @typedef {Object} VertexArrayInfo
@@ -9523,7 +9551,7 @@ function createVAOAndSetAttributes(gl, setters, attribs, indices) {
9523
9551
  gl.bindVertexArray(vao);
9524
9552
  setAttributes(setters, attribs);
9525
9553
  if (indices) {
9526
- gl.bindBuffer(ELEMENT_ARRAY_BUFFER$2, indices);
9554
+ gl.bindBuffer(ELEMENT_ARRAY_BUFFER, indices);
9527
9555
  }
9528
9556
  // We unbind this because otherwise any change to ELEMENT_ARRAY_BUFFER
9529
9557
  // like when creating buffers for other stuff will mess up this VAO's binding
@@ -9577,7 +9605,7 @@ var vertexArrays = /*#__PURE__*/Object.freeze({
9577
9605
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
9578
9606
  * DEALINGS IN THE SOFTWARE.
9579
9607
  */
9580
- const defaults$2 = {
9608
+ const defaults = {
9581
9609
  addExtensionsToContext: true,
9582
9610
  };
9583
9611
 
@@ -9652,9 +9680,9 @@ const defaults$2 = {
9652
9680
  * @param {module:twgl.Defaults} newDefaults The default settings.
9653
9681
  * @memberOf module:twgl
9654
9682
  */
9655
- function setDefaults$2(newDefaults) {
9656
- copyExistingProperties(newDefaults, defaults$2);
9657
- setDefaults(newDefaults); // eslint-disable-line
9683
+ function setDefaults(newDefaults) {
9684
+ copyExistingProperties(newDefaults, defaults);
9685
+ setDefaults$2(newDefaults); // eslint-disable-line
9658
9686
  setDefaults$1(newDefaults); // eslint-disable-line
9659
9687
  }
9660
9688
 
@@ -9678,7 +9706,7 @@ function addExtensionToContext(gl, extensionName) {
9678
9706
  }
9679
9707
  if (gl[name] !== undefined) {
9680
9708
  if (!isFunc && gl[name] !== value) {
9681
- warn(name, gl[name], value, key);
9709
+ warn$1(name, gl[name], value, key);
9682
9710
  }
9683
9711
  } else {
9684
9712
  if (isFunc) {
@@ -9806,7 +9834,7 @@ function create3DContext(canvas, opt_attribs) {
9806
9834
  for (let ii = 0; ii < names.length; ++ii) {
9807
9835
  context = canvas.getContext(names[ii], opt_attribs);
9808
9836
  if (context) {
9809
- if (defaults$2.addExtensionsToContext) {
9837
+ if (defaults.addExtensionsToContext) {
9810
9838
  addExtensionsToContext(context);
9811
9839
  }
9812
9840
  break;
@@ -9854,7 +9882,7 @@ function createContext(canvas, opt_attribs) {
9854
9882
  for (let ii = 0; ii < names.length; ++ii) {
9855
9883
  context = canvas.getContext(names[ii], opt_attribs);
9856
9884
  if (context) {
9857
- if (defaults$2.addExtensionsToContext) {
9885
+ if (defaults.addExtensionsToContext) {
9858
9886
  addExtensionsToContext(context);
9859
9887
  }
9860
9888
  break;
@@ -9906,4 +9934,4 @@ function resizeCanvasToDisplaySize(canvas, multiplier) {
9906
9934
  return false;
9907
9935
  }
9908
9936
 
9909
- export { addExtensionsToContext, attributes, bindFramebufferInfo, bindTransformFeedbackInfo, bindUniformBlock, canFilter, canGenerateMipmap, createAttribsFromArrays, createAttributeSetters, createBufferFromArray, createBufferFromTypedArray, createBufferInfoFromArrays, createBuffersFromArrays, createFramebufferInfo, createProgram, createProgramAsync, createProgramFromScripts, createProgramFromSources, createProgramInfo, createProgramInfoAsync, createProgramInfoFromProgram, createSampler, createSamplers, createTexture, createTextures, createTransformFeedback, createTransformFeedbackInfo, createUniformBlockInfo, createUniformBlockInfoFromProgram, createUniformBlockSpecFromProgram, createUniformSetters, createVAOAndSetAttributes, createVAOFromBufferInfo, createVertexArrayInfo, draw, drawBufferInfo, drawObjectList, framebuffers, getArray as getArray_, getBytesPerElementForInternalFormat, getContext, getFormatAndTypeForInternalFormat, getGLTypeForTypedArray, getGLTypeForTypedArrayType, getNumComponentsForFormat, getNumComponents as getNumComponents_, getTypedArrayTypeForGLType, getWebGLContext, glEnumToString, isArrayBuffer, isWebGL1, isWebGL2, loadTextureFromUrl, m4, primitives, programs, resizeCanvasToDisplaySize, resizeFramebufferInfo, resizeTexture, setAttribInfoBufferFromArray, setDefaults as setAttributeDefaults_, setAttributePrefix, setAttributes, setBlockUniforms, setBuffersAndAttributes, setDefaultTextureColor, setDefaults$2 as setDefaults, setEmptyTexture, setSamplerParameters, setDefaults$1 as setTextureDefaults_, setTextureFilteringForSize, setTextureFromArray, setTextureFromElement, setTextureParameters, setUniformBlock, setUniforms, setUniformsAndBindTextures, textures, typedarrays, utils, v3, vertexArrays };
9937
+ export { addExtensionsToContext, attributes, bindFramebufferInfo, bindTransformFeedbackInfo, bindUniformBlock, canFilter, canGenerateMipmap, createAttribsFromArrays, createAttributeSetters, createBufferFromArray, createBufferFromTypedArray, createBufferInfoFromArrays, createBuffersFromArrays, createFramebufferInfo, createProgram, createProgramAsync, createProgramFromScripts, createProgramFromSources, createProgramInfo, createProgramInfoAsync, createProgramInfoFromProgram, createSampler, createSamplers, createTexture, createTextures, createTransformFeedback, createTransformFeedbackInfo, createUniformBlockInfo, createUniformBlockInfoFromProgram, createUniformBlockSpecFromProgram, createUniformSetters, createVAOAndSetAttributes, createVAOFromBufferInfo, createVertexArrayInfo, draw, drawBufferInfo, drawObjectList, framebuffers, getArray$1 as getArray_, getBytesPerElementForInternalFormat, getContext, getFormatAndTypeForInternalFormat, getGLTypeForTypedArray, getGLTypeForTypedArrayType, getNumComponentsForFormat, getNumComponents$1 as getNumComponents_, getTypedArrayTypeForGLType, getWebGLContext, glEnumToString, isArrayBuffer$1 as isArrayBuffer, isWebGL1, isWebGL2, loadTextureFromUrl, m4, primitives, programs, resizeCanvasToDisplaySize, resizeFramebufferInfo, resizeTexture, setAttribInfoBufferFromArray, setDefaults$2 as setAttributeDefaults_, setAttributePrefix, setAttributes, setBlockUniforms, setBuffersAndAttributes, setDefaultTextureColor, setDefaults, setEmptyTexture, setSamplerParameters, setDefaults$1 as setTextureDefaults_, setTextureFilteringForSize, setTextureFromArray, setTextureFromElement, setTextureParameters, setUniformBlock, setUniforms, setUniformsAndBindTextures, textures, typedarrays, utils, v3, vertexArrays };