@ohos-ports/luma.gl-gltools 8.5.21-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +7 -0
- package/dist/dist.js +4716 -0
- package/dist/dist.min.js +1 -0
- package/dist/es5/bundle.js +7 -0
- package/dist/es5/bundle.js.map +1 -0
- package/dist/es5/context/context.d.ts +79 -0
- package/dist/es5/context/context.js +321 -0
- package/dist/es5/context/context.js.map +1 -0
- package/dist/es5/index.d.ts +37 -0
- package/dist/es5/index.js +140 -0
- package/dist/es5/index.js.map +1 -0
- package/dist/es5/polyfill/get-parameter-polyfill.js +77 -0
- package/dist/es5/polyfill/get-parameter-polyfill.js.map +1 -0
- package/dist/es5/polyfill/polyfill-context.d.ts +4 -0
- package/dist/es5/polyfill/polyfill-context.js +132 -0
- package/dist/es5/polyfill/polyfill-context.js.map +1 -0
- package/dist/es5/polyfill/polyfill-table.js +161 -0
- package/dist/es5/polyfill/polyfill-table.js.map +1 -0
- package/dist/es5/polyfill/polyfill-vertex-array-object.js +341 -0
- package/dist/es5/polyfill/polyfill-vertex-array-object.js.map +1 -0
- package/dist/es5/state-tracker/track-context-state.d.ts +22 -0
- package/dist/es5/state-tracker/track-context-state.js +191 -0
- package/dist/es5/state-tracker/track-context-state.js.map +1 -0
- package/dist/es5/state-tracker/unified-parameter-api.d.ts +34 -0
- package/dist/es5/state-tracker/unified-parameter-api.js +117 -0
- package/dist/es5/state-tracker/unified-parameter-api.js.map +1 -0
- package/dist/es5/state-tracker/webgl-parameter-tables.js +343 -0
- package/dist/es5/state-tracker/webgl-parameter-tables.js.map +1 -0
- package/dist/es5/utils/assert.js +13 -0
- package/dist/es5/utils/assert.js.map +1 -0
- package/dist/es5/utils/device-pixels.d.ts +28 -0
- package/dist/es5/utils/device-pixels.js +72 -0
- package/dist/es5/utils/device-pixels.js.map +1 -0
- package/dist/es5/utils/log.js +14 -0
- package/dist/es5/utils/log.js.map +1 -0
- package/dist/es5/utils/utils.js +37 -0
- package/dist/es5/utils/utils.js.map +1 -0
- package/dist/es5/utils/webgl-checks.d.ts +17 -0
- package/dist/es5/utils/webgl-checks.js +54 -0
- package/dist/es5/utils/webgl-checks.js.map +1 -0
- package/dist/esm/bundle.js +5 -0
- package/dist/esm/bundle.js.map +1 -0
- package/dist/esm/context/context.d.ts +79 -0
- package/dist/esm/context/context.js +303 -0
- package/dist/esm/context/context.js.map +1 -0
- package/dist/esm/index.d.ts +37 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/polyfill/get-parameter-polyfill.js +88 -0
- package/dist/esm/polyfill/get-parameter-polyfill.js.map +1 -0
- package/dist/esm/polyfill/polyfill-context.d.ts +4 -0
- package/dist/esm/polyfill/polyfill-context.js +95 -0
- package/dist/esm/polyfill/polyfill-context.js.map +1 -0
- package/dist/esm/polyfill/polyfill-table.js +157 -0
- package/dist/esm/polyfill/polyfill-table.js.map +1 -0
- package/dist/esm/polyfill/polyfill-vertex-array-object.js +335 -0
- package/dist/esm/polyfill/polyfill-vertex-array-object.js.map +1 -0
- package/dist/esm/state-tracker/track-context-state.d.ts +22 -0
- package/dist/esm/state-tracker/track-context-state.js +167 -0
- package/dist/esm/state-tracker/track-context-state.js.map +1 -0
- package/dist/esm/state-tracker/unified-parameter-api.d.ts +34 -0
- package/dist/esm/state-tracker/unified-parameter-api.js +84 -0
- package/dist/esm/state-tracker/unified-parameter-api.js.map +1 -0
- package/dist/esm/state-tracker/webgl-parameter-tables.js +372 -0
- package/dist/esm/state-tracker/webgl-parameter-tables.js.map +1 -0
- package/dist/esm/utils/assert.js +6 -0
- package/dist/esm/utils/assert.js.map +1 -0
- package/dist/esm/utils/device-pixels.d.ts +28 -0
- package/dist/esm/utils/device-pixels.js +63 -0
- package/dist/esm/utils/device-pixels.js.map +1 -0
- package/dist/esm/utils/log.js +5 -0
- package/dist/esm/utils/log.js.map +1 -0
- package/dist/esm/utils/utils.js +28 -0
- package/dist/esm/utils/utils.js.map +1 -0
- package/dist/esm/utils/webgl-checks.d.ts +17 -0
- package/dist/esm/utils/webgl-checks.js +34 -0
- package/dist/esm/utils/webgl-checks.js.map +1 -0
- package/package.json +44 -0
- package/src/bundle.js +6 -0
- package/src/context/context.d.ts +79 -0
- package/src/context/context.js +331 -0
- package/src/index.d.ts +37 -0
- package/src/index.js +36 -0
- package/src/polyfill/get-parameter-polyfill.js +118 -0
- package/src/polyfill/polyfill-context.d.ts +4 -0
- package/src/polyfill/polyfill-context.js +103 -0
- package/src/polyfill/polyfill-table.js +162 -0
- package/src/polyfill/polyfill-vertex-array-object.js +359 -0
- package/src/state-tracker/track-context-state.d.ts +22 -0
- package/src/state-tracker/track-context-state.js +220 -0
- package/src/state-tracker/unified-parameter-api.d.ts +34 -0
- package/src/state-tracker/unified-parameter-api.js +134 -0
- package/src/state-tracker/webgl-parameter-tables.js +515 -0
- package/src/utils/assert.js +6 -0
- package/src/utils/device-pixels.d.ts +28 -0
- package/src/utils/device-pixels.js +94 -0
- package/src/utils/log.js +3 -0
- package/src/utils/utils.js +27 -0
- package/src/utils/webgl-checks.d.ts +17 -0
- package/src/utils/webgl-checks.js +38 -0
package/dist/dist.js
ADDED
|
@@ -0,0 +1,4716 @@
|
|
|
1
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
2
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
3
|
+
module.exports = factory();
|
|
4
|
+
else if(typeof define === 'function' && define.amd)
|
|
5
|
+
define([], factory);
|
|
6
|
+
else {
|
|
7
|
+
var a = factory();
|
|
8
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
9
|
+
}
|
|
10
|
+
})(window, function() {
|
|
11
|
+
return /******/ (function(modules) { // webpackBootstrap
|
|
12
|
+
/******/ // The module cache
|
|
13
|
+
/******/ var installedModules = {};
|
|
14
|
+
/******/
|
|
15
|
+
/******/ // The require function
|
|
16
|
+
/******/ function __webpack_require__(moduleId) {
|
|
17
|
+
/******/
|
|
18
|
+
/******/ // Check if module is in cache
|
|
19
|
+
/******/ if(installedModules[moduleId]) {
|
|
20
|
+
/******/ return installedModules[moduleId].exports;
|
|
21
|
+
/******/ }
|
|
22
|
+
/******/ // Create a new module (and put it into the cache)
|
|
23
|
+
/******/ var module = installedModules[moduleId] = {
|
|
24
|
+
/******/ i: moduleId,
|
|
25
|
+
/******/ l: false,
|
|
26
|
+
/******/ exports: {}
|
|
27
|
+
/******/ };
|
|
28
|
+
/******/
|
|
29
|
+
/******/ // Execute the module function
|
|
30
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
31
|
+
/******/
|
|
32
|
+
/******/ // Flag the module as loaded
|
|
33
|
+
/******/ module.l = true;
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // Return the exports of the module
|
|
36
|
+
/******/ return module.exports;
|
|
37
|
+
/******/ }
|
|
38
|
+
/******/
|
|
39
|
+
/******/
|
|
40
|
+
/******/ // expose the modules object (__webpack_modules__)
|
|
41
|
+
/******/ __webpack_require__.m = modules;
|
|
42
|
+
/******/
|
|
43
|
+
/******/ // expose the module cache
|
|
44
|
+
/******/ __webpack_require__.c = installedModules;
|
|
45
|
+
/******/
|
|
46
|
+
/******/ // define getter function for harmony exports
|
|
47
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
48
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
49
|
+
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
50
|
+
/******/ }
|
|
51
|
+
/******/ };
|
|
52
|
+
/******/
|
|
53
|
+
/******/ // define __esModule on exports
|
|
54
|
+
/******/ __webpack_require__.r = function(exports) {
|
|
55
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
56
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
57
|
+
/******/ }
|
|
58
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
59
|
+
/******/ };
|
|
60
|
+
/******/
|
|
61
|
+
/******/ // create a fake namespace object
|
|
62
|
+
/******/ // mode & 1: value is a module id, require it
|
|
63
|
+
/******/ // mode & 2: merge all properties of value into the ns
|
|
64
|
+
/******/ // mode & 4: return value when already ns object
|
|
65
|
+
/******/ // mode & 8|1: behave like require
|
|
66
|
+
/******/ __webpack_require__.t = function(value, mode) {
|
|
67
|
+
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
68
|
+
/******/ if(mode & 8) return value;
|
|
69
|
+
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
70
|
+
/******/ var ns = Object.create(null);
|
|
71
|
+
/******/ __webpack_require__.r(ns);
|
|
72
|
+
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
73
|
+
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
74
|
+
/******/ return ns;
|
|
75
|
+
/******/ };
|
|
76
|
+
/******/
|
|
77
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
78
|
+
/******/ __webpack_require__.n = function(module) {
|
|
79
|
+
/******/ var getter = module && module.__esModule ?
|
|
80
|
+
/******/ function getDefault() { return module['default']; } :
|
|
81
|
+
/******/ function getModuleExports() { return module; };
|
|
82
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
83
|
+
/******/ return getter;
|
|
84
|
+
/******/ };
|
|
85
|
+
/******/
|
|
86
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
|
87
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
88
|
+
/******/
|
|
89
|
+
/******/ // __webpack_public_path__
|
|
90
|
+
/******/ __webpack_require__.p = "";
|
|
91
|
+
/******/
|
|
92
|
+
/******/
|
|
93
|
+
/******/ // Load entry module and return exports
|
|
94
|
+
/******/ return __webpack_require__(__webpack_require__.s = "./src/bundle.js");
|
|
95
|
+
/******/ })
|
|
96
|
+
/************************************************************************/
|
|
97
|
+
/******/ ({
|
|
98
|
+
|
|
99
|
+
/***/ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js":
|
|
100
|
+
/*!*********************************************************************************************!*\
|
|
101
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
|
|
102
|
+
\*********************************************************************************************/
|
|
103
|
+
/*! exports provided: default */
|
|
104
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
105
|
+
|
|
106
|
+
"use strict";
|
|
107
|
+
__webpack_require__.r(__webpack_exports__);
|
|
108
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _defineProperty; });
|
|
109
|
+
function _defineProperty(obj, key, value) {
|
|
110
|
+
if (key in obj) {
|
|
111
|
+
Object.defineProperty(obj, key, {
|
|
112
|
+
value: value,
|
|
113
|
+
enumerable: true,
|
|
114
|
+
configurable: true,
|
|
115
|
+
writable: true
|
|
116
|
+
});
|
|
117
|
+
} else {
|
|
118
|
+
obj[key] = value;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return obj;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/***/ }),
|
|
125
|
+
|
|
126
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/index.js":
|
|
127
|
+
/*!********************************************************************************!*\
|
|
128
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/index.js ***!
|
|
129
|
+
\********************************************************************************/
|
|
130
|
+
/*! exports provided: VERSION, self, window, global, document, process, console, isBrowser, isBrowserMainThread, getBrowser, isMobile, isElectron, assert */
|
|
131
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
132
|
+
|
|
133
|
+
"use strict";
|
|
134
|
+
__webpack_require__.r(__webpack_exports__);
|
|
135
|
+
/* harmony import */ var _utils_globals__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/globals */ "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js");
|
|
136
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return _utils_globals__WEBPACK_IMPORTED_MODULE_0__["VERSION"]; });
|
|
137
|
+
|
|
138
|
+
/* harmony import */ var _lib_globals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/globals */ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js");
|
|
139
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "self", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["self"]; });
|
|
140
|
+
|
|
141
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["window"]; });
|
|
142
|
+
|
|
143
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "global", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["global"]; });
|
|
144
|
+
|
|
145
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "document", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["document"]; });
|
|
146
|
+
|
|
147
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "process", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["process"]; });
|
|
148
|
+
|
|
149
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "console", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["console"]; });
|
|
150
|
+
|
|
151
|
+
/* harmony import */ var _lib_is_browser__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/is-browser */ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js");
|
|
152
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBrowser", function() { return _lib_is_browser__WEBPACK_IMPORTED_MODULE_2__["default"]; });
|
|
153
|
+
|
|
154
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isBrowserMainThread", function() { return _lib_is_browser__WEBPACK_IMPORTED_MODULE_2__["isBrowserMainThread"]; });
|
|
155
|
+
|
|
156
|
+
/* harmony import */ var _lib_get_browser__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/get-browser */ "../../node_modules/@probe.gl/env/dist/esm/lib/get-browser.js");
|
|
157
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getBrowser", function() { return _lib_get_browser__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
|
158
|
+
|
|
159
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return _lib_get_browser__WEBPACK_IMPORTED_MODULE_3__["isMobile"]; });
|
|
160
|
+
|
|
161
|
+
/* harmony import */ var _lib_is_electron__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/is-electron */ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js");
|
|
162
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isElectron", function() { return _lib_is_electron__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
|
163
|
+
|
|
164
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/assert */ "../../node_modules/@probe.gl/env/dist/esm/utils/assert.js");
|
|
165
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return _utils_assert__WEBPACK_IMPORTED_MODULE_5__["default"]; });
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
//# sourceMappingURL=index.js.map
|
|
174
|
+
|
|
175
|
+
/***/ }),
|
|
176
|
+
|
|
177
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/lib/get-browser.js":
|
|
178
|
+
/*!******************************************************************************************!*\
|
|
179
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/lib/get-browser.js ***!
|
|
180
|
+
\******************************************************************************************/
|
|
181
|
+
/*! exports provided: isMobile, default */
|
|
182
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
183
|
+
|
|
184
|
+
"use strict";
|
|
185
|
+
__webpack_require__.r(__webpack_exports__);
|
|
186
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isMobile", function() { return isMobile; });
|
|
187
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return getBrowser; });
|
|
188
|
+
/* harmony import */ var _is_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-browser */ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js");
|
|
189
|
+
/* harmony import */ var _is_electron__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./is-electron */ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js");
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
const window = globalThis;
|
|
193
|
+
function isMobile() {
|
|
194
|
+
return typeof window.orientation !== 'undefined';
|
|
195
|
+
}
|
|
196
|
+
function getBrowser(mockUserAgent) {
|
|
197
|
+
if (!mockUserAgent && !Object(_is_browser__WEBPACK_IMPORTED_MODULE_0__["default"])()) {
|
|
198
|
+
return 'Node';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (Object(_is_electron__WEBPACK_IMPORTED_MODULE_1__["default"])(mockUserAgent)) {
|
|
202
|
+
return 'Electron';
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const navigator_ = typeof navigator !== 'undefined' ? navigator : {};
|
|
206
|
+
const userAgent = mockUserAgent || navigator_.userAgent || '';
|
|
207
|
+
|
|
208
|
+
if (userAgent.indexOf('Edge') > -1) {
|
|
209
|
+
return 'Edge';
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const isMSIE = userAgent.indexOf('MSIE ') !== -1;
|
|
213
|
+
const isTrident = userAgent.indexOf('Trident/') !== -1;
|
|
214
|
+
|
|
215
|
+
if (isMSIE || isTrident) {
|
|
216
|
+
return 'IE';
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (window.chrome) {
|
|
220
|
+
return 'Chrome';
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (window.safari) {
|
|
224
|
+
return 'Safari';
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (window.mozInnerScreenX) {
|
|
228
|
+
return 'Firefox';
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return 'Unknown';
|
|
232
|
+
}
|
|
233
|
+
//# sourceMappingURL=get-browser.js.map
|
|
234
|
+
|
|
235
|
+
/***/ }),
|
|
236
|
+
|
|
237
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js":
|
|
238
|
+
/*!**************************************************************************************!*\
|
|
239
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/lib/globals.js ***!
|
|
240
|
+
\**************************************************************************************/
|
|
241
|
+
/*! exports provided: self, window, global, document, process, console */
|
|
242
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
243
|
+
|
|
244
|
+
"use strict";
|
|
245
|
+
__webpack_require__.r(__webpack_exports__);
|
|
246
|
+
/* WEBPACK VAR INJECTION */(function(global, process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "self", function() { return self_; });
|
|
247
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "window", function() { return window_; });
|
|
248
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "global", function() { return global_; });
|
|
249
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "document", function() { return document_; });
|
|
250
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "process", function() { return process_; });
|
|
251
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "console", function() { return console_; });
|
|
252
|
+
const globals = {
|
|
253
|
+
self: typeof self !== 'undefined' && self,
|
|
254
|
+
window: typeof window !== 'undefined' && window,
|
|
255
|
+
global: typeof global !== 'undefined' && global,
|
|
256
|
+
document: typeof document !== 'undefined' && document,
|
|
257
|
+
process: typeof process === 'object' && process
|
|
258
|
+
};
|
|
259
|
+
const global_ = globalThis;
|
|
260
|
+
const self_ = globals.self || globals.window || globals.global;
|
|
261
|
+
const window_ = globals.window || globals.self || globals.global;
|
|
262
|
+
const document_ = globals.document || {};
|
|
263
|
+
const process_ = globals.process || {};
|
|
264
|
+
const console_ = console;
|
|
265
|
+
|
|
266
|
+
//# sourceMappingURL=globals.js.map
|
|
267
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../webpack/buildin/global.js */ "../../node_modules/webpack/buildin/global.js"), __webpack_require__(/*! ./../../../../../process/browser.js */ "../../node_modules/process/browser.js")))
|
|
268
|
+
|
|
269
|
+
/***/ }),
|
|
270
|
+
|
|
271
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js":
|
|
272
|
+
/*!*****************************************************************************************!*\
|
|
273
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/lib/is-browser.js ***!
|
|
274
|
+
\*****************************************************************************************/
|
|
275
|
+
/*! exports provided: default, isBrowserMainThread */
|
|
276
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
277
|
+
|
|
278
|
+
"use strict";
|
|
279
|
+
__webpack_require__.r(__webpack_exports__);
|
|
280
|
+
/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isBrowser; });
|
|
281
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBrowserMainThread", function() { return isBrowserMainThread; });
|
|
282
|
+
/* harmony import */ var _is_electron__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./is-electron */ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js");
|
|
283
|
+
|
|
284
|
+
function isBrowser() {
|
|
285
|
+
const isNode = typeof process === 'object' && String(process) === '[object process]' && !process.browser;
|
|
286
|
+
return !isNode || Object(_is_electron__WEBPACK_IMPORTED_MODULE_0__["default"])();
|
|
287
|
+
}
|
|
288
|
+
function isBrowserMainThread() {
|
|
289
|
+
return isBrowser() && typeof document !== 'undefined';
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=is-browser.js.map
|
|
292
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../process/browser.js */ "../../node_modules/process/browser.js")))
|
|
293
|
+
|
|
294
|
+
/***/ }),
|
|
295
|
+
|
|
296
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/lib/is-electron.js":
|
|
297
|
+
/*!******************************************************************************************!*\
|
|
298
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/lib/is-electron.js ***!
|
|
299
|
+
\******************************************************************************************/
|
|
300
|
+
/*! exports provided: default */
|
|
301
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
302
|
+
|
|
303
|
+
"use strict";
|
|
304
|
+
__webpack_require__.r(__webpack_exports__);
|
|
305
|
+
/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isElectron; });
|
|
306
|
+
function isElectron(mockUserAgent) {
|
|
307
|
+
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
|
|
308
|
+
return true;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
if (typeof process !== 'undefined' && typeof process.versions === 'object' && Boolean(process.versions.electron)) {
|
|
312
|
+
return true;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const realUserAgent = typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent;
|
|
316
|
+
const userAgent = mockUserAgent || realUserAgent;
|
|
317
|
+
|
|
318
|
+
if (userAgent && userAgent.indexOf('Electron') >= 0) {
|
|
319
|
+
return true;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=is-electron.js.map
|
|
325
|
+
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../../../process/browser.js */ "../../node_modules/process/browser.js")))
|
|
326
|
+
|
|
327
|
+
/***/ }),
|
|
328
|
+
|
|
329
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/utils/assert.js":
|
|
330
|
+
/*!***************************************************************************************!*\
|
|
331
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/utils/assert.js ***!
|
|
332
|
+
\***************************************************************************************/
|
|
333
|
+
/*! exports provided: default */
|
|
334
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
335
|
+
|
|
336
|
+
"use strict";
|
|
337
|
+
__webpack_require__.r(__webpack_exports__);
|
|
338
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return assert; });
|
|
339
|
+
function assert(condition, message) {
|
|
340
|
+
if (!condition) {
|
|
341
|
+
throw new Error(message || 'Assertion failed');
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
//# sourceMappingURL=assert.js.map
|
|
345
|
+
|
|
346
|
+
/***/ }),
|
|
347
|
+
|
|
348
|
+
/***/ "../../node_modules/@probe.gl/env/dist/esm/utils/globals.js":
|
|
349
|
+
/*!****************************************************************************************!*\
|
|
350
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/env/dist/esm/utils/globals.js ***!
|
|
351
|
+
\****************************************************************************************/
|
|
352
|
+
/*! exports provided: self, window, global, document, process, console, VERSION, isBrowser */
|
|
353
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
354
|
+
|
|
355
|
+
"use strict";
|
|
356
|
+
__webpack_require__.r(__webpack_exports__);
|
|
357
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
|
|
358
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isBrowser", function() { return isBrowser; });
|
|
359
|
+
/* harmony import */ var _lib_is_browser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../lib/is-browser */ "../../node_modules/@probe.gl/env/dist/esm/lib/is-browser.js");
|
|
360
|
+
/* harmony import */ var _lib_globals__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/globals */ "../../node_modules/@probe.gl/env/dist/esm/lib/globals.js");
|
|
361
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "self", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["self"]; });
|
|
362
|
+
|
|
363
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["window"]; });
|
|
364
|
+
|
|
365
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "global", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["global"]; });
|
|
366
|
+
|
|
367
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "document", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["document"]; });
|
|
368
|
+
|
|
369
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "process", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["process"]; });
|
|
370
|
+
|
|
371
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "console", function() { return _lib_globals__WEBPACK_IMPORTED_MODULE_1__["console"]; });
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
const VERSION = true ? "8.5.20" : undefined;
|
|
376
|
+
const isBrowser = Object(_lib_is_browser__WEBPACK_IMPORTED_MODULE_0__["default"])();
|
|
377
|
+
//# sourceMappingURL=globals.js.map
|
|
378
|
+
|
|
379
|
+
/***/ }),
|
|
380
|
+
|
|
381
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/index.js":
|
|
382
|
+
/*!********************************************************************************!*\
|
|
383
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/index.js ***!
|
|
384
|
+
\********************************************************************************/
|
|
385
|
+
/*! exports provided: default, Log, COLOR, addColor, leftPad, rightPad, autobind, LocalStorage, getHiResTimestamp */
|
|
386
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
387
|
+
|
|
388
|
+
"use strict";
|
|
389
|
+
__webpack_require__.r(__webpack_exports__);
|
|
390
|
+
/* harmony import */ var _log__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./log */ "../../node_modules/@probe.gl/log/dist/esm/log.js");
|
|
391
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Log", function() { return _log__WEBPACK_IMPORTED_MODULE_0__["default"]; });
|
|
392
|
+
|
|
393
|
+
/* harmony import */ var _utils_color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/color */ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js");
|
|
394
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "COLOR", function() { return _utils_color__WEBPACK_IMPORTED_MODULE_1__["COLOR"]; });
|
|
395
|
+
|
|
396
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addColor", function() { return _utils_color__WEBPACK_IMPORTED_MODULE_1__["addColor"]; });
|
|
397
|
+
|
|
398
|
+
/* harmony import */ var _utils_formatters__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/formatters */ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js");
|
|
399
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "leftPad", function() { return _utils_formatters__WEBPACK_IMPORTED_MODULE_2__["leftPad"]; });
|
|
400
|
+
|
|
401
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rightPad", function() { return _utils_formatters__WEBPACK_IMPORTED_MODULE_2__["rightPad"]; });
|
|
402
|
+
|
|
403
|
+
/* harmony import */ var _utils_autobind__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/autobind */ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js");
|
|
404
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "autobind", function() { return _utils_autobind__WEBPACK_IMPORTED_MODULE_3__["autobind"]; });
|
|
405
|
+
|
|
406
|
+
/* harmony import */ var _utils_local_storage__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/local-storage */ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js");
|
|
407
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "LocalStorage", function() { return _utils_local_storage__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
|
408
|
+
|
|
409
|
+
/* harmony import */ var _utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/hi-res-timestamp */ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js");
|
|
410
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getHiResTimestamp", function() { return _utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_5__["getHiResTimestamp"]; });
|
|
411
|
+
|
|
412
|
+
/* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./init */ "../../node_modules/@probe.gl/log/dist/esm/init.js");
|
|
413
|
+
/* harmony import */ var _init__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_init__WEBPACK_IMPORTED_MODULE_6__);
|
|
414
|
+
|
|
415
|
+
/* harmony default export */ __webpack_exports__["default"] = (new _log__WEBPACK_IMPORTED_MODULE_0__["default"]({
|
|
416
|
+
id: '@probe.gl/log'
|
|
417
|
+
}));
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
//# sourceMappingURL=index.js.map
|
|
427
|
+
|
|
428
|
+
/***/ }),
|
|
429
|
+
|
|
430
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/init.js":
|
|
431
|
+
/*!*******************************************************************************!*\
|
|
432
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/init.js ***!
|
|
433
|
+
\*******************************************************************************/
|
|
434
|
+
/*! no static exports found */
|
|
435
|
+
/***/ (function(module, exports) {
|
|
436
|
+
|
|
437
|
+
globalThis.probe = {};
|
|
438
|
+
//# sourceMappingURL=init.js.map
|
|
439
|
+
|
|
440
|
+
/***/ }),
|
|
441
|
+
|
|
442
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/log.js":
|
|
443
|
+
/*!******************************************************************************!*\
|
|
444
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/log.js ***!
|
|
445
|
+
\******************************************************************************/
|
|
446
|
+
/*! exports provided: default, normalizeArguments */
|
|
447
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
448
|
+
|
|
449
|
+
"use strict";
|
|
450
|
+
__webpack_require__.r(__webpack_exports__);
|
|
451
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return Log; });
|
|
452
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "normalizeArguments", function() { return normalizeArguments; });
|
|
453
|
+
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js");
|
|
454
|
+
/* harmony import */ var _probe_gl_env__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @probe.gl/env */ "../../node_modules/@probe.gl/env/dist/esm/index.js");
|
|
455
|
+
/* harmony import */ var _utils_local_storage__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/local-storage */ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js");
|
|
456
|
+
/* harmony import */ var _utils_formatters__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/formatters */ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js");
|
|
457
|
+
/* harmony import */ var _utils_color__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils/color */ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js");
|
|
458
|
+
/* harmony import */ var _utils_autobind__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./utils/autobind */ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js");
|
|
459
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/assert */ "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js");
|
|
460
|
+
/* harmony import */ var _utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils/hi-res-timestamp */ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js");
|
|
461
|
+
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
|
|
469
|
+
const originalConsole = {
|
|
470
|
+
debug: _probe_gl_env__WEBPACK_IMPORTED_MODULE_1__["isBrowser"] ? console.debug || console.log : console.log,
|
|
471
|
+
log: console.log,
|
|
472
|
+
info: console.info,
|
|
473
|
+
warn: console.warn,
|
|
474
|
+
error: console.error
|
|
475
|
+
};
|
|
476
|
+
const DEFAULT_SETTINGS = {
|
|
477
|
+
enabled: true,
|
|
478
|
+
level: 0
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
function noop() {}
|
|
482
|
+
|
|
483
|
+
const cache = {};
|
|
484
|
+
const ONCE = {
|
|
485
|
+
once: true
|
|
486
|
+
};
|
|
487
|
+
class Log {
|
|
488
|
+
constructor() {
|
|
489
|
+
let {
|
|
490
|
+
id
|
|
491
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
492
|
+
id: ''
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "id", void 0);
|
|
496
|
+
|
|
497
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "VERSION", _probe_gl_env__WEBPACK_IMPORTED_MODULE_1__["VERSION"]);
|
|
498
|
+
|
|
499
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "_startTs", Object(_utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__["getHiResTimestamp"])());
|
|
500
|
+
|
|
501
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "_deltaTs", Object(_utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__["getHiResTimestamp"])());
|
|
502
|
+
|
|
503
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "_storage", void 0);
|
|
504
|
+
|
|
505
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "userData", {});
|
|
506
|
+
|
|
507
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "LOG_THROTTLE_TIMEOUT", 0);
|
|
508
|
+
|
|
509
|
+
this.id = id;
|
|
510
|
+
this._storage = new _utils_local_storage__WEBPACK_IMPORTED_MODULE_2__["default"]("__probe-".concat(this.id, "__"), DEFAULT_SETTINGS);
|
|
511
|
+
this.userData = {};
|
|
512
|
+
this.timeStamp("".concat(this.id, " started"));
|
|
513
|
+
Object(_utils_autobind__WEBPACK_IMPORTED_MODULE_5__["autobind"])(this);
|
|
514
|
+
Object.seal(this);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
set level(newLevel) {
|
|
518
|
+
this.setLevel(newLevel);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
get level() {
|
|
522
|
+
return this.getLevel();
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
isEnabled() {
|
|
526
|
+
return this._storage.config.enabled;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
getLevel() {
|
|
530
|
+
return this._storage.config.level;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
getTotal() {
|
|
534
|
+
return Number((Object(_utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__["getHiResTimestamp"])() - this._startTs).toPrecision(10));
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
getDelta() {
|
|
538
|
+
return Number((Object(_utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__["getHiResTimestamp"])() - this._deltaTs).toPrecision(10));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
set priority(newPriority) {
|
|
542
|
+
this.level = newPriority;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
get priority() {
|
|
546
|
+
return this.level;
|
|
547
|
+
}
|
|
548
|
+
|
|
549
|
+
getPriority() {
|
|
550
|
+
return this.level;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
enable() {
|
|
554
|
+
let enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
555
|
+
|
|
556
|
+
this._storage.updateConfiguration({
|
|
557
|
+
enabled
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
return this;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
setLevel(level) {
|
|
564
|
+
this._storage.updateConfiguration({
|
|
565
|
+
level
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
return this;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
get(setting) {
|
|
572
|
+
return this._storage.config[setting];
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
set(setting, value) {
|
|
576
|
+
this._storage.updateConfiguration({
|
|
577
|
+
[setting]: value
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
settings() {
|
|
582
|
+
if (console.table) {
|
|
583
|
+
console.table(this._storage.config);
|
|
584
|
+
} else {
|
|
585
|
+
console.log(this._storage.config);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
assert(condition, message) {
|
|
590
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_6__["default"])(condition, message);
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
warn(message) {
|
|
594
|
+
return this._getLogFunction(0, message, originalConsole.warn, arguments, ONCE);
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
error(message) {
|
|
598
|
+
return this._getLogFunction(0, message, originalConsole.error, arguments);
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
deprecated(oldUsage, newUsage) {
|
|
602
|
+
return this.warn("`".concat(oldUsage, "` is deprecated and will be removed in a later version. Use `").concat(newUsage, "` instead"));
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
removed(oldUsage, newUsage) {
|
|
606
|
+
return this.error("`".concat(oldUsage, "` has been removed. Use `").concat(newUsage, "` instead"));
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
probe(logLevel, message) {
|
|
610
|
+
return this._getLogFunction(logLevel, message, originalConsole.log, arguments, {
|
|
611
|
+
time: true,
|
|
612
|
+
once: true
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
log(logLevel, message) {
|
|
617
|
+
return this._getLogFunction(logLevel, message, originalConsole.debug, arguments);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
info(logLevel, message) {
|
|
621
|
+
return this._getLogFunction(logLevel, message, console.info, arguments);
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
once(logLevel, message) {
|
|
625
|
+
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
626
|
+
args[_key - 2] = arguments[_key];
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
return this._getLogFunction(logLevel, message, originalConsole.debug || originalConsole.info, arguments, ONCE);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
table(logLevel, table, columns) {
|
|
633
|
+
if (table) {
|
|
634
|
+
return this._getLogFunction(logLevel, table, console.table || noop, columns && [columns], {
|
|
635
|
+
tag: getTableHeader(table)
|
|
636
|
+
});
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return noop;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
image(_ref) {
|
|
643
|
+
let {
|
|
644
|
+
logLevel,
|
|
645
|
+
priority,
|
|
646
|
+
image,
|
|
647
|
+
message = '',
|
|
648
|
+
scale = 1
|
|
649
|
+
} = _ref;
|
|
650
|
+
|
|
651
|
+
if (!this._shouldLog(logLevel || priority)) {
|
|
652
|
+
return noop;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
return _probe_gl_env__WEBPACK_IMPORTED_MODULE_1__["isBrowser"] ? logImageInBrowser({
|
|
656
|
+
image,
|
|
657
|
+
message,
|
|
658
|
+
scale
|
|
659
|
+
}) : logImageInNode({
|
|
660
|
+
image,
|
|
661
|
+
message,
|
|
662
|
+
scale
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
time(logLevel, message) {
|
|
667
|
+
return this._getLogFunction(logLevel, message, console.time ? console.time : console.info);
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
timeEnd(logLevel, message) {
|
|
671
|
+
return this._getLogFunction(logLevel, message, console.timeEnd ? console.timeEnd : console.info);
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
timeStamp(logLevel, message) {
|
|
675
|
+
return this._getLogFunction(logLevel, message, console.timeStamp || noop);
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
group(logLevel, message) {
|
|
679
|
+
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
680
|
+
collapsed: false
|
|
681
|
+
};
|
|
682
|
+
const options = normalizeArguments({
|
|
683
|
+
logLevel,
|
|
684
|
+
message,
|
|
685
|
+
opts
|
|
686
|
+
});
|
|
687
|
+
const {
|
|
688
|
+
collapsed
|
|
689
|
+
} = opts;
|
|
690
|
+
options.method = (collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
691
|
+
return this._getLogFunction(options);
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
groupCollapsed(logLevel, message) {
|
|
695
|
+
let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
696
|
+
return this.group(logLevel, message, Object.assign({}, opts, {
|
|
697
|
+
collapsed: true
|
|
698
|
+
}));
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
groupEnd(logLevel) {
|
|
702
|
+
return this._getLogFunction(logLevel, '', console.groupEnd || noop);
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
withGroup(logLevel, message, func) {
|
|
706
|
+
this.group(logLevel, message)();
|
|
707
|
+
|
|
708
|
+
try {
|
|
709
|
+
func();
|
|
710
|
+
} finally {
|
|
711
|
+
this.groupEnd(logLevel)();
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
trace() {
|
|
716
|
+
if (console.trace) {
|
|
717
|
+
console.trace();
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
_shouldLog(logLevel) {
|
|
722
|
+
return this.isEnabled() && this.getLevel() >= normalizeLogLevel(logLevel);
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
_getLogFunction(logLevel, message, method, args, opts) {
|
|
726
|
+
if (this._shouldLog(logLevel)) {
|
|
727
|
+
opts = normalizeArguments({
|
|
728
|
+
logLevel,
|
|
729
|
+
message,
|
|
730
|
+
args,
|
|
731
|
+
opts
|
|
732
|
+
});
|
|
733
|
+
method = method || opts.method;
|
|
734
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_6__["default"])(method);
|
|
735
|
+
opts.total = this.getTotal();
|
|
736
|
+
opts.delta = this.getDelta();
|
|
737
|
+
this._deltaTs = Object(_utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__["getHiResTimestamp"])();
|
|
738
|
+
const tag = opts.tag || opts.message;
|
|
739
|
+
|
|
740
|
+
if (opts.once) {
|
|
741
|
+
if (!cache[tag]) {
|
|
742
|
+
cache[tag] = Object(_utils_hi_res_timestamp__WEBPACK_IMPORTED_MODULE_7__["getHiResTimestamp"])();
|
|
743
|
+
} else {
|
|
744
|
+
return noop;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
message = decorateMessage(this.id, opts.message, opts);
|
|
749
|
+
return method.bind(console, message, ...opts.args);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return noop;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(Log, "VERSION", _probe_gl_env__WEBPACK_IMPORTED_MODULE_1__["VERSION"]);
|
|
758
|
+
|
|
759
|
+
function normalizeLogLevel(logLevel) {
|
|
760
|
+
if (!logLevel) {
|
|
761
|
+
return 0;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
let resolvedLevel;
|
|
765
|
+
|
|
766
|
+
switch (typeof logLevel) {
|
|
767
|
+
case 'number':
|
|
768
|
+
resolvedLevel = logLevel;
|
|
769
|
+
break;
|
|
770
|
+
|
|
771
|
+
case 'object':
|
|
772
|
+
resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
|
|
773
|
+
break;
|
|
774
|
+
|
|
775
|
+
default:
|
|
776
|
+
return 0;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_6__["default"])(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
|
|
780
|
+
return resolvedLevel;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
function normalizeArguments(opts) {
|
|
784
|
+
const {
|
|
785
|
+
logLevel,
|
|
786
|
+
message
|
|
787
|
+
} = opts;
|
|
788
|
+
opts.logLevel = normalizeLogLevel(logLevel);
|
|
789
|
+
const args = opts.args ? Array.from(opts.args) : [];
|
|
790
|
+
|
|
791
|
+
while (args.length && args.shift() !== message) {}
|
|
792
|
+
|
|
793
|
+
switch (typeof logLevel) {
|
|
794
|
+
case 'string':
|
|
795
|
+
case 'function':
|
|
796
|
+
if (message !== undefined) {
|
|
797
|
+
args.unshift(message);
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
opts.message = logLevel;
|
|
801
|
+
break;
|
|
802
|
+
|
|
803
|
+
case 'object':
|
|
804
|
+
Object.assign(opts, logLevel);
|
|
805
|
+
break;
|
|
806
|
+
|
|
807
|
+
default:
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
if (typeof opts.message === 'function') {
|
|
811
|
+
opts.message = opts.message();
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
const messageType = typeof opts.message;
|
|
815
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_6__["default"])(messageType === 'string' || messageType === 'object');
|
|
816
|
+
return Object.assign(opts, {
|
|
817
|
+
args
|
|
818
|
+
}, opts.opts);
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
function decorateMessage(id, message, opts) {
|
|
822
|
+
if (typeof message === 'string') {
|
|
823
|
+
const time = opts.time ? Object(_utils_formatters__WEBPACK_IMPORTED_MODULE_3__["leftPad"])(Object(_utils_formatters__WEBPACK_IMPORTED_MODULE_3__["formatTime"])(opts.total)) : '';
|
|
824
|
+
message = opts.time ? "".concat(id, ": ").concat(time, " ").concat(message) : "".concat(id, ": ").concat(message);
|
|
825
|
+
message = Object(_utils_color__WEBPACK_IMPORTED_MODULE_4__["addColor"])(message, opts.color, opts.background);
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return message;
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function logImageInNode(_ref2) {
|
|
832
|
+
let {
|
|
833
|
+
image,
|
|
834
|
+
message = '',
|
|
835
|
+
scale = 1
|
|
836
|
+
} = _ref2;
|
|
837
|
+
let asciify = null;
|
|
838
|
+
|
|
839
|
+
try {
|
|
840
|
+
asciify = __webpack_require__(/*! asciify-image */ 0);
|
|
841
|
+
} catch (error) {}
|
|
842
|
+
|
|
843
|
+
if (asciify) {
|
|
844
|
+
return () => asciify(image, {
|
|
845
|
+
fit: 'box',
|
|
846
|
+
width: "".concat(Math.round(80 * scale), "%")
|
|
847
|
+
}).then(data => console.log(data));
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
return noop;
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
function logImageInBrowser(_ref3) {
|
|
854
|
+
let {
|
|
855
|
+
image,
|
|
856
|
+
message = '',
|
|
857
|
+
scale = 1
|
|
858
|
+
} = _ref3;
|
|
859
|
+
|
|
860
|
+
if (typeof image === 'string') {
|
|
861
|
+
const img = new Image();
|
|
862
|
+
|
|
863
|
+
img.onload = () => {
|
|
864
|
+
const args = Object(_utils_formatters__WEBPACK_IMPORTED_MODULE_3__["formatImage"])(img, message, scale);
|
|
865
|
+
console.log(...args);
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
img.src = image;
|
|
869
|
+
return noop;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
const element = image.nodeName || '';
|
|
873
|
+
|
|
874
|
+
if (element.toLowerCase() === 'img') {
|
|
875
|
+
console.log(...Object(_utils_formatters__WEBPACK_IMPORTED_MODULE_3__["formatImage"])(image, message, scale));
|
|
876
|
+
return noop;
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
if (element.toLowerCase() === 'canvas') {
|
|
880
|
+
const img = new Image();
|
|
881
|
+
|
|
882
|
+
img.onload = () => console.log(...Object(_utils_formatters__WEBPACK_IMPORTED_MODULE_3__["formatImage"])(img, message, scale));
|
|
883
|
+
|
|
884
|
+
img.src = image.toDataURL();
|
|
885
|
+
return noop;
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
return noop;
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
function getTableHeader(table) {
|
|
892
|
+
for (const key in table) {
|
|
893
|
+
for (const title in table[key]) {
|
|
894
|
+
return title || 'untitled';
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
898
|
+
return 'empty';
|
|
899
|
+
}
|
|
900
|
+
//# sourceMappingURL=log.js.map
|
|
901
|
+
|
|
902
|
+
/***/ }),
|
|
903
|
+
|
|
904
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/utils/assert.js":
|
|
905
|
+
/*!***************************************************************************************!*\
|
|
906
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/utils/assert.js ***!
|
|
907
|
+
\***************************************************************************************/
|
|
908
|
+
/*! exports provided: default */
|
|
909
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
910
|
+
|
|
911
|
+
"use strict";
|
|
912
|
+
__webpack_require__.r(__webpack_exports__);
|
|
913
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return assert; });
|
|
914
|
+
function assert(condition, message) {
|
|
915
|
+
if (!condition) {
|
|
916
|
+
throw new Error(message || 'Assertion failed');
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
//# sourceMappingURL=assert.js.map
|
|
920
|
+
|
|
921
|
+
/***/ }),
|
|
922
|
+
|
|
923
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/utils/autobind.js":
|
|
924
|
+
/*!*****************************************************************************************!*\
|
|
925
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/utils/autobind.js ***!
|
|
926
|
+
\*****************************************************************************************/
|
|
927
|
+
/*! exports provided: autobind */
|
|
928
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
929
|
+
|
|
930
|
+
"use strict";
|
|
931
|
+
__webpack_require__.r(__webpack_exports__);
|
|
932
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "autobind", function() { return autobind; });
|
|
933
|
+
function autobind(obj) {
|
|
934
|
+
let predefined = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ['constructor'];
|
|
935
|
+
const proto = Object.getPrototypeOf(obj);
|
|
936
|
+
const propNames = Object.getOwnPropertyNames(proto);
|
|
937
|
+
|
|
938
|
+
for (const key of propNames) {
|
|
939
|
+
if (typeof obj[key] === 'function') {
|
|
940
|
+
if (!predefined.find(name => key === name)) {
|
|
941
|
+
obj[key] = obj[key].bind(obj);
|
|
942
|
+
}
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}
|
|
946
|
+
//# sourceMappingURL=autobind.js.map
|
|
947
|
+
|
|
948
|
+
/***/ }),
|
|
949
|
+
|
|
950
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/utils/color.js":
|
|
951
|
+
/*!**************************************************************************************!*\
|
|
952
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/utils/color.js ***!
|
|
953
|
+
\**************************************************************************************/
|
|
954
|
+
/*! exports provided: COLOR, addColor */
|
|
955
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
956
|
+
|
|
957
|
+
"use strict";
|
|
958
|
+
__webpack_require__.r(__webpack_exports__);
|
|
959
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COLOR", function() { return COLOR; });
|
|
960
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addColor", function() { return addColor; });
|
|
961
|
+
/* harmony import */ var _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @probe.gl/env */ "../../node_modules/@probe.gl/env/dist/esm/index.js");
|
|
962
|
+
|
|
963
|
+
let COLOR;
|
|
964
|
+
|
|
965
|
+
(function (COLOR) {
|
|
966
|
+
COLOR[COLOR["BLACK"] = 30] = "BLACK";
|
|
967
|
+
COLOR[COLOR["RED"] = 31] = "RED";
|
|
968
|
+
COLOR[COLOR["GREEN"] = 32] = "GREEN";
|
|
969
|
+
COLOR[COLOR["YELLOW"] = 33] = "YELLOW";
|
|
970
|
+
COLOR[COLOR["BLUE"] = 34] = "BLUE";
|
|
971
|
+
COLOR[COLOR["MAGENTA"] = 35] = "MAGENTA";
|
|
972
|
+
COLOR[COLOR["CYAN"] = 36] = "CYAN";
|
|
973
|
+
COLOR[COLOR["WHITE"] = 37] = "WHITE";
|
|
974
|
+
COLOR[COLOR["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
|
|
975
|
+
COLOR[COLOR["BRIGHT_RED"] = 91] = "BRIGHT_RED";
|
|
976
|
+
COLOR[COLOR["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
|
|
977
|
+
COLOR[COLOR["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
|
|
978
|
+
COLOR[COLOR["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
|
|
979
|
+
COLOR[COLOR["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
|
|
980
|
+
COLOR[COLOR["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
|
|
981
|
+
COLOR[COLOR["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
|
|
982
|
+
})(COLOR || (COLOR = {}));
|
|
983
|
+
|
|
984
|
+
function getColor(color) {
|
|
985
|
+
return typeof color === 'string' ? COLOR[color.toUpperCase()] || COLOR.WHITE : color;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
function addColor(string, color, background) {
|
|
989
|
+
if (!_probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["isBrowser"] && typeof string === 'string') {
|
|
990
|
+
if (color) {
|
|
991
|
+
color = getColor(color);
|
|
992
|
+
string = "\x1B[".concat(color, "m").concat(string, "\x1B[39m");
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
if (background) {
|
|
996
|
+
color = getColor(background);
|
|
997
|
+
string = "\x1B[".concat(background + 10, "m").concat(string, "\x1B[49m");
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
return string;
|
|
1002
|
+
}
|
|
1003
|
+
//# sourceMappingURL=color.js.map
|
|
1004
|
+
|
|
1005
|
+
/***/ }),
|
|
1006
|
+
|
|
1007
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/utils/formatters.js":
|
|
1008
|
+
/*!*******************************************************************************************!*\
|
|
1009
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/utils/formatters.js ***!
|
|
1010
|
+
\*******************************************************************************************/
|
|
1011
|
+
/*! exports provided: formatTime, leftPad, rightPad, formatValue, formatImage */
|
|
1012
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1013
|
+
|
|
1014
|
+
"use strict";
|
|
1015
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1016
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatTime", function() { return formatTime; });
|
|
1017
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "leftPad", function() { return leftPad; });
|
|
1018
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rightPad", function() { return rightPad; });
|
|
1019
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatValue", function() { return formatValue; });
|
|
1020
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatImage", function() { return formatImage; });
|
|
1021
|
+
function formatTime(ms) {
|
|
1022
|
+
let formatted;
|
|
1023
|
+
|
|
1024
|
+
if (ms < 10) {
|
|
1025
|
+
formatted = "".concat(ms.toFixed(2), "ms");
|
|
1026
|
+
} else if (ms < 100) {
|
|
1027
|
+
formatted = "".concat(ms.toFixed(1), "ms");
|
|
1028
|
+
} else if (ms < 1000) {
|
|
1029
|
+
formatted = "".concat(ms.toFixed(0), "ms");
|
|
1030
|
+
} else {
|
|
1031
|
+
formatted = "".concat((ms / 1000).toFixed(2), "s");
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
return formatted;
|
|
1035
|
+
}
|
|
1036
|
+
function leftPad(string) {
|
|
1037
|
+
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
|
|
1038
|
+
const padLength = Math.max(length - string.length, 0);
|
|
1039
|
+
return "".concat(' '.repeat(padLength)).concat(string);
|
|
1040
|
+
}
|
|
1041
|
+
function rightPad(string) {
|
|
1042
|
+
let length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8;
|
|
1043
|
+
const padLength = Math.max(length - string.length, 0);
|
|
1044
|
+
return "".concat(string).concat(' '.repeat(padLength));
|
|
1045
|
+
}
|
|
1046
|
+
function formatValue(v) {
|
|
1047
|
+
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1048
|
+
const EPSILON = 1e-16;
|
|
1049
|
+
const {
|
|
1050
|
+
isInteger = false
|
|
1051
|
+
} = opts;
|
|
1052
|
+
|
|
1053
|
+
if (Array.isArray(v) || ArrayBuffer.isView(v)) {
|
|
1054
|
+
return formatArrayValue(v, opts);
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
if (!Number.isFinite(v)) {
|
|
1058
|
+
return String(v);
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
if (Math.abs(v) < EPSILON) {
|
|
1062
|
+
return isInteger ? '0' : '0.';
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
if (isInteger) {
|
|
1066
|
+
return v.toFixed(0);
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
if (Math.abs(v) > 100 && Math.abs(v) < 10000) {
|
|
1070
|
+
return v.toFixed(0);
|
|
1071
|
+
}
|
|
1072
|
+
|
|
1073
|
+
const string = v.toPrecision(2);
|
|
1074
|
+
const decimal = string.indexOf('.0');
|
|
1075
|
+
return decimal === string.length - 2 ? string.slice(0, -1) : string;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
function formatArrayValue(v, opts) {
|
|
1079
|
+
const {
|
|
1080
|
+
maxElts = 16,
|
|
1081
|
+
size = 1
|
|
1082
|
+
} = opts;
|
|
1083
|
+
let string = '[';
|
|
1084
|
+
|
|
1085
|
+
for (let i = 0; i < v.length && i < maxElts; ++i) {
|
|
1086
|
+
if (i > 0) {
|
|
1087
|
+
string += ",".concat(i % size === 0 ? ' ' : '');
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
string += formatValue(v[i], opts);
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
const terminator = v.length > maxElts ? '...' : ']';
|
|
1094
|
+
return "".concat(string).concat(terminator);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
function formatImage(image, message, scale) {
|
|
1098
|
+
let maxWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 600;
|
|
1099
|
+
const imageUrl = image.src.replace(/\(/g, '%28').replace(/\)/g, '%29');
|
|
1100
|
+
|
|
1101
|
+
if (image.width > maxWidth) {
|
|
1102
|
+
scale = Math.min(scale, maxWidth / image.width);
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
const width = image.width * scale;
|
|
1106
|
+
const height = image.height * scale;
|
|
1107
|
+
const style = ['font-size:1px;', "padding:".concat(Math.floor(height / 2), "px ").concat(Math.floor(width / 2), "px;"), "line-height:".concat(height, "px;"), "background:url(".concat(imageUrl, ");"), "background-size:".concat(width, "px ").concat(height, "px;"), 'color:transparent;'].join('');
|
|
1108
|
+
return ["".concat(message, " %c+"), style];
|
|
1109
|
+
}
|
|
1110
|
+
//# sourceMappingURL=formatters.js.map
|
|
1111
|
+
|
|
1112
|
+
/***/ }),
|
|
1113
|
+
|
|
1114
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js":
|
|
1115
|
+
/*!*************************************************************************************************!*\
|
|
1116
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/utils/hi-res-timestamp.js ***!
|
|
1117
|
+
\*************************************************************************************************/
|
|
1118
|
+
/*! exports provided: getHiResTimestamp */
|
|
1119
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1120
|
+
|
|
1121
|
+
"use strict";
|
|
1122
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1123
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHiResTimestamp", function() { return getHiResTimestamp; });
|
|
1124
|
+
/* harmony import */ var _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @probe.gl/env */ "../../node_modules/@probe.gl/env/dist/esm/index.js");
|
|
1125
|
+
|
|
1126
|
+
function getHiResTimestamp() {
|
|
1127
|
+
let timestamp;
|
|
1128
|
+
|
|
1129
|
+
if (_probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["isBrowser"] && 'performance' in _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["window"]) {
|
|
1130
|
+
var _window$performance, _window$performance$n;
|
|
1131
|
+
|
|
1132
|
+
timestamp = _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["window"] === null || _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["window"] === void 0 ? void 0 : (_window$performance = _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["window"].performance) === null || _window$performance === void 0 ? void 0 : (_window$performance$n = _window$performance.now) === null || _window$performance$n === void 0 ? void 0 : _window$performance$n.call(_window$performance);
|
|
1133
|
+
} else if ('hrtime' in _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["process"]) {
|
|
1134
|
+
var _process$hrtime;
|
|
1135
|
+
|
|
1136
|
+
const timeParts = _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["process"] === null || _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["process"] === void 0 ? void 0 : (_process$hrtime = _probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["process"].hrtime) === null || _process$hrtime === void 0 ? void 0 : _process$hrtime.call(_probe_gl_env__WEBPACK_IMPORTED_MODULE_0__["process"]);
|
|
1137
|
+
timestamp = timeParts[0] * 1000 + timeParts[1] / 1e6;
|
|
1138
|
+
} else {
|
|
1139
|
+
timestamp = Date.now();
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
return timestamp;
|
|
1143
|
+
}
|
|
1144
|
+
//# sourceMappingURL=hi-res-timestamp.js.map
|
|
1145
|
+
|
|
1146
|
+
/***/ }),
|
|
1147
|
+
|
|
1148
|
+
/***/ "../../node_modules/@probe.gl/log/dist/esm/utils/local-storage.js":
|
|
1149
|
+
/*!**********************************************************************************************!*\
|
|
1150
|
+
!*** /Users/missx/Source/luma.gl/node_modules/@probe.gl/log/dist/esm/utils/local-storage.js ***!
|
|
1151
|
+
\**********************************************************************************************/
|
|
1152
|
+
/*! exports provided: default */
|
|
1153
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1154
|
+
|
|
1155
|
+
"use strict";
|
|
1156
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1157
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return LocalStorage; });
|
|
1158
|
+
/* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../node_modules/@babel/runtime/helpers/esm/defineProperty.js");
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
function getStorage(type) {
|
|
1162
|
+
try {
|
|
1163
|
+
const storage = window[type];
|
|
1164
|
+
const x = '__storage_test__';
|
|
1165
|
+
storage.setItem(x, x);
|
|
1166
|
+
storage.removeItem(x);
|
|
1167
|
+
return storage;
|
|
1168
|
+
} catch (e) {
|
|
1169
|
+
return null;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
class LocalStorage {
|
|
1174
|
+
constructor(id) {
|
|
1175
|
+
let defaultSettings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1176
|
+
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'sessionStorage';
|
|
1177
|
+
|
|
1178
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "storage", void 0);
|
|
1179
|
+
|
|
1180
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "id", void 0);
|
|
1181
|
+
|
|
1182
|
+
Object(_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(this, "config", {});
|
|
1183
|
+
|
|
1184
|
+
this.storage = getStorage(type);
|
|
1185
|
+
this.id = id;
|
|
1186
|
+
this.config = {};
|
|
1187
|
+
Object.assign(this.config, defaultSettings);
|
|
1188
|
+
|
|
1189
|
+
this._loadConfiguration();
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
getConfiguration() {
|
|
1193
|
+
return this.config;
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
setConfiguration(configuration) {
|
|
1197
|
+
this.config = {};
|
|
1198
|
+
return this.updateConfiguration(configuration);
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1201
|
+
updateConfiguration(configuration) {
|
|
1202
|
+
Object.assign(this.config, configuration);
|
|
1203
|
+
|
|
1204
|
+
if (this.storage) {
|
|
1205
|
+
const serialized = JSON.stringify(this.config);
|
|
1206
|
+
this.storage.setItem(this.id, serialized);
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
return this;
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
_loadConfiguration() {
|
|
1213
|
+
let configuration = {};
|
|
1214
|
+
|
|
1215
|
+
if (this.storage) {
|
|
1216
|
+
const serializedConfiguration = this.storage.getItem(this.id);
|
|
1217
|
+
configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
Object.assign(this.config, configuration);
|
|
1221
|
+
return this;
|
|
1222
|
+
}
|
|
1223
|
+
|
|
1224
|
+
}
|
|
1225
|
+
//# sourceMappingURL=local-storage.js.map
|
|
1226
|
+
|
|
1227
|
+
/***/ }),
|
|
1228
|
+
|
|
1229
|
+
/***/ "../../node_modules/process/browser.js":
|
|
1230
|
+
/*!*******************************************************************!*\
|
|
1231
|
+
!*** /Users/missx/Source/luma.gl/node_modules/process/browser.js ***!
|
|
1232
|
+
\*******************************************************************/
|
|
1233
|
+
/*! no static exports found */
|
|
1234
|
+
/***/ (function(module, exports) {
|
|
1235
|
+
|
|
1236
|
+
// shim for using process in browser
|
|
1237
|
+
var process = module.exports = {};
|
|
1238
|
+
|
|
1239
|
+
// cached from whatever global is present so that test runners that stub it
|
|
1240
|
+
// don't break things. But we need to wrap it in a try catch in case it is
|
|
1241
|
+
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
|
1242
|
+
// function because try/catches deoptimize in certain engines.
|
|
1243
|
+
|
|
1244
|
+
var cachedSetTimeout;
|
|
1245
|
+
var cachedClearTimeout;
|
|
1246
|
+
|
|
1247
|
+
function defaultSetTimout() {
|
|
1248
|
+
throw new Error('setTimeout has not been defined');
|
|
1249
|
+
}
|
|
1250
|
+
function defaultClearTimeout () {
|
|
1251
|
+
throw new Error('clearTimeout has not been defined');
|
|
1252
|
+
}
|
|
1253
|
+
(function () {
|
|
1254
|
+
try {
|
|
1255
|
+
if (typeof setTimeout === 'function') {
|
|
1256
|
+
cachedSetTimeout = setTimeout;
|
|
1257
|
+
} else {
|
|
1258
|
+
cachedSetTimeout = defaultSetTimout;
|
|
1259
|
+
}
|
|
1260
|
+
} catch (e) {
|
|
1261
|
+
cachedSetTimeout = defaultSetTimout;
|
|
1262
|
+
}
|
|
1263
|
+
try {
|
|
1264
|
+
if (typeof clearTimeout === 'function') {
|
|
1265
|
+
cachedClearTimeout = clearTimeout;
|
|
1266
|
+
} else {
|
|
1267
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
1268
|
+
}
|
|
1269
|
+
} catch (e) {
|
|
1270
|
+
cachedClearTimeout = defaultClearTimeout;
|
|
1271
|
+
}
|
|
1272
|
+
} ())
|
|
1273
|
+
function runTimeout(fun) {
|
|
1274
|
+
if (cachedSetTimeout === setTimeout) {
|
|
1275
|
+
//normal enviroments in sane situations
|
|
1276
|
+
return setTimeout(fun, 0);
|
|
1277
|
+
}
|
|
1278
|
+
// if setTimeout wasn't available but was latter defined
|
|
1279
|
+
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
|
1280
|
+
cachedSetTimeout = setTimeout;
|
|
1281
|
+
return setTimeout(fun, 0);
|
|
1282
|
+
}
|
|
1283
|
+
try {
|
|
1284
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1285
|
+
return cachedSetTimeout(fun, 0);
|
|
1286
|
+
} catch(e){
|
|
1287
|
+
try {
|
|
1288
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1289
|
+
return cachedSetTimeout.call(null, fun, 0);
|
|
1290
|
+
} catch(e){
|
|
1291
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
|
1292
|
+
return cachedSetTimeout.call(this, fun, 0);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
}
|
|
1298
|
+
function runClearTimeout(marker) {
|
|
1299
|
+
if (cachedClearTimeout === clearTimeout) {
|
|
1300
|
+
//normal enviroments in sane situations
|
|
1301
|
+
return clearTimeout(marker);
|
|
1302
|
+
}
|
|
1303
|
+
// if clearTimeout wasn't available but was latter defined
|
|
1304
|
+
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
|
1305
|
+
cachedClearTimeout = clearTimeout;
|
|
1306
|
+
return clearTimeout(marker);
|
|
1307
|
+
}
|
|
1308
|
+
try {
|
|
1309
|
+
// when when somebody has screwed with setTimeout but no I.E. maddness
|
|
1310
|
+
return cachedClearTimeout(marker);
|
|
1311
|
+
} catch (e){
|
|
1312
|
+
try {
|
|
1313
|
+
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
|
1314
|
+
return cachedClearTimeout.call(null, marker);
|
|
1315
|
+
} catch (e){
|
|
1316
|
+
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
|
1317
|
+
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
|
1318
|
+
return cachedClearTimeout.call(this, marker);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
}
|
|
1325
|
+
var queue = [];
|
|
1326
|
+
var draining = false;
|
|
1327
|
+
var currentQueue;
|
|
1328
|
+
var queueIndex = -1;
|
|
1329
|
+
|
|
1330
|
+
function cleanUpNextTick() {
|
|
1331
|
+
if (!draining || !currentQueue) {
|
|
1332
|
+
return;
|
|
1333
|
+
}
|
|
1334
|
+
draining = false;
|
|
1335
|
+
if (currentQueue.length) {
|
|
1336
|
+
queue = currentQueue.concat(queue);
|
|
1337
|
+
} else {
|
|
1338
|
+
queueIndex = -1;
|
|
1339
|
+
}
|
|
1340
|
+
if (queue.length) {
|
|
1341
|
+
drainQueue();
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
function drainQueue() {
|
|
1346
|
+
if (draining) {
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
var timeout = runTimeout(cleanUpNextTick);
|
|
1350
|
+
draining = true;
|
|
1351
|
+
|
|
1352
|
+
var len = queue.length;
|
|
1353
|
+
while(len) {
|
|
1354
|
+
currentQueue = queue;
|
|
1355
|
+
queue = [];
|
|
1356
|
+
while (++queueIndex < len) {
|
|
1357
|
+
if (currentQueue) {
|
|
1358
|
+
currentQueue[queueIndex].run();
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
queueIndex = -1;
|
|
1362
|
+
len = queue.length;
|
|
1363
|
+
}
|
|
1364
|
+
currentQueue = null;
|
|
1365
|
+
draining = false;
|
|
1366
|
+
runClearTimeout(timeout);
|
|
1367
|
+
}
|
|
1368
|
+
|
|
1369
|
+
process.nextTick = function (fun) {
|
|
1370
|
+
var args = new Array(arguments.length - 1);
|
|
1371
|
+
if (arguments.length > 1) {
|
|
1372
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
1373
|
+
args[i - 1] = arguments[i];
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
queue.push(new Item(fun, args));
|
|
1377
|
+
if (queue.length === 1 && !draining) {
|
|
1378
|
+
runTimeout(drainQueue);
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
|
|
1382
|
+
// v8 likes predictible objects
|
|
1383
|
+
function Item(fun, array) {
|
|
1384
|
+
this.fun = fun;
|
|
1385
|
+
this.array = array;
|
|
1386
|
+
}
|
|
1387
|
+
Item.prototype.run = function () {
|
|
1388
|
+
this.fun.apply(null, this.array);
|
|
1389
|
+
};
|
|
1390
|
+
process.title = 'browser';
|
|
1391
|
+
process.browser = true;
|
|
1392
|
+
process.env = {};
|
|
1393
|
+
process.argv = [];
|
|
1394
|
+
process.version = ''; // empty string to avoid regexp issues
|
|
1395
|
+
process.versions = {};
|
|
1396
|
+
|
|
1397
|
+
function noop() {}
|
|
1398
|
+
|
|
1399
|
+
process.on = noop;
|
|
1400
|
+
process.addListener = noop;
|
|
1401
|
+
process.once = noop;
|
|
1402
|
+
process.off = noop;
|
|
1403
|
+
process.removeListener = noop;
|
|
1404
|
+
process.removeAllListeners = noop;
|
|
1405
|
+
process.emit = noop;
|
|
1406
|
+
process.prependListener = noop;
|
|
1407
|
+
process.prependOnceListener = noop;
|
|
1408
|
+
|
|
1409
|
+
process.listeners = function (name) { return [] }
|
|
1410
|
+
|
|
1411
|
+
process.binding = function (name) {
|
|
1412
|
+
throw new Error('process.binding is not supported');
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
process.cwd = function () { return '/' };
|
|
1416
|
+
process.chdir = function (dir) {
|
|
1417
|
+
throw new Error('process.chdir is not supported');
|
|
1418
|
+
};
|
|
1419
|
+
process.umask = function() { return 0; };
|
|
1420
|
+
|
|
1421
|
+
|
|
1422
|
+
/***/ }),
|
|
1423
|
+
|
|
1424
|
+
/***/ "../../node_modules/webpack/buildin/global.js":
|
|
1425
|
+
/*!***********************************!*\
|
|
1426
|
+
!*** (webpack)/buildin/global.js ***!
|
|
1427
|
+
\***********************************/
|
|
1428
|
+
/*! no static exports found */
|
|
1429
|
+
/***/ (function(module, exports) {
|
|
1430
|
+
|
|
1431
|
+
var g;
|
|
1432
|
+
|
|
1433
|
+
// This works in non-strict mode
|
|
1434
|
+
g = (function() {
|
|
1435
|
+
return this;
|
|
1436
|
+
})();
|
|
1437
|
+
|
|
1438
|
+
try {
|
|
1439
|
+
// This works if eval is allowed (see CSP)
|
|
1440
|
+
g = g || new Function("return this")();
|
|
1441
|
+
} catch (e) {
|
|
1442
|
+
// This works if the window reference is available
|
|
1443
|
+
if (typeof window === "object") g = window;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
// g can still be undefined, but nothing to do about it...
|
|
1447
|
+
// We return undefined, instead of nothing here, so it's
|
|
1448
|
+
// easier to handle this case. if(!global) { ...}
|
|
1449
|
+
|
|
1450
|
+
module.exports = g;
|
|
1451
|
+
|
|
1452
|
+
|
|
1453
|
+
/***/ }),
|
|
1454
|
+
|
|
1455
|
+
/***/ "../constants/src/index.js":
|
|
1456
|
+
/*!*********************************!*\
|
|
1457
|
+
!*** ../constants/src/index.js ***!
|
|
1458
|
+
\*********************************/
|
|
1459
|
+
/*! exports provided: default */
|
|
1460
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1461
|
+
|
|
1462
|
+
"use strict";
|
|
1463
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1464
|
+
// GL constants, copied from Mozilla documentation
|
|
1465
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants
|
|
1466
|
+
|
|
1467
|
+
// Standard WebGL 1 constants
|
|
1468
|
+
// These constants are defined on the WebGLRenderingContext interface.
|
|
1469
|
+
|
|
1470
|
+
/* eslint-disable key-spacing, max-len, no-inline-comments, camelcase */
|
|
1471
|
+
// eslint-disable-next-line
|
|
1472
|
+
/* harmony default export */ __webpack_exports__["default"] = ({
|
|
1473
|
+
// Clearing buffers
|
|
1474
|
+
// Constants passed to clear() to clear buffer masks.
|
|
1475
|
+
|
|
1476
|
+
DEPTH_BUFFER_BIT: 0x00000100,
|
|
1477
|
+
STENCIL_BUFFER_BIT: 0x00000400,
|
|
1478
|
+
COLOR_BUFFER_BIT: 0x00004000,
|
|
1479
|
+
|
|
1480
|
+
// Rendering primitives
|
|
1481
|
+
// Constants passed to drawElements() or drawArrays() to specify what kind of primitive to render.
|
|
1482
|
+
|
|
1483
|
+
POINTS: 0x0000,
|
|
1484
|
+
LINES: 0x0001,
|
|
1485
|
+
LINE_LOOP: 0x0002,
|
|
1486
|
+
LINE_STRIP: 0x0003,
|
|
1487
|
+
TRIANGLES: 0x0004,
|
|
1488
|
+
TRIANGLE_STRIP: 0x0005,
|
|
1489
|
+
TRIANGLE_FAN: 0x0006,
|
|
1490
|
+
|
|
1491
|
+
// Blending modes
|
|
1492
|
+
// Constants passed to blendFunc() or blendFuncSeparate() to specify the blending mode (for both, RBG and alpha, or separately).
|
|
1493
|
+
|
|
1494
|
+
ZERO: 0,
|
|
1495
|
+
ONE: 1,
|
|
1496
|
+
SRC_COLOR: 0x0300,
|
|
1497
|
+
ONE_MINUS_SRC_COLOR: 0x0301,
|
|
1498
|
+
SRC_ALPHA: 0x0302,
|
|
1499
|
+
ONE_MINUS_SRC_ALPHA: 0x0303,
|
|
1500
|
+
DST_ALPHA: 0x0304,
|
|
1501
|
+
ONE_MINUS_DST_ALPHA: 0x0305,
|
|
1502
|
+
DST_COLOR: 0x0306,
|
|
1503
|
+
ONE_MINUS_DST_COLOR: 0x0307,
|
|
1504
|
+
SRC_ALPHA_SATURATE: 0x0308,
|
|
1505
|
+
CONSTANT_COLOR: 0x8001,
|
|
1506
|
+
ONE_MINUS_CONSTANT_COLOR: 0x8002,
|
|
1507
|
+
CONSTANT_ALPHA: 0x8003,
|
|
1508
|
+
ONE_MINUS_CONSTANT_ALPHA: 0x8004,
|
|
1509
|
+
|
|
1510
|
+
// Blending equations
|
|
1511
|
+
// Constants passed to blendEquation() or blendEquationSeparate() to control
|
|
1512
|
+
// how the blending is calculated (for both, RBG and alpha, or separately).
|
|
1513
|
+
|
|
1514
|
+
FUNC_ADD: 0x8006,
|
|
1515
|
+
FUNC_SUBTRACT: 0x800a,
|
|
1516
|
+
FUNC_REVERSE_SUBTRACT: 0x800b,
|
|
1517
|
+
|
|
1518
|
+
// Getting GL parameter information
|
|
1519
|
+
// Constants passed to getParameter() to specify what information to return.
|
|
1520
|
+
|
|
1521
|
+
BLEND_EQUATION: 0x8009,
|
|
1522
|
+
BLEND_EQUATION_RGB: 0x8009,
|
|
1523
|
+
BLEND_EQUATION_ALPHA: 0x883d,
|
|
1524
|
+
BLEND_DST_RGB: 0x80c8,
|
|
1525
|
+
BLEND_SRC_RGB: 0x80c9,
|
|
1526
|
+
BLEND_DST_ALPHA: 0x80ca,
|
|
1527
|
+
BLEND_SRC_ALPHA: 0x80cb,
|
|
1528
|
+
BLEND_COLOR: 0x8005,
|
|
1529
|
+
ARRAY_BUFFER_BINDING: 0x8894,
|
|
1530
|
+
ELEMENT_ARRAY_BUFFER_BINDING: 0x8895,
|
|
1531
|
+
LINE_WIDTH: 0x0b21,
|
|
1532
|
+
ALIASED_POINT_SIZE_RANGE: 0x846d,
|
|
1533
|
+
ALIASED_LINE_WIDTH_RANGE: 0x846e,
|
|
1534
|
+
CULL_FACE_MODE: 0x0b45,
|
|
1535
|
+
FRONT_FACE: 0x0b46,
|
|
1536
|
+
DEPTH_RANGE: 0x0b70,
|
|
1537
|
+
DEPTH_WRITEMASK: 0x0b72,
|
|
1538
|
+
DEPTH_CLEAR_VALUE: 0x0b73,
|
|
1539
|
+
DEPTH_FUNC: 0x0b74,
|
|
1540
|
+
STENCIL_CLEAR_VALUE: 0x0b91,
|
|
1541
|
+
STENCIL_FUNC: 0x0b92,
|
|
1542
|
+
STENCIL_FAIL: 0x0b94,
|
|
1543
|
+
STENCIL_PASS_DEPTH_FAIL: 0x0b95,
|
|
1544
|
+
STENCIL_PASS_DEPTH_PASS: 0x0b96,
|
|
1545
|
+
STENCIL_REF: 0x0b97,
|
|
1546
|
+
STENCIL_VALUE_MASK: 0x0b93,
|
|
1547
|
+
STENCIL_WRITEMASK: 0x0b98,
|
|
1548
|
+
STENCIL_BACK_FUNC: 0x8800,
|
|
1549
|
+
STENCIL_BACK_FAIL: 0x8801,
|
|
1550
|
+
STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802,
|
|
1551
|
+
STENCIL_BACK_PASS_DEPTH_PASS: 0x8803,
|
|
1552
|
+
STENCIL_BACK_REF: 0x8ca3,
|
|
1553
|
+
STENCIL_BACK_VALUE_MASK: 0x8ca4,
|
|
1554
|
+
STENCIL_BACK_WRITEMASK: 0x8ca5,
|
|
1555
|
+
VIEWPORT: 0x0ba2,
|
|
1556
|
+
SCISSOR_BOX: 0x0c10,
|
|
1557
|
+
COLOR_CLEAR_VALUE: 0x0c22,
|
|
1558
|
+
COLOR_WRITEMASK: 0x0c23,
|
|
1559
|
+
UNPACK_ALIGNMENT: 0x0cf5,
|
|
1560
|
+
PACK_ALIGNMENT: 0x0d05,
|
|
1561
|
+
MAX_TEXTURE_SIZE: 0x0d33,
|
|
1562
|
+
MAX_VIEWPORT_DIMS: 0x0d3a,
|
|
1563
|
+
SUBPIXEL_BITS: 0x0d50,
|
|
1564
|
+
RED_BITS: 0x0d52,
|
|
1565
|
+
GREEN_BITS: 0x0d53,
|
|
1566
|
+
BLUE_BITS: 0x0d54,
|
|
1567
|
+
ALPHA_BITS: 0x0d55,
|
|
1568
|
+
DEPTH_BITS: 0x0d56,
|
|
1569
|
+
STENCIL_BITS: 0x0d57,
|
|
1570
|
+
POLYGON_OFFSET_UNITS: 0x2a00,
|
|
1571
|
+
POLYGON_OFFSET_FACTOR: 0x8038,
|
|
1572
|
+
TEXTURE_BINDING_2D: 0x8069,
|
|
1573
|
+
SAMPLE_BUFFERS: 0x80a8,
|
|
1574
|
+
SAMPLES: 0x80a9,
|
|
1575
|
+
SAMPLE_COVERAGE_VALUE: 0x80aa,
|
|
1576
|
+
SAMPLE_COVERAGE_INVERT: 0x80ab,
|
|
1577
|
+
COMPRESSED_TEXTURE_FORMATS: 0x86a3,
|
|
1578
|
+
VENDOR: 0x1f00,
|
|
1579
|
+
RENDERER: 0x1f01,
|
|
1580
|
+
VERSION: 0x1f02,
|
|
1581
|
+
IMPLEMENTATION_COLOR_READ_TYPE: 0x8b9a,
|
|
1582
|
+
IMPLEMENTATION_COLOR_READ_FORMAT: 0x8b9b,
|
|
1583
|
+
BROWSER_DEFAULT_WEBGL: 0x9244,
|
|
1584
|
+
|
|
1585
|
+
// Buffers
|
|
1586
|
+
// Constants passed to bufferData(), bufferSubData(), bindBuffer(), or
|
|
1587
|
+
// getBufferParameter().
|
|
1588
|
+
|
|
1589
|
+
STATIC_DRAW: 0x88e4,
|
|
1590
|
+
STREAM_DRAW: 0x88e0,
|
|
1591
|
+
DYNAMIC_DRAW: 0x88e8,
|
|
1592
|
+
ARRAY_BUFFER: 0x8892,
|
|
1593
|
+
ELEMENT_ARRAY_BUFFER: 0x8893,
|
|
1594
|
+
BUFFER_SIZE: 0x8764,
|
|
1595
|
+
BUFFER_USAGE: 0x8765,
|
|
1596
|
+
|
|
1597
|
+
// Vertex attributes
|
|
1598
|
+
// Constants passed to getVertexAttrib().
|
|
1599
|
+
|
|
1600
|
+
CURRENT_VERTEX_ATTRIB: 0x8626,
|
|
1601
|
+
VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622,
|
|
1602
|
+
VERTEX_ATTRIB_ARRAY_SIZE: 0x8623,
|
|
1603
|
+
VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624,
|
|
1604
|
+
VERTEX_ATTRIB_ARRAY_TYPE: 0x8625,
|
|
1605
|
+
VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886a,
|
|
1606
|
+
VERTEX_ATTRIB_ARRAY_POINTER: 0x8645,
|
|
1607
|
+
VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889f,
|
|
1608
|
+
|
|
1609
|
+
// Culling
|
|
1610
|
+
// Constants passed to cullFace().
|
|
1611
|
+
|
|
1612
|
+
CULL_FACE: 0x0b44,
|
|
1613
|
+
FRONT: 0x0404,
|
|
1614
|
+
BACK: 0x0405,
|
|
1615
|
+
FRONT_AND_BACK: 0x0408,
|
|
1616
|
+
|
|
1617
|
+
// Enabling and disabling
|
|
1618
|
+
// Constants passed to enable() or disable().
|
|
1619
|
+
|
|
1620
|
+
BLEND: 0x0be2,
|
|
1621
|
+
DEPTH_TEST: 0x0b71,
|
|
1622
|
+
DITHER: 0x0bd0,
|
|
1623
|
+
POLYGON_OFFSET_FILL: 0x8037,
|
|
1624
|
+
SAMPLE_ALPHA_TO_COVERAGE: 0x809e,
|
|
1625
|
+
SAMPLE_COVERAGE: 0x80a0,
|
|
1626
|
+
SCISSOR_TEST: 0x0c11,
|
|
1627
|
+
STENCIL_TEST: 0x0b90,
|
|
1628
|
+
|
|
1629
|
+
// Errors
|
|
1630
|
+
// Constants returned from getError().
|
|
1631
|
+
|
|
1632
|
+
NO_ERROR: 0,
|
|
1633
|
+
INVALID_ENUM: 0x0500,
|
|
1634
|
+
INVALID_VALUE: 0x0501,
|
|
1635
|
+
INVALID_OPERATION: 0x0502,
|
|
1636
|
+
OUT_OF_MEMORY: 0x0505,
|
|
1637
|
+
CONTEXT_LOST_WEBGL: 0x9242,
|
|
1638
|
+
|
|
1639
|
+
// Front face directions
|
|
1640
|
+
// Constants passed to frontFace().
|
|
1641
|
+
|
|
1642
|
+
CW: 0x0900,
|
|
1643
|
+
CCW: 0x0901,
|
|
1644
|
+
|
|
1645
|
+
// Hints
|
|
1646
|
+
// Constants passed to hint()
|
|
1647
|
+
|
|
1648
|
+
DONT_CARE: 0x1100,
|
|
1649
|
+
FASTEST: 0x1101,
|
|
1650
|
+
NICEST: 0x1102,
|
|
1651
|
+
GENERATE_MIPMAP_HINT: 0x8192,
|
|
1652
|
+
|
|
1653
|
+
// Data types
|
|
1654
|
+
|
|
1655
|
+
BYTE: 0x1400,
|
|
1656
|
+
UNSIGNED_BYTE: 0x1401,
|
|
1657
|
+
SHORT: 0x1402,
|
|
1658
|
+
UNSIGNED_SHORT: 0x1403,
|
|
1659
|
+
INT: 0x1404,
|
|
1660
|
+
UNSIGNED_INT: 0x1405,
|
|
1661
|
+
FLOAT: 0x1406,
|
|
1662
|
+
DOUBLE: 0x140a,
|
|
1663
|
+
|
|
1664
|
+
// Pixel formats
|
|
1665
|
+
|
|
1666
|
+
DEPTH_COMPONENT: 0x1902,
|
|
1667
|
+
ALPHA: 0x1906,
|
|
1668
|
+
RGB: 0x1907,
|
|
1669
|
+
RGBA: 0x1908,
|
|
1670
|
+
LUMINANCE: 0x1909,
|
|
1671
|
+
LUMINANCE_ALPHA: 0x190a,
|
|
1672
|
+
|
|
1673
|
+
// Pixel types
|
|
1674
|
+
|
|
1675
|
+
// UNSIGNED_BYTE: 0x1401,
|
|
1676
|
+
UNSIGNED_SHORT_4_4_4_4: 0x8033,
|
|
1677
|
+
UNSIGNED_SHORT_5_5_5_1: 0x8034,
|
|
1678
|
+
UNSIGNED_SHORT_5_6_5: 0x8363,
|
|
1679
|
+
|
|
1680
|
+
// Shaders
|
|
1681
|
+
// Constants passed to createShader() or getShaderParameter()
|
|
1682
|
+
|
|
1683
|
+
FRAGMENT_SHADER: 0x8b30,
|
|
1684
|
+
VERTEX_SHADER: 0x8b31,
|
|
1685
|
+
COMPILE_STATUS: 0x8b81,
|
|
1686
|
+
DELETE_STATUS: 0x8b80,
|
|
1687
|
+
LINK_STATUS: 0x8b82,
|
|
1688
|
+
VALIDATE_STATUS: 0x8b83,
|
|
1689
|
+
ATTACHED_SHADERS: 0x8b85,
|
|
1690
|
+
ACTIVE_ATTRIBUTES: 0x8b89,
|
|
1691
|
+
ACTIVE_UNIFORMS: 0x8b86,
|
|
1692
|
+
MAX_VERTEX_ATTRIBS: 0x8869,
|
|
1693
|
+
MAX_VERTEX_UNIFORM_VECTORS: 0x8dfb,
|
|
1694
|
+
MAX_VARYING_VECTORS: 0x8dfc,
|
|
1695
|
+
MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8b4d,
|
|
1696
|
+
MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8b4c,
|
|
1697
|
+
MAX_TEXTURE_IMAGE_UNITS: 0x8872,
|
|
1698
|
+
MAX_FRAGMENT_UNIFORM_VECTORS: 0x8dfd,
|
|
1699
|
+
SHADER_TYPE: 0x8b4f,
|
|
1700
|
+
SHADING_LANGUAGE_VERSION: 0x8b8c,
|
|
1701
|
+
CURRENT_PROGRAM: 0x8b8d,
|
|
1702
|
+
|
|
1703
|
+
// Depth or stencil tests
|
|
1704
|
+
// Constants passed to depthFunc() or stencilFunc().
|
|
1705
|
+
|
|
1706
|
+
NEVER: 0x0200,
|
|
1707
|
+
ALWAYS: 0x0207,
|
|
1708
|
+
LESS: 0x0201,
|
|
1709
|
+
EQUAL: 0x0202,
|
|
1710
|
+
LEQUAL: 0x0203,
|
|
1711
|
+
GREATER: 0x0204,
|
|
1712
|
+
GEQUAL: 0x0206,
|
|
1713
|
+
NOTEQUAL: 0x0205,
|
|
1714
|
+
|
|
1715
|
+
// Stencil actions
|
|
1716
|
+
// Constants passed to stencilOp().
|
|
1717
|
+
|
|
1718
|
+
KEEP: 0x1e00,
|
|
1719
|
+
REPLACE: 0x1e01,
|
|
1720
|
+
INCR: 0x1e02,
|
|
1721
|
+
DECR: 0x1e03,
|
|
1722
|
+
INVERT: 0x150a,
|
|
1723
|
+
INCR_WRAP: 0x8507,
|
|
1724
|
+
DECR_WRAP: 0x8508,
|
|
1725
|
+
|
|
1726
|
+
// Textures
|
|
1727
|
+
// Constants passed to texParameteri(),
|
|
1728
|
+
// texParameterf(), bindTexture(), texImage2D(), and others.
|
|
1729
|
+
|
|
1730
|
+
NEAREST: 0x2600,
|
|
1731
|
+
LINEAR: 0x2601,
|
|
1732
|
+
NEAREST_MIPMAP_NEAREST: 0x2700,
|
|
1733
|
+
LINEAR_MIPMAP_NEAREST: 0x2701,
|
|
1734
|
+
NEAREST_MIPMAP_LINEAR: 0x2702,
|
|
1735
|
+
LINEAR_MIPMAP_LINEAR: 0x2703,
|
|
1736
|
+
TEXTURE_MAG_FILTER: 0x2800,
|
|
1737
|
+
TEXTURE_MIN_FILTER: 0x2801,
|
|
1738
|
+
TEXTURE_WRAP_S: 0x2802,
|
|
1739
|
+
TEXTURE_WRAP_T: 0x2803,
|
|
1740
|
+
TEXTURE_2D: 0x0de1,
|
|
1741
|
+
TEXTURE: 0x1702,
|
|
1742
|
+
TEXTURE_CUBE_MAP: 0x8513,
|
|
1743
|
+
TEXTURE_BINDING_CUBE_MAP: 0x8514,
|
|
1744
|
+
TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515,
|
|
1745
|
+
TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516,
|
|
1746
|
+
TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517,
|
|
1747
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518,
|
|
1748
|
+
TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519,
|
|
1749
|
+
TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851a,
|
|
1750
|
+
MAX_CUBE_MAP_TEXTURE_SIZE: 0x851c,
|
|
1751
|
+
// TEXTURE0 - 31 0x84C0 - 0x84DF A texture unit.
|
|
1752
|
+
TEXTURE0: 0x84c0,
|
|
1753
|
+
ACTIVE_TEXTURE: 0x84e0,
|
|
1754
|
+
REPEAT: 0x2901,
|
|
1755
|
+
CLAMP_TO_EDGE: 0x812f,
|
|
1756
|
+
MIRRORED_REPEAT: 0x8370,
|
|
1757
|
+
|
|
1758
|
+
// Emulation
|
|
1759
|
+
TEXTURE_WIDTH: 0x1000,
|
|
1760
|
+
TEXTURE_HEIGHT: 0x1001,
|
|
1761
|
+
|
|
1762
|
+
// Uniform types
|
|
1763
|
+
|
|
1764
|
+
FLOAT_VEC2: 0x8b50,
|
|
1765
|
+
FLOAT_VEC3: 0x8b51,
|
|
1766
|
+
FLOAT_VEC4: 0x8b52,
|
|
1767
|
+
INT_VEC2: 0x8b53,
|
|
1768
|
+
INT_VEC3: 0x8b54,
|
|
1769
|
+
INT_VEC4: 0x8b55,
|
|
1770
|
+
BOOL: 0x8b56,
|
|
1771
|
+
BOOL_VEC2: 0x8b57,
|
|
1772
|
+
BOOL_VEC3: 0x8b58,
|
|
1773
|
+
BOOL_VEC4: 0x8b59,
|
|
1774
|
+
FLOAT_MAT2: 0x8b5a,
|
|
1775
|
+
FLOAT_MAT3: 0x8b5b,
|
|
1776
|
+
FLOAT_MAT4: 0x8b5c,
|
|
1777
|
+
SAMPLER_2D: 0x8b5e,
|
|
1778
|
+
SAMPLER_CUBE: 0x8b60,
|
|
1779
|
+
|
|
1780
|
+
// Shader precision-specified types
|
|
1781
|
+
|
|
1782
|
+
LOW_FLOAT: 0x8df0,
|
|
1783
|
+
MEDIUM_FLOAT: 0x8df1,
|
|
1784
|
+
HIGH_FLOAT: 0x8df2,
|
|
1785
|
+
LOW_INT: 0x8df3,
|
|
1786
|
+
MEDIUM_INT: 0x8df4,
|
|
1787
|
+
HIGH_INT: 0x8df5,
|
|
1788
|
+
|
|
1789
|
+
// Framebuffers and renderbuffers
|
|
1790
|
+
|
|
1791
|
+
FRAMEBUFFER: 0x8d40,
|
|
1792
|
+
RENDERBUFFER: 0x8d41,
|
|
1793
|
+
RGBA4: 0x8056,
|
|
1794
|
+
RGB5_A1: 0x8057,
|
|
1795
|
+
RGB565: 0x8d62,
|
|
1796
|
+
DEPTH_COMPONENT16: 0x81a5,
|
|
1797
|
+
STENCIL_INDEX: 0x1901,
|
|
1798
|
+
STENCIL_INDEX8: 0x8d48,
|
|
1799
|
+
DEPTH_STENCIL: 0x84f9,
|
|
1800
|
+
RENDERBUFFER_WIDTH: 0x8d42,
|
|
1801
|
+
RENDERBUFFER_HEIGHT: 0x8d43,
|
|
1802
|
+
RENDERBUFFER_INTERNAL_FORMAT: 0x8d44,
|
|
1803
|
+
RENDERBUFFER_RED_SIZE: 0x8d50,
|
|
1804
|
+
RENDERBUFFER_GREEN_SIZE: 0x8d51,
|
|
1805
|
+
RENDERBUFFER_BLUE_SIZE: 0x8d52,
|
|
1806
|
+
RENDERBUFFER_ALPHA_SIZE: 0x8d53,
|
|
1807
|
+
RENDERBUFFER_DEPTH_SIZE: 0x8d54,
|
|
1808
|
+
RENDERBUFFER_STENCIL_SIZE: 0x8d55,
|
|
1809
|
+
FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8cd0,
|
|
1810
|
+
FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8cd1,
|
|
1811
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8cd2,
|
|
1812
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8cd3,
|
|
1813
|
+
COLOR_ATTACHMENT0: 0x8ce0,
|
|
1814
|
+
DEPTH_ATTACHMENT: 0x8d00,
|
|
1815
|
+
STENCIL_ATTACHMENT: 0x8d20,
|
|
1816
|
+
DEPTH_STENCIL_ATTACHMENT: 0x821a,
|
|
1817
|
+
NONE: 0,
|
|
1818
|
+
FRAMEBUFFER_COMPLETE: 0x8cd5,
|
|
1819
|
+
FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8cd6,
|
|
1820
|
+
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8cd7,
|
|
1821
|
+
FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8cd9,
|
|
1822
|
+
FRAMEBUFFER_UNSUPPORTED: 0x8cdd,
|
|
1823
|
+
FRAMEBUFFER_BINDING: 0x8ca6,
|
|
1824
|
+
RENDERBUFFER_BINDING: 0x8ca7,
|
|
1825
|
+
READ_FRAMEBUFFER: 0x8ca8,
|
|
1826
|
+
DRAW_FRAMEBUFFER: 0x8ca9,
|
|
1827
|
+
MAX_RENDERBUFFER_SIZE: 0x84e8,
|
|
1828
|
+
INVALID_FRAMEBUFFER_OPERATION: 0x0506,
|
|
1829
|
+
|
|
1830
|
+
// Pixel storage modes
|
|
1831
|
+
// Constants passed to pixelStorei().
|
|
1832
|
+
|
|
1833
|
+
UNPACK_FLIP_Y_WEBGL: 0x9240,
|
|
1834
|
+
UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241,
|
|
1835
|
+
UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243,
|
|
1836
|
+
|
|
1837
|
+
// /////////////////////////////////////////////////////
|
|
1838
|
+
// Additional constants defined WebGL 2
|
|
1839
|
+
// These constants are defined on the WebGL2RenderingContext interface.
|
|
1840
|
+
// All WebGL 1 constants are also available in a WebGL 2 context.
|
|
1841
|
+
// /////////////////////////////////////////////////////
|
|
1842
|
+
|
|
1843
|
+
// Getting GL parameter information
|
|
1844
|
+
// Constants passed to getParameter()
|
|
1845
|
+
// to specify what information to return.
|
|
1846
|
+
|
|
1847
|
+
READ_BUFFER: 0x0c02,
|
|
1848
|
+
UNPACK_ROW_LENGTH: 0x0cf2,
|
|
1849
|
+
UNPACK_SKIP_ROWS: 0x0cf3,
|
|
1850
|
+
UNPACK_SKIP_PIXELS: 0x0cf4,
|
|
1851
|
+
PACK_ROW_LENGTH: 0x0d02,
|
|
1852
|
+
PACK_SKIP_ROWS: 0x0d03,
|
|
1853
|
+
PACK_SKIP_PIXELS: 0x0d04,
|
|
1854
|
+
TEXTURE_BINDING_3D: 0x806a,
|
|
1855
|
+
UNPACK_SKIP_IMAGES: 0x806d,
|
|
1856
|
+
UNPACK_IMAGE_HEIGHT: 0x806e,
|
|
1857
|
+
MAX_3D_TEXTURE_SIZE: 0x8073,
|
|
1858
|
+
MAX_ELEMENTS_VERTICES: 0x80e8,
|
|
1859
|
+
MAX_ELEMENTS_INDICES: 0x80e9,
|
|
1860
|
+
MAX_TEXTURE_LOD_BIAS: 0x84fd,
|
|
1861
|
+
MAX_FRAGMENT_UNIFORM_COMPONENTS: 0x8b49,
|
|
1862
|
+
MAX_VERTEX_UNIFORM_COMPONENTS: 0x8b4a,
|
|
1863
|
+
MAX_ARRAY_TEXTURE_LAYERS: 0x88ff,
|
|
1864
|
+
MIN_PROGRAM_TEXEL_OFFSET: 0x8904,
|
|
1865
|
+
MAX_PROGRAM_TEXEL_OFFSET: 0x8905,
|
|
1866
|
+
MAX_VARYING_COMPONENTS: 0x8b4b,
|
|
1867
|
+
FRAGMENT_SHADER_DERIVATIVE_HINT: 0x8b8b,
|
|
1868
|
+
RASTERIZER_DISCARD: 0x8c89,
|
|
1869
|
+
VERTEX_ARRAY_BINDING: 0x85b5,
|
|
1870
|
+
MAX_VERTEX_OUTPUT_COMPONENTS: 0x9122,
|
|
1871
|
+
MAX_FRAGMENT_INPUT_COMPONENTS: 0x9125,
|
|
1872
|
+
MAX_SERVER_WAIT_TIMEOUT: 0x9111,
|
|
1873
|
+
MAX_ELEMENT_INDEX: 0x8d6b,
|
|
1874
|
+
|
|
1875
|
+
// Textures
|
|
1876
|
+
// Constants passed to texParameteri(),
|
|
1877
|
+
// texParameterf(), bindTexture(), texImage2D(), and others.
|
|
1878
|
+
|
|
1879
|
+
RED: 0x1903,
|
|
1880
|
+
RGB8: 0x8051,
|
|
1881
|
+
RGBA8: 0x8058,
|
|
1882
|
+
RGB10_A2: 0x8059,
|
|
1883
|
+
TEXTURE_3D: 0x806f,
|
|
1884
|
+
TEXTURE_WRAP_R: 0x8072,
|
|
1885
|
+
TEXTURE_MIN_LOD: 0x813a,
|
|
1886
|
+
TEXTURE_MAX_LOD: 0x813b,
|
|
1887
|
+
TEXTURE_BASE_LEVEL: 0x813c,
|
|
1888
|
+
TEXTURE_MAX_LEVEL: 0x813d,
|
|
1889
|
+
TEXTURE_COMPARE_MODE: 0x884c,
|
|
1890
|
+
TEXTURE_COMPARE_FUNC: 0x884d,
|
|
1891
|
+
SRGB: 0x8c40,
|
|
1892
|
+
SRGB8: 0x8c41,
|
|
1893
|
+
SRGB8_ALPHA8: 0x8c43,
|
|
1894
|
+
COMPARE_REF_TO_TEXTURE: 0x884e,
|
|
1895
|
+
RGBA32F: 0x8814,
|
|
1896
|
+
RGB32F: 0x8815,
|
|
1897
|
+
RGBA16F: 0x881a,
|
|
1898
|
+
RGB16F: 0x881b,
|
|
1899
|
+
TEXTURE_2D_ARRAY: 0x8c1a,
|
|
1900
|
+
TEXTURE_BINDING_2D_ARRAY: 0x8c1d,
|
|
1901
|
+
R11F_G11F_B10F: 0x8c3a,
|
|
1902
|
+
RGB9_E5: 0x8c3d,
|
|
1903
|
+
RGBA32UI: 0x8d70,
|
|
1904
|
+
RGB32UI: 0x8d71,
|
|
1905
|
+
RGBA16UI: 0x8d76,
|
|
1906
|
+
RGB16UI: 0x8d77,
|
|
1907
|
+
RGBA8UI: 0x8d7c,
|
|
1908
|
+
RGB8UI: 0x8d7d,
|
|
1909
|
+
RGBA32I: 0x8d82,
|
|
1910
|
+
RGB32I: 0x8d83,
|
|
1911
|
+
RGBA16I: 0x8d88,
|
|
1912
|
+
RGB16I: 0x8d89,
|
|
1913
|
+
RGBA8I: 0x8d8e,
|
|
1914
|
+
RGB8I: 0x8d8f,
|
|
1915
|
+
RED_INTEGER: 0x8d94,
|
|
1916
|
+
RGB_INTEGER: 0x8d98,
|
|
1917
|
+
RGBA_INTEGER: 0x8d99,
|
|
1918
|
+
R8: 0x8229,
|
|
1919
|
+
RG8: 0x822b,
|
|
1920
|
+
R16F: 0x822d,
|
|
1921
|
+
R32F: 0x822e,
|
|
1922
|
+
RG16F: 0x822f,
|
|
1923
|
+
RG32F: 0x8230,
|
|
1924
|
+
R8I: 0x8231,
|
|
1925
|
+
R8UI: 0x8232,
|
|
1926
|
+
R16I: 0x8233,
|
|
1927
|
+
R16UI: 0x8234,
|
|
1928
|
+
R32I: 0x8235,
|
|
1929
|
+
R32UI: 0x8236,
|
|
1930
|
+
RG8I: 0x8237,
|
|
1931
|
+
RG8UI: 0x8238,
|
|
1932
|
+
RG16I: 0x8239,
|
|
1933
|
+
RG16UI: 0x823a,
|
|
1934
|
+
RG32I: 0x823b,
|
|
1935
|
+
RG32UI: 0x823c,
|
|
1936
|
+
R8_SNORM: 0x8f94,
|
|
1937
|
+
RG8_SNORM: 0x8f95,
|
|
1938
|
+
RGB8_SNORM: 0x8f96,
|
|
1939
|
+
RGBA8_SNORM: 0x8f97,
|
|
1940
|
+
RGB10_A2UI: 0x906f,
|
|
1941
|
+
|
|
1942
|
+
/* covered by extension
|
|
1943
|
+
COMPRESSED_R11_EAC : 0x9270,
|
|
1944
|
+
COMPRESSED_SIGNED_R11_EAC: 0x9271,
|
|
1945
|
+
COMPRESSED_RG11_EAC: 0x9272,
|
|
1946
|
+
COMPRESSED_SIGNED_RG11_EAC : 0x9273,
|
|
1947
|
+
COMPRESSED_RGB8_ETC2 : 0x9274,
|
|
1948
|
+
COMPRESSED_SRGB8_ETC2: 0x9275,
|
|
1949
|
+
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 : 0x9276,
|
|
1950
|
+
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC : 0x9277,
|
|
1951
|
+
COMPRESSED_RGBA8_ETC2_EAC: 0x9278,
|
|
1952
|
+
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : 0x9279,
|
|
1953
|
+
*/
|
|
1954
|
+
TEXTURE_IMMUTABLE_FORMAT: 0x912f,
|
|
1955
|
+
TEXTURE_IMMUTABLE_LEVELS: 0x82df,
|
|
1956
|
+
|
|
1957
|
+
// Pixel types
|
|
1958
|
+
|
|
1959
|
+
UNSIGNED_INT_2_10_10_10_REV: 0x8368,
|
|
1960
|
+
UNSIGNED_INT_10F_11F_11F_REV: 0x8c3b,
|
|
1961
|
+
UNSIGNED_INT_5_9_9_9_REV: 0x8c3e,
|
|
1962
|
+
FLOAT_32_UNSIGNED_INT_24_8_REV: 0x8dad,
|
|
1963
|
+
UNSIGNED_INT_24_8: 0x84fa,
|
|
1964
|
+
HALF_FLOAT: 0x140b,
|
|
1965
|
+
RG: 0x8227,
|
|
1966
|
+
RG_INTEGER: 0x8228,
|
|
1967
|
+
INT_2_10_10_10_REV: 0x8d9f,
|
|
1968
|
+
|
|
1969
|
+
// Queries
|
|
1970
|
+
|
|
1971
|
+
CURRENT_QUERY: 0x8865,
|
|
1972
|
+
QUERY_RESULT: 0x8866,
|
|
1973
|
+
QUERY_RESULT_AVAILABLE: 0x8867,
|
|
1974
|
+
ANY_SAMPLES_PASSED: 0x8c2f,
|
|
1975
|
+
ANY_SAMPLES_PASSED_CONSERVATIVE: 0x8d6a,
|
|
1976
|
+
|
|
1977
|
+
// Draw buffers
|
|
1978
|
+
|
|
1979
|
+
MAX_DRAW_BUFFERS: 0x8824,
|
|
1980
|
+
DRAW_BUFFER0: 0x8825,
|
|
1981
|
+
DRAW_BUFFER1: 0x8826,
|
|
1982
|
+
DRAW_BUFFER2: 0x8827,
|
|
1983
|
+
DRAW_BUFFER3: 0x8828,
|
|
1984
|
+
DRAW_BUFFER4: 0x8829,
|
|
1985
|
+
DRAW_BUFFER5: 0x882a,
|
|
1986
|
+
DRAW_BUFFER6: 0x882b,
|
|
1987
|
+
DRAW_BUFFER7: 0x882c,
|
|
1988
|
+
DRAW_BUFFER8: 0x882d,
|
|
1989
|
+
DRAW_BUFFER9: 0x882e,
|
|
1990
|
+
DRAW_BUFFER10: 0x882f,
|
|
1991
|
+
DRAW_BUFFER11: 0x8830,
|
|
1992
|
+
DRAW_BUFFER12: 0x8831,
|
|
1993
|
+
DRAW_BUFFER13: 0x8832,
|
|
1994
|
+
DRAW_BUFFER14: 0x8833,
|
|
1995
|
+
DRAW_BUFFER15: 0x8834,
|
|
1996
|
+
MAX_COLOR_ATTACHMENTS: 0x8cdf,
|
|
1997
|
+
COLOR_ATTACHMENT1: 0x8ce1,
|
|
1998
|
+
COLOR_ATTACHMENT2: 0x8ce2,
|
|
1999
|
+
COLOR_ATTACHMENT3: 0x8ce3,
|
|
2000
|
+
COLOR_ATTACHMENT4: 0x8ce4,
|
|
2001
|
+
COLOR_ATTACHMENT5: 0x8ce5,
|
|
2002
|
+
COLOR_ATTACHMENT6: 0x8ce6,
|
|
2003
|
+
COLOR_ATTACHMENT7: 0x8ce7,
|
|
2004
|
+
COLOR_ATTACHMENT8: 0x8ce8,
|
|
2005
|
+
COLOR_ATTACHMENT9: 0x8ce9,
|
|
2006
|
+
COLOR_ATTACHMENT10: 0x8cea,
|
|
2007
|
+
COLOR_ATTACHMENT11: 0x8ceb,
|
|
2008
|
+
COLOR_ATTACHMENT12: 0x8cec,
|
|
2009
|
+
COLOR_ATTACHMENT13: 0x8ced,
|
|
2010
|
+
COLOR_ATTACHMENT14: 0x8cee,
|
|
2011
|
+
COLOR_ATTACHMENT15: 0x8cef,
|
|
2012
|
+
|
|
2013
|
+
// Samplers
|
|
2014
|
+
|
|
2015
|
+
SAMPLER_3D: 0x8b5f,
|
|
2016
|
+
SAMPLER_2D_SHADOW: 0x8b62,
|
|
2017
|
+
SAMPLER_2D_ARRAY: 0x8dc1,
|
|
2018
|
+
SAMPLER_2D_ARRAY_SHADOW: 0x8dc4,
|
|
2019
|
+
SAMPLER_CUBE_SHADOW: 0x8dc5,
|
|
2020
|
+
INT_SAMPLER_2D: 0x8dca,
|
|
2021
|
+
INT_SAMPLER_3D: 0x8dcb,
|
|
2022
|
+
INT_SAMPLER_CUBE: 0x8dcc,
|
|
2023
|
+
INT_SAMPLER_2D_ARRAY: 0x8dcf,
|
|
2024
|
+
UNSIGNED_INT_SAMPLER_2D: 0x8dd2,
|
|
2025
|
+
UNSIGNED_INT_SAMPLER_3D: 0x8dd3,
|
|
2026
|
+
UNSIGNED_INT_SAMPLER_CUBE: 0x8dd4,
|
|
2027
|
+
UNSIGNED_INT_SAMPLER_2D_ARRAY: 0x8dd7,
|
|
2028
|
+
MAX_SAMPLES: 0x8d57,
|
|
2029
|
+
SAMPLER_BINDING: 0x8919,
|
|
2030
|
+
|
|
2031
|
+
// Buffers
|
|
2032
|
+
|
|
2033
|
+
PIXEL_PACK_BUFFER: 0x88eb,
|
|
2034
|
+
PIXEL_UNPACK_BUFFER: 0x88ec,
|
|
2035
|
+
PIXEL_PACK_BUFFER_BINDING: 0x88ed,
|
|
2036
|
+
PIXEL_UNPACK_BUFFER_BINDING: 0x88ef,
|
|
2037
|
+
COPY_READ_BUFFER: 0x8f36,
|
|
2038
|
+
COPY_WRITE_BUFFER: 0x8f37,
|
|
2039
|
+
COPY_READ_BUFFER_BINDING: 0x8f36,
|
|
2040
|
+
COPY_WRITE_BUFFER_BINDING: 0x8f37,
|
|
2041
|
+
|
|
2042
|
+
// Data types
|
|
2043
|
+
|
|
2044
|
+
FLOAT_MAT2x3: 0x8b65,
|
|
2045
|
+
FLOAT_MAT2x4: 0x8b66,
|
|
2046
|
+
FLOAT_MAT3x2: 0x8b67,
|
|
2047
|
+
FLOAT_MAT3x4: 0x8b68,
|
|
2048
|
+
FLOAT_MAT4x2: 0x8b69,
|
|
2049
|
+
FLOAT_MAT4x3: 0x8b6a,
|
|
2050
|
+
UNSIGNED_INT_VEC2: 0x8dc6,
|
|
2051
|
+
UNSIGNED_INT_VEC3: 0x8dc7,
|
|
2052
|
+
UNSIGNED_INT_VEC4: 0x8dc8,
|
|
2053
|
+
UNSIGNED_NORMALIZED: 0x8c17,
|
|
2054
|
+
SIGNED_NORMALIZED: 0x8f9c,
|
|
2055
|
+
|
|
2056
|
+
// Vertex attributes
|
|
2057
|
+
|
|
2058
|
+
VERTEX_ATTRIB_ARRAY_INTEGER: 0x88fd,
|
|
2059
|
+
VERTEX_ATTRIB_ARRAY_DIVISOR: 0x88fe,
|
|
2060
|
+
|
|
2061
|
+
// Transform feedback
|
|
2062
|
+
|
|
2063
|
+
TRANSFORM_FEEDBACK_BUFFER_MODE: 0x8c7f,
|
|
2064
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 0x8c80,
|
|
2065
|
+
TRANSFORM_FEEDBACK_VARYINGS: 0x8c83,
|
|
2066
|
+
TRANSFORM_FEEDBACK_BUFFER_START: 0x8c84,
|
|
2067
|
+
TRANSFORM_FEEDBACK_BUFFER_SIZE: 0x8c85,
|
|
2068
|
+
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0x8c88,
|
|
2069
|
+
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 0x8c8a,
|
|
2070
|
+
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 0x8c8b,
|
|
2071
|
+
INTERLEAVED_ATTRIBS: 0x8c8c,
|
|
2072
|
+
SEPARATE_ATTRIBS: 0x8c8d,
|
|
2073
|
+
TRANSFORM_FEEDBACK_BUFFER: 0x8c8e,
|
|
2074
|
+
TRANSFORM_FEEDBACK_BUFFER_BINDING: 0x8c8f,
|
|
2075
|
+
TRANSFORM_FEEDBACK: 0x8e22,
|
|
2076
|
+
TRANSFORM_FEEDBACK_PAUSED: 0x8e23,
|
|
2077
|
+
TRANSFORM_FEEDBACK_ACTIVE: 0x8e24,
|
|
2078
|
+
TRANSFORM_FEEDBACK_BINDING: 0x8e25,
|
|
2079
|
+
|
|
2080
|
+
// Framebuffers and renderbuffers
|
|
2081
|
+
|
|
2082
|
+
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 0x8210,
|
|
2083
|
+
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 0x8211,
|
|
2084
|
+
FRAMEBUFFER_ATTACHMENT_RED_SIZE: 0x8212,
|
|
2085
|
+
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 0x8213,
|
|
2086
|
+
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 0x8214,
|
|
2087
|
+
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 0x8215,
|
|
2088
|
+
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 0x8216,
|
|
2089
|
+
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 0x8217,
|
|
2090
|
+
FRAMEBUFFER_DEFAULT: 0x8218,
|
|
2091
|
+
// DEPTH_STENCIL_ATTACHMENT : 0x821A,
|
|
2092
|
+
// DEPTH_STENCIL: 0x84F9,
|
|
2093
|
+
DEPTH24_STENCIL8: 0x88f0,
|
|
2094
|
+
DRAW_FRAMEBUFFER_BINDING: 0x8ca6,
|
|
2095
|
+
READ_FRAMEBUFFER_BINDING: 0x8caa,
|
|
2096
|
+
RENDERBUFFER_SAMPLES: 0x8cab,
|
|
2097
|
+
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 0x8cd4,
|
|
2098
|
+
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 0x8d56,
|
|
2099
|
+
|
|
2100
|
+
// Uniforms
|
|
2101
|
+
|
|
2102
|
+
UNIFORM_BUFFER: 0x8a11,
|
|
2103
|
+
UNIFORM_BUFFER_BINDING: 0x8a28,
|
|
2104
|
+
UNIFORM_BUFFER_START: 0x8a29,
|
|
2105
|
+
UNIFORM_BUFFER_SIZE: 0x8a2a,
|
|
2106
|
+
MAX_VERTEX_UNIFORM_BLOCKS: 0x8a2b,
|
|
2107
|
+
MAX_FRAGMENT_UNIFORM_BLOCKS: 0x8a2d,
|
|
2108
|
+
MAX_COMBINED_UNIFORM_BLOCKS: 0x8a2e,
|
|
2109
|
+
MAX_UNIFORM_BUFFER_BINDINGS: 0x8a2f,
|
|
2110
|
+
MAX_UNIFORM_BLOCK_SIZE: 0x8a30,
|
|
2111
|
+
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 0x8a31,
|
|
2112
|
+
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 0x8a33,
|
|
2113
|
+
UNIFORM_BUFFER_OFFSET_ALIGNMENT: 0x8a34,
|
|
2114
|
+
ACTIVE_UNIFORM_BLOCKS: 0x8a36,
|
|
2115
|
+
UNIFORM_TYPE: 0x8a37,
|
|
2116
|
+
UNIFORM_SIZE: 0x8a38,
|
|
2117
|
+
UNIFORM_BLOCK_INDEX: 0x8a3a,
|
|
2118
|
+
UNIFORM_OFFSET: 0x8a3b,
|
|
2119
|
+
UNIFORM_ARRAY_STRIDE: 0x8a3c,
|
|
2120
|
+
UNIFORM_MATRIX_STRIDE: 0x8a3d,
|
|
2121
|
+
UNIFORM_IS_ROW_MAJOR: 0x8a3e,
|
|
2122
|
+
UNIFORM_BLOCK_BINDING: 0x8a3f,
|
|
2123
|
+
UNIFORM_BLOCK_DATA_SIZE: 0x8a40,
|
|
2124
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORMS: 0x8a42,
|
|
2125
|
+
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 0x8a43,
|
|
2126
|
+
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 0x8a44,
|
|
2127
|
+
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 0x8a46,
|
|
2128
|
+
|
|
2129
|
+
// Sync objects
|
|
2130
|
+
|
|
2131
|
+
OBJECT_TYPE: 0x9112,
|
|
2132
|
+
SYNC_CONDITION: 0x9113,
|
|
2133
|
+
SYNC_STATUS: 0x9114,
|
|
2134
|
+
SYNC_FLAGS: 0x9115,
|
|
2135
|
+
SYNC_FENCE: 0x9116,
|
|
2136
|
+
SYNC_GPU_COMMANDS_COMPLETE: 0x9117,
|
|
2137
|
+
UNSIGNALED: 0x9118,
|
|
2138
|
+
SIGNALED: 0x9119,
|
|
2139
|
+
ALREADY_SIGNALED: 0x911a,
|
|
2140
|
+
TIMEOUT_EXPIRED: 0x911b,
|
|
2141
|
+
CONDITION_SATISFIED: 0x911c,
|
|
2142
|
+
WAIT_FAILED: 0x911d,
|
|
2143
|
+
SYNC_FLUSH_COMMANDS_BIT: 0x00000001,
|
|
2144
|
+
|
|
2145
|
+
// Miscellaneous constants
|
|
2146
|
+
|
|
2147
|
+
COLOR: 0x1800,
|
|
2148
|
+
DEPTH: 0x1801,
|
|
2149
|
+
STENCIL: 0x1802,
|
|
2150
|
+
MIN: 0x8007,
|
|
2151
|
+
MAX: 0x8008,
|
|
2152
|
+
DEPTH_COMPONENT24: 0x81a6,
|
|
2153
|
+
STREAM_READ: 0x88e1,
|
|
2154
|
+
STREAM_COPY: 0x88e2,
|
|
2155
|
+
STATIC_READ: 0x88e5,
|
|
2156
|
+
STATIC_COPY: 0x88e6,
|
|
2157
|
+
DYNAMIC_READ: 0x88e9,
|
|
2158
|
+
DYNAMIC_COPY: 0x88ea,
|
|
2159
|
+
DEPTH_COMPONENT32F: 0x8cac,
|
|
2160
|
+
DEPTH32F_STENCIL8: 0x8cad,
|
|
2161
|
+
INVALID_INDEX: 0xffffffff,
|
|
2162
|
+
TIMEOUT_IGNORED: -1,
|
|
2163
|
+
MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 0x9247,
|
|
2164
|
+
|
|
2165
|
+
// Constants defined in WebGL extensions
|
|
2166
|
+
|
|
2167
|
+
// ANGLE_instanced_arrays
|
|
2168
|
+
|
|
2169
|
+
VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88fe,
|
|
2170
|
+
|
|
2171
|
+
// WEBGL_debug_renderer_info
|
|
2172
|
+
|
|
2173
|
+
UNMASKED_VENDOR_WEBGL: 0x9245,
|
|
2174
|
+
UNMASKED_RENDERER_WEBGL: 0x9246,
|
|
2175
|
+
|
|
2176
|
+
// EXT_texture_filter_anisotropic
|
|
2177
|
+
|
|
2178
|
+
MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84ff,
|
|
2179
|
+
TEXTURE_MAX_ANISOTROPY_EXT: 0x84fe,
|
|
2180
|
+
|
|
2181
|
+
// WEBGL_compressed_texture_s3tc
|
|
2182
|
+
|
|
2183
|
+
COMPRESSED_RGB_S3TC_DXT1_EXT: 0x83f0,
|
|
2184
|
+
COMPRESSED_RGBA_S3TC_DXT1_EXT: 0x83f1,
|
|
2185
|
+
COMPRESSED_RGBA_S3TC_DXT3_EXT: 0x83f2,
|
|
2186
|
+
COMPRESSED_RGBA_S3TC_DXT5_EXT: 0x83f3,
|
|
2187
|
+
|
|
2188
|
+
// WEBGL_compressed_texture_es3
|
|
2189
|
+
|
|
2190
|
+
COMPRESSED_R11_EAC: 0x9270,
|
|
2191
|
+
COMPRESSED_SIGNED_R11_EAC: 0x9271,
|
|
2192
|
+
COMPRESSED_RG11_EAC: 0x9272,
|
|
2193
|
+
COMPRESSED_SIGNED_RG11_EAC: 0x9273,
|
|
2194
|
+
COMPRESSED_RGB8_ETC2: 0x9274,
|
|
2195
|
+
COMPRESSED_RGBA8_ETC2_EAC: 0x9275,
|
|
2196
|
+
COMPRESSED_SRGB8_ETC2: 0x9276,
|
|
2197
|
+
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 0x9277,
|
|
2198
|
+
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9278,
|
|
2199
|
+
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9279,
|
|
2200
|
+
|
|
2201
|
+
// WEBGL_compressed_texture_pvrtc
|
|
2202
|
+
|
|
2203
|
+
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 0x8c00,
|
|
2204
|
+
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 0x8c02,
|
|
2205
|
+
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 0x8c01,
|
|
2206
|
+
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 0x8c03,
|
|
2207
|
+
|
|
2208
|
+
// WEBGL_compressed_texture_etc1
|
|
2209
|
+
|
|
2210
|
+
COMPRESSED_RGB_ETC1_WEBGL: 0x8d64,
|
|
2211
|
+
|
|
2212
|
+
// WEBGL_compressed_texture_atc
|
|
2213
|
+
|
|
2214
|
+
COMPRESSED_RGB_ATC_WEBGL: 0x8c92,
|
|
2215
|
+
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 0x8c92,
|
|
2216
|
+
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 0x87ee,
|
|
2217
|
+
|
|
2218
|
+
// WEBGL_depth_texture
|
|
2219
|
+
|
|
2220
|
+
UNSIGNED_INT_24_8_WEBGL: 0x84fa,
|
|
2221
|
+
|
|
2222
|
+
// OES_texture_half_float
|
|
2223
|
+
|
|
2224
|
+
HALF_FLOAT_OES: 0x8d61,
|
|
2225
|
+
|
|
2226
|
+
// WEBGL_color_buffer_float
|
|
2227
|
+
|
|
2228
|
+
RGBA32F_EXT: 0x8814,
|
|
2229
|
+
RGB32F_EXT: 0x8815,
|
|
2230
|
+
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211,
|
|
2231
|
+
UNSIGNED_NORMALIZED_EXT: 0x8c17,
|
|
2232
|
+
|
|
2233
|
+
// EXT_blend_minmax
|
|
2234
|
+
|
|
2235
|
+
MIN_EXT: 0x8007,
|
|
2236
|
+
MAX_EXT: 0x8008,
|
|
2237
|
+
|
|
2238
|
+
// EXT_sRGB
|
|
2239
|
+
|
|
2240
|
+
SRGB_EXT: 0x8c40,
|
|
2241
|
+
SRGB_ALPHA_EXT: 0x8c42,
|
|
2242
|
+
SRGB8_ALPHA8_EXT: 0x8c43,
|
|
2243
|
+
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 0x8210,
|
|
2244
|
+
|
|
2245
|
+
// OES_standard_derivatives
|
|
2246
|
+
|
|
2247
|
+
FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 0x8b8b,
|
|
2248
|
+
|
|
2249
|
+
// WEBGL_draw_buffers
|
|
2250
|
+
|
|
2251
|
+
COLOR_ATTACHMENT0_WEBGL: 0x8ce0,
|
|
2252
|
+
COLOR_ATTACHMENT1_WEBGL: 0x8ce1,
|
|
2253
|
+
COLOR_ATTACHMENT2_WEBGL: 0x8ce2,
|
|
2254
|
+
COLOR_ATTACHMENT3_WEBGL: 0x8ce3,
|
|
2255
|
+
COLOR_ATTACHMENT4_WEBGL: 0x8ce4,
|
|
2256
|
+
COLOR_ATTACHMENT5_WEBGL: 0x8ce5,
|
|
2257
|
+
COLOR_ATTACHMENT6_WEBGL: 0x8ce6,
|
|
2258
|
+
COLOR_ATTACHMENT7_WEBGL: 0x8ce7,
|
|
2259
|
+
COLOR_ATTACHMENT8_WEBGL: 0x8ce8,
|
|
2260
|
+
COLOR_ATTACHMENT9_WEBGL: 0x8ce9,
|
|
2261
|
+
COLOR_ATTACHMENT10_WEBGL: 0x8cea,
|
|
2262
|
+
COLOR_ATTACHMENT11_WEBGL: 0x8ceb,
|
|
2263
|
+
COLOR_ATTACHMENT12_WEBGL: 0x8cec,
|
|
2264
|
+
COLOR_ATTACHMENT13_WEBGL: 0x8ced,
|
|
2265
|
+
COLOR_ATTACHMENT14_WEBGL: 0x8cee,
|
|
2266
|
+
COLOR_ATTACHMENT15_WEBGL: 0x8cef,
|
|
2267
|
+
DRAW_BUFFER0_WEBGL: 0x8825,
|
|
2268
|
+
DRAW_BUFFER1_WEBGL: 0x8826,
|
|
2269
|
+
DRAW_BUFFER2_WEBGL: 0x8827,
|
|
2270
|
+
DRAW_BUFFER3_WEBGL: 0x8828,
|
|
2271
|
+
DRAW_BUFFER4_WEBGL: 0x8829,
|
|
2272
|
+
DRAW_BUFFER5_WEBGL: 0x882a,
|
|
2273
|
+
DRAW_BUFFER6_WEBGL: 0x882b,
|
|
2274
|
+
DRAW_BUFFER7_WEBGL: 0x882c,
|
|
2275
|
+
DRAW_BUFFER8_WEBGL: 0x882d,
|
|
2276
|
+
DRAW_BUFFER9_WEBGL: 0x882e,
|
|
2277
|
+
DRAW_BUFFER10_WEBGL: 0x882f,
|
|
2278
|
+
DRAW_BUFFER11_WEBGL: 0x8830,
|
|
2279
|
+
DRAW_BUFFER12_WEBGL: 0x8831,
|
|
2280
|
+
DRAW_BUFFER13_WEBGL: 0x8832,
|
|
2281
|
+
DRAW_BUFFER14_WEBGL: 0x8833,
|
|
2282
|
+
DRAW_BUFFER15_WEBGL: 0x8834,
|
|
2283
|
+
MAX_COLOR_ATTACHMENTS_WEBGL: 0x8cdf,
|
|
2284
|
+
MAX_DRAW_BUFFERS_WEBGL: 0x8824,
|
|
2285
|
+
|
|
2286
|
+
// OES_vertex_array_object
|
|
2287
|
+
|
|
2288
|
+
VERTEX_ARRAY_BINDING_OES: 0x85b5,
|
|
2289
|
+
|
|
2290
|
+
// EXT_disjoint_timer_query
|
|
2291
|
+
|
|
2292
|
+
QUERY_COUNTER_BITS_EXT: 0x8864,
|
|
2293
|
+
CURRENT_QUERY_EXT: 0x8865,
|
|
2294
|
+
QUERY_RESULT_EXT: 0x8866,
|
|
2295
|
+
QUERY_RESULT_AVAILABLE_EXT: 0x8867,
|
|
2296
|
+
TIME_ELAPSED_EXT: 0x88bf,
|
|
2297
|
+
TIMESTAMP_EXT: 0x8e28,
|
|
2298
|
+
GPU_DISJOINT_EXT: 0x8fbb // A Boolean indicating whether or not the GPU performed any disjoint operation.
|
|
2299
|
+
});
|
|
2300
|
+
|
|
2301
|
+
|
|
2302
|
+
/***/ }),
|
|
2303
|
+
|
|
2304
|
+
/***/ "./src/bundle.js":
|
|
2305
|
+
/*!***********************!*\
|
|
2306
|
+
!*** ./src/bundle.js ***!
|
|
2307
|
+
\***********************/
|
|
2308
|
+
/*! no static exports found */
|
|
2309
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
2310
|
+
|
|
2311
|
+
const moduleExports = __webpack_require__(/*! ./index */ "./src/index.js");
|
|
2312
|
+
|
|
2313
|
+
// @ts-ignore
|
|
2314
|
+
globalThis.luma = globalThis.luma || {};
|
|
2315
|
+
// @ts-ignore
|
|
2316
|
+
module.exports = Object.assign(globalThis.luma, moduleExports);
|
|
2317
|
+
|
|
2318
|
+
|
|
2319
|
+
/***/ }),
|
|
2320
|
+
|
|
2321
|
+
/***/ "./src/context/context.js":
|
|
2322
|
+
/*!********************************!*\
|
|
2323
|
+
!*** ./src/context/context.js ***!
|
|
2324
|
+
\********************************/
|
|
2325
|
+
/*! exports provided: createGLContext, instrumentGLContext, getContextDebugInfo, resizeGLContext */
|
|
2326
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2327
|
+
|
|
2328
|
+
"use strict";
|
|
2329
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2330
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createGLContext", function() { return createGLContext; });
|
|
2331
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "instrumentGLContext", function() { return instrumentGLContext; });
|
|
2332
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getContextDebugInfo", function() { return getContextDebugInfo; });
|
|
2333
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resizeGLContext", function() { return resizeGLContext; });
|
|
2334
|
+
/* harmony import */ var _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @luma.gl/constants */ "../constants/src/index.js");
|
|
2335
|
+
/* harmony import */ var _probe_gl_env__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @probe.gl/env */ "../../node_modules/@probe.gl/env/dist/esm/index.js");
|
|
2336
|
+
/* harmony import */ var _state_tracker_track_context_state__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../state-tracker/track-context-state */ "./src/state-tracker/track-context-state.js");
|
|
2337
|
+
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/log */ "./src/utils/log.js");
|
|
2338
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/assert */ "./src/utils/assert.js");
|
|
2339
|
+
/* harmony import */ var _utils_device_pixels__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../utils/device-pixels */ "./src/utils/device-pixels.js");
|
|
2340
|
+
/* harmony import */ var _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../utils/webgl-checks */ "./src/utils/webgl-checks.js");
|
|
2341
|
+
// WebGLRenderingContext related methods
|
|
2342
|
+
|
|
2343
|
+
/** @typedef {import('./context')} types */
|
|
2344
|
+
|
|
2345
|
+
/* eslint-disable quotes */
|
|
2346
|
+
|
|
2347
|
+
|
|
2348
|
+
|
|
2349
|
+
|
|
2350
|
+
|
|
2351
|
+
|
|
2352
|
+
|
|
2353
|
+
|
|
2354
|
+
|
|
2355
|
+
const isBrowser = Object(_probe_gl_env__WEBPACK_IMPORTED_MODULE_1__["isBrowser"])();
|
|
2356
|
+
const isPage = isBrowser && typeof document !== 'undefined';
|
|
2357
|
+
|
|
2358
|
+
const CONTEXT_DEFAULTS = {
|
|
2359
|
+
// COMMON CONTEXT PARAMETERS
|
|
2360
|
+
// Attempt to allocate WebGL2 context
|
|
2361
|
+
webgl2: true, // Attempt to create a WebGL2 context (false to force webgl1)
|
|
2362
|
+
webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available)
|
|
2363
|
+
throwOnError: true,
|
|
2364
|
+
manageState: true,
|
|
2365
|
+
// BROWSER CONTEXT PARAMETERS
|
|
2366
|
+
canvas: null, // A canvas element or a canvas string id
|
|
2367
|
+
debug: false, // Instrument context (at the expense of performance)
|
|
2368
|
+
// HEADLESS CONTEXT PARAMETERS
|
|
2369
|
+
width: 800, // width are height are only used by headless gl
|
|
2370
|
+
height: 600
|
|
2371
|
+
// WEBGL/HEADLESS CONTEXT PARAMETERS
|
|
2372
|
+
// Remaining options are passed through to context creator
|
|
2373
|
+
};
|
|
2374
|
+
|
|
2375
|
+
/**
|
|
2376
|
+
* Creates a context giving access to the WebGL API
|
|
2377
|
+
* @type {types['createGLContext']}
|
|
2378
|
+
*/
|
|
2379
|
+
/* eslint-disable complexity, max-statements */
|
|
2380
|
+
function createGLContext(options = {}) {
|
|
2381
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_4__["assert"])(
|
|
2382
|
+
isBrowser,
|
|
2383
|
+
"createGLContext only available in the browser.\nCreate your own headless context or use 'createHeadlessContext' from @luma.gl/test-utils"
|
|
2384
|
+
);
|
|
2385
|
+
|
|
2386
|
+
options = Object.assign({}, CONTEXT_DEFAULTS, options);
|
|
2387
|
+
const {width, height} = options;
|
|
2388
|
+
|
|
2389
|
+
// Error reporting function, enables exceptions to be disabled
|
|
2390
|
+
function onError(message) {
|
|
2391
|
+
if (options.throwOnError) {
|
|
2392
|
+
throw new Error(message);
|
|
2393
|
+
}
|
|
2394
|
+
// eslint-disable-next-line
|
|
2395
|
+
console.error(message);
|
|
2396
|
+
return null;
|
|
2397
|
+
}
|
|
2398
|
+
options.onError = onError;
|
|
2399
|
+
|
|
2400
|
+
let gl;
|
|
2401
|
+
// Get or create a canvas
|
|
2402
|
+
const {canvas} = options;
|
|
2403
|
+
const targetCanvas = getCanvas({canvas, width, height, onError});
|
|
2404
|
+
// Create a WebGL context in the canvas
|
|
2405
|
+
gl = createBrowserContext(targetCanvas, options);
|
|
2406
|
+
|
|
2407
|
+
if (!gl) {
|
|
2408
|
+
return null;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
gl = instrumentGLContext(gl, options);
|
|
2412
|
+
|
|
2413
|
+
// Log some debug info about the newly created context
|
|
2414
|
+
logInfo(gl);
|
|
2415
|
+
|
|
2416
|
+
// Add to seer integration
|
|
2417
|
+
return gl;
|
|
2418
|
+
}
|
|
2419
|
+
|
|
2420
|
+
/**
|
|
2421
|
+
* Creates a context giving access to the WebGL API
|
|
2422
|
+
* @type {types['instrumentGLContext']}
|
|
2423
|
+
*/
|
|
2424
|
+
function instrumentGLContext(gl, options = {}) {
|
|
2425
|
+
// Avoid multiple instrumentations
|
|
2426
|
+
// @ts-ignore
|
|
2427
|
+
if (!gl || gl._instrumented) {
|
|
2428
|
+
return gl;
|
|
2429
|
+
}
|
|
2430
|
+
|
|
2431
|
+
// @ts-ignore
|
|
2432
|
+
gl._version = gl._version || getVersion(gl);
|
|
2433
|
+
|
|
2434
|
+
// Cache canvas size information to avoid setting it on every frame.
|
|
2435
|
+
// @ts-ignore
|
|
2436
|
+
gl.luma = gl.luma || {};
|
|
2437
|
+
// @ts-ignore
|
|
2438
|
+
gl.luma.canvasSizeInfo = gl.luma.canvasSizeInfo || {};
|
|
2439
|
+
|
|
2440
|
+
options = Object.assign({}, CONTEXT_DEFAULTS, options);
|
|
2441
|
+
const {manageState, debug} = options;
|
|
2442
|
+
|
|
2443
|
+
// Install context state tracking
|
|
2444
|
+
if (manageState) {
|
|
2445
|
+
Object(_state_tracker_track_context_state__WEBPACK_IMPORTED_MODULE_2__["trackContextState"])(gl, {
|
|
2446
|
+
copyState: false,
|
|
2447
|
+
log: (...args) => _utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].log(1, ...args)()
|
|
2448
|
+
});
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
// Add debug instrumentation to the context
|
|
2452
|
+
if (isBrowser && debug) {
|
|
2453
|
+
// @ts-ignore
|
|
2454
|
+
if (!globalThis.makeDebugContext) {
|
|
2455
|
+
_utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].warn('WebGL debug mode not activated. import "@luma.gl/debug" to enable.')();
|
|
2456
|
+
} else {
|
|
2457
|
+
// @ts-ignore
|
|
2458
|
+
gl = globalThis.makeDebugContext(gl, options);
|
|
2459
|
+
// Debug forces log level to at least 1
|
|
2460
|
+
_utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].level = Math.max(_utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].level, 1);
|
|
2461
|
+
}
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
// @ts-ignore
|
|
2465
|
+
gl._instrumented = true;
|
|
2466
|
+
|
|
2467
|
+
return gl;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
/**
|
|
2471
|
+
* Provides strings identifying the GPU vendor and driver.
|
|
2472
|
+
* @type {types['getContextDebugInfo']}
|
|
2473
|
+
*/
|
|
2474
|
+
function getContextDebugInfo(gl) {
|
|
2475
|
+
const vendorMasked = gl.getParameter(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VENDOR);
|
|
2476
|
+
const rendererMasked = gl.getParameter(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RENDERER);
|
|
2477
|
+
const ext = gl.getExtension('WEBGL_debug_renderer_info');
|
|
2478
|
+
const vendorUnmasked = ext && gl.getParameter(ext.UNMASKED_VENDOR_WEBGL || _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VENDOR);
|
|
2479
|
+
const rendererUnmasked = ext && gl.getParameter(ext.UNMASKED_RENDERER_WEBGL || _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RENDERER);
|
|
2480
|
+
return {
|
|
2481
|
+
vendor: vendorUnmasked || vendorMasked,
|
|
2482
|
+
renderer: rendererUnmasked || rendererMasked,
|
|
2483
|
+
vendorMasked,
|
|
2484
|
+
rendererMasked,
|
|
2485
|
+
version: gl.getParameter(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VERSION),
|
|
2486
|
+
shadingLanguageVersion: gl.getParameter(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SHADING_LANGUAGE_VERSION)
|
|
2487
|
+
};
|
|
2488
|
+
}
|
|
2489
|
+
|
|
2490
|
+
/**
|
|
2491
|
+
* Resize the canvas' drawing buffer.
|
|
2492
|
+
* @type {types['resizeGLContext']}
|
|
2493
|
+
*/
|
|
2494
|
+
function resizeGLContext(gl, options = {}) {
|
|
2495
|
+
// Resize browser context
|
|
2496
|
+
if (gl.canvas) {
|
|
2497
|
+
const devicePixelRatio = Object(_utils_device_pixels__WEBPACK_IMPORTED_MODULE_5__["getDevicePixelRatio"])(options.useDevicePixels);
|
|
2498
|
+
setDevicePixelRatio(gl, devicePixelRatio, options);
|
|
2499
|
+
return;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
// Resize headless gl context
|
|
2503
|
+
const ext = gl.getExtension('STACKGL_resize_drawingbuffer');
|
|
2504
|
+
if (ext && `width` in options && `height` in options) {
|
|
2505
|
+
ext.resize(options.width, options.height);
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
// HELPER METHODS
|
|
2510
|
+
|
|
2511
|
+
/**
|
|
2512
|
+
* Create a WebGL context for a canvas
|
|
2513
|
+
* Note calling this multiple time on the same canvas does return the same context
|
|
2514
|
+
*/
|
|
2515
|
+
|
|
2516
|
+
function createBrowserContext(canvas, options) {
|
|
2517
|
+
const {onError} = options;
|
|
2518
|
+
|
|
2519
|
+
// Try to extract any extra information about why context creation failed
|
|
2520
|
+
let errorMessage = null;
|
|
2521
|
+
const onCreateError = error => (errorMessage = error.statusMessage || errorMessage);
|
|
2522
|
+
canvas.addEventListener('webglcontextcreationerror', onCreateError, false);
|
|
2523
|
+
|
|
2524
|
+
const {webgl1 = true, webgl2 = true} = options;
|
|
2525
|
+
let gl = null;
|
|
2526
|
+
// Prefer webgl2 over webgl1, prefer conformant over experimental
|
|
2527
|
+
if (webgl2) {
|
|
2528
|
+
gl = gl || canvas.getContext('webgl2', options);
|
|
2529
|
+
gl = gl || canvas.getContext('experimental-webgl2', options);
|
|
2530
|
+
}
|
|
2531
|
+
if (webgl1) {
|
|
2532
|
+
gl = gl || canvas.getContext('webgl', options);
|
|
2533
|
+
gl = gl || canvas.getContext('experimental-webgl', options);
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
canvas.removeEventListener('webglcontextcreationerror', onCreateError, false);
|
|
2537
|
+
|
|
2538
|
+
if (!gl) {
|
|
2539
|
+
return onError(
|
|
2540
|
+
`Failed to create ${webgl2 && !webgl1 ? 'WebGL2' : 'WebGL'} context: ${errorMessage ||
|
|
2541
|
+
'Unknown error'}`
|
|
2542
|
+
);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
if (options.onContextLost) {
|
|
2546
|
+
canvas.addEventListener('webglcontextlost', options.onContextLost, false);
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
if (options.onContextRestored) {
|
|
2550
|
+
canvas.addEventListener('webglcontextrestored', options.onContextRestored, false);
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
return gl;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
function getCanvas({canvas, width = 800, height = 600, onError}) {
|
|
2557
|
+
let targetCanvas;
|
|
2558
|
+
if (typeof canvas === 'string') {
|
|
2559
|
+
const isPageLoaded = isPage && document.readyState === 'complete';
|
|
2560
|
+
if (!isPageLoaded) {
|
|
2561
|
+
onError(`createGLContext called on canvas '${canvas}' before page was loaded`);
|
|
2562
|
+
}
|
|
2563
|
+
targetCanvas = document.getElementById(canvas);
|
|
2564
|
+
} else if (canvas) {
|
|
2565
|
+
targetCanvas = canvas;
|
|
2566
|
+
} else {
|
|
2567
|
+
targetCanvas = document.createElement('canvas');
|
|
2568
|
+
targetCanvas.id = 'lumagl-canvas';
|
|
2569
|
+
targetCanvas.style.width = Number.isFinite(width) ? `${width}px` : '100%';
|
|
2570
|
+
targetCanvas.style.height = Number.isFinite(height) ? `${height}px` : '100%';
|
|
2571
|
+
document.body.insertBefore(targetCanvas, document.body.firstChild);
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
return targetCanvas;
|
|
2575
|
+
}
|
|
2576
|
+
|
|
2577
|
+
function logInfo(gl) {
|
|
2578
|
+
const webGL = Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_6__["isWebGL2"])(gl) ? 'WebGL2' : 'WebGL1';
|
|
2579
|
+
const info = getContextDebugInfo(gl);
|
|
2580
|
+
const driver = info ? `(${info.vendor},${info.renderer})` : '';
|
|
2581
|
+
const debug = gl.debug ? ' debug' : '';
|
|
2582
|
+
_utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].info(1, `${webGL}${debug} context ${driver}`)();
|
|
2583
|
+
}
|
|
2584
|
+
|
|
2585
|
+
function getVersion(gl) {
|
|
2586
|
+
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
2587
|
+
// WebGL2 context.
|
|
2588
|
+
return 2;
|
|
2589
|
+
}
|
|
2590
|
+
// Must be a WebGL1 context.
|
|
2591
|
+
return 1;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
// use devicePixelRatio to set canvas width and height
|
|
2595
|
+
function setDevicePixelRatio(gl, devicePixelRatio, options) {
|
|
2596
|
+
// NOTE: if options.width and options.height not used remove in v8
|
|
2597
|
+
let clientWidth = 'width' in options ? options.width : gl.canvas.clientWidth;
|
|
2598
|
+
let clientHeight = 'height' in options ? options.height : gl.canvas.clientHeight;
|
|
2599
|
+
|
|
2600
|
+
if (!clientWidth || !clientHeight) {
|
|
2601
|
+
_utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].log(1, 'Canvas clientWidth/clientHeight is 0')();
|
|
2602
|
+
// by forcing devicePixel ratio to 1, we do not scale gl.canvas.width and height in each frame.
|
|
2603
|
+
devicePixelRatio = 1;
|
|
2604
|
+
clientWidth = gl.canvas.width || 1;
|
|
2605
|
+
clientHeight = gl.canvas.height || 1;
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
gl.luma = gl.luma || {};
|
|
2609
|
+
gl.luma.canvasSizeInfo = gl.luma.canvasSizeInfo || {};
|
|
2610
|
+
const cachedSize = gl.luma.canvasSizeInfo;
|
|
2611
|
+
// Check if canvas needs to be resized
|
|
2612
|
+
if (
|
|
2613
|
+
cachedSize.clientWidth !== clientWidth ||
|
|
2614
|
+
cachedSize.clientHeight !== clientHeight ||
|
|
2615
|
+
cachedSize.devicePixelRatio !== devicePixelRatio
|
|
2616
|
+
) {
|
|
2617
|
+
let clampedPixelRatio = devicePixelRatio;
|
|
2618
|
+
|
|
2619
|
+
const canvasWidth = Math.floor(clientWidth * clampedPixelRatio);
|
|
2620
|
+
const canvasHeight = Math.floor(clientHeight * clampedPixelRatio);
|
|
2621
|
+
gl.canvas.width = canvasWidth;
|
|
2622
|
+
gl.canvas.height = canvasHeight;
|
|
2623
|
+
|
|
2624
|
+
// Note: when devicePixelRatio is too high, it is possible we might hit system limit for
|
|
2625
|
+
// drawing buffer width and hight, in those cases they get clamped and resulting aspect ration may not be maintained
|
|
2626
|
+
// for those cases, reduce devicePixelRatio.
|
|
2627
|
+
if (gl.drawingBufferWidth !== canvasWidth || gl.drawingBufferHeight !== canvasHeight) {
|
|
2628
|
+
_utils_log__WEBPACK_IMPORTED_MODULE_3__["log"].warn(`Device pixel ratio clamped`)();
|
|
2629
|
+
clampedPixelRatio = Math.min(
|
|
2630
|
+
gl.drawingBufferWidth / clientWidth,
|
|
2631
|
+
gl.drawingBufferHeight / clientHeight
|
|
2632
|
+
);
|
|
2633
|
+
|
|
2634
|
+
gl.canvas.width = Math.floor(clientWidth * clampedPixelRatio);
|
|
2635
|
+
gl.canvas.height = Math.floor(clientHeight * clampedPixelRatio);
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
Object.assign(gl.luma.canvasSizeInfo, {clientWidth, clientHeight, devicePixelRatio});
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
|
|
2643
|
+
/***/ }),
|
|
2644
|
+
|
|
2645
|
+
/***/ "./src/index.js":
|
|
2646
|
+
/*!**********************!*\
|
|
2647
|
+
!*** ./src/index.js ***!
|
|
2648
|
+
\**********************/
|
|
2649
|
+
/*! exports provided: log, isWebGL, isWebGL2, getWebGL2Context, assertWebGLContext, assertWebGL2Context, polyfillContext, getParameters, setParameters, resetParameters, withParameters, trackContextState, pushContextState, popContextState, createGLContext, resizeGLContext, instrumentGLContext, getContextDebugInfo, cssToDeviceRatio, cssToDevicePixels */
|
|
2650
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2651
|
+
|
|
2652
|
+
"use strict";
|
|
2653
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2654
|
+
/* harmony import */ var _utils_log__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./utils/log */ "./src/utils/log.js");
|
|
2655
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "log", function() { return _utils_log__WEBPACK_IMPORTED_MODULE_0__["log"]; });
|
|
2656
|
+
|
|
2657
|
+
/* harmony import */ var _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./utils/webgl-checks */ "./src/utils/webgl-checks.js");
|
|
2658
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWebGL", function() { return _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL"]; });
|
|
2659
|
+
|
|
2660
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isWebGL2", function() { return _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"]; });
|
|
2661
|
+
|
|
2662
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getWebGL2Context", function() { return _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["getWebGL2Context"]; });
|
|
2663
|
+
|
|
2664
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "assertWebGLContext", function() { return _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["assertWebGLContext"]; });
|
|
2665
|
+
|
|
2666
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "assertWebGL2Context", function() { return _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["assertWebGL2Context"]; });
|
|
2667
|
+
|
|
2668
|
+
/* harmony import */ var _polyfill_polyfill_context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./polyfill/polyfill-context */ "./src/polyfill/polyfill-context.js");
|
|
2669
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "polyfillContext", function() { return _polyfill_polyfill_context__WEBPACK_IMPORTED_MODULE_2__["polyfillContext"]; });
|
|
2670
|
+
|
|
2671
|
+
/* harmony import */ var _state_tracker_unified_parameter_api__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./state-tracker/unified-parameter-api */ "./src/state-tracker/unified-parameter-api.js");
|
|
2672
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getParameters", function() { return _state_tracker_unified_parameter_api__WEBPACK_IMPORTED_MODULE_3__["getParameters"]; });
|
|
2673
|
+
|
|
2674
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "setParameters", function() { return _state_tracker_unified_parameter_api__WEBPACK_IMPORTED_MODULE_3__["setParameters"]; });
|
|
2675
|
+
|
|
2676
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resetParameters", function() { return _state_tracker_unified_parameter_api__WEBPACK_IMPORTED_MODULE_3__["resetParameters"]; });
|
|
2677
|
+
|
|
2678
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withParameters", function() { return _state_tracker_unified_parameter_api__WEBPACK_IMPORTED_MODULE_3__["withParameters"]; });
|
|
2679
|
+
|
|
2680
|
+
/* harmony import */ var _state_tracker_track_context_state__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./state-tracker/track-context-state */ "./src/state-tracker/track-context-state.js");
|
|
2681
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "trackContextState", function() { return _state_tracker_track_context_state__WEBPACK_IMPORTED_MODULE_4__["trackContextState"]; });
|
|
2682
|
+
|
|
2683
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pushContextState", function() { return _state_tracker_track_context_state__WEBPACK_IMPORTED_MODULE_4__["pushContextState"]; });
|
|
2684
|
+
|
|
2685
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "popContextState", function() { return _state_tracker_track_context_state__WEBPACK_IMPORTED_MODULE_4__["popContextState"]; });
|
|
2686
|
+
|
|
2687
|
+
/* harmony import */ var _context_context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./context/context */ "./src/context/context.js");
|
|
2688
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "createGLContext", function() { return _context_context__WEBPACK_IMPORTED_MODULE_5__["createGLContext"]; });
|
|
2689
|
+
|
|
2690
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "resizeGLContext", function() { return _context_context__WEBPACK_IMPORTED_MODULE_5__["resizeGLContext"]; });
|
|
2691
|
+
|
|
2692
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "instrumentGLContext", function() { return _context_context__WEBPACK_IMPORTED_MODULE_5__["instrumentGLContext"]; });
|
|
2693
|
+
|
|
2694
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "getContextDebugInfo", function() { return _context_context__WEBPACK_IMPORTED_MODULE_5__["getContextDebugInfo"]; });
|
|
2695
|
+
|
|
2696
|
+
/* harmony import */ var _utils_device_pixels__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/device-pixels */ "./src/utils/device-pixels.js");
|
|
2697
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cssToDeviceRatio", function() { return _utils_device_pixels__WEBPACK_IMPORTED_MODULE_6__["cssToDeviceRatio"]; });
|
|
2698
|
+
|
|
2699
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "cssToDevicePixels", function() { return _utils_device_pixels__WEBPACK_IMPORTED_MODULE_6__["cssToDevicePixels"]; });
|
|
2700
|
+
|
|
2701
|
+
// Utils
|
|
2702
|
+
|
|
2703
|
+
|
|
2704
|
+
|
|
2705
|
+
// Polyfills to support a subset of WebGL2 APIs on WebGL1 contexts
|
|
2706
|
+
|
|
2707
|
+
|
|
2708
|
+
// unified parameter APIs
|
|
2709
|
+
|
|
2710
|
+
|
|
2711
|
+
// state tracking
|
|
2712
|
+
|
|
2713
|
+
|
|
2714
|
+
|
|
2715
|
+
|
|
2716
|
+
|
|
2717
|
+
|
|
2718
|
+
|
|
2719
|
+
/***/ }),
|
|
2720
|
+
|
|
2721
|
+
/***/ "./src/polyfill/get-parameter-polyfill.js":
|
|
2722
|
+
/*!************************************************!*\
|
|
2723
|
+
!*** ./src/polyfill/get-parameter-polyfill.js ***!
|
|
2724
|
+
\************************************************/
|
|
2725
|
+
/*! exports provided: getParameterPolyfill */
|
|
2726
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2727
|
+
|
|
2728
|
+
"use strict";
|
|
2729
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2730
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getParameterPolyfill", function() { return getParameterPolyfill; });
|
|
2731
|
+
/* harmony import */ var _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @luma.gl/constants */ "../constants/src/index.js");
|
|
2732
|
+
/* harmony import */ var _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/webgl-checks */ "./src/utils/webgl-checks.js");
|
|
2733
|
+
/* eslint-disable no-inline-comments, max-len, camelcase */
|
|
2734
|
+
|
|
2735
|
+
|
|
2736
|
+
|
|
2737
|
+
const OES_element_index = 'OES_element_index';
|
|
2738
|
+
const WEBGL_draw_buffers = 'WEBGL_draw_buffers';
|
|
2739
|
+
const EXT_disjoint_timer_query = 'EXT_disjoint_timer_query';
|
|
2740
|
+
const EXT_disjoint_timer_query_webgl2 = 'EXT_disjoint_timer_query_webgl2';
|
|
2741
|
+
const EXT_texture_filter_anisotropic = 'EXT_texture_filter_anisotropic';
|
|
2742
|
+
const WEBGL_debug_renderer_info = 'WEBGL_debug_renderer_info';
|
|
2743
|
+
|
|
2744
|
+
const GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8b8b;
|
|
2745
|
+
const GL_DONT_CARE = 0x1100;
|
|
2746
|
+
const GL_GPU_DISJOINT_EXT = 0x8fbb;
|
|
2747
|
+
const GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84ff;
|
|
2748
|
+
const GL_UNMASKED_VENDOR_WEBGL = 0x9245; // vendor string of the graphics driver.
|
|
2749
|
+
const GL_UNMASKED_RENDERER_WEBGL = 0x9246; // renderer string of the graphics driver.
|
|
2750
|
+
|
|
2751
|
+
const getWebGL2ValueOrZero = gl => (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl) ? 0 : undefined);
|
|
2752
|
+
|
|
2753
|
+
// if a function returns undefined in this table,
|
|
2754
|
+
// the original getParameter will be called, defeating the override
|
|
2755
|
+
const WEBGL_PARAMETERS = {
|
|
2756
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_BUFFER]: gl => (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl) ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_ATTACHMENT0 : undefined),
|
|
2757
|
+
|
|
2758
|
+
// WebGL2 context parameters
|
|
2759
|
+
[GL_FRAGMENT_SHADER_DERIVATIVE_HINT]: gl => (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl) ? GL_DONT_CARE : undefined),
|
|
2760
|
+
|
|
2761
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RASTERIZER_DISCARD]: getWebGL2ValueOrZero,
|
|
2762
|
+
|
|
2763
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLES]: getWebGL2ValueOrZero,
|
|
2764
|
+
|
|
2765
|
+
// WebGL2 extension context parameters
|
|
2766
|
+
[GL_GPU_DISJOINT_EXT]: (gl, getParameter) => {
|
|
2767
|
+
const ext = Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl)
|
|
2768
|
+
? gl.getExtension(EXT_disjoint_timer_query_webgl2)
|
|
2769
|
+
: gl.getExtension(EXT_disjoint_timer_query);
|
|
2770
|
+
return ext && ext.GPU_DISJOINT_EXT ? getParameter(ext.GPU_DISJOINT_EXT) : 0;
|
|
2771
|
+
},
|
|
2772
|
+
|
|
2773
|
+
// Extension fixed values
|
|
2774
|
+
[GL_UNMASKED_VENDOR_WEBGL]: (gl, getParameter) => {
|
|
2775
|
+
const ext = gl.getExtension(WEBGL_debug_renderer_info);
|
|
2776
|
+
return getParameter((ext && ext.UNMASKED_VENDOR_WEBGL) || _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VENDOR);
|
|
2777
|
+
},
|
|
2778
|
+
|
|
2779
|
+
[GL_UNMASKED_RENDERER_WEBGL]: (gl, getParameter) => {
|
|
2780
|
+
const ext = gl.getExtension(WEBGL_debug_renderer_info);
|
|
2781
|
+
return getParameter((ext && ext.UNMASKED_RENDERER_WEBGL) || _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RENDERER);
|
|
2782
|
+
},
|
|
2783
|
+
|
|
2784
|
+
// Extension LIMITS
|
|
2785
|
+
[GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT]: (gl, getParameter) => {
|
|
2786
|
+
const ext = gl.luma.extensions[EXT_texture_filter_anisotropic];
|
|
2787
|
+
return ext ? getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1.0;
|
|
2788
|
+
},
|
|
2789
|
+
|
|
2790
|
+
// WebGL2 Limits
|
|
2791
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_3D_TEXTURE_SIZE]: getWebGL2ValueOrZero,
|
|
2792
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_ARRAY_TEXTURE_LAYERS]: getWebGL2ValueOrZero,
|
|
2793
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: getWebGL2ValueOrZero,
|
|
2794
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_COLOR_ATTACHMENTS]: (gl, getParameter) => {
|
|
2795
|
+
if (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl)) {
|
|
2796
|
+
const ext = gl.getExtension(WEBGL_draw_buffers);
|
|
2797
|
+
return ext ? getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL) : 0;
|
|
2798
|
+
}
|
|
2799
|
+
return undefined;
|
|
2800
|
+
},
|
|
2801
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2802
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_COMBINED_UNIFORM_BLOCKS]: getWebGL2ValueOrZero,
|
|
2803
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2804
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_DRAW_BUFFERS]: gl => {
|
|
2805
|
+
if (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl)) {
|
|
2806
|
+
const ext = gl.getExtension(WEBGL_draw_buffers);
|
|
2807
|
+
return ext ? ext.MAX_DRAW_BUFFERS_WEBGL : 0;
|
|
2808
|
+
}
|
|
2809
|
+
return undefined;
|
|
2810
|
+
},
|
|
2811
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_ELEMENT_INDEX]:
|
|
2812
|
+
// Guess: per webglstats.com 99.6% of webgl2 supports 2147483647
|
|
2813
|
+
gl => (gl.getExtension(OES_element_index) ? 2147483647 : 65535),
|
|
2814
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_ELEMENTS_INDICES]:
|
|
2815
|
+
// Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
|
|
2816
|
+
gl => (gl.getExtension(OES_element_index) ? 16777216 : 65535),
|
|
2817
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_ELEMENTS_VERTICES]:
|
|
2818
|
+
// Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices)
|
|
2819
|
+
gl => 16777216,
|
|
2820
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_FRAGMENT_INPUT_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2821
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_FRAGMENT_UNIFORM_BLOCKS]: getWebGL2ValueOrZero,
|
|
2822
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_FRAGMENT_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2823
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_SAMPLES]: getWebGL2ValueOrZero,
|
|
2824
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_SERVER_WAIT_TIMEOUT]: getWebGL2ValueOrZero,
|
|
2825
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_TEXTURE_LOD_BIAS]: getWebGL2ValueOrZero,
|
|
2826
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2827
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: getWebGL2ValueOrZero,
|
|
2828
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2829
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_UNIFORM_BLOCK_SIZE]: getWebGL2ValueOrZero,
|
|
2830
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_UNIFORM_BUFFER_BINDINGS]: getWebGL2ValueOrZero,
|
|
2831
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_VARYING_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2832
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_VERTEX_OUTPUT_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2833
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_VERTEX_UNIFORM_BLOCKS]: getWebGL2ValueOrZero,
|
|
2834
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_VERTEX_UNIFORM_COMPONENTS]: getWebGL2ValueOrZero,
|
|
2835
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MIN_PROGRAM_TEXEL_OFFSET]: getWebGL2ValueOrZero,
|
|
2836
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].MAX_PROGRAM_TEXEL_OFFSET]: getWebGL2ValueOrZero,
|
|
2837
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNIFORM_BUFFER_OFFSET_ALIGNMENT]: getWebGL2ValueOrZero
|
|
2838
|
+
};
|
|
2839
|
+
|
|
2840
|
+
// A "replacement" gl.getParameter that accepts "enums" from extensions and WebGL2
|
|
2841
|
+
// and returns reasonably safe defaults
|
|
2842
|
+
function getParameterPolyfill(gl, originalGetParameter, pname) {
|
|
2843
|
+
// Return mock limits (usually 0) for WebGL2 constants to ensure these
|
|
2844
|
+
// can be queries without error
|
|
2845
|
+
const limit = WEBGL_PARAMETERS[pname];
|
|
2846
|
+
// @ts-ignore TODO pname parameter not declared
|
|
2847
|
+
const value = typeof limit === 'function' ? limit(gl, originalGetParameter, pname) : limit;
|
|
2848
|
+
const result = value !== undefined ? value : originalGetParameter(pname);
|
|
2849
|
+
return result;
|
|
2850
|
+
}
|
|
2851
|
+
|
|
2852
|
+
|
|
2853
|
+
/***/ }),
|
|
2854
|
+
|
|
2855
|
+
/***/ "./src/polyfill/polyfill-context.js":
|
|
2856
|
+
/*!******************************************!*\
|
|
2857
|
+
!*** ./src/polyfill/polyfill-context.js ***!
|
|
2858
|
+
\******************************************/
|
|
2859
|
+
/*! exports provided: polyfillContext */
|
|
2860
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2861
|
+
|
|
2862
|
+
"use strict";
|
|
2863
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2864
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polyfillContext", function() { return polyfillContext; });
|
|
2865
|
+
/* harmony import */ var _polyfill_vertex_array_object__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./polyfill-vertex-array-object */ "./src/polyfill/polyfill-vertex-array-object.js");
|
|
2866
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/assert */ "./src/utils/assert.js");
|
|
2867
|
+
/* harmony import */ var _polyfill_table__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./polyfill-table */ "./src/polyfill/polyfill-table.js");
|
|
2868
|
+
// WebGL1/WebGL2 extension polyfill support
|
|
2869
|
+
//
|
|
2870
|
+
// Provides a function that creates polyfills for WebGL2 functions based
|
|
2871
|
+
// on available extensions and installs them on a supplied target (could be
|
|
2872
|
+
// the WebGLContext or its prototype, or a separate object).
|
|
2873
|
+
//
|
|
2874
|
+
// This is intended to be a stand-alone file with minimal dependencies,
|
|
2875
|
+
// easy to reuse or repurpose in other projects.
|
|
2876
|
+
|
|
2877
|
+
/** @typedef {import('./polyfill-context')} types */
|
|
2878
|
+
|
|
2879
|
+
|
|
2880
|
+
|
|
2881
|
+
|
|
2882
|
+
|
|
2883
|
+
|
|
2884
|
+
/** @type {types['polyfillContext']} */
|
|
2885
|
+
function polyfillContext(gl) {
|
|
2886
|
+
// @ts-ignore
|
|
2887
|
+
gl.luma = gl.luma || {};
|
|
2888
|
+
// @ts-ignore
|
|
2889
|
+
const {luma} = gl;
|
|
2890
|
+
|
|
2891
|
+
if (!luma.polyfilled) {
|
|
2892
|
+
Object(_polyfill_vertex_array_object__WEBPACK_IMPORTED_MODULE_0__["polyfillVertexArrayObject"])(gl);
|
|
2893
|
+
initializeExtensions(gl);
|
|
2894
|
+
installPolyfills(gl, _polyfill_table__WEBPACK_IMPORTED_MODULE_2__["WEBGL2_CONTEXT_POLYFILLS"]);
|
|
2895
|
+
installOverrides(gl, {target: luma, target2: gl});
|
|
2896
|
+
luma.polyfilled = true;
|
|
2897
|
+
}
|
|
2898
|
+
|
|
2899
|
+
// TODO - only supporting a few members
|
|
2900
|
+
/** @type {WebGL2RenderingContext} */
|
|
2901
|
+
// @ts-ignore
|
|
2902
|
+
return gl;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
// TODO - is this still required?
|
|
2906
|
+
// @ts-ignore
|
|
2907
|
+
globalThis.polyfillContext = polyfillContext;
|
|
2908
|
+
|
|
2909
|
+
function initializeExtensions(gl) {
|
|
2910
|
+
gl.luma.extensions = {};
|
|
2911
|
+
// `getSupportedExtensions` can return null when context is lost.
|
|
2912
|
+
const EXTENSIONS = gl.getSupportedExtensions() || [];
|
|
2913
|
+
for (const extension of EXTENSIONS) {
|
|
2914
|
+
gl.luma[extension] = gl.getExtension(extension);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
|
|
2918
|
+
// Install simple overrides (mostly get* functions)
|
|
2919
|
+
function installOverrides(gl, {target, target2}) {
|
|
2920
|
+
Object.keys(_polyfill_table__WEBPACK_IMPORTED_MODULE_2__["WEBGL2_CONTEXT_OVERRIDES"]).forEach(key => {
|
|
2921
|
+
if (typeof _polyfill_table__WEBPACK_IMPORTED_MODULE_2__["WEBGL2_CONTEXT_OVERRIDES"][key] === 'function') {
|
|
2922
|
+
// install an override, if no implementation was detected
|
|
2923
|
+
const originalFunc = gl[key] ? gl[key].bind(gl) : () => {};
|
|
2924
|
+
const polyfill = _polyfill_table__WEBPACK_IMPORTED_MODULE_2__["WEBGL2_CONTEXT_OVERRIDES"][key].bind(null, gl, originalFunc);
|
|
2925
|
+
target[key] = polyfill;
|
|
2926
|
+
target2[key] = polyfill;
|
|
2927
|
+
}
|
|
2928
|
+
});
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
function installPolyfills(gl, polyfills) {
|
|
2932
|
+
for (const extension of Object.getOwnPropertyNames(polyfills)) {
|
|
2933
|
+
if (extension !== 'overrides') {
|
|
2934
|
+
polyfillExtension(gl, {extension, target: gl.luma, target2: gl});
|
|
2935
|
+
}
|
|
2936
|
+
}
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
// Polyfills a single WebGL extension into the `target` object
|
|
2940
|
+
function polyfillExtension(gl, {extension, target, target2}) {
|
|
2941
|
+
const defaults = _polyfill_table__WEBPACK_IMPORTED_MODULE_2__["WEBGL2_CONTEXT_POLYFILLS"][extension];
|
|
2942
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(defaults);
|
|
2943
|
+
|
|
2944
|
+
const {meta = {}} = defaults;
|
|
2945
|
+
const {suffix = ''} = meta;
|
|
2946
|
+
|
|
2947
|
+
const ext = gl.getExtension(extension);
|
|
2948
|
+
|
|
2949
|
+
for (const key of Object.keys(defaults)) {
|
|
2950
|
+
const extKey = `${key}${suffix}`;
|
|
2951
|
+
|
|
2952
|
+
let polyfill = null;
|
|
2953
|
+
if (key === 'meta') {
|
|
2954
|
+
// ignore
|
|
2955
|
+
} else if (typeof gl[key] === 'function') {
|
|
2956
|
+
// WebGL2 implementation is already
|
|
2957
|
+
} else if (ext && typeof ext[extKey] === 'function') {
|
|
2958
|
+
// pick extension implemenentation,if available
|
|
2959
|
+
polyfill = (...args) => ext[extKey](...args);
|
|
2960
|
+
} else if (typeof defaults[key] === 'function') {
|
|
2961
|
+
// pick the mock implementation, if no implementation was detected
|
|
2962
|
+
polyfill = defaults[key].bind(target);
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
if (polyfill) {
|
|
2966
|
+
target[key] = polyfill;
|
|
2967
|
+
target2[key] = polyfill;
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
|
|
2973
|
+
/***/ }),
|
|
2974
|
+
|
|
2975
|
+
/***/ "./src/polyfill/polyfill-table.js":
|
|
2976
|
+
/*!****************************************!*\
|
|
2977
|
+
!*** ./src/polyfill/polyfill-table.js ***!
|
|
2978
|
+
\****************************************/
|
|
2979
|
+
/*! exports provided: WEBGL2_CONTEXT_POLYFILLS, WEBGL2_CONTEXT_OVERRIDES */
|
|
2980
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2981
|
+
|
|
2982
|
+
"use strict";
|
|
2983
|
+
__webpack_require__.r(__webpack_exports__);
|
|
2984
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WEBGL2_CONTEXT_POLYFILLS", function() { return WEBGL2_CONTEXT_POLYFILLS; });
|
|
2985
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WEBGL2_CONTEXT_OVERRIDES", function() { return WEBGL2_CONTEXT_OVERRIDES; });
|
|
2986
|
+
/* harmony import */ var _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @luma.gl/constants */ "../constants/src/index.js");
|
|
2987
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/assert */ "./src/utils/assert.js");
|
|
2988
|
+
/* harmony import */ var _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/webgl-checks */ "./src/utils/webgl-checks.js");
|
|
2989
|
+
/* harmony import */ var _get_parameter_polyfill__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./get-parameter-polyfill */ "./src/polyfill/get-parameter-polyfill.js");
|
|
2990
|
+
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
|
|
2994
|
+
|
|
2995
|
+
|
|
2996
|
+
const OES_vertex_array_object = 'OES_vertex_array_object';
|
|
2997
|
+
const ANGLE_instanced_arrays = 'ANGLE_instanced_arrays';
|
|
2998
|
+
const WEBGL_draw_buffers = 'WEBGL_draw_buffers';
|
|
2999
|
+
const EXT_disjoint_timer_query = 'EXT_disjoint_timer_query';
|
|
3000
|
+
const EXT_texture_filter_anisotropic = 'EXT_texture_filter_anisotropic';
|
|
3001
|
+
|
|
3002
|
+
const ERR_VAO_NOT_SUPPORTED = 'VertexArray requires WebGL2 or OES_vertex_array_object extension';
|
|
3003
|
+
|
|
3004
|
+
// Return object with webgl2 flag and an extension
|
|
3005
|
+
function getExtensionData(gl, extension) {
|
|
3006
|
+
return {
|
|
3007
|
+
webgl2: Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_2__["isWebGL2"])(gl),
|
|
3008
|
+
ext: gl.getExtension(extension)
|
|
3009
|
+
};
|
|
3010
|
+
}
|
|
3011
|
+
|
|
3012
|
+
// function mapExtensionConstant(gl, constant) {
|
|
3013
|
+
// switch (constant) {
|
|
3014
|
+
// case ext.FRAGMENT_SHADER_DERIVATIVE_HINT_OES: return GL.FRAGMENT_SHADER_DERIVATIVE_HINT;
|
|
3015
|
+
// }
|
|
3016
|
+
// }
|
|
3017
|
+
|
|
3018
|
+
const WEBGL2_CONTEXT_POLYFILLS = {
|
|
3019
|
+
// POLYFILL TABLE
|
|
3020
|
+
[OES_vertex_array_object]: {
|
|
3021
|
+
meta: {suffix: 'OES'},
|
|
3022
|
+
// NEW METHODS
|
|
3023
|
+
createVertexArray: () => {
|
|
3024
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(false, ERR_VAO_NOT_SUPPORTED);
|
|
3025
|
+
},
|
|
3026
|
+
deleteVertexArray: () => {},
|
|
3027
|
+
bindVertexArray: () => {},
|
|
3028
|
+
isVertexArray: () => false
|
|
3029
|
+
},
|
|
3030
|
+
[ANGLE_instanced_arrays]: {
|
|
3031
|
+
meta: {
|
|
3032
|
+
suffix: 'ANGLE'
|
|
3033
|
+
// constants: {
|
|
3034
|
+
// VERTEX_ATTRIB_ARRAY_DIVISOR: 'VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE'
|
|
3035
|
+
// }
|
|
3036
|
+
},
|
|
3037
|
+
vertexAttribDivisor(location, divisor) {
|
|
3038
|
+
// Accept divisor 0 even if instancing is not supported (0 = no instancing)
|
|
3039
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(divisor === 0, 'WebGL instanced rendering not supported');
|
|
3040
|
+
},
|
|
3041
|
+
drawElementsInstanced: () => {},
|
|
3042
|
+
drawArraysInstanced: () => {}
|
|
3043
|
+
},
|
|
3044
|
+
[WEBGL_draw_buffers]: {
|
|
3045
|
+
meta: {
|
|
3046
|
+
suffix: 'WEBGL'
|
|
3047
|
+
},
|
|
3048
|
+
drawBuffers: () => {
|
|
3049
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(false);
|
|
3050
|
+
}
|
|
3051
|
+
},
|
|
3052
|
+
[EXT_disjoint_timer_query]: {
|
|
3053
|
+
meta: {suffix: 'EXT'},
|
|
3054
|
+
// WebGL1: Polyfills the WebGL2 Query API
|
|
3055
|
+
createQuery: () => {
|
|
3056
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(false);
|
|
3057
|
+
},
|
|
3058
|
+
deleteQuery: () => {
|
|
3059
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(false);
|
|
3060
|
+
},
|
|
3061
|
+
beginQuery: () => {
|
|
3062
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_1__["assert"])(false);
|
|
3063
|
+
},
|
|
3064
|
+
endQuery: () => {},
|
|
3065
|
+
getQuery(handle, pname) {
|
|
3066
|
+
// @ts-ignore
|
|
3067
|
+
return this.getQueryObject(handle, pname);
|
|
3068
|
+
},
|
|
3069
|
+
// The WebGL1 extension uses getQueryObject rather then getQueryParameter
|
|
3070
|
+
getQueryParameter(handle, pname) {
|
|
3071
|
+
// @ts-ignore
|
|
3072
|
+
return this.getQueryObject(handle, pname);
|
|
3073
|
+
},
|
|
3074
|
+
getQueryObject: () => {}
|
|
3075
|
+
}
|
|
3076
|
+
};
|
|
3077
|
+
|
|
3078
|
+
const WEBGL2_CONTEXT_OVERRIDES = {
|
|
3079
|
+
// Ensure readBuffer is a no-op
|
|
3080
|
+
readBuffer: (gl, originalFunc, attachment) => {
|
|
3081
|
+
if (Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_2__["isWebGL2"])(gl)) {
|
|
3082
|
+
originalFunc(attachment);
|
|
3083
|
+
} else {
|
|
3084
|
+
// assert(attachment !== GL_COLOR_ATTACHMENT0 && attachment !== GL_FRONT);
|
|
3085
|
+
}
|
|
3086
|
+
},
|
|
3087
|
+
// Override for getVertexAttrib that returns sane values for non-WebGL1 constants
|
|
3088
|
+
getVertexAttrib: (gl, originalFunc, location, pname) => {
|
|
3089
|
+
// const gl = this; // eslint-disable-line
|
|
3090
|
+
const {webgl2, ext} = getExtensionData(gl, ANGLE_instanced_arrays);
|
|
3091
|
+
|
|
3092
|
+
let result;
|
|
3093
|
+
switch (pname) {
|
|
3094
|
+
// WebGL1 attributes will never be integer
|
|
3095
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VERTEX_ATTRIB_ARRAY_INTEGER:
|
|
3096
|
+
result = !webgl2 ? false : undefined;
|
|
3097
|
+
break;
|
|
3098
|
+
// if instancing is not available, return 0 meaning divisor has not been set
|
|
3099
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VERTEX_ATTRIB_ARRAY_DIVISOR:
|
|
3100
|
+
result = !webgl2 && !ext ? 0 : undefined;
|
|
3101
|
+
break;
|
|
3102
|
+
default:
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
return result !== undefined ? result : originalFunc(location, pname);
|
|
3106
|
+
},
|
|
3107
|
+
// Handle transform feedback and uniform block queries in WebGL1
|
|
3108
|
+
getProgramParameter: (gl, originalFunc, program, pname) => {
|
|
3109
|
+
if (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_2__["isWebGL2"])(gl)) {
|
|
3110
|
+
switch (pname) {
|
|
3111
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRANSFORM_FEEDBACK_BUFFER_MODE:
|
|
3112
|
+
return _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SEPARATE_ATTRIBS;
|
|
3113
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].TRANSFORM_FEEDBACK_VARYINGS:
|
|
3114
|
+
return 0;
|
|
3115
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ACTIVE_UNIFORM_BLOCKS:
|
|
3116
|
+
return 0;
|
|
3117
|
+
default:
|
|
3118
|
+
}
|
|
3119
|
+
}
|
|
3120
|
+
return originalFunc(program, pname);
|
|
3121
|
+
},
|
|
3122
|
+
getInternalformatParameter: (gl, originalFunc, target, format, pname) => {
|
|
3123
|
+
if (!Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_2__["isWebGL2"])(gl)) {
|
|
3124
|
+
switch (pname) {
|
|
3125
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLES:
|
|
3126
|
+
return new Int32Array([0]);
|
|
3127
|
+
default:
|
|
3128
|
+
}
|
|
3129
|
+
}
|
|
3130
|
+
return gl.getInternalformatParameter(target, format, pname);
|
|
3131
|
+
},
|
|
3132
|
+
getTexParameter(gl, originalFunc, target, pname) {
|
|
3133
|
+
switch (pname) {
|
|
3134
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXTURE_MAX_ANISOTROPY_EXT:
|
|
3135
|
+
const {extensions} = gl.luma;
|
|
3136
|
+
const ext = extensions[EXT_texture_filter_anisotropic];
|
|
3137
|
+
pname = (ext && ext.TEXTURE_MAX_ANISOTROPY_EXT) || _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].TEXTURE_MAX_ANISOTROPY_EXT;
|
|
3138
|
+
break;
|
|
3139
|
+
default:
|
|
3140
|
+
}
|
|
3141
|
+
return originalFunc(target, pname);
|
|
3142
|
+
},
|
|
3143
|
+
getParameter: _get_parameter_polyfill__WEBPACK_IMPORTED_MODULE_3__["getParameterPolyfill"],
|
|
3144
|
+
hint(gl, originalFunc, pname, value) {
|
|
3145
|
+
// TODO - handle GL.FRAGMENT_SHADER_DERIVATIVE_HINT:
|
|
3146
|
+
// switch (pname) {
|
|
3147
|
+
// case GL.FRAGMENT_SHADER_DERIVATIVE_HINT:
|
|
3148
|
+
// }
|
|
3149
|
+
return originalFunc(pname, value);
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
|
|
3153
|
+
|
|
3154
|
+
/***/ }),
|
|
3155
|
+
|
|
3156
|
+
/***/ "./src/polyfill/polyfill-vertex-array-object.js":
|
|
3157
|
+
/*!******************************************************!*\
|
|
3158
|
+
!*** ./src/polyfill/polyfill-vertex-array-object.js ***!
|
|
3159
|
+
\******************************************************/
|
|
3160
|
+
/*! exports provided: polyfillVertexArrayObject */
|
|
3161
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3162
|
+
|
|
3163
|
+
"use strict";
|
|
3164
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3165
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "polyfillVertexArrayObject", function() { return polyfillVertexArrayObject; });
|
|
3166
|
+
/*
|
|
3167
|
+
** Copyright (c) 2015 The Khronos Group Inc.
|
|
3168
|
+
**
|
|
3169
|
+
** Permission is hereby granted, free of charge, to any person obtaining a
|
|
3170
|
+
** copy of this software and/or associated documentation files (the
|
|
3171
|
+
** "Materials"), to deal in the Materials without restriction, including
|
|
3172
|
+
** without limitation the rights to use, copy, modify, merge, publish,
|
|
3173
|
+
** distribute, sublicense, and/or sell copies of the Materials, and to
|
|
3174
|
+
** permit persons to whom the Materials are furnished to do so, subject to
|
|
3175
|
+
** the following conditions:
|
|
3176
|
+
**
|
|
3177
|
+
** The above copyright notice and this permission notice shall be included
|
|
3178
|
+
** in all copies or substantial portions of the Materials.
|
|
3179
|
+
**
|
|
3180
|
+
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
3181
|
+
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
3182
|
+
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
3183
|
+
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
3184
|
+
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
3185
|
+
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
3186
|
+
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
|
3187
|
+
*/
|
|
3188
|
+
|
|
3189
|
+
// Modified to use ES6 and polyfill a provided context rather than
|
|
3190
|
+
// the global class.
|
|
3191
|
+
|
|
3192
|
+
// @ts-nocheck external code
|
|
3193
|
+
|
|
3194
|
+
const glErrorShadow = {};
|
|
3195
|
+
|
|
3196
|
+
function error(msg) {
|
|
3197
|
+
if (globalThis.console && globalThis.console.error) {
|
|
3198
|
+
globalThis.console.error(msg);
|
|
3199
|
+
}
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
function log(msg) {
|
|
3203
|
+
if (globalThis.console && globalThis.console.log) {
|
|
3204
|
+
globalThis.console.log(msg);
|
|
3205
|
+
}
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
|
+
function synthesizeGLError(err, opt_msg) {
|
|
3209
|
+
glErrorShadow[err] = true;
|
|
3210
|
+
if (opt_msg !== undefined) {
|
|
3211
|
+
error(opt_msg);
|
|
3212
|
+
}
|
|
3213
|
+
}
|
|
3214
|
+
|
|
3215
|
+
function wrapGLError(gl) {
|
|
3216
|
+
const f = gl.getError;
|
|
3217
|
+
gl.getError = function getError() {
|
|
3218
|
+
let err;
|
|
3219
|
+
do {
|
|
3220
|
+
err = f.apply(gl);
|
|
3221
|
+
if (err !== gl.NO_ERROR) {
|
|
3222
|
+
glErrorShadow[err] = true;
|
|
3223
|
+
}
|
|
3224
|
+
} while (err !== gl.NO_ERROR);
|
|
3225
|
+
|
|
3226
|
+
for (err in glErrorShadow) {
|
|
3227
|
+
if (glErrorShadow[err]) {
|
|
3228
|
+
delete glErrorShadow[err];
|
|
3229
|
+
return parseInt(err, 10);
|
|
3230
|
+
}
|
|
3231
|
+
}
|
|
3232
|
+
|
|
3233
|
+
return gl.NO_ERROR;
|
|
3234
|
+
};
|
|
3235
|
+
}
|
|
3236
|
+
|
|
3237
|
+
const WebGLVertexArrayObjectOES = function WebGLVertexArrayObjectOES(ext) {
|
|
3238
|
+
const gl = ext.gl;
|
|
3239
|
+
|
|
3240
|
+
this.ext = ext;
|
|
3241
|
+
this.isAlive = true;
|
|
3242
|
+
this.hasBeenBound = false;
|
|
3243
|
+
|
|
3244
|
+
this.elementArrayBuffer = null;
|
|
3245
|
+
this.attribs = new Array(ext.maxVertexAttribs);
|
|
3246
|
+
for (let n = 0; n < this.attribs.length; n++) {
|
|
3247
|
+
const attrib = new WebGLVertexArrayObjectOES.VertexAttrib(gl);
|
|
3248
|
+
this.attribs[n] = attrib;
|
|
3249
|
+
}
|
|
3250
|
+
|
|
3251
|
+
this.maxAttrib = 0;
|
|
3252
|
+
};
|
|
3253
|
+
|
|
3254
|
+
WebGLVertexArrayObjectOES.VertexAttrib = function VertexAttrib(gl) {
|
|
3255
|
+
this.enabled = false;
|
|
3256
|
+
this.buffer = null;
|
|
3257
|
+
this.size = 4;
|
|
3258
|
+
this.type = gl.FLOAT;
|
|
3259
|
+
this.normalized = false;
|
|
3260
|
+
this.stride = 16;
|
|
3261
|
+
this.offset = 0;
|
|
3262
|
+
|
|
3263
|
+
this.cached = '';
|
|
3264
|
+
this.recache();
|
|
3265
|
+
};
|
|
3266
|
+
WebGLVertexArrayObjectOES.VertexAttrib.prototype.recache = function recache() {
|
|
3267
|
+
this.cached = [this.size, this.type, this.normalized, this.stride, this.offset].join(':');
|
|
3268
|
+
};
|
|
3269
|
+
|
|
3270
|
+
const OESVertexArrayObject = function OESVertexArrayObject(gl) {
|
|
3271
|
+
const self = this;
|
|
3272
|
+
this.gl = gl;
|
|
3273
|
+
|
|
3274
|
+
wrapGLError(gl);
|
|
3275
|
+
|
|
3276
|
+
const original = (this.original = {
|
|
3277
|
+
getParameter: gl.getParameter,
|
|
3278
|
+
enableVertexAttribArray: gl.enableVertexAttribArray,
|
|
3279
|
+
disableVertexAttribArray: gl.disableVertexAttribArray,
|
|
3280
|
+
bindBuffer: gl.bindBuffer,
|
|
3281
|
+
getVertexAttrib: gl.getVertexAttrib,
|
|
3282
|
+
vertexAttribPointer: gl.vertexAttribPointer
|
|
3283
|
+
});
|
|
3284
|
+
|
|
3285
|
+
gl.getParameter = function getParameter(pname) {
|
|
3286
|
+
if (pname === self.VERTEX_ARRAY_BINDING_OES) {
|
|
3287
|
+
if (self.currentVertexArrayObject === self.defaultVertexArrayObject) {
|
|
3288
|
+
return null;
|
|
3289
|
+
}
|
|
3290
|
+
return self.currentVertexArrayObject;
|
|
3291
|
+
}
|
|
3292
|
+
return original.getParameter.apply(this, arguments);
|
|
3293
|
+
};
|
|
3294
|
+
|
|
3295
|
+
gl.enableVertexAttribArray = function enableVertexAttribArray(index) {
|
|
3296
|
+
const vao = self.currentVertexArrayObject;
|
|
3297
|
+
vao.maxAttrib = Math.max(vao.maxAttrib, index);
|
|
3298
|
+
const attrib = vao.attribs[index];
|
|
3299
|
+
attrib.enabled = true;
|
|
3300
|
+
return original.enableVertexAttribArray.apply(this, arguments);
|
|
3301
|
+
};
|
|
3302
|
+
gl.disableVertexAttribArray = function disableVertexAttribArray(index) {
|
|
3303
|
+
const vao = self.currentVertexArrayObject;
|
|
3304
|
+
vao.maxAttrib = Math.max(vao.maxAttrib, index);
|
|
3305
|
+
const attrib = vao.attribs[index];
|
|
3306
|
+
attrib.enabled = false;
|
|
3307
|
+
return original.disableVertexAttribArray.apply(this, arguments);
|
|
3308
|
+
};
|
|
3309
|
+
|
|
3310
|
+
gl.bindBuffer = function bindBuffer(target, buffer) {
|
|
3311
|
+
switch (target) {
|
|
3312
|
+
case gl.ARRAY_BUFFER:
|
|
3313
|
+
self.currentArrayBuffer = buffer;
|
|
3314
|
+
break;
|
|
3315
|
+
case gl.ELEMENT_ARRAY_BUFFER:
|
|
3316
|
+
self.currentVertexArrayObject.elementArrayBuffer = buffer;
|
|
3317
|
+
break;
|
|
3318
|
+
default:
|
|
3319
|
+
}
|
|
3320
|
+
return original.bindBuffer.apply(this, arguments);
|
|
3321
|
+
};
|
|
3322
|
+
|
|
3323
|
+
gl.getVertexAttrib = function getVertexAttrib(index, pname) {
|
|
3324
|
+
const vao = self.currentVertexArrayObject;
|
|
3325
|
+
const attrib = vao.attribs[index];
|
|
3326
|
+
switch (pname) {
|
|
3327
|
+
case gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
|
|
3328
|
+
return attrib.buffer;
|
|
3329
|
+
case gl.VERTEX_ATTRIB_ARRAY_ENABLED:
|
|
3330
|
+
return attrib.enabled;
|
|
3331
|
+
case gl.VERTEX_ATTRIB_ARRAY_SIZE:
|
|
3332
|
+
return attrib.size;
|
|
3333
|
+
case gl.VERTEX_ATTRIB_ARRAY_STRIDE:
|
|
3334
|
+
return attrib.stride;
|
|
3335
|
+
case gl.VERTEX_ATTRIB_ARRAY_TYPE:
|
|
3336
|
+
return attrib.type;
|
|
3337
|
+
case gl.VERTEX_ATTRIB_ARRAY_NORMALIZED:
|
|
3338
|
+
return attrib.normalized;
|
|
3339
|
+
default:
|
|
3340
|
+
return original.getVertexAttrib.apply(this, arguments);
|
|
3341
|
+
}
|
|
3342
|
+
};
|
|
3343
|
+
|
|
3344
|
+
gl.vertexAttribPointer = function vertexAttribPointer(
|
|
3345
|
+
indx,
|
|
3346
|
+
size,
|
|
3347
|
+
type,
|
|
3348
|
+
normalized,
|
|
3349
|
+
stride,
|
|
3350
|
+
offset
|
|
3351
|
+
) {
|
|
3352
|
+
const vao = self.currentVertexArrayObject;
|
|
3353
|
+
vao.maxAttrib = Math.max(vao.maxAttrib, indx);
|
|
3354
|
+
const attrib = vao.attribs[indx];
|
|
3355
|
+
attrib.buffer = self.currentArrayBuffer;
|
|
3356
|
+
attrib.size = size;
|
|
3357
|
+
attrib.type = type;
|
|
3358
|
+
attrib.normalized = normalized;
|
|
3359
|
+
attrib.stride = stride;
|
|
3360
|
+
attrib.offset = offset;
|
|
3361
|
+
attrib.recache();
|
|
3362
|
+
return original.vertexAttribPointer.apply(this, arguments);
|
|
3363
|
+
};
|
|
3364
|
+
|
|
3365
|
+
if (gl.instrumentExtension) {
|
|
3366
|
+
gl.instrumentExtension(this, 'OES_vertex_array_object');
|
|
3367
|
+
}
|
|
3368
|
+
|
|
3369
|
+
// undefined for headless gl
|
|
3370
|
+
if (gl.canvas) {
|
|
3371
|
+
gl.canvas.addEventListener(
|
|
3372
|
+
'webglcontextrestored',
|
|
3373
|
+
() => {
|
|
3374
|
+
log('OESVertexArrayObject emulation library context restored');
|
|
3375
|
+
self.reset_();
|
|
3376
|
+
},
|
|
3377
|
+
true
|
|
3378
|
+
);
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
this.reset_();
|
|
3382
|
+
};
|
|
3383
|
+
|
|
3384
|
+
OESVertexArrayObject.prototype.VERTEX_ARRAY_BINDING_OES = 0x85b5;
|
|
3385
|
+
|
|
3386
|
+
OESVertexArrayObject.prototype.reset_ = function reset_() {
|
|
3387
|
+
const contextWasLost = this.vertexArrayObjects !== undefined;
|
|
3388
|
+
if (contextWasLost) {
|
|
3389
|
+
for (let ii = 0; ii < this.vertexArrayObjects.length; ++ii) {
|
|
3390
|
+
this.vertexArrayObjects.isAlive = false;
|
|
3391
|
+
}
|
|
3392
|
+
}
|
|
3393
|
+
const gl = this.gl;
|
|
3394
|
+
this.maxVertexAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);
|
|
3395
|
+
|
|
3396
|
+
this.defaultVertexArrayObject = new WebGLVertexArrayObjectOES(this);
|
|
3397
|
+
this.currentVertexArrayObject = null;
|
|
3398
|
+
this.currentArrayBuffer = null;
|
|
3399
|
+
this.vertexArrayObjects = [this.defaultVertexArrayObject];
|
|
3400
|
+
|
|
3401
|
+
this.bindVertexArrayOES(null);
|
|
3402
|
+
};
|
|
3403
|
+
|
|
3404
|
+
OESVertexArrayObject.prototype.createVertexArrayOES = function createVertexArrayOES() {
|
|
3405
|
+
const arrayObject = new WebGLVertexArrayObjectOES(this);
|
|
3406
|
+
this.vertexArrayObjects.push(arrayObject);
|
|
3407
|
+
return arrayObject;
|
|
3408
|
+
};
|
|
3409
|
+
|
|
3410
|
+
OESVertexArrayObject.prototype.deleteVertexArrayOES = function deleteVertexArrayOES(arrayObject) {
|
|
3411
|
+
arrayObject.isAlive = false;
|
|
3412
|
+
this.vertexArrayObjects.splice(this.vertexArrayObjects.indexOf(arrayObject), 1);
|
|
3413
|
+
if (this.currentVertexArrayObject === arrayObject) {
|
|
3414
|
+
this.bindVertexArrayOES(null);
|
|
3415
|
+
}
|
|
3416
|
+
};
|
|
3417
|
+
|
|
3418
|
+
OESVertexArrayObject.prototype.isVertexArrayOES = function isVertexArrayOES(arrayObject) {
|
|
3419
|
+
if (arrayObject && arrayObject instanceof WebGLVertexArrayObjectOES) {
|
|
3420
|
+
if (arrayObject.hasBeenBound && arrayObject.ext === this) {
|
|
3421
|
+
return true;
|
|
3422
|
+
}
|
|
3423
|
+
}
|
|
3424
|
+
return false;
|
|
3425
|
+
};
|
|
3426
|
+
|
|
3427
|
+
OESVertexArrayObject.prototype.bindVertexArrayOES = function bindVertexArrayOES(arrayObject) {
|
|
3428
|
+
const gl = this.gl;
|
|
3429
|
+
if (arrayObject && !arrayObject.isAlive) {
|
|
3430
|
+
synthesizeGLError(
|
|
3431
|
+
gl.INVALID_OPERATION,
|
|
3432
|
+
'bindVertexArrayOES: attempt to bind deleted arrayObject'
|
|
3433
|
+
);
|
|
3434
|
+
return;
|
|
3435
|
+
}
|
|
3436
|
+
const original = this.original;
|
|
3437
|
+
|
|
3438
|
+
const oldVAO = this.currentVertexArrayObject;
|
|
3439
|
+
this.currentVertexArrayObject = arrayObject || this.defaultVertexArrayObject;
|
|
3440
|
+
this.currentVertexArrayObject.hasBeenBound = true;
|
|
3441
|
+
const newVAO = this.currentVertexArrayObject;
|
|
3442
|
+
|
|
3443
|
+
if (oldVAO === newVAO) {
|
|
3444
|
+
return;
|
|
3445
|
+
}
|
|
3446
|
+
|
|
3447
|
+
if (!oldVAO || newVAO.elementArrayBuffer !== oldVAO.elementArrayBuffer) {
|
|
3448
|
+
original.bindBuffer.call(gl, gl.ELEMENT_ARRAY_BUFFER, newVAO.elementArrayBuffer);
|
|
3449
|
+
}
|
|
3450
|
+
|
|
3451
|
+
let currentBinding = this.currentArrayBuffer;
|
|
3452
|
+
const maxAttrib = Math.max(oldVAO ? oldVAO.maxAttrib : 0, newVAO.maxAttrib);
|
|
3453
|
+
for (let n = 0; n <= maxAttrib; n++) {
|
|
3454
|
+
const attrib = newVAO.attribs[n];
|
|
3455
|
+
const oldAttrib = oldVAO ? oldVAO.attribs[n] : null;
|
|
3456
|
+
|
|
3457
|
+
if (!oldVAO || attrib.enabled !== oldAttrib.enabled) {
|
|
3458
|
+
if (attrib.enabled) {
|
|
3459
|
+
original.enableVertexAttribArray.call(gl, n);
|
|
3460
|
+
} else {
|
|
3461
|
+
original.disableVertexAttribArray.call(gl, n);
|
|
3462
|
+
}
|
|
3463
|
+
}
|
|
3464
|
+
|
|
3465
|
+
if (attrib.enabled) {
|
|
3466
|
+
let bufferChanged = false;
|
|
3467
|
+
if (!oldVAO || attrib.buffer !== oldAttrib.buffer) {
|
|
3468
|
+
if (currentBinding !== attrib.buffer) {
|
|
3469
|
+
original.bindBuffer.call(gl, gl.ARRAY_BUFFER, attrib.buffer);
|
|
3470
|
+
currentBinding = attrib.buffer;
|
|
3471
|
+
}
|
|
3472
|
+
bufferChanged = true;
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
if (bufferChanged || attrib.cached !== oldAttrib.cached) {
|
|
3476
|
+
original.vertexAttribPointer.call(
|
|
3477
|
+
gl,
|
|
3478
|
+
n,
|
|
3479
|
+
attrib.size,
|
|
3480
|
+
attrib.type,
|
|
3481
|
+
attrib.normalized,
|
|
3482
|
+
attrib.stride,
|
|
3483
|
+
attrib.offset
|
|
3484
|
+
);
|
|
3485
|
+
}
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
|
|
3489
|
+
if (this.currentArrayBuffer !== currentBinding) {
|
|
3490
|
+
original.bindBuffer.call(gl, gl.ARRAY_BUFFER, this.currentArrayBuffer);
|
|
3491
|
+
}
|
|
3492
|
+
};
|
|
3493
|
+
|
|
3494
|
+
function polyfillVertexArrayObject(gl) {
|
|
3495
|
+
if (typeof gl.createVertexArray === 'function') {
|
|
3496
|
+
// VAOs directly supported on object (i.e. WebGL 2 context)
|
|
3497
|
+
return;
|
|
3498
|
+
}
|
|
3499
|
+
|
|
3500
|
+
const original_getSupportedExtensions = gl.getSupportedExtensions;
|
|
3501
|
+
gl.getSupportedExtensions = function getSupportedExtensions() {
|
|
3502
|
+
const list = original_getSupportedExtensions.call(this) || [];
|
|
3503
|
+
if (list.indexOf('OES_vertex_array_object') < 0) {
|
|
3504
|
+
list.push('OES_vertex_array_object');
|
|
3505
|
+
}
|
|
3506
|
+
return list;
|
|
3507
|
+
};
|
|
3508
|
+
|
|
3509
|
+
const original_getExtension = gl.getExtension;
|
|
3510
|
+
gl.getExtension = function getExtension(name) {
|
|
3511
|
+
const ext = original_getExtension.call(this, name);
|
|
3512
|
+
if (ext) {
|
|
3513
|
+
return ext;
|
|
3514
|
+
}
|
|
3515
|
+
if (name !== 'OES_vertex_array_object') {
|
|
3516
|
+
return null;
|
|
3517
|
+
}
|
|
3518
|
+
|
|
3519
|
+
if (!gl.__OESVertexArrayObject) {
|
|
3520
|
+
this.__OESVertexArrayObject = new OESVertexArrayObject(this);
|
|
3521
|
+
}
|
|
3522
|
+
return this.__OESVertexArrayObject;
|
|
3523
|
+
};
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
|
|
3527
|
+
/***/ }),
|
|
3528
|
+
|
|
3529
|
+
/***/ "./src/state-tracker/track-context-state.js":
|
|
3530
|
+
/*!**************************************************!*\
|
|
3531
|
+
!*** ./src/state-tracker/track-context-state.js ***!
|
|
3532
|
+
\**************************************************/
|
|
3533
|
+
/*! exports provided: trackContextState, pushContextState, popContextState */
|
|
3534
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3535
|
+
|
|
3536
|
+
"use strict";
|
|
3537
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3538
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trackContextState", function() { return trackContextState; });
|
|
3539
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pushContextState", function() { return pushContextState; });
|
|
3540
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "popContextState", function() { return popContextState; });
|
|
3541
|
+
/* harmony import */ var _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webgl-parameter-tables */ "./src/state-tracker/webgl-parameter-tables.js");
|
|
3542
|
+
/* harmony import */ var _unified_parameter_api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./unified-parameter-api */ "./src/state-tracker/unified-parameter-api.js");
|
|
3543
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/assert */ "./src/utils/assert.js");
|
|
3544
|
+
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/utils */ "./src/utils/utils.js");
|
|
3545
|
+
// Support for listening to context state changes and intercepting state queries
|
|
3546
|
+
// NOTE: this system does not handle buffer bindings
|
|
3547
|
+
/** @typedef {import('./track-context-state')} types */
|
|
3548
|
+
|
|
3549
|
+
|
|
3550
|
+
|
|
3551
|
+
|
|
3552
|
+
|
|
3553
|
+
|
|
3554
|
+
// HELPER FUNCTIONS - INSTALL GET/SET INTERCEPTORS (SPYS) ON THE CONTEXT
|
|
3555
|
+
|
|
3556
|
+
// Overrides a WebGLRenderingContext state "getter" function
|
|
3557
|
+
// to return values directly from cache
|
|
3558
|
+
function installGetterOverride(gl, functionName) {
|
|
3559
|
+
// Get the original function from the WebGLRenderingContext
|
|
3560
|
+
const originalGetterFunc = gl[functionName].bind(gl);
|
|
3561
|
+
|
|
3562
|
+
// Wrap it with a spy so that we can update our state cache when it gets called
|
|
3563
|
+
gl[functionName] = function get(...params) {
|
|
3564
|
+
const pname = params[0];
|
|
3565
|
+
|
|
3566
|
+
// WebGL limits are not prepopulated in the cache, it's neither undefined in GL_PARAMETER_DEFAULTS
|
|
3567
|
+
// nor intercepted by GL_HOOKED_SETTERS. Query the original getter.
|
|
3568
|
+
if (!(pname in gl.state.cache)) {
|
|
3569
|
+
return originalGetterFunc(...params);
|
|
3570
|
+
}
|
|
3571
|
+
|
|
3572
|
+
// Optionally call the original function to do a "hard" query from the WebGLRenderingContext
|
|
3573
|
+
return gl.state.enable
|
|
3574
|
+
? // Call the getter the params so that it can e.g. serve from a cache
|
|
3575
|
+
gl.state.cache[pname]
|
|
3576
|
+
: // Optionally call the original function to do a "hard" query from the WebGLRenderingContext
|
|
3577
|
+
originalGetterFunc(...params);
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3580
|
+
// Set the name of this anonymous function to help in debugging and profiling
|
|
3581
|
+
Object.defineProperty(gl[functionName], 'name', {
|
|
3582
|
+
value: `${functionName}-from-cache`,
|
|
3583
|
+
configurable: false
|
|
3584
|
+
});
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
// Overrides a WebGLRenderingContext state "setter" function
|
|
3588
|
+
// to call a setter spy before the actual setter. Allows us to keep a cache
|
|
3589
|
+
// updated with a copy of the WebGL context state.
|
|
3590
|
+
function installSetterSpy(gl, functionName, setter) {
|
|
3591
|
+
// Get the original function from the WebGLRenderingContext
|
|
3592
|
+
const originalSetterFunc = gl[functionName].bind(gl);
|
|
3593
|
+
|
|
3594
|
+
// Wrap it with a spy so that we can update our state cache when it gets called
|
|
3595
|
+
gl[functionName] = function set(...params) {
|
|
3596
|
+
// Update the value
|
|
3597
|
+
// Call the setter with the state cache and the params so that it can store the parameters
|
|
3598
|
+
const {valueChanged, oldValue} = setter(gl.state._updateCache, ...params);
|
|
3599
|
+
|
|
3600
|
+
// Call the original WebGLRenderingContext func to make sure the context actually gets updated
|
|
3601
|
+
if (valueChanged) {
|
|
3602
|
+
originalSetterFunc(...params);
|
|
3603
|
+
}
|
|
3604
|
+
|
|
3605
|
+
// Note: if the original function fails to set the value, our state cache will be bad
|
|
3606
|
+
// No solution for this at the moment, but assuming that this is unlikely to be a real problem
|
|
3607
|
+
// We could call the setter after the originalSetterFunc. Concern is that this would
|
|
3608
|
+
// cause different behavior in debug mode, where originalSetterFunc can throw exceptions
|
|
3609
|
+
|
|
3610
|
+
return oldValue;
|
|
3611
|
+
};
|
|
3612
|
+
|
|
3613
|
+
// Set the name of this anonymous function to help in debugging and profiling
|
|
3614
|
+
Object.defineProperty(gl[functionName], 'name', {
|
|
3615
|
+
value: `${functionName}-to-cache`,
|
|
3616
|
+
configurable: false
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3619
|
+
|
|
3620
|
+
function installProgramSpy(gl) {
|
|
3621
|
+
const originalUseProgram = gl.useProgram.bind(gl);
|
|
3622
|
+
|
|
3623
|
+
gl.useProgram = function useProgramLuma(handle) {
|
|
3624
|
+
if (gl.state.program !== handle) {
|
|
3625
|
+
originalUseProgram(handle);
|
|
3626
|
+
gl.state.program = handle;
|
|
3627
|
+
}
|
|
3628
|
+
};
|
|
3629
|
+
}
|
|
3630
|
+
|
|
3631
|
+
// HELPER CLASS - GLState
|
|
3632
|
+
|
|
3633
|
+
/* eslint-disable no-shadow */
|
|
3634
|
+
class GLState {
|
|
3635
|
+
constructor(
|
|
3636
|
+
gl,
|
|
3637
|
+
{
|
|
3638
|
+
copyState = false, // Copy cache from params (slow) or initialize from WebGL defaults (fast)
|
|
3639
|
+
log = () => {} // Logging function, called when gl parameter change calls are actually issued
|
|
3640
|
+
} = {}
|
|
3641
|
+
) {
|
|
3642
|
+
this.gl = gl;
|
|
3643
|
+
this.program = null;
|
|
3644
|
+
this.stateStack = [];
|
|
3645
|
+
this.enable = true;
|
|
3646
|
+
this.cache = copyState ? Object(_unified_parameter_api__WEBPACK_IMPORTED_MODULE_1__["getParameters"])(gl) : Object.assign({}, _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_PARAMETER_DEFAULTS"]);
|
|
3647
|
+
this.log = log;
|
|
3648
|
+
|
|
3649
|
+
this._updateCache = this._updateCache.bind(this);
|
|
3650
|
+
Object.seal(this);
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
push(values = {}) {
|
|
3654
|
+
this.stateStack.push({});
|
|
3655
|
+
}
|
|
3656
|
+
|
|
3657
|
+
pop() {
|
|
3658
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_2__["assert"])(this.stateStack.length > 0);
|
|
3659
|
+
// Use the saved values in the state stack to restore parameters
|
|
3660
|
+
const oldValues = this.stateStack[this.stateStack.length - 1];
|
|
3661
|
+
Object(_unified_parameter_api__WEBPACK_IMPORTED_MODULE_1__["setParameters"])(this.gl, oldValues);
|
|
3662
|
+
// Don't pop until we have reset parameters (to make sure other "stack frames" are not affected)
|
|
3663
|
+
this.stateStack.pop();
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
// interceptor for context set functions - update our cache and our stack
|
|
3667
|
+
// values (Object) - the key values for this setter
|
|
3668
|
+
_updateCache(values) {
|
|
3669
|
+
let valueChanged = false;
|
|
3670
|
+
let oldValue; // = undefined
|
|
3671
|
+
|
|
3672
|
+
const oldValues = this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1];
|
|
3673
|
+
|
|
3674
|
+
for (const key in values) {
|
|
3675
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_2__["assert"])(key !== undefined);
|
|
3676
|
+
const value = values[key];
|
|
3677
|
+
const cached = this.cache[key];
|
|
3678
|
+
// Check that value hasn't already been shadowed
|
|
3679
|
+
if (!Object(_utils_utils__WEBPACK_IMPORTED_MODULE_3__["deepArrayEqual"])(value, cached)) {
|
|
3680
|
+
valueChanged = true;
|
|
3681
|
+
oldValue = cached;
|
|
3682
|
+
|
|
3683
|
+
// First, save current value being shadowed
|
|
3684
|
+
// If a state stack frame is active, save the current parameter values for pop
|
|
3685
|
+
// but first check that value hasn't already been shadowed and saved
|
|
3686
|
+
if (oldValues && !(key in oldValues)) {
|
|
3687
|
+
oldValues[key] = cached;
|
|
3688
|
+
}
|
|
3689
|
+
|
|
3690
|
+
// Save current value being shadowed
|
|
3691
|
+
this.cache[key] = value;
|
|
3692
|
+
}
|
|
3693
|
+
}
|
|
3694
|
+
|
|
3695
|
+
return {valueChanged, oldValue};
|
|
3696
|
+
}
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
// PUBLIC API
|
|
3700
|
+
|
|
3701
|
+
/**
|
|
3702
|
+
* Initialize WebGL state caching on a context
|
|
3703
|
+
* @type {types['trackContextState']}
|
|
3704
|
+
*/
|
|
3705
|
+
// After calling this function, context state will be cached
|
|
3706
|
+
// gl.state.push() and gl.state.pop() will be available for saving,
|
|
3707
|
+
// temporarily modifying, and then restoring state.
|
|
3708
|
+
function trackContextState(gl, options = {}) {
|
|
3709
|
+
const {enable = true, copyState} = options;
|
|
3710
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_2__["assert"])(copyState !== undefined);
|
|
3711
|
+
// @ts-ignore
|
|
3712
|
+
if (!gl.state) {
|
|
3713
|
+
// @ts-ignore
|
|
3714
|
+
const {polyfillContext} = globalThis;
|
|
3715
|
+
if (polyfillContext) {
|
|
3716
|
+
polyfillContext(gl);
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
// Create a state cache
|
|
3720
|
+
// @ts-ignore
|
|
3721
|
+
gl.state = new GLState(gl, {copyState});
|
|
3722
|
+
|
|
3723
|
+
installProgramSpy(gl);
|
|
3724
|
+
|
|
3725
|
+
// intercept all setter functions in the table
|
|
3726
|
+
for (const key in _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_HOOKED_SETTERS"]) {
|
|
3727
|
+
const setter = _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_HOOKED_SETTERS"][key];
|
|
3728
|
+
installSetterSpy(gl, key, setter);
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
// intercept all getter functions in the table
|
|
3732
|
+
installGetterOverride(gl, 'getParameter');
|
|
3733
|
+
installGetterOverride(gl, 'isEnabled');
|
|
3734
|
+
}
|
|
3735
|
+
|
|
3736
|
+
// @ts-ignore
|
|
3737
|
+
gl.state.enable = enable;
|
|
3738
|
+
|
|
3739
|
+
return gl;
|
|
3740
|
+
}
|
|
3741
|
+
|
|
3742
|
+
/**
|
|
3743
|
+
* Initialize WebGL state caching on a context
|
|
3744
|
+
* @type {types['pushContextState']}
|
|
3745
|
+
*/
|
|
3746
|
+
function pushContextState(gl) {
|
|
3747
|
+
// @ts-ignore
|
|
3748
|
+
if (!gl.state) {
|
|
3749
|
+
trackContextState(gl, {copyState: false});
|
|
3750
|
+
}
|
|
3751
|
+
// @ts-ignore
|
|
3752
|
+
gl.state.push();
|
|
3753
|
+
}
|
|
3754
|
+
|
|
3755
|
+
/**
|
|
3756
|
+
* Initialize WebGL state caching on a context
|
|
3757
|
+
* @type {types['popContextState']}
|
|
3758
|
+
*/
|
|
3759
|
+
function popContextState(gl) {
|
|
3760
|
+
// @ts-ignore
|
|
3761
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_2__["assert"])(gl.state);
|
|
3762
|
+
// @ts-ignore
|
|
3763
|
+
gl.state.pop();
|
|
3764
|
+
}
|
|
3765
|
+
|
|
3766
|
+
|
|
3767
|
+
/***/ }),
|
|
3768
|
+
|
|
3769
|
+
/***/ "./src/state-tracker/unified-parameter-api.js":
|
|
3770
|
+
/*!****************************************************!*\
|
|
3771
|
+
!*** ./src/state-tracker/unified-parameter-api.js ***!
|
|
3772
|
+
\****************************************************/
|
|
3773
|
+
/*! exports provided: setParameters, getParameters, resetParameters, withParameters */
|
|
3774
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3775
|
+
|
|
3776
|
+
"use strict";
|
|
3777
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3778
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setParameters", function() { return setParameters; });
|
|
3779
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getParameters", function() { return getParameters; });
|
|
3780
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resetParameters", function() { return resetParameters; });
|
|
3781
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withParameters", function() { return withParameters; });
|
|
3782
|
+
/* harmony import */ var _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webgl-parameter-tables */ "./src/state-tracker/webgl-parameter-tables.js");
|
|
3783
|
+
/* harmony import */ var _track_context_state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./track-context-state */ "./src/state-tracker/track-context-state.js");
|
|
3784
|
+
/* harmony import */ var _utils_assert__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/assert */ "./src/utils/assert.js");
|
|
3785
|
+
/* harmony import */ var _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/webgl-checks */ "./src/utils/webgl-checks.js");
|
|
3786
|
+
/* harmony import */ var _utils_utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/utils */ "./src/utils/utils.js");
|
|
3787
|
+
// Provides a unified API for getting and setting any WebGL parameter
|
|
3788
|
+
// Also knows default values of all parameters, enabling fast cache initialization
|
|
3789
|
+
// Provides base functionality for the state caching.
|
|
3790
|
+
|
|
3791
|
+
|
|
3792
|
+
|
|
3793
|
+
|
|
3794
|
+
|
|
3795
|
+
|
|
3796
|
+
|
|
3797
|
+
// Sets any GL parameter regardless of function (gl.blendMode, ...)
|
|
3798
|
+
// Note: requires a `cache` object to be set on the context (gl.state.cache)
|
|
3799
|
+
// This object is used to fill in any missing values for composite setter functions
|
|
3800
|
+
function setParameters(gl, values) {
|
|
3801
|
+
Object(_utils_assert__WEBPACK_IMPORTED_MODULE_2__["assert"])(Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_3__["isWebGL"])(gl), 'setParameters requires a WebGL context');
|
|
3802
|
+
|
|
3803
|
+
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["isObjectEmpty"])(values)) {
|
|
3804
|
+
return;
|
|
3805
|
+
}
|
|
3806
|
+
|
|
3807
|
+
const compositeSetters = {};
|
|
3808
|
+
|
|
3809
|
+
// HANDLE PRIMITIVE SETTERS (and make note of any composite setters)
|
|
3810
|
+
|
|
3811
|
+
for (const key in values) {
|
|
3812
|
+
const glConstant = Number(key);
|
|
3813
|
+
const setter = _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_PARAMETER_SETTERS"][key];
|
|
3814
|
+
if (setter) {
|
|
3815
|
+
// Composite setters should only be called once, so save them
|
|
3816
|
+
if (typeof setter === 'string') {
|
|
3817
|
+
compositeSetters[setter] = true;
|
|
3818
|
+
} else {
|
|
3819
|
+
// if (gl[glConstant] !== undefined) {
|
|
3820
|
+
// TODO - added above check since this is being called on WebGL2 values in WebGL1...
|
|
3821
|
+
// TODO - deep equal on values? only call setter if value has changed?
|
|
3822
|
+
// NOTE - the setter will automatically update this.state
|
|
3823
|
+
setter(gl, values[key], glConstant);
|
|
3824
|
+
}
|
|
3825
|
+
}
|
|
3826
|
+
}
|
|
3827
|
+
|
|
3828
|
+
// HANDLE COMPOSITE SETTERS
|
|
3829
|
+
|
|
3830
|
+
// NOTE: any non-provided values needed by composite setters are filled in from state cache
|
|
3831
|
+
// The cache parameter is automatically retrieved from the context
|
|
3832
|
+
// This depends on `trackContextState`, which is technically a "circular" dependency.
|
|
3833
|
+
// But it is too inconvenient to always require a cache parameter here.
|
|
3834
|
+
// This is the ONLY external dependency in this module/
|
|
3835
|
+
const cache = gl.state && gl.state.cache;
|
|
3836
|
+
if (cache) {
|
|
3837
|
+
for (const key in compositeSetters) {
|
|
3838
|
+
// TODO - avoid calling composite setters if values have not changed.
|
|
3839
|
+
const compositeSetter = _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_COMPOSITE_PARAMETER_SETTERS"][key];
|
|
3840
|
+
// Note - if `trackContextState` has been called,
|
|
3841
|
+
// the setter will automatically update this.state.cache
|
|
3842
|
+
compositeSetter(gl, values, cache);
|
|
3843
|
+
}
|
|
3844
|
+
}
|
|
3845
|
+
|
|
3846
|
+
// Add a log for the else case?
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
// Copies the state from a context (gl.getParameter should not be overriden)
|
|
3850
|
+
// Reads the entire WebGL state from a context
|
|
3851
|
+
// Caveat: This generates a huge amount of synchronous driver roundtrips and should be
|
|
3852
|
+
// considered a very slow operation, to be used only if/when a context already manipulated
|
|
3853
|
+
// by external code needs to be synchronized for the first time
|
|
3854
|
+
// @return {Object} - a newly created map, with values keyed by GL parameters
|
|
3855
|
+
function getParameters(gl, parameters) {
|
|
3856
|
+
// default to querying all parameters
|
|
3857
|
+
parameters = parameters || _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_PARAMETER_DEFAULTS"];
|
|
3858
|
+
// support both arrays of parameters and objects (keys represent parameters)
|
|
3859
|
+
|
|
3860
|
+
if (typeof parameters === 'number') {
|
|
3861
|
+
// single GL enum
|
|
3862
|
+
const key = parameters;
|
|
3863
|
+
const getter = _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_PARAMETER_GETTERS"][key];
|
|
3864
|
+
return getter ? getter(gl, key) : gl.getParameter(key);
|
|
3865
|
+
}
|
|
3866
|
+
|
|
3867
|
+
const parameterKeys = Array.isArray(parameters) ? parameters : Object.keys(parameters);
|
|
3868
|
+
|
|
3869
|
+
const state = {};
|
|
3870
|
+
for (const key of parameterKeys) {
|
|
3871
|
+
const getter = _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_PARAMETER_GETTERS"][key];
|
|
3872
|
+
state[key] = getter ? getter(gl, Number(key)) : gl.getParameter(Number(key));
|
|
3873
|
+
}
|
|
3874
|
+
return state;
|
|
3875
|
+
}
|
|
3876
|
+
|
|
3877
|
+
// Reset all parameters to a (almost) pure context state
|
|
3878
|
+
// NOTE: viewport and scissor will be set to the values in GL_PARAMETER_DEFAULTS,
|
|
3879
|
+
// NOT the canvas size dimensions, so they will have to be properly set after
|
|
3880
|
+
// calling this function.
|
|
3881
|
+
function resetParameters(gl) {
|
|
3882
|
+
setParameters(gl, _webgl_parameter_tables__WEBPACK_IMPORTED_MODULE_0__["GL_PARAMETER_DEFAULTS"]);
|
|
3883
|
+
}
|
|
3884
|
+
|
|
3885
|
+
// Stores current "global" WebGL context settings, changes selected parameters,
|
|
3886
|
+
// executes function, restores parameters
|
|
3887
|
+
function withParameters(gl, parameters, func) {
|
|
3888
|
+
if (Object(_utils_utils__WEBPACK_IMPORTED_MODULE_4__["isObjectEmpty"])(parameters)) {
|
|
3889
|
+
// Avoid setting state if no parameters provided. Just call and return
|
|
3890
|
+
return func(gl);
|
|
3891
|
+
}
|
|
3892
|
+
|
|
3893
|
+
const {nocatch = true} = parameters;
|
|
3894
|
+
|
|
3895
|
+
Object(_track_context_state__WEBPACK_IMPORTED_MODULE_1__["pushContextState"])(gl);
|
|
3896
|
+
setParameters(gl, parameters);
|
|
3897
|
+
|
|
3898
|
+
// Setup is done, call the function
|
|
3899
|
+
let value;
|
|
3900
|
+
|
|
3901
|
+
if (nocatch) {
|
|
3902
|
+
// Avoid try catch to minimize stack size impact for safe execution paths
|
|
3903
|
+
value = func(gl);
|
|
3904
|
+
Object(_track_context_state__WEBPACK_IMPORTED_MODULE_1__["popContextState"])(gl);
|
|
3905
|
+
} else {
|
|
3906
|
+
// Wrap in a try-catch to ensure that parameters are restored on exceptions
|
|
3907
|
+
try {
|
|
3908
|
+
value = func(gl);
|
|
3909
|
+
} finally {
|
|
3910
|
+
Object(_track_context_state__WEBPACK_IMPORTED_MODULE_1__["popContextState"])(gl);
|
|
3911
|
+
}
|
|
3912
|
+
}
|
|
3913
|
+
|
|
3914
|
+
return value;
|
|
3915
|
+
}
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
/***/ }),
|
|
3919
|
+
|
|
3920
|
+
/***/ "./src/state-tracker/webgl-parameter-tables.js":
|
|
3921
|
+
/*!*****************************************************!*\
|
|
3922
|
+
!*** ./src/state-tracker/webgl-parameter-tables.js ***!
|
|
3923
|
+
\*****************************************************/
|
|
3924
|
+
/*! exports provided: GL_PARAMETER_DEFAULTS, GL_PARAMETER_SETTERS, GL_COMPOSITE_PARAMETER_SETTERS, GL_HOOKED_SETTERS, GL_PARAMETER_GETTERS */
|
|
3925
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
3926
|
+
|
|
3927
|
+
"use strict";
|
|
3928
|
+
__webpack_require__.r(__webpack_exports__);
|
|
3929
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GL_PARAMETER_DEFAULTS", function() { return GL_PARAMETER_DEFAULTS; });
|
|
3930
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GL_PARAMETER_SETTERS", function() { return GL_PARAMETER_SETTERS; });
|
|
3931
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GL_COMPOSITE_PARAMETER_SETTERS", function() { return GL_COMPOSITE_PARAMETER_SETTERS; });
|
|
3932
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GL_HOOKED_SETTERS", function() { return GL_HOOKED_SETTERS; });
|
|
3933
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GL_PARAMETER_GETTERS", function() { return GL_PARAMETER_GETTERS; });
|
|
3934
|
+
/* harmony import */ var _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @luma.gl/constants */ "../constants/src/index.js");
|
|
3935
|
+
/* harmony import */ var _utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/webgl-checks */ "./src/utils/webgl-checks.js");
|
|
3936
|
+
// Tables describing WebGL parameters
|
|
3937
|
+
|
|
3938
|
+
|
|
3939
|
+
|
|
3940
|
+
// DEFAULT SETTINGS - FOR FAST CACHE INITIALIZATION AND CONTEXT RESETS
|
|
3941
|
+
|
|
3942
|
+
/* eslint-disable no-shadow */
|
|
3943
|
+
|
|
3944
|
+
const GL_PARAMETER_DEFAULTS = {
|
|
3945
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND]: false,
|
|
3946
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_COLOR]: new Float32Array([0, 0, 0, 0]),
|
|
3947
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_RGB]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FUNC_ADD,
|
|
3948
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_ALPHA]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FUNC_ADD,
|
|
3949
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_RGB]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ONE,
|
|
3950
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_RGB]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ZERO,
|
|
3951
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_ALPHA]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ONE,
|
|
3952
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_ALPHA]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ZERO,
|
|
3953
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_CLEAR_VALUE]: new Float32Array([0, 0, 0, 0]), // TBD
|
|
3954
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_WRITEMASK]: [true, true, true, true],
|
|
3955
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE]: false,
|
|
3956
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE_MODE]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK,
|
|
3957
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_TEST]: false,
|
|
3958
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_CLEAR_VALUE]: 1,
|
|
3959
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_FUNC]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].LESS,
|
|
3960
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_RANGE]: new Float32Array([0, 1]), // TBD
|
|
3961
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_WRITEMASK]: true,
|
|
3962
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DITHER]: true,
|
|
3963
|
+
// FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
|
|
3964
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAMEBUFFER_BINDING]: null,
|
|
3965
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT_FACE]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CCW,
|
|
3966
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].GENERATE_MIPMAP_HINT]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DONT_CARE,
|
|
3967
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].LINE_WIDTH]: 1,
|
|
3968
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FILL]: false,
|
|
3969
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FACTOR]: 0,
|
|
3970
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_UNITS]: 0,
|
|
3971
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_VALUE]: 1.0,
|
|
3972
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_INVERT]: false,
|
|
3973
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_TEST]: false,
|
|
3974
|
+
// Note: Dynamic value. If scissor test enabled we expect users to set correct scissor box
|
|
3975
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_BOX]: new Int32Array([0, 0, 1024, 1024]),
|
|
3976
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_TEST]: false,
|
|
3977
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_CLEAR_VALUE]: 0,
|
|
3978
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_WRITEMASK]: 0xffffffff,
|
|
3979
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_WRITEMASK]: 0xffffffff,
|
|
3980
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FUNC]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ALWAYS,
|
|
3981
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_REF]: 0,
|
|
3982
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_VALUE_MASK]: 0xffffffff,
|
|
3983
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FUNC]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].ALWAYS,
|
|
3984
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_REF]: 0,
|
|
3985
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_VALUE_MASK]: 0xffffffff,
|
|
3986
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FAIL]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].KEEP,
|
|
3987
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_FAIL]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].KEEP,
|
|
3988
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_PASS]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].KEEP,
|
|
3989
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FAIL]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].KEEP,
|
|
3990
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_FAIL]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].KEEP,
|
|
3991
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_PASS]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].KEEP,
|
|
3992
|
+
// Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
|
|
3993
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIEWPORT]: [0, 0, 1024, 1024],
|
|
3994
|
+
// WEBGL1 PIXEL PACK/UNPACK MODES
|
|
3995
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_ALIGNMENT]: 4,
|
|
3996
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_ALIGNMENT]: 4,
|
|
3997
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_FLIP_Y_WEBGL]: false,
|
|
3998
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_PREMULTIPLY_ALPHA_WEBGL]: false,
|
|
3999
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_COLORSPACE_CONVERSION_WEBGL]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BROWSER_DEFAULT_WEBGL,
|
|
4000
|
+
|
|
4001
|
+
// WEBGL2 / EXTENSIONS
|
|
4002
|
+
// gl1: 'OES_standard_derivatives'
|
|
4003
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAGMENT_SHADER_DERIVATIVE_HINT]: _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DONT_CARE,
|
|
4004
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_FRAMEBUFFER_BINDING]: null,
|
|
4005
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RASTERIZER_DISCARD]: false,
|
|
4006
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_ROW_LENGTH]: 0,
|
|
4007
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_SKIP_PIXELS]: 0,
|
|
4008
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_SKIP_ROWS]: 0,
|
|
4009
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_ROW_LENGTH]: 0,
|
|
4010
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_IMAGE_HEIGHT]: 0,
|
|
4011
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_SKIP_PIXELS]: 0,
|
|
4012
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_SKIP_ROWS]: 0,
|
|
4013
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_SKIP_IMAGES]: 0
|
|
4014
|
+
};
|
|
4015
|
+
|
|
4016
|
+
// SETTER TABLES - ENABLES SETTING ANY PARAMETER WITH A COMMON API
|
|
4017
|
+
|
|
4018
|
+
const enable = (gl, value, key) => (value ? gl.enable(key) : gl.disable(key));
|
|
4019
|
+
const hint = (gl, value, key) => gl.hint(key, value);
|
|
4020
|
+
const pixelStorei = (gl, value, key) => gl.pixelStorei(key, value);
|
|
4021
|
+
|
|
4022
|
+
const drawFramebuffer = (gl, value) => {
|
|
4023
|
+
const target = Object(_utils_webgl_checks__WEBPACK_IMPORTED_MODULE_1__["isWebGL2"])(gl) ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_FRAMEBUFFER : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAMEBUFFER;
|
|
4024
|
+
return gl.bindFramebuffer(target, value);
|
|
4025
|
+
};
|
|
4026
|
+
const readFramebuffer = (gl, value) => {
|
|
4027
|
+
return gl.bindFramebuffer(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_FRAMEBUFFER, value);
|
|
4028
|
+
};
|
|
4029
|
+
|
|
4030
|
+
// Utility
|
|
4031
|
+
function isArray(array) {
|
|
4032
|
+
return Array.isArray(array) || ArrayBuffer.isView(array);
|
|
4033
|
+
}
|
|
4034
|
+
|
|
4035
|
+
// Map from WebGL parameter names to corresponding WebGL setter functions
|
|
4036
|
+
// WegGL constants are read by parameter names, but set by function names
|
|
4037
|
+
// NOTE: When value type is a string, it will be handled by 'GL_COMPOSITE_PARAMETER_SETTERS'
|
|
4038
|
+
const GL_PARAMETER_SETTERS = {
|
|
4039
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND]: enable,
|
|
4040
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_COLOR]: (gl, value) => gl.blendColor(...value),
|
|
4041
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_RGB]: 'blendEquation',
|
|
4042
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_ALPHA]: 'blendEquation',
|
|
4043
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_RGB]: 'blendFunc',
|
|
4044
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_RGB]: 'blendFunc',
|
|
4045
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_ALPHA]: 'blendFunc',
|
|
4046
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_ALPHA]: 'blendFunc',
|
|
4047
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_CLEAR_VALUE]: (gl, value) => gl.clearColor(...value),
|
|
4048
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_WRITEMASK]: (gl, value) => gl.colorMask(...value),
|
|
4049
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE]: enable,
|
|
4050
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE_MODE]: (gl, value) => gl.cullFace(value),
|
|
4051
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_TEST]: enable,
|
|
4052
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_CLEAR_VALUE]: (gl, value) => gl.clearDepth(value),
|
|
4053
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_FUNC]: (gl, value) => gl.depthFunc(value),
|
|
4054
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_RANGE]: (gl, value) => gl.depthRange(...value),
|
|
4055
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_WRITEMASK]: (gl, value) => gl.depthMask(value),
|
|
4056
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DITHER]: enable,
|
|
4057
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAGMENT_SHADER_DERIVATIVE_HINT]: hint,
|
|
4058
|
+
// NOTE: FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
|
|
4059
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAMEBUFFER_BINDING]: drawFramebuffer,
|
|
4060
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT_FACE]: (gl, value) => gl.frontFace(value),
|
|
4061
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].GENERATE_MIPMAP_HINT]: hint,
|
|
4062
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].LINE_WIDTH]: (gl, value) => gl.lineWidth(value),
|
|
4063
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FILL]: enable,
|
|
4064
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FACTOR]: 'polygonOffset',
|
|
4065
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_UNITS]: 'polygonOffset',
|
|
4066
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RASTERIZER_DISCARD]: enable,
|
|
4067
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_VALUE]: 'sampleCoverage',
|
|
4068
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_INVERT]: 'sampleCoverage',
|
|
4069
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_TEST]: enable,
|
|
4070
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_BOX]: (gl, value) => gl.scissor(...value),
|
|
4071
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_TEST]: enable,
|
|
4072
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_CLEAR_VALUE]: (gl, value) => gl.clearStencil(value),
|
|
4073
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT, value),
|
|
4074
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_WRITEMASK]: (gl, value) => gl.stencilMaskSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK, value),
|
|
4075
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FUNC]: 'stencilFuncFront',
|
|
4076
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_REF]: 'stencilFuncFront',
|
|
4077
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_VALUE_MASK]: 'stencilFuncFront',
|
|
4078
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FUNC]: 'stencilFuncBack',
|
|
4079
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_REF]: 'stencilFuncBack',
|
|
4080
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_VALUE_MASK]: 'stencilFuncBack',
|
|
4081
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FAIL]: 'stencilOpFront',
|
|
4082
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_FAIL]: 'stencilOpFront',
|
|
4083
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_PASS]: 'stencilOpFront',
|
|
4084
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FAIL]: 'stencilOpBack',
|
|
4085
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_FAIL]: 'stencilOpBack',
|
|
4086
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_PASS]: 'stencilOpBack',
|
|
4087
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIEWPORT]: (gl, value) => gl.viewport(...value),
|
|
4088
|
+
|
|
4089
|
+
// WEBGL1 PIXEL PACK/UNPACK MODES
|
|
4090
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_ALIGNMENT]: pixelStorei,
|
|
4091
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_ALIGNMENT]: pixelStorei,
|
|
4092
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_FLIP_Y_WEBGL]: pixelStorei,
|
|
4093
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_PREMULTIPLY_ALPHA_WEBGL]: pixelStorei,
|
|
4094
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_COLORSPACE_CONVERSION_WEBGL]: pixelStorei,
|
|
4095
|
+
|
|
4096
|
+
// WEBGL2 PIXEL PACK/UNPACK MODES
|
|
4097
|
+
// RASTERIZER_DISCARD ...
|
|
4098
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_ROW_LENGTH]: pixelStorei,
|
|
4099
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_SKIP_PIXELS]: pixelStorei,
|
|
4100
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].PACK_SKIP_ROWS]: pixelStorei,
|
|
4101
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_FRAMEBUFFER_BINDING]: readFramebuffer,
|
|
4102
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_ROW_LENGTH]: pixelStorei,
|
|
4103
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_IMAGE_HEIGHT]: pixelStorei,
|
|
4104
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_SKIP_PIXELS]: pixelStorei,
|
|
4105
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_SKIP_ROWS]: pixelStorei,
|
|
4106
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].UNPACK_SKIP_IMAGES]: pixelStorei,
|
|
4107
|
+
|
|
4108
|
+
// Function-style setters
|
|
4109
|
+
framebuffer: (gl, framebuffer) => {
|
|
4110
|
+
// accepts 1) a WebGLFramebuffer 2) null (default framebuffer), or 3) luma.gl Framebuffer class
|
|
4111
|
+
// framebuffer is null when restoring to default framebuffer, otherwise use the WebGL handle.
|
|
4112
|
+
const handle = framebuffer && 'handle' in framebuffer ? framebuffer.handle : framebuffer;
|
|
4113
|
+
return gl.bindFramebuffer(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAMEBUFFER, handle);
|
|
4114
|
+
},
|
|
4115
|
+
blend: (gl, value) => (value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND)),
|
|
4116
|
+
blendColor: (gl, value) => gl.blendColor(...value),
|
|
4117
|
+
blendEquation: (gl, args) => {
|
|
4118
|
+
args = isArray(args) ? args : [args, args];
|
|
4119
|
+
gl.blendEquationSeparate(...args);
|
|
4120
|
+
},
|
|
4121
|
+
blendFunc: (gl, args) => {
|
|
4122
|
+
args = isArray(args) && args.length === 2 ? [...args, ...args] : args;
|
|
4123
|
+
gl.blendFuncSeparate(...args);
|
|
4124
|
+
},
|
|
4125
|
+
|
|
4126
|
+
clearColor: (gl, value) => gl.clearColor(...value),
|
|
4127
|
+
clearDepth: (gl, value) => gl.clearDepth(value),
|
|
4128
|
+
clearStencil: (gl, value) => gl.clearStencil(value),
|
|
4129
|
+
|
|
4130
|
+
colorMask: (gl, value) => gl.colorMask(...value),
|
|
4131
|
+
|
|
4132
|
+
cull: (gl, value) => (value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE)),
|
|
4133
|
+
cullFace: (gl, value) => gl.cullFace(value),
|
|
4134
|
+
|
|
4135
|
+
depthTest: (gl, value) => (value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_TEST) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_TEST)),
|
|
4136
|
+
depthFunc: (gl, value) => gl.depthFunc(value),
|
|
4137
|
+
depthMask: (gl, value) => gl.depthMask(value),
|
|
4138
|
+
depthRange: (gl, value) => gl.depthRange(...value),
|
|
4139
|
+
|
|
4140
|
+
dither: (gl, value) => (value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DITHER) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DITHER)),
|
|
4141
|
+
|
|
4142
|
+
derivativeHint: (gl, value) => {
|
|
4143
|
+
// gl1: 'OES_standard_derivatives'
|
|
4144
|
+
gl.hint(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAGMENT_SHADER_DERIVATIVE_HINT, value);
|
|
4145
|
+
},
|
|
4146
|
+
|
|
4147
|
+
frontFace: (gl, value) => gl.frontFace(value),
|
|
4148
|
+
|
|
4149
|
+
mipmapHint: (gl, value) => gl.hint(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].GENERATE_MIPMAP_HINT, value),
|
|
4150
|
+
|
|
4151
|
+
lineWidth: (gl, value) => gl.lineWidth(value),
|
|
4152
|
+
|
|
4153
|
+
polygonOffsetFill: (gl, value) =>
|
|
4154
|
+
value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FILL) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FILL),
|
|
4155
|
+
polygonOffset: (gl, value) => gl.polygonOffset(...value),
|
|
4156
|
+
|
|
4157
|
+
sampleCoverage: (gl, value) => gl.sampleCoverage(...value),
|
|
4158
|
+
|
|
4159
|
+
scissorTest: (gl, value) => (value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_TEST) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_TEST)),
|
|
4160
|
+
scissor: (gl, value) => gl.scissor(...value),
|
|
4161
|
+
|
|
4162
|
+
stencilTest: (gl, value) => (value ? gl.enable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_TEST) : gl.disable(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_TEST)),
|
|
4163
|
+
stencilMask: (gl, value) => {
|
|
4164
|
+
value = isArray(value) ? value : [value, value];
|
|
4165
|
+
const [mask, backMask] = value;
|
|
4166
|
+
gl.stencilMaskSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT, mask);
|
|
4167
|
+
gl.stencilMaskSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK, backMask);
|
|
4168
|
+
},
|
|
4169
|
+
stencilFunc: (gl, args) => {
|
|
4170
|
+
args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
|
|
4171
|
+
const [func, ref, mask, backFunc, backRef, backMask] = args;
|
|
4172
|
+
gl.stencilFuncSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT, func, ref, mask);
|
|
4173
|
+
gl.stencilFuncSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK, backFunc, backRef, backMask);
|
|
4174
|
+
},
|
|
4175
|
+
stencilOp: (gl, args) => {
|
|
4176
|
+
args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
|
|
4177
|
+
const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = args;
|
|
4178
|
+
gl.stencilOpSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT, sfail, dpfail, dppass);
|
|
4179
|
+
gl.stencilOpSeparate(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK, backSfail, backDpfail, backDppass);
|
|
4180
|
+
},
|
|
4181
|
+
|
|
4182
|
+
viewport: (gl, value) => gl.viewport(...value)
|
|
4183
|
+
};
|
|
4184
|
+
|
|
4185
|
+
function getValue(glEnum, values, cache) {
|
|
4186
|
+
return values[glEnum] !== undefined ? values[glEnum] : cache[glEnum];
|
|
4187
|
+
}
|
|
4188
|
+
|
|
4189
|
+
// COMPOSITE_WEBGL_PARAMETER_
|
|
4190
|
+
const GL_COMPOSITE_PARAMETER_SETTERS = {
|
|
4191
|
+
blendEquation: (gl, values, cache) =>
|
|
4192
|
+
gl.blendEquationSeparate(
|
|
4193
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_RGB, values, cache),
|
|
4194
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_ALPHA, values, cache)
|
|
4195
|
+
),
|
|
4196
|
+
blendFunc: (gl, values, cache) =>
|
|
4197
|
+
gl.blendFuncSeparate(
|
|
4198
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_RGB, values, cache),
|
|
4199
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_RGB, values, cache),
|
|
4200
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_ALPHA, values, cache),
|
|
4201
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_ALPHA, values, cache)
|
|
4202
|
+
),
|
|
4203
|
+
polygonOffset: (gl, values, cache) =>
|
|
4204
|
+
gl.polygonOffset(
|
|
4205
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FACTOR, values, cache),
|
|
4206
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_UNITS, values, cache)
|
|
4207
|
+
),
|
|
4208
|
+
sampleCoverage: (gl, values, cache) =>
|
|
4209
|
+
gl.sampleCoverage(
|
|
4210
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_VALUE, values, cache),
|
|
4211
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_INVERT, values, cache)
|
|
4212
|
+
),
|
|
4213
|
+
stencilFuncFront: (gl, values, cache) =>
|
|
4214
|
+
gl.stencilFuncSeparate(
|
|
4215
|
+
_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT,
|
|
4216
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FUNC, values, cache),
|
|
4217
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_REF, values, cache),
|
|
4218
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_VALUE_MASK, values, cache)
|
|
4219
|
+
),
|
|
4220
|
+
stencilFuncBack: (gl, values, cache) =>
|
|
4221
|
+
gl.stencilFuncSeparate(
|
|
4222
|
+
_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK,
|
|
4223
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FUNC, values, cache),
|
|
4224
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_REF, values, cache),
|
|
4225
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_VALUE_MASK, values, cache)
|
|
4226
|
+
),
|
|
4227
|
+
stencilOpFront: (gl, values, cache) =>
|
|
4228
|
+
gl.stencilOpSeparate(
|
|
4229
|
+
_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT,
|
|
4230
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FAIL, values, cache),
|
|
4231
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_FAIL, values, cache),
|
|
4232
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_PASS, values, cache)
|
|
4233
|
+
),
|
|
4234
|
+
stencilOpBack: (gl, values, cache) =>
|
|
4235
|
+
gl.stencilOpSeparate(
|
|
4236
|
+
_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BACK,
|
|
4237
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FAIL, values, cache),
|
|
4238
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_FAIL, values, cache),
|
|
4239
|
+
getValue(_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_PASS, values, cache)
|
|
4240
|
+
)
|
|
4241
|
+
};
|
|
4242
|
+
|
|
4243
|
+
// Setter functions intercepted for cache updates
|
|
4244
|
+
const GL_HOOKED_SETTERS = {
|
|
4245
|
+
// GENERIC SETTERS
|
|
4246
|
+
|
|
4247
|
+
enable: (update, capability) =>
|
|
4248
|
+
update({
|
|
4249
|
+
[capability]: true
|
|
4250
|
+
}),
|
|
4251
|
+
disable: (update, capability) =>
|
|
4252
|
+
update({
|
|
4253
|
+
[capability]: false
|
|
4254
|
+
}),
|
|
4255
|
+
pixelStorei: (update, pname, value) =>
|
|
4256
|
+
update({
|
|
4257
|
+
[pname]: value
|
|
4258
|
+
}),
|
|
4259
|
+
hint: (update, pname, hint) =>
|
|
4260
|
+
update({
|
|
4261
|
+
[pname]: hint
|
|
4262
|
+
}),
|
|
4263
|
+
|
|
4264
|
+
// SPECIFIC SETTERS
|
|
4265
|
+
|
|
4266
|
+
bindFramebuffer: (update, target, framebuffer) => {
|
|
4267
|
+
switch (target) {
|
|
4268
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRAMEBUFFER:
|
|
4269
|
+
return update({
|
|
4270
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_FRAMEBUFFER_BINDING]: framebuffer,
|
|
4271
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_FRAMEBUFFER_BINDING]: framebuffer
|
|
4272
|
+
});
|
|
4273
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_FRAMEBUFFER:
|
|
4274
|
+
return update({[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DRAW_FRAMEBUFFER_BINDING]: framebuffer});
|
|
4275
|
+
case _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_FRAMEBUFFER:
|
|
4276
|
+
return update({[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].READ_FRAMEBUFFER_BINDING]: framebuffer});
|
|
4277
|
+
default:
|
|
4278
|
+
return null;
|
|
4279
|
+
}
|
|
4280
|
+
},
|
|
4281
|
+
blendColor: (update, r, g, b, a) =>
|
|
4282
|
+
update({
|
|
4283
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_COLOR]: new Float32Array([r, g, b, a])
|
|
4284
|
+
}),
|
|
4285
|
+
|
|
4286
|
+
blendEquation: (update, mode) =>
|
|
4287
|
+
update({
|
|
4288
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_RGB]: mode,
|
|
4289
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_ALPHA]: mode
|
|
4290
|
+
}),
|
|
4291
|
+
|
|
4292
|
+
blendEquationSeparate: (update, modeRGB, modeAlpha) =>
|
|
4293
|
+
update({
|
|
4294
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_RGB]: modeRGB,
|
|
4295
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_EQUATION_ALPHA]: modeAlpha
|
|
4296
|
+
}),
|
|
4297
|
+
|
|
4298
|
+
blendFunc: (update, src, dst) =>
|
|
4299
|
+
update({
|
|
4300
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_RGB]: src,
|
|
4301
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_RGB]: dst,
|
|
4302
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_ALPHA]: src,
|
|
4303
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_ALPHA]: dst
|
|
4304
|
+
}),
|
|
4305
|
+
|
|
4306
|
+
blendFuncSeparate: (update, srcRGB, dstRGB, srcAlpha, dstAlpha) =>
|
|
4307
|
+
update({
|
|
4308
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_RGB]: srcRGB,
|
|
4309
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_RGB]: dstRGB,
|
|
4310
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_SRC_ALPHA]: srcAlpha,
|
|
4311
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND_DST_ALPHA]: dstAlpha
|
|
4312
|
+
}),
|
|
4313
|
+
|
|
4314
|
+
clearColor: (update, r, g, b, a) =>
|
|
4315
|
+
update({
|
|
4316
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_CLEAR_VALUE]: new Float32Array([r, g, b, a])
|
|
4317
|
+
}),
|
|
4318
|
+
|
|
4319
|
+
clearDepth: (update, depth) =>
|
|
4320
|
+
update({
|
|
4321
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_CLEAR_VALUE]: depth
|
|
4322
|
+
}),
|
|
4323
|
+
|
|
4324
|
+
clearStencil: (update, s) =>
|
|
4325
|
+
update({
|
|
4326
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_CLEAR_VALUE]: s
|
|
4327
|
+
}),
|
|
4328
|
+
|
|
4329
|
+
colorMask: (update, r, g, b, a) =>
|
|
4330
|
+
update({
|
|
4331
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].COLOR_WRITEMASK]: [r, g, b, a]
|
|
4332
|
+
}),
|
|
4333
|
+
|
|
4334
|
+
cullFace: (update, mode) =>
|
|
4335
|
+
update({
|
|
4336
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE_MODE]: mode
|
|
4337
|
+
}),
|
|
4338
|
+
|
|
4339
|
+
depthFunc: (update, func) =>
|
|
4340
|
+
update({
|
|
4341
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_FUNC]: func
|
|
4342
|
+
}),
|
|
4343
|
+
|
|
4344
|
+
depthRange: (update, zNear, zFar) =>
|
|
4345
|
+
update({
|
|
4346
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_RANGE]: new Float32Array([zNear, zFar])
|
|
4347
|
+
}),
|
|
4348
|
+
|
|
4349
|
+
depthMask: (update, mask) =>
|
|
4350
|
+
update({
|
|
4351
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_WRITEMASK]: mask
|
|
4352
|
+
}),
|
|
4353
|
+
|
|
4354
|
+
frontFace: (update, face) =>
|
|
4355
|
+
update({
|
|
4356
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT_FACE]: face
|
|
4357
|
+
}),
|
|
4358
|
+
|
|
4359
|
+
lineWidth: (update, width) =>
|
|
4360
|
+
update({
|
|
4361
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].LINE_WIDTH]: width
|
|
4362
|
+
}),
|
|
4363
|
+
|
|
4364
|
+
polygonOffset: (update, factor, units) =>
|
|
4365
|
+
update({
|
|
4366
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FACTOR]: factor,
|
|
4367
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_UNITS]: units
|
|
4368
|
+
}),
|
|
4369
|
+
|
|
4370
|
+
sampleCoverage: (update, value, invert) =>
|
|
4371
|
+
update({
|
|
4372
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_VALUE]: value,
|
|
4373
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE_INVERT]: invert
|
|
4374
|
+
}),
|
|
4375
|
+
|
|
4376
|
+
scissor: (update, x, y, width, height) =>
|
|
4377
|
+
update({
|
|
4378
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_BOX]: new Int32Array([x, y, width, height])
|
|
4379
|
+
}),
|
|
4380
|
+
|
|
4381
|
+
stencilMask: (update, mask) =>
|
|
4382
|
+
update({
|
|
4383
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_WRITEMASK]: mask,
|
|
4384
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_WRITEMASK]: mask
|
|
4385
|
+
}),
|
|
4386
|
+
|
|
4387
|
+
stencilMaskSeparate: (update, face, mask) =>
|
|
4388
|
+
update({
|
|
4389
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_WRITEMASK : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_WRITEMASK]: mask
|
|
4390
|
+
}),
|
|
4391
|
+
|
|
4392
|
+
stencilFunc: (update, func, ref, mask) =>
|
|
4393
|
+
update({
|
|
4394
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FUNC]: func,
|
|
4395
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_REF]: ref,
|
|
4396
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_VALUE_MASK]: mask,
|
|
4397
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FUNC]: func,
|
|
4398
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_REF]: ref,
|
|
4399
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_VALUE_MASK]: mask
|
|
4400
|
+
}),
|
|
4401
|
+
|
|
4402
|
+
stencilFuncSeparate: (update, face, func, ref, mask) =>
|
|
4403
|
+
update({
|
|
4404
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FUNC : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FUNC]: func,
|
|
4405
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_REF : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_REF]: ref,
|
|
4406
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_VALUE_MASK : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_VALUE_MASK]: mask
|
|
4407
|
+
}),
|
|
4408
|
+
|
|
4409
|
+
stencilOp: (update, fail, zfail, zpass) =>
|
|
4410
|
+
update({
|
|
4411
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FAIL]: fail,
|
|
4412
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_FAIL]: zfail,
|
|
4413
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_PASS]: zpass,
|
|
4414
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FAIL]: fail,
|
|
4415
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
|
|
4416
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_PASS]: zpass
|
|
4417
|
+
}),
|
|
4418
|
+
|
|
4419
|
+
stencilOpSeparate: (update, face, fail, zfail, zpass) =>
|
|
4420
|
+
update({
|
|
4421
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_FAIL : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_FAIL]: fail,
|
|
4422
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_FAIL : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_FAIL]: zfail,
|
|
4423
|
+
[face === _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].FRONT ? _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_PASS_DEPTH_PASS : _luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_BACK_PASS_DEPTH_PASS]: zpass
|
|
4424
|
+
}),
|
|
4425
|
+
|
|
4426
|
+
viewport: (update, x, y, width, height) =>
|
|
4427
|
+
update({
|
|
4428
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].VIEWPORT]: [x, y, width, height]
|
|
4429
|
+
})
|
|
4430
|
+
};
|
|
4431
|
+
|
|
4432
|
+
// GETTER TABLE - FOR READING OUT AN ENTIRE CONTEXT
|
|
4433
|
+
|
|
4434
|
+
const isEnabled = (gl, key) => gl.isEnabled(key);
|
|
4435
|
+
|
|
4436
|
+
// Exceptions for any keys that cannot be queried by gl.getParameters
|
|
4437
|
+
const GL_PARAMETER_GETTERS = {
|
|
4438
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].BLEND]: isEnabled,
|
|
4439
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].CULL_FACE]: isEnabled,
|
|
4440
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DEPTH_TEST]: isEnabled,
|
|
4441
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].DITHER]: isEnabled,
|
|
4442
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].POLYGON_OFFSET_FILL]: isEnabled,
|
|
4443
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_ALPHA_TO_COVERAGE]: isEnabled,
|
|
4444
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SAMPLE_COVERAGE]: isEnabled,
|
|
4445
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].SCISSOR_TEST]: isEnabled,
|
|
4446
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].STENCIL_TEST]: isEnabled,
|
|
4447
|
+
|
|
4448
|
+
// WebGL 2
|
|
4449
|
+
[_luma_gl_constants__WEBPACK_IMPORTED_MODULE_0__["default"].RASTERIZER_DISCARD]: isEnabled
|
|
4450
|
+
};
|
|
4451
|
+
|
|
4452
|
+
|
|
4453
|
+
/***/ }),
|
|
4454
|
+
|
|
4455
|
+
/***/ "./src/utils/assert.js":
|
|
4456
|
+
/*!*****************************!*\
|
|
4457
|
+
!*** ./src/utils/assert.js ***!
|
|
4458
|
+
\*****************************/
|
|
4459
|
+
/*! exports provided: assert */
|
|
4460
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4461
|
+
|
|
4462
|
+
"use strict";
|
|
4463
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4464
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assert", function() { return assert; });
|
|
4465
|
+
// Avoid bundling assert polyfill module
|
|
4466
|
+
function assert(condition, message) {
|
|
4467
|
+
if (!condition) {
|
|
4468
|
+
throw new Error(message || 'luma.gl: assertion failed.');
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
|
|
4472
|
+
|
|
4473
|
+
/***/ }),
|
|
4474
|
+
|
|
4475
|
+
/***/ "./src/utils/device-pixels.js":
|
|
4476
|
+
/*!************************************!*\
|
|
4477
|
+
!*** ./src/utils/device-pixels.js ***!
|
|
4478
|
+
\************************************/
|
|
4479
|
+
/*! exports provided: cssToDeviceRatio, cssToDevicePixels, getDevicePixelRatio */
|
|
4480
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4481
|
+
|
|
4482
|
+
"use strict";
|
|
4483
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4484
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssToDeviceRatio", function() { return cssToDeviceRatio; });
|
|
4485
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "cssToDevicePixels", function() { return cssToDevicePixels; });
|
|
4486
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDevicePixelRatio", function() { return getDevicePixelRatio; });
|
|
4487
|
+
/** @typedef {import('./device-pixels')} types */
|
|
4488
|
+
|
|
4489
|
+
/**
|
|
4490
|
+
* Returns multiplier need to convert CSS size to Device size
|
|
4491
|
+
* @type {types['cssToDeviceRatio']}
|
|
4492
|
+
*/
|
|
4493
|
+
function cssToDeviceRatio(gl) {
|
|
4494
|
+
// @ts-ignore
|
|
4495
|
+
const {luma} = gl;
|
|
4496
|
+
|
|
4497
|
+
if (gl.canvas && luma) {
|
|
4498
|
+
// For headless gl we might have used custom width and height
|
|
4499
|
+
// hence prioritize cached clientWidth
|
|
4500
|
+
const cachedSize = luma.canvasSizeInfo;
|
|
4501
|
+
const clientWidth =
|
|
4502
|
+
'clientWidth' in cachedSize ? cachedSize.clientWidth : gl.canvas.clientWidth;
|
|
4503
|
+
return clientWidth ? gl.drawingBufferWidth / clientWidth : 1;
|
|
4504
|
+
}
|
|
4505
|
+
// use default device pixel ratio
|
|
4506
|
+
return 1;
|
|
4507
|
+
}
|
|
4508
|
+
|
|
4509
|
+
/**
|
|
4510
|
+
* Maps CSS pixel position to device pixel position
|
|
4511
|
+
* @type {types['cssToDevicePixels']}
|
|
4512
|
+
*/
|
|
4513
|
+
function cssToDevicePixels(gl, cssPixel, yInvert = true) {
|
|
4514
|
+
const ratio = cssToDeviceRatio(gl);
|
|
4515
|
+
const width = gl.drawingBufferWidth;
|
|
4516
|
+
const height = gl.drawingBufferHeight;
|
|
4517
|
+
return scalePixels(cssPixel, ratio, width, height, yInvert);
|
|
4518
|
+
}
|
|
4519
|
+
|
|
4520
|
+
// HELPER METHOD
|
|
4521
|
+
|
|
4522
|
+
/**
|
|
4523
|
+
* Calulates device pixel ratio, used during context creation
|
|
4524
|
+
* @type {types['getDevicePixelRatio']}
|
|
4525
|
+
*/
|
|
4526
|
+
function getDevicePixelRatio(useDevicePixels) {
|
|
4527
|
+
const windowRatio = typeof window === 'undefined' ? 1 : window.devicePixelRatio || 1;
|
|
4528
|
+
if (Number.isFinite(useDevicePixels)) {
|
|
4529
|
+
// @ts-ignore Can no longer be boolean after previous line
|
|
4530
|
+
return useDevicePixels <= 0 ? 1 : useDevicePixels;
|
|
4531
|
+
}
|
|
4532
|
+
return useDevicePixels ? windowRatio : 1;
|
|
4533
|
+
}
|
|
4534
|
+
|
|
4535
|
+
// PRIVATE
|
|
4536
|
+
|
|
4537
|
+
function scalePixels(pixel, ratio, width, height, yInvert) {
|
|
4538
|
+
const x = scaleX(pixel[0], ratio, width);
|
|
4539
|
+
let y = scaleY(pixel[1], ratio, height, yInvert);
|
|
4540
|
+
|
|
4541
|
+
// Find boundaries of next pixel to provide valid range of device pixel locaitons
|
|
4542
|
+
|
|
4543
|
+
let t = scaleX(pixel[0] + 1, ratio, width);
|
|
4544
|
+
// If next pixel's position is clamped to boundary, use it as is, otherwise subtract 1 for current pixel boundary
|
|
4545
|
+
const xHigh = t === width - 1 ? t : t - 1;
|
|
4546
|
+
|
|
4547
|
+
t = scaleY(pixel[1] + 1, ratio, height, yInvert);
|
|
4548
|
+
let yHigh;
|
|
4549
|
+
if (yInvert) {
|
|
4550
|
+
// If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range
|
|
4551
|
+
t = t === 0 ? t : t + 1;
|
|
4552
|
+
// swap y and yHigh
|
|
4553
|
+
yHigh = y;
|
|
4554
|
+
y = t;
|
|
4555
|
+
} else {
|
|
4556
|
+
// If next pixel's position is clamped to boundary, use it as is, otherwise clamp it to valid range
|
|
4557
|
+
yHigh = t === height - 1 ? t : t - 1;
|
|
4558
|
+
// y remains same
|
|
4559
|
+
}
|
|
4560
|
+
return {
|
|
4561
|
+
x,
|
|
4562
|
+
y,
|
|
4563
|
+
// when ratio < 1, current css pixel and next css pixel may point to same device pixel, set width/height to 1 in those cases.
|
|
4564
|
+
width: Math.max(xHigh - x + 1, 1),
|
|
4565
|
+
height: Math.max(yHigh - y + 1, 1)
|
|
4566
|
+
};
|
|
4567
|
+
}
|
|
4568
|
+
|
|
4569
|
+
function scaleX(x, ratio, width) {
|
|
4570
|
+
// since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit
|
|
4571
|
+
const r = Math.min(Math.round(x * ratio), width - 1);
|
|
4572
|
+
return r;
|
|
4573
|
+
}
|
|
4574
|
+
|
|
4575
|
+
function scaleY(y, ratio, height, yInvert) {
|
|
4576
|
+
// since we are rounding to nearest, when ratio > 1, edge pixels may point to out of bounds value, clamp to the limit
|
|
4577
|
+
return yInvert
|
|
4578
|
+
? Math.max(0, height - 1 - Math.round(y * ratio))
|
|
4579
|
+
: Math.min(Math.round(y * ratio), height - 1);
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4582
|
+
|
|
4583
|
+
/***/ }),
|
|
4584
|
+
|
|
4585
|
+
/***/ "./src/utils/log.js":
|
|
4586
|
+
/*!**************************!*\
|
|
4587
|
+
!*** ./src/utils/log.js ***!
|
|
4588
|
+
\**************************/
|
|
4589
|
+
/*! exports provided: log */
|
|
4590
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4591
|
+
|
|
4592
|
+
"use strict";
|
|
4593
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4594
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "log", function() { return log; });
|
|
4595
|
+
/* harmony import */ var _probe_gl_log__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @probe.gl/log */ "../../node_modules/@probe.gl/log/dist/esm/index.js");
|
|
4596
|
+
|
|
4597
|
+
|
|
4598
|
+
const log = new _probe_gl_log__WEBPACK_IMPORTED_MODULE_0__["Log"]({id: 'luma.gl'});
|
|
4599
|
+
|
|
4600
|
+
|
|
4601
|
+
/***/ }),
|
|
4602
|
+
|
|
4603
|
+
/***/ "./src/utils/utils.js":
|
|
4604
|
+
/*!****************************!*\
|
|
4605
|
+
!*** ./src/utils/utils.js ***!
|
|
4606
|
+
\****************************/
|
|
4607
|
+
/*! exports provided: isObjectEmpty, deepArrayEqual */
|
|
4608
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4609
|
+
|
|
4610
|
+
"use strict";
|
|
4611
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4612
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObjectEmpty", function() { return isObjectEmpty; });
|
|
4613
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "deepArrayEqual", function() { return deepArrayEqual; });
|
|
4614
|
+
// Returns true if given object is empty, false otherwise.
|
|
4615
|
+
function isObjectEmpty(object) {
|
|
4616
|
+
for (const key in object) {
|
|
4617
|
+
return false;
|
|
4618
|
+
}
|
|
4619
|
+
return true;
|
|
4620
|
+
}
|
|
4621
|
+
|
|
4622
|
+
function deepArrayEqual(x, y) {
|
|
4623
|
+
if (x === y) {
|
|
4624
|
+
return true;
|
|
4625
|
+
}
|
|
4626
|
+
const isArrayX = Array.isArray(x) || ArrayBuffer.isView(x);
|
|
4627
|
+
const isArrayY = Array.isArray(y) || ArrayBuffer.isView(y);
|
|
4628
|
+
|
|
4629
|
+
// @ts-expect-error DataView...
|
|
4630
|
+
if (isArrayX && isArrayY && x.length === y.length) {
|
|
4631
|
+
// @ts-expect-error DataView...
|
|
4632
|
+
for (let i = 0; i < x.length; ++i) {
|
|
4633
|
+
if (x[i] !== y[i]) {
|
|
4634
|
+
return false;
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4637
|
+
return true;
|
|
4638
|
+
}
|
|
4639
|
+
return false;
|
|
4640
|
+
}
|
|
4641
|
+
|
|
4642
|
+
|
|
4643
|
+
/***/ }),
|
|
4644
|
+
|
|
4645
|
+
/***/ "./src/utils/webgl-checks.js":
|
|
4646
|
+
/*!***********************************!*\
|
|
4647
|
+
!*** ./src/utils/webgl-checks.js ***!
|
|
4648
|
+
\***********************************/
|
|
4649
|
+
/*! exports provided: ERR_WEBGL, ERR_WEBGL2, isWebGL, isWebGL2, getWebGL2Context, assertWebGLContext, assertWebGL2Context */
|
|
4650
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
4651
|
+
|
|
4652
|
+
"use strict";
|
|
4653
|
+
__webpack_require__.r(__webpack_exports__);
|
|
4654
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERR_WEBGL", function() { return ERR_WEBGL; });
|
|
4655
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERR_WEBGL2", function() { return ERR_WEBGL2; });
|
|
4656
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWebGL", function() { return isWebGL; });
|
|
4657
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isWebGL2", function() { return isWebGL2; });
|
|
4658
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getWebGL2Context", function() { return getWebGL2Context; });
|
|
4659
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertWebGLContext", function() { return assertWebGLContext; });
|
|
4660
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertWebGL2Context", function() { return assertWebGL2Context; });
|
|
4661
|
+
/* harmony import */ var _assert__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assert */ "./src/utils/assert.js");
|
|
4662
|
+
|
|
4663
|
+
|
|
4664
|
+
const ERR_CONTEXT = 'Invalid WebGLRenderingContext';
|
|
4665
|
+
const ERR_WEBGL = ERR_CONTEXT;
|
|
4666
|
+
const ERR_WEBGL2 = 'Requires WebGL2';
|
|
4667
|
+
|
|
4668
|
+
function isWebGL(gl) {
|
|
4669
|
+
if (typeof WebGLRenderingContext !== 'undefined' && gl instanceof WebGLRenderingContext) {
|
|
4670
|
+
return true;
|
|
4671
|
+
}
|
|
4672
|
+
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
4673
|
+
return true;
|
|
4674
|
+
}
|
|
4675
|
+
// Look for debug contexts, headless gl etc
|
|
4676
|
+
return Boolean(gl && Number.isFinite(gl._version));
|
|
4677
|
+
}
|
|
4678
|
+
|
|
4679
|
+
function isWebGL2(gl) {
|
|
4680
|
+
if (typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext) {
|
|
4681
|
+
return true;
|
|
4682
|
+
}
|
|
4683
|
+
// Look for debug contexts, headless gl etc
|
|
4684
|
+
return Boolean(gl && gl._version === 2);
|
|
4685
|
+
}
|
|
4686
|
+
|
|
4687
|
+
function getWebGL2Context(gl) {
|
|
4688
|
+
return isWebGL2(gl) ? gl : null;
|
|
4689
|
+
}
|
|
4690
|
+
|
|
4691
|
+
function assertWebGLContext(gl) {
|
|
4692
|
+
Object(_assert__WEBPACK_IMPORTED_MODULE_0__["assert"])(isWebGL(gl), ERR_CONTEXT);
|
|
4693
|
+
return gl;
|
|
4694
|
+
}
|
|
4695
|
+
|
|
4696
|
+
function assertWebGL2Context(gl) {
|
|
4697
|
+
Object(_assert__WEBPACK_IMPORTED_MODULE_0__["assert"])(isWebGL2(gl), ERR_WEBGL2);
|
|
4698
|
+
return gl;
|
|
4699
|
+
}
|
|
4700
|
+
|
|
4701
|
+
|
|
4702
|
+
/***/ }),
|
|
4703
|
+
|
|
4704
|
+
/***/ 0:
|
|
4705
|
+
/*!*******************************!*\
|
|
4706
|
+
!*** asciify-image (ignored) ***!
|
|
4707
|
+
\*******************************/
|
|
4708
|
+
/*! no static exports found */
|
|
4709
|
+
/***/ (function(module, exports) {
|
|
4710
|
+
|
|
4711
|
+
/* (ignored) */
|
|
4712
|
+
|
|
4713
|
+
/***/ })
|
|
4714
|
+
|
|
4715
|
+
/******/ });
|
|
4716
|
+
});
|