twgl.js 5.5.3 → 6.1.1

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,5 +1,5 @@
1
1
  /*!
2
- * @license twgl.js 5.5.3 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
2
+ * @license twgl.js 6.1.1 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
3
3
  * Available via the MIT license.
4
4
  * see: http://github.com/greggman/twgl.js for details
5
5
  */
@@ -12,106 +12,20 @@
12
12
  exports["twgl"] = factory();
13
13
  else
14
14
  root["twgl"] = factory();
15
- })(typeof self !== 'undefined' ? self : this, function() {
16
- return /******/ (function(modules) { // webpackBootstrap
17
- /******/ // The module cache
18
- /******/ var installedModules = {};
19
- /******/
20
- /******/ // The require function
21
- /******/ function __webpack_require__(moduleId) {
22
- /******/
23
- /******/ // Check if module is in cache
24
- /******/ if(installedModules[moduleId]) {
25
- /******/ return installedModules[moduleId].exports;
26
- /******/ }
27
- /******/ // Create a new module (and put it into the cache)
28
- /******/ var module = installedModules[moduleId] = {
29
- /******/ i: moduleId,
30
- /******/ l: false,
31
- /******/ exports: {}
32
- /******/ };
33
- /******/
34
- /******/ // Execute the module function
35
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
36
- /******/
37
- /******/ // Flag the module as loaded
38
- /******/ module.l = true;
39
- /******/
40
- /******/ // Return the exports of the module
41
- /******/ return module.exports;
42
- /******/ }
43
- /******/
44
- /******/
45
- /******/ // expose the modules object (__webpack_modules__)
46
- /******/ __webpack_require__.m = modules;
47
- /******/
48
- /******/ // expose the module cache
49
- /******/ __webpack_require__.c = installedModules;
50
- /******/
51
- /******/ // define getter function for harmony exports
52
- /******/ __webpack_require__.d = function(exports, name, getter) {
53
- /******/ if(!__webpack_require__.o(exports, name)) {
54
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
55
- /******/ }
56
- /******/ };
57
- /******/
58
- /******/ // define __esModule on exports
59
- /******/ __webpack_require__.r = function(exports) {
60
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
61
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
62
- /******/ }
63
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
64
- /******/ };
65
- /******/
66
- /******/ // create a fake namespace object
67
- /******/ // mode & 1: value is a module id, require it
68
- /******/ // mode & 2: merge all properties of value into the ns
69
- /******/ // mode & 4: return value when already ns object
70
- /******/ // mode & 8|1: behave like require
71
- /******/ __webpack_require__.t = function(value, mode) {
72
- /******/ if(mode & 1) value = __webpack_require__(value);
73
- /******/ if(mode & 8) return value;
74
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
75
- /******/ var ns = Object.create(null);
76
- /******/ __webpack_require__.r(ns);
77
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
78
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
79
- /******/ return ns;
80
- /******/ };
81
- /******/
82
- /******/ // getDefaultExport function for compatibility with non-harmony modules
83
- /******/ __webpack_require__.n = function(module) {
84
- /******/ var getter = module && module.__esModule ?
85
- /******/ function getDefault() { return module['default']; } :
86
- /******/ function getModuleExports() { return module; };
87
- /******/ __webpack_require__.d(getter, 'a', getter);
88
- /******/ return getter;
89
- /******/ };
90
- /******/
91
- /******/ // Object.prototype.hasOwnProperty.call
92
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
93
- /******/
94
- /******/ // __webpack_public_path__
95
- /******/ __webpack_require__.p = "";
96
- /******/
97
- /******/
98
- /******/ // Load entry module and return exports
99
- /******/ return __webpack_require__(__webpack_require__.s = "./src/twgl-full.js");
100
- /******/ })
101
- /************************************************************************/
102
- /******/ ({
15
+ })(typeof self !== 'undefined' ? self : this, () => {
16
+ return /******/ (() => { // webpackBootstrap
17
+ /******/ "use strict";
18
+ /******/ var __webpack_modules__ = ({
103
19
 
104
20
  /***/ "./src/attributes.js":
105
21
  /*!***************************!*\
106
22
  !*** ./src/attributes.js ***!
107
23
  \***************************/
108
- /*! no static exports found */
109
- /***/ (function(module, exports, __webpack_require__) {
24
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
110
25
 
111
- "use strict";
112
26
 
113
27
 
114
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
28
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
115
29
  exports.__esModule = true;
116
30
  exports.createAttribsFromArrays = createAttribsFromArrays;
117
31
  exports.createBufferFromArray = createBufferFromArray;
@@ -125,8 +39,8 @@ exports.setAttributeDefaults_ = setDefaults;
125
39
  exports.setAttributePrefix = setAttributePrefix;
126
40
  var typedArrays = _interopRequireWildcard(__webpack_require__(/*! ./typedarrays.js */ "./src/typedarrays.js"));
127
41
  var helper = _interopRequireWildcard(__webpack_require__(/*! ./helper.js */ "./src/helper.js"));
128
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
129
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
42
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
43
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
130
44
  /*
131
45
  * Copyright 2019 Gregg Tavares
132
46
  *
@@ -262,7 +176,6 @@ function guessNumComponentsFromName(name, length) {
262
176
  } else {
263
177
  numComponents = 3; // position, normals, indices ...
264
178
  }
265
-
266
179
  if (length % numComponents > 0) {
267
180
  throw new Error("Can not guess numComponents for attribute '".concat(name, "'. Tried ").concat(numComponents, " but ").concat(length, " values is not evenly divisible by ").concat(numComponents, ". You should specify it."));
268
181
  }
@@ -626,7 +539,6 @@ function getNumElementsFromNonIndexedArrays(arrays) {
626
539
  if (length === undefined) {
627
540
  return 1; // There's no arrays
628
541
  }
629
-
630
542
  var numComponents = getNumComponents(array, key);
631
543
  var numElements = length / numComponents;
632
544
  if (length % numComponents > 0) {
@@ -654,7 +566,6 @@ function getNumElementsFromAttributes(gl, attribs) {
654
566
  if (!attrib.buffer) {
655
567
  return 1; // There's no buffer
656
568
  }
657
-
658
569
  gl.bindBuffer(ARRAY_BUFFER, attrib.buffer);
659
570
  var numBytes = gl.getBufferParameter(ARRAY_BUFFER, BUFFER_SIZE);
660
571
  gl.bindBuffer(ARRAY_BUFFER, null);
@@ -868,19 +779,17 @@ function createBuffersFromArrays(gl, arrays) {
868
779
  /*!*********************!*\
869
780
  !*** ./src/draw.js ***!
870
781
  \*********************/
871
- /*! no static exports found */
872
- /***/ (function(module, exports, __webpack_require__) {
782
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
873
783
 
874
- "use strict";
875
784
 
876
785
 
877
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
786
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
878
787
  exports.__esModule = true;
879
788
  exports.drawBufferInfo = drawBufferInfo;
880
789
  exports.drawObjectList = drawObjectList;
881
790
  var programs = _interopRequireWildcard(__webpack_require__(/*! ./programs.js */ "./src/programs.js"));
882
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
883
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
791
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
792
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
884
793
  /*
885
794
  * Copyright 2019 Gregg Tavares
886
795
  *
@@ -1044,21 +953,19 @@ function drawObjectList(gl, objectsToDraw) {
1044
953
  /*!*****************************!*\
1045
954
  !*** ./src/framebuffers.js ***!
1046
955
  \*****************************/
1047
- /*! no static exports found */
1048
- /***/ (function(module, exports, __webpack_require__) {
956
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1049
957
 
1050
- "use strict";
1051
958
 
1052
959
 
1053
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
960
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1054
961
  exports.__esModule = true;
1055
962
  exports.bindFramebufferInfo = bindFramebufferInfo;
1056
963
  exports.createFramebufferInfo = createFramebufferInfo;
1057
964
  exports.resizeFramebufferInfo = resizeFramebufferInfo;
1058
965
  var textures = _interopRequireWildcard(__webpack_require__(/*! ./textures.js */ "./src/textures.js"));
1059
966
  var helper = _interopRequireWildcard(__webpack_require__(/*! ./helper.js */ "./src/helper.js"));
1060
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
1061
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
967
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
968
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
1062
969
  /*
1063
970
  * Copyright 2019 Gregg Tavares
1064
971
  *
@@ -1417,10 +1324,8 @@ function bindFramebufferInfo(gl, framebufferInfo, target) {
1417
1324
  /*!***********************!*\
1418
1325
  !*** ./src/helper.js ***!
1419
1326
  \***********************/
1420
- /*! no static exports found */
1421
- /***/ (function(module, exports, __webpack_require__) {
1327
+ /***/ ((__unused_webpack_module, exports) => {
1422
1328
 
1423
- "use strict";
1424
1329
 
1425
1330
 
1426
1331
  exports.__esModule = true;
@@ -1433,7 +1338,7 @@ exports.isSampler = isSampler;
1433
1338
  exports.isShader = isShader;
1434
1339
  exports.isTexture = isTexture;
1435
1340
  exports.warn = warn;
1436
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1341
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1437
1342
  /*
1438
1343
  * Copyright 2019 Gregg Tavares
1439
1344
  *
@@ -1538,13 +1443,11 @@ function isSampler(gl, t) {
1538
1443
  /*!*******************!*\
1539
1444
  !*** ./src/m4.js ***!
1540
1445
  \*******************/
1541
- /*! no static exports found */
1542
- /***/ (function(module, exports, __webpack_require__) {
1446
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1543
1447
 
1544
- "use strict";
1545
1448
 
1546
1449
 
1547
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1450
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
1548
1451
  exports.__esModule = true;
1549
1452
  exports.axisRotate = axisRotate;
1550
1453
  exports.axisRotation = axisRotation;
@@ -1578,8 +1481,8 @@ exports.translate = translate;
1578
1481
  exports.translation = translation;
1579
1482
  exports.transpose = transpose;
1580
1483
  var v3 = _interopRequireWildcard(__webpack_require__(/*! ./v3.js */ "./src/v3.js"));
1581
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
1582
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
1484
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
1485
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
1583
1486
  /*
1584
1487
  * Copyright 2019 Gregg Tavares
1585
1488
  *
@@ -2750,13 +2653,11 @@ function transformNormal(m, v, dst) {
2750
2653
  /*!***************************!*\
2751
2654
  !*** ./src/primitives.js ***!
2752
2655
  \***************************/
2753
- /*! no static exports found */
2754
- /***/ (function(module, exports, __webpack_require__) {
2656
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
2755
2657
 
2756
- "use strict";
2757
2658
 
2758
2659
 
2759
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2660
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2760
2661
  exports.__esModule = true;
2761
2662
  exports.concatVertices = concatVertices;
2762
2663
  exports.create3DFBuffers = exports.create3DFBufferInfo = void 0;
@@ -2793,8 +2694,8 @@ var helper = _interopRequireWildcard(__webpack_require__(/*! ./helper.js */ "./s
2793
2694
  var typedArrays = _interopRequireWildcard(__webpack_require__(/*! ./typedarrays.js */ "./src/typedarrays.js"));
2794
2695
  var m4 = _interopRequireWildcard(__webpack_require__(/*! ./m4.js */ "./src/m4.js"));
2795
2696
  var v3 = _interopRequireWildcard(__webpack_require__(/*! ./v3.js */ "./src/v3.js"));
2796
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
2797
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
2697
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
2698
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
2798
2699
  /*
2799
2700
  * Copyright 2019 Gregg Tavares
2800
2701
  *
@@ -4397,7 +4298,7 @@ function concatVertices(arrayOfArrays) {
4397
4298
  var baseName;
4398
4299
  // get names of all arrays.
4399
4300
  // and numElements for each set of vertices
4400
- var _loop = function _loop(ii) {
4301
+ var _loop = function _loop() {
4401
4302
  var arrays = arrayOfArrays[ii];
4402
4303
  Object.keys(arrays).forEach(function (name) {
4403
4304
  // eslint-disable-line
@@ -4415,7 +4316,7 @@ function concatVertices(arrayOfArrays) {
4415
4316
  });
4416
4317
  };
4417
4318
  for (var ii = 0; ii < arrayOfArrays.length; ++ii) {
4418
- _loop(ii);
4319
+ _loop();
4419
4320
  }
4420
4321
 
4421
4322
  // compute length of combined array
@@ -4485,54 +4386,31 @@ function duplicateVertices(arrays) {
4485
4386
  });
4486
4387
  return newArrays;
4487
4388
  }
4488
- var create3DFBufferInfo = createBufferInfoFunc(create3DFVertices);
4489
- exports.create3DFBufferInfo = create3DFBufferInfo;
4490
- var create3DFBuffers = createBufferFunc(create3DFVertices);
4491
- exports.create3DFBuffers = create3DFBuffers;
4492
- var createCubeBufferInfo = createBufferInfoFunc(createCubeVertices);
4493
- exports.createCubeBufferInfo = createCubeBufferInfo;
4494
- var createCubeBuffers = createBufferFunc(createCubeVertices);
4495
- exports.createCubeBuffers = createCubeBuffers;
4496
- var createPlaneBufferInfo = createBufferInfoFunc(createPlaneVertices);
4497
- exports.createPlaneBufferInfo = createPlaneBufferInfo;
4498
- var createPlaneBuffers = createBufferFunc(createPlaneVertices);
4499
- exports.createPlaneBuffers = createPlaneBuffers;
4500
- var createSphereBufferInfo = createBufferInfoFunc(createSphereVertices);
4501
- exports.createSphereBufferInfo = createSphereBufferInfo;
4502
- var createSphereBuffers = createBufferFunc(createSphereVertices);
4503
- exports.createSphereBuffers = createSphereBuffers;
4504
- var createTruncatedConeBufferInfo = createBufferInfoFunc(createTruncatedConeVertices);
4505
- exports.createTruncatedConeBufferInfo = createTruncatedConeBufferInfo;
4506
- var createTruncatedConeBuffers = createBufferFunc(createTruncatedConeVertices);
4507
- exports.createTruncatedConeBuffers = createTruncatedConeBuffers;
4508
- var createXYQuadBufferInfo = createBufferInfoFunc(createXYQuadVertices);
4509
- exports.createXYQuadBufferInfo = createXYQuadBufferInfo;
4510
- var createXYQuadBuffers = createBufferFunc(createXYQuadVertices);
4511
- exports.createXYQuadBuffers = createXYQuadBuffers;
4512
- var createCrescentBufferInfo = createBufferInfoFunc(createCrescentVertices);
4513
- exports.createCrescentBufferInfo = createCrescentBufferInfo;
4514
- var createCrescentBuffers = createBufferFunc(createCrescentVertices);
4515
- exports.createCrescentBuffers = createCrescentBuffers;
4516
- var createCylinderBufferInfo = createBufferInfoFunc(createCylinderVertices);
4517
- exports.createCylinderBufferInfo = createCylinderBufferInfo;
4518
- var createCylinderBuffers = createBufferFunc(createCylinderVertices);
4519
- exports.createCylinderBuffers = createCylinderBuffers;
4520
- var createTorusBufferInfo = createBufferInfoFunc(createTorusVertices);
4521
- exports.createTorusBufferInfo = createTorusBufferInfo;
4522
- var createTorusBuffers = createBufferFunc(createTorusVertices);
4523
- exports.createTorusBuffers = createTorusBuffers;
4524
- var createDiscBufferInfo = createBufferInfoFunc(createDiscVertices);
4525
- exports.createDiscBufferInfo = createDiscBufferInfo;
4526
- var createDiscBuffers = createBufferFunc(createDiscVertices);
4389
+ var create3DFBufferInfo = exports.create3DFBufferInfo = createBufferInfoFunc(create3DFVertices);
4390
+ var create3DFBuffers = exports.create3DFBuffers = createBufferFunc(create3DFVertices);
4391
+ var createCubeBufferInfo = exports.createCubeBufferInfo = createBufferInfoFunc(createCubeVertices);
4392
+ var createCubeBuffers = exports.createCubeBuffers = createBufferFunc(createCubeVertices);
4393
+ var createPlaneBufferInfo = exports.createPlaneBufferInfo = createBufferInfoFunc(createPlaneVertices);
4394
+ var createPlaneBuffers = exports.createPlaneBuffers = createBufferFunc(createPlaneVertices);
4395
+ var createSphereBufferInfo = exports.createSphereBufferInfo = createBufferInfoFunc(createSphereVertices);
4396
+ var createSphereBuffers = exports.createSphereBuffers = createBufferFunc(createSphereVertices);
4397
+ var createTruncatedConeBufferInfo = exports.createTruncatedConeBufferInfo = createBufferInfoFunc(createTruncatedConeVertices);
4398
+ var createTruncatedConeBuffers = exports.createTruncatedConeBuffers = createBufferFunc(createTruncatedConeVertices);
4399
+ var createXYQuadBufferInfo = exports.createXYQuadBufferInfo = createBufferInfoFunc(createXYQuadVertices);
4400
+ var createXYQuadBuffers = exports.createXYQuadBuffers = createBufferFunc(createXYQuadVertices);
4401
+ var createCrescentBufferInfo = exports.createCrescentBufferInfo = createBufferInfoFunc(createCrescentVertices);
4402
+ var createCrescentBuffers = exports.createCrescentBuffers = createBufferFunc(createCrescentVertices);
4403
+ var createCylinderBufferInfo = exports.createCylinderBufferInfo = createBufferInfoFunc(createCylinderVertices);
4404
+ var createCylinderBuffers = exports.createCylinderBuffers = createBufferFunc(createCylinderVertices);
4405
+ var createTorusBufferInfo = exports.createTorusBufferInfo = createBufferInfoFunc(createTorusVertices);
4406
+ var createTorusBuffers = exports.createTorusBuffers = createBufferFunc(createTorusVertices);
4407
+ var createDiscBufferInfo = exports.createDiscBufferInfo = createBufferInfoFunc(createDiscVertices);
4408
+ var createDiscBuffers = exports.createDiscBuffers = createBufferFunc(createDiscVertices);
4527
4409
 
4528
4410
  // these were mis-spelled until 4.12
4529
- exports.createDiscBuffers = createDiscBuffers;
4530
- var createCresentBufferInfo = createCrescentBufferInfo;
4531
- exports.createCresentBufferInfo = createCresentBufferInfo;
4532
- var createCresentBuffers = createCrescentBuffers;
4533
- exports.createCresentBuffers = createCresentBuffers;
4534
- var createCresentVertices = createCrescentVertices;
4535
- exports.createCresentVertices = createCresentVertices;
4411
+ var createCresentBufferInfo = exports.createCresentBufferInfo = createCrescentBufferInfo;
4412
+ var createCresentBuffers = exports.createCresentBuffers = createCrescentBuffers;
4413
+ var createCresentVertices = exports.createCresentVertices = createCrescentVertices;
4536
4414
 
4537
4415
  /***/ }),
4538
4416
 
@@ -4540,13 +4418,11 @@ exports.createCresentVertices = createCresentVertices;
4540
4418
  /*!*************************!*\
4541
4419
  !*** ./src/programs.js ***!
4542
4420
  \*************************/
4543
- /*! no static exports found */
4544
- /***/ (function(module, exports, __webpack_require__) {
4421
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
4545
4422
 
4546
- "use strict";
4547
4423
 
4548
4424
 
4549
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4425
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4550
4426
  exports.__esModule = true;
4551
4427
  exports.bindTransformFeedbackInfo = bindTransformFeedbackInfo;
4552
4428
  exports.bindUniformBlock = bindUniformBlock;
@@ -4576,25 +4452,47 @@ exports.setUniforms = setUniforms;
4576
4452
  exports.setUniformsAndBindTextures = void 0;
4577
4453
  var utils = _interopRequireWildcard(__webpack_require__(/*! ./utils.js */ "./src/utils.js"));
4578
4454
  var helper = _interopRequireWildcard(__webpack_require__(/*! ./helper.js */ "./src/helper.js"));
4579
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
4580
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
4581
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
4582
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4583
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4584
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4455
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
4456
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
4457
+ function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
4458
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4459
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4460
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4461
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4462
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
4585
4463
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
4586
4464
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4587
4465
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4588
4466
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4589
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
4467
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4590
4468
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4591
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4469
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
4592
4470
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
4593
4471
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4594
4472
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4595
4473
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
4596
4474
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
4597
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
4475
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } /*
4476
+ * Copyright 2019 Gregg Tavares
4477
+ *
4478
+ * Permission is hereby granted, free of charge, to any person obtaining a
4479
+ * copy of this software and associated documentation files (the "Software"),
4480
+ * to deal in the Software without restriction, including without limitation
4481
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
4482
+ * and/or sell copies of the Software, and to permit persons to whom the
4483
+ * Software is furnished to do so, subject to the following conditions:
4484
+ *
4485
+ * The above copyright notice and this permission notice shall be included in
4486
+ * all copies or substantial portions of the Software.
4487
+ *
4488
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4489
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4490
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
4491
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4492
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
4493
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
4494
+ * DEALINGS IN THE SOFTWARE.
4495
+ */
4598
4496
  /**
4599
4497
  * Low level shader program related functions
4600
4498
  *
@@ -5510,7 +5408,7 @@ function deleteProgramAndShaders(gl, program, notThese) {
5510
5408
  try {
5511
5409
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
5512
5410
  var shader = _step.value;
5513
- if (notThese.has(shader)) {
5411
+ if (!notThese.has(shader)) {
5514
5412
  gl.deleteShader(shader);
5515
5413
  }
5516
5414
  }
@@ -5545,8 +5443,8 @@ function createProgramNoCheck(gl, shaders, programOptions) {
5545
5443
  shader = gl.createShader(type);
5546
5444
  gl.shaderSource(shader, prepShaderSource(src).shaderSource);
5547
5445
  gl.compileShader(shader);
5548
- gl.attachShader(program, shader);
5549
5446
  }
5447
+ gl.attachShader(program, shader);
5550
5448
  }
5551
5449
  Object.entries(attribLocations).forEach(function (_ref) {
5552
5450
  var _ref2 = _slicedToArray(_ref, 2),
@@ -5584,7 +5482,7 @@ function createProgramNoCheck(gl, shaders, programOptions) {
5584
5482
  * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
5585
5483
  * @param {WebGLShader[]|string[]} shaders The shaders to attach, or element ids for their source, or strings that contain their source
5586
5484
  * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
5587
- * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5485
+ * @param {number[]|module:twgl.ErrorCallback} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5588
5486
  * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
5589
5487
  * on error. If you want something else pass an callback. It's passed an error message.
5590
5488
  * @return {WebGLProgram?} the created program or null if error of a callback was provided.
@@ -5651,13 +5549,13 @@ function wrapCallbackFnToAsyncFn(fn) {
5651
5549
  * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
5652
5550
  * @param {WebGLShader[]|string[]} shaders The shaders to attach, or element ids for their source, or strings that contain their source
5653
5551
  * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
5654
- * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5552
+ * @param {number[]|module:twgl.ErrorCallback} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5655
5553
  * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
5656
5554
  * on error. If you want something else pass an callback. It's passed an error message.
5657
5555
  * @return {Promise<WebGLProgram>} The created program
5658
5556
  * @memberOf module:twgl/programs
5659
5557
  */
5660
- var createProgramAsync = wrapCallbackFnToAsyncFn(createProgram);
5558
+ var createProgramAsync = exports.createProgramAsync = wrapCallbackFnToAsyncFn(createProgram);
5661
5559
 
5662
5560
  /**
5663
5561
  * Same as createProgramInfo but returns a promise
@@ -5668,15 +5566,13 @@ var createProgramAsync = wrapCallbackFnToAsyncFn(createProgram);
5668
5566
  * shaders or ids. The first is assumed to be the vertex shader,
5669
5567
  * the second the fragment shader.
5670
5568
  * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
5671
- * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5569
+ * @param {number[]|module:twgl.ErrorCallback} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5672
5570
  * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
5673
5571
  * on error. If you want something else pass an callback. It's passed an error message.
5674
5572
  * @return {Promise<module:twgl.ProgramInfo>} The created ProgramInfo
5675
5573
  * @memberOf module:twgl/programs
5676
5574
  */
5677
- exports.createProgramAsync = createProgramAsync;
5678
- var createProgramInfoAsync = wrapCallbackFnToAsyncFn(createProgramInfo);
5679
- exports.createProgramInfoAsync = createProgramInfoAsync;
5575
+ var createProgramInfoAsync = exports.createProgramInfoAsync = wrapCallbackFnToAsyncFn(createProgramInfo);
5680
5576
  function waitForProgramLinkCompletionAsync(_x, _x2) {
5681
5577
  return _waitForProgramLinkCompletionAsync.apply(this, arguments);
5682
5578
  }
@@ -5684,31 +5580,29 @@ function _waitForProgramLinkCompletionAsync() {
5684
5580
  _waitForProgramLinkCompletionAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(gl, program) {
5685
5581
  var ext, checkFn, waitTime;
5686
5582
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5687
- while (1) {
5688
- switch (_context.prev = _context.next) {
5689
- case 0:
5690
- ext = gl.getExtension('KHR_parallel_shader_compile');
5691
- checkFn = ext ? function (gl, program) {
5692
- return gl.getProgramParameter(program, ext.COMPLETION_STATUS_KHR);
5693
- } : function () {
5694
- return true;
5695
- };
5696
- waitTime = 0;
5697
- case 3:
5698
- _context.next = 5;
5699
- return wait(waitTime);
5700
- case 5:
5701
- // must wait at least once
5702
- waitTime = 1000 / 60;
5703
- case 6:
5704
- if (!checkFn(gl, program)) {
5705
- _context.next = 3;
5706
- break;
5707
- }
5708
- case 7:
5709
- case "end":
5710
- return _context.stop();
5711
- }
5583
+ while (1) switch (_context.prev = _context.next) {
5584
+ case 0:
5585
+ ext = gl.getExtension('KHR_parallel_shader_compile');
5586
+ checkFn = ext ? function (gl, program) {
5587
+ return gl.getProgramParameter(program, ext.COMPLETION_STATUS_KHR);
5588
+ } : function () {
5589
+ return true;
5590
+ };
5591
+ waitTime = 0;
5592
+ case 3:
5593
+ _context.next = 5;
5594
+ return wait(waitTime);
5595
+ case 5:
5596
+ // must wait at least once
5597
+ waitTime = 1000 / 60;
5598
+ case 6:
5599
+ if (!checkFn(gl, program)) {
5600
+ _context.next = 3;
5601
+ break;
5602
+ }
5603
+ case 7:
5604
+ case "end":
5605
+ return _context.stop();
5712
5606
  }
5713
5607
  }, _callee);
5714
5608
  }));
@@ -5716,38 +5610,37 @@ function _waitForProgramLinkCompletionAsync() {
5716
5610
  }
5717
5611
  function waitForAllProgramsLinkCompletionAsync(_x3, _x4) {
5718
5612
  return _waitForAllProgramsLinkCompletionAsync.apply(this, arguments);
5719
- } /**
5720
- * Check a program's link status
5721
- * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
5722
- * @param {WebGLProgram} program Program to check
5723
- * @param {ErrorCallback} [errFn] func for errors
5724
- * @return {string?} errors if program is failed, else undefined
5725
- * @private
5726
- */
5613
+ }
5614
+ /**
5615
+ * Check a program's link status
5616
+ * @param {WebGLRenderingContext} gl The WebGLRenderingContext to use.
5617
+ * @param {WebGLProgram} program Program to check
5618
+ * @param {ErrorCallback} [errFn] func for errors
5619
+ * @return {string?} errors if program is failed, else undefined
5620
+ * @private
5621
+ */
5727
5622
  function _waitForAllProgramsLinkCompletionAsync() {
5728
5623
  _waitForAllProgramsLinkCompletionAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(gl, programs) {
5729
- var _i4, _Object$values2, program;
5624
+ var _i3, _Object$values2, program;
5730
5625
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
5731
- while (1) {
5732
- switch (_context2.prev = _context2.next) {
5733
- case 0:
5734
- _i4 = 0, _Object$values2 = Object.values(programs);
5735
- case 1:
5736
- if (!(_i4 < _Object$values2.length)) {
5737
- _context2.next = 8;
5738
- break;
5739
- }
5740
- program = _Object$values2[_i4];
5741
- _context2.next = 5;
5742
- return waitForProgramLinkCompletionAsync(gl, program);
5743
- case 5:
5744
- _i4++;
5745
- _context2.next = 1;
5626
+ while (1) switch (_context2.prev = _context2.next) {
5627
+ case 0:
5628
+ _i3 = 0, _Object$values2 = Object.values(programs);
5629
+ case 1:
5630
+ if (!(_i3 < _Object$values2.length)) {
5631
+ _context2.next = 8;
5746
5632
  break;
5747
- case 8:
5748
- case "end":
5749
- return _context2.stop();
5750
- }
5633
+ }
5634
+ program = _Object$values2[_i3];
5635
+ _context2.next = 5;
5636
+ return waitForProgramLinkCompletionAsync(gl, program);
5637
+ case 5:
5638
+ _i3++;
5639
+ _context2.next = 1;
5640
+ break;
5641
+ case 8:
5642
+ case "end":
5643
+ return _context2.stop();
5751
5644
  }
5752
5645
  }, _callee2);
5753
5646
  }));
@@ -5789,7 +5682,7 @@ function getProgramErrors(gl, program, errFn) {
5789
5682
  * tags for the shaders. The first is assumed to be the
5790
5683
  * vertex shader, the second the fragment shader.
5791
5684
  * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
5792
- * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5685
+ * @param {number[]|module:twgl.ErrorCallback} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5793
5686
  * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
5794
5687
  * on error. If you want something else pass an callback. It's passed an error message.
5795
5688
  * @return {WebGLProgram?} the created program or null if error or a callback was provided.
@@ -5833,7 +5726,7 @@ function createProgramFromScripts(gl, shaderScriptIds, opt_attribs, opt_location
5833
5726
  * shaders. The first is assumed to be the vertex shader,
5834
5727
  * the second the fragment shader.
5835
5728
  * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
5836
- * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5729
+ * @param {number[]|module:twgl.ErrorCallback} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
5837
5730
  * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
5838
5731
  * on error. If you want something else pass an callback. It's passed an error message.
5839
5732
  * @return {WebGLProgram?} the created program or null if error or a callback was provided.
@@ -5882,7 +5775,6 @@ function addSetterToUniformTree(fullPath, setter, node, uniformSetters) {
5882
5775
  if (isArrayIndex) {
5883
5776
  path += tokens[tokenNdx++]; // skip ']'
5884
5777
  }
5885
-
5886
5778
  var isLastToken = tokenNdx === tokens.length;
5887
5779
  if (isLastToken) {
5888
5780
  node[accessor] = setter;
@@ -5931,7 +5823,6 @@ function createUniformSetters(gl, program) {
5931
5823
  if (!typeInfo) {
5932
5824
  throw new Error("unknown type: 0x".concat(type.toString(16))); // we should never get here.
5933
5825
  }
5934
-
5935
5826
  var setter;
5936
5827
  if (typeInfo.bindPoint) {
5937
5828
  // it's a sampler
@@ -6173,6 +6064,7 @@ function createUniformBlockUniformSetter(view, isArray, rows, cols) {
6173
6064
  * @property {ArrayBuffer} array The array buffer that contains the uniform values
6174
6065
  * @property {Float32Array} asFloat A float view on the array buffer. This is useful
6175
6066
  * inspecting the contents of the buffer in the debugger.
6067
+ * @property {Uint8Array} asUint8t A uint8 view on the array buffer.
6176
6068
  * @property {WebGLBuffer} buffer A WebGL buffer that will hold a copy of the uniform values for rendering.
6177
6069
  * @property {number} [offset] offset into buffer
6178
6070
  * @property {Object<string, ArrayBufferView>} uniforms A uniform name to ArrayBufferView map.
@@ -6191,6 +6083,15 @@ function createUniformBlockUniformSetter(view, isArray, rows, cols) {
6191
6083
  * @memberOf module:twgl
6192
6084
  */
6193
6085
 
6086
+ /**
6087
+ * Options to allow createUniformBlockInfo to use an existing buffer and arrayBuffer at an offset
6088
+ * @typedef {Object} UniformBlockInfoOptions
6089
+ * @property {ArrayBuffer} [array] an existing array buffer to use for values
6090
+ * @property {number} [offset] the offset in bytes to use in the array buffer (default = 0)
6091
+ * @property {WebGLBuffer} [buffer] the buffer to use for this uniform block info
6092
+ * @property {number} [bufferOffset] the offset in bytes in the buffer to use (default = use offset above)
6093
+ */
6094
+
6194
6095
  /**
6195
6096
  * Creates a `UniformBlockInfo` for the specified block
6196
6097
  *
@@ -6205,10 +6106,13 @@ function createUniformBlockUniformSetter(view, isArray, rows, cols) {
6205
6106
  * @param {module:twgl.UniformBlockSpec} uniformBlockSpec. A UniformBlockSpec as returned
6206
6107
  * from {@link module:twgl.createUniformBlockSpecFromProgram}.
6207
6108
  * @param {string} blockName The name of the block.
6109
+ * @param {module:twgl.UniformBlockInfoOptions} [options] Optional options for using existing an existing buffer and arrayBuffer
6208
6110
  * @return {module:twgl.UniformBlockInfo} The created UniformBlockInfo
6209
6111
  * @memberOf module:twgl/programs
6210
6112
  */
6211
6113
  function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockName) {
6114
+ var _options$offset, _options$array, _options$buffer, _options$bufferOffset;
6115
+ var options = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
6212
6116
  var blockSpecs = uniformBlockSpec.blockSpecs;
6213
6117
  var uniformData = uniformBlockSpec.uniformData;
6214
6118
  var blockSpec = blockSpecs[blockName];
@@ -6219,10 +6123,14 @@ function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockN
6219
6123
  uniforms: {}
6220
6124
  };
6221
6125
  }
6222
- var array = new ArrayBuffer(blockSpec.size);
6223
- var buffer = gl.createBuffer();
6126
+ var offset = (_options$offset = options.offset) !== null && _options$offset !== void 0 ? _options$offset : 0;
6127
+ var array = (_options$array = options.array) !== null && _options$array !== void 0 ? _options$array : new ArrayBuffer(blockSpec.size);
6128
+ var buffer = (_options$buffer = options.buffer) !== null && _options$buffer !== void 0 ? _options$buffer : gl.createBuffer();
6224
6129
  var uniformBufferIndex = blockSpec.index;
6225
6130
  gl.bindBuffer(UNIFORM_BUFFER, buffer);
6131
+ if (!options.buffer) {
6132
+ gl.bufferData(UNIFORM_BUFFER, array.byteLength, DYNAMIC_DRAW);
6133
+ }
6226
6134
  gl.uniformBlockBinding(program, blockSpec.index, uniformBufferIndex);
6227
6135
  var prefix = blockName + ".";
6228
6136
  if (arraySuffixRE.test(prefix)) {
@@ -6244,7 +6152,7 @@ function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockN
6244
6152
  var typeInfo = typeMap[data.type];
6245
6153
  var Type = typeInfo.Type;
6246
6154
  var byteLength = isArray ? pad(typeInfo.size, 16) * data.size : typeInfo.size * data.size;
6247
- var uniformView = new Type(array, data.offset, byteLength / Type.BYTES_PER_ELEMENT);
6155
+ var uniformView = new Type(array, offset + data.offset, byteLength / Type.BYTES_PER_ELEMENT);
6248
6156
  uniforms[name] = uniformView;
6249
6157
  // Note: I'm not sure what to do here. The original
6250
6158
  // idea was to create TypedArray views into each part
@@ -6280,9 +6188,13 @@ function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockN
6280
6188
  array: array,
6281
6189
  asFloat: new Float32Array(array),
6282
6190
  // for debugging
6191
+ asUint8: new Uint8Array(array),
6192
+ // needed for gl.bufferSubData because it doesn't take an array buffer
6283
6193
  buffer: buffer,
6284
6194
  uniforms: uniforms,
6285
- setters: setters
6195
+ setters: setters,
6196
+ offset: (_options$bufferOffset = options.bufferOffset) !== null && _options$bufferOffset !== void 0 ? _options$bufferOffset : offset,
6197
+ size: blockSpec.size
6286
6198
  };
6287
6199
  }
6288
6200
 
@@ -6299,11 +6211,13 @@ function createUniformBlockInfoFromProgram(gl, program, uniformBlockSpec, blockN
6299
6211
  * @param {module:twgl.ProgramInfo} programInfo a `ProgramInfo`
6300
6212
  * as returned from {@link module:twgl.createProgramInfo}
6301
6213
  * @param {string} blockName The name of the block.
6214
+ * @param {module:twgl.UniformBlockInfoOptions} [options] Optional options for using existing an existing buffer and arrayBuffer
6302
6215
  * @return {module:twgl.UniformBlockInfo} The created UniformBlockInfo
6303
6216
  * @memberOf module:twgl/programs
6304
6217
  */
6305
6218
  function createUniformBlockInfo(gl, programInfo, blockName) {
6306
- return createUniformBlockInfoFromProgram(gl, programInfo.program, programInfo.uniformBlockSpec, blockName);
6219
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
6220
+ return createUniformBlockInfoFromProgram(gl, programInfo.program, programInfo.uniformBlockSpec, blockName, options);
6307
6221
  }
6308
6222
 
6309
6223
  /**
@@ -6328,8 +6242,9 @@ function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
6328
6242
  var uniformBlockSpec = programInfo.uniformBlockSpec || programInfo;
6329
6243
  var blockSpec = uniformBlockSpec.blockSpecs[uniformBlockInfo.name];
6330
6244
  if (blockSpec) {
6245
+ var _uniformBlockInfo$siz;
6331
6246
  var bufferBindIndex = blockSpec.index;
6332
- gl.bindBufferRange(UNIFORM_BUFFER, bufferBindIndex, uniformBlockInfo.buffer, uniformBlockInfo.offset || 0, uniformBlockInfo.array.byteLength);
6247
+ gl.bindBufferRange(UNIFORM_BUFFER, bufferBindIndex, uniformBlockInfo.buffer, uniformBlockInfo.offset || 0, (_uniformBlockInfo$siz = uniformBlockInfo.size) !== null && _uniformBlockInfo$siz !== void 0 ? _uniformBlockInfo$siz : uniformBlockInfo.array.byteLength);
6333
6248
  return true;
6334
6249
  }
6335
6250
  return false;
@@ -6352,7 +6267,7 @@ function bindUniformBlock(gl, programInfo, uniformBlockInfo) {
6352
6267
  */
6353
6268
  function setUniformBlock(gl, programInfo, uniformBlockInfo) {
6354
6269
  if (bindUniformBlock(gl, programInfo, uniformBlockInfo)) {
6355
- gl.bufferData(UNIFORM_BUFFER, uniformBlockInfo.array, DYNAMIC_DRAW);
6270
+ gl.bufferSubData(UNIFORM_BUFFER, 0, uniformBlockInfo.asUint8, uniformBlockInfo.offset || 0, uniformBlockInfo.size || 0);
6356
6271
  }
6357
6272
  }
6358
6273
 
@@ -6650,7 +6565,7 @@ function setUniforms(setters) {
6650
6565
  * @param {Object.<string, ?>} values an object with values for the
6651
6566
  * @memberOf module:twgl/programs
6652
6567
  */
6653
- var setUniformsAndBindTextures = setUniforms;
6568
+ var setUniformsAndBindTextures = exports.setUniformsAndBindTextures = setUniforms;
6654
6569
 
6655
6570
  /**
6656
6571
  * Creates setter functions for all attributes of a shader
@@ -6662,7 +6577,6 @@ var setUniformsAndBindTextures = setUniforms;
6662
6577
  * @return {Object.<string, function>} an object with a setter for each attribute by name.
6663
6578
  * @memberOf module:twgl/programs
6664
6579
  */
6665
- exports.setUniformsAndBindTextures = setUniformsAndBindTextures;
6666
6580
  function createAttributeSetters(gl, program) {
6667
6581
  var attribSetters = {};
6668
6582
  var numAttribs = gl.getProgramParameter(program, ACTIVE_ATTRIBUTES);
@@ -6795,6 +6709,8 @@ function setBuffersAndAttributes(gl, programInfo, buffers) {
6795
6709
  /**
6796
6710
  * @typedef {Object} ProgramInfo
6797
6711
  * @property {WebGLProgram} program A shader program
6712
+ * @property {Object<string, WebGLUniformLocation>} uniformLocations The uniform locations of each uniform
6713
+ * @property {Object<string, number>} attribLocations The locations of each attribute
6798
6714
  * @property {Object<string, function>} uniformSetters object of setters as returned from createUniformSetters,
6799
6715
  * @property {Object<string, function>} attribSetters object of setters as returned from createAttribSetters,
6800
6716
  * @property {module:twgl.UniformBlockSpec} [uniformBlockSpec] a uniform block spec for making UniformBlockInfos with createUniformBlockInfo etc..
@@ -6825,7 +6741,19 @@ function createProgramInfoFromProgram(gl, program) {
6825
6741
  var programInfo = {
6826
6742
  program: program,
6827
6743
  uniformSetters: uniformSetters,
6828
- attribSetters: attribSetters
6744
+ attribSetters: attribSetters,
6745
+ uniformLocations: Object.fromEntries(Object.entries(uniformSetters).map(function (_ref3) {
6746
+ var _ref4 = _slicedToArray(_ref3, 2),
6747
+ k = _ref4[0],
6748
+ v = _ref4[1];
6749
+ return [k, v.location];
6750
+ })),
6751
+ attribLocations: Object.fromEntries(Object.entries(attribSetters).map(function (_ref5) {
6752
+ var _ref6 = _slicedToArray(_ref5, 2),
6753
+ k = _ref6[0],
6754
+ v = _ref6[1];
6755
+ return [k, v.location];
6756
+ }))
6829
6757
  };
6830
6758
  if (utils.isWebGL2(gl)) {
6831
6759
  programInfo.uniformBlockSpec = createUniformBlockSpecFromProgram(gl, program);
@@ -6859,7 +6787,7 @@ var notIdRE = /\s|{|}|;/;
6859
6787
  * shaders or ids. The first is assumed to be the vertex shader,
6860
6788
  * the second the fragment shader.
6861
6789
  * @param {module:twgl.ProgramOptions|string[]|module:twgl.ErrorCallback} [opt_attribs] Options for the program or an array of attribs names or an error callback. Locations will be assigned by index if not passed in
6862
- * @param {number[]} [opt_locations|module:twgl.ErrorCallback] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
6790
+ * @param {number[]|module:twgl.ErrorCallback} [opt_locations] The locations for the. A parallel array to opt_attribs letting you assign locations or an error callback.
6863
6791
  * @param {module:twgl.ErrorCallback} [opt_errorCallback] callback for errors. By default it just prints an error to the console
6864
6792
  * on error. If you want something else pass an callback. It's passed an error message.
6865
6793
  * @return {module:twgl.ProgramInfo?} The created ProgramInfo or null if it failed to link or compile
@@ -6899,8 +6827,8 @@ function createProgramInfo(gl, shaderSources, opt_attribs, opt_locations, opt_er
6899
6827
  }
6900
6828
  function checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, programOptions) {
6901
6829
  // check errors for everything.
6902
- for (var _i2 = 0, _Object$entries = Object.entries(programs); _i2 < _Object$entries.length; _i2++) {
6903
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
6830
+ for (var _i = 0, _Object$entries = Object.entries(programs); _i < _Object$entries.length; _i++) {
6831
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
6904
6832
  name = _Object$entries$_i[0],
6905
6833
  program = _Object$entries$_i[1];
6906
6834
  var options = _objectSpread({}, programOptions);
@@ -6911,8 +6839,8 @@ function checkAllPrograms(gl, programs, programSpecs, noDeleteShadersSet, progra
6911
6839
  var errors = getProgramErrors(gl, program, options.errorCallback);
6912
6840
  if (errors) {
6913
6841
  // delete everything we created
6914
- for (var _i3 = 0, _Object$values = Object.values(programs); _i3 < _Object$values.length; _i3++) {
6915
- var _program = _Object$values[_i3];
6842
+ for (var _i2 = 0, _Object$values = Object.values(programs); _i2 < _Object$values.length; _i2++) {
6843
+ var _program = _Object$values[_i2];
6916
6844
  var shaders = gl.getAttachedShaders(_program);
6917
6845
  gl.deleteProgram(_program);
6918
6846
  var _iterator3 = _createForOfIteratorHelper(shaders),
@@ -6968,10 +6896,10 @@ function createPrograms(gl, programSpecs) {
6968
6896
  var noDeleteShadersSet = new Set();
6969
6897
 
6970
6898
  // compile and link everything
6971
- var programs = Object.fromEntries(Object.entries(programSpecs).map(function (_ref3) {
6972
- var _ref4 = _slicedToArray(_ref3, 2),
6973
- name = _ref4[0],
6974
- spec = _ref4[1];
6899
+ var programs = Object.fromEntries(Object.entries(programSpecs).map(function (_ref7) {
6900
+ var _ref8 = _slicedToArray(_ref7, 2),
6901
+ name = _ref8[0],
6902
+ spec = _ref8[1];
6975
6903
  var options = _objectSpread({}, programOptions);
6976
6904
  var shaders = Array.isArray(spec) ? spec : spec.shaders;
6977
6905
  if (!Array.isArray(spec)) {
@@ -7031,10 +6959,10 @@ function createPrograms(gl, programSpecs) {
7031
6959
  function createProgramInfos(gl, programSpecs, programOptions) {
7032
6960
  programOptions = getProgramOptions(programOptions);
7033
6961
  function createProgramInfosForPrograms(gl, programs) {
7034
- return Object.fromEntries(Object.entries(programs).map(function (_ref5) {
7035
- var _ref6 = _slicedToArray(_ref5, 2),
7036
- name = _ref6[0],
7037
- program = _ref6[1];
6962
+ return Object.fromEntries(Object.entries(programs).map(function (_ref9) {
6963
+ var _ref10 = _slicedToArray(_ref9, 2),
6964
+ name = _ref10[0],
6965
+ program = _ref10[1];
7038
6966
  return [name, createProgramInfoFromProgram(gl, program)];
7039
6967
  }));
7040
6968
  }
@@ -7073,7 +7001,7 @@ function createProgramInfos(gl, programSpecs, programOptions) {
7073
7001
  * @param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
7074
7002
  * @return {Object.<string, WebGLProgram>?} the created programInfos by name
7075
7003
  */
7076
- var createProgramsAsync = wrapCallbackFnToAsyncFn(createPrograms);
7004
+ var createProgramsAsync = exports.createProgramsAsync = wrapCallbackFnToAsyncFn(createPrograms);
7077
7005
 
7078
7006
  /**
7079
7007
  * Creates multiple programInfos asynchronously
@@ -7097,9 +7025,7 @@ var createProgramsAsync = wrapCallbackFnToAsyncFn(createPrograms);
7097
7025
  * @param {module:twgl.ProgramOptions} [programOptions] options to apply to all programs
7098
7026
  * @return {Promise<Object.<string, module:twgl.ProgramInfo>>} the created programInfos by name
7099
7027
  */
7100
- exports.createProgramsAsync = createProgramsAsync;
7101
- var createProgramInfosAsync = wrapCallbackFnToAsyncFn(createProgramInfos);
7102
- exports.createProgramInfosAsync = createProgramInfosAsync;
7028
+ var createProgramInfosAsync = exports.createProgramInfosAsync = wrapCallbackFnToAsyncFn(createProgramInfos);
7103
7029
 
7104
7030
  /***/ }),
7105
7031
 
@@ -7107,20 +7033,19 @@ exports.createProgramInfosAsync = createProgramInfosAsync;
7107
7033
  /*!*************************!*\
7108
7034
  !*** ./src/textures.js ***!
7109
7035
  \*************************/
7110
- /*! no static exports found */
7111
- /***/ (function(module, exports, __webpack_require__) {
7036
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
7112
7037
 
7113
- "use strict";
7114
7038
 
7115
7039
 
7116
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
7117
7040
  exports.__esModule = true;
7118
7041
  exports.canFilter = canFilter;
7119
7042
  exports.canGenerateMipmap = canGenerateMipmap;
7120
7043
  exports.createSampler = createSampler;
7121
7044
  exports.createSamplers = createSamplers;
7122
7045
  exports.createTexture = createTexture;
7046
+ exports.createTextureAsync = createTextureAsync;
7123
7047
  exports.createTextures = createTextures;
7048
+ exports.createTexturesAsync = createTexturesAsync;
7124
7049
  exports.getBytesPerElementForInternalFormat = getBytesPerElementForInternalFormat;
7125
7050
  exports.getFormatAndTypeForInternalFormat = getFormatAndTypeForInternalFormat;
7126
7051
  exports.getNumComponentsForFormat = getNumComponentsForFormat;
@@ -7137,9 +7062,14 @@ exports.setTextureParameters = setTextureParameters;
7137
7062
  var utils = _interopRequireWildcard(__webpack_require__(/*! ./utils.js */ "./src/utils.js"));
7138
7063
  var typedArrays = _interopRequireWildcard(__webpack_require__(/*! ./typedarrays.js */ "./src/typedarrays.js"));
7139
7064
  var helper = _interopRequireWildcard(__webpack_require__(/*! ./helper.js */ "./src/helper.js"));
7140
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
7141
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
7142
- /*
7065
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
7066
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
7067
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
7068
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
7069
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7070
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
7071
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7072
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
7143
7073
  * Copyright 2019 Gregg Tavares
7144
7074
  *
7145
7075
  * Permission is hereby granted, free of charge, to any person obtaining a
@@ -7160,7 +7090,6 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
7160
7090
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
7161
7091
  * DEALINGS IN THE SOFTWARE.
7162
7092
  */
7163
-
7164
7093
  /**
7165
7094
  * Low level texture related functions
7166
7095
  *
@@ -8127,21 +8056,62 @@ function setDefaults(newDefaults) {
8127
8056
  */
8128
8057
 
8129
8058
  /**
8130
- * Sets any packing state that will be set based on the options.
8131
- * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
8059
+ * Saves the current packing state, sets the packing state as specified
8060
+ * then calls a function, after which the packing state will be restored.
8132
8061
  * @param {WebGLRenderingContext} gl the WebGLRenderingContext
8062
+ * @param {module:twgl.TextureOptions} options A TextureOptions object with whatever parameters you want set.
8063
+ * @param {function():void} [fn] A function to call, after which the packing state will be restored.
8133
8064
  * @private
8134
8065
  */
8135
- function setPackState(gl, options) {
8066
+ function scopedSetPackState(gl, options, fn) {
8067
+ var colorspaceConversion;
8068
+ var premultiplyAlpha;
8069
+ var flipY;
8136
8070
  if (options.colorspaceConversion !== undefined) {
8071
+ colorspaceConversion = gl.getParameter(UNPACK_COLORSPACE_CONVERSION_WEBGL);
8137
8072
  gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, options.colorspaceConversion);
8138
8073
  }
8139
8074
  if (options.premultiplyAlpha !== undefined) {
8075
+ premultiplyAlpha = gl.getParameter(UNPACK_PREMULTIPLY_ALPHA_WEBGL);
8140
8076
  gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, options.premultiplyAlpha);
8141
8077
  }
8142
8078
  if (options.flipY !== undefined) {
8079
+ flipY = gl.getParameter(UNPACK_FLIP_Y_WEBGL);
8143
8080
  gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, options.flipY);
8144
8081
  }
8082
+ fn();
8083
+ if (colorspaceConversion !== undefined) {
8084
+ gl.pixelStorei(UNPACK_COLORSPACE_CONVERSION_WEBGL, colorspaceConversion);
8085
+ }
8086
+ if (premultiplyAlpha !== undefined) {
8087
+ gl.pixelStorei(UNPACK_PREMULTIPLY_ALPHA_WEBGL, premultiplyAlpha);
8088
+ }
8089
+ if (flipY !== undefined) {
8090
+ gl.pixelStorei(UNPACK_FLIP_Y_WEBGL, flipY);
8091
+ }
8092
+ }
8093
+
8094
+ /**
8095
+ * returns the property if set or the corresponding state if undefined
8096
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
8097
+ * @param {module:twgl.TextureOptions} options
8098
+ * @param {string} property the name of the property to copy
8099
+ * @param {number} pname
8100
+ * @return {module:twgl.TextureOptions}
8101
+ */
8102
+ function getPackStateOption(gl, options, property, pname) {
8103
+ var v = options[property];
8104
+ return _defineProperty({}, property, v === undefined ? gl.getParameter(pname) : v);
8105
+ }
8106
+
8107
+ /**
8108
+ * Copy the options object and apply pack state
8109
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
8110
+ * @param {module:twgl.TextureOptions} options
8111
+ * @return {module:twgl.TextureOptions}
8112
+ */
8113
+ function copyOptionsAndApplyPackState(gl, options) {
8114
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, options), getPackStateOption(gl, options, 'flipY', UNPACK_FLIP_Y_WEBGL)), getPackStateOption(gl, options, 'premultiplyAlpha', UNPACK_PREMULTIPLY_ALPHA_WEBGL)), getPackStateOption(gl, options, 'colorspaceConversion', UNPACK_COLORSPACE_CONVERSION_WEBGL));
8145
8115
  }
8146
8116
 
8147
8117
  /**
@@ -8425,7 +8395,6 @@ function setTextureFromElement(gl, tex, element, options) {
8425
8395
  var formatType = getFormatAndTypeForInternalFormat(internalFormat);
8426
8396
  var format = options.format || formatType.format;
8427
8397
  var type = options.type || formatType.type;
8428
- setPackState(gl, options);
8429
8398
  gl.bindTexture(target, tex);
8430
8399
  if (target === TEXTURE_CUBE_MAP) {
8431
8400
  // guess the parts
@@ -8458,15 +8427,17 @@ function setTextureFromElement(gl, tex, element, options) {
8458
8427
  ctx.canvas.height = size;
8459
8428
  width = size;
8460
8429
  height = size;
8461
- getCubeFacesWithNdx(gl, options).forEach(function (f) {
8462
- var xOffset = slices[f.ndx * 2 + 0] * size;
8463
- var yOffset = slices[f.ndx * 2 + 1] * size;
8464
- ctx.drawImage(element, xOffset, yOffset, size, size, 0, 0, size, size);
8465
- gl.texImage2D(f.face, level, internalFormat, format, type, ctx.canvas);
8430
+ scopedSetPackState(gl, options, function () {
8431
+ getCubeFacesWithNdx(gl, options).forEach(function (f) {
8432
+ var xOffset = slices[f.ndx * 2 + 0] * size;
8433
+ var yOffset = slices[f.ndx * 2 + 1] * size;
8434
+ ctx.drawImage(element, xOffset, yOffset, size, size, 0, 0, size, size);
8435
+ gl.texImage2D(f.face, level, internalFormat, format, type, ctx.canvas);
8436
+ });
8437
+ // Free up the canvas memory
8438
+ ctx.canvas.width = 1;
8439
+ ctx.canvas.height = 1;
8466
8440
  });
8467
- // Free up the canvas memory
8468
- ctx.canvas.width = 1;
8469
- ctx.canvas.height = 1;
8470
8441
  } else if (typeof createImageBitmap !== 'undefined') {
8471
8442
  // NOTE: It seems like we should prefer ImageBitmap because unlike canvas it's
8472
8443
  // note lossy? (alpha is not premultiplied? although I'm not sure what
@@ -8485,39 +8456,44 @@ function setTextureFromElement(gl, tex, element, options) {
8485
8456
  premultiplyAlpha: 'none',
8486
8457
  colorSpaceConversion: 'none'
8487
8458
  }).then(function (imageBitmap) {
8488
- setPackState(gl, options);
8489
- gl.bindTexture(target, tex);
8490
- gl.texImage2D(f.face, level, internalFormat, format, type, imageBitmap);
8491
- if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8492
- setTextureFilteringForSize(gl, tex, options, width, height, internalFormat);
8493
- }
8459
+ scopedSetPackState(gl, options, function () {
8460
+ gl.bindTexture(target, tex);
8461
+ gl.texImage2D(f.face, level, internalFormat, format, type, imageBitmap);
8462
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8463
+ setTextureFilteringForSize(gl, tex, options, width, height, internalFormat);
8464
+ }
8465
+ });
8494
8466
  });
8495
8467
  });
8496
8468
  }
8497
8469
  } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
8498
- var smallest = Math.min(element.width, element.height);
8499
- var largest = Math.max(element.width, element.height);
8500
- var depth = largest / smallest;
8501
- if (depth % 1 !== 0) {
8502
- throw "can not compute 3D dimensions of element";
8503
- }
8504
- var xMult = element.width === largest ? 1 : 0;
8505
- var yMult = element.height === largest ? 1 : 0;
8506
- gl.pixelStorei(UNPACK_ALIGNMENT, 1);
8507
- gl.pixelStorei(UNPACK_ROW_LENGTH, element.width);
8508
- gl.pixelStorei(UNPACK_IMAGE_HEIGHT, 0);
8509
- gl.pixelStorei(UNPACK_SKIP_IMAGES, 0);
8510
- gl.texImage3D(target, level, internalFormat, smallest, smallest, smallest, 0, format, type, null);
8511
- for (var d = 0; d < depth; ++d) {
8512
- var srcX = d * smallest * xMult;
8513
- var srcY = d * smallest * yMult;
8514
- gl.pixelStorei(UNPACK_SKIP_PIXELS, srcX);
8515
- gl.pixelStorei(UNPACK_SKIP_ROWS, srcY);
8516
- gl.texSubImage3D(target, level, 0, 0, d, smallest, smallest, 1, format, type, element);
8517
- }
8518
- setSkipStateToDefault(gl);
8470
+ scopedSetPackState(gl, options, function () {
8471
+ var smallest = Math.min(element.width, element.height);
8472
+ var largest = Math.max(element.width, element.height);
8473
+ var depth = largest / smallest;
8474
+ if (depth % 1 !== 0) {
8475
+ throw "can not compute 3D dimensions of element";
8476
+ }
8477
+ var xMult = element.width === largest ? 1 : 0;
8478
+ var yMult = element.height === largest ? 1 : 0;
8479
+ gl.pixelStorei(UNPACK_ALIGNMENT, 1);
8480
+ gl.pixelStorei(UNPACK_ROW_LENGTH, element.width);
8481
+ gl.pixelStorei(UNPACK_IMAGE_HEIGHT, 0);
8482
+ gl.pixelStorei(UNPACK_SKIP_IMAGES, 0);
8483
+ gl.texImage3D(target, level, internalFormat, smallest, smallest, smallest, 0, format, type, null);
8484
+ for (var d = 0; d < depth; ++d) {
8485
+ var srcX = d * smallest * xMult;
8486
+ var srcY = d * smallest * yMult;
8487
+ gl.pixelStorei(UNPACK_SKIP_PIXELS, srcX);
8488
+ gl.pixelStorei(UNPACK_SKIP_ROWS, srcY);
8489
+ gl.texSubImage3D(target, level, 0, 0, d, smallest, smallest, 1, format, type, element);
8490
+ }
8491
+ setSkipStateToDefault(gl);
8492
+ });
8519
8493
  } else {
8520
- gl.texImage2D(target, level, internalFormat, format, type, element);
8494
+ scopedSetPackState(gl, options, function () {
8495
+ gl.texImage2D(target, level, internalFormat, format, type, element);
8496
+ });
8521
8497
  }
8522
8498
  if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8523
8499
  setTextureFilteringForSize(gl, tex, options, width, height, internalFormat);
@@ -8596,7 +8572,6 @@ function loadImage(url, crossOrigin, callback) {
8596
8572
  if (crossOrigin) {
8597
8573
  options.mode = 'cors'; // TODO: not sure how to translate image.crossOrigin
8598
8574
  }
8599
-
8600
8575
  fetch(url, options).then(function (response) {
8601
8576
  if (!response.ok) {
8602
8577
  throw response;
@@ -8752,7 +8727,7 @@ function loadTextureFromUrl(gl, tex, options, callback) {
8752
8727
  options = options || defaults.textureOptions;
8753
8728
  setTextureTo1PixelColor(gl, tex, options);
8754
8729
  // Because it's async we need to copy the options.
8755
- options = Object.assign({}, options);
8730
+ options = copyOptionsAndApplyPackState(gl, options);
8756
8731
  var img = loadAndUseImage(options.src, options.crossOrigin, function (err, img) {
8757
8732
  if (err) {
8758
8733
  callback(err, tex, img);
@@ -8792,7 +8767,7 @@ function loadCubemapFromUrls(gl, tex, options, callback) {
8792
8767
  }
8793
8768
  setTextureTo1PixelColor(gl, tex, options);
8794
8769
  // Because it's async we need to copy the options.
8795
- options = Object.assign({}, options);
8770
+ options = copyOptionsAndApplyPackState(gl, options);
8796
8771
  var numToLoad = 6;
8797
8772
  var errors = [];
8798
8773
  var faces = getCubeFaceOrder(gl, options);
@@ -8807,23 +8782,24 @@ function loadCubemapFromUrls(gl, tex, options, callback) {
8807
8782
  if (img.width !== img.height) {
8808
8783
  errors.push("cubemap face img is not a square: " + img.src);
8809
8784
  } else {
8810
- setPackState(gl, options);
8811
- gl.bindTexture(target, tex);
8812
-
8813
- // So assuming this is the first image we now have one face that's img sized
8814
- // and 5 faces that are 1x1 pixel so size the other faces
8815
- if (numToLoad === 5) {
8816
- // use the default order
8817
- getCubeFaceOrder(gl).forEach(function (otherTarget) {
8818
- // Should we re-use the same face or a color?
8819
- gl.texImage2D(otherTarget, level, internalFormat, format, type, img);
8820
- });
8821
- } else {
8822
- gl.texImage2D(faceTarget, level, internalFormat, format, type, img);
8823
- }
8824
- if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8825
- gl.generateMipmap(target);
8826
- }
8785
+ scopedSetPackState(gl, options, function () {
8786
+ gl.bindTexture(target, tex);
8787
+
8788
+ // So assuming this is the first image we now have one face that's img sized
8789
+ // and 5 faces that are 1x1 pixel so size the other faces
8790
+ if (numToLoad === 5) {
8791
+ // use the default order
8792
+ getCubeFaceOrder(gl).forEach(function (otherTarget) {
8793
+ // Should we re-use the same face or a color?
8794
+ gl.texImage2D(otherTarget, level, internalFormat, format, type, img);
8795
+ });
8796
+ } else {
8797
+ gl.texImage2D(faceTarget, level, internalFormat, format, type, img);
8798
+ }
8799
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8800
+ gl.generateMipmap(target);
8801
+ }
8802
+ });
8827
8803
  }
8828
8804
  }
8829
8805
  if (numToLoad === 0) {
@@ -8869,7 +8845,7 @@ function loadSlicesFromUrls(gl, tex, options, callback) {
8869
8845
  }
8870
8846
  setTextureTo1PixelColor(gl, tex, options);
8871
8847
  // Because it's async we need to copy the options.
8872
- options = Object.assign({}, options);
8848
+ options = copyOptionsAndApplyPackState(gl, options);
8873
8849
  var numToLoad = urls.length;
8874
8850
  var errors = [];
8875
8851
  var imgs; // eslint-disable-line
@@ -8884,40 +8860,41 @@ function loadSlicesFromUrls(gl, tex, options, callback) {
8884
8860
  if (err) {
8885
8861
  errors.push(err);
8886
8862
  } else {
8887
- setPackState(gl, options);
8888
- gl.bindTexture(target, tex);
8889
- if (firstImage) {
8890
- firstImage = false;
8891
- width = options.width || img.width;
8892
- height = options.height || img.height;
8893
- gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, null);
8894
-
8895
- // put it in every slice otherwise some slices will be 0,0,0,0
8896
- for (var s = 0; s < depth; ++s) {
8897
- gl.texSubImage3D(target, level, 0, 0, s, width, height, 1, format, type, img);
8898
- }
8899
- } else {
8900
- var src = img;
8901
- var ctx;
8902
- if (img.width !== width || img.height !== height) {
8903
- // Size the image to fix
8904
- ctx = getShared2DContext();
8905
- src = ctx.canvas;
8906
- ctx.canvas.width = width;
8907
- ctx.canvas.height = height;
8908
- ctx.drawImage(img, 0, 0, width, height);
8909
- }
8910
- gl.texSubImage3D(target, level, 0, 0, slice, width, height, 1, format, type, src);
8863
+ scopedSetPackState(gl, options, function () {
8864
+ gl.bindTexture(target, tex);
8865
+ if (firstImage) {
8866
+ firstImage = false;
8867
+ width = options.width || img.width;
8868
+ height = options.height || img.height;
8869
+ gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, null);
8870
+
8871
+ // put it in every slice otherwise some slices will be 0,0,0,0
8872
+ for (var s = 0; s < depth; ++s) {
8873
+ gl.texSubImage3D(target, level, 0, 0, s, width, height, 1, format, type, img);
8874
+ }
8875
+ } else {
8876
+ var src = img;
8877
+ var ctx;
8878
+ if (img.width !== width || img.height !== height) {
8879
+ // Size the image to fix
8880
+ ctx = getShared2DContext();
8881
+ src = ctx.canvas;
8882
+ ctx.canvas.width = width;
8883
+ ctx.canvas.height = height;
8884
+ ctx.drawImage(img, 0, 0, width, height);
8885
+ }
8886
+ gl.texSubImage3D(target, level, 0, 0, slice, width, height, 1, format, type, src);
8911
8887
 
8912
- // free the canvas memory
8913
- if (ctx && src === ctx.canvas) {
8914
- ctx.canvas.width = 0;
8915
- ctx.canvas.height = 0;
8888
+ // free the canvas memory
8889
+ if (ctx && src === ctx.canvas) {
8890
+ ctx.canvas.width = 0;
8891
+ ctx.canvas.height = 0;
8892
+ }
8916
8893
  }
8917
- }
8918
- if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8919
- gl.generateMipmap(target);
8920
- }
8894
+ if (shouldAutomaticallySetTextureFilteringForSize(options)) {
8895
+ gl.generateMipmap(target);
8896
+ }
8897
+ });
8921
8898
  }
8922
8899
  if (numToLoad === 0) {
8923
8900
  callback(errors.length ? errors : undefined, tex, imgs);
@@ -8992,20 +8969,21 @@ function setTextureFromArray(gl, tex, src, options) {
8992
8969
  }
8993
8970
  setSkipStateToDefault(gl);
8994
8971
  gl.pixelStorei(UNPACK_ALIGNMENT, options.unpackAlignment || 1);
8995
- setPackState(gl, options);
8996
- if (target === TEXTURE_CUBE_MAP) {
8997
- var elementsPerElement = bytesPerElement / src.BYTES_PER_ELEMENT;
8998
- var faceSize = numElements / 6 * elementsPerElement;
8999
- getCubeFacesWithNdx(gl, options).forEach(function (f) {
9000
- var offset = faceSize * f.ndx;
9001
- var data = src.subarray(offset, offset + faceSize);
9002
- gl.texImage2D(f.face, level, internalFormat, width, height, 0, format, type, data);
9003
- });
9004
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
9005
- gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, src);
9006
- } else {
9007
- gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, src);
9008
- }
8972
+ scopedSetPackState(gl, options, function () {
8973
+ if (target === TEXTURE_CUBE_MAP) {
8974
+ var elementsPerElement = bytesPerElement / src.BYTES_PER_ELEMENT;
8975
+ var faceSize = numElements / 6 * elementsPerElement;
8976
+ getCubeFacesWithNdx(gl, options).forEach(function (f) {
8977
+ var offset = faceSize * f.ndx;
8978
+ var data = src.subarray(offset, offset + faceSize);
8979
+ gl.texImage2D(f.face, level, internalFormat, width, height, 0, format, type, data);
8980
+ });
8981
+ } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
8982
+ gl.texImage3D(target, level, internalFormat, width, height, depth, 0, format, type, src);
8983
+ } else {
8984
+ gl.texImage2D(target, level, internalFormat, width, height, 0, format, type, src);
8985
+ }
8986
+ });
9009
8987
  return {
9010
8988
  width: width,
9011
8989
  height: height,
@@ -9030,24 +9008,46 @@ function setEmptyTexture(gl, tex, options) {
9030
9008
  var formatType = getFormatAndTypeForInternalFormat(internalFormat);
9031
9009
  var format = options.format || formatType.format;
9032
9010
  var type = options.type || formatType.type;
9033
- setPackState(gl, options);
9034
- if (target === TEXTURE_CUBE_MAP) {
9035
- for (var ii = 0; ii < 6; ++ii) {
9036
- gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, options.width, options.height, 0, format, type, null);
9011
+ scopedSetPackState(gl, options, function () {
9012
+ if (target === TEXTURE_CUBE_MAP) {
9013
+ for (var ii = 0; ii < 6; ++ii) {
9014
+ gl.texImage2D(TEXTURE_CUBE_MAP_POSITIVE_X + ii, level, internalFormat, options.width, options.height, 0, format, type, null);
9015
+ }
9016
+ } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
9017
+ gl.texImage3D(target, level, internalFormat, options.width, options.height, options.depth, 0, format, type, null);
9018
+ } else {
9019
+ gl.texImage2D(target, level, internalFormat, options.width, options.height, 0, format, type, null);
9037
9020
  }
9038
- } else if (target === TEXTURE_3D || target === TEXTURE_2D_ARRAY) {
9039
- gl.texImage3D(target, level, internalFormat, options.width, options.height, options.depth, 0, format, type, null);
9040
- } else {
9041
- gl.texImage2D(target, level, internalFormat, options.width, options.height, 0, format, type, null);
9042
- }
9021
+ });
9043
9022
  }
9044
9023
 
9045
9024
  /**
9046
9025
  * Creates a texture based on the options passed in.
9047
9026
  *
9027
+ * See {@link module:twgl.TextureOptions}
9028
+ *
9048
9029
  * Note: may reset UNPACK_ALIGNMENT, UNPACK_ROW_LENGTH, UNPACK_IMAGE_HEIGHT, UNPACK_SKIP_IMAGES
9049
9030
  * UNPACK_SKIP_PIXELS, and UNPACK_SKIP_ROWS
9050
9031
  *
9032
+ * UNPACK_FLIP_Y_WEBGL, UNPACK_PREMULTIPLY_ALPHA_WEBGL, UNPACK_COLORSPACE_CONVERSION_WEBGL
9033
+ * are left as is though you can pass in options for flipY, premultiplyAlpha, and colorspaceConversion
9034
+ * to override them.
9035
+ *
9036
+ * As for the behavior of these settings
9037
+ *
9038
+ * ```js
9039
+ * gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
9040
+ * t1 = twgl.createTexture({src: someImage }); // flipped
9041
+ * t2 = twgl.createTexture({src: someImage, flipY: true }); // flipped
9042
+ * t3 = twgl.createTexture({src: someImage, flipY: false }); // not flipped
9043
+ * t4 = twgl.createTexture({src: someImage }); // flipped
9044
+ * ```
9045
+ *
9046
+ * * t1 is flipped because UNPACK_FLIP_Y_WEBGL is true
9047
+ * * t2 is flipped because it was requested
9048
+ * * t3 is not flipped because it was requested
9049
+ * * t4 is flipped because UNPACK_FLIP_Y_WEBGL has been restored to true
9050
+ *
9051
9051
  * @param {WebGLRenderingContext} gl the WebGLRenderingContext
9052
9052
  * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
9053
9053
  * @param {module:twgl.TextureReadyCallback} [callback] A callback called when an image has been downloaded and uploaded to the texture.
@@ -9101,6 +9101,45 @@ function createTexture(gl, options, callback) {
9101
9101
  return tex;
9102
9102
  }
9103
9103
 
9104
+ /**
9105
+ * Value returned by createTextureAsync
9106
+ *
9107
+ * @typedef {Object} CreateTextureInfo
9108
+ * @param {WebGLTexture} texture the texture.
9109
+ * @param {module:twgl.TextureSrc} source image(s) used to as the src for the texture
9110
+ * @memberOf module:twgl
9111
+ */
9112
+
9113
+ /**
9114
+ * Creates a texture based on the options passed in.
9115
+ *
9116
+ * see {@link module:twgl/textures.createTexture}.
9117
+ * The only difference is this function returns a promise
9118
+ * where as the other returns a texture and takes a callback.
9119
+ *
9120
+ * Note: this is here for completeness. It is probably better to use
9121
+ * the non-async version as it returns a usable texture immediately
9122
+ * where as this one you have to wait for it to load.
9123
+ *
9124
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
9125
+ * @param {module:twgl.TextureOptions} [options] A TextureOptions object with whatever parameters you want set.
9126
+ * @return {Promise<CreateTextureInfo>} The created texture and source.
9127
+ */
9128
+ function createTextureAsync(gl, options) {
9129
+ return new Promise(function (resolve, reject) {
9130
+ createTexture(gl, options, function (err, texture, source) {
9131
+ if (err) {
9132
+ reject(err);
9133
+ } else {
9134
+ resolve({
9135
+ texture: texture,
9136
+ source: source
9137
+ });
9138
+ }
9139
+ });
9140
+ });
9141
+ }
9142
+
9104
9143
  /**
9105
9144
  * Resizes a texture based on the options passed in.
9106
9145
  *
@@ -9273,19 +9312,56 @@ function createTextures(gl, textureOptions, callback) {
9273
9312
  return textures;
9274
9313
  }
9275
9314
 
9315
+ /**
9316
+ * Value returned by createTextureAsync
9317
+ *
9318
+ * @typedef {Object} CreateTexturesInfo
9319
+ * @param {Object.<string, WebGLTexture>} textures the created textures by name. Same as returned by {@link module:twgl.createTextures}.
9320
+ * @param {Object.<string, module:twgl.TextureSrc>} sources the image(s) used for the texture by name.
9321
+ * @memberOf module:twgl
9322
+ */
9323
+
9324
+ /**
9325
+ * Creates textures based on the options passed in.
9326
+ *
9327
+ * see {@link module:twgl/textures.createTextures}.
9328
+ * The only difference is this function returns a promise
9329
+ * where as the other returns a texture and takes a callback.
9330
+ *
9331
+ * Note: this is here for completeness. It is probably better to use
9332
+ * the non-async version as it returns usable textures immediately
9333
+ * where as this one you have to wait for them to load.
9334
+ *
9335
+ * @param {WebGLRenderingContext} gl the WebGLRenderingContext
9336
+ * @param {Object.<string,module:twgl.TextureOptions>} options A object of TextureOptions one per texture.
9337
+ * @return {Promise<CreateTexturesInfo>} The created textures and sources.
9338
+ */
9339
+ function createTexturesAsync(gl, options) {
9340
+ return new Promise(function (resolve, reject) {
9341
+ createTexture(gl, options, function (err, textures, sources) {
9342
+ if (err) {
9343
+ reject(err);
9344
+ } else {
9345
+ resolve({
9346
+ textures: textures,
9347
+ sources: sources
9348
+ });
9349
+ }
9350
+ });
9351
+ });
9352
+ }
9353
+
9276
9354
  /***/ }),
9277
9355
 
9278
9356
  /***/ "./src/twgl-full.js":
9279
9357
  /*!**************************!*\
9280
9358
  !*** ./src/twgl-full.js ***!
9281
9359
  \**************************/
9282
- /*! no static exports found */
9283
- /***/ (function(module, exports, __webpack_require__) {
9360
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9284
9361
 
9285
- "use strict";
9286
9362
 
9287
9363
 
9288
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9364
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9289
9365
  exports.__esModule = true;
9290
9366
  var _exportNames = {
9291
9367
  m4: true,
@@ -9306,8 +9382,8 @@ Object.keys(_twgl).forEach(function (key) {
9306
9382
  if (key in exports && exports[key] === _twgl[key]) return;
9307
9383
  exports[key] = _twgl[key];
9308
9384
  });
9309
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9310
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
9385
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
9386
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
9311
9387
 
9312
9388
  /***/ }),
9313
9389
 
@@ -9315,13 +9391,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
9315
9391
  /*!*********************!*\
9316
9392
  !*** ./src/twgl.js ***!
9317
9393
  \*********************/
9318
- /*! no static exports found */
9319
- /***/ (function(module, exports, __webpack_require__) {
9394
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
9320
9395
 
9321
- "use strict";
9322
9396
 
9323
9397
 
9324
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
9398
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
9325
9399
  exports.__esModule = true;
9326
9400
  var _exportNames = {
9327
9401
  addExtensionsToContext: true,
@@ -9411,8 +9485,8 @@ Object.keys(vertexArrays).forEach(function (key) {
9411
9485
  if (key in exports && exports[key] === vertexArrays[key]) return;
9412
9486
  exports[key] = vertexArrays[key];
9413
9487
  });
9414
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
9415
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
9488
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
9489
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
9416
9490
  /*
9417
9491
  * Copyright 2019 Gregg Tavares
9418
9492
  *
@@ -9545,7 +9619,6 @@ function setDefaults(newDefaults) {
9545
9619
  attributes.setAttributeDefaults_(newDefaults); // eslint-disable-line
9546
9620
  textures.setTextureDefaults_(newDefaults); // eslint-disable-line
9547
9621
  }
9548
-
9549
9622
  var prefixRE = /^(.*?)_/;
9550
9623
  function addExtensionToContext(gl, extensionName) {
9551
9624
  utils.glEnumToString(gl, 0);
@@ -9768,16 +9841,25 @@ function resizeCanvasToDisplaySize(canvas, multiplier) {
9768
9841
  return false;
9769
9842
  }
9770
9843
 
9844
+ // function notPrivate(name) {
9845
+ // return name[name.length - 1] !== '_';
9846
+ // }
9847
+ //
9848
+ // function copyPublicProperties(src, dst) {
9849
+ // Object.keys(src).filter(notPrivate).forEach(function(key) {
9850
+ // dst[key] = src[key];
9851
+ // });
9852
+ // return dst;
9853
+ // }
9854
+
9771
9855
  /***/ }),
9772
9856
 
9773
9857
  /***/ "./src/typedarrays.js":
9774
9858
  /*!****************************!*\
9775
9859
  !*** ./src/typedarrays.js ***!
9776
9860
  \****************************/
9777
- /*! no static exports found */
9778
- /***/ (function(module, exports, __webpack_require__) {
9861
+ /***/ ((__unused_webpack_module, exports) => {
9779
9862
 
9780
- "use strict";
9781
9863
 
9782
9864
 
9783
9865
  exports.__esModule = true;
@@ -9946,12 +10028,11 @@ function getTypedArrayTypeForGLType(type) {
9946
10028
  }
9947
10029
  return CTOR;
9948
10030
  }
9949
- var isArrayBuffer = typeof SharedArrayBuffer !== 'undefined' ? function isArrayBufferOrSharedArrayBuffer(a) {
10031
+ var isArrayBuffer = exports.isArrayBuffer = typeof SharedArrayBuffer !== 'undefined' ? function isArrayBufferOrSharedArrayBuffer(a) {
9950
10032
  return a && a.buffer && (a.buffer instanceof ArrayBuffer || a.buffer instanceof SharedArrayBuffer);
9951
10033
  } : function isArrayBuffer(a) {
9952
10034
  return a && a.buffer && a.buffer instanceof ArrayBuffer;
9953
10035
  };
9954
- exports.isArrayBuffer = isArrayBuffer;
9955
10036
 
9956
10037
  /***/ }),
9957
10038
 
@@ -9959,10 +10040,8 @@ exports.isArrayBuffer = isArrayBuffer;
9959
10040
  /*!**********************!*\
9960
10041
  !*** ./src/utils.js ***!
9961
10042
  \**********************/
9962
- /*! no static exports found */
9963
- /***/ (function(module, exports, __webpack_require__) {
10043
+ /***/ ((__unused_webpack_module, exports) => {
9964
10044
 
9965
- "use strict";
9966
10045
 
9967
10046
 
9968
10047
  exports.__esModule = true;
@@ -10078,7 +10157,7 @@ function isWebGL1(gl) {
10078
10157
  * @memberOf module:twgl
10079
10158
  * @function glEnumToString
10080
10159
  */
10081
- var glEnumToString = function () {
10160
+ var glEnumToString = exports.glEnumToString = function () {
10082
10161
  var haveEnumsForType = {};
10083
10162
  var enums = {};
10084
10163
  function addEnums(gl) {
@@ -10098,7 +10177,6 @@ var glEnumToString = function () {
10098
10177
  return enums[value] || (typeof value === 'number' ? "0x".concat(value.toString(16)) : value);
10099
10178
  };
10100
10179
  }();
10101
- exports.glEnumToString = glEnumToString;
10102
10180
 
10103
10181
  /***/ }),
10104
10182
 
@@ -10106,10 +10184,8 @@ exports.glEnumToString = glEnumToString;
10106
10184
  /*!*******************!*\
10107
10185
  !*** ./src/v3.js ***!
10108
10186
  \*******************/
10109
- /*! no static exports found */
10110
- /***/ (function(module, exports, __webpack_require__) {
10187
+ /***/ ((__unused_webpack_module, exports) => {
10111
10188
 
10112
- "use strict";
10113
10189
 
10114
10190
 
10115
10191
  exports.__esModule = true;
@@ -10536,20 +10612,18 @@ function divide(a, b, dst) {
10536
10612
  /*!******************************!*\
10537
10613
  !*** ./src/vertex-arrays.js ***!
10538
10614
  \******************************/
10539
- /*! no static exports found */
10540
- /***/ (function(module, exports, __webpack_require__) {
10615
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
10541
10616
 
10542
- "use strict";
10543
10617
 
10544
10618
 
10545
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10619
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
10546
10620
  exports.__esModule = true;
10547
10621
  exports.createVAOAndSetAttributes = createVAOAndSetAttributes;
10548
10622
  exports.createVAOFromBufferInfo = createVAOFromBufferInfo;
10549
10623
  exports.createVertexArrayInfo = createVertexArrayInfo;
10550
10624
  var programs = _interopRequireWildcard(__webpack_require__(/*! ./programs.js */ "./src/programs.js"));
10551
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
10552
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
10625
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
10626
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
10553
10627
  /*
10554
10628
  * Copyright 2019 Gregg Tavares
10555
10629
  *
@@ -10695,6 +10769,41 @@ function createVAOFromBufferInfo(gl, programInfo, bufferInfo) {
10695
10769
 
10696
10770
  /***/ })
10697
10771
 
10698
- /******/ });
10772
+ /******/ });
10773
+ /************************************************************************/
10774
+ /******/ // The module cache
10775
+ /******/ var __webpack_module_cache__ = {};
10776
+ /******/
10777
+ /******/ // The require function
10778
+ /******/ function __webpack_require__(moduleId) {
10779
+ /******/ // Check if module is in cache
10780
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
10781
+ /******/ if (cachedModule !== undefined) {
10782
+ /******/ return cachedModule.exports;
10783
+ /******/ }
10784
+ /******/ // Create a new module (and put it into the cache)
10785
+ /******/ var module = __webpack_module_cache__[moduleId] = {
10786
+ /******/ // no module.id needed
10787
+ /******/ // no module.loaded needed
10788
+ /******/ exports: {}
10789
+ /******/ };
10790
+ /******/
10791
+ /******/ // Execute the module function
10792
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
10793
+ /******/
10794
+ /******/ // Return the exports of the module
10795
+ /******/ return module.exports;
10796
+ /******/ }
10797
+ /******/
10798
+ /************************************************************************/
10799
+ /******/
10800
+ /******/ // startup
10801
+ /******/ // Load entry module and return exports
10802
+ /******/ // This entry module is referenced by other modules so it can't be inlined
10803
+ /******/ var __webpack_exports__ = __webpack_require__("./src/twgl-full.js");
10804
+ /******/
10805
+ /******/ return __webpack_exports__;
10806
+ /******/ })()
10807
+ ;
10699
10808
  });
10700
10809
  //# sourceMappingURL=twgl-full.js.map