/*! * * deck.gl.js (https://github.com/SuperMap/deck.gl.git) * license: MIT * * origin: 'https://github.com/uber/deck.gl.git' * fork: 'https://github.com/SuperMap/deck.gl.git' * branch: 'https://github.com/SuperMap/deck.gl/tree/deck.gl-for-iclient' * * */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["deckgl"] = factory(); else root["deckgl"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { /******/ configurable: false, /******/ enumerable: true, /******/ get: getter /******/ }); /******/ } /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 288); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var core = __webpack_require__(33); var hide = __webpack_require__(19); var redefine = __webpack_require__(20); var ctx = __webpack_require__(28); var PROTOTYPE = 'prototype'; var $export = function (type, name, source) { var IS_FORCED = type & $export.F; var IS_GLOBAL = type & $export.G; var IS_STATIC = type & $export.S; var IS_PROTO = type & $export.P; var IS_BIND = type & $export.B; var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE]; var exports = IS_GLOBAL ? core : core[name] || (core[name] = {}); var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {}); var key, own, out, exp; if (IS_GLOBAL) source = name; for (key in source) { // contains in native own = !IS_FORCED && target && target[key] !== undefined; // export native or passed out = (own ? target : source)[key]; // bind timers to global for call from export context exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out; // extend global if (target) redefine(target, key, out, type & $export.U); // export if (exports[key] != out) hide(exports, key, exp); if (IS_PROTO && expProto[key] != out) expProto[key] = out; } }; global.core = core; // type bitmap $export.F = 1; // forced $export.G = 2; // global $export.S = 4; // static $export.P = 8; // proto $export.B = 16; // bind $export.W = 32; // wrap $export.U = 64; // safe $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }), /* 1 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) { // compare and isBuffer taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js // original notice: /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ function compare(a, b) { if (a === b) { return 0; } var x = a.length; var y = b.length; for (var i = 0, len = Math.min(x, y); i < len; ++i) { if (a[i] !== b[i]) { x = a[i]; y = b[i]; break; } } if (x < y) { return -1; } if (y < x) { return 1; } return 0; } function isBuffer(b) { if (global.Buffer && typeof global.Buffer.isBuffer === 'function') { return global.Buffer.isBuffer(b); } return !!(b != null && b._isBuffer); } // based on node assert, original notice: // http://wiki.commonjs.org/wiki/Unit_Testing/1.0 // // THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! // // Originally from narwhal.js (http://narwhaljs.org) // Copyright (c) 2009 Thomas Robinson <280north.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the 'Software'), to // deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or // sell copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. var util = __webpack_require__(684); var hasOwn = Object.prototype.hasOwnProperty; var pSlice = Array.prototype.slice; var functionsHaveNames = (function () { return function foo() {}.name === 'foo'; }()); function pToString (obj) { return Object.prototype.toString.call(obj); } function isView(arrbuf) { if (isBuffer(arrbuf)) { return false; } if (typeof global.ArrayBuffer !== 'function') { return false; } if (typeof ArrayBuffer.isView === 'function') { return ArrayBuffer.isView(arrbuf); } if (!arrbuf) { return false; } if (arrbuf instanceof DataView) { return true; } if (arrbuf.buffer && arrbuf.buffer instanceof ArrayBuffer) { return true; } return false; } // 1. The assert module provides functions that throw // AssertionError's when particular conditions are not met. The // assert module must conform to the following interface. var assert = module.exports = ok; // 2. The AssertionError is defined in assert. // new assert.AssertionError({ message: message, // actual: actual, // expected: expected }) var regex = /\s*function\s+([^\(\s]*)\s*/; // based on https://github.com/ljharb/function.prototype.name/blob/adeeeec8bfcc6068b187d7d9fb3d5bb1d3a30899/implementation.js function getName(func) { if (!util.isFunction(func)) { return; } if (functionsHaveNames) { return func.name; } var str = func.toString(); var match = str.match(regex); return match && match[1]; } assert.AssertionError = function AssertionError(options) { this.name = 'AssertionError'; this.actual = options.actual; this.expected = options.expected; this.operator = options.operator; if (options.message) { this.message = options.message; this.generatedMessage = false; } else { this.message = getMessage(this); this.generatedMessage = true; } var stackStartFunction = options.stackStartFunction || fail; if (Error.captureStackTrace) { Error.captureStackTrace(this, stackStartFunction); } else { // non v8 browsers so we can have a stacktrace var err = new Error(); if (err.stack) { var out = err.stack; // try to strip useless frames var fn_name = getName(stackStartFunction); var idx = out.indexOf('\n' + fn_name); if (idx >= 0) { // once we have located the function frame // we need to strip out everything before it (and its line) var next_line = out.indexOf('\n', idx + 1); out = out.substring(next_line + 1); } this.stack = out; } } }; // assert.AssertionError instanceof Error util.inherits(assert.AssertionError, Error); function truncate(s, n) { if (typeof s === 'string') { return s.length < n ? s : s.slice(0, n); } else { return s; } } function inspect(something) { if (functionsHaveNames || !util.isFunction(something)) { return util.inspect(something); } var rawname = getName(something); var name = rawname ? ': ' + rawname : ''; return '[Function' + name + ']'; } function getMessage(self) { return truncate(inspect(self.actual), 128) + ' ' + self.operator + ' ' + truncate(inspect(self.expected), 128); } // At present only the three keys mentioned above are used and // understood by the spec. Implementations or sub modules can pass // other keys to the AssertionError's constructor - they will be // ignored. // 3. All of the following functions must throw an AssertionError // when a corresponding condition is not met, with a message that // may be undefined if not provided. All assertion methods provide // both the actual and expected values to the assertion error for // display purposes. function fail(actual, expected, message, operator, stackStartFunction) { throw new assert.AssertionError({ message: message, actual: actual, expected: expected, operator: operator, stackStartFunction: stackStartFunction }); } // EXTENSION! allows for well behaved errors defined elsewhere. assert.fail = fail; // 4. Pure assertion tests whether a value is truthy, as determined // by !!guard. // assert.ok(guard, message_opt); // This statement is equivalent to assert.equal(true, !!guard, // message_opt);. To test strictly for the value true, use // assert.strictEqual(true, guard, message_opt);. function ok(value, message) { if (!value) fail(value, true, message, '==', assert.ok); } assert.ok = ok; // 5. The equality assertion tests shallow, coercive equality with // ==. // assert.equal(actual, expected, message_opt); assert.equal = function equal(actual, expected, message) { if (actual != expected) fail(actual, expected, message, '==', assert.equal); }; // 6. The non-equality assertion tests for whether two objects are not equal // with != assert.notEqual(actual, expected, message_opt); assert.notEqual = function notEqual(actual, expected, message) { if (actual == expected) { fail(actual, expected, message, '!=', assert.notEqual); } }; // 7. The equivalence assertion tests a deep equality relation. // assert.deepEqual(actual, expected, message_opt); assert.deepEqual = function deepEqual(actual, expected, message) { if (!_deepEqual(actual, expected, false)) { fail(actual, expected, message, 'deepEqual', assert.deepEqual); } }; assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) { if (!_deepEqual(actual, expected, true)) { fail(actual, expected, message, 'deepStrictEqual', assert.deepStrictEqual); } }; function _deepEqual(actual, expected, strict, memos) { // 7.1. All identical values are equivalent, as determined by ===. if (actual === expected) { return true; } else if (isBuffer(actual) && isBuffer(expected)) { return compare(actual, expected) === 0; // 7.2. If the expected value is a Date object, the actual value is // equivalent if it is also a Date object that refers to the same time. } else if (util.isDate(actual) && util.isDate(expected)) { return actual.getTime() === expected.getTime(); // 7.3 If the expected value is a RegExp object, the actual value is // equivalent if it is also a RegExp object with the same source and // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). } else if (util.isRegExp(actual) && util.isRegExp(expected)) { return actual.source === expected.source && actual.global === expected.global && actual.multiline === expected.multiline && actual.lastIndex === expected.lastIndex && actual.ignoreCase === expected.ignoreCase; // 7.4. Other pairs that do not both pass typeof value == 'object', // equivalence is determined by ==. } else if ((actual === null || typeof actual !== 'object') && (expected === null || typeof expected !== 'object')) { return strict ? actual === expected : actual == expected; // If both values are instances of typed arrays, wrap their underlying // ArrayBuffers in a Buffer each to increase performance // This optimization requires the arrays to have the same type as checked by // Object.prototype.toString (aka pToString). Never perform binary // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their // bit patterns are not identical. } else if (isView(actual) && isView(expected) && pToString(actual) === pToString(expected) && !(actual instanceof Float32Array || actual instanceof Float64Array)) { return compare(new Uint8Array(actual.buffer), new Uint8Array(expected.buffer)) === 0; // 7.5 For all other Object pairs, including Array objects, equivalence is // determined by having the same number of owned properties (as verified // with Object.prototype.hasOwnProperty.call), the same set of keys // (although not necessarily the same order), equivalent values for every // corresponding key, and an identical 'prototype' property. Note: this // accounts for both named and indexed properties on Arrays. } else if (isBuffer(actual) !== isBuffer(expected)) { return false; } else { memos = memos || {actual: [], expected: []}; var actualIndex = memos.actual.indexOf(actual); if (actualIndex !== -1) { if (actualIndex === memos.expected.indexOf(expected)) { return true; } } memos.actual.push(actual); memos.expected.push(expected); return objEquiv(actual, expected, strict, memos); } } function isArguments(object) { return Object.prototype.toString.call(object) == '[object Arguments]'; } function objEquiv(a, b, strict, actualVisitedObjects) { if (a === null || a === undefined || b === null || b === undefined) return false; // if one is a primitive, the other must be same if (util.isPrimitive(a) || util.isPrimitive(b)) return a === b; if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) return false; var aIsArgs = isArguments(a); var bIsArgs = isArguments(b); if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) return false; if (aIsArgs) { a = pSlice.call(a); b = pSlice.call(b); return _deepEqual(a, b, strict); } var ka = objectKeys(a); var kb = objectKeys(b); var key, i; // having the same number of owned properties (keys incorporates // hasOwnProperty) if (ka.length !== kb.length) return false; //the same set of keys (although not necessarily the same order), ka.sort(); kb.sort(); //~~~cheap key test for (i = ka.length - 1; i >= 0; i--) { if (ka[i] !== kb[i]) return false; } //equivalent values for every corresponding key, and //~~~possibly expensive deep test for (i = ka.length - 1; i >= 0; i--) { key = ka[i]; if (!_deepEqual(a[key], b[key], strict, actualVisitedObjects)) return false; } return true; } // 8. The non-equivalence assertion tests for any deep inequality. // assert.notDeepEqual(actual, expected, message_opt); assert.notDeepEqual = function notDeepEqual(actual, expected, message) { if (_deepEqual(actual, expected, false)) { fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); } }; assert.notDeepStrictEqual = notDeepStrictEqual; function notDeepStrictEqual(actual, expected, message) { if (_deepEqual(actual, expected, true)) { fail(actual, expected, message, 'notDeepStrictEqual', notDeepStrictEqual); } } // 9. The strict equality assertion tests strict equality, as determined by ===. // assert.strictEqual(actual, expected, message_opt); assert.strictEqual = function strictEqual(actual, expected, message) { if (actual !== expected) { fail(actual, expected, message, '===', assert.strictEqual); } }; // 10. The strict non-equality assertion tests for strict inequality, as // determined by !==. assert.notStrictEqual(actual, expected, message_opt); assert.notStrictEqual = function notStrictEqual(actual, expected, message) { if (actual === expected) { fail(actual, expected, message, '!==', assert.notStrictEqual); } }; function expectedException(actual, expected) { if (!actual || !expected) { return false; } if (Object.prototype.toString.call(expected) == '[object RegExp]') { return expected.test(actual); } try { if (actual instanceof expected) { return true; } } catch (e) { // Ignore. The instanceof check doesn't work for arrow functions. } if (Error.isPrototypeOf(expected)) { return false; } return expected.call({}, actual) === true; } function _tryBlock(block) { var error; try { block(); } catch (e) { error = e; } return error; } function _throws(shouldThrow, block, expected, message) { var actual; if (typeof block !== 'function') { throw new TypeError('"block" argument must be a function'); } if (typeof expected === 'string') { message = expected; expected = null; } actual = _tryBlock(block); message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + (message ? ' ' + message : '.'); if (shouldThrow && !actual) { fail(actual, expected, 'Missing expected exception' + message); } var userProvidedMessage = typeof message === 'string'; var isUnwantedException = !shouldThrow && util.isError(actual); var isUnexpectedException = !shouldThrow && actual && !expected; if ((isUnwantedException && userProvidedMessage && expectedException(actual, expected)) || isUnexpectedException) { fail(actual, expected, 'Got unwanted exception' + message); } if ((shouldThrow && actual && expected && !expectedException(actual, expected)) || (!shouldThrow && actual)) { throw actual; } } // 11. Expected to throw an error: // assert.throws(block, Error_opt, message_opt); assert.throws = function(block, /*optional*/error, /*optional*/message) { _throws(true, block, error, message); }; // EXTENSION! This is annoying to write outside this module. assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { _throws(false, block, error, message); }; assert.ifError = function(err) { if (err) throw err; }; var objectKeys = Object.keys || function (obj) { var keys = []; for (var key in obj) { if (hasOwn.call(obj, key)) keys.push(key); } return keys; }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(47))) /***/ }), /* 2 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(5); module.exports = function (it) { if (!isObject(it)) throw TypeError(it + ' is not an object!'); return it; }; /***/ }), /* 3 */ /***/ (function(module, exports) { // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self // eslint-disable-next-line no-new-func : Function('return this')(); if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef /***/ }), /* 4 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return !!exec(); } catch (e) { return true; } }; /***/ }), /* 5 */ /***/ (function(module, exports) { module.exports = function (it) { return typeof it === 'object' ? it !== null : typeof it === 'function'; }; /***/ }), /* 6 */ /***/ (function(module, exports, __webpack_require__) { var store = __webpack_require__(98)('wks'); var uid = __webpack_require__(58); var Symbol = __webpack_require__(3).Symbol; var USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function (name) { return store[name] || (store[name] = USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name)); }; $exports.store = store; /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export ERR_CONTEXT */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return ERR_WEBGL; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return ERR_WEBGL2; }); /* harmony export (immutable) */ __webpack_exports__["a"] = isWebGL; /* harmony export (immutable) */ __webpack_exports__["b"] = isWebGL2; /* harmony export (immutable) */ __webpack_exports__["j"] = assertWebGLContext; /* harmony export (immutable) */ __webpack_exports__["g"] = assertWebGL2Context; /* harmony export (immutable) */ __webpack_exports__["c"] = setContextDefaults; /* harmony export (immutable) */ __webpack_exports__["d"] = createGLContext; /* harmony export (immutable) */ __webpack_exports__["e"] = deleteGLContext; /* harmony export (immutable) */ __webpack_exports__["f"] = pollContext; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_utils_track_context_state__ = __webpack_require__(164); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__webgl_utils__ = __webpack_require__(60); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__context_debug__ = __webpack_require__(269); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__context_limits__ = __webpack_require__(165); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__helpers_query_manager__ = __webpack_require__(166); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__init__ = __webpack_require__(106); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_assert__); // WebGLRenderingContext related methods // Heuristic testing of contexts (to indentify debug wrappers around gl contexts) var GL_ARRAY_BUFFER = 0x8892; var GL_TEXTURE_BINDING_3D = 0x806A; var ERR_CONTEXT = 'Invalid WebGLRenderingContext'; var ERR_WEBGL = ERR_CONTEXT; var ERR_WEBGL2 = 'Requires WebGL2'; var ERR_WEBGL_MISSING_NODE = 'WebGL API is missing. To run luma.gl under Node.js, please "npm install gl"\nand import \'luma.gl/headless\' before importing \'luma.gl\'.'; var ERR_HEADLESSGL_NOT_AVAILABLE = 'Cannot create headless WebGL context, headlessGL not available'; var ERR_HEADLESSGL_FAILED = 'headlessGL failed to create headless WebGL context'; function isWebGL(gl) { return Boolean(gl && (gl instanceof __WEBPACK_IMPORTED_MODULE_0__api__["b" /* WebGLRenderingContext */] || gl.ARRAY_BUFFER === GL_ARRAY_BUFFER)); } function isWebGL2(gl) { return Boolean(gl && (gl instanceof __WEBPACK_IMPORTED_MODULE_0__api__["c" /* WebGL2RenderingContext */] || gl.TEXTURE_BINDING_3D === GL_TEXTURE_BINDING_3D)); } function assertWebGLContext(gl) { // Need to handle debug context __WEBPACK_IMPORTED_MODULE_8_assert___default()(isWebGL(gl), ERR_CONTEXT); } function assertWebGL2Context(gl) { // Need to handle debug context __WEBPACK_IMPORTED_MODULE_8_assert___default()(isWebGL2(gl), ERR_WEBGL2); } var contextDefaults = { // COMMON CONTEXT PARAMETERS // Attempt to allocate WebGL2 context webgl2: true, // Attempt to create a WebGL2 context (false to force webgl1) webgl1: true, // Attempt to create a WebGL1 context (false to fail if webgl2 not available) throwOnFailure: true, manageState: true, // BROWSER CONTEXT PARAMETERS canvas: null, // A canvas element or a canvas string id debug: false, // Instrument context (at the expense of performance) // HEADLESS CONTEXT PARAMETERS width: 800, // width are height are only used by headless gl height: 600 // WEBGL/HEADLESS CONTEXT PARAMETERS // Remaining options are passed through to context creator }; /* * Change default context creation parameters. * Main use case is regression test suite. */ function setContextDefaults() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; Object.assign(contextDefaults, { width: 1, height: 1 }, opts); } /* * Creates a context giving access to the WebGL API */ /* eslint-disable complexity, max-statements */ function createGLContext() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; opts = Object.assign({}, contextDefaults, opts); var _opts = opts, canvas = _opts.canvas, width = _opts.width, height = _opts.height, throwOnError = _opts.throwOnError, manageState = _opts.manageState, debug = _opts.debug; // Error reporting function, enables exceptions to be disabled function onError(message) { if (throwOnError) { throw new Error(message); } // log.log(0, message); return null; } var gl = void 0; if (__WEBPACK_IMPORTED_MODULE_6__utils__["a" /* isBrowser */]) { // Make sure we have a real canvas ("canvas" can a string, a canvas or null) var realCanvas = void 0; if (!canvas) { realCanvas = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__webgl_utils__["c" /* createCanvas */])({ id: 'lumagl-canvas', width: width, height: height, onError: onError }); } else if (typeof canvas === 'string') { realCanvas = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__webgl_utils__["d" /* getCanvas */])({ id: canvas }); } else { realCanvas = canvas; } // Create a WebGL context in the canvas gl = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__webgl_utils__["e" /* createContext */])({ canvas: realCanvas, opts: opts }); } else { // Create a headless-gl context under Node.js gl = _createHeadlessContext({ width: width, height: height, opts: opts, onError: onError }); } if (!gl) { return null; } // Install context state tracking if (manageState) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_track_context_state__["a" /* default */])(gl, { copyState: false, log: function log() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].log.apply(__WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */], [1].concat(args)); } }); } // Add debug instrumentation to the context if (__WEBPACK_IMPORTED_MODULE_6__utils__["a" /* isBrowser */] && debug) { gl = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__context_debug__["a" /* makeDebugContext */])(gl, { debug: debug }); // Debug forces log level to at least 1 __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].priority = Math.max(__WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].priority, 1); // Log some debug info about the context } logInfo(gl); // Add to seer integration return gl; } function deleteGLContext(gl) {} // Remove from seer integration // POLLING FOR PENDING QUERIES // Calling this function checks all pending queries for completion function pollContext(gl) { __WEBPACK_IMPORTED_MODULE_5__helpers_query_manager__["a" /* default */].poll(gl); } function logInfo(gl) { var webGL = isWebGL2(gl) ? 'WebGL2' : 'WebGL1'; var info = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__context_limits__["d" /* glGetDebugInfo */])(gl); var driver = info ? '(' + info.vendor + ',' + info.renderer + ')' : ''; var debug = gl.debug ? ' debug' : ''; __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].once(0, '' + webGL + debug + ' context ' + driver); } // Create headless gl context (for running under Node.js) function _createHeadlessContext(_ref) { var width = _ref.width, height = _ref.height, opts = _ref.opts, onError = _ref.onError; var webgl1 = opts.webgl1, webgl2 = opts.webgl2; if (webgl2 && !webgl1) { return onError('headless-gl does not support WebGL2'); } if (!__WEBPACK_IMPORTED_MODULE_0__api__["d" /* webGLTypesAvailable */]) { return onError(ERR_WEBGL_MISSING_NODE); } if (!__WEBPACK_IMPORTED_MODULE_7__init__["default"].globals.headlessGL) { return onError(ERR_HEADLESSGL_NOT_AVAILABLE); } var gl = __WEBPACK_IMPORTED_MODULE_7__init__["default"].globals.headlessGL(width, height, opts); if (!gl) { return onError(ERR_HEADLESSGL_FAILED); } return gl; } //# sourceMappingURL=context.js.map /***/ }), /* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__is_browser__ = __webpack_require__(262); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__is_browser__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__promise_utils__ = __webpack_require__(660); /* unused harmony reexport promisify */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(661); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_2__utils__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_2__utils__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_2__utils__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__log__ = __webpack_require__(263); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_3__log__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_3__log__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__typed_array_utils__ = __webpack_require__(163); /* unused harmony reexport getGLTypeFromTypedArray */ /* unused harmony reexport getTypedArrayFromGLType */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_4__typed_array_utils__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_4__typed_array_utils__["d"]; }); //# sourceMappingURL=index.js.map /***/ }), /* 9 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty module.exports = !__webpack_require__(4)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 10 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(2); var IE8_DOM_DEFINE = __webpack_require__(207); var toPrimitive = __webpack_require__(37); var dP = Object.defineProperty; exports.f = __webpack_require__(9) ? Object.defineProperty : function defineProperty(O, P, Attributes) { anObject(O); P = toPrimitive(P, true); anObject(Attributes); if (IE8_DOM_DEFINE) try { return dP(O, P, Attributes); } catch (e) { /* empty */ } if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!'); if ('value' in Attributes) O[P] = Attributes.value; return O; }; /***/ }), /* 11 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.15 ToLength var toInteger = __webpack_require__(36); var min = Math.min; module.exports = function (it) { return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 }; /***/ }), /* 12 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "experimental", function() { return experimental; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl_gl_constants__ = __webpack_require__(25); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "GL", function() { return __WEBPACK_IMPORTED_MODULE_0__webgl_gl_constants__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "glGet", function() { return __WEBPACK_IMPORTED_MODULE_0__webgl_gl_constants__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "glKey", function() { return __WEBPACK_IMPORTED_MODULE_0__webgl_gl_constants__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_utils__ = __webpack_require__(60); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "trackContextCreation", function() { return __WEBPACK_IMPORTED_MODULE_1__webgl_utils__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "trackContextState", function() { return __WEBPACK_IMPORTED_MODULE_1__webgl_utils__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__webgl_context__ = __webpack_require__(7); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWebGL", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_context__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWebGL2", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_context__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "setContextDefaults", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_context__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "createGLContext", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_context__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "deleteGLContext", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_context__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pollContext", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_context__["f"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__ = __webpack_require__(68); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "resetParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getParameter", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "setParameter", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "setParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "withParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["f"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getModifiedParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__webgl_context_state__["g"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__webgl_context_limits__ = __webpack_require__(165); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getContextInfo", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_context_limits__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getGLContextInfo", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_context_limits__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getContextLimits", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_context_limits__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "glGetDebugInfo", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_context_limits__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__webgl_context_features__ = __webpack_require__(108); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FEATURES", function() { return __WEBPACK_IMPORTED_MODULE_5__webgl_context_features__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "hasFeature", function() { return __WEBPACK_IMPORTED_MODULE_5__webgl_context_features__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "hasFeatures", function() { return __WEBPACK_IMPORTED_MODULE_5__webgl_context_features__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getFeatures", function() { return __WEBPACK_IMPORTED_MODULE_5__webgl_context_features__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__webgl_context_debug__ = __webpack_require__(269); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "makeDebugContext", function() { return __WEBPACK_IMPORTED_MODULE_6__webgl_context_debug__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__webgl_api_debug_parameters__ = __webpack_require__(267); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "installParameterDefinitions", function() { return __WEBPACK_IMPORTED_MODULE_7__webgl_api_debug_parameters__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__webgl_buffer__ = __webpack_require__(67); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Buffer", function() { return __WEBPACK_IMPORTED_MODULE_8__webgl_buffer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__webgl_shader__ = __webpack_require__(111); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Shader", function() { return __WEBPACK_IMPORTED_MODULE_9__webgl_shader__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VertexShader", function() { return __WEBPACK_IMPORTED_MODULE_9__webgl_shader__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FragmentShader", function() { return __WEBPACK_IMPORTED_MODULE_9__webgl_shader__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__webgl_program__ = __webpack_require__(109); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return __WEBPACK_IMPORTED_MODULE_10__webgl_program__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__webgl_framebuffer__ = __webpack_require__(69); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Framebuffer", function() { return __WEBPACK_IMPORTED_MODULE_11__webgl_framebuffer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__webgl_renderbuffer__ = __webpack_require__(110); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Renderbuffer", function() { return __WEBPACK_IMPORTED_MODULE_12__webgl_renderbuffer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__webgl_texture_2d__ = __webpack_require__(167); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Texture2D", function() { return __WEBPACK_IMPORTED_MODULE_13__webgl_texture_2d__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__webgl_texture_cube__ = __webpack_require__(275); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TextureCube", function() { return __WEBPACK_IMPORTED_MODULE_14__webgl_texture_cube__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__webgl_draw__ = __webpack_require__(270); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return __WEBPACK_IMPORTED_MODULE_15__webgl_draw__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__webgl_clear__ = __webpack_require__(107); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return __WEBPACK_IMPORTED_MODULE_16__webgl_clear__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clearBuffer", function() { return __WEBPACK_IMPORTED_MODULE_16__webgl_clear__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17__webgl_fence_sync__ = __webpack_require__(271); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FenceSync", function() { return __WEBPACK_IMPORTED_MODULE_17__webgl_fence_sync__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18__webgl_query__ = __webpack_require__(273); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Query", function() { return __WEBPACK_IMPORTED_MODULE_18__webgl_query__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19__webgl_sampler__ = __webpack_require__(274); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Sampler", function() { return __WEBPACK_IMPORTED_MODULE_19__webgl_sampler__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20__webgl_texture_3d__ = __webpack_require__(668); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Texture3D", function() { return __WEBPACK_IMPORTED_MODULE_20__webgl_texture_3d__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21__webgl_texture_2d_array__ = __webpack_require__(667); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Texture2DArray", function() { return __WEBPACK_IMPORTED_MODULE_21__webgl_texture_2d_array__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22__webgl_transform_feedback__ = __webpack_require__(276); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TransformFeedback", function() { return __WEBPACK_IMPORTED_MODULE_22__webgl_transform_feedback__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23__webgl_vertex_array__ = __webpack_require__(169); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VertexArray", function() { return __WEBPACK_IMPORTED_MODULE_23__webgl_vertex_array__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_24__webgl_uniform_buffer_layout__ = __webpack_require__(669); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "UniformBufferLayout", function() { return __WEBPACK_IMPORTED_MODULE_24__webgl_uniform_buffer_layout__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_25__core_model__ = __webpack_require__(104); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Model", function() { return __WEBPACK_IMPORTED_MODULE_25__core_model__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_26__core_animation_loop__ = __webpack_require__(249); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationLoop", function() { return __WEBPACK_IMPORTED_MODULE_26__core_animation_loop__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_27__core_pick_models__ = __webpack_require__(626); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pickModels", function() { return __WEBPACK_IMPORTED_MODULE_27__core_pick_models__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_28__core_picking_colors__ = __webpack_require__(627); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "encodePickingColor", function() { return __WEBPACK_IMPORTED_MODULE_28__core_picking_colors__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "decodePickingColor", function() { return __WEBPACK_IMPORTED_MODULE_28__core_picking_colors__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getNullPickingColor", function() { return __WEBPACK_IMPORTED_MODULE_28__core_picking_colors__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_29__packages_events__ = __webpack_require__(641); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "addEvents", function() { return __WEBPACK_IMPORTED_MODULE_29__packages_events__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_30__geometry_geometry__ = __webpack_require__(45); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Geometry", function() { return __WEBPACK_IMPORTED_MODULE_30__geometry_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_31__geometry_cone_geometry__ = __webpack_require__(251); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ConeGeometry", function() { return __WEBPACK_IMPORTED_MODULE_31__geometry_cone_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_32__geometry_cube_geometry__ = __webpack_require__(252); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CubeGeometry", function() { return __WEBPACK_IMPORTED_MODULE_32__geometry_cube_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_33__geometry_cylinder_geometry__ = __webpack_require__(253); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CylinderGeometry", function() { return __WEBPACK_IMPORTED_MODULE_33__geometry_cylinder_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_34__geometry_ico_sphere_geometry__ = __webpack_require__(254); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "IcoSphereGeometry", function() { return __WEBPACK_IMPORTED_MODULE_34__geometry_ico_sphere_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_35__geometry_plane_geometry__ = __webpack_require__(255); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PlaneGeometry", function() { return __WEBPACK_IMPORTED_MODULE_35__geometry_plane_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_36__geometry_sphere_geometry__ = __webpack_require__(256); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SphereGeometry", function() { return __WEBPACK_IMPORTED_MODULE_36__geometry_sphere_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_37__geometry_truncated_cone_geometry__ = __webpack_require__(105); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TruncatedConeGeometry", function() { return __WEBPACK_IMPORTED_MODULE_37__geometry_truncated_cone_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_38__models_cone__ = __webpack_require__(633); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Cone", function() { return __WEBPACK_IMPORTED_MODULE_38__models_cone__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_39__models_cube__ = __webpack_require__(634); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Cube", function() { return __WEBPACK_IMPORTED_MODULE_39__models_cube__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_40__models_cylinder__ = __webpack_require__(635); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Cylinder", function() { return __WEBPACK_IMPORTED_MODULE_40__models_cylinder__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_41__models_ico_sphere__ = __webpack_require__(636); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "IcoSphere", function() { return __WEBPACK_IMPORTED_MODULE_41__models_ico_sphere__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_42__models_plane__ = __webpack_require__(637); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Plane", function() { return __WEBPACK_IMPORTED_MODULE_42__models_plane__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_43__models_sphere__ = __webpack_require__(638); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Sphere", function() { return __WEBPACK_IMPORTED_MODULE_43__models_sphere__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_44__models_truncated_cone__ = __webpack_require__(639); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TruncatedCone", function() { return __WEBPACK_IMPORTED_MODULE_44__models_truncated_cone__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_45__models_clip_space_quad__ = __webpack_require__(632); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ClipSpaceQuad", function() { return __WEBPACK_IMPORTED_MODULE_45__models_clip_space_quad__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__io__ = __webpack_require__(630); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_46__io___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_46__io__); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "setPathPrefix")) __webpack_require__.d(__webpack_exports__, "setPathPrefix", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["setPathPrefix"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadFile")) __webpack_require__.d(__webpack_exports__, "loadFile", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadFile"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadImage")) __webpack_require__.d(__webpack_exports__, "loadImage", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadImage"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadFiles")) __webpack_require__.d(__webpack_exports__, "loadFiles", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadFiles"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadImages")) __webpack_require__.d(__webpack_exports__, "loadImages", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadImages"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadTextures")) __webpack_require__.d(__webpack_exports__, "loadTextures", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadTextures"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadProgram")) __webpack_require__.d(__webpack_exports__, "loadProgram", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadProgram"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "loadModel")) __webpack_require__.d(__webpack_exports__, "loadModel", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["loadModel"]; }); /* harmony reexport (binding) */ if(__webpack_require__.o(__WEBPACK_IMPORTED_MODULE_46__io__, "parseModel")) __webpack_require__.d(__webpack_exports__, "parseModel", function() { return __WEBPACK_IMPORTED_MODULE_46__io__["parseModel"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_47__shadertools_lib_shader_cache__ = __webpack_require__(259); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ShaderCache", function() { return __WEBPACK_IMPORTED_MODULE_47__shadertools_lib_shader_cache__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_48__shadertools_lib_assemble_shaders__ = __webpack_require__(258); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "assembleShaders", function() { return __WEBPACK_IMPORTED_MODULE_48__shadertools_lib_assemble_shaders__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_49__shadertools_lib_shader_modules__ = __webpack_require__(162); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "registerShaderModules", function() { return __WEBPACK_IMPORTED_MODULE_49__shadertools_lib_shader_modules__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "setDefaultShaderModules", function() { return __WEBPACK_IMPORTED_MODULE_49__shadertools_lib_shader_modules__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_50__shadertools_modules_fp32_fp32__ = __webpack_require__(646); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "fp32", function() { return __WEBPACK_IMPORTED_MODULE_50__shadertools_modules_fp32_fp32__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_51__shadertools_modules_fp64_fp64__ = __webpack_require__(650); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "fp64", function() { return __WEBPACK_IMPORTED_MODULE_51__shadertools_modules_fp64_fp64__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_52__shadertools_modules_project_project__ = __webpack_require__(260); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "project", function() { return __WEBPACK_IMPORTED_MODULE_52__shadertools_modules_project_project__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_53__shadertools_modules_lighting_lighting__ = __webpack_require__(654); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lighting", function() { return __WEBPACK_IMPORTED_MODULE_53__shadertools_modules_lighting_lighting__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_54__shadertools_modules_dirlight_dirlight__ = __webpack_require__(645); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "dirlight", function() { return __WEBPACK_IMPORTED_MODULE_54__shadertools_modules_dirlight_dirlight__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_55__shadertools_modules_picking_picking__ = __webpack_require__(656); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "picking", function() { return __WEBPACK_IMPORTED_MODULE_55__shadertools_modules_picking_picking__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_56__shadertools_modules_diffuse_diffuse__ = __webpack_require__(644); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "diffuse", function() { return __WEBPACK_IMPORTED_MODULE_56__shadertools_modules_diffuse_diffuse__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_57_math_gl__ = __webpack_require__(16); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "radians", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["radians"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "degrees", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["degrees"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector2", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["Vector2"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector3", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["Vector3"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector4", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["Vector4"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Matrix4", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["Matrix4"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Quaternion", function() { return __WEBPACK_IMPORTED_MODULE_57_math_gl__["Quaternion"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_58__webgl_functions__ = __webpack_require__(272); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "readPixels", function() { return __WEBPACK_IMPORTED_MODULE_58__webgl_functions__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FramebufferObject", function() { return __WEBPACK_IMPORTED_MODULE_11__webgl_framebuffer__["a"]; }); // Export core modules for luma.gl // Initialize any global state __webpack_require__(106); // WebGL // WebGL2 & Extensions // Core Classes // export {default as Object3D} from './core/object-3d'; // export {default as Group} from './core/group'; // Addons // Geometry // Models // IO // shadertools // shader modules // EXPERIMENTAL EXPORTS var experimental = { clearBuffer: __WEBPACK_IMPORTED_MODULE_16__webgl_clear__["b" /* clearBuffer */] }; // DEPRECATED EXPORTS // DEPRECATED IN V4.1 // DEPRECATED IN V3.0 // Alias FramebufferObject to Framebuffer - API is fairly similar //# sourceMappingURL=index.js.map /***/ }), /* 13 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.experimental = exports.lighting = exports.project64 = exports.project = exports.OrthographicViewport = exports.PerspectiveViewport = exports.WebMercatorViewport = exports.Viewport = exports.CompositeLayer = exports.Layer = exports.AttributeManager = exports.LayerManager = exports.COORDINATE_SYSTEM = undefined; var _constants = __webpack_require__(70); Object.defineProperty(exports, 'COORDINATE_SYSTEM', { enumerable: true, get: function get() { return _constants.COORDINATE_SYSTEM; } }); var _layerManager = __webpack_require__(184); Object.defineProperty(exports, 'LayerManager', { enumerable: true, get: function get() { return _interopRequireDefault(_layerManager).default; } }); var _attributeManager = __webpack_require__(182); Object.defineProperty(exports, 'AttributeManager', { enumerable: true, get: function get() { return _interopRequireDefault(_attributeManager).default; } }); var _layer = __webpack_require__(123); Object.defineProperty(exports, 'Layer', { enumerable: true, get: function get() { return _interopRequireDefault(_layer).default; } }); var _compositeLayer = __webpack_require__(337); Object.defineProperty(exports, 'CompositeLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_compositeLayer).default; } }); var _viewport = __webpack_require__(42); Object.defineProperty(exports, 'Viewport', { enumerable: true, get: function get() { return _interopRequireDefault(_viewport).default; } }); var _webMercatorViewport = __webpack_require__(86); Object.defineProperty(exports, 'WebMercatorViewport', { enumerable: true, get: function get() { return _interopRequireDefault(_webMercatorViewport).default; } }); var _perspectiveViewport = __webpack_require__(355); Object.defineProperty(exports, 'PerspectiveViewport', { enumerable: true, get: function get() { return _interopRequireDefault(_perspectiveViewport).default; } }); var _orthographicViewport = __webpack_require__(354); Object.defineProperty(exports, 'OrthographicViewport', { enumerable: true, get: function get() { return _interopRequireDefault(_orthographicViewport).default; } }); var _project = __webpack_require__(83); Object.defineProperty(exports, 'project', { enumerable: true, get: function get() { return _interopRequireDefault(_project).default; } }); var _project2 = __webpack_require__(192); Object.defineProperty(exports, 'project64', { enumerable: true, get: function get() { return _interopRequireDefault(_project2).default; } }); var _lighting = __webpack_require__(191); Object.defineProperty(exports, 'lighting', { enumerable: true, get: function get() { return _interopRequireDefault(_lighting).default; } }); __webpack_require__(338); __webpack_require__(190); var _firstPersonState = __webpack_require__(333); var _firstPersonState2 = _interopRequireDefault(_firstPersonState); var _orbitState = __webpack_require__(179); var _orbitState2 = _interopRequireDefault(_orbitState); var _mapState = __webpack_require__(82); var _mapState2 = _interopRequireDefault(_mapState); var _viewportControls = __webpack_require__(121); var _viewportControls2 = _interopRequireDefault(_viewportControls); var _mapControls = __webpack_require__(178); var _mapControls2 = _interopRequireDefault(_mapControls); var _firstPersonViewport = __webpack_require__(353); var _firstPersonViewport2 = _interopRequireDefault(_firstPersonViewport); var _thirdPersonViewport = __webpack_require__(356); var _thirdPersonViewport2 = _interopRequireDefault(_thirdPersonViewport); var _orbitViewport = __webpack_require__(85); var _orbitViewport2 = _interopRequireDefault(_orbitViewport); var _deckJs = __webpack_require__(341); var _deckJs2 = _interopRequireDefault(_deckJs); var _mapControllerJs = __webpack_require__(188); var _mapControllerJs2 = _interopRequireDefault(_mapControllerJs); var _orbitControllerJs = __webpack_require__(189); var _orbitControllerJs2 = _interopRequireDefault(_orbitControllerJs); var _effectManager = __webpack_require__(181); var _effectManager2 = _interopRequireDefault(_effectManager); var _effect = __webpack_require__(122); var _effect2 = _interopRequireDefault(_effect); var _transitionManager = __webpack_require__(186); var _transitionManager2 = _interopRequireDefault(_transitionManager); var _linearInterpolator = __webpack_require__(125); var _linearInterpolator2 = _interopRequireDefault(_linearInterpolator); var _viewportFlyToInterpolator = __webpack_require__(346); var _viewportFlyToInterpolator2 = _interopRequireDefault(_viewportFlyToInterpolator); var _transitionUtils = __webpack_require__(84); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _get = __webpack_require__(349); var _count = __webpack_require__(194); var _binSorter = __webpack_require__(347); var _binSorter2 = _interopRequireDefault(_binSorter); var _colorUtils = __webpack_require__(348); var _scaleUtils = __webpack_require__(352); var _flatten = __webpack_require__(126); var _fp = __webpack_require__(195); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // EXPERIMENTAL EXPORTS // Experimental Features (May change in minor version bumps, use at your own risk) // Experimental Controllers // Experimental Pure JS (non-React) bindings // Experimental Effects (non-React) bindings // Eperimental Transitions // INTERNAL EXPORTS // Layer utilities // Layer utilities // TODO - just expose as layer methods instead? var experimental = exports.experimental = { ViewportControls: _viewportControls2.default, FirstPersonState: _firstPersonState2.default, OrbitState: _orbitState2.default, MapState: _mapState2.default, Controller: _viewportControls2.default, MapController: _mapControls2.default, // FirstPersonController, // OrbitController, FirstPersonViewport: _firstPersonViewport2.default, ThirdPersonViewport: _thirdPersonViewport2.default, OrbitViewport: _orbitViewport2.default, DeckGLJS: _deckJs2.default, MapControllerJS: _mapControllerJs2.default, OrbitControllerJS: _orbitControllerJs2.default, EffectManager: _effectManager2.default, Effect: _effect2.default, // Transitions TRANSITION_EVENTS: _transitionManager.TRANSITION_EVENTS, LinearInterpolator: _linearInterpolator2.default, ViewportFlyToInterpolator: _viewportFlyToInterpolator2.default, // For react module TransitionManager: _transitionManager2.default, extractViewportFrom: _transitionUtils.extractViewportFrom, // For layers BinSorter: _binSorter2.default, linearScale: _scaleUtils.linearScale, getLinearScale: _scaleUtils.getLinearScale, quantizeScale: _scaleUtils.quantizeScale, getQuantizeScale: _scaleUtils.getQuantizeScale, clamp: _scaleUtils.clamp, defaultColorRange: _colorUtils.defaultColorRange, log: _log2.default, get: _get.get, count: _count.count, flatten: _flatten.flatten, countVertices: _flatten.countVertices, flattenVertices: _flatten.flattenVertices, fillArray: _flatten.fillArray, enable64bitSupport: _fp.enable64bitSupport, fp64ify: _fp.fp64ify, fp64LowPart: _fp.fp64LowPart }; /***/ }), /* 14 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.13 ToObject(argument) var defined = __webpack_require__(34); module.exports = function (it) { return Object(defined(it)); }; /***/ }), /* 15 */ /***/ (function(module, exports) { module.exports = function (it) { if (typeof it != 'function') throw TypeError(it + ' is not a function!'); return it; }; /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "experimental", function() { return experimental; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__vector2__ = __webpack_require__(280); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector2", function() { return __WEBPACK_IMPORTED_MODULE_0__vector2__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__vector3__ = __webpack_require__(113); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector3", function() { return __WEBPACK_IMPORTED_MODULE_1__vector3__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__vector4__ = __webpack_require__(281); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Vector4", function() { return __WEBPACK_IMPORTED_MODULE_2__vector4__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__matrix4__ = __webpack_require__(278); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Matrix4", function() { return __WEBPACK_IMPORTED_MODULE_3__matrix4__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__quaternion__ = __webpack_require__(279); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Quaternion", function() { return __WEBPACK_IMPORTED_MODULE_4__quaternion__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__common__ = __webpack_require__(31); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "config", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "checkNumber", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["g"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "configure", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["h"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "formatValue", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["i"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clone", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["j"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "radians", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "degrees", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["f"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "sin", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["k"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "cos", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["l"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "tan", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["m"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "asin", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["n"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "acos", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["o"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "atan", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["p"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clamp", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "equals", function() { return __WEBPACK_IMPORTED_MODULE_5__common__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__euler__ = __webpack_require__(670); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__spherical_coordinates__ = __webpack_require__(671); var experimental={Euler:__WEBPACK_IMPORTED_MODULE_6__euler__["a" /* default */],SphericalCoordinates:__WEBPACK_IMPORTED_MODULE_7__spherical_coordinates__["a" /* default */]}; //# sourceMappingURL=index.js.map /***/ }), /* 17 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* eslint-disable no-console */ /* global console */ var cache = {}; function log(priority, arg) { for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } (0, _assert2.default)(Number.isFinite(priority), 'log priority must be a number'); if (priority <= log.priority) { // Node doesn't have console.debug, but using it looks better in browser consoles args = formatArgs.apply(undefined, [arg].concat(_toConsumableArray(args))); if (console.debug) { var _console; (_console = console).debug.apply(_console, _toConsumableArray(args)); } else { var _console2; (_console2 = console).info.apply(_console2, _toConsumableArray(args)); } } } function once(priority, arg) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } if (!cache[arg] && priority <= log.priority) { var _console3; args = checkForAssertionErrors(args); (_console3 = console).error.apply(_console3, _toConsumableArray(formatArgs.apply(undefined, [arg].concat(_toConsumableArray(args))))); cache[arg] = true; } } function warn(arg) { if (!cache[arg]) { var _console4; for (var _len3 = arguments.length, args = Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { args[_key3 - 1] = arguments[_key3]; } (_console4 = console).warn.apply(_console4, ['deck.gl: ' + arg].concat(args)); cache[arg] = true; } } function error(arg) { var _console5; for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { args[_key4 - 1] = arguments[_key4]; } (_console5 = console).error.apply(_console5, ['deck.gl: ' + arg].concat(args)); } function deprecated(oldUsage, newUsage) { log.warn('`' + oldUsage + '` is deprecated and will be removed in a later version. Use `' + newUsage + '` instead'); } function removed(oldUsage, newUsage) { log.error('`' + oldUsage + '` is no longer supported. Use `' + newUsage + '` instead, check our upgrade-guide.md for more details'); } // Logs a message with a time function time(priority, label) { (0, _assert2.default)(Number.isFinite(priority), 'log priority must be a number'); if (priority <= log.priority) { // In case the platform doesn't have console.time if (console.time) { console.time(label); } else { console.info(label); } } } function timeEnd(priority, label) { (0, _assert2.default)(Number.isFinite(priority), 'log priority must be a number'); if (priority <= log.priority) { // In case the platform doesn't have console.timeEnd if (console.timeEnd) { console.timeEnd(label); } else { console.info(label); } } } function group(priority, arg) { var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref$collapsed = _ref.collapsed, collapsed = _ref$collapsed === undefined ? false : _ref$collapsed; if (priority <= log.priority) { if (collapsed) { console.groupCollapsed('luma.gl: ' + arg); } else { console.group('luma.gl: ' + arg); } } } function groupEnd(priority, arg) { if (priority <= log.priority) { console.groupEnd('luma.gl: ' + arg); } } // Helper functions function formatArgs(firstArg) { if (typeof firstArg === 'function') { firstArg = firstArg(); } for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { args[_key5 - 1] = arguments[_key5]; } if (typeof firstArg === 'string') { args.unshift('deck.gl ' + firstArg); } else { args.unshift(firstArg); args.unshift('deck.gl'); } return args; } // Assertions don't generate standard exceptions and don't print nicely function checkForAssertionErrors(args) { var isAssertion = args && args.length > 0 && _typeof(args[0]) === 'object' && args[0] !== null && args[0].name === 'AssertionError'; if (isAssertion) { args = Array.prototype.slice.call(args); args.unshift('assert(' + args[0].message + ')'); } return args; } log.priority = 0; log.log = log; log.once = once; log.time = time; log.timeEnd = timeEnd; log.warn = warn; log.error = error; log.deprecated = deprecated; log.removed = removed; log.group = group; log.groupEnd = groupEnd; exports.default = log; /***/ }), /* 18 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; module.exports = function (it, key) { return hasOwnProperty.call(it, key); }; /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(10); var createDesc = __webpack_require__(54); module.exports = __webpack_require__(9) ? function (object, key, value) { return dP.f(object, key, createDesc(1, value)); } : function (object, key, value) { object[key] = value; return object; }; /***/ }), /* 20 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var hide = __webpack_require__(19); var has = __webpack_require__(18); var SRC = __webpack_require__(58)('src'); var TO_STRING = 'toString'; var $toString = Function[TO_STRING]; var TPL = ('' + $toString).split(TO_STRING); __webpack_require__(33).inspectSource = function (it) { return $toString.call(it); }; (module.exports = function (O, key, val, safe) { var isFunction = typeof val == 'function'; if (isFunction) has(val, 'name') || hide(val, 'name', key); if (O[key] === val) return; if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key))); if (O === global) { O[key] = val; } else if (!safe) { delete O[key]; hide(O, key, val); } else if (O[key]) { O[key] = val; } else { hide(O, key, val); } // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, TO_STRING, function toString() { return typeof this == 'function' && this[SRC] || $toString.call(this); }); /***/ }), /* 21 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var fails = __webpack_require__(4); var defined = __webpack_require__(34); var quot = /"/g; // B.2.3.2.1 CreateHTML(string, tag, attribute, value) var createHTML = function (string, tag, attribute, value) { var S = String(defined(string)); var p1 = '<' + tag; if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"'; return p1 + '>' + S + ''; }; module.exports = function (NAME, exec) { var O = {}; O[NAME] = exec(createHTML); $export($export.P + $export.F * fails(function () { var test = ''[NAME]('"'); return test !== test.toLowerCase() || test.split('"').length > 3; }), 'String', O); }; /***/ }), /* 22 */ /***/ (function(module, exports, __webpack_require__) { var pIE = __webpack_require__(73); var createDesc = __webpack_require__(54); var toIObject = __webpack_require__(24); var toPrimitive = __webpack_require__(37); var has = __webpack_require__(18); var IE8_DOM_DEFINE = __webpack_require__(207); var gOPD = Object.getOwnPropertyDescriptor; exports.f = __webpack_require__(9) ? gOPD : function getOwnPropertyDescriptor(O, P) { O = toIObject(O); P = toPrimitive(P, true); if (IE8_DOM_DEFINE) try { return gOPD(O, P); } catch (e) { /* empty */ } if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]); }; /***/ }), /* 23 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) var has = __webpack_require__(18); var toObject = __webpack_require__(14); var IE_PROTO = __webpack_require__(144)('IE_PROTO'); var ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function (O) { O = toObject(O); if (has(O, IE_PROTO)) return O[IE_PROTO]; if (typeof O.constructor == 'function' && O instanceof O.constructor) { return O.constructor.prototype; } return O instanceof Object ? ObjectProto : null; }; /***/ }), /* 24 */ /***/ (function(module, exports, __webpack_require__) { // to indexed object, toObject with fallback for non-array-like ES3 strings var IObject = __webpack_require__(72); var defined = __webpack_require__(34); module.exports = function (it) { return IObject(defined(it)); }; /***/ }), /* 25 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = glGet; /* harmony export (immutable) */ __webpack_exports__["c"] = glKey; /* unused harmony export glKeyType */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_utils_constants_to_keys__ = __webpack_require__(662); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a"]; }); // WEBGL BUILT-IN CONSTANTS /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */]); // Resolve a WebGL enumeration name (returns itself if already a number) function glGet(name) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_constants_to_keys__["a" /* getKeyValue */])(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */], name); } function glKey(value) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_constants_to_keys__["b" /* getKey */])(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */], value); } function glKeyType(value) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_constants_to_keys__["c" /* getKeyType */])(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */], value); } //# sourceMappingURL=gl-constants.js.map /***/ }), /* 26 */ /***/ (function(module, exports) { // shim for using process in browser var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it // don't break things. But we need to wrap it in a try catch in case it is // wrapped in strict mode code which doesn't define any globals. It's inside a // function because try/catches deoptimize in certain engines. var cachedSetTimeout; var cachedClearTimeout; function defaultSetTimout() { throw new Error('setTimeout has not been defined'); } function defaultClearTimeout () { throw new Error('clearTimeout has not been defined'); } (function () { try { if (typeof setTimeout === 'function') { cachedSetTimeout = setTimeout; } else { cachedSetTimeout = defaultSetTimout; } } catch (e) { cachedSetTimeout = defaultSetTimout; } try { if (typeof clearTimeout === 'function') { cachedClearTimeout = clearTimeout; } else { cachedClearTimeout = defaultClearTimeout; } } catch (e) { cachedClearTimeout = defaultClearTimeout; } } ()) function runTimeout(fun) { if (cachedSetTimeout === setTimeout) { //normal enviroments in sane situations return setTimeout(fun, 0); } // if setTimeout wasn't available but was latter defined if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { cachedSetTimeout = setTimeout; return setTimeout(fun, 0); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedSetTimeout(fun, 0); } catch(e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedSetTimeout.call(null, fun, 0); } catch(e){ // 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 return cachedSetTimeout.call(this, fun, 0); } } } function runClearTimeout(marker) { if (cachedClearTimeout === clearTimeout) { //normal enviroments in sane situations return clearTimeout(marker); } // if clearTimeout wasn't available but was latter defined if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { cachedClearTimeout = clearTimeout; return clearTimeout(marker); } try { // when when somebody has screwed with setTimeout but no I.E. maddness return cachedClearTimeout(marker); } catch (e){ try { // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally return cachedClearTimeout.call(null, marker); } catch (e){ // 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. // Some versions of I.E. have different rules for clearTimeout vs setTimeout return cachedClearTimeout.call(this, marker); } } } var queue = []; var draining = false; var currentQueue; var queueIndex = -1; function cleanUpNextTick() { if (!draining || !currentQueue) { return; } draining = false; if (currentQueue.length) { queue = currentQueue.concat(queue); } else { queueIndex = -1; } if (queue.length) { drainQueue(); } } function drainQueue() { if (draining) { return; } var timeout = runTimeout(cleanUpNextTick); draining = true; var len = queue.length; while(len) { currentQueue = queue; queue = []; while (++queueIndex < len) { if (currentQueue) { currentQueue[queueIndex].run(); } } queueIndex = -1; len = queue.length; } currentQueue = null; draining = false; runClearTimeout(timeout); } process.nextTick = function (fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); if (queue.length === 1 && !draining) { runTimeout(drainQueue); } }; // v8 likes predictible objects function Item(fun, array) { this.fun = fun; this.array = array; } Item.prototype.run = function () { this.fun.apply(null, this.array); }; process.title = 'browser'; process.browser = true; process.env = {}; process.argv = []; process.version = ''; // empty string to avoid regexp issues process.versions = {}; function noop() {} process.on = noop; process.addListener = noop; process.once = noop; process.off = noop; process.removeListener = noop; process.removeAllListeners = noop; process.emit = noop; process.prependListener = noop; process.prependOnceListener = noop; process.listeners = function (name) { return [] } process.binding = function (name) { throw new Error('process.binding is not supported'); }; process.cwd = function () { return '/' }; process.chdir = function (dir) { throw new Error('process.chdir is not supported'); }; process.umask = function() { return 0; }; /***/ }), /* 27 */ /***/ (function(module, exports) { var toString = {}.toString; module.exports = function (it) { return toString.call(it).slice(8, -1); }; /***/ }), /* 28 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding var aFunction = __webpack_require__(15); module.exports = function (fn, that, length) { aFunction(fn); if (that === undefined) return fn; switch (length) { case 1: return function (a) { return fn.call(that, a); }; case 2: return function (a, b) { return fn.call(that, a, b); }; case 3: return function (a, b, c) { return fn.call(that, a, b, c); }; } return function (/* ...args */) { return fn.apply(that, arguments); }; }; /***/ }), /* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var fails = __webpack_require__(4); module.exports = function (method, arg) { return !!method && fails(function () { // eslint-disable-next-line no-useless-call arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null); }); }; /***/ }), /* 30 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__init__ = __webpack_require__(106); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_assert__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__webgl_utils__ = __webpack_require__(60); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods'; // TODO - Handle context loss // function glGetContextLossCount(gl) { // return (gl.luma && gl.luma.glCount) || 0; // } var Resource = /*#__PURE__*/function () { function Resource(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Resource); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["j" /* assertWebGLContext */])(gl); var id = opts.id, _opts$userData = opts.userData, userData = _opts$userData === undefined ? {} : _opts$userData; this.gl = gl; this.ext = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__webgl_utils__["f" /* polyfillContext */])(gl); this.id = id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils__["d" /* uid */])(this.constructor.name); this.userData = userData; this.opts = opts; // Set the handle // If handle was provided, use it, otherwise create a new handle // TODO - Stores the handle with context loss information // this.glCount = glGetContextLossCount(this.gl); // Default VertexArray needs to be created with null handle, so compare against undefined this._handle = opts.handle; if (this._handle === undefined) { this._handle = this._createHandle(); } this._addStats(); } _createClass(Resource, [{ key: 'toString', value: function toString() { return this.constructor.name + '(' + this.id + ')'; } }, { key: 'delete', value: function _delete() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$deleteChildren = _ref.deleteChildren, deleteChildren = _ref$deleteChildren === undefined ? false : _ref$deleteChildren; // Delete this object, and get refs to any children var children = this._handle && this._deleteHandle(this._handle); this._handle = null; // Optionally, recursively delete the children if (children && deleteChildren) { children.filter(Boolean).forEach(function (child) { child.delete(); }); } return this; } }, { key: 'unbind', value: function unbind() { this.bind(null); } /** * Query a Resource parameter * * @param {GLenum} pname * @return {GLint|GLfloat|GLenum} param */ }, { key: 'getParameter', value: function getParameter(pname) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; pname = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__gl_constants__["b" /* glGet */])(pname); __WEBPACK_IMPORTED_MODULE_4_assert___default()(pname); var parameters = this.constructor.PARAMETERS || {}; // Use parameter definitions to handle unsupported parameters var parameter = parameters[pname]; if (parameter) { var isWebgl2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(this.gl); // Check if we can query for this parameter var parameterAvailable = (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension)); if (!parameterAvailable) { var webgl1Default = parameter.webgl1; var webgl2Default = 'webgl2' in parameter ? parameter.webgl2 : parameter.webgl1; var defaultValue = isWebgl2 ? webgl2Default : webgl1Default; return defaultValue; } } // If unknown parameter - Could be a valid parameter not covered by PARAMS // Attempt to query for it and let WebGL report errors return this._getParameter(pname, opts); } // Many resources support a getParameter call - // getParameters will get all parameters - slow but useful for debugging }, { key: 'getParameters', value: function getParameters() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _ref2 = {}, parameters = _ref2.parameters, keys = _ref2.keys; // Get parameter definitions for this Resource var PARAMETERS = this.constructor.PARAMETERS || {}; var isWebgl2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(this.gl); var values = {}; // Query all parameters if no list provided var parameterKeys = parameters || Object.keys(PARAMETERS); // WEBGL limits var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = parameterKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var pname = _step.value; var parameter = PARAMETERS[pname]; // Check if this parameter is available on this platform var parameterAvailable = parameter && (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension)); if (parameterAvailable) { var key = keys ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__gl_constants__["c" /* glKey */])(pname) : pname; values[key] = this.getParameter(pname, opts); if (keys && parameter.type === 'GLenum') { values[key] = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__gl_constants__["c" /* glKey */])(values[key]); } } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return values; } /** * Update a Resource setting * * @todo - cache parameter to avoid issuing WebGL calls? * * @param {GLenum} pname - parameter (GL constant, value or key) * @param {GLint|GLfloat|GLenum} value * @return {Resource} returns self to enable chaining */ }, { key: 'setParameter', value: function setParameter(pname, value) { pname = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__gl_constants__["b" /* glGet */])(pname); __WEBPACK_IMPORTED_MODULE_4_assert___default()(pname); var parameters = this.constructor.PARAMETERS || {}; var parameter = parameters[pname]; if (parameter) { var isWebgl2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(this.gl); // Check if this parameter is available on this platform var parameterAvailable = (!('webgl2' in parameter) || isWebgl2) && (!('extension' in parameter) || this.gl.getExtension(parameter.extension)); if (!parameterAvailable) { throw new Error('Parameter not available on this platform'); } // Handle string keys if (parameter.type === 'GLenum') { value = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__gl_constants__["b" /* glGet */])(value); } } // If unknown parameter - Could be a valid parameter not covered by PARAMS // attempt to set it and let WebGL report errors this._setParameter(pname, value); return this; } /* * Batch update resource parameters * Assumes the subclass supports a setParameter call */ }, { key: 'setParameters', value: function setParameters(parameters) { for (var pname in parameters) { this.setParameter(pname, parameters[pname]); } return this; } // PUBLIC VIRTUAL METHODS }, { key: 'initialize', value: function initialize(opts) {} // PROTECTED METHODS - These must be overridden by subclass }, { key: '_createHandle', value: function _createHandle() { throw new Error(ERR_RESOURCE_METHOD_UNDEFINED); } }, { key: '_deleteHandle', value: function _deleteHandle() { throw new Error(ERR_RESOURCE_METHOD_UNDEFINED); } }, { key: '_getOptsFromHandle', value: function _getOptsFromHandle() { throw new Error(ERR_RESOURCE_METHOD_UNDEFINED); } }, { key: '_getParameter', value: function _getParameter(pname, opts) { throw new Error(ERR_RESOURCE_METHOD_UNDEFINED); } /** * @param {GLenum} pname * @param {GLint|GLfloat|GLenum} param * @return {Sampler} returns self to enable chaining */ }, { key: '_setParameter', value: function _setParameter(pname, value) { throw new Error(ERR_RESOURCE_METHOD_UNDEFINED); } // PRIVATE METHODS }, { key: '_context', value: function _context() { this.gl.luma = this.gl.luma || {}; return this.gl.luma; } }, { key: '_addStats', value: function _addStats() { var name = this.constructor.name; var stats = __WEBPACK_IMPORTED_MODULE_0__init__["default"].stats; stats.resourceCount = stats.resourceCount || 0; stats.resourceMap = stats.resourceMap || {}; // Resource creation stats stats.resourceCount++; stats.resourceMap[name] = stats.resourceMap[name] || { count: 0 }; stats.resourceMap[name].count++; } }, { key: 'handle', get: function get() { // TODO - Add context loss handling // Will regenerate and reinitialize the handle if necessary // const glCount = glGetContextLossCount(this.gl); // if (this.glCount !== glCount) { // this._handle = this._createHandle(this.opts); // this._glCount = glCount; // // Reinitialize object // this.initialize(this.opts); // } return this._handle; } }]); return Resource; }(); /* harmony default export */ __webpack_exports__["a"] = (Resource); //# sourceMappingURL=resource.js.map /***/ }), /* 31 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return config; }); /* harmony export (immutable) */ __webpack_exports__["h"] = configure; /* harmony export (immutable) */ __webpack_exports__["g"] = checkNumber; /* harmony export (immutable) */ __webpack_exports__["b"] = formatValue; /* unused harmony export formatAngle */ /* harmony export (immutable) */ __webpack_exports__["i"] = isArray; /* harmony export (immutable) */ __webpack_exports__["j"] = clone; /* harmony export (immutable) */ __webpack_exports__["d"] = radians; /* harmony export (immutable) */ __webpack_exports__["f"] = degrees; /* harmony export (immutable) */ __webpack_exports__["k"] = sin; /* harmony export (immutable) */ __webpack_exports__["l"] = cos; /* harmony export (immutable) */ __webpack_exports__["m"] = tan; /* harmony export (immutable) */ __webpack_exports__["n"] = asin; /* harmony export (immutable) */ __webpack_exports__["o"] = acos; /* harmony export (immutable) */ __webpack_exports__["p"] = atan; /* harmony export (immutable) */ __webpack_exports__["e"] = clamp; /* harmony export (immutable) */ __webpack_exports__["c"] = equals; var config={EPSILON:1e-12,debug:!0,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0};function configure(options){'epsilon'in options&&(config.EPSILON=options.epsilon),'debug'in options&&(config.debug=options.debug)}function checkNumber(value){if(!Number.isFinite(value))throw new Error('Invalid number '+value);return value}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON}function formatValue(value){var _ref=1 Array#forEach // 1 -> Array#map // 2 -> Array#filter // 3 -> Array#some // 4 -> Array#every // 5 -> Array#find // 6 -> Array#findIndex var ctx = __webpack_require__(28); var IObject = __webpack_require__(72); var toObject = __webpack_require__(14); var toLength = __webpack_require__(11); var asc = __webpack_require__(129); module.exports = function (TYPE, $create) { var IS_MAP = TYPE == 1; var IS_FILTER = TYPE == 2; var IS_SOME = TYPE == 3; var IS_EVERY = TYPE == 4; var IS_FIND_INDEX = TYPE == 6; var NO_HOLES = TYPE == 5 || IS_FIND_INDEX; var create = $create || asc; return function ($this, callbackfn, that) { var O = toObject($this); var self = IObject(O); var f = ctx(callbackfn, that, 3); var length = toLength(self.length); var index = 0; var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined; var val, res; for (;length > index; index++) if (NO_HOLES || index in self) { val = self[index]; res = f(val, index, O); if (TYPE) { if (IS_MAP) result[index] = res; // map else if (res) switch (TYPE) { case 3: return true; // some case 5: return val; // find case 6: return index; // findIndex case 2: result.push(val); // filter } else if (IS_EVERY) return false; // every } } return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result; }; }; /***/ }), /* 33 */ /***/ (function(module, exports) { var core = module.exports = { version: '2.5.3' }; if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef /***/ }), /* 34 */ /***/ (function(module, exports) { // 7.2.1 RequireObjectCoercible(argument) module.exports = function (it) { if (it == undefined) throw TypeError("Can't call method on " + it); return it; }; /***/ }), /* 35 */ /***/ (function(module, exports, __webpack_require__) { // most Object methods by ES6 should accept primitives var $export = __webpack_require__(0); var core = __webpack_require__(33); var fails = __webpack_require__(4); module.exports = function (KEY, exec) { var fn = (core.Object || {})[KEY] || Object[KEY]; var exp = {}; exp[KEY] = exec(fn); $export($export.S + $export.F * fails(function () { fn(1); }), 'Object', exp); }; /***/ }), /* 36 */ /***/ (function(module, exports) { // 7.1.4 ToInteger var ceil = Math.ceil; var floor = Math.floor; module.exports = function (it) { return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); }; /***/ }), /* 37 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) var isObject = __webpack_require__(5); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function (it, S) { if (!isObject(it)) return it; var fn, val; if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val; if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val; throw TypeError("Can't convert object to primitive value"); }; /***/ }), /* 38 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__types__ = __webpack_require__(268); /* unused harmony reexport Image */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__types__["a"]; }); /* unused harmony reexport WebGLProgram */ /* unused harmony reexport WebGLShader */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_0__types__["d"]; }); /* unused harmony reexport WebGLFramebuffer */ /* unused harmony reexport WebGLRenderbuffer */ /* unused harmony reexport WebGLTexture */ /* unused harmony reexport WebGLUniformLocation */ /* unused harmony reexport WebGLActiveInfo */ /* unused harmony reexport WebGLShaderPrecisionFormat */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__types__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__types__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_utils__ = __webpack_require__(60); /* unused harmony reexport formatGLSLCompilerError */ /* unused harmony reexport getShaderName */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__webgl_utils_constants__ = __webpack_require__(46); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_2__webgl_utils_constants__["a"]; }); // Exports WebGL API constants and types, plus some basic type checks // TODO - avoid importing GL as it is a big file /* harmony default export */ __webpack_exports__["a"] = (__WEBPACK_IMPORTED_MODULE_2__webgl_utils_constants__["a" /* default */]); //# sourceMappingURL=index.js.map /***/ }), /* 39 */ /***/ (function(module, exports, __webpack_require__) { var Map = __webpack_require__(228); var $export = __webpack_require__(0); var shared = __webpack_require__(98)('metadata'); var store = shared.store || (shared.store = new (__webpack_require__(231))()); var getOrCreateMetadataMap = function (target, targetKey, create) { var targetMetadata = store.get(target); if (!targetMetadata) { if (!create) return undefined; store.set(target, targetMetadata = new Map()); } var keyMetadata = targetMetadata.get(targetKey); if (!keyMetadata) { if (!create) return undefined; targetMetadata.set(targetKey, keyMetadata = new Map()); } return keyMetadata; }; var ordinaryHasOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? false : metadataMap.has(MetadataKey); }; var ordinaryGetOwnMetadata = function (MetadataKey, O, P) { var metadataMap = getOrCreateMetadataMap(O, P, false); return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey); }; var ordinaryDefineOwnMetadata = function (MetadataKey, MetadataValue, O, P) { getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue); }; var ordinaryOwnMetadataKeys = function (target, targetKey) { var metadataMap = getOrCreateMetadataMap(target, targetKey, false); var keys = []; if (metadataMap) metadataMap.forEach(function (_, key) { keys.push(key); }); return keys; }; var toMetaKey = function (it) { return it === undefined || typeof it == 'symbol' ? it : String(it); }; var exp = function (O) { $export($export.S, 'Reflect', O); }; module.exports = { store: store, map: getOrCreateMetadataMap, has: ordinaryHasOwnMetadata, get: ordinaryGetOwnMetadata, set: ordinaryDefineOwnMetadata, keys: ordinaryOwnMetadataKeys, key: toMetaKey, exp: exp }; /***/ }), /* 40 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; if (__webpack_require__(9)) { var LIBRARY = __webpack_require__(50); var global = __webpack_require__(3); var fails = __webpack_require__(4); var $export = __webpack_require__(0); var $typed = __webpack_require__(100); var $buffer = __webpack_require__(150); var ctx = __webpack_require__(28); var anInstance = __webpack_require__(48); var propertyDesc = __webpack_require__(54); var hide = __webpack_require__(19); var redefineAll = __webpack_require__(55); var toInteger = __webpack_require__(36); var toLength = __webpack_require__(11); var toIndex = __webpack_require__(226); var toAbsoluteIndex = __webpack_require__(57); var toPrimitive = __webpack_require__(37); var has = __webpack_require__(18); var classof = __webpack_require__(71); var isObject = __webpack_require__(5); var toObject = __webpack_require__(14); var isArrayIter = __webpack_require__(136); var create = __webpack_require__(51); var getPrototypeOf = __webpack_require__(23); var gOPN = __webpack_require__(52).f; var getIterFn = __webpack_require__(153); var uid = __webpack_require__(58); var wks = __webpack_require__(6); var createArrayMethod = __webpack_require__(32); var createArrayIncludes = __webpack_require__(87); var speciesConstructor = __webpack_require__(99); var ArrayIterators = __webpack_require__(154); var Iterators = __webpack_require__(63); var $iterDetect = __webpack_require__(93); var setSpecies = __webpack_require__(56); var arrayFill = __webpack_require__(128); var arrayCopyWithin = __webpack_require__(199); var $DP = __webpack_require__(10); var $GOPD = __webpack_require__(22); var dP = $DP.f; var gOPD = $GOPD.f; var RangeError = global.RangeError; var TypeError = global.TypeError; var Uint8Array = global.Uint8Array; var ARRAY_BUFFER = 'ArrayBuffer'; var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER; var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; var PROTOTYPE = 'prototype'; var ArrayProto = Array[PROTOTYPE]; var $ArrayBuffer = $buffer.ArrayBuffer; var $DataView = $buffer.DataView; var arrayForEach = createArrayMethod(0); var arrayFilter = createArrayMethod(2); var arraySome = createArrayMethod(3); var arrayEvery = createArrayMethod(4); var arrayFind = createArrayMethod(5); var arrayFindIndex = createArrayMethod(6); var arrayIncludes = createArrayIncludes(true); var arrayIndexOf = createArrayIncludes(false); var arrayValues = ArrayIterators.values; var arrayKeys = ArrayIterators.keys; var arrayEntries = ArrayIterators.entries; var arrayLastIndexOf = ArrayProto.lastIndexOf; var arrayReduce = ArrayProto.reduce; var arrayReduceRight = ArrayProto.reduceRight; var arrayJoin = ArrayProto.join; var arraySort = ArrayProto.sort; var arraySlice = ArrayProto.slice; var arrayToString = ArrayProto.toString; var arrayToLocaleString = ArrayProto.toLocaleString; var ITERATOR = wks('iterator'); var TAG = wks('toStringTag'); var TYPED_CONSTRUCTOR = uid('typed_constructor'); var DEF_CONSTRUCTOR = uid('def_constructor'); var ALL_CONSTRUCTORS = $typed.CONSTR; var TYPED_ARRAY = $typed.TYPED; var VIEW = $typed.VIEW; var WRONG_LENGTH = 'Wrong length!'; var $map = createArrayMethod(1, function (O, length) { return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length); }); var LITTLE_ENDIAN = fails(function () { // eslint-disable-next-line no-undef return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1; }); var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () { new Uint8Array(1).set({}); }); var toOffset = function (it, BYTES) { var offset = toInteger(it); if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!'); return offset; }; var validate = function (it) { if (isObject(it) && TYPED_ARRAY in it) return it; throw TypeError(it + ' is not a typed array!'); }; var allocate = function (C, length) { if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) { throw TypeError('It is not a typed array constructor!'); } return new C(length); }; var speciesFromList = function (O, list) { return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list); }; var fromList = function (C, list) { var index = 0; var length = list.length; var result = allocate(C, length); while (length > index) result[index] = list[index++]; return result; }; var addGetter = function (it, key, internal) { dP(it, key, { get: function () { return this._d[internal]; } }); }; var $from = function from(source /* , mapfn, thisArg */) { var O = toObject(source); var aLen = arguments.length; var mapfn = aLen > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var iterFn = getIterFn(O); var i, length, values, result, step, iterator; if (iterFn != undefined && !isArrayIter(iterFn)) { for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) { values.push(step.value); } O = values; } if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2); for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) { result[i] = mapping ? mapfn(O[i], i) : O[i]; } return result; }; var $of = function of(/* ...items */) { var index = 0; var length = arguments.length; var result = allocate(this, length); while (length > index) result[index] = arguments[index++]; return result; }; // iOS Safari 6.x fails here var TO_LOCALE_BUG = !!Uint8Array && fails(function () { arrayToLocaleString.call(new Uint8Array(1)); }); var $toLocaleString = function toLocaleString() { return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments); }; var proto = { copyWithin: function copyWithin(target, start /* , end */) { return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }, every: function every(callbackfn /* , thisArg */) { return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, fill: function fill(value /* , start, end */) { // eslint-disable-line no-unused-vars return arrayFill.apply(validate(this), arguments); }, filter: function filter(callbackfn /* , thisArg */) { return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined)); }, find: function find(predicate /* , thisArg */) { return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, findIndex: function findIndex(predicate /* , thisArg */) { return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined); }, forEach: function forEach(callbackfn /* , thisArg */) { arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, indexOf: function indexOf(searchElement /* , fromIndex */) { return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, includes: function includes(searchElement /* , fromIndex */) { return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined); }, join: function join(separator) { // eslint-disable-line no-unused-vars return arrayJoin.apply(validate(this), arguments); }, lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) { // eslint-disable-line no-unused-vars return arrayLastIndexOf.apply(validate(this), arguments); }, map: function map(mapfn /* , thisArg */) { return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined); }, reduce: function reduce(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars return arrayReduce.apply(validate(this), arguments); }, reduceRight: function reduceRight(callbackfn /* , initialValue */) { // eslint-disable-line no-unused-vars return arrayReduceRight.apply(validate(this), arguments); }, reverse: function reverse() { var that = this; var length = validate(that).length; var middle = Math.floor(length / 2); var index = 0; var value; while (index < middle) { value = that[index]; that[index++] = that[--length]; that[length] = value; } return that; }, some: function some(callbackfn /* , thisArg */) { return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined); }, sort: function sort(comparefn) { return arraySort.call(validate(this), comparefn); }, subarray: function subarray(begin, end) { var O = validate(this); var length = O.length; var $begin = toAbsoluteIndex(begin, length); return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))( O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin) ); } }; var $slice = function slice(start, end) { return speciesFromList(this, arraySlice.call(validate(this), start, end)); }; var $set = function set(arrayLike /* , offset */) { validate(this); var offset = toOffset(arguments[1], 1); var length = this.length; var src = toObject(arrayLike); var len = toLength(src.length); var index = 0; if (len + offset > length) throw RangeError(WRONG_LENGTH); while (index < len) this[offset + index] = src[index++]; }; var $iterators = { entries: function entries() { return arrayEntries.call(validate(this)); }, keys: function keys() { return arrayKeys.call(validate(this)); }, values: function values() { return arrayValues.call(validate(this)); } }; var isTAIndex = function (target, key) { return isObject(target) && target[TYPED_ARRAY] && typeof key != 'symbol' && key in target && String(+key) == String(key); }; var $getDesc = function getOwnPropertyDescriptor(target, key) { return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key); }; var $setDesc = function defineProperty(target, key, desc) { if (isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set') // TODO: add validation descriptor w/o calling accessors && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable) ) { target[key] = desc.value; return target; } return dP(target, key, desc); }; if (!ALL_CONSTRUCTORS) { $GOPD.f = $getDesc; $DP.f = $setDesc; } $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', { getOwnPropertyDescriptor: $getDesc, defineProperty: $setDesc }); if (fails(function () { arrayToString.call({}); })) { arrayToString = arrayToLocaleString = function toString() { return arrayJoin.call(this); }; } var $TypedArrayPrototype$ = redefineAll({}, proto); redefineAll($TypedArrayPrototype$, $iterators); hide($TypedArrayPrototype$, ITERATOR, $iterators.values); redefineAll($TypedArrayPrototype$, { slice: $slice, set: $set, constructor: function () { /* noop */ }, toString: arrayToString, toLocaleString: $toLocaleString }); addGetter($TypedArrayPrototype$, 'buffer', 'b'); addGetter($TypedArrayPrototype$, 'byteOffset', 'o'); addGetter($TypedArrayPrototype$, 'byteLength', 'l'); addGetter($TypedArrayPrototype$, 'length', 'e'); dP($TypedArrayPrototype$, TAG, { get: function () { return this[TYPED_ARRAY]; } }); // eslint-disable-next-line max-statements module.exports = function (KEY, BYTES, wrapper, CLAMPED) { CLAMPED = !!CLAMPED; var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array'; var GETTER = 'get' + KEY; var SETTER = 'set' + KEY; var TypedArray = global[NAME]; var Base = TypedArray || {}; var TAC = TypedArray && getPrototypeOf(TypedArray); var FORCED = !TypedArray || !$typed.ABV; var O = {}; var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE]; var getter = function (that, index) { var data = that._d; return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN); }; var setter = function (that, index, value) { var data = that._d; if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff; data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN); }; var addElement = function (that, index) { dP(that, index, { get: function () { return getter(this, index); }, set: function (value) { return setter(this, index, value); }, enumerable: true }); }; if (FORCED) { TypedArray = wrapper(function (that, data, $offset, $length) { anInstance(that, TypedArray, NAME, '_d'); var index = 0; var offset = 0; var buffer, byteLength, length, klass; if (!isObject(data)) { length = toIndex(data); byteLength = length * BYTES; buffer = new $ArrayBuffer(byteLength); } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { buffer = data; offset = toOffset($offset, BYTES); var $len = data.byteLength; if ($length === undefined) { if ($len % BYTES) throw RangeError(WRONG_LENGTH); byteLength = $len - offset; if (byteLength < 0) throw RangeError(WRONG_LENGTH); } else { byteLength = toLength($length) * BYTES; if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH); } length = byteLength / BYTES; } else if (TYPED_ARRAY in data) { return fromList(TypedArray, data); } else { return $from.call(TypedArray, data); } hide(that, '_d', { b: buffer, o: offset, l: byteLength, e: length, v: new $DataView(buffer) }); while (index < length) addElement(that, index++); }); TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$); hide(TypedArrayPrototype, 'constructor', TypedArray); } else if (!fails(function () { TypedArray(1); }) || !fails(function () { new TypedArray(-1); // eslint-disable-line no-new }) || !$iterDetect(function (iter) { new TypedArray(); // eslint-disable-line no-new new TypedArray(null); // eslint-disable-line no-new new TypedArray(1.5); // eslint-disable-line no-new new TypedArray(iter); // eslint-disable-line no-new }, true)) { TypedArray = wrapper(function (that, data, $offset, $length) { anInstance(that, TypedArray, NAME); var klass; // `ws` module bug, temporarily remove validation length for Uint8Array // https://github.com/websockets/ws/pull/645 if (!isObject(data)) return new Base(toIndex(data)); if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) { return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data); } if (TYPED_ARRAY in data) return fromList(TypedArray, data); return $from.call(TypedArray, data); }); arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) { if (!(key in TypedArray)) hide(TypedArray, key, Base[key]); }); TypedArray[PROTOTYPE] = TypedArrayPrototype; if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray; } var $nativeIterator = TypedArrayPrototype[ITERATOR]; var CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined); var $iterator = $iterators.values; hide(TypedArray, TYPED_CONSTRUCTOR, true); hide(TypedArrayPrototype, TYPED_ARRAY, NAME); hide(TypedArrayPrototype, VIEW, true); hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray); if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) { dP(TypedArrayPrototype, TAG, { get: function () { return NAME; } }); } O[NAME] = TypedArray; $export($export.G + $export.W + $export.F * (TypedArray != Base), O); $export($export.S, NAME, { BYTES_PER_ELEMENT: BYTES }); $export($export.S + $export.F * fails(function () { Base.of.call(TypedArray, 1); }), NAME, { from: $from, of: $of }); if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES); $export($export.P, NAME, proto); setSpecies(NAME); $export($export.P + $export.F * FORCED_SET, NAME, { set: $set }); $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators); if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString; $export($export.P + $export.F * fails(function () { new TypedArray(1).slice(); }), NAME, { slice: $slice }); $export($export.P + $export.F * (fails(function () { return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString(); }) || !fails(function () { TypedArrayPrototype.toLocaleString.call([1, 2]); })), NAME, { toLocaleString: $toLocaleString }); Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator; if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator); }; } else module.exports = function () { /* empty */ }; /***/ }), /* 41 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(45); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Geometry", function() { return __WEBPACK_IMPORTED_MODULE_0__geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__cone_geometry__ = __webpack_require__(251); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "ConeGeometry", function() { return __WEBPACK_IMPORTED_MODULE_1__cone_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__cube_geometry__ = __webpack_require__(252); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CubeGeometry", function() { return __WEBPACK_IMPORTED_MODULE_2__cube_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__cylinder_geometry__ = __webpack_require__(253); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "CylinderGeometry", function() { return __WEBPACK_IMPORTED_MODULE_3__cylinder_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__ico_sphere_geometry__ = __webpack_require__(254); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "IcoSphereGeometry", function() { return __WEBPACK_IMPORTED_MODULE_4__ico_sphere_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__plane_geometry__ = __webpack_require__(255); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PlaneGeometry", function() { return __WEBPACK_IMPORTED_MODULE_5__plane_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__sphere_geometry__ = __webpack_require__(256); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "SphereGeometry", function() { return __WEBPACK_IMPORTED_MODULE_6__sphere_geometry__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__truncated_cone_geometry__ = __webpack_require__(105); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TruncatedConeGeometry", function() { return __WEBPACK_IMPORTED_MODULE_7__truncated_cone_geometry__["a"]; }); //# sourceMappingURL=index.js.map /***/ }), /* 42 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _mathUtils = __webpack_require__(127); var _math = __webpack_require__(16); var _scale = __webpack_require__(77); var _scale2 = _interopRequireDefault(_scale); var _translate = __webpack_require__(78); var _translate2 = _interopRequireDefault(_translate); var _multiply = __webpack_require__(75); var _multiply2 = _interopRequireDefault(_multiply); var _invert = __webpack_require__(156); var _invert2 = _interopRequireDefault(_invert); var _perspective = __webpack_require__(76); var _perspective2 = _interopRequireDefault(_perspective); var _viewportMercatorProject = __webpack_require__(79); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ZERO_VECTOR = [0, 0, 0]; var IDENTITY = (0, _mathUtils.createMat4)(); var DEFAULT_DISTANCE_SCALES = { pixelsPerMeter: [1, 1, 1], metersPerPixel: [1, 1, 1], pixelsPerDegree: [1, 1, 1], degreesPerPixel: [1, 1, 1] }; var DEFAULT_ZOOM = 0; var ERR_ARGUMENT = 'Illegal argument to Viewport'; var Viewport = function () { /** * @classdesc * Manages coordinate system transformations for deck.gl. * * Note: The Viewport is immutable in the sense that it only has accessors. * A new viewport instance should be created if any parameters have changed. */ /* eslint-disable complexity, max-statements */ function Viewport() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, Viewport); var _opts$id = opts.id, id = _opts$id === undefined ? null : _opts$id, _opts$x = opts.x, x = _opts$x === undefined ? 0 : _opts$x, _opts$y = opts.y, y = _opts$y === undefined ? 0 : _opts$y, _opts$width = opts.width, width = _opts$width === undefined ? 1 : _opts$width, _opts$height = opts.height, height = _opts$height === undefined ? 1 : _opts$height, _opts$viewMatrix = opts.viewMatrix, viewMatrix = _opts$viewMatrix === undefined ? IDENTITY : _opts$viewMatrix, _opts$projectionMatri = opts.projectionMatrix, projectionMatrix = _opts$projectionMatri === undefined ? null : _opts$projectionMatri, _opts$fovy = opts.fovy, fovy = _opts$fovy === undefined ? 75 : _opts$fovy, _opts$near = opts.near, near = _opts$near === undefined ? 0.1 : _opts$near, _opts$far = opts.far, far = _opts$far === undefined ? 1000 : _opts$far, _opts$longitude = opts.longitude, longitude = _opts$longitude === undefined ? null : _opts$longitude, _opts$latitude = opts.latitude, latitude = _opts$latitude === undefined ? null : _opts$latitude, _opts$zoom = opts.zoom, zoom = _opts$zoom === undefined ? null : _opts$zoom, _opts$position = opts.position, position = _opts$position === undefined ? null : _opts$position, _opts$modelMatrix = opts.modelMatrix, modelMatrix = _opts$modelMatrix === undefined ? null : _opts$modelMatrix, _opts$distanceScales = opts.distanceScales, distanceScales = _opts$distanceScales === undefined ? null : _opts$distanceScales; //iclient this.isGeographicCoordinateSystem=opts.isGeographicCoordinateSystem; this.id = id || this.constructor.displayName || 'viewport'; // Check if we have a geospatial anchor this.isGeospatial = Number.isFinite(latitude) && Number.isFinite(longitude); // Silently allow apps to send in w,h = 0,0 this.x = x; this.y = y; this.width = width || 1; this.height = height || 1; this.zoom = zoom; if (!Number.isFinite(this.zoom)) { this.zoom = this.isGeospatial ? (0, _viewportMercatorProject.getMeterZoom)({ latitude: latitude }) : DEFAULT_ZOOM; } this.scale = Math.pow(2, this.zoom); // Calculate distance scales if lng/lat/zoom are provided this.distanceScales = this.isGeospatial ? (0, _viewportMercatorProject.getDistanceScales)({ latitude: latitude, longitude: longitude, scale: this.scale,isGeographicCoordinateSystem:this.isGeographicCoordinateSystem }) : distanceScales || DEFAULT_DISTANCE_SCALES; this.focalDistance = opts.focalDistance || 1; this.distanceScales.metersPerPixel = new _math.Vector3(this.distanceScales.metersPerPixel); this.distanceScales.pixelsPerMeter = new _math.Vector3(this.distanceScales.pixelsPerMeter); this.position = ZERO_VECTOR; this.meterOffset = ZERO_VECTOR; if (position) { // Apply model matrix if supplied this.position = position; this.modelMatrix = modelMatrix; this.meterOffset = modelMatrix ? modelMatrix.transformVector(position) : position; } this.viewMatrixUncentered = viewMatrix; if (this.isGeospatial) { // Determine camera center this.center = (0, _viewportMercatorProject.getWorldPosition)({ longitude: longitude, latitude: latitude, scale: this.scale, distanceScales: this.distanceScales, meterOffset: this.meterOffset }); // Make a centered version of the matrix for projection modes without an offset this.viewMatrix = new _math.Matrix4() // Apply the uncentered view matrix .multiplyRight(this.viewMatrixUncentered) // The Mercator world coordinate system is upper left, // but GL expects lower left, so we flip it around the center after all transforms are done .scale([1, -1, 1]) // And center it .translate(new _math.Vector3(this.center || ZERO_VECTOR).negate()); } else { this.center = position; this.viewMatrix = viewMatrix; } // Create a projection matrix if not supplied if (projectionMatrix) { this.projectionMatrix = projectionMatrix; } else { (0, _assert2.default)(Number.isFinite(fovy)); var DEGREES_TO_RADIANS = Math.PI / 180; var fovyRadians = fovy * DEGREES_TO_RADIANS; var aspect = this.width / this.height; this.projectionMatrix = (0, _perspective2.default)([], fovyRadians, aspect, near, far); } // Init pixel matrices this._initMatrices(); // Bind methods for easy access this.equals = this.equals.bind(this); this.project = this.project.bind(this); this.unproject = this.unproject.bind(this); this.projectFlat = this.projectFlat.bind(this); this.unprojectFlat = this.unprojectFlat.bind(this); this.getMatrices = this.getMatrices.bind(this); } /* eslint-enable complexity, max-statements */ // Two viewports are equal if width and height are identical, and if // their view and projection matrices are (approximately) equal. _createClass(Viewport, [{ key: 'equals', value: function equals(viewport) { if (!(viewport instanceof Viewport)) { return false; } return viewport.width === this.width && viewport.height === this.height && (0, _math.equals)(viewport.projectionMatrix, this.projectionMatrix) && (0, _math.equals)(viewport.viewMatrix, this.viewMatrix); // TODO - check distance scales? } /** * Projects xyz (possibly latitude and longitude) to pixel coordinates in window * using viewport projection parameters * - [longitude, latitude] to [x, y] * - [longitude, latitude, Z] => [x, y, z] * Note: By default, returns top-left coordinates for canvas/SVG type render * * @param {Array} lngLatZ - [lng, lat] or [lng, lat, Z] * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether projected coords are top left * @return {Array} - [x, y] or [x, y, z] in top left coords */ }, { key: 'project', value: function project(xyz) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$topLeft = _ref.topLeft, topLeft = _ref$topLeft === undefined ? true : _ref$topLeft; var _xyz = _slicedToArray(xyz, 3), x0 = _xyz[0], y0 = _xyz[1], _xyz$ = _xyz[2], z0 = _xyz$ === undefined ? 0 : _xyz$; var _projectFlat2 = this.projectFlat([x0, y0]), _projectFlat3 = _slicedToArray(_projectFlat2, 2), X = _projectFlat3[0], Y = _projectFlat3[1]; var coord = (0, _viewportMercatorProject.worldToPixels)([X, Y, z0], this.pixelProjectionMatrix); var _coord = _slicedToArray(coord, 2), x = _coord[0], y = _coord[1]; var y2 = topLeft ? y : this.height - y; return xyz.length === 2 ? [x, y2] : [x, y2, coord[2]]; } /** * Unproject pixel coordinates on screen onto world coordinates, * (possibly [lon, lat]) on map. * - [x, y] => [lng, lat] * - [x, y, z] => [lng, lat, Z] * @param {Array} xyz - * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether origin is top left * @return {Array|null} - [lng, lat, Z] or [X, Y, Z] */ }, { key: 'unproject', value: function unproject(xyz) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$topLeft = _ref2.topLeft, topLeft = _ref2$topLeft === undefined ? true : _ref2$topLeft, targetZ = _ref2.targetZ; var _xyz2 = _slicedToArray(xyz, 3), x = _xyz2[0], y = _xyz2[1], z = _xyz2[2]; var y2 = topLeft ? y : this.height - y; var coord = (0, _viewportMercatorProject.pixelsToWorld)([x, y2, z], this.pixelUnprojectionMatrix, targetZ); var _unprojectFlat2 = this.unprojectFlat(coord), _unprojectFlat3 = _slicedToArray(_unprojectFlat2, 2), X = _unprojectFlat3[0], Y = _unprojectFlat3[1]; if (Number.isFinite(z)) { // Has depth component return [X, Y, coord[2]]; } return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y]; } // NON_LINEAR PROJECTION HOOKS // Used for web meractor projection /** * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile. * Performs the nonlinear part of the web mercator projection. * Remaining projection is done with 4x4 matrices which also handles * perspective. * @param {Array} lngLat - [lng, lat] coordinates * Specifies a point on the sphere to project onto the map. * @return {Array} [x,y] coordinates. */ }, { key: 'projectFlat', value: function projectFlat(_ref3) { var _ref4 = _slicedToArray(_ref3, 2), x = _ref4[0], y = _ref4[1]; var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return this._projectFlat.apply(this, arguments); } /** * Unproject world point [x,y] on map onto {lat, lon} on sphere * @param {object|Vector} xy - object with {x,y} members * representing point on projected map plane * @return {GeoCoordinates} - object with {lat,lon} of point on sphere. * Has toArray method if you need a GeoJSON Array. * Per cartographic tradition, lat and lon are specified as degrees. */ }, { key: 'unprojectFlat', value: function unprojectFlat(xyz) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return this._unprojectFlat.apply(this, arguments); } // TODO - why do we need these? }, { key: '_projectFlat', value: function _projectFlat(xyz) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return xyz; } }, { key: '_unprojectFlat', value: function _unprojectFlat(xyz) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return xyz; } }, { key: 'getMercatorParams', value: function getMercatorParams() { var lngLat = this._addMetersToLngLat([this.longitude || 0, this.latitude || 0], this.meterOffset); return { longitude: lngLat[0], latitude: lngLat[1] }; } }, { key: 'isMapSynched', value: function isMapSynched() { return false; } }, { key: 'getDistanceScales', value: function getDistanceScales() { var coordinateOrigin = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; if (coordinateOrigin) { return (0, _viewportMercatorProject.getDistanceScales)({ longitude: coordinateOrigin[0], latitude: coordinateOrigin[1], scale: this.scale, highPrecision: true }); } return this.distanceScales; } }, { key: 'getMatrices', value: function getMatrices() { var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref5$modelMatrix = _ref5.modelMatrix, modelMatrix = _ref5$modelMatrix === undefined ? null : _ref5$modelMatrix; var modelViewProjectionMatrix = this.viewProjectionMatrix; var pixelProjectionMatrix = this.pixelProjectionMatrix; var pixelUnprojectionMatrix = this.pixelUnprojectionMatrix; if (modelMatrix) { modelViewProjectionMatrix = (0, _multiply2.default)([], this.viewProjectionMatrix, modelMatrix); pixelProjectionMatrix = (0, _multiply2.default)([], this.pixelProjectionMatrix, modelMatrix); pixelUnprojectionMatrix = (0, _invert2.default)([], pixelProjectionMatrix); } var matrices = Object.assign({ modelViewProjectionMatrix: modelViewProjectionMatrix, viewProjectionMatrix: this.viewProjectionMatrix, viewMatrix: this.viewMatrix, projectionMatrix: this.projectionMatrix, // project/unproject between pixels and world pixelProjectionMatrix: pixelProjectionMatrix, pixelUnprojectionMatrix: pixelUnprojectionMatrix, width: this.width, height: this.height, scale: this.scale }); return matrices; } // EXPERIMENTAL METHODS }, { key: 'getCameraPosition', value: function getCameraPosition() { return this.cameraPosition; } }, { key: 'getCameraDirection', value: function getCameraDirection() { return this.cameraDirection; } }, { key: 'getCameraUp', value: function getCameraUp() { return this.cameraUp; } // TODO - these are duplicating WebMercator methods }, { key: '_addMetersToLngLat', value: function _addMetersToLngLat(lngLatZ, xyz) { var _lngLatZ = _slicedToArray(lngLatZ, 3), lng = _lngLatZ[0], lat = _lngLatZ[1], _lngLatZ$ = _lngLatZ[2], Z = _lngLatZ$ === undefined ? 0 : _lngLatZ$; var _metersToLngLatDelta2 = this._metersToLngLatDelta(xyz), _metersToLngLatDelta3 = _slicedToArray(_metersToLngLatDelta2, 3), deltaLng = _metersToLngLatDelta3[0], deltaLat = _metersToLngLatDelta3[1], _metersToLngLatDelta4 = _metersToLngLatDelta3[2], deltaZ = _metersToLngLatDelta4 === undefined ? 0 : _metersToLngLatDelta4; return lngLatZ.length === 2 ? [lng + deltaLng, lat + deltaLat] : [lng + deltaLng, lat + deltaLat, Z + deltaZ]; } }, { key: '_metersToLngLatDelta', value: function _metersToLngLatDelta(xyz) { var _xyz3 = _slicedToArray(xyz, 3), x = _xyz3[0], y = _xyz3[1], _xyz3$ = _xyz3[2], z = _xyz3$ === undefined ? 0 : _xyz3$; (0, _assert2.default)(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z), ERR_ARGUMENT); var _distanceScales = this.distanceScales, pixelsPerMeter = _distanceScales.pixelsPerMeter, degreesPerPixel = _distanceScales.degreesPerPixel; var deltaLng = x * pixelsPerMeter[0] * degreesPerPixel[0]; var deltaLat = y * pixelsPerMeter[1] * degreesPerPixel[1]; return xyz.length === 2 ? [deltaLng, deltaLat] : [deltaLng, deltaLat, z]; } // INTERNAL METHODS }, { key: '_initMatrices', value: function _initMatrices() { // Note: As usual, matrix operations should be applied in "reverse" order // since vectors will be multiplied in from the right during transformation var vpm = (0, _mathUtils.createMat4)(); (0, _multiply2.default)(vpm, vpm, this.projectionMatrix); (0, _multiply2.default)(vpm, vpm, this.viewMatrix); this.viewProjectionMatrix = vpm; // console.log('VPM', this.viewMatrix, this.projectionMatrix, this.viewProjectionMatrix); // Calculate inverse view matrix this.viewMatrixInverse = (0, _invert2.default)([], this.viewMatrix) || this.viewMatrix; // Decompose camera directions var _extractCameraVectors = (0, _mathUtils.extractCameraVectors)({ viewMatrix: this.viewMatrix, viewMatrixInverse: this.viewMatrixInverse }), eye = _extractCameraVectors.eye, direction = _extractCameraVectors.direction, up = _extractCameraVectors.up; this.cameraPosition = eye; this.cameraDirection = direction; this.cameraUp = up; // console.log(this.cameraPosition, this.cameraDirection, this.cameraUp); /* * Builds matrices that converts preprojected lngLats to screen pixels * and vice versa. * Note: Currently returns bottom-left coordinates! * Note: Starts with the GL projection matrix and adds steps to the * scale and translate that matrix onto the window. * Note: WebGL controls clip space to screen projection with gl.viewport * and does not need this step. */ // matrix for conversion from world location to screen (pixel) coordinates var m = (0, _mathUtils.createMat4)(); (0, _scale2.default)(m, m, [this.width / 2, -this.height / 2, 1]); (0, _translate2.default)(m, m, [1, -1, 0]); (0, _multiply2.default)(m, m, this.viewProjectionMatrix); this.pixelProjectionMatrix = m; this.pixelUnprojectionMatrix = (0, _invert2.default)((0, _mathUtils.createMat4)(), this.pixelProjectionMatrix); if (!this.pixelUnprojectionMatrix) { _log2.default.warn('Pixel project matrix not invertible'); // throw new Error('Pixel project matrix not invertible'); } } }]); return Viewport; }(); exports.default = Viewport; Viewport.displayName = 'Viewport'; /***/ }), /* 43 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.31 Array.prototype[@@unscopables] var UNSCOPABLES = __webpack_require__(6)('unscopables'); var ArrayProto = Array.prototype; if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(19)(ArrayProto, UNSCOPABLES, {}); module.exports = function (key) { ArrayProto[UNSCOPABLES][key] = true; }; /***/ }), /* 44 */ /***/ (function(module, exports, __webpack_require__) { var META = __webpack_require__(58)('meta'); var isObject = __webpack_require__(5); var has = __webpack_require__(18); var setDesc = __webpack_require__(10).f; var id = 0; var isExtensible = Object.isExtensible || function () { return true; }; var FREEZE = !__webpack_require__(4)(function () { return isExtensible(Object.preventExtensions({})); }); var setMeta = function (it) { setDesc(it, META, { value: { i: 'O' + ++id, // object ID w: {} // weak collections IDs } }); }; var fastKey = function (it, create) { // return primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; if (!has(it, META)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata if (!create) return 'E'; // add missing metadata setMeta(it); // return object ID } return it[META].i; }; var getWeak = function (it, create) { if (!has(it, META)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata if (!create) return false; // add missing metadata setMeta(it); // return hash weak collections IDs } return it[META].w; }; // add metadata on freeze-family methods calling var onFreeze = function (it) { if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it); return it; }; var meta = module.exports = { KEY: META, NEED: false, fastKey: fastKey, getWeak: getWeak, onFreeze: onFreeze }; /***/ }), /* 45 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export DRAW_MODE */ /* harmony export (immutable) */ __webpack_exports__["b"] = getDrawMode; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Rendering primitives - specify how to extract primitives from vertices. // NOTE: These are numerically identical to the corresponding WebGL/OpenGL constants var DRAW_MODE = { POINTS: 0x0000, // draw single points. LINES: 0x0001, // draw lines. Each vertex connects to the one after it. LINE_LOOP: 0x0002, // draw lines. Each set of two vertices is treated as a separate line segment. LINE_STRIP: 0x0003, // draw a connected group of line segments from the first vertex to the last TRIANGLES: 0x0004, // draw triangles. Each set of three vertices creates a separate triangle. TRIANGLE_STRIP: 0x0005, // draw a connected group of triangles. TRIANGLE_FAN: 0x0006 // draw a connected group of triangles. // Each vertex connects to the previous and the first vertex in the fan. }; // Helper function to handle string draw modes - when using this library without WebGL constants function getDrawMode(drawMode) { var mode = typeof drawMode === 'string' ? DRAW_MODE[drawMode] || DRAW_MODE.TRIANGLES : drawMode; __WEBPACK_IMPORTED_MODULE_1_assert___default()(mode >= 0 && mode <= DRAW_MODE.TRIANGLE_FAN, 'Illegal drawMode'); return mode; } var Geometry = /*#__PURE__*/function () { function Geometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, Geometry); var id = opts.id, _opts$drawMode = opts.drawMode, drawMode = _opts$drawMode === undefined ? DRAW_MODE.TRIANGLES : _opts$drawMode, _opts$vertexCount = opts.vertexCount, vertexCount = _opts$vertexCount === undefined ? undefined : _opts$vertexCount, attributes = opts.attributes; this.id = id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__utils__["d" /* uid */])(this.constructor.name); this.drawMode = getDrawMode(drawMode); this.vertexCount = vertexCount; this.attributes = {}; this.needsRedraw = true; this.userData = {}; Object.seal(this); if (attributes) { this.setAttributes(attributes); } } _createClass(Geometry, [{ key: 'setNeedsRedraw', value: function setNeedsRedraw() { var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.needsRedraw = redraw; return this; } }, { key: 'getNeedsRedraw', value: function getNeedsRedraw() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$clearRedrawFlags = _ref.clearRedrawFlags, clearRedrawFlags = _ref$clearRedrawFlags === undefined ? false : _ref$clearRedrawFlags; var redraw = false; redraw = redraw || this.needsRedraw; this.needsRedraw = this.needsRedraw && !clearRedrawFlags; return redraw; } }, { key: 'setVertexCount', value: function setVertexCount(vertexCount) { this.vertexCount = vertexCount; } }, { key: 'getVertexCount', value: function getVertexCount() { if (this.vertexCount !== undefined) { return this.vertexCount; } else if (this.attributes.indices) { return this.attributes.indices.value.length; } else if (this.attributes.vertices) { return this.attributes.vertices.value.length / 3; } else if (this.attributes.positions) { return this.attributes.positions.value.length / 3; } return false; } }, { key: 'hasAttribute', value: function hasAttribute(attributeName) { return Boolean(this.attributes[attributeName]); } }, { key: 'getAttribute', value: function getAttribute(attributeName) { var attribute = this.attributes[attributeName]; __WEBPACK_IMPORTED_MODULE_1_assert___default()(attribute); return attribute.value; } }, { key: 'getArray', value: function getArray(attributeName) { var attribute = this.attributes[attributeName]; __WEBPACK_IMPORTED_MODULE_1_assert___default()(attribute); return attribute.value; } }, { key: 'getAttributes', value: function getAttributes() { return this.attributes; } // Attribute // value: typed array // type: indices, vertices, uvs // size: elements per vertex // target: WebGL buffer type (string or constant) }, { key: 'setAttributes', value: function setAttributes(attributes) { for (var attributeName in attributes) { var attribute = attributes[attributeName]; // Wrap "unwrapped" arrays and try to autodetect their type attribute = ArrayBuffer.isView(attribute) ? { value: attribute } : attribute; __WEBPACK_IMPORTED_MODULE_1_assert___default()(ArrayBuffer.isView(attribute.value), this._print(attributeName) + ': must be typed array or object with value as typed array'); this._autoDetectAttribute(attributeName, attribute); this.attributes[attributeName] = Object.assign({}, attribute, { instanced: attribute.instanced || 0 }); } this.setNeedsRedraw(); return this; } // Check for well known attribute names /* eslint-disable default-case, complexity */ }, { key: '_autoDetectAttribute', value: function _autoDetectAttribute(attributeName, attribute) { var category = void 0; switch (attributeName) { case 'indices': category = category || 'indices'; break; case 'texCoords': case 'texCoord1': case 'texCoord2': case 'texCoord3': category = 'uvs'; break; case 'vertices': case 'positions': case 'normals': case 'pickingColors': category = 'vectors'; break; } // Check for categorys switch (category) { case 'vectors': attribute.size = attribute.size || 3; break; case 'uvs': attribute.size = attribute.size || 2; break; case 'indices': attribute.size = attribute.size || 1; attribute.isIndexed = attribute.isIndexed || true; __WEBPACK_IMPORTED_MODULE_1_assert___default()(attribute.value instanceof Uint16Array || attribute.value instanceof Uint32Array, 'attribute array for "indices" must be of integer type'); break; } __WEBPACK_IMPORTED_MODULE_1_assert___default()(attribute.size, 'attribute ' + attributeName + ' needs size'); } /* eslint-enable default-case, complexity */ }, { key: '_print', value: function _print(attributeName) { return 'Geometry ' + this.id + ' attribute ' + attributeName; } }]); return Geometry; }(); /* harmony default export */ __webpack_exports__["a"] = (Geometry); //# sourceMappingURL=geometry.js.map /***/ }), /* 46 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // GL constants, copied from Mozilla documentation // https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants // Standard WebGL 1 constants // These constants are defined on the WebGLRenderingContext interface. /* eslint-disable key-spacing, max-len, no-inline-comments, camelcase */ /* harmony default export */ __webpack_exports__["a"] = ({ // Clearing buffers // Constants passed to clear() to clear buffer masks. DEPTH_BUFFER_BIT: 0x00000100, STENCIL_BUFFER_BIT: 0x00000400, COLOR_BUFFER_BIT: 0x00004000, // Rendering primitives // Constants passed to drawElements() or drawArrays() to specify what kind of primitive to render. POINTS: 0x0000, LINES: 0x0001, LINE_LOOP: 0x0002, LINE_STRIP: 0x0003, TRIANGLES: 0x0004, TRIANGLE_STRIP: 0x0005, TRIANGLE_FAN: 0x0006, // Blending modes // Constants passed to blendFunc() or blendFuncSeparate() to specify the blending mode (for both, RBG and alpha, or separately). ZERO: 0, ONE: 1, SRC_COLOR: 0x0300, ONE_MINUS_SRC_COLOR: 0x0301, SRC_ALPHA: 0x0302, ONE_MINUS_SRC_ALPHA: 0x0303, DST_ALPHA: 0x0304, ONE_MINUS_DST_ALPHA: 0x0305, DST_COLOR: 0x0306, ONE_MINUS_DST_COLOR: 0x0307, SRC_ALPHA_SATURATE: 0x0308, CONSTANT_COLOR: 0x8001, ONE_MINUS_CONSTANT_COLOR: 0x8002, CONSTANT_ALPHA: 0x8003, ONE_MINUS_CONSTANT_ALPHA: 0x8004, // Blending equations // Constants passed to blendEquation() or blendEquationSeparate() to control // how the blending is calculated (for both, RBG and alpha, or separately). FUNC_ADD: 0x8006, FUNC_SUBTRACT: 0x800A, FUNC_REVERSE_SUBTRACT: 0x800B, // Getting GL parameter information // Constants passed to getParameter() to specify what information to return. BLEND_EQUATION: 0x8009, BLEND_EQUATION_RGB: 0x8009, BLEND_EQUATION_ALPHA: 0x883D, BLEND_DST_RGB: 0x80C8, BLEND_SRC_RGB: 0x80C9, BLEND_DST_ALPHA: 0x80CA, BLEND_SRC_ALPHA: 0x80CB, BLEND_COLOR: 0x8005, ARRAY_BUFFER_BINDING: 0x8894, ELEMENT_ARRAY_BUFFER_BINDING: 0x8895, LINE_WIDTH: 0x0B21, ALIASED_POINT_SIZE_RANGE: 0x846D, ALIASED_LINE_WIDTH_RANGE: 0x846E, CULL_FACE_MODE: 0x0B45, FRONT_FACE: 0x0B46, DEPTH_RANGE: 0x0B70, DEPTH_WRITEMASK: 0x0B72, DEPTH_CLEAR_VALUE: 0x0B73, DEPTH_FUNC: 0x0B74, STENCIL_CLEAR_VALUE: 0x0B91, STENCIL_FUNC: 0x0B92, STENCIL_FAIL: 0x0B94, STENCIL_PASS_DEPTH_FAIL: 0x0B95, STENCIL_PASS_DEPTH_PASS: 0x0B96, STENCIL_REF: 0x0B97, STENCIL_VALUE_MASK: 0x0B93, STENCIL_WRITEMASK: 0x0B98, STENCIL_BACK_FUNC: 0x8800, STENCIL_BACK_FAIL: 0x8801, STENCIL_BACK_PASS_DEPTH_FAIL: 0x8802, STENCIL_BACK_PASS_DEPTH_PASS: 0x8803, STENCIL_BACK_REF: 0x8CA3, STENCIL_BACK_VALUE_MASK: 0x8CA4, STENCIL_BACK_WRITEMASK: 0x8CA5, VIEWPORT: 0x0BA2, SCISSOR_BOX: 0x0C10, COLOR_CLEAR_VALUE: 0x0C22, COLOR_WRITEMASK: 0x0C23, UNPACK_ALIGNMENT: 0x0CF5, PACK_ALIGNMENT: 0x0D05, MAX_TEXTURE_SIZE: 0x0D33, MAX_VIEWPORT_DIMS: 0x0D3A, SUBPIXEL_BITS: 0x0D50, RED_BITS: 0x0D52, GREEN_BITS: 0x0D53, BLUE_BITS: 0x0D54, ALPHA_BITS: 0x0D55, DEPTH_BITS: 0x0D56, STENCIL_BITS: 0x0D57, POLYGON_OFFSET_UNITS: 0x2A00, POLYGON_OFFSET_FACTOR: 0x8038, TEXTURE_BINDING_2D: 0x8069, SAMPLE_BUFFERS: 0x80A8, SAMPLES: 0x80A9, SAMPLE_COVERAGE_VALUE: 0x80AA, SAMPLE_COVERAGE_INVERT: 0x80AB, COMPRESSED_TEXTURE_FORMATS: 0x86A3, VENDOR: 0x1F00, RENDERER: 0x1F01, VERSION: 0x1F02, IMPLEMENTATION_COLOR_READ_TYPE: 0x8B9A, IMPLEMENTATION_COLOR_READ_FORMAT: 0x8B9B, BROWSER_DEFAULT_WEBGL: 0x9244, // Buffers // Constants passed to bufferData(), bufferSubData(), bindBuffer(), or // getBufferParameter(). STATIC_DRAW: 0x88E4, STREAM_DRAW: 0x88E0, DYNAMIC_DRAW: 0x88E8, ARRAY_BUFFER: 0x8892, ELEMENT_ARRAY_BUFFER: 0x8893, BUFFER_SIZE: 0x8764, BUFFER_USAGE: 0x8765, // Vertex attributes // Constants passed to getVertexAttrib(). CURRENT_VERTEX_ATTRIB: 0x8626, VERTEX_ATTRIB_ARRAY_ENABLED: 0x8622, VERTEX_ATTRIB_ARRAY_SIZE: 0x8623, VERTEX_ATTRIB_ARRAY_STRIDE: 0x8624, VERTEX_ATTRIB_ARRAY_TYPE: 0x8625, VERTEX_ATTRIB_ARRAY_NORMALIZED: 0x886A, VERTEX_ATTRIB_ARRAY_POINTER: 0x8645, VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 0x889F, // Culling // Constants passed to cullFace(). CULL_FACE: 0x0B44, FRONT: 0x0404, BACK: 0x0405, FRONT_AND_BACK: 0x0408, // Enabling and disabling // Constants passed to enable() or disable(). BLEND: 0x0BE2, DEPTH_TEST: 0x0B71, DITHER: 0x0BD0, POLYGON_OFFSET_FILL: 0x8037, SAMPLE_ALPHA_TO_COVERAGE: 0x809E, SAMPLE_COVERAGE: 0x80A0, SCISSOR_TEST: 0x0C11, STENCIL_TEST: 0x0B90, // Errors // Constants returned from getError(). NO_ERROR: 0, INVALID_ENUM: 0x0500, INVALID_VALUE: 0x0501, INVALID_OPERATION: 0x0502, OUT_OF_MEMORY: 0x0505, CONTEXT_LOST_WEBGL: 0x9242, // Front face directions // Constants passed to frontFace(). CW: 0x0900, CCW: 0x0901, // Hints // Constants passed to hint() DONT_CARE: 0x1100, FASTEST: 0x1101, NICEST: 0x1102, GENERATE_MIPMAP_HINT: 0x8192, // Data types BYTE: 0x1400, UNSIGNED_BYTE: 0x1401, SHORT: 0x1402, UNSIGNED_SHORT: 0x1403, INT: 0x1404, UNSIGNED_INT: 0x1405, FLOAT: 0x1406, // Pixel formats DEPTH_COMPONENT: 0x1902, ALPHA: 0x1906, RGB: 0x1907, RGBA: 0x1908, LUMINANCE: 0x1909, LUMINANCE_ALPHA: 0x190A, // Pixel types // UNSIGNED_BYTE: 0x1401, UNSIGNED_SHORT_4_4_4_4: 0x8033, UNSIGNED_SHORT_5_5_5_1: 0x8034, UNSIGNED_SHORT_5_6_5: 0x8363, // Shaders // Constants passed to createShader() or getShaderParameter() FRAGMENT_SHADER: 0x8B30, VERTEX_SHADER: 0x8B31, COMPILE_STATUS: 0x8B81, DELETE_STATUS: 0x8B80, LINK_STATUS: 0x8B82, VALIDATE_STATUS: 0x8B83, ATTACHED_SHADERS: 0x8B85, ACTIVE_ATTRIBUTES: 0x8B89, ACTIVE_UNIFORMS: 0x8B86, MAX_VERTEX_ATTRIBS: 0x8869, MAX_VERTEX_UNIFORM_VECTORS: 0x8DFB, MAX_VARYING_VECTORS: 0x8DFC, MAX_COMBINED_TEXTURE_IMAGE_UNITS: 0x8B4D, MAX_VERTEX_TEXTURE_IMAGE_UNITS: 0x8B4C, MAX_TEXTURE_IMAGE_UNITS: 0x8872, MAX_FRAGMENT_UNIFORM_VECTORS: 0x8DFD, SHADER_TYPE: 0x8B4F, SHADING_LANGUAGE_VERSION: 0x8B8C, CURRENT_PROGRAM: 0x8B8D, // Depth or stencil tests // Constants passed to depthFunc() or stencilFunc(). NEVER: 0x0200, ALWAYS: 0x0207, LESS: 0x0201, EQUAL: 0x0202, LEQUAL: 0x0203, GREATER: 0x0204, GEQUAL: 0x0206, NOTEQUAL: 0x0205, // Stencil actions // Constants passed to stencilOp(). KEEP: 0x1E00, REPLACE: 0x1E01, INCR: 0x1E02, DECR: 0x1E03, INVERT: 0x150A, INCR_WRAP: 0x8507, DECR_WRAP: 0x8508, // Textures // Constants passed to texParameteri(), // texParameterf(), bindTexture(), texImage2D(), and others. NEAREST: 0x2600, LINEAR: 0x2601, NEAREST_MIPMAP_NEAREST: 0x2700, LINEAR_MIPMAP_NEAREST: 0x2701, NEAREST_MIPMAP_LINEAR: 0x2702, LINEAR_MIPMAP_LINEAR: 0x2703, TEXTURE_MAG_FILTER: 0x2800, TEXTURE_MIN_FILTER: 0x2801, TEXTURE_WRAP_S: 0x2802, TEXTURE_WRAP_T: 0x2803, TEXTURE_2D: 0x0DE1, TEXTURE: 0x1702, TEXTURE_CUBE_MAP: 0x8513, TEXTURE_BINDING_CUBE_MAP: 0x8514, TEXTURE_CUBE_MAP_POSITIVE_X: 0x8515, TEXTURE_CUBE_MAP_NEGATIVE_X: 0x8516, TEXTURE_CUBE_MAP_POSITIVE_Y: 0x8517, TEXTURE_CUBE_MAP_NEGATIVE_Y: 0x8518, TEXTURE_CUBE_MAP_POSITIVE_Z: 0x8519, TEXTURE_CUBE_MAP_NEGATIVE_Z: 0x851A, MAX_CUBE_MAP_TEXTURE_SIZE: 0x851C, // TEXTURE0 - 31 0x84C0 - 0x84DF A texture unit. TEXTURE0: 0x84C0, ACTIVE_TEXTURE: 0x84E0, REPEAT: 0x2901, CLAMP_TO_EDGE: 0x812F, MIRRORED_REPEAT: 0x8370, // Emulation TEXTURE_WIDTH: 0x1000, TEXTURE_HEIGHT: 0x1001, // Uniform types FLOAT_VEC2: 0x8B50, FLOAT_VEC3: 0x8B51, FLOAT_VEC4: 0x8B52, INT_VEC2: 0x8B53, INT_VEC3: 0x8B54, INT_VEC4: 0x8B55, BOOL: 0x8B56, BOOL_VEC2: 0x8B57, BOOL_VEC3: 0x8B58, BOOL_VEC4: 0x8B59, FLOAT_MAT2: 0x8B5A, FLOAT_MAT3: 0x8B5B, FLOAT_MAT4: 0x8B5C, SAMPLER_2D: 0x8B5E, SAMPLER_CUBE: 0x8B60, // Shader precision-specified types LOW_FLOAT: 0x8DF0, MEDIUM_FLOAT: 0x8DF1, HIGH_FLOAT: 0x8DF2, LOW_INT: 0x8DF3, MEDIUM_INT: 0x8DF4, HIGH_INT: 0x8DF5, // Framebuffers and renderbuffers FRAMEBUFFER: 0x8D40, RENDERBUFFER: 0x8D41, RGBA4: 0x8056, RGB5_A1: 0x8057, RGB565: 0x8D62, DEPTH_COMPONENT16: 0x81A5, STENCIL_INDEX: 0x1901, STENCIL_INDEX8: 0x8D48, DEPTH_STENCIL: 0x84F9, RENDERBUFFER_WIDTH: 0x8D42, RENDERBUFFER_HEIGHT: 0x8D43, RENDERBUFFER_INTERNAL_FORMAT: 0x8D44, RENDERBUFFER_RED_SIZE: 0x8D50, RENDERBUFFER_GREEN_SIZE: 0x8D51, RENDERBUFFER_BLUE_SIZE: 0x8D52, RENDERBUFFER_ALPHA_SIZE: 0x8D53, RENDERBUFFER_DEPTH_SIZE: 0x8D54, RENDERBUFFER_STENCIL_SIZE: 0x8D55, FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: 0x8CD0, FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: 0x8CD1, FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: 0x8CD2, FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: 0x8CD3, COLOR_ATTACHMENT0: 0x8CE0, DEPTH_ATTACHMENT: 0x8D00, STENCIL_ATTACHMENT: 0x8D20, DEPTH_STENCIL_ATTACHMENT: 0x821A, NONE: 0, FRAMEBUFFER_COMPLETE: 0x8CD5, FRAMEBUFFER_INCOMPLETE_ATTACHMENT: 0x8CD6, FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: 0x8CD7, FRAMEBUFFER_INCOMPLETE_DIMENSIONS: 0x8CD9, FRAMEBUFFER_UNSUPPORTED: 0x8CDD, FRAMEBUFFER_BINDING: 0x8CA6, RENDERBUFFER_BINDING: 0x8CA7, READ_FRAMEBUFFER: 0x8CA8, DRAW_FRAMEBUFFER: 0x8CA9, MAX_RENDERBUFFER_SIZE: 0x84E8, INVALID_FRAMEBUFFER_OPERATION: 0x0506, // Pixel storage modes // Constants passed to pixelStorei(). UNPACK_FLIP_Y_WEBGL: 0x9240, UNPACK_PREMULTIPLY_ALPHA_WEBGL: 0x9241, UNPACK_COLORSPACE_CONVERSION_WEBGL: 0x9243, // ///////////////////////////////////////////////////// // Additional constants defined WebGL 2 // These constants are defined on the WebGL2RenderingContext interface. // All WebGL 1 constants are also available in a WebGL 2 context. // ///////////////////////////////////////////////////// // Getting GL parameter information // Constants passed to getParameter() // to specify what information to return. READ_BUFFER: 0x0C02, UNPACK_ROW_LENGTH: 0x0CF2, UNPACK_SKIP_ROWS: 0x0CF3, UNPACK_SKIP_PIXELS: 0x0CF4, PACK_ROW_LENGTH: 0x0D02, PACK_SKIP_ROWS: 0x0D03, PACK_SKIP_PIXELS: 0x0D04, TEXTURE_BINDING_3D: 0x806A, UNPACK_SKIP_IMAGES: 0x806D, UNPACK_IMAGE_HEIGHT: 0x806E, MAX_3D_TEXTURE_SIZE: 0x8073, MAX_ELEMENTS_VERTICES: 0x80E8, MAX_ELEMENTS_INDICES: 0x80E9, MAX_TEXTURE_LOD_BIAS: 0x84FD, MAX_FRAGMENT_UNIFORM_COMPONENTS: 0x8B49, MAX_VERTEX_UNIFORM_COMPONENTS: 0x8B4A, MAX_ARRAY_TEXTURE_LAYERS: 0x88FF, MIN_PROGRAM_TEXEL_OFFSET: 0x8904, MAX_PROGRAM_TEXEL_OFFSET: 0x8905, MAX_VARYING_COMPONENTS: 0x8B4B, FRAGMENT_SHADER_DERIVATIVE_HINT: 0x8B8B, RASTERIZER_DISCARD: 0x8C89, VERTEX_ARRAY_BINDING: 0x85B5, MAX_VERTEX_OUTPUT_COMPONENTS: 0x9122, MAX_FRAGMENT_INPUT_COMPONENTS: 0x9125, MAX_SERVER_WAIT_TIMEOUT: 0x9111, MAX_ELEMENT_INDEX: 0x8D6B, // Textures // Constants passed to texParameteri(), // texParameterf(), bindTexture(), texImage2D(), and others. RED: 0x1903, RGB8: 0x8051, RGBA8: 0x8058, RGB10_A2: 0x8059, TEXTURE_3D: 0x806F, TEXTURE_WRAP_R: 0x8072, TEXTURE_MIN_LOD: 0x813A, TEXTURE_MAX_LOD: 0x813B, TEXTURE_BASE_LEVEL: 0x813C, TEXTURE_MAX_LEVEL: 0x813D, TEXTURE_COMPARE_MODE: 0x884C, TEXTURE_COMPARE_FUNC: 0x884D, SRGB: 0x8C40, SRGB8: 0x8C41, SRGB8_ALPHA8: 0x8C43, COMPARE_REF_TO_TEXTURE: 0x884E, RGBA32F: 0x8814, RGB32F: 0x8815, RGBA16F: 0x881A, RGB16F: 0x881B, TEXTURE_2D_ARRAY: 0x8C1A, TEXTURE_BINDING_2D_ARRAY: 0x8C1D, R11F_G11F_B10F: 0x8C3A, RGB9_E5: 0x8C3D, RGBA32UI: 0x8D70, RGB32UI: 0x8D71, RGBA16UI: 0x8D76, RGB16UI: 0x8D77, RGBA8UI: 0x8D7C, RGB8UI: 0x8D7D, RGBA32I: 0x8D82, RGB32I: 0x8D83, RGBA16I: 0x8D88, RGB16I: 0x8D89, RGBA8I: 0x8D8E, RGB8I: 0x8D8F, RED_INTEGER: 0x8D94, RGB_INTEGER: 0x8D98, RGBA_INTEGER: 0x8D99, R8: 0x8229, RG8: 0x822B, R16F: 0x822D, R32F: 0x822E, RG16F: 0x822F, RG32F: 0x8230, R8I: 0x8231, R8UI: 0x8232, R16I: 0x8233, R16UI: 0x8234, R32I: 0x8235, R32UI: 0x8236, RG8I: 0x8237, RG8UI: 0x8238, RG16I: 0x8239, RG16UI: 0x823A, RG32I: 0x823B, RG32UI: 0x823C, R8_SNORM: 0x8F94, RG8_SNORM: 0x8F95, RGB8_SNORM: 0x8F96, RGBA8_SNORM: 0x8F97, RGB10_A2UI: 0x906F, /* covered by extension COMPRESSED_R11_EAC : 0x9270, COMPRESSED_SIGNED_R11_EAC: 0x9271, COMPRESSED_RG11_EAC: 0x9272, COMPRESSED_SIGNED_RG11_EAC : 0x9273, COMPRESSED_RGB8_ETC2 : 0x9274, COMPRESSED_SRGB8_ETC2: 0x9275, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 : 0x9276, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC : 0x9277, COMPRESSED_RGBA8_ETC2_EAC: 0x9278, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : 0x9279, */ TEXTURE_IMMUTABLE_FORMAT: 0x912F, TEXTURE_IMMUTABLE_LEVELS: 0x82DF, // Pixel types UNSIGNED_INT_2_10_10_10_REV: 0x8368, UNSIGNED_INT_10F_11F_11F_REV: 0x8C3B, UNSIGNED_INT_5_9_9_9_REV: 0x8C3E, FLOAT_32_UNSIGNED_INT_24_8_REV: 0x8DAD, UNSIGNED_INT_24_8: 0x84FA, HALF_FLOAT: 0x140B, RG: 0x8227, RG_INTEGER: 0x8228, INT_2_10_10_10_REV: 0x8D9F, // Queries CURRENT_QUERY: 0x8865, QUERY_RESULT: 0x8866, QUERY_RESULT_AVAILABLE: 0x8867, ANY_SAMPLES_PASSED: 0x8C2F, ANY_SAMPLES_PASSED_CONSERVATIVE: 0x8D6A, // Draw buffers MAX_DRAW_BUFFERS: 0x8824, DRAW_BUFFER0: 0x8825, DRAW_BUFFER1: 0x8826, DRAW_BUFFER2: 0x8827, DRAW_BUFFER3: 0x8828, DRAW_BUFFER4: 0x8829, DRAW_BUFFER5: 0x882A, DRAW_BUFFER6: 0x882B, DRAW_BUFFER7: 0x882C, DRAW_BUFFER8: 0x882D, DRAW_BUFFER9: 0x882E, DRAW_BUFFER10: 0x882F, DRAW_BUFFER11: 0x8830, DRAW_BUFFER12: 0x8831, DRAW_BUFFER13: 0x8832, DRAW_BUFFER14: 0x8833, DRAW_BUFFER15: 0x8834, MAX_COLOR_ATTACHMENTS: 0x8CDF, COLOR_ATTACHMENT1: 0x8CE1, COLOR_ATTACHMENT2: 0x8CE2, COLOR_ATTACHMENT3: 0x8CE3, COLOR_ATTACHMENT4: 0x8CE4, COLOR_ATTACHMENT5: 0x8CE5, COLOR_ATTACHMENT6: 0x8CE6, COLOR_ATTACHMENT7: 0x8CE7, COLOR_ATTACHMENT8: 0x8CE8, COLOR_ATTACHMENT9: 0x8CE9, COLOR_ATTACHMENT10: 0x8CEA, COLOR_ATTACHMENT11: 0x8CEB, COLOR_ATTACHMENT12: 0x8CEC, COLOR_ATTACHMENT13: 0x8CED, COLOR_ATTACHMENT14: 0x8CEE, COLOR_ATTACHMENT15: 0x8CEF, // Samplers SAMPLER_3D: 0x8B5F, SAMPLER_2D_SHADOW: 0x8B62, SAMPLER_2D_ARRAY: 0x8DC1, SAMPLER_2D_ARRAY_SHADOW: 0x8DC4, SAMPLER_CUBE_SHADOW: 0x8DC5, INT_SAMPLER_2D: 0x8DCA, INT_SAMPLER_3D: 0x8DCB, INT_SAMPLER_CUBE: 0x8DCC, INT_SAMPLER_2D_ARRAY: 0x8DCF, UNSIGNED_INT_SAMPLER_2D: 0x8DD2, UNSIGNED_INT_SAMPLER_3D: 0x8DD3, UNSIGNED_INT_SAMPLER_CUBE: 0x8DD4, UNSIGNED_INT_SAMPLER_2D_ARRAY: 0x8DD7, MAX_SAMPLES: 0x8D57, SAMPLER_BINDING: 0x8919, // Buffers PIXEL_PACK_BUFFER: 0x88EB, PIXEL_UNPACK_BUFFER: 0x88EC, PIXEL_PACK_BUFFER_BINDING: 0x88ED, PIXEL_UNPACK_BUFFER_BINDING: 0x88EF, COPY_READ_BUFFER: 0x8F36, COPY_WRITE_BUFFER: 0x8F37, COPY_READ_BUFFER_BINDING: 0x8F36, COPY_WRITE_BUFFER_BINDING: 0x8F37, // Data types FLOAT_MAT2x3: 0x8B65, FLOAT_MAT2x4: 0x8B66, FLOAT_MAT3x2: 0x8B67, FLOAT_MAT3x4: 0x8B68, FLOAT_MAT4x2: 0x8B69, FLOAT_MAT4x3: 0x8B6A, UNSIGNED_INT_VEC2: 0x8DC6, UNSIGNED_INT_VEC3: 0x8DC7, UNSIGNED_INT_VEC4: 0x8DC8, UNSIGNED_NORMALIZED: 0x8C17, SIGNED_NORMALIZED: 0x8F9C, // Vertex attributes VERTEX_ATTRIB_ARRAY_INTEGER: 0x88FD, VERTEX_ATTRIB_ARRAY_DIVISOR: 0x88FE, // Transform feedback TRANSFORM_FEEDBACK_BUFFER_MODE: 0x8C7F, MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: 0x8C80, TRANSFORM_FEEDBACK_VARYINGS: 0x8C83, TRANSFORM_FEEDBACK_BUFFER_START: 0x8C84, TRANSFORM_FEEDBACK_BUFFER_SIZE: 0x8C85, TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0x8C88, MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 0x8C8A, MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 0x8C8B, INTERLEAVED_ATTRIBS: 0x8C8C, SEPARATE_ATTRIBS: 0x8C8D, TRANSFORM_FEEDBACK_BUFFER: 0x8C8E, TRANSFORM_FEEDBACK_BUFFER_BINDING: 0x8C8F, TRANSFORM_FEEDBACK: 0x8E22, TRANSFORM_FEEDBACK_PAUSED: 0x8E23, TRANSFORM_FEEDBACK_ACTIVE: 0x8E24, TRANSFORM_FEEDBACK_BINDING: 0x8E25, // Framebuffers and renderbuffers FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: 0x8210, FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: 0x8211, FRAMEBUFFER_ATTACHMENT_RED_SIZE: 0x8212, FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: 0x8213, FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: 0x8214, FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: 0x8215, FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: 0x8216, FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: 0x8217, FRAMEBUFFER_DEFAULT: 0x8218, // DEPTH_STENCIL_ATTACHMENT : 0x821A, // DEPTH_STENCIL: 0x84F9, DEPTH24_STENCIL8: 0x88F0, DRAW_FRAMEBUFFER_BINDING: 0x8CA6, READ_FRAMEBUFFER_BINDING: 0x8CAA, RENDERBUFFER_SAMPLES: 0x8CAB, FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: 0x8CD4, FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: 0x8D56, // Uniforms UNIFORM_BUFFER: 0x8A11, UNIFORM_BUFFER_BINDING: 0x8A28, UNIFORM_BUFFER_START: 0x8A29, UNIFORM_BUFFER_SIZE: 0x8A2A, MAX_VERTEX_UNIFORM_BLOCKS: 0x8A2B, MAX_FRAGMENT_UNIFORM_BLOCKS: 0x8A2D, MAX_COMBINED_UNIFORM_BLOCKS: 0x8A2E, MAX_UNIFORM_BUFFER_BINDINGS: 0x8A2F, MAX_UNIFORM_BLOCK_SIZE: 0x8A30, MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: 0x8A31, MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: 0x8A33, UNIFORM_BUFFER_OFFSET_ALIGNMENT: 0x8A34, ACTIVE_UNIFORM_BLOCKS: 0x8A36, UNIFORM_TYPE: 0x8A37, UNIFORM_SIZE: 0x8A38, UNIFORM_BLOCK_INDEX: 0x8A3A, UNIFORM_OFFSET: 0x8A3B, UNIFORM_ARRAY_STRIDE: 0x8A3C, UNIFORM_MATRIX_STRIDE: 0x8A3D, UNIFORM_IS_ROW_MAJOR: 0x8A3E, UNIFORM_BLOCK_BINDING: 0x8A3F, UNIFORM_BLOCK_DATA_SIZE: 0x8A40, UNIFORM_BLOCK_ACTIVE_UNIFORMS: 0x8A42, UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: 0x8A43, UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: 0x8A44, UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: 0x8A46, // Sync objects OBJECT_TYPE: 0x9112, SYNC_CONDITION: 0x9113, SYNC_STATUS: 0x9114, SYNC_FLAGS: 0x9115, SYNC_FENCE: 0x9116, SYNC_GPU_COMMANDS_COMPLETE: 0x9117, UNSIGNALED: 0x9118, SIGNALED: 0x9119, ALREADY_SIGNALED: 0x911A, TIMEOUT_EXPIRED: 0x911B, CONDITION_SATISFIED: 0x911C, WAIT_FAILED: 0x911D, SYNC_FLUSH_COMMANDS_BIT: 0x00000001, // Miscellaneous constants COLOR: 0x1800, DEPTH: 0x1801, STENCIL: 0x1802, MIN: 0x8007, MAX: 0x8008, DEPTH_COMPONENT24: 0x81A6, STREAM_READ: 0x88E1, STREAM_COPY: 0x88E2, STATIC_READ: 0x88E5, STATIC_COPY: 0x88E6, DYNAMIC_READ: 0x88E9, DYNAMIC_COPY: 0x88EA, DEPTH_COMPONENT32F: 0x8CAC, DEPTH32F_STENCIL8: 0x8CAD, INVALID_INDEX: 0xFFFFFFFF, TIMEOUT_IGNORED: -1, MAX_CLIENT_WAIT_TIMEOUT_WEBGL: 0x9247, // Constants defined in WebGL extensions // ANGLE_instanced_arrays VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: 0x88FE, // WEBGL_debug_renderer_info UNMASKED_VENDOR_WEBGL: 0x9245, UNMASKED_RENDERER_WEBGL: 0x9246, // EXT_texture_filter_anisotropic MAX_TEXTURE_MAX_ANISOTROPY_EXT: 0x84FF, TEXTURE_MAX_ANISOTROPY_EXT: 0x84FE, // WEBGL_compressed_texture_s3tc COMPRESSED_RGB_S3TC_DXT1_EXT: 0x83F0, COMPRESSED_RGBA_S3TC_DXT1_EXT: 0x83F1, COMPRESSED_RGBA_S3TC_DXT3_EXT: 0x83F2, COMPRESSED_RGBA_S3TC_DXT5_EXT: 0x83F3, // WEBGL_compressed_texture_es3 COMPRESSED_R11_EAC: 0x9270, COMPRESSED_SIGNED_R11_EAC: 0x9271, COMPRESSED_RG11_EAC: 0x9272, COMPRESSED_SIGNED_RG11_EAC: 0x9273, COMPRESSED_RGB8_ETC2: 0x9274, COMPRESSED_RGBA8_ETC2_EAC: 0x9275, COMPRESSED_SRGB8_ETC2: 0x9276, COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 0x9277, COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9278, COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 0x9279, // WEBGL_compressed_texture_pvrtc COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 0x8C00, COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 0x8C02, COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 0x8C01, COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 0x8C03, // WEBGL_compressed_texture_etc1 COMPRESSED_RGB_ETC1_WEBGL: 0x8D64, // WEBGL_compressed_texture_atc COMPRESSED_RGB_ATC_WEBGL: 0x8C92, COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 0x8C92, COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 0x87EE, // WEBGL_depth_texture UNSIGNED_INT_24_8_WEBGL: 0x84FA, // OES_texture_half_float HALF_FLOAT_OES: 0x8D61, // WEBGL_color_buffer_float RGBA32F_EXT: 0x8814, RGB32F_EXT: 0x8815, FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: 0x8211, UNSIGNED_NORMALIZED_EXT: 0x8C17, // EXT_blend_minmax MIN_EXT: 0x8007, MAX_EXT: 0x8008, // EXT_sRGB SRGB_EXT: 0x8C40, SRGB_ALPHA_EXT: 0x8C42, SRGB8_ALPHA8_EXT: 0x8C43, FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: 0x8210, // OES_standard_derivatives FRAGMENT_SHADER_DERIVATIVE_HINT_OES: 0x8B8B, // WEBGL_draw_buffers COLOR_ATTACHMENT0_WEBGL: 0x8CE0, COLOR_ATTACHMENT1_WEBGL: 0x8CE1, COLOR_ATTACHMENT2_WEBGL: 0x8CE2, COLOR_ATTACHMENT3_WEBGL: 0x8CE3, COLOR_ATTACHMENT4_WEBGL: 0x8CE4, COLOR_ATTACHMENT5_WEBGL: 0x8CE5, COLOR_ATTACHMENT6_WEBGL: 0x8CE6, COLOR_ATTACHMENT7_WEBGL: 0x8CE7, COLOR_ATTACHMENT8_WEBGL: 0x8CE8, COLOR_ATTACHMENT9_WEBGL: 0x8CE9, COLOR_ATTACHMENT10_WEBGL: 0x8CEA, COLOR_ATTACHMENT11_WEBGL: 0x8CEB, COLOR_ATTACHMENT12_WEBGL: 0x8CEC, COLOR_ATTACHMENT13_WEBGL: 0x8CED, COLOR_ATTACHMENT14_WEBGL: 0x8CEE, COLOR_ATTACHMENT15_WEBGL: 0x8CEF, DRAW_BUFFER0_WEBGL: 0x8825, DRAW_BUFFER1_WEBGL: 0x8826, DRAW_BUFFER2_WEBGL: 0x8827, DRAW_BUFFER3_WEBGL: 0x8828, DRAW_BUFFER4_WEBGL: 0x8829, DRAW_BUFFER5_WEBGL: 0x882A, DRAW_BUFFER6_WEBGL: 0x882B, DRAW_BUFFER7_WEBGL: 0x882C, DRAW_BUFFER8_WEBGL: 0x882D, DRAW_BUFFER9_WEBGL: 0x882E, DRAW_BUFFER10_WEBGL: 0x882F, DRAW_BUFFER11_WEBGL: 0x8830, DRAW_BUFFER12_WEBGL: 0x8831, DRAW_BUFFER13_WEBGL: 0x8832, DRAW_BUFFER14_WEBGL: 0x8833, DRAW_BUFFER15_WEBGL: 0x8834, MAX_COLOR_ATTACHMENTS_WEBGL: 0x8CDF, MAX_DRAW_BUFFERS_WEBGL: 0x8824, // OES_vertex_array_object VERTEX_ARRAY_BINDING_OES: 0x85B5, // EXT_disjoint_timer_query QUERY_COUNTER_BITS_EXT: 0x8864, CURRENT_QUERY_EXT: 0x8865, QUERY_RESULT_EXT: 0x8866, QUERY_RESULT_AVAILABLE_EXT: 0x8867, TIME_ELAPSED_EXT: 0x88BF, TIMESTAMP_EXT: 0x8E28, GPU_DISJOINT_EXT: 0x8FBB // A Boolean indicating whether or not the GPU performed any disjoint operation. }); //# sourceMappingURL=constants.js.map /***/ }), /* 47 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || Function("return this")() || (1,eval)("this"); } catch(e) { // This works if the window reference is available if(typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 48 */ /***/ (function(module, exports) { module.exports = function (it, Constructor, name, forbiddenField) { if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) { throw TypeError(name + ': incorrect invocation!'); } return it; }; /***/ }), /* 49 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(28); var call = __webpack_require__(210); var isArrayIter = __webpack_require__(136); var anObject = __webpack_require__(2); var toLength = __webpack_require__(11); var getIterFn = __webpack_require__(153); var BREAK = {}; var RETURN = {}; var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable); var f = ctx(fn, that, entries ? 2 : 1); var index = 0; var length, step, iterator, result; if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!'); // fast case for arrays with default iterator if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) { result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]); if (result === BREAK || result === RETURN) return result; } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) { result = call(iterator, f, step.value, entries); if (result === BREAK || result === RETURN) return result; } }; exports.BREAK = BREAK; exports.RETURN = RETURN; /***/ }), /* 50 */ /***/ (function(module, exports) { module.exports = false; /***/ }), /* 51 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(2); var dPs = __webpack_require__(216); var enumBugKeys = __webpack_require__(132); var IE_PROTO = __webpack_require__(144)('IE_PROTO'); var Empty = function () { /* empty */ }; var PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function () { // Thrash, waste and sodomy: IE GC bug var iframe = __webpack_require__(131)('iframe'); var i = enumBugKeys.length; var lt = '<'; var gt = '>'; var iframeDocument; iframe.style.display = 'none'; __webpack_require__(134).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); iframeDocument = iframe.contentWindow.document; iframeDocument.open(); iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt); iframeDocument.close(); createDict = iframeDocument.F; while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]]; return createDict(); }; module.exports = Object.create || function create(O, Properties) { var result; if (O !== null) { Empty[PROTOTYPE] = anObject(O); result = new Empty(); Empty[PROTOTYPE] = null; // add "__proto__" for Object.getPrototypeOf polyfill result[IE_PROTO] = O; } else result = createDict(); return Properties === undefined ? result : dPs(result, Properties); }; /***/ }), /* 52 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O) var $keys = __webpack_require__(218); var hiddenKeys = __webpack_require__(132).concat('length', 'prototype'); exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { return $keys(O, hiddenKeys); }; /***/ }), /* 53 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) var $keys = __webpack_require__(218); var enumBugKeys = __webpack_require__(132); module.exports = Object.keys || function keys(O) { return $keys(O, enumBugKeys); }; /***/ }), /* 54 */ /***/ (function(module, exports) { module.exports = function (bitmap, value) { return { enumerable: !(bitmap & 1), configurable: !(bitmap & 2), writable: !(bitmap & 4), value: value }; }; /***/ }), /* 55 */ /***/ (function(module, exports, __webpack_require__) { var redefine = __webpack_require__(20); module.exports = function (target, src, safe) { for (var key in src) redefine(target, key, src[key], safe); return target; }; /***/ }), /* 56 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var dP = __webpack_require__(10); var DESCRIPTORS = __webpack_require__(9); var SPECIES = __webpack_require__(6)('species'); module.exports = function (KEY) { var C = global[KEY]; if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, { configurable: true, get: function () { return this; } }); }; /***/ }), /* 57 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(36); var max = Math.max; var min = Math.min; module.exports = function (index, length) { index = toInteger(index); return index < 0 ? max(index + length, 0) : min(index, length); }; /***/ }), /* 58 */ /***/ (function(module, exports) { var id = 0; var px = Math.random(); module.exports = function (key) { return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36)); }; /***/ }), /* 59 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__animation_loop__ = __webpack_require__(249); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationLoop", function() { return __WEBPACK_IMPORTED_MODULE_0__animation_loop__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "requestAnimationFrame", function() { return __WEBPACK_IMPORTED_MODULE_0__animation_loop__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "cancelAnimationFrame", function() { return __WEBPACK_IMPORTED_MODULE_0__animation_loop__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__model__ = __webpack_require__(104); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Model", function() { return __WEBPACK_IMPORTED_MODULE_1__model__["a"]; }); //# sourceMappingURL=index.js.map /***/ }), /* 60 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__create_canvas__ = __webpack_require__(663); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_0__create_canvas__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_0__create_canvas__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_0__create_canvas__["b"]; }); /* unused harmony reexport resizeCanvas */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_0__create_canvas__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__create_context__ = __webpack_require__(664); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__create_context__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_1__create_context__["b"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__polyfill_context__ = __webpack_require__(265); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_2__polyfill_context__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__track_context_state__ = __webpack_require__(164); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_3__track_context_state__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__format_glsl_error__ = __webpack_require__(665); /* unused harmony reexport formatGLSLCompilerError */ /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_4__format_glsl_error__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__get_shader_name__ = __webpack_require__(264); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_5__get_shader_name__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__constants__ = __webpack_require__(46); /* unused harmony reexport GL */ // TODO - avoid uncondsitionally importing GL as it adds a lot to bundle size? //# sourceMappingURL=index.js.map /***/ }), /* 61 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "GL", function() { return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__api_types__ = __webpack_require__(268); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Image", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLRenderingContext", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLProgram", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["f"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLShader", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["g"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLBuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLFramebuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["h"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLRenderbuffer", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["i"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLTexture", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["j"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLUniformLocation", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["k"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLActiveInfo", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["l"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGLShaderPrecisionFormat", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["m"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebGL2RenderingContext", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "webGLTypesAvailable", function() { return __WEBPACK_IMPORTED_MODULE_1__api_types__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context__ = __webpack_require__(7); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWebGL", function() { return __WEBPACK_IMPORTED_MODULE_2__context__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "isWebGL2", function() { return __WEBPACK_IMPORTED_MODULE_2__context__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "createGLContext", function() { return __WEBPACK_IMPORTED_MODULE_2__context__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "deleteGLContext", function() { return __WEBPACK_IMPORTED_MODULE_2__context__["e"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__context_state__ = __webpack_require__(68); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "withParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__context_state__["f"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "resetParameters", function() { return __WEBPACK_IMPORTED_MODULE_3__context_state__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__context_limits__ = __webpack_require__(165); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getContextInfo", function() { return __WEBPACK_IMPORTED_MODULE_4__context_limits__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__buffer__ = __webpack_require__(67); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Buffer", function() { return __WEBPACK_IMPORTED_MODULE_5__buffer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shader__ = __webpack_require__(111); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Shader", function() { return __WEBPACK_IMPORTED_MODULE_6__shader__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VertexShader", function() { return __WEBPACK_IMPORTED_MODULE_6__shader__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "FragmentShader", function() { return __WEBPACK_IMPORTED_MODULE_6__shader__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__program__ = __webpack_require__(109); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return __WEBPACK_IMPORTED_MODULE_7__program__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__framebuffer__ = __webpack_require__(69); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Framebuffer", function() { return __WEBPACK_IMPORTED_MODULE_8__framebuffer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__renderbuffer__ = __webpack_require__(110); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Renderbuffer", function() { return __WEBPACK_IMPORTED_MODULE_9__renderbuffer__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__texture_2d__ = __webpack_require__(167); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "Texture2D", function() { return __WEBPACK_IMPORTED_MODULE_10__texture_2d__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__texture_cube__ = __webpack_require__(275); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "TextureCube", function() { return __WEBPACK_IMPORTED_MODULE_11__texture_cube__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12__draw__ = __webpack_require__(270); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "draw", function() { return __WEBPACK_IMPORTED_MODULE_12__draw__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13__clear__ = __webpack_require__(107); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "clear", function() { return __WEBPACK_IMPORTED_MODULE_13__clear__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14__functions__ = __webpack_require__(272); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "readPixels", function() { return __WEBPACK_IMPORTED_MODULE_14__functions__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15__uniforms__ = __webpack_require__(168); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "parseUniformName", function() { return __WEBPACK_IMPORTED_MODULE_15__uniforms__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getUniformSetter", function() { return __WEBPACK_IMPORTED_MODULE_15__uniforms__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "checkUniformValues", function() { return __WEBPACK_IMPORTED_MODULE_15__uniforms__["c"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16__vertex_array__ = __webpack_require__(169); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "VertexArray", function() { return __WEBPACK_IMPORTED_MODULE_16__vertex_array__["a"]; }); // luma.gl Base WebGL wrapper library // Provides simple class/function wrappers around the low level webgl objects // These classes are intentionally close to the WebGL API // but make it easier to use. // Higher level abstractions can be built on these classes // Exports WebGL API constants and types, plus some basic type checks // WebGL1 objects // Functions // WebGL2 //# sourceMappingURL=index.js.map /***/ }), /* 62 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export TEXTURE_FORMATS */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__context_state__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__buffer__ = __webpack_require__(67); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _TEXTURE_FORMATS; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint-disable no-inline-comments, max-len */ // Supported min filters for NPOT texture. var NPOT_MIN_FILTERS = [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINEAR, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].NEAREST]; // const S3TC = 'WEBGL_compressed_texture_s3tc'; // const PVRTC = 'WEBGL_compressed_texture_pvrtc'; // const ES3 = 'WEBGL_compressed_texture_es3'; // const ETC1 = 'WEBGL_compressed_texture_etc1'; // const SRGB = 'EXT_sRGB'; // const DEPTH = 'WEBGL_depth_texture'; // Legal combinations for internalFormat, format and type var TEXTURE_FORMATS = (_TEXTURE_FORMATS = {}, _defineProperty(_TEXTURE_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB, { dataFormat: __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB, types: [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_SHORT_5_6_5] }), _defineProperty(_TEXTURE_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA, { dataFormat: __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA, types: [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_SHORT_4_4_4_4, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_SHORT_5_5_5_1] }), _defineProperty(_TEXTURE_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].ALPHA, { dataFormat: __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].ALPHA, types: [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE] }), _defineProperty(_TEXTURE_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LUMINANCE, { dataFormat: __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LUMINANCE, types: [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE] }), _defineProperty(_TEXTURE_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LUMINANCE_ALPHA, { dataFormat: __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LUMINANCE_ALPHA, types: [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE] // [GL.DEPTH_COMPONENT]: {types: [GL.UNSIGNED_SHORT, GL.UNSIGNED_INT, GL.UNSIGNED_INT_24_8], gl1: DEPTH}, // [GL.DEPTH_STENCIL]: {gl1: DEPTH}, // Sized texture format - more performance // R // [GL.R8]: {dataFormat: GL.RED, types: [GL.UNSIGNED_BYTE], gl2: true}, // [GL.R16F]: {dataFormat: GL.RED, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true}, // [GL.R32F]: {dataFormat: GL.RED, types: [GL.FLOAT], gl2: true}, // [GL.R8UI]: {dataFormat: GL.RED_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true}, // // RG // [GL.RG8]: {dataFormat: GL.RG, types: [GL.UNSIGNED_BYTE], gl2: true}, // [GL.RG16F]: {dataFormat: GL.RG, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true}, // [GL.RG32F]: {dataFormat: GL.RG, types: [GL.FLOAT], gl2: true}, // [GL.RG8UI]: {dataFormat: GL.RG_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true}, // // RGB // [GL.RGB8]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB}, // [GL.SRGB8]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB}, // [GL.RGB565]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_6_5], gl2: true}, // [GL.R11F_G11F_B10F]: {dataFormat: GL.RGB, types: [GL.UNSIGNED_INT_10F_11F_11F_REV, GL.HALF_FLOAT, GL.FLOAT], gl2: true}, // [GL.RGB9_E5]: {dataFormat: GL.RGB, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1: 'WEBGL_color_buffer_half_float'}, // [GL.RGB16F]: {dataFormat: GL.RGB, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true, gl1: 'WEBGL_color_buffer_float'}, // [GL.RGB32F]: {dataFormat: GL.RGB, types: [GL.FLOAT], gl2: true}, // [GL.RGB8UI]: {dataFormat: GL.RGB_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true}, // // RGBA // [GL.RGBA8]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB}, // [GL.SRGB8_ALPHA8]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE], gl2: true, gl1: SRGB}, // [GL.RGB5_A1]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_5_5_5_1], gl2: true}, // [GL.RGBA4]: {dataFormat: GL.RGBA, types: [GL.UNSIGNED_BYTE, GL.UNSIGNED_SHORT_4_4_4_4], gl2: true}, // [GL.RGBA16F]: {dataFormat: GL.RGBA, types: [GL.HALF_FLOAT, GL.FLOAT], gl2: true}, // [GL.RGBA32F]: {dataFormat: GL.RGBA, types: [GL.FLOAT], gl2: true}, // [GL.RGBA8UI]: {dataFormat: GL.RGBA_INTEGER, types: [GL.UNSIGNED_BYTE], gl2: true} // Compressed formats // WEBGL_compressed_texture_s3tc // [GL.COMPRESSED_RGB_S3TC_DXT1_EXT]: {compressed: true, gl1: S3TC}, // [GL.COMPRESSED_RGBA_S3TC_DXT1_EXT]: {compressed: true, gl1: S3TC}, // [GL.COMPRESSED_RGBA_S3TC_DXT3_EXT]: {compressed: true, gl1: S3TC}, // [GL.COMPRESSED_RGBA_S3TC_DXT5_EXT]: {compressed: true, gl1: S3TC}, // WEBGL_compressed_texture_es3 // [GL.COMPRESSED_R11_EAC]: {compressed: true, gl1: ES3}, // RED // [GL.COMPRESSED_SIGNED_R11_EAC]: {compressed: true, gl1: ES3}, // RED // [GL.COMPRESSED_RG11_EAC]: {compressed: true, gl1: ES3}, // RG // [GL.COMPRESSED_SIGNED_RG11_EAC]: {compressed: true, gl1: ES3}, // RG // [GL.COMPRESSED_RGB8_ETC2]: {compressed: true, gl1: ES3}, // RGB // [GL.COMPRESSED_RGBA8_ETC2_EAC]: {compressed: true, gl1: ES3}, // RBG // [GL.COMPRESSED_SRGB8_ETC2]: {compressed: true, gl1: ES3}, // RGB // [GL.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]: {compressed: true, gl1: ES3}, // RGBA // [GL.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]: {compressed: true, gl1: ES3}, // RGBA // [GL.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]: {compressed: true, gl1: ES3}, // RGBA /* WebGL2 guaranteed availability compressed formats? COMPRESSED_R11_EAC RED COMPRESSED_SIGNED_R11_EAC RED COMPRESSED_RG11_EAC RG COMPRESSED_SIGNED_RG11_EAC RG COMPRESSED_RGB8_ETC2 RGB COMPRESSED_SRGB8_ETC2 RGB COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 RGBA COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 RGBA COMPRESSED_RGBA8_ETC2_EAC RGBA COMPRESSED_SRGB8_ALPHA8_ETC2_EAC */ // WEBGL_compressed_texture_pvrtc // [GL.COMPRESSED_RGB_PVRTC_4BPPV1_IMG]: {compressed: true, gl1: PVRTC}, // [GL.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]: {compressed: true, gl1: PVRTC}, // [GL.COMPRESSED_RGB_PVRTC_2BPPV1_IMG]: {compressed: true, gl1: PVRTC}, // [GL.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]: {compressed: true, gl1: PVRTC}, // WEBGL_compressed_texture_etc1 // [GL.COMPRESSED_RGB_ETC1_WEBGL]: {compressed: true, gl1: ETC1}, // WEBGL_compressed_texture_atc // [GL.COMPRESSED_RGB_ATC_WEBGL]: {compressed: true, gl1: ETC1}, // [GL.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]: {compressed: true, gl1: ETC1}, // [GL.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]: {compressed: true, gl1: ETC1} }), _TEXTURE_FORMATS); function isFormatSupported(gl, format) { __WEBPACK_IMPORTED_MODULE_7_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["a" /* isWebGL */])(gl), __WEBPACK_IMPORTED_MODULE_2__context__["h" /* ERR_WEBGL */]); var info = TEXTURE_FORMATS[format]; if (!info) { return false; } if (info.gl1 === undefined && info.gl2 === undefined) { // No info - always supported return true; } var value = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["b" /* isWebGL2 */])(gl) ? info.gl2 || info.gl1 : info.gl1; return typeof value === 'string' ? gl.getExtension(value) : value; } function isLinearFilteringSupported(gl, format) { var info = TEXTURE_FORMATS[format]; switch (info && info.types[0]) { // Both WebGL1 and WebGL2? case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].FLOAT: return gl.getExtension('OES_texture_float_linear'); // Not in WebGL2? case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].HALF_FLOAT: return gl.getExtension('OES_texture_half_float_linear'); default: return true; } } var Texture = /*#__PURE__*/function (_Resource) { _inherits(Texture, _Resource); _createClass(Texture, null, [{ key: 'isSupported', value: function isSupported(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, format = _ref.format, linearFiltering = _ref.linearFiltering; __WEBPACK_IMPORTED_MODULE_7_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["a" /* isWebGL */])(gl), __WEBPACK_IMPORTED_MODULE_2__context__["h" /* ERR_WEBGL */]); var supported = true; if (format) { supported = supported && isFormatSupported(gl, format); supported = supported && (!linearFiltering || isLinearFilteringSupported(gl, format)); } return supported; } // target cannot be modified by bind: // textures are special because when you first bind them to a target, // they get special information. When you first bind a texture as a // GL_TEXTURE_2D, you are actually setting special state in the texture. // You are saying that this texture is a 2D texture. // And it will always be a 2D texture; this state cannot be changed ever. // If you have a texture that was first bound as a GL_TEXTURE_2D, // you must always bind it as a GL_TEXTURE_2D; // attempting to bind it as GL_TEXTURE_1D will give rise to an error // (while run-time). }]); function Texture(gl, opts) { _classCallCheck(this, Texture); var _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__utils__["d" /* uid */])('texture') : _opts$id, handle = opts.handle, target = opts.target; var _this = _possibleConstructorReturn(this, (Texture.__proto__ || Object.getPrototypeOf(Texture)).call(this, gl, { id: id, handle: handle })); _this.target = target; _this.hasFloatTexture = gl.getExtension('OES_texture_float'); _this.textureUnit = undefined; return _this; } _createClass(Texture, [{ key: 'toString', value: function toString() { return 'Texture(' + this.id + ',' + this.width + 'x' + this.height + ')'; } /* eslint-disable max-len, max-statements */ }, { key: 'initialize', value: function initialize() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var data = opts.data; var _opts$pixels = opts.pixels, pixels = _opts$pixels === undefined ? null : _opts$pixels, _opts$format = opts.format, format = _opts$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA : _opts$format, _opts$type = opts.type, type = _opts$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE : _opts$type, _opts$border = opts.border, border = _opts$border === undefined ? 0 : _opts$border, _opts$recreate = opts.recreate, recreate = _opts$recreate === undefined ? false : _opts$recreate, _opts$parameters = opts.parameters, parameters = _opts$parameters === undefined ? {} : _opts$parameters, _opts$pixelStore = opts.pixelStore, pixelStore = _opts$pixelStore === undefined ? {} : _opts$pixelStore, _opts$unpackFlipY = opts.unpackFlipY, unpackFlipY = _opts$unpackFlipY === undefined ? true : _opts$unpackFlipY; var _opts$mipmaps = opts.mipmaps, mipmaps = _opts$mipmaps === undefined ? true : _opts$mipmaps; // pixels variable is for API compatibility purpose if (!data) { // TODO - This looks backwards? Commenting out for now until we decide // which prop to use // log.deprecated('data', 'pixels'); data = pixels; } var width = opts.width, height = opts.height, dataFormat = opts.dataFormat; // Deduce width and height // Store opts for accessors var _deduceParameters2 = this._deduceParameters({ format: format, type: type, dataFormat: dataFormat, compressed: false, data: data, width: width, height: height }); width = _deduceParameters2.width; height = _deduceParameters2.height; dataFormat = _deduceParameters2.dataFormat; this.width = width; this.height = height; this.format = format; this.type = type; this.dataFormat = dataFormat; this.border = border; this.mipmaps = mipmaps; // Note: luma.gl defaults to GL.UNPACK_FLIP_Y_WEBGL = true; // TODO - compare v4 and v3 var DEFAULT_TEXTURE_SETTINGS = _defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNPACK_FLIP_Y_WEBGL, unpackFlipY); var glSettings = Object.assign({}, DEFAULT_TEXTURE_SETTINGS, pixelStore); if (this._isNPOT()) { __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].warn('texture: ' + this + ' is Non-Power-Of-Two, disabling mipmaping'); mipmaps = false; this._updateForNPOT(parameters); } this.setImageData({ data: data, width: width, height: height, format: format, type: type, dataFormat: dataFormat, border: border, mipmaps: mipmaps, parameters: glSettings }); if (mipmaps) { this.generateMipmap(); } // Set texture sampler parameters this.setParameters(parameters); // TODO - Store data to enable auto recreate on context loss if (recreate) { this.data = data; } } // If size has changed, reinitializes with current format // note clears image and mipmaps }, { key: 'resize', value: function resize(_ref2) { var width = _ref2.width, height = _ref2.height; if (width !== this.width || height !== this.height) { return this.initialize({ width: width, height: height, format: this.format, type: this.type, dataFormat: this.dataFormat, border: this.border, mipmaps: false }); } return this; } // Call to regenerate mipmaps after modifying texture(s) }, { key: 'generateMipmap', value: function generateMipmap() { var _this2 = this; var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this.gl.bindTexture(this.target, this.handle); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__context_state__["f" /* withParameters */])(this.gl, params, function () { _this2.gl.generateMipmap(_this2.target); }); this.gl.bindTexture(this.target, null); return this; } /* * Allocates storage * @param {*} pixels - * null - create empty texture of specified format * Typed array - init from image data in typed array * Buffer|WebGLBuffer - (WEBGL2) init from image data in WebGLBuffer * HTMLImageElement|Image - Inits with content of image. Auto width/height * HTMLCanvasElement - Inits with contents of canvas. Auto width/height * HTMLVideoElement - Creates video texture. Auto width/height * * @param {GLint} width - * @param {GLint} height - * @param {GLint} mipMapLevel - * @param {GLenum} format - format of image data. * @param {GLenum} type * - format of array (autodetect from type) or * - (WEBGL2) format of buffer * @param {Number} offset - (WEBGL2) offset from start of buffer * @param {GLint} border - must be 0. * @parameters - temporary settings to be applied, can be used to supply pixel store settings. */ /* eslint-disable max-len, max-statements, complexity */ }, { key: 'setImageData', value: function setImageData(_ref3) { var _this3 = this; var _ref3$target = _ref3.target, target = _ref3$target === undefined ? this.target : _ref3$target, _ref3$pixels = _ref3.pixels, pixels = _ref3$pixels === undefined ? null : _ref3$pixels, _ref3$data = _ref3.data, data = _ref3$data === undefined ? null : _ref3$data, width = _ref3.width, height = _ref3.height, _ref3$level = _ref3.level, level = _ref3$level === undefined ? 0 : _ref3$level, _ref3$format = _ref3.format, format = _ref3$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA : _ref3$format, type = _ref3.type, dataFormat = _ref3.dataFormat, _ref3$offset = _ref3.offset, offset = _ref3$offset === undefined ? 0 : _ref3$offset, _ref3$border = _ref3.border, border = _ref3$border === undefined ? 0 : _ref3$border, _ref3$compressed = _ref3.compressed, compressed = _ref3$compressed === undefined ? false : _ref3$compressed, _ref3$parameters = _ref3.parameters, parameters = _ref3$parameters === undefined ? {} : _ref3$parameters; // pixels variable is for API compatibility purpose if (!data) { data = pixels; } var _deduceParameters3 = this._deduceParameters({ format: format, type: type, dataFormat: dataFormat, compressed: compressed, data: data, width: width, height: height }); type = _deduceParameters3.type; dataFormat = _deduceParameters3.dataFormat; compressed = _deduceParameters3.compressed; width = _deduceParameters3.width; height = _deduceParameters3.height; var gl = this.gl; gl.bindTexture(this.target, this.handle); var dataType = null; var _getDataType2 = this._getDataType({ data: data, compressed: compressed }); data = _getDataType2.data; dataType = _getDataType2.dataType; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__context_state__["f" /* withParameters */])(this.gl, parameters, function () { switch (dataType) { case 'null': gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data); break; case 'typed-array': // Looks like this assert is not necessary, as offset is ignored under WebGL1 // assert((offset === 0 || isWebGL2(gl)), 'offset supported in WebGL2 only'); gl.texImage2D(target, level, format, width, height, border, dataFormat, type, data, offset); break; case 'buffer': // WebGL2 enables creating textures directly from a WebGL buffer __WEBPACK_IMPORTED_MODULE_7_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["b" /* isWebGL2 */])(gl), __WEBPACK_IMPORTED_MODULE_2__context__["i" /* ERR_WEBGL2 */]); gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].PIXEL_UNPACK_BUFFER, data.handle || data); gl.texImage2D(target, level, format, width, height, border, format, type, offset); break; case 'browser-object': gl.texImage2D(target, level, format, format, type, data); break; case 'compressed': gl.compressedTexImage2D(_this3.target, level, format, width, height, border, data); break; default: __WEBPACK_IMPORTED_MODULE_7_assert___default()(false, 'Unknown image data type'); } }); } /* eslint-enable max-len, max-statements, complexity */ /** * Redefines an area of an existing texture * Note: does not allocate storage */ /* * Redefines an area of an existing texture * @param {*} pixels, data - * null - create empty texture of specified format * Typed array - init from image data in typed array * Buffer|WebGLBuffer - (WEBGL2) init from image data in WebGLBuffer * HTMLImageElement|Image - Inits with content of image. Auto width/height * HTMLCanvasElement - Inits with contents of canvas. Auto width/height * HTMLVideoElement - Creates video texture. Auto width/height * * @param {GLint} x - xOffset from where texture to be updated * @param {GLint} y - yOffset from where texture to be updated * @param {GLint} width - width of the sub image to be updated * @param {GLint} height - height of the sub image to be updated * @param {GLint} level - mip level to be updated * @param {GLenum} format - internal format of image data. * @param {GLenum} type * - format of array (autodetect from type) or * - (WEBGL2) format of buffer or ArrayBufferView * @param {GLenum} dataFormat - format of image data. * @param {Number} offset - (WEBGL2) offset from start of buffer * @param {GLint} border - must be 0. * @parameters - temporary settings to be applied, can be used to supply pixel store settings. */ }, { key: 'setSubImageData', value: function setSubImageData(_ref4) { var _this4 = this; var _ref4$target = _ref4.target, target = _ref4$target === undefined ? this.target : _ref4$target, _ref4$pixels = _ref4.pixels, pixels = _ref4$pixels === undefined ? null : _ref4$pixels, _ref4$data = _ref4.data, data = _ref4$data === undefined ? null : _ref4$data, _ref4$x = _ref4.x, x = _ref4$x === undefined ? 0 : _ref4$x, _ref4$y = _ref4.y, y = _ref4$y === undefined ? 0 : _ref4$y, width = _ref4.width, height = _ref4.height, _ref4$level = _ref4.level, level = _ref4$level === undefined ? 0 : _ref4$level, _ref4$format = _ref4.format, format = _ref4$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA : _ref4$format, type = _ref4.type, dataFormat = _ref4.dataFormat, _ref4$compressed = _ref4.compressed, compressed = _ref4$compressed === undefined ? false : _ref4$compressed, _ref4$offset = _ref4.offset, offset = _ref4$offset === undefined ? 0 : _ref4$offset, _ref4$border = _ref4.border, border = _ref4$border === undefined ? 0 : _ref4$border, _ref4$parameters = _ref4.parameters, parameters = _ref4$parameters === undefined ? {} : _ref4$parameters; // pixels variable is for API compatibility purpose var _deduceParameters4 = this._deduceParameters({ format: format, type: type, dataFormat: dataFormat, compressed: compressed, data: data, width: width, height: height }); type = _deduceParameters4.type; dataFormat = _deduceParameters4.dataFormat; compressed = _deduceParameters4.compressed; width = _deduceParameters4.width; height = _deduceParameters4.height; if (!data) { data = pixels; } // Support ndarrays if (data && data.data) { var ndarray = data; data = ndarray.data; width = ndarray.shape[0]; height = ndarray.shape[1]; } // Support buffers if (data instanceof __WEBPACK_IMPORTED_MODULE_5__buffer__["a" /* default */]) { data = data.handle; } this.gl.bindTexture(this.target, this.handle); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__context_state__["f" /* withParameters */])(this.gl, parameters, function () { // TODO - x,y parameters if (compressed) { _this4.gl.compressedTexSubImage2D(target, level, x, y, width, height, format, data); } else if (data === null) { _this4.gl.texSubImage2D(target, level, format, width, height, border, dataFormat, type, null); } else if (ArrayBuffer.isView(data)) { _this4.gl.texSubImage2D(target, level, x, y, width, height, format, type, data, offset); } else if (data instanceof __WEBPACK_IMPORTED_MODULE_1__api__["e" /* WebGLBuffer */]) { // WebGL2 allows us to create texture directly from a WebGL buffer __WEBPACK_IMPORTED_MODULE_7_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["b" /* isWebGL2 */])(_this4.gl), __WEBPACK_IMPORTED_MODULE_2__context__["i" /* ERR_WEBGL2 */]); // This texImage2D signature uses currently bound GL_PIXEL_UNPACK_BUFFER _this4.gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].PIXEL_UNPACK_BUFFER, data); _this4.gl.texSubImage2D(target, level, format, width, height, border, format, type, offset); _this4.gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].GL_PIXEL_UNPACK_BUFFER, null); } else { // Assume data is a browser supported object (ImageData, Canvas, ...) _this4.gl.texSubImage2D(target, level, x, y, format, type, data); } }); this.gl.bindTexture(this.target, null); } /* eslint-enable max-len, max-statements, complexity */ /** * Defines a two-dimensional texture image or cube-map texture image with * pixels from the current framebuffer (rather than from client memory). * (gl.copyTexImage2D wrapper) * * Note that binding a texture into a Framebuffer's color buffer and * rendering can be faster. */ }, { key: 'copyFramebuffer', value: function copyFramebuffer(_ref5) { var _ref5$target = _ref5.target, target = _ref5$target === undefined ? this.target : _ref5$target, framebuffer = _ref5.framebuffer, _ref5$offset = _ref5.offset, offset = _ref5$offset === undefined ? 0 : _ref5$offset, _ref5$x = _ref5.x, x = _ref5$x === undefined ? 0 : _ref5$x, _ref5$y = _ref5.y, y = _ref5$y === undefined ? 0 : _ref5$y, width = _ref5.width, height = _ref5.height, _ref5$level = _ref5.level, level = _ref5$level === undefined ? 0 : _ref5$level, _ref5$internalFormat = _ref5.internalFormat, internalFormat = _ref5$internalFormat === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA : _ref5$internalFormat, _ref5$border = _ref5.border, border = _ref5$border === undefined ? 0 : _ref5$border; if (framebuffer) { framebuffer.bind(); } // target this.bind(); this.gl.copyTexImage2D(this.target, level, internalFormat, x, y, width, height, border); this.unbind(); if (framebuffer) { framebuffer.unbind(); } } }, { key: 'getActiveUnit', value: function getActiveUnit() { return this.gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].ACTIVE_TEXTURE) - __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE0; } // target cannot be modified by bind: // textures are special because when you first bind them to a target, // they get special information. When you first bind a texture as a // GL_TEXTURE_2D, you are actually setting special state in the texture. // You are saying that this texture is a 2D texture. // And it will always be a 2D texture; this state cannot be changed ever. // If you have a texture that was first bound as a GL_TEXTURE_2D, // you must always bind it as a GL_TEXTURE_2D; // attempting to bind it as GL_TEXTURE_1D will give rise to an error // (while run-time). }, { key: 'bind', value: function bind() { var textureUnit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.textureUnit; if (textureUnit === undefined) { throw new Error('Texture.bind: must specify texture unit'); } this.textureUnit = textureUnit; this.gl.activeTexture(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE0 + textureUnit); this.gl.bindTexture(this.target, this.handle); return textureUnit; } }, { key: 'unbind', value: function unbind() { if (this.textureUnit === undefined) { throw new Error('Texture.unbind: texture unit not specified'); } this.gl.activeTexture(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE0 + this.textureUnit); this.gl.bindTexture(this.target, null); return this.textureUnit; } // PRIVATE METHODS }, { key: '_getDataType', value: function _getDataType(_ref6) { var data = _ref6.data, _ref6$compressed = _ref6.compressed, compressed = _ref6$compressed === undefined ? false : _ref6$compressed; if (compressed) { return { data: data, dataType: 'compressed' }; } if (data === null) { return { data: data, dataType: 'null' }; } if (ArrayBuffer.isView(data)) { return { data: data, dataType: 'typed-array' }; } if (data instanceof __WEBPACK_IMPORTED_MODULE_5__buffer__["a" /* default */]) { return { data: data.handle, dataType: 'buffer' }; } if (data instanceof __WEBPACK_IMPORTED_MODULE_1__api__["e" /* WebGLBuffer */]) { return { data: data, dataType: 'buffer' }; } // Assume data is a browser supported object (ImageData, Canvas, ...) return { data: data, dataType: 'browser-object' }; } // Image 3D copies from Typed Array or WebGLBuffer }, { key: 'setImage3D', value: function setImage3D(_ref7) { var _ref7$level = _ref7.level, level = _ref7$level === undefined ? 0 : _ref7$level, _ref7$internalformat = _ref7.internalformat, internalformat = _ref7$internalformat === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA : _ref7$internalformat, width = _ref7.width, height = _ref7.height, _ref7$depth = _ref7.depth, depth = _ref7$depth === undefined ? 1 : _ref7$depth, _ref7$border = _ref7.border, border = _ref7$border === undefined ? 0 : _ref7$border, format = _ref7.format, _ref7$type = _ref7.type, type = _ref7$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_BYTE : _ref7$type, _ref7$offset = _ref7.offset, offset = _ref7$offset === undefined ? 0 : _ref7$offset, pixels = _ref7.pixels; if (ArrayBuffer.isView(pixels)) { this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, pixels); return this; } if (pixels instanceof __WEBPACK_IMPORTED_MODULE_5__buffer__["a" /* default */]) { this.gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].PIXEL_UNPACK_BUFFER, pixels.handle); this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, offset); } return this; } /* Copied from texture-2d.js // WebGL2 setPixels(opts = {}) { const { buffer, width = null, height = null, mipmapLevel = 0, format = GL.RGBA, type = GL.UNSIGNED_BYTE, border = 0 } = opts; const {gl} = this; // This signature of texImage2D uses currently bound GL_PIXEL_UNPACK_BUFFER gl.bindBuffer(GL.PIXEL_UNPACK_BUFFER, buffer.target); // And as always, we must also bind the texture itself this.bind(); gl.texImage2D(gl.TEXTURE_2D, mipmapLevel, format, width, height, border, format, type, buffer.target); this.unbind(); gl.bindBuffer(GL.GL_PIXEL_UNPACK_BUFFER, null); return this; } setImageDataFromCompressedBuffer(opts) { const { buffer, // offset = 0, width = null, height = null, mipmapLevel = 0, internalFormat = GL.RGBA, // format = GL.RGBA, // type = GL.UNSIGNED_BYTE, border = 0 } = opts; const {gl} = this; gl.compressedTexImage2D(this.target, mipmapLevel, internalFormat, width, height, border, buffer); // gl.compressedTexSubImage2D(target, // level, xoffset, yoffset, width, height, format, ArrayBufferView? pixels); return this; } copySubImage(opts) { const { // pixels, // offset = 0, // x, // y, // width, // height, // mipmapLevel = 0, // internalFormat = GL.RGBA, // type = GL.UNSIGNED_BYTE, // border = 0 } = opts; // if (pixels instanceof ArrayBufferView) { // gl.texSubImage2D(target, level, x, y, width, height, format, type, pixels); // } // gl.texSubImage2D(target, level, x, y, format, type, ? pixels); // gl.texSubImage2D(target, level, x, y, format, type, HTMLImageElement pixels); // gl.texSubImage2D(target, level, x, y, format, type, HTMLCanvasElement pixels); // gl.texSubImage2D(target, level, x, y, format, type, HTMLVideoElement pixels); // // Additional signature in a WebGL 2 context: // gl.texSubImage2D(target, level, x, y, format, type, GLintptr offset); } */ // HELPER METHODS }, { key: '_deduceParameters', value: function _deduceParameters(opts) { var format = opts.format, data = opts.data; var width = opts.width, height = opts.height, dataFormat = opts.dataFormat, type = opts.type, compressed = opts.compressed; // Deduce format and type from format var textureFormat = TEXTURE_FORMATS[format]; dataFormat = dataFormat || textureFormat && textureFormat.dataFormat; type = type || textureFormat && textureFormat.types[0]; // Deduce compression from format compressed = compressed || textureFormat && textureFormat.compressed; var _deduceImageSize2 = this._deduceImageSize({ data: data, width: width, height: height }); width = _deduceImageSize2.width; height = _deduceImageSize2.height; return { dataFormat: dataFormat, type: type, compressed: compressed, width: width, height: height, format: format, data: data }; } /* global ImageData, HTMLImageElement, HTMLCanvasElement, HTMLVideoElement */ }, { key: '_deduceImageSize', value: function _deduceImageSize(_ref8) { var data = _ref8.data, width = _ref8.width, height = _ref8.height; var size = void 0; if (typeof ImageData !== 'undefined' && data instanceof ImageData) { size = { width: data.width, height: data.height }; } else if (typeof HTMLImageElement !== 'undefined' && data instanceof HTMLImageElement) { size = { width: data.naturalWidth, height: data.naturalHeight }; } else if (typeof HTMLCanvasElement !== 'undefined' && data instanceof HTMLCanvasElement) { size = { width: data.width, height: data.height }; } else if (typeof HTMLVideoElement !== 'undefined' && data instanceof HTMLVideoElement) { size = { width: data.videoWidth, height: data.videoHeight }; } else if (!data) { size = { width: width >= 0 ? width : 1, height: height >= 0 ? height : 1 }; } else { size = { width: width, height: height }; } __WEBPACK_IMPORTED_MODULE_7_assert___default()(size, 'Could not deduced texture size'); __WEBPACK_IMPORTED_MODULE_7_assert___default()(width === undefined || size.width === width, 'Deduced texture width does not match supplied width'); __WEBPACK_IMPORTED_MODULE_7_assert___default()(height === undefined || size.height === height, 'Deduced texture height does not match supplied height'); return size; } // RESOURCE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.createTexture(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteTexture(this.handle); } }, { key: '_getParameter', value: function _getParameter(pname) { switch (pname) { case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_WIDTH: return this.width; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_HEIGHT: return this.height; default: this.gl.bindTexture(this.target, this.handle); var value = this.gl.getTexParameter(this.target, pname); this.gl.bindTexture(this.target, null); return value; } } }, { key: '_setParameter', value: function _setParameter(pname, param) { this.gl.bindTexture(this.target, this.handle); // NOTE: Apply NPOT workaround param = this._getNPOTParam(pname, param); // Apparently there are some integer/float conversion rules that made // the WebGL committe expose two parameter setting functions in JavaScript. // For now, pick the float version for parameters specified as GLfloat. switch (pname) { case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_MIN_LOD: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_MAX_LOD: this.gl.texParameterf(this.handle, pname, param); break; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_WIDTH: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_HEIGHT: throw new Error('Cannot set emulated parameter'); default: this.gl.texParameteri(this.target, pname, param); break; } this.gl.bindTexture(this.target, null); return this; } }, { key: '_isNPOT', value: function _isNPOT() { return !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["b" /* isWebGL2 */])(this.gl) && (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__utils__["e" /* isPowerOfTwo */])(this.width) || !__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__utils__["e" /* isPowerOfTwo */])(this.height)); } // Update default settings which are not supported by NPOT textures. }, { key: '_updateForNPOT', value: function _updateForNPOT(parameters) { if (parameters[this.gl.TEXTURE_MIN_FILTER] === undefined) { __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].warn('texture: ' + this + ' is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR'); parameters[this.gl.TEXTURE_MIN_FILTER] = this.gl.LINEAR; } if (parameters[this.gl.TEXTURE_WRAP_S] === undefined) { __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].warn('texture: ' + this + ' is Non-Power-Of-Two, forcing TEXTURE_WRAP_S to CLAMP_TO_EDGE'); parameters[this.gl.TEXTURE_WRAP_S] = this.gl.CLAMP_TO_EDGE; } if (parameters[this.gl.TEXTURE_WRAP_T] === undefined) { __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].warn('texture: ' + this + ' is Non-Power-Of-Two, forcing TEXTURE_WRAP_T to CLAMP_TO_EDGE'); parameters[this.gl.TEXTURE_WRAP_T] = this.gl.CLAMP_TO_EDGE; } } }, { key: '_getNPOTParam', value: function _getNPOTParam(pname, param) { if (this._isNPOT()) { switch (pname) { case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_MIN_FILTER: if (NPOT_MIN_FILTERS.indexOf(param) === -1) { __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].warn('texture: ' + this + ' is Non-Power-Of-Two, forcing TEXTURE_MIN_FILTER to LINEAR'); param = __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINEAR; } break; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_WRAP_S: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TEXTURE_WRAP_T: if (param !== __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].CLAMP_TO_EDGE) { __WEBPACK_IMPORTED_MODULE_6__utils__["b" /* log */].warn('texture: ' + this + ' is Non-Power-Of-Two, ' + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["c" /* glKey */])(pname) + ' to CLAMP_TO_EDGE'); param = __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].CLAMP_TO_EDGE; } break; default: break; } } return param; } }]); return Texture; }(__WEBPACK_IMPORTED_MODULE_4__resource__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Texture); //# sourceMappingURL=texture.js.map /***/ }), /* 63 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { var def = __webpack_require__(10).f; var has = __webpack_require__(18); var TAG = __webpack_require__(6)('toStringTag'); module.exports = function (it, tag, stat) { if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag }); }; /***/ }), /* 65 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var defined = __webpack_require__(34); var fails = __webpack_require__(4); var spaces = __webpack_require__(148); var space = '[' + spaces + ']'; var non = '\u200b\u0085'; var ltrim = RegExp('^' + space + space + '*'); var rtrim = RegExp(space + space + '*$'); var exporter = function (KEY, exec, ALIAS) { var exp = {}; var FORCE = fails(function () { return !!spaces[KEY]() || non[KEY]() != non; }); var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY]; if (ALIAS) exp[ALIAS] = fn; $export($export.P + $export.F * FORCE, 'String', exp); }; // 1 -> String#trimLeft // 2 -> String#trimRight // 3 -> String#trim var trim = exporter.trim = function (string, TYPE) { string = String(defined(string)); if (TYPE & 1) string = string.replace(ltrim, ''); if (TYPE & 2) string = string.replace(rtrim, ''); return string; }; module.exports = exporter; /***/ }), /* 66 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(5); module.exports = function (it, TYPE) { if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!'); return it; }; /***/ }), /* 67 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export BufferLayout */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_typed_array_utils__ = __webpack_require__(163); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ERR_BUFFER_PARAMS = 'Illegal or missing parameter to Buffer'; var GL_COPY_READ_BUFFER = 0x8F36; var GL_COPY_WRITE_BUFFER = 0x8F37; var GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; var BufferLayout = /*#__PURE__*/ /** * @classdesc * Store characteristics of a data layout * This data can be used when updating vertex attributes with * the associated buffer, freeing the application from keeping * track of this metadata. * * @class * @param {GLuint} size - number of values per element (1-4) * @param {GLuint} type - type of values (e.g. gl.FLOAT) * @param {GLbool} normalized=false - normalize integers to [-1,1] or [0,1] * @param {GLuint} integer=false - WebGL2 only, int-to-float conversion * @param {GLuint} stride=0 - supports strided arrays * @param {GLuint} offset=0 - supports strided arrays */ function BufferLayout() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, type = _ref.type, _ref$size = _ref.size, size = _ref$size === undefined ? 1 : _ref$size, _ref$offset = _ref.offset, offset = _ref$offset === undefined ? 0 : _ref$offset, _ref$stride = _ref.stride, stride = _ref$stride === undefined ? 0 : _ref$stride, _ref$normalized = _ref.normalized, normalized = _ref$normalized === undefined ? false : _ref$normalized, _ref$integer = _ref.integer, integer = _ref$integer === undefined ? false : _ref$integer, _ref$instanced = _ref.instanced, instanced = _ref$instanced === undefined ? 0 : _ref$instanced; _classCallCheck(this, BufferLayout); this.type = type; this.size = size; this.offset = offset; this.stride = stride; this.normalized = normalized; this.integer = integer; this.instanced = instanced; }; var Buffer = /*#__PURE__*/function (_Resource) { _inherits(Buffer, _Resource); function Buffer(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Buffer); // In WebGL1, we need to make sure we use GL.ELEMENT_ARRAY_BUFFER when // initializing element buffers, otherwise the buffer type will be locked // to a generic (non-element) buffer. // In WebGL2, we can use GL_COPY_READ_BUFFER which avoids locking the type here var _this = _possibleConstructorReturn(this, (Buffer.__proto__ || Object.getPrototypeOf(Buffer)).call(this, gl, opts)); _this.target = opts.target || (_this.gl.webgl2 ? GL_COPY_READ_BUFFER : __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ARRAY_BUFFER); _this.index = null; _this.setData(opts); Object.seal(_this); return _this; } // Stores the layout of data with the buffer, makes it easy to e.g. set it as an attribute later _createClass(Buffer, [{ key: 'setDataLayout', value: function setDataLayout(_ref2) { var layout = _ref2.layout, type = _ref2.type, _ref2$size = _ref2.size, size = _ref2$size === undefined ? 1 : _ref2$size, _ref2$offset = _ref2.offset, offset = _ref2$offset === undefined ? 0 : _ref2$offset, _ref2$stride = _ref2.stride, stride = _ref2$stride === undefined ? 0 : _ref2$stride, _ref2$normalized = _ref2.normalized, normalized = _ref2$normalized === undefined ? false : _ref2$normalized, _ref2$integer = _ref2.integer, integer = _ref2$integer === undefined ? false : _ref2$integer, _ref2$instanced = _ref2.instanced, instanced = _ref2$instanced === undefined ? 0 : _ref2$instanced; this.layout = layout || new BufferLayout({ type: type || this.type, // Use autodeduced type if available size: size, offset: offset, stride: stride, normalized: normalized, integer: integer, instanced: instanced }); return this; } // Creates and initializes the buffer object's data store. }, { key: 'initialize', value: function initialize() { var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, data = _ref3.data, bytes = _ref3.bytes, _ref3$usage = _ref3.usage, usage = _ref3$usage === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].STATIC_DRAW : _ref3$usage, layout = _ref3.layout, type = _ref3.type, _ref3$size = _ref3.size, size = _ref3$size === undefined ? 1 : _ref3$size, _ref3$offset = _ref3.offset, offset = _ref3$offset === undefined ? 0 : _ref3$offset, _ref3$stride = _ref3.stride, stride = _ref3$stride === undefined ? 0 : _ref3$stride, _ref3$normalized = _ref3.normalized, normalized = _ref3$normalized === undefined ? false : _ref3$normalized, _ref3$integer = _ref3.integer, integer = _ref3$integer === undefined ? false : _ref3$integer, _ref3$instanced = _ref3.instanced, instanced = _ref3$instanced === undefined ? 0 : _ref3$instanced; var opts = arguments[0]; if (!data) { type = type || __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FLOAT; // Workaround needed for Safari (#291): // gl.bufferData with size (second argument) equal to 0 crashes. // hence create zero sized array. if (!bytes || bytes === 0) { bytes = 0; data = new Float32Array(0); } } else { type = type || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils_typed_array_utils__["b" /* getGLTypeFromTypedArray */])(data); bytes = data.byteLength; __WEBPACK_IMPORTED_MODULE_4_assert___default()(type, ERR_BUFFER_PARAMS); } this.bytes = bytes; this.bytesUsed = bytes; this.data = data; this.type = type; this.usage = usage; // Call after type is set this.setDataLayout(Object.assign(opts)); // Create the buffer - binding it here for the first time locks the type // In WebGL2, use GL_COPY_WRITE_BUFFER to avoid locking the type var target = this.gl.webgl2 ? GL_COPY_WRITE_BUFFER : this.target; this.gl.bindBuffer(target, this.handle); this.gl.bufferData(target, data || bytes, usage); this.gl.bindBuffer(target, null); return this; } // DEPRECATED - Can we change to call `subData`? }, { key: 'setData', value: function setData(options) { return this.initialize(options); } // Updates a subset of a buffer object's data store. }, { key: 'subData', value: function subData() { var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, data = _ref4.data, _ref4$offset = _ref4.offset, offset = _ref4$offset === undefined ? 0 : _ref4$offset, _ref4$srcOffset = _ref4.srcOffset, srcOffset = _ref4$srcOffset === undefined ? 0 : _ref4$srcOffset, length = _ref4.length; __WEBPACK_IMPORTED_MODULE_4_assert___default()(data, ERR_BUFFER_PARAMS); // Create the buffer - binding it here for the first time locks the type // In WebGL2, use GL_COPY_WRITE_BUFFER to avoid locking the type var target = this.gl.webgl2 ? GL_COPY_WRITE_BUFFER : this.target; this.gl.bindBuffer(target, this.handle); // WebGL2: subData supports additional srcOffset and length parameters if (srcOffset !== 0 || length !== undefined) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); this.gl.bufferSubData(this.target, offset, data, srcOffset, length || 0); } else { this.gl.bufferSubData(target, offset, data); } this.gl.bindBuffer(target, null); return this; } // WEBGL2 ONLY: Copies part of the data of another buffer into this buffer }, { key: 'copyData', value: function copyData(_ref5) { var sourceBuffer = _ref5.sourceBuffer, _ref5$readOffset = _ref5.readOffset, readOffset = _ref5$readOffset === undefined ? 0 : _ref5$readOffset, _ref5$writeOffset = _ref5.writeOffset, writeOffset = _ref5$writeOffset === undefined ? 0 : _ref5$writeOffset, size = _ref5.size; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); // Use GL_COPY_READ_BUFFER+GL_COPY_WRITE_BUFFER avoid disturbing other targets and locking type this.gl.bindBuffer(GL_COPY_READ_BUFFER, sourceBuffer.handle); this.gl.bindBuffer(GL_COPY_WRITE_BUFFER, this.handle); this.gl.copyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, readOffset, writeOffset, size); this.gl.bindBuffer(GL_COPY_READ_BUFFER, null); this.gl.bindBuffer(GL_COPY_WRITE_BUFFER, null); return this; } // WEBGL2 ONLY: Reads data from buffer into an ArrayBufferView or SharedArrayBuffer. }, { key: 'getData', value: function getData() { var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref6$dstData = _ref6.dstData, dstData = _ref6$dstData === undefined ? null : _ref6$dstData, _ref6$srcByteOffset = _ref6.srcByteOffset, srcByteOffset = _ref6$srcByteOffset === undefined ? 0 : _ref6$srcByteOffset, _ref6$dstOffset = _ref6.dstOffset, dstOffset = _ref6$dstOffset === undefined ? 0 : _ref6$dstOffset, _ref6$length = _ref6.length, length = _ref6$length === undefined ? 0 : _ref6$length; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); var ArrayType = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils_typed_array_utils__["a" /* getTypedArrayFromGLType */])(this.type, { clamped: false }); var sourceAvailableElementCount = this._getAvailableElementCount(srcByteOffset); var dstAvailableElementCount = void 0; var dstElementCount = void 0; var dstElementOffset = dstOffset; if (dstData) { dstElementCount = dstData.length; dstAvailableElementCount = dstElementCount - dstElementOffset; } else { // Allocate ArrayBufferView with enough size to copy all eligible data. dstAvailableElementCount = Math.min(sourceAvailableElementCount, length || sourceAvailableElementCount); dstElementCount = dstElementOffset + dstAvailableElementCount; } var copyElementCount = Math.min(sourceAvailableElementCount, dstAvailableElementCount); length = length || copyElementCount; __WEBPACK_IMPORTED_MODULE_4_assert___default()(length <= copyElementCount, 'Invalid srcByteOffset, dstOffset and length combination'); dstData = dstData || new ArrayType(dstElementCount); // Use GL_COPY_READ_BUFFER to avoid disturbing other targets and locking type this.gl.bindBuffer(GL_COPY_READ_BUFFER, this.handle); this.gl.getBufferSubData(GL_COPY_READ_BUFFER, srcByteOffset, dstData, dstOffset, length); this.gl.bindBuffer(GL_COPY_READ_BUFFER, null); return dstData; } /** * Binds a buffer to a given binding point (target). * GL_TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER take an index, and optionally a range. * * @param {Glenum} target - target for the bind operation. * * @param {GLuint} index= - the index of the target. * - GL_TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER need an index to affect state * @param {GLuint} offset=0 - the index of the target. * - GL.UNIFORM_BUFFER: `offset` must be aligned to GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT. * @param {GLuint} size= - the index of the target. * - GL.UNIFORM_BUFFER: `size` must be a minimum of GL.UNIFORM_BLOCK_SIZE_DATA. * @returns {Buffer} - Returns itself for chaining. */ }, { key: 'bind', value: function bind() { var _ref7 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref7$target = _ref7.target, target = _ref7$target === undefined ? this.target : _ref7$target, _ref7$index = _ref7.index, index = _ref7$index === undefined ? this.index : _ref7$index, _ref7$offset = _ref7.offset, offset = _ref7$offset === undefined ? 0 : _ref7$offset, size = _ref7.size; // NOTE: While GL_TRANSFORM_FEEDBACK_BUFFER and GL.UNIFORM_BUFFER could // be used as direct binding points, they will not affect transform feedback or // uniform buffer state. Instead indexed bindings need to be made. var type = target === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNIFORM_BUFFER || target === GL_TRANSFORM_FEEDBACK_BUFFER ? size !== undefined ? 'ranged' : ' indexed' : 'non-indexed'; switch (type) { case 'non-indexed': this.gl.bindBuffer(target, this.handle); break; case 'indexed': __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); __WEBPACK_IMPORTED_MODULE_4_assert___default()(offset === 0, ERR_BUFFER_PARAMS); // Make sure offset wasn't supplied this.gl.bindBufferBase(target, index, this.handle); break; case 'ranged': __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); this.gl.bindBufferRange(target, index, this.handle, offset, size); break; default: throw new Error(ERR_BUFFER_PARAMS); } return this; } }, { key: 'unbind', value: function unbind() { var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref8$target = _ref8.target, target = _ref8$target === undefined ? this.target : _ref8$target, _ref8$index = _ref8.index, index = _ref8$index === undefined ? this.index : _ref8$index; var isIndexedBuffer = target === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNIFORM_BUFFER || target === GL_TRANSFORM_FEEDBACK_BUFFER; if (isIndexedBuffer) { this.gl.bindBufferBase(target, index, null); } else { this.gl.bindBuffer(target, null); } return this; } // TODO - is this the right place? // gl.TRANSFORM_FEEDBACK_BUFFER_BINDING: Returns a WebGLBuffer. // gl.TRANSFORM_FEEDBACK_BUFFER_SIZE: Returns a GLsizeiptr. // gl.TRANSFORM_FEEDBACK_BUFFER_START: Returns a GLintptr. // gl.UNIFORM_BUFFER_BINDING: Returns a WebGLBuffer. // gl.UNIFORM_BUFFER_SIZE: Returns a GLsizeiptr. // gl.UNIFORM_BUFFER_START: Returns a GLintptr. }, { key: 'getIndexedParameter', value: function getIndexedParameter(binding, index) { // Create the buffer - if binding it here for the first time, this locks the type // In WebGL2, use GL_COPY_READ_BUFFER to avoid locking the type var target = this.gl.webgl2 ? GL_COPY_READ_BUFFER : this.target; this.gl.bindBuffer(target, index); return this.gl.getIndexedParameter(binding, index); } // RESOURCE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.createBuffer(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteBuffer(this.handle); } }, { key: '_getParameter', value: function _getParameter(pname) { this.gl.bindBuffer(this.target, this.handle); var value = this.gl.getBufferParameter(this.target, pname); this.gl.bindBuffer(this.target, null); return value; } }, { key: '_getAvailableElementCount', value: function _getAvailableElementCount(srcByteOffset) { var ArrayType = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils_typed_array_utils__["a" /* getTypedArrayFromGLType */])(this.type, { clamped: false }); var sourceElementCount = this.bytes / ArrayType.BYTES_PER_ELEMENT; var sourceElementOffset = srcByteOffset / ArrayType.BYTES_PER_ELEMENT; return sourceElementCount - sourceElementOffset; } }]); return Buffer; }(__WEBPACK_IMPORTED_MODULE_3__resource__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Buffer); //# sourceMappingURL=buffer.js.map /***/ }), /* 68 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export LUMA_SETTERS */ /* harmony export (immutable) */ __webpack_exports__["e"] = setParameters; /* harmony export (immutable) */ __webpack_exports__["f"] = withParameters; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_utils_track_context_state__ = __webpack_require__(164); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__ = __webpack_require__(266); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__["f"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__["g"]; }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /* eslint-disable no-inline-comments, max-len */ // map of parameter setter function names, parameter constants, default values and types // - Uses gl function names, except when setter function exist that are named differently // - When the WebGL api offers and Separate (e.g. blendEquation and // blendEquationSeparate, we use non-separate name, but accept both non-separate and // separate arguments. Thus, a `getParameter` call will always return all the separate values // in an array, in a form that can be accepted by the setter. var LUMA_SETTERS = { framebuffer: function framebuffer(gl, _framebuffer) { var handle = _framebuffer && _framebuffer.handle ? _framebuffer.handle : _framebuffer; return gl.bindFramebuffer(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER, handle); }, blend: function blend(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BLEND) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BLEND); }, blendColor: function blendColor(gl, value) { return gl.blendColor.apply(gl, _toConsumableArray(value)); }, blendEquation: function blendEquation(gl, args) { args = isArray(args) ? args : [args, args]; gl.blendEquationSeparate.apply(gl, _toConsumableArray(args)); }, blendFunc: function blendFunc(gl, args) { args = isArray(args) && args.length === 2 ? [].concat(_toConsumableArray(args), _toConsumableArray(args)) : args; gl.blendFuncSeparate.apply(gl, _toConsumableArray(args)); }, clearColor: function clearColor(gl, value) { return gl.clearColor.apply(gl, _toConsumableArray(value)); }, clearDepth: function clearDepth(gl, value) { return gl.clearDepth(value); }, clearStencil: function clearStencil(gl, value) { return gl.clearStencil(value); }, colorMask: function colorMask(gl, value) { return gl.colorMask.apply(gl, _toConsumableArray(value)); }, cull: function cull(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].CULL_FACE) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].CULL_FACE); }, cullFace: function cullFace(gl, value) { return gl.cullFace(value); }, depthTest: function depthTest(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].DEPTH_TEST) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].DEPTH_TEST); }, depthFunc: function depthFunc(gl, value) { return gl.depthFunc(value); }, depthMask: function depthMask(gl, value) { return gl.depthMask(value); }, depthRange: function depthRange(gl, value) { return gl.depthRange.apply(gl, _toConsumableArray(value)); }, dither: function dither(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].DITHER) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].DITHER); }, derivativeHint: function derivativeHint(gl, value) { // gl1: 'OES_standard_derivatives' gl.hint(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAGMENT_SHADER_DERIVATIVE_HINT, value); }, frontFace: function frontFace(gl, value) { return gl.frontFace(value); }, mipmapHint: function mipmapHint(gl, value) { return gl.hint(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].GENERATE_MIPMAP_HINT, value); }, lineWidth: function lineWidth(gl, value) { return gl.lineWidth(value); }, polygonOffsetFill: function polygonOffsetFill(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].POLYGON_OFFSET_FILL) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].POLYGON_OFFSET_FILL); }, polygonOffset: function polygonOffset(gl, value) { return gl.polygonOffset.apply(gl, _toConsumableArray(value)); }, sampleCoverage: function sampleCoverage(gl, value) { return gl.sampleCoverage.apply(gl, _toConsumableArray(value)); }, scissorTest: function scissorTest(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].SCISSOR_TEST) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].SCISSOR_TEST); }, scissor: function scissor(gl, value) { return gl.scissor.apply(gl, _toConsumableArray(value)); }, stencilTest: function stencilTest(gl, value) { return value ? gl.enable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].STENCIL_TEST) : gl.disable(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].STENCIL_TEST); }, stencilMask: function stencilMask(gl, value) { value = isArray(value) ? value : [value, value]; var _value = value, _value2 = _slicedToArray(_value, 2), mask = _value2[0], backMask = _value2[1]; gl.stencilMaskSeparate(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRONT, mask); gl.stencilMaskSeparate(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BACK, backMask); }, stencilFunc: function stencilFunc(gl, args) { args = isArray(args) && args.length === 3 ? [].concat(_toConsumableArray(args), _toConsumableArray(args)) : args; var _args = args, _args2 = _slicedToArray(_args, 6), func = _args2[0], ref = _args2[1], mask = _args2[2], backFunc = _args2[3], backRef = _args2[4], backMask = _args2[5]; gl.stencilFuncSeparate(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRONT, func, ref, mask); gl.stencilFuncSeparate(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BACK, backFunc, backRef, backMask); }, stencilOp: function stencilOp(gl, args) { args = isArray(args) && args.length === 3 ? [].concat(_toConsumableArray(args), _toConsumableArray(args)) : args; var _args3 = args, _args4 = _slicedToArray(_args3, 6), sfail = _args4[0], dpfail = _args4[1], dppass = _args4[2], backSfail = _args4[3], backDpfail = _args4[4], backDppass = _args4[5]; gl.stencilOpSeparate(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRONT, sfail, dpfail, dppass); gl.stencilOpSeparate(__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BACK, backSfail, backDpfail, backDppass); }, viewport: function viewport(gl, value) { return gl.viewport.apply(gl, _toConsumableArray(value)); } }; // HELPERS function isArray(array) { return Array.isArray(array) || ArrayBuffer.isView(array); } // GETTERS AND SETTERS // Get the parameter value(s) from the context // from '../webgl-utils/set-parameters' // Get the parameters from the context // from '../webgl-utils/set-parameters' // Resets gl state to default values. // from '../webgl-utils/set-parameters' // Resets gl state to default values. // from '../webgl-utils/set-parameters' // Get a map of modified parameters // Note: "setParameters" is given extra treatment below // Set the parameter value(s) by key to the context // Sets value with key to context. // Value may be "normalized" (in case a short form is supported). In that case // the normalized value is retured. function setParameters(gl, parameters) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__webgl_utils_set_parameters__["c" /* setParameters */])(gl, parameters); for (var key in parameters) { var setter = LUMA_SETTERS[key]; if (setter) { setter(gl, parameters[key], key); } } } // VERY LIMITED / BASIC GL STATE MANAGEMENT // Executes a function with gl states temporarily set, exception safe // Currently support pixelStorage, scissor test and framebuffer binding function withParameters(gl, parameters, func) { // assertWebGLContext(gl); if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils__["f" /* isObjectEmpty */])(parameters)) { // Avoid setting state if no parameters provided. Just call and return return func(gl); } var _parameters$nocatch = parameters.nocatch, nocatch = _parameters$nocatch === undefined ? true : _parameters$nocatch; // frameBuffer not supported use framebuffer __WEBPACK_IMPORTED_MODULE_2_assert___default()(!parameters.frameBuffer); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_track_context_state__["b" /* pushContextState */])(gl); setParameters(gl, parameters); // Setup is done, call the function var value = void 0; if (nocatch) { // Avoid try catch to minimize stack size impact for safe execution paths value = func(gl); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_track_context_state__["c" /* popContextState */])(gl); } else { // Wrap in a try-catch to ensure that parameters are restored on exceptions try { value = func(gl); } finally { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils_track_context_state__["c" /* popContextState */])(gl); } } return value; } //# sourceMappingURL=context-state.js.map /***/ }), /* 69 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context_features__ = __webpack_require__(108); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__clear__ = __webpack_require__(107); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__texture_2d__ = __webpack_require__(167); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__renderbuffer__ = __webpack_require__(110); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__utils_typed_array_utils__ = __webpack_require__(163); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_assert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Local constants - will collapse during minification var GL_FRAMEBUFFER = 0x8D40; var GL_DRAW_FRAMEBUFFER = 0x8CA8; var GL_READ_FRAMEBUFFER = 0x8CA9; var GL_COLOR_ATTACHMENT0 = 0x8CE0; var GL_DEPTH_ATTACHMENT = 0x8D00; var GL_STENCIL_ATTACHMENT = 0x8D20; // const GL_DEPTH_STENCIL_ATTACHMENT = 0x821A; var GL_RENDERBUFFER = 0x8D41; var GL_TEXTURE_3D = 0x806F; var GL_TEXTURE_2D_ARRAY = 0x8C1A; var GL_TEXTURE_2D = 0x0DE1; var GL_TEXTURE_CUBE_MAP = 0x8513; var GL_TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515; var GL_DEPTH_BUFFER_BIT = 0x00000100; var GL_STENCIL_BUFFER_BIT = 0x00000400; var GL_COLOR_BUFFER_BIT = 0x00004000; var ERR_MULTIPLE_RENDERTARGETS = 'Multiple render targets not supported'; var Framebuffer = /*#__PURE__*/function (_Resource) { _inherits(Framebuffer, _Resource); _createClass(Framebuffer, [{ key: 'MAX_COLOR_ATTACHMENTS', get: function get() { return this.gl.getParameter(this.gl.MAX_COLOR_ATTACHMENTS); } }, { key: 'MAX_DRAW_BUFFERS', get: function get() { return this.gl.getParameter(this.gl.MAX_DRAW_BUFFERS); } }], [{ key: 'isSupported', value: function isSupported(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, colorBufferFloat = _ref.colorBufferFloat, colorBufferHalfFloat = _ref.colorBufferHalfFloat; var supported = true; supported = colorBufferFloat && gl.getExtension(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl) ? 'EXT_color_buffer_float' : 'WEBGL_color_buffer_float'); supported = colorBufferHalfFloat && gl.getExtension(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl) ? 'EXT_color_buffer_float' : 'EXT_color_buffer_half_float'); return supported; } // Create a Framebuffer wrapper for the default framebuffer (target === null) }, { key: 'getDefaultFramebuffer', value: function getDefaultFramebuffer(gl) { gl.luma = gl.luma || {}; if (!gl.luma.defaultFramebuffer) { gl.luma.defaultFramebuffer = new Framebuffer(gl, { handle: null, attachments: {} }); } // TODO - can we query for and get a handle to the GL.FRONT renderbuffer? return gl.luma.defaultFramebuffer; } }]); function Framebuffer(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Framebuffer); // Public members var _this = _possibleConstructorReturn(this, (Framebuffer.__proto__ || Object.getPrototypeOf(Framebuffer)).call(this, gl, opts)); _this.width = null; _this.height = null; _this.attachments = {}; _this.readBuffer = GL_COLOR_ATTACHMENT0; _this.drawBuffers = [GL_COLOR_ATTACHMENT0]; _this.initialize(opts); Object.seal(_this); return _this; } _createClass(Framebuffer, [{ key: 'initialize', value: function initialize(_ref2) { var _ref2$width = _ref2.width, width = _ref2$width === undefined ? 1 : _ref2$width, _ref2$height = _ref2.height, height = _ref2$height === undefined ? 1 : _ref2$height, _ref2$attachments = _ref2.attachments, attachments = _ref2$attachments === undefined ? null : _ref2$attachments, _ref2$color = _ref2.color, color = _ref2$color === undefined ? true : _ref2$color, _ref2$depth = _ref2.depth, depth = _ref2$depth === undefined ? true : _ref2$depth, _ref2$stencil = _ref2.stencil, stencil = _ref2$stencil === undefined ? false : _ref2$stencil, _ref2$check = _ref2.check, check = _ref2$check === undefined ? true : _ref2$check, readBuffer = _ref2.readBuffer, drawBuffers = _ref2.drawBuffers; __WEBPACK_IMPORTED_MODULE_9_assert___default()(width >= 0 && height >= 0, 'Width and height need to be integers'); // Store actual width and height for diffing this.width = width; this.height = height; // Resize any provided attachments - note that resize only resizes if needed // Note: A framebuffer has no separate size, it is defined by its attachments (which must agree) if (attachments) { for (var attachment in attachments) { var target = attachments[attachment]; var object = Array.isArray(target) ? target[0] : target; object.resize({ width: width, height: height }); } } else { // Create any requested default attachments attachments = this._createDefaultAttachments({ color: color, depth: depth, stencil: stencil, width: width, height: height }); } this.update({ clearAttachments: true, attachments: attachments, readBuffer: readBuffer, drawBuffers: drawBuffers }); // Checks that framebuffer was properly set up, if not, throws an explanatory error if (attachments && check) { this.checkStatus(); } } }, { key: 'update', value: function update(_ref3) { var _ref3$attachments = _ref3.attachments, attachments = _ref3$attachments === undefined ? {} : _ref3$attachments, readBuffer = _ref3.readBuffer, drawBuffers = _ref3.drawBuffers, _ref3$clearAttachment = _ref3.clearAttachments, clearAttachments = _ref3$clearAttachment === undefined ? false : _ref3$clearAttachment; this.attach(attachments, { clearAttachments: clearAttachments }); var gl = this.gl; // Multiple render target support, set read buffer and draw buffers var prevHandle = gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle); if (readBuffer) { this._setReadBuffer(readBuffer); } if (drawBuffers) { this._setDrawBuffers(drawBuffers); } gl.bindFramebuffer(GL_FRAMEBUFFER, prevHandle); return this; } // Attachment resize is expected to be a noop if size is same }, { key: 'resize', value: function resize() { var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, width = _ref4.width, height = _ref4.height; // for default framebuffer, just update the stored size if (this.handle === null) { __WEBPACK_IMPORTED_MODULE_9_assert___default()(width === undefined && height === undefined); this.width = this.gl.drawingBufferWidth; this.height = this.gl.drawingBufferHeight; return this; } if (width === undefined) { width = this.gl.drawingBufferWidth; } if (height === undefined) { height = this.gl.drawingBufferHeight; } if (width !== this.width && height !== this.height) { __WEBPACK_IMPORTED_MODULE_8__utils__["b" /* log */].log(2, 'Resizing framebuffer ' + this.id + ' to ' + width + 'x' + height); } for (var attachmentPoint in this.attachments) { this.attachments[attachmentPoint].resize({ width: width, height: height }); } this.width = width; this.height = height; return this; } // Attach from a map of attachments }, { key: 'attach', value: function attach(attachments) { var _this2 = this; var _ref5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref5$clearAttachment = _ref5.clearAttachments, clearAttachments = _ref5$clearAttachment === undefined ? false : _ref5$clearAttachment; var newAttachments = {}; // Any current attachments need to be removed, add null values to map if (clearAttachments) { Object.keys(this.attachments).forEach(function (key) { newAttachments[key] = null; }); } // Overlay the new attachments Object.assign(newAttachments, attachments); var prevHandle = this.gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle); // Walk the attachments for (var attachment in newAttachments) { // Ensure key is not undefined __WEBPACK_IMPORTED_MODULE_9_assert___default()(attachment !== 'undefined', 'Misspelled framebuffer binding point?'); var descriptor = newAttachments[attachment]; var object = descriptor; if (!object) { this._unattach({ attachment: attachment }); } else if (object instanceof __WEBPACK_IMPORTED_MODULE_6__renderbuffer__["a" /* default */]) { this._attachRenderbuffer({ attachment: attachment, renderbuffer: object }); } else if (Array.isArray(descriptor)) { var _descriptor = _slicedToArray(descriptor, 3), texture = _descriptor[0], _descriptor$ = _descriptor[1], layer = _descriptor$ === undefined ? 0 : _descriptor$, _descriptor$2 = _descriptor[2], level = _descriptor$2 === undefined ? 0 : _descriptor$2; object = texture; this._attachTexture({ attachment: attachment, texture: texture, layer: layer, level: level }); } else { this._attachTexture({ attachment: attachment, texture: object, layer: 0, level: 0 }); } // Resize objects if (object) { object.resize({ width: this.width, height: this.height }); } } this.gl.bindFramebuffer(GL_FRAMEBUFFER, prevHandle); // Assign to attachments and remove any nulls to get a clean attachment map Object.assign(this.attachments, attachments); Object.keys(this.attachments).filter(function (key) { return !_this2.attachments[key]; }).forEach(function (key) { delete _this2.attachments[key]; }); } }, { key: 'checkStatus', value: function checkStatus() { var gl = this.gl; var prevHandle = gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle); var status = gl.checkFramebufferStatus(GL_FRAMEBUFFER); gl.bindFramebuffer(GL_FRAMEBUFFER, prevHandle); if (status !== gl.FRAMEBUFFER_COMPLETE) { throw new Error(_getFrameBufferStatus(status)); } return this; } }, { key: 'clear', value: function clear() { var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, color = _ref6.color, depth = _ref6.depth, stencil = _ref6.stencil, _ref6$drawBuffers = _ref6.drawBuffers, drawBuffers = _ref6$drawBuffers === undefined ? [] : _ref6$drawBuffers; // Bind framebuffer and delegate to global clear functions var prevHandle = this.gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle); if (color || depth || stencil) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__clear__["a" /* clear */])(this.gl, { color: color, depth: depth, stencil: stencil }); } drawBuffers.forEach(function (value, drawBuffer) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__clear__["b" /* clearBuffer */])({ drawBuffer: drawBuffer, value: value }); }); this.gl.bindFramebuffer(GL_FRAMEBUFFER, prevHandle); return this; } // NOTE: Slow requires roundtrip to GPU // App can provide pixelArray or have it auto allocated by this method // @returns {Uint8Array|Uint16Array|FloatArray} - pixel array, // newly allocated by this method unless provided by app. }, { key: 'readPixels', value: function readPixels(_ref7) { var _ref7$x = _ref7.x, x = _ref7$x === undefined ? 0 : _ref7$x, _ref7$y = _ref7.y, y = _ref7$y === undefined ? 0 : _ref7$y, _ref7$width = _ref7.width, width = _ref7$width === undefined ? this.width : _ref7$width, _ref7$height = _ref7.height, height = _ref7$height === undefined ? this.height : _ref7$height, _ref7$format = _ref7.format, format = _ref7$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGBA : _ref7$format, type = _ref7.type, _ref7$pixelArray = _ref7.pixelArray, pixelArray = _ref7$pixelArray === undefined ? null : _ref7$pixelArray, _ref7$attachment = _ref7.attachment, attachment = _ref7$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref7$attachment; var gl = this.gl; // TODO - Set and unset gl.readBuffer if (attachment === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].COLOR_ATTACHMENT0 && this.handle === null) { attachment = __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRONT; } // Deduce type and allocated pixelArray if needed if (!pixelArray) { // Allocate pixel array if not already available, using supplied type type = type || gl.UNSIGNED_BYTE; var ArrayType = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__utils_typed_array_utils__["a" /* getTypedArrayFromGLType */])(type, { clamped: false }); var components = glFormatToComponents(format); // TODO - check for composite type (components = 1). pixelArray = pixelArray || new ArrayType(width * height * components); } // Pixel array available, if necessary, deduce type from it. type = type || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__utils_typed_array_utils__["b" /* getGLTypeFromTypedArray */])(pixelArray); var prevHandle = this.gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle); this.gl.readPixels(x, y, width, height, format, type, pixelArray); this.gl.bindFramebuffer(GL_FRAMEBUFFER, prevHandle); return pixelArray; } // Reads pixels as a dataUrl }, { key: 'copyToDataUrl', value: function copyToDataUrl() { var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref8$attachment = _ref8.attachment, attachment = _ref8$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref8$attachment, _ref8$maxHeight = _ref8.maxHeight, maxHeight = _ref8$maxHeight === undefined ? Number.MAX_SAFE_INTEGER : _ref8$maxHeight; var data = this.readPixels({ attachment: attachment }); // Scale down var width = this.width, height = this.height; while (height > maxHeight) { var _scalePixels = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__utils__["g" /* scalePixels */])({ data: data, width: width, height: height }); data = _scalePixels.data; width = _scalePixels.width; height = _scalePixels.height; } // Flip to top down coordinate system __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__utils__["h" /* flipRows */])({ data: data, width: width, height: height }); /* global document */ var canvas = document.createElement('canvas'); canvas.width = width; canvas.height = height; var context = canvas.getContext('2d'); // Copy the pixels to a 2D canvas var imageData = context.createImageData(width, height); imageData.data.set(data); context.putImageData(imageData, 0, 0); return canvas.toDataURL(); } // Reads pixels into an HTML Image }, { key: 'copyToImage', value: function copyToImage() { var _ref9 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref9$image = _ref9.image, image = _ref9$image === undefined ? null : _ref9$image, _ref9$attachment = _ref9.attachment, attachment = _ref9$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref9$attachment, _ref9$maxHeight = _ref9.maxHeight, maxHeight = _ref9$maxHeight === undefined ? Number.MAX_SAFE_INTEGER : _ref9$maxHeight; /* global Image */ var dataUrl = this.readDataUrl({ attachment: attachment }); image = image || new Image(); image.src = dataUrl; return image; } // copyToFramebuffer({width, height}) { // const scaleX = width / this.width; // const scaleY = height / this.height; // const scale = Math.min(scaleX, scaleY); // width = width * scale; // height = height * scale; // const scaledFramebuffer = new Framebuffer(this.gl, {width, height}); // this.blit(); // } // Copy a rectangle from a framebuffer attachment into a texture (at an offset) }, { key: 'copyToTexture', value: function copyToTexture(_ref10) { var texture = _ref10.texture, target = _ref10.target, _ref10$xoffset = _ref10.xoffset, xoffset = _ref10$xoffset === undefined ? 0 : _ref10$xoffset, _ref10$yoffset = _ref10.yoffset, yoffset = _ref10$yoffset === undefined ? 0 : _ref10$yoffset, _ref10$zoffset = _ref10.zoffset, zoffset = _ref10$zoffset === undefined ? 0 : _ref10$zoffset, _ref10$mipmapLevel = _ref10.mipmapLevel, mipmapLevel = _ref10$mipmapLevel === undefined ? 0 : _ref10$mipmapLevel, _ref10$attachment = _ref10.attachment, attachment = _ref10$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref10$attachment, _ref10$x = _ref10.x, x = _ref10$x === undefined ? 0 : _ref10$x, _ref10$y = _ref10.y, y = _ref10$y === undefined ? 0 : _ref10$y, width = _ref10.width, height = _ref10.height; var gl = this.gl; var prevHandle = gl.bindFramebuffer(GL_FRAMEBUFFER, this.handle); var prevBuffer = gl.readBuffer(attachment); width = Number.isFinite(width) ? width : texture.width; height = Number.isFinite(height) ? height : texture.height; // target switch (texture.target) { case GL_TEXTURE_2D: case GL_TEXTURE_CUBE_MAP: gl.copyTexSubImage2D(target || texture.target, mipmapLevel, xoffset, yoffset, x, y, width, height); break; case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_3D: gl.copyTexSubImage3D(target || texture.target, mipmapLevel, xoffset, yoffset, zoffset, x, y, width, height); break; default: } gl.readBuffer(prevBuffer); gl.bindFramebuffer(GL_FRAMEBUFFER, prevHandle); return texture; } // WEBGL2 INTERFACE // Copies a rectangle of pixels between framebuffers }, { key: 'blit', value: function blit(_ref11) { var srcFramebuffer = _ref11.srcFramebuffer, _ref11$attachment = _ref11.attachment, attachment = _ref11$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref11$attachment, _ref11$srcX = _ref11.srcX0, srcX0 = _ref11$srcX === undefined ? 0 : _ref11$srcX, _ref11$srcY = _ref11.srcY0, srcY0 = _ref11$srcY === undefined ? 0 : _ref11$srcY, srcX1 = _ref11.srcX1, srcY1 = _ref11.srcY1, _ref11$dstX = _ref11.dstX0, dstX0 = _ref11$dstX === undefined ? 0 : _ref11$dstX, _ref11$dstY = _ref11.dstY0, dstY0 = _ref11$dstY === undefined ? 0 : _ref11$dstY, dstX1 = _ref11.dstX1, dstY1 = _ref11.dstY1, _ref11$color = _ref11.color, color = _ref11$color === undefined ? true : _ref11$color, _ref11$depth = _ref11.depth, depth = _ref11$depth === undefined ? false : _ref11$depth, _ref11$stencil = _ref11.stencil, stencil = _ref11$stencil === undefined ? false : _ref11$stencil, _ref11$mask = _ref11.mask, mask = _ref11$mask === undefined ? 0 : _ref11$mask, _ref11$filter = _ref11.filter, filter = _ref11$filter === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].NEAREST : _ref11$filter; var gl = this.gl; __WEBPACK_IMPORTED_MODULE_9_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl), __WEBPACK_IMPORTED_MODULE_1__context__["i" /* ERR_WEBGL2 */]); if (!srcFramebuffer.handle && attachment === GL_COLOR_ATTACHMENT0) { attachment = __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRONT; } if (color) { mask |= GL_COLOR_BUFFER_BIT; } if (depth) { mask |= GL_DEPTH_BUFFER_BIT; } if (stencil) { mask |= GL_STENCIL_BUFFER_BIT; } __WEBPACK_IMPORTED_MODULE_9_assert___default()(mask); srcX1 = srcX1 === undefined ? srcFramebuffer.width : srcX1; srcY1 = srcY1 === undefined ? srcFramebuffer.height : srcY1; dstX1 = dstX1 === undefined ? this.width : dstX1; dstY1 = dstY1 === undefined ? this.height : dstY1; var prevDrawHandle = gl.bindFramebuffer(GL_DRAW_FRAMEBUFFER, this.handle); var prevReadHandle = gl.bindFramebuffer(GL_READ_FRAMEBUFFER, srcFramebuffer.handle); var prevReadBuffer = gl.readBuffer(attachment); gl.blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); gl.readBuffer(prevReadBuffer); gl.bindFramebuffer(GL_READ_FRAMEBUFFER, prevReadHandle); gl.bindFramebuffer(GL_DRAW_FRAMEBUFFER, prevDrawHandle); return this; } // signals to the GL that it need not preserve all pixels of a specified region // of the framebuffer }, { key: 'invalidate', value: function invalidate(_ref12) { var _ref12$attachments = _ref12.attachments, attachments = _ref12$attachments === undefined ? [] : _ref12$attachments, _ref12$x = _ref12.x, x = _ref12$x === undefined ? 0 : _ref12$x, _ref12$y = _ref12.y, y = _ref12$y === undefined ? 0 : _ref12$y, width = _ref12.width, height = _ref12.height; var gl = this.gl; __WEBPACK_IMPORTED_MODULE_9_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl, __WEBPACK_IMPORTED_MODULE_1__context__["i" /* ERR_WEBGL2 */])); var prevHandle = gl.bindFramebuffer(GL_READ_FRAMEBUFFER, this.handle); var invalidateAll = x === 0 && y === 0 && width === undefined && height === undefined; if (invalidateAll) { gl.invalidateFramebuffer(GL_READ_FRAMEBUFFER, attachments); } else { gl.invalidateFramebuffer(GL_READ_FRAMEBUFFER, attachments, x, y, width, height); } gl.bindFramebuffer(GL_READ_FRAMEBUFFER, prevHandle); return this; } // Return the value for `pname` of the specified attachment. // The type returned is the type of the requested pname }, { key: 'getAttachmentParameter', value: function getAttachmentParameter() { var _ref13 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref13$attachment = _ref13.attachment, attachment = _ref13$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref13$attachment, pname = _ref13.pname; var value = this._getAttachmentParameterFallback(pname); if (value === null) { this.gl.bindTexture(GL_FRAMEBUFFER, this.handle); value = this.gl.getFramebufferAttachmentParameter(GL_FRAMEBUFFER, attachment, pname); this.gl.bindTexture(GL_FRAMEBUFFER, null); } return value; } }, { key: 'getAttachmentParameters', value: function getAttachmentParameters() { var attachment = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : GL_COLOR_ATTACHMENT0; var parameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.constructor.ATTACHMENT_PARAMETERS || {}; var values = {}; for (var pname in parameters) { values[pname] = this.getAttachmentParameter(pname); } return this; } // DEBUG // Note: Will only work when called in an event handler }, { key: 'show', value: function show() { /* global window */ if (typeof window !== 'undefined') { window.open(this.copyToDataUrl(), 'luma-debug-texture'); } return this; } }, { key: 'log', value: function log() { var _ref14 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref14$priority = _ref14.priority, priority = _ref14$priority === undefined ? 0 : _ref14$priority, _ref14$message = _ref14.message, message = _ref14$message === undefined ? '' : _ref14$message; if (priority > __WEBPACK_IMPORTED_MODULE_8__utils__["b" /* log */].priority || typeof window === 'undefined') { return this; } message = message || 'Framebuffer ' + this.id; var image = this.copyToDataUrl({ maxHeight: 100 }); __WEBPACK_IMPORTED_MODULE_8__utils__["b" /* log */].image({ priority: priority, message: message, image: image }, message); return this; } // WEBGL INTERFACE }, { key: 'bind', value: function bind() { var _ref15 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref15$target = _ref15.target, target = _ref15$target === undefined ? GL_FRAMEBUFFER : _ref15$target; this.gl.bindFramebuffer(target, this.handle); return this; } }, { key: 'unbind', value: function unbind() { var _ref16 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref16$target = _ref16.target, target = _ref16$target === undefined ? GL_FRAMEBUFFER : _ref16$target; this.gl.bindFramebuffer(target, null); return this; } // PRIVATE METHODS }, { key: '_createDefaultAttachments', value: function _createDefaultAttachments(_ref17) { var color = _ref17.color, depth = _ref17.depth, stencil = _ref17.stencil, width = _ref17.width, height = _ref17.height; var defaultAttachments = null; // Add a color buffer if requested and not supplied if (color) { var _parameters; defaultAttachments = defaultAttachments || {}; defaultAttachments[GL_COLOR_ATTACHMENT0] = new __WEBPACK_IMPORTED_MODULE_5__texture_2d__["a" /* default */](this.gl, { pixels: null, // reserves texture memory, but texels are undefined format: __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGBA, type: __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNSIGNED_BYTE, width: width, height: height, // Note: Mipmapping can be disabled by texture resource when we resize the texture // to a non-power-of-two dimenstion (NPOT texture) under WebGL1. To have consistant // behavior we always disable mipmaps. mipmaps: false, // Set MIN and MAG filtering parameters so mipmaps are not used in sampling. // Set WRAP modes that support NPOT textures too. parameters: (_parameters = {}, _defineProperty(_parameters, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_MIN_FILTER, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].NEAREST), _defineProperty(_parameters, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_MAG_FILTER, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].NEAREST), _defineProperty(_parameters, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_WRAP_S, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].CLAMP_TO_EDGE), _defineProperty(_parameters, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_WRAP_T, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].CLAMP_TO_EDGE), _parameters) }); } // Add a depth buffer if requested and not supplied if (depth) { defaultAttachments = defaultAttachments || {}; defaultAttachments[GL_DEPTH_ATTACHMENT] = new __WEBPACK_IMPORTED_MODULE_6__renderbuffer__["a" /* default */](this.gl, { format: __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].DEPTH_COMPONENT16, width: width, height: height }); } // TODO - handle stencil and combined depth and stencil return defaultAttachments; } }, { key: '_unattach', value: function _unattach(_ref18) { var attachment = _ref18.attachment; this.gl.bindRenderbuffer(GL_RENDERBUFFER, this.handle); this.gl.framebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, null); delete this.attachments[attachment]; } }, { key: '_attachRenderbuffer', value: function _attachRenderbuffer(_ref19) { var _ref19$attachment = _ref19.attachment, attachment = _ref19$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref19$attachment, renderbuffer = _ref19.renderbuffer; var gl = this.gl; // TODO - is the bind needed? // gl.bindRenderbuffer(GL_RENDERBUFFER, renderbuffer.handle); gl.framebufferRenderbuffer(GL_FRAMEBUFFER, attachment, GL_RENDERBUFFER, renderbuffer.handle); // TODO - is the unbind needed? // gl.bindRenderbuffer(GL_RENDERBUFFER, null); this.attachments[attachment] = renderbuffer; } // layer = 0 - index into Texture2DArray and Texture3D or face for `TextureCubeMap` // level = 0 - mipmapLevel (must be 0 in WebGL1) }, { key: '_attachTexture', value: function _attachTexture(_ref20) { var _ref20$attachment = _ref20.attachment, attachment = _ref20$attachment === undefined ? GL_COLOR_ATTACHMENT0 : _ref20$attachment, texture = _ref20.texture, layer = _ref20.layer, level = _ref20.level; var gl = this.gl; gl.bindTexture(texture.target, texture.handle); switch (texture.target) { case GL_TEXTURE_2D_ARRAY: case GL_TEXTURE_3D: gl.framebufferTextureLayer(GL_FRAMEBUFFER, attachment, texture.target, level, layer); break; case GL_TEXTURE_CUBE_MAP: // layer must be a cubemap face (or if index, converted to cube map face) var face = mapIndexToCubeMapFace(layer); gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, face, texture.handle, level); break; case GL_TEXTURE_2D: gl.framebufferTexture2D(GL_FRAMEBUFFER, attachment, GL_TEXTURE_2D, texture.handle, level); break; default: __WEBPACK_IMPORTED_MODULE_9_assert___default()(false, 'Illegal texture type'); } gl.bindTexture(texture.target, null); this.attachments[attachment] = texture; } // Expects framebuffer to be bound }, { key: '_setReadBuffer', value: function _setReadBuffer(gl, readBuffer) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl)) { gl.readBuffer(readBuffer); } else { // Setting to color attachment 0 is a noop, so allow it in WebGL1 __WEBPACK_IMPORTED_MODULE_9_assert___default()(readBuffer === GL_COLOR_ATTACHMENT0 || readBuffer === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].BACK, ERR_MULTIPLE_RENDERTARGETS); } this.readBuffer = readBuffer; } // Expects framebuffer to be bound }, { key: '_setDrawBuffers', value: function _setDrawBuffers(gl, drawBuffers) { if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl)) { gl.drawBuffers(drawBuffers); } else { var ext = gl.getExtension('WEBGL_draw_buffers'); if (ext) { ext.drawBuffersWEBGL(drawBuffers); } else { // Setting a single draw buffer to color attachment 0 is a noop, allow in WebGL1 __WEBPACK_IMPORTED_MODULE_9_assert___default()(drawBuffers.length === 1 && (drawBuffers[0] === GL_COLOR_ATTACHMENT0 || drawBuffers[0] === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].BACK), ERR_MULTIPLE_RENDERTARGETS); } } this.drawBuffers = drawBuffers; } // Attempt to provide workable defaults for WebGL2 symbols under WebGL1 // null means OK to query /* eslint-disable complexity */ }, { key: '_getAttachmentParameterFallback', value: function _getAttachmentParameterFallback(pname) { var caps = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context_features__["d" /* getFeatures */])(this.gl); switch (pname) { case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: // GLint return !caps.webgl2 ? 0 : null; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_RED_SIZE: // GLint case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: // GLint case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: // GLint case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: // GLint case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: // GLint case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: // GLint return !caps.webgl2 ? 8 : null; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: // GLenum return !caps.webgl2 ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNSIGNED_INT : null; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: return !caps.webgl2 && !caps.EXT_sRGB ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].LINEAR : null; default: return null; } } /* eslint-enable complexity */ // RESOURCE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.createFramebuffer(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteFramebuffer(this.handle); } }, { key: 'color', get: function get() { return this.attachments[GL_COLOR_ATTACHMENT0] || null; } }, { key: 'texture', get: function get() { return this.attachments[GL_COLOR_ATTACHMENT0] || null; } }, { key: 'depth', get: function get() { return this.attachments[GL_DEPTH_ATTACHMENT] || null; } }, { key: 'stencil', get: function get() { return this.attachments[GL_STENCIL_ATTACHMENT] || null; } }]); return Framebuffer; }(__WEBPACK_IMPORTED_MODULE_4__resource__["a" /* default */]); // PUBLIC METHODS // Map an index to a cube map face constant /* harmony default export */ __webpack_exports__["a"] = (Framebuffer); function mapIndexToCubeMapFace(layer) { // TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515) // if smaller assume layer is index, otherwise assume it is already a cube map face constant return layer < GL_TEXTURE_CUBE_MAP_POSITIVE_X ? layer + GL_TEXTURE_CUBE_MAP_POSITIVE_X : layer; } // Returns number of components in a specific WebGL format function glFormatToComponents(format) { switch (format) { case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ALPHA: return 1; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGB: return 3; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGBA: return 4; default: throw new Error('Unknown format'); } } // Get a string describing the framebuffer error if installed function _getFrameBufferStatus(status) { // Use error mapping if installed var STATUS = Framebuffer.STATUS || {}; return STATUS[status] || 'Framebuffer error ' + status; } //# sourceMappingURL=framebuffer.js.map /***/ }), /* 70 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Note: The numeric values here are matched by shader code in the // "project" and "project64" shader modules. Both places need to be // updated. // TODO: Maybe "POSITIONS" would be a better name? var COORDINATE_SYSTEM = exports.COORDINATE_SYSTEM = { // Positions are interpreted as [lng, lat, elevation] // lng lat are degrees, elevation is meters. distances as meters. LNGLAT: 1.0, // Positions are interpreted as meter offsets, distances as meters // Planned to deprecate in later versions METER_OFFSETS: 2.0, METERS: 2.0, // Positions are interpreted as lng lat offsets: [deltaLng, deltaLat, elevation] // deltaLng, deltaLat are delta degrees, elevation is meters. // distances as meters. LNGLAT_OFFSETS: 3.0, // Positions and distances are not transformed: [x, y, z] in unit coordinates IDENTITY: 0.0 }; var LIFECYCLE = exports.LIFECYCLE = { NO_STATE: 'Awaiting state', MATCHED: 'Matched. State transferred from previous layer', INITIALIZED: 'Intialized', AWAITING_GC: 'Discarded. Awaiting garbage collection', AWAITING_FINALIZATION: 'No longer matched. Awaiting garbage collection', FINALIZED: 'Finalized! Awaiting garbage collection' }; /***/ }), /* 71 */ /***/ (function(module, exports, __webpack_require__) { // getting tag from 19.1.3.6 Object.prototype.toString() var cof = __webpack_require__(27); var TAG = __webpack_require__(6)('toStringTag'); // ES3 wrong here var ARG = cof(function () { return arguments; }()) == 'Arguments'; // fallback for IE11 Script Access Denied error var tryGet = function (it, key) { try { return it[key]; } catch (e) { /* empty */ } }; module.exports = function (it) { var O, T, B; return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T // builtinTag case : ARG ? cof(O) // ES3 arguments fallback : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; }; /***/ }), /* 72 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings var cof = __webpack_require__(27); // eslint-disable-next-line no-prototype-builtins module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), /* 73 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), /* 74 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * */ function makeEmptyFunction(arg) { return function () { return arg; }; } /** * This function accepts and discards inputs; it has no side effects. This is * primarily useful idiomatically for overridable function endpoints which * always need to be callable, since JS lacks a null-call idiom ala Cocoa. */ var emptyFunction = function emptyFunction() {}; emptyFunction.thatReturns = makeEmptyFunction; emptyFunction.thatReturnsFalse = makeEmptyFunction(false); emptyFunction.thatReturnsTrue = makeEmptyFunction(true); emptyFunction.thatReturnsNull = makeEmptyFunction(null); emptyFunction.thatReturnsThis = function () { return this; }; emptyFunction.thatReturnsArgument = function (arg) { return arg; }; module.exports = emptyFunction; /***/ }), /* 75 */ /***/ (function(module, exports) { module.exports = multiply; /** * Multiplies two mat4's * * @param {mat4} out the receiving matrix * @param {mat4} a the first operand * @param {mat4} b the second operand * @returns {mat4} out */ function multiply(out, a, b) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15]; // Cache only the current line of the second matrix var b0 = b[0], b1 = b[1], b2 = b[2], b3 = b[3]; out[0] = b0*a00 + b1*a10 + b2*a20 + b3*a30; out[1] = b0*a01 + b1*a11 + b2*a21 + b3*a31; out[2] = b0*a02 + b1*a12 + b2*a22 + b3*a32; out[3] = b0*a03 + b1*a13 + b2*a23 + b3*a33; b0 = b[4]; b1 = b[5]; b2 = b[6]; b3 = b[7]; out[4] = b0*a00 + b1*a10 + b2*a20 + b3*a30; out[5] = b0*a01 + b1*a11 + b2*a21 + b3*a31; out[6] = b0*a02 + b1*a12 + b2*a22 + b3*a32; out[7] = b0*a03 + b1*a13 + b2*a23 + b3*a33; b0 = b[8]; b1 = b[9]; b2 = b[10]; b3 = b[11]; out[8] = b0*a00 + b1*a10 + b2*a20 + b3*a30; out[9] = b0*a01 + b1*a11 + b2*a21 + b3*a31; out[10] = b0*a02 + b1*a12 + b2*a22 + b3*a32; out[11] = b0*a03 + b1*a13 + b2*a23 + b3*a33; b0 = b[12]; b1 = b[13]; b2 = b[14]; b3 = b[15]; out[12] = b0*a00 + b1*a10 + b2*a20 + b3*a30; out[13] = b0*a01 + b1*a11 + b2*a21 + b3*a31; out[14] = b0*a02 + b1*a12 + b2*a22 + b3*a32; out[15] = b0*a03 + b1*a13 + b2*a23 + b3*a33; return out; }; /***/ }), /* 76 */ /***/ (function(module, exports) { module.exports = perspective; /** * Generates a perspective projection matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {number} fovy Vertical field of view in radians * @param {number} aspect Aspect ratio. typically viewport width/height * @param {number} near Near bound of the frustum * @param {number} far Far bound of the frustum * @returns {mat4} out */ function perspective(out, fovy, aspect, near, far) { var f = 1.0 / Math.tan(fovy / 2), nf = 1 / (near - far); out[0] = f / aspect; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = f; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = (far + near) * nf; out[11] = -1; out[12] = 0; out[13] = 0; out[14] = (2 * far * near) * nf; out[15] = 0; return out; }; /***/ }), /* 77 */ /***/ (function(module, exports) { module.exports = scale; /** * Scales the mat4 by the dimensions in the given vec3 * * @param {mat4} out the receiving matrix * @param {mat4} a the matrix to scale * @param {vec3} v the vec3 to scale the matrix by * @returns {mat4} out **/ function scale(out, a, v) { var x = v[0], y = v[1], z = v[2]; out[0] = a[0] * x; out[1] = a[1] * x; out[2] = a[2] * x; out[3] = a[3] * x; out[4] = a[4] * y; out[5] = a[5] * y; out[6] = a[6] * y; out[7] = a[7] * y; out[8] = a[8] * z; out[9] = a[9] * z; out[10] = a[10] * z; out[11] = a[11] * z; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; return out; }; /***/ }), /* 78 */ /***/ (function(module, exports) { module.exports = translate; /** * Translate a mat4 by the given vector * * @param {mat4} out the receiving matrix * @param {mat4} a the matrix to translate * @param {vec3} v vector to translate by * @returns {mat4} out */ function translate(out, a, v) { var x = v[0], y = v[1], z = v[2], a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23; if (a === out) { out[12] = a[0] * x + a[4] * y + a[8] * z + a[12]; out[13] = a[1] * x + a[5] * y + a[9] * z + a[13]; out[14] = a[2] * x + a[6] * y + a[10] * z + a[14]; out[15] = a[3] * x + a[7] * y + a[11] * z + a[15]; } else { a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; out[0] = a00; out[1] = a01; out[2] = a02; out[3] = a03; out[4] = a10; out[5] = a11; out[6] = a12; out[7] = a13; out[8] = a20; out[9] = a21; out[10] = a22; out[11] = a23; out[12] = a00 * x + a10 * y + a20 * z + a[12]; out[13] = a01 * x + a11 * y + a21 * z + a[13]; out[14] = a02 * x + a12 * y + a22 * z + a[14]; out[15] = a03 * x + a13 * y + a23 * z + a[15]; } return out; }; /***/ }), /* 79 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__ = __webpack_require__(81); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "WebMercatorViewport", function() { return __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__fit_bounds__ = __webpack_require__(285); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "fitBounds", function() { return __WEBPACK_IMPORTED_MODULE_1__fit_bounds__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__normalize_viewport_props__ = __webpack_require__(686); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "normalizeViewportProps", function() { return __WEBPACK_IMPORTED_MODULE_2__normalize_viewport_props__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__fly_to_viewport__ = __webpack_require__(685); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "flyToViewport", function() { return __WEBPACK_IMPORTED_MODULE_3__fly_to_viewport__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__ = __webpack_require__(80); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "lngLatToWorld", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "worldToLngLat", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["b"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "worldToPixels", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["c"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "pixelsToWorld", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["d"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getMeterZoom", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["e"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getDistanceScales", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["f"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getWorldPosition", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["g"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getViewMatrix", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["h"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getProjectionMatrix", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["i"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "PerspectiveMercatorViewport", function() { return __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "getUncenteredViewMatrix", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["h"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "projectFlat", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["a"]; }); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "unprojectFlat", function() { return __WEBPACK_IMPORTED_MODULE_4__web_mercator_utils__["b"]; }); // Classic web-mercator-project // Deprecated //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9pbmRleC5qcyJdLCJuYW1lcyI6WyJkZWZhdWx0IiwiV2ViTWVyY2F0b3JWaWV3cG9ydCIsImZpdEJvdW5kcyIsIm5vcm1hbGl6ZVZpZXdwb3J0UHJvcHMiLCJmbHlUb1ZpZXdwb3J0IiwibG5nTGF0VG9Xb3JsZCIsIndvcmxkVG9MbmdM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ZGVmYXVsdCBhcyBXZWJNZXJjYXRvclZpZXdwb3J0fSBmcm9tICcuL3dlYi1tZXJjYXRvci12aWV3cG9ydCc7XG5cbmV4cG9ydCB7ZGVmYXVsdCBhcyBmaXRCb3VuZHN9IGZyb20gJy4vZml0LWJvdW5kcyc7XG5leHBvcnQge2RlZmF1bHQgYXMgbm9ybWFsaXplVmlld3BvcnRQcm9wc30gZnJvbSAnLi9ub3JtYWxpemUtdmlld3BvcnQtcHJvcHMnO1xuZXhwb3J0IHtkZWZhdWx0IGFzIGZseVRvVmlld3BvcnR9IGZyb20gJy4vZmx5LXRvLXZpZXdwb3J0JztcblxuZXhwb3J0IHtcbiAgbG5nTGF0VG9Xb3JsZCxcbiAgd29ybGRUb0xuZ0xhdCxcbiAgd29ybGRUb1BpeGVscyxcbiAgcGl4ZWxzVG9Xb3JsZCxcbiAgZ2V0TWV0ZXJab29tLFxuICBnZXREaXN0YW5jZVNjYWxlcyxcbiAgZ2V0V29ybGRQb3NpdGlvbixcbiAgZ2V0Vmlld01hdHJpeCxcbiAgZ2V0UHJvamVjdGlvbk1hdHJpeFxufSBmcm9tICcuL3dlYi1tZXJjYXRvci11dGlscyc7XG5cbi8vIERlcHJlY2F0ZWRcbmV4cG9ydCB7ZGVmYXVsdCBhcyBQZXJzcGVjdGl2ZU1lcmNhdG9yVmlld3BvcnR9IGZyb20gJy4vd2ViLW1lcmNhdG9yLXZpZXdwb3J0JztcbmV4cG9ydCB7XG4gIGdldFZpZXdNYXRyaXggYXMgZ2V0VW5jZW50ZXJlZFZpZXdNYXRyaXgsXG4gIGxuZ0xhdFRvV29ybGQgYXMgcHJvamVjdEZsYXQsXG4gIHdvcmxkVG9MbmdMYXQgYXMgdW5wcm9qZWN0RmxhdFxufSBmcm9tICcuL3dlYi1tZXJjYXRvci11dGlscyc7XG4iXX0= /***/ }), /* 80 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["j"] = zoomToScale; /* harmony export (immutable) */ __webpack_exports__["k"] = scaleToZoom; /* harmony export (immutable) */ __webpack_exports__["a"] = lngLatToWorld; /* harmony export (immutable) */ __webpack_exports__["b"] = worldToLngLat; /* harmony export (immutable) */ __webpack_exports__["e"] = getMeterZoom; /* harmony export (immutable) */ __webpack_exports__["f"] = getDistanceScales; /* harmony export (immutable) */ __webpack_exports__["g"] = getWorldPosition; /* harmony export (immutable) */ __webpack_exports__["h"] = getViewMatrix; /* harmony export (immutable) */ __webpack_exports__["i"] = getProjectionMatrix; /* harmony export (immutable) */ __webpack_exports__["c"] = worldToPixels; /* harmony export (immutable) */ __webpack_exports__["d"] = pixelsToWorld; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_math_gl__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_utils__ = __webpack_require__(118); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_gl_mat4_perspective__ = __webpack_require__(76); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_gl_mat4_perspective___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_gl_mat4_perspective__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale__ = __webpack_require__(77); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate__ = __webpack_require__(78); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_gl_mat4_rotateX__ = __webpack_require__(157); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_gl_mat4_rotateX___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_gl_mat4_rotateX__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_gl_mat4_rotateZ__ = __webpack_require__(158); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_gl_mat4_rotateZ___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_gl_mat4_rotateZ__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_gl_vec2_lerp__ = __webpack_require__(238); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_gl_vec2_lerp___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_gl_vec2_lerp__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_assert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); // TODO - THE UTILITIES IN THIS FILE SHOULD BE IMPORTED FROM WEB-MERCATOR-VIEWPORT MODULE // CONSTANTS var PI = Math.PI; var PI_4 = PI / 4; var DEGREES_TO_RADIANS = PI / 180; var RADIANS_TO_DEGREES = 180 / PI; var TILE_SIZE = 512; // Average circumference (40075 km equatorial, 40007 km meridional) var EARTH_CIRCUMFERENCE = 40.03e6; /** Util functions **/ function zoomToScale(zoom) { return Math.pow(2, zoom); } function scaleToZoom(scale) { return Math.log2(scale); } /** * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile. * Performs the nonlinear part of the web mercator projection. * Remaining projection is done with 4x4 matrices which also handles * perspective. * * @param {Array} lngLat - [lng, lat] coordinates * Specifies a point on the sphere to project onto the map. * @return {Array} [x,y] coordinates. */ function lngLatToWorld(_ref, scale,isGeographicCoordinateSystem) { var _ref2 = _slicedToArray(_ref, 2), lng = _ref2[0], lat = _ref2[1]; scale *= TILE_SIZE; var lambda2 = lng * DEGREES_TO_RADIANS; var phi2 = lat * DEGREES_TO_RADIANS; var x = scale * (lambda2 + PI) / (2 * PI); var y ; if(isGeographicCoordinateSystem===true){ y = scale * (PI - phi2) / (2 * PI); }else{ y = scale * (PI - Math.log(Math.tan(PI_4 + phi2 * 0.5))) / (2 * PI); } // y = scale * (PI - phi2) / (2 * PI); //iclient return [x, y]; } /** * Unproject world point [x,y] on map onto {lat, lon} on sphere * * @param {object|Vector} xy - object with {x,y} members * representing point on projected map plane * @return {GeoCoordinates} - object with {lat,lon} of point on sphere. * Has toArray method if you need a GeoJSON Array. * Per cartographic tradition, lat and lon are specified as degrees. */ function worldToLngLat(_ref3, scale,isGeographicCoordinateSystem) { var _ref4 = _slicedToArray(_ref3, 2), x = _ref4[0], y = _ref4[1]; scale *= TILE_SIZE; var lambda2 = x / scale * (2 * PI) - PI; var phi2; if(isGeographicCoordinateSystem===true){ phi2=PI- (y*2*PI/scale); }else{ phi2 = 2 * (Math.atan(Math.exp(PI - y / scale * (2 * PI))) - PI_4);//90-y*360/scale; } //var phi2 =(PI/2)- y / scale*(2 * PI); //var phi2 =2 * (Math.atan(Math.exp(PI - y / scale * (2 * PI))) - PI_4); return [lambda2 * RADIANS_TO_DEGREES, phi2* RADIANS_TO_DEGREES ]; } // Returns the zoom level that gives a 1 meter pixel at a certain latitude // S=C*cos(y)/2^(z+8) function getMeterZoom(_ref5) { var latitude = _ref5.latitude; __WEBPACK_IMPORTED_MODULE_8_assert___default()(Number.isFinite(latitude)); var latCosine = Math.cos(latitude * DEGREES_TO_RADIANS); return scaleToZoom(EARTH_CIRCUMFERENCE * latCosine) - 8; } /** * Calculate distance scales in meters around current lat/lon, both for * degrees and pixels. * In mercator projection mode, the distance scales vary significantly * with latitude. */ function getDistanceScales(_ref6) { var latitude = _ref6.latitude, longitude = _ref6.longitude, zoom = _ref6.zoom, scale = _ref6.scale, _ref6$highPrecision = _ref6.highPrecision, isGeographicCoordinateSystem = _ref6.isGeographicCoordinateSystem, highPrecision = _ref6$highPrecision === undefined ? false : _ref6$highPrecision; // Calculate scale from zoom if not provided scale = scale !== undefined ? scale : zoomToScale(zoom); __WEBPACK_IMPORTED_MODULE_8_assert___default()(Number.isFinite(latitude) && Number.isFinite(longitude) && Number.isFinite(scale)); var result = {}; var worldSize = TILE_SIZE * scale; var latCosine =Math.cos(latitude * DEGREES_TO_RADIANS); /** * Number of pixels occupied by one degree longitude around current lat/lon: pixelsPerDegreeX = d(lngLatToWorld([lng, lat])[0])/d(lng) = scale * TILE_SIZE * DEGREES_TO_RADIANS / (2 * PI) pixelsPerDegreeY = d(lngLatToWorld([lng, lat])[1])/d(lat) = -scale * TILE_SIZE * DEGREES_TO_RADIANS / cos(lat * DEGREES_TO_RADIANS) / (2 * PI) */ var pixelsPerDegreeX = worldSize / 360; var pixelsPerDegreeY = pixelsPerDegreeX / latCosine; /** * Number of pixels occupied by one meter around current lat/lon: */ var altPixelsPerMeter = worldSize / EARTH_CIRCUMFERENCE / latCosine; result.pixelsPerMeter = [altPixelsPerMeter, altPixelsPerMeter, altPixelsPerMeter]; result.metersPerPixel = [1 / altPixelsPerMeter, 1 / altPixelsPerMeter, 1 / altPixelsPerMeter]; result.pixelsPerDegree = [pixelsPerDegreeX, pixelsPerDegreeY, altPixelsPerMeter]; result.degreesPerPixel = [1 / pixelsPerDegreeX, 1 / pixelsPerDegreeY, 1 / altPixelsPerMeter]; /** * Taylor series 2nd order for 1/latCosine f'(a) * (x - a) = d(1/cos(lat * DEGREES_TO_RADIANS))/d(lat) * dLat = DEGREES_TO_RADIANS * tan(lat * DEGREES_TO_RADIANS) / cos(lat * DEGREES_TO_RADIANS) * dLat */ if (highPrecision) { var latCosine2 = DEGREES_TO_RADIANS * Math.tan(latitude * DEGREES_TO_RADIANS) / latCosine; var pixelsPerDegreeY2 = pixelsPerDegreeX * latCosine2 / 2; var altPixelsPerDegree2 = worldSize / EARTH_CIRCUMFERENCE * latCosine2; var altPixelsPerMeter2 = altPixelsPerDegree2 / pixelsPerDegreeY * altPixelsPerMeter; result.pixelsPerDegree2 = [0, pixelsPerDegreeY2, altPixelsPerDegree2]; result.pixelsPerMeter2 = [altPixelsPerMeter2, 0, altPixelsPerMeter2]; } //iclient result.isGeographicCoordinateSystem=isGeographicCoordinateSystem; // Main results, used for converting meters to latlng deltas and scaling offsets return result; } /** * Calculates a mercator world position ("pixels" in given zoom level) * from a lng/lat and meterOffset */ function getWorldPosition(_ref7) { var longitude = _ref7.longitude, latitude = _ref7.latitude, zoom = _ref7.zoom, scale = _ref7.scale, meterOffset = _ref7.meterOffset, _ref7$distanceScales = _ref7.distanceScales, distanceScales = _ref7$distanceScales === undefined ? null : _ref7$distanceScales; // Calculate scale from zoom if not provided scale = scale !== undefined ? scale : zoomToScale(zoom); // Make a centered version of the matrix for projection modes without an offset var center2d = lngLatToWorld([longitude, latitude], scale,distanceScales?distanceScales.isGeographicCoordinateSystem:false); var center = new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Vector3"](center2d[0], center2d[1], 0); if (meterOffset) { // Calculate distance scales if lng/lat/zoom are provided distanceScales = distanceScales || getDistanceScales({ latitude: latitude, longitude: longitude, scale: scale }); var pixelPosition = new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Vector3"](meterOffset) // Convert to pixels in current zoom .scale(distanceScales.pixelsPerMeter) // We want positive Y to represent an offset towards north, // but web mercator world coordinates is top-left .scale([1, -1, 1]); center.add(pixelPosition); } return center; } // ATTRIBUTION: // view and projection matrix creation is intentionally kept compatible with // mapbox-gl's implementation to ensure that seamless interoperation // with mapbox and react-map-gl. See: https://github.com/mapbox/mapbox-gl-js // Variable fov (in radians) function getFov(_ref8) { var height = _ref8.height, altitude = _ref8.altitude; return 2 * Math.atan(height / 2 / altitude); } function getClippingPlanes(_ref9) { var altitude = _ref9.altitude, pitch = _ref9.pitch; // Find the distance from the center point to the center top // in altitude units using law of sines. var pitchRadians = pitch * DEGREES_TO_RADIANS; var halfFov = Math.atan(0.5 / altitude); var topHalfSurfaceDistance = Math.sin(halfFov) * altitude / Math.sin(Math.PI / 2 - pitchRadians - halfFov); // Calculate z value of the farthest fragment that should be rendered. var farZ = Math.cos(Math.PI / 2 - pitchRadians) * topHalfSurfaceDistance + altitude; return { farZ: farZ, nearZ: 0.1 }; } function getViewMatrix(_ref10) { var height = _ref10.height, pitch = _ref10.pitch, bearing = _ref10.bearing, altitude = _ref10.altitude, _ref10$center = _ref10.center, center = _ref10$center === undefined ? null : _ref10$center, _ref10$flipY = _ref10.flipY, flipY = _ref10$flipY === undefined ? false : _ref10$flipY; // VIEW MATRIX: PROJECTS MERCATOR WORLD COORDINATES // Note that mercator world coordinates typically need to be flipped // // Note: As usual, matrix operation orders should be read in reverse // since vectors will be multiplied from the right during transformation var vm = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["a" /* createMat4 */])(); // Move camera to altitude (along the pitch & bearing direction) __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate___default()(vm, vm, [0, 0, -altitude]); // After the rotateX, z values are in pixel units. Convert them to // altitude units. 1 altitude unit = the screen height. __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale___default()(vm, vm, [1, 1, 1 / height]); // Rotate by bearing, and then by pitch (which tilts the view) __WEBPACK_IMPORTED_MODULE_5_gl_mat4_rotateX___default()(vm, vm, -pitch * DEGREES_TO_RADIANS); __WEBPACK_IMPORTED_MODULE_6_gl_mat4_rotateZ___default()(vm, vm, bearing * DEGREES_TO_RADIANS); if (flipY) { __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale___default()(vm, vm, [1, -1, 1]); } if (center) { __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate___default()(vm, vm, new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Vector3"](center).negate()); } return vm; } // PROJECTION MATRIX: PROJECTS FROM CAMERA (VIEW) SPACE TO CLIPSPACE // This is a "Mapbox" projection matrix - matches mapbox exactly if farZMultiplier === 1 function getProjectionMatrix(_ref11) { var width = _ref11.width, height = _ref11.height, pitch = _ref11.pitch, altitude = _ref11.altitude, _ref11$farZMultiplier = _ref11.farZMultiplier, farZMultiplier = _ref11$farZMultiplier === undefined ? 10 : _ref11$farZMultiplier; var _getClippingPlanes = getClippingPlanes({ altitude: altitude, pitch: pitch }), nearZ = _getClippingPlanes.nearZ, farZ = _getClippingPlanes.farZ; var fov = getFov({ height: height, altitude: altitude }); var projectionMatrix = __WEBPACK_IMPORTED_MODULE_2_gl_mat4_perspective___default()([], fov, // fov in radians width / height, // aspect ratio nearZ, // near plane farZ * farZMultiplier // far plane ); return projectionMatrix; } /** * Project flat coordinates to pixels on screen. * * @param {Array} xyz - flat coordinate on 512*512 Mercator Zoom 0 tile * @param {Matrix4} pixelProjectionMatrix - projection matrix * @return {Array} [x, y, depth] pixel coordinate on screen. */ function worldToPixels(xyz, pixelProjectionMatrix) { var _xyz = _slicedToArray(xyz, 3), x = _xyz[0], y = _xyz[1], _xyz$ = _xyz[2], z = _xyz$ === undefined ? 0 : _xyz$; __WEBPACK_IMPORTED_MODULE_8_assert___default()(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z)); return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["b" /* transformVector */])(pixelProjectionMatrix, [x, y, z, 1]); } /** * Unproject pixels on screen to flat coordinates. * * @param {Array} xyz - pixel coordinate on screen. * @param {Matrix4} pixelUnprojectionMatrix - unprojection matrix * @param {Number} targetZ - if pixel coordinate does not have a 3rd component (depth), * targetZ is used as the elevation plane to unproject onto * @return {Array} [x, y, Z] flat coordinates on 512*512 Mercator Zoom 0 tile. */ function pixelsToWorld(xyz, pixelUnprojectionMatrix) { var targetZ = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var _xyz2 = _slicedToArray(xyz, 3), x = _xyz2[0], y = _xyz2[1], z = _xyz2[2]; __WEBPACK_IMPORTED_MODULE_8_assert___default()(Number.isFinite(x) && Number.isFinite(y)); if (Number.isFinite(z)) { // Has depth component var coord = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["b" /* transformVector */])(pixelUnprojectionMatrix, [x, y, z, 1]); return coord; } // since we don't know the correct projected z value for the point, // unproject two points to get a line and then find the point on that line with z=0 var coord0 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["b" /* transformVector */])(pixelUnprojectionMatrix, [x, y, 0, 1]); var coord1 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["b" /* transformVector */])(pixelUnprojectionMatrix, [x, y, 1, 1]); var z0 = coord0[2]; var z1 = coord1[2]; var t = z0 === z1 ? 0 : ((targetZ || 0) - z0) / (z1 - z0); return __WEBPACK_IMPORTED_MODULE_7_gl_vec2_lerp___default()([], coord0, coord1, t); } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy93ZWItbWVyY2F0b3ItdXRpbHMuanMiXSwibmFtZXMiOlsiVmVjdG9yMyIsImNyZWF0ZU1hdDQiLCJ0cmFuc2Zvcm1WZWN0b3IiLCJtYXQ0X3BlcnNwZWN0aXZlIiwibWF0NF9zY2FsZSIsIm1hdDRfdHJhbnNsYXRlIiwibWF0NF9yb3RhdGVYIiwibWF0NF9yb3RhdGVaIiwidmVjMl9sZXJwIiwiYXNzZXJ0IiwiUEkiLCJNYXRoIiwiUElfNCIsIkRFR1JFRVNfVE9fUkFESUFOUyIsIlJBRElBTlNfVE9fREVHUkVFUyIsIlRJTEVfU0laRSIsIkVBUlRIX0NJUkNVTUZFUkVOQ0UiLCJ6b29tVG9TY2FsZSIsInpvb20iLCJwb3ciLCJzY2FsZVRvWm9vbSIsInNjY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W5kIHRoZSBwb2ludCBvbiB0aGF0IGxpbmUgd2l0aCB6PTBcbiAgY29uc3QgY29vcmQwID0gdHJhbnNmb3JtVmVjdG9yKHBpeGVsVW5wcm9qZWN0aW9uTWF0cml4LCBbeCwgeSwgMCwgMV0pO1xuICBjb25zdCBjb29yZDEgPSB0cmFuc2Zvcm1WZWN0b3IocGl4ZWxVbnByb2plY3Rpb25NYXRyaXgsIFt4LCB5LCAxLCAxXSk7XG5cbiAgY29uc3QgejAgPSBjb29yZDBbMl07XG4gIGNvbnN0IHoxID0gY29vcmQxWzJdO1xuXG4gIGNvbnN0IHQgPSB6MCA9PT0gejEgPyAwIDogKCh0YXJnZXRaIHx8IDApIC0gejApIC8gKHoxIC0gejApO1xuICByZXR1cm4gdmVjMl9sZXJwKFtdLCBjb29yZDAsIGNvb3JkMSwgdCk7XG59XG4iXX0= /***/ }), /* 81 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__viewport__ = __webpack_require__(687); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__ = __webpack_require__(80); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__fit_bounds__ = __webpack_require__(285); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_gl_vec2_add__ = __webpack_require__(159); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_gl_vec2_add___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_gl_vec2_add__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_gl_vec2_negate__ = __webpack_require__(160); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_gl_vec2_negate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_gl_vec2_negate__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // View and Projection Matrix calculations for mapbox-js style map view properties var WebMercatorViewport = function (_Viewport) { _inherits(WebMercatorViewport, _Viewport); /** * @classdesc * Creates view/projection matrices from mercator params * Note: The Viewport is immutable in the sense that it only has accessors. * A new viewport instance should be created if any parameters have changed. * * @class * @param {Object} opt - options * * @param {Number} opt.width=1 - Width of "viewport" or window * @param {Number} opt.height=1 - Height of "viewport" or window * @param {Number} opt.scale=1 - Either use scale or zoom * @param {Number} opt.pitch=0 - Camera angle in degrees (0 is straight down) * @param {Number} opt.bearing=0 - Map rotation in degrees (0 means north is up) * @param {Number} opt.altitude= - Altitude of camera in screen units * * Web mercator projection short-hand parameters * @param {Number} opt.latitude - Center of viewport on map (alternative to opt.center) * @param {Number} opt.longitude - Center of viewport on map (alternative to opt.center) * @param {Number} opt.zoom - Scale = Math.pow(2,zoom) on map (alternative to opt.scale) * Notes: * - Only one of center or [latitude, longitude] can be specified * - [latitude, longitude] can only be specified when "mercator" is true * - Altitude has a default value that matches assumptions in mapbox-gl * - width and height are forced to 1 if supplied as 0, to avoid * division by zero. This is intended to reduce the burden of apps to * to check values before instantiating a Viewport. */ /* eslint-disable complexity */ function WebMercatorViewport() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, width = _ref.width, height = _ref.height, _ref$latitude = _ref.latitude, latitude = _ref$latitude === undefined ? 0 : _ref$latitude, _ref$longitude = _ref.longitude, longitude = _ref$longitude === undefined ? 0 : _ref$longitude, _ref$zoom = _ref.zoom, zoom = _ref$zoom === undefined ? 0 : _ref$zoom, _ref$pitch = _ref.pitch, pitch = _ref$pitch === undefined ? 0 : _ref$pitch, _ref$bearing = _ref.bearing, bearing = _ref$bearing === undefined ? 0 : _ref$bearing, _ref$altitude = _ref.altitude, altitude = _ref$altitude === undefined ? 1.5 : _ref$altitude, //iclient isGeographicCoordinateSystem = _ref.isGeographicCoordinateSystem, farZMultiplier = _ref$farZMultiplier === undefined ? 10 : _ref$farZMultiplier; _ref$farZMultiplier = _ref.farZMultiplier, farZMultiplier = _ref$farZMultiplier === undefined ? 10 : _ref$farZMultiplier; _classCallCheck(this, WebMercatorViewport); // Silently allow apps to send in 0,0 to facilitate isomorphic render etc width = width || 1; height = height || 1; var scale = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["j" /* zoomToScale */])(zoom); // Altitude - prevent division by 0 // TODO - just throw an Error instead? altitude = Math.max(0.75, altitude); var center = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["g" /* getWorldPosition */])({ longitude: longitude, latitude: latitude, scale: scale }); var projectionMatrix = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["i" /* getProjectionMatrix */])({ width: width, height: height, pitch: pitch, bearing: bearing, altitude: altitude, farZMultiplier: farZMultiplier }); var viewMatrix = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["h" /* getViewMatrix */])({ height: height, center: center, pitch: pitch, bearing: bearing, altitude: altitude, flipY: true }); // Save parameters var _this = _possibleConstructorReturn(this, (WebMercatorViewport.__proto__ || Object.getPrototypeOf(WebMercatorViewport)).call(this, { width: width, height: height, viewMatrix: viewMatrix, projectionMatrix: projectionMatrix,isGeographicCoordinateSystem:isGeographicCoordinateSystem })); _this.latitude = latitude; _this.longitude = longitude; _this.zoom = zoom; _this.pitch = pitch; _this.bearing = bearing; _this.altitude = altitude; _this.scale = scale; _this.center = center; Object.freeze(_this); return _this; } /* eslint-enable complexity */ /** * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile. * Performs the nonlinear part of the web mercator projection. * Remaining projection is done with 4x4 matrices which also handles * perspective. * * @param {Array} lngLat - [lng, lat] coordinates * Specifies a point on the sphere to project onto the map. * @return {Array} [x,y] coordinates. */ _createClass(WebMercatorViewport, [{ key: 'projectFlat', value: function projectFlat(lngLat) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["a" /* lngLatToWorld */])(lngLat, scale); } /** * Unproject world point [x,y] on map onto {lat, lon} on sphere * * @param {object|Vector} xy - object with {x,y} members * representing point on projected map plane * @return {GeoCoordinates} - object with {lat,lon} of point on sphere. * Has toArray method if you need a GeoJSON Array. * Per cartographic tradition, lat and lon are specified as degrees. */ }, { key: 'unprojectFlat', value: function unprojectFlat(xy) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["b" /* worldToLngLat */])(xy, scale); } /** * Get the map center that place a given [lng, lat] coordinate at screen * point [x, y] * * @param {Array} lngLat - [lng,lat] coordinates * Specifies a point on the sphere. * @param {Array} pos - [x,y] coordinates * Specifies a point on the screen. * @return {Array} [lng,lat] new map center. */ }, { key: 'getMapCenterByLngLatPosition', value: function getMapCenterByLngLatPosition(_ref2) { var lngLat = _ref2.lngLat, pos = _ref2.pos; var fromLocation = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["d" /* pixelsToWorld */])(pos, this.pixelUnprojectionMatrix); var toLocation = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["a" /* lngLatToWorld */])(lngLat, this.scale); var translate = __WEBPACK_IMPORTED_MODULE_3_gl_vec2_add___default()([], toLocation, __WEBPACK_IMPORTED_MODULE_4_gl_vec2_negate___default()([], fromLocation)); var newCenter = __WEBPACK_IMPORTED_MODULE_3_gl_vec2_add___default()([], this.center, translate); return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__web_mercator_utils__["b" /* worldToLngLat */])(newCenter, this.scale); } // Legacy method name }, { key: 'getLocationAtPoint', value: function getLocationAtPoint(_ref3) { var lngLat = _ref3.lngLat, pos = _ref3.pos; return this.getMapCenterByLngLatPosition({ lngLat: lngLat, pos: pos }); } /** * Returns a new viewport that fit around the given rectangle. * Only supports non-perspective mode. * @param {Array} bounds - [[lon, lat], [lon, lat]] * @param {Number} [options.padding] - The amount of padding in pixels to add to the given bounds. * @param {Array} [options.offset] - The center of the given bounds relative to the map's center, * [x, y] measured in pixels. * @returns {WebMercatorViewport} */ }, { key: 'fitBounds', value: function fitBounds(bounds) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var width = this.width, height = this.height; var _fitBounds2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__fit_bounds__["a" /* default */])(Object.assign({ width: width, height: height, bounds: bounds }, options)), longitude = _fitBounds2.longitude, latitude = _fitBounds2.latitude, zoom = _fitBounds2.zoom; return new WebMercatorViewport({ width: width, height: height, longitude: longitude, latitude: latitude, zoom: zoom }); } }]); return WebMercatorViewport; }(__WEBPACK_IMPORTED_MODULE_0__viewport__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (WebMercatorViewport); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy93ZWItbWVyY2F0b3Itdmlld3BvcnQuanMiXSwibmFtZXMiOlsiVmlld3BvcnQiLCJ6b29tVG9TY2FsZSIsImdldFdvcm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ZHMgcmVsYXRpdmUgdG8gdGhlIG1hcCdzIGNlbnRlcixcbiAgICogICAgW3gsIHldIG1lYXN1cmVkIGluIHBpeGVscy5cbiAgICogQHJldHVybnMge1dlYk1lcmNhdG9yVmlld3BvcnR9XG4gICAqL1xuICBmaXRCb3VuZHMoYm91bmRzLCBvcHRpb25zID0ge30pIHtcbiAgICBjb25zdCB7d2lkdGgsIGhlaWdodH0gPSB0aGlzO1xuICAgIGNvbnN0IHtsb25naXR1ZGUsIGxhdGl0dWRlLCB6b29tfSA9IGZpdEJvdW5kcyhPYmplY3QuYXNzaWduKHt3aWR0aCwgaGVpZ2h0LCBib3VuZHN9LCBvcHRpb25zKSk7XG4gICAgcmV0dXJuIG5ldyBXZWJNZXJjYXRvclZpZXdwb3J0KHt3aWR0aCwgaGVpZ2h0LCBsb25naXR1ZGUsIGxhdGl0dWRlLCB6b29tfSk7XG4gIH1cblxufVxuIl19 /***/ }), /* 82 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MAPBOX_LIMITS = undefined; var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _viewState = __webpack_require__(180); var _viewState2 = _interopRequireDefault(_viewState); var _viewportMercatorProject = __webpack_require__(79); var _viewportMercatorProject2 = _interopRequireDefault(_viewportMercatorProject); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // MAPBOX LIMITS var MAPBOX_LIMITS = exports.MAPBOX_LIMITS = { minZoom: 0, maxZoom: 20, minPitch: 0, maxPitch: 60 }; var DEFAULT_STATE = { pitch: 0, bearing: 0, altitude: 1.5 }; /* Utils */ function clamp(value, min, max) { return value < min ? min : value > max ? max : value; } var MapState = function (_ViewState) { _inherits(MapState, _ViewState); function MapState() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, width = _ref.width, height = _ref.height, latitude = _ref.latitude, longitude = _ref.longitude, zoom = _ref.zoom, _ref$bearing = _ref.bearing, bearing = _ref$bearing === undefined ? DEFAULT_STATE.bearing : _ref$bearing, _ref$pitch = _ref.pitch, pitch = _ref$pitch === undefined ? DEFAULT_STATE.pitch : _ref$pitch, _ref$altitude = _ref.altitude, altitude = _ref$altitude === undefined ? DEFAULT_STATE.altitude : _ref$altitude, _ref$maxZoom = _ref.maxZoom, maxZoom = _ref$maxZoom === undefined ? MAPBOX_LIMITS.maxZoom : _ref$maxZoom, _ref$minZoom = _ref.minZoom, minZoom = _ref$minZoom === undefined ? MAPBOX_LIMITS.minZoom : _ref$minZoom, _ref$maxPitch = _ref.maxPitch, maxPitch = _ref$maxPitch === undefined ? MAPBOX_LIMITS.maxPitch : _ref$maxPitch, _ref$minPitch = _ref.minPitch, minPitch = _ref$minPitch === undefined ? MAPBOX_LIMITS.minPitch : _ref$minPitch, startPanLngLat = _ref.startPanLngLat, startZoomLngLat = _ref.startZoomLngLat, startBearing = _ref.startBearing, startPitch = _ref.startPitch, startZoom = _ref.startZoom; _classCallCheck(this, MapState); (0, _assert2.default)(Number.isFinite(longitude), '`longitude` must be supplied'); (0, _assert2.default)(Number.isFinite(latitude), '`latitude` must be supplied'); (0, _assert2.default)(Number.isFinite(zoom), '`zoom` must be supplied'); var _this = _possibleConstructorReturn(this, (MapState.__proto__ || Object.getPrototypeOf(MapState)).call(this, { width: width, height: height, latitude: latitude, longitude: longitude, zoom: zoom, bearing: bearing, pitch: pitch, altitude: altitude, maxZoom: maxZoom, minZoom: minZoom, maxPitch: maxPitch, minPitch: minPitch })); _this._interactiveState = { startPanLngLat: startPanLngLat, startZoomLngLat: startZoomLngLat, startBearing: startBearing, startPitch: startPitch, startZoom: startZoom }; return _this; } /* Public API */ _createClass(MapState, [{ key: 'getViewportProps', value: function getViewportProps() { return this._viewportProps; } }, { key: 'getInteractiveState', value: function getInteractiveState() { return this._interactiveState; } /** * Start panning * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'panStart', value: function panStart(_ref2) { var pos = _ref2.pos; return this._getUpdatedState({ startPanLngLat: this._unproject(pos) }); } /** * Pan * @param {[Number, Number]} pos - position on screen where the pointer is * @param {[Number, Number], optional} startPos - where the pointer grabbed at * the start of the operation. Must be supplied of `panStart()` was not called */ }, { key: 'pan', value: function pan(_ref3) { var pos = _ref3.pos, startPos = _ref3.startPos; var startPanLngLat = this._interactiveState.startPanLngLat || this._unproject(startPos); if (!startPanLngLat) { return this; } var _calculateNewLngLat2 = this._calculateNewLngLat({ startPanLngLat: startPanLngLat, pos: pos }), _calculateNewLngLat3 = _slicedToArray(_calculateNewLngLat2, 2), longitude = _calculateNewLngLat3[0], latitude = _calculateNewLngLat3[1]; return this._getUpdatedState({ longitude: longitude, latitude: latitude }); } /** * End panning * Must call if `panStart()` was called */ }, { key: 'panEnd', value: function panEnd() { return this._getUpdatedState({ startPanLngLat: null }); } /** * Start rotating * @param {[Number, Number]} pos - position on screen where the center is */ }, { key: 'rotateStart', value: function rotateStart(_ref4) { var pos = _ref4.pos; return this._getUpdatedState({ startBearing: this._viewportProps.bearing, startPitch: this._viewportProps.pitch }); } /** * Rotate * @param {Number} deltaScaleX - a number between [-1, 1] specifying the * change to bearing. * @param {Number} deltaScaleY - a number between [-1, 1] specifying the * change to pitch. -1 sets to minPitch and 1 sets to maxPitch. */ }, { key: 'rotate', value: function rotate(_ref5) { var _ref5$deltaScaleX = _ref5.deltaScaleX, deltaScaleX = _ref5$deltaScaleX === undefined ? 0 : _ref5$deltaScaleX, _ref5$deltaScaleY = _ref5.deltaScaleY, deltaScaleY = _ref5$deltaScaleY === undefined ? 0 : _ref5$deltaScaleY; var _interactiveState = this._interactiveState, startBearing = _interactiveState.startBearing, startPitch = _interactiveState.startPitch; if (!Number.isFinite(startBearing) || !Number.isFinite(startPitch)) { return this; } var _calculateNewPitchAnd = this._calculateNewPitchAndBearing({ deltaScaleX: deltaScaleX, deltaScaleY: deltaScaleY, startBearing: startBearing, startPitch: startPitch }), pitch = _calculateNewPitchAnd.pitch, bearing = _calculateNewPitchAnd.bearing; return this._getUpdatedState({ bearing: bearing, pitch: pitch }); } /** * End rotating * Must call if `rotateStart()` was called */ }, { key: 'rotateEnd', value: function rotateEnd() { return this._getUpdatedState({ startBearing: null, startPitch: null }); } /** * Start zooming * @param {[Number, Number]} pos - position on screen where the center is */ }, { key: 'zoomStart', value: function zoomStart(_ref6) { var pos = _ref6.pos; return this._getUpdatedState({ startZoomLngLat: this._unproject(pos), startZoom: this._viewportProps.zoom }); } /** * Zoom * @param {[Number, Number]} pos - position on screen where the current center is * @param {[Number, Number]} startPos - the center position at * the start of the operation. Must be supplied of `zoomStart()` was not called * @param {Number} scale - a number between [0, 1] specifying the accumulated * relative scale. */ }, { key: 'zoom', value: function zoom(_ref7) { var pos = _ref7.pos, startPos = _ref7.startPos, scale = _ref7.scale; (0, _assert2.default)(scale > 0, '`scale` must be a positive number'); // Make sure we zoom around the current mouse position rather than map center var _interactiveState2 = this._interactiveState, startZoom = _interactiveState2.startZoom, startZoomLngLat = _interactiveState2.startZoomLngLat; if (!Number.isFinite(startZoom)) { // We have two modes of zoom: // scroll zoom that are discrete events (transform from the current zoom level), // and pinch zoom that are continuous events (transform from the zoom level when // pinch started). // If startZoom state is defined, then use the startZoom state; // otherwise assume discrete zooming startZoom = this._viewportProps.zoom; startZoomLngLat = this._unproject(startPos) || this._unproject(pos); } // take the start lnglat and put it where the mouse is down. (0, _assert2.default)(startZoomLngLat, '`startZoomLngLat` prop is required ' + 'for zoom behavior to calculate where to position the map.'); var zoom = this._calculateNewZoom({ scale: scale, startZoom: startZoom }); var zoomedViewport = new _viewportMercatorProject2.default(Object.assign({}, this._viewportProps, { zoom: zoom })); var _zoomedViewport$getLo = zoomedViewport.getLocationAtPoint({ lngLat: startZoomLngLat, pos: pos }), _zoomedViewport$getLo2 = _slicedToArray(_zoomedViewport$getLo, 2), longitude = _zoomedViewport$getLo2[0], latitude = _zoomedViewport$getLo2[1]; return this._getUpdatedState({ zoom: zoom, longitude: longitude, latitude: latitude }); } /** * End zooming * Must call if `zoomStart()` was called */ }, { key: 'zoomEnd', value: function zoomEnd() { return this._getUpdatedState({ startZoomLngLat: null, startZoom: null }); } }, { key: 'zoomIn', value: function zoomIn() { return this._zoomFromCenter(2); } }, { key: 'zoomOut', value: function zoomOut() { return this._zoomFromCenter(0.5); } }, { key: 'moveLeft', value: function moveLeft() { return this._panFromCenter([100, 0]); } }, { key: 'moveRight', value: function moveRight() { return this._panFromCenter([-100, 0]); } }, { key: 'moveUp', value: function moveUp() { return this._panFromCenter([0, 100]); } }, { key: 'moveDown', value: function moveDown() { return this._panFromCenter([0, -100]); } }, { key: 'rotateLeft', value: function rotateLeft() { return this._getUpdatedState({ bearing: this._viewportProps.bearing - 15 }); } }, { key: 'rotateRight', value: function rotateRight() { return this._getUpdatedState({ bearing: this._viewportProps.bearing + 15 }); } }, { key: 'rotateUp', value: function rotateUp() { return this._getUpdatedState({ pitch: this._viewportProps.pitch + 10 }); } }, { key: 'rotateDown', value: function rotateDown() { return this._getUpdatedState({ pitch: this._viewportProps.pitch - 10 }); } /* Private methods */ }, { key: '_zoomFromCenter', value: function _zoomFromCenter(scale) { var _viewportProps = this._viewportProps, width = _viewportProps.width, height = _viewportProps.height; return this.zoom({ pos: [width / 2, height / 2], scale: scale }); } }, { key: '_panFromCenter', value: function _panFromCenter(offset) { var _viewportProps2 = this._viewportProps, width = _viewportProps2.width, height = _viewportProps2.height; return this.pan({ startPos: [width / 2, height / 2], pos: [width / 2 + offset[0], height / 2 + offset[1]] }); } }, { key: '_getUpdatedState', value: function _getUpdatedState(newProps) { // Update _viewportProps return new MapState(Object.assign({}, this._viewportProps, this._interactiveState, newProps)); } // Apply any constraints (mathematical or defined by _viewportProps) to map state }, { key: '_applyConstraints', value: function _applyConstraints(props) { // Ensure zoom is within specified range var maxZoom = props.maxZoom, minZoom = props.minZoom, zoom = props.zoom; props.zoom = clamp(zoom, minZoom, maxZoom); // Ensure pitch is within specified range var maxPitch = props.maxPitch, minPitch = props.minPitch, pitch = props.pitch; props.pitch = clamp(pitch, minPitch, maxPitch); Object.assign(props, (0, _viewportMercatorProject.normalizeViewportProps)(props)); return props; } }, { key: '_unproject', value: function _unproject(pos) { var viewport = new _viewportMercatorProject2.default(this._viewportProps); return pos && viewport.unproject(pos); } // Calculate a new lnglat based on pixel dragging position }, { key: '_calculateNewLngLat', value: function _calculateNewLngLat(_ref8) { var startPanLngLat = _ref8.startPanLngLat, pos = _ref8.pos; var viewport = new _viewportMercatorProject2.default(this._viewportProps); return viewport.getMapCenterByLngLatPosition({ lngLat: startPanLngLat, pos: pos }); } // Calculates new zoom }, { key: '_calculateNewZoom', value: function _calculateNewZoom(_ref9) { var scale = _ref9.scale, startZoom = _ref9.startZoom; var _viewportProps3 = this._viewportProps, maxZoom = _viewportProps3.maxZoom, minZoom = _viewportProps3.minZoom; var zoom = startZoom + Math.log2(scale); return clamp(zoom, minZoom, maxZoom); } // Calculates a new pitch and bearing from a position (coming from an event) }, { key: '_calculateNewPitchAndBearing', value: function _calculateNewPitchAndBearing(_ref10) { var deltaScaleX = _ref10.deltaScaleX, deltaScaleY = _ref10.deltaScaleY, startBearing = _ref10.startBearing, startPitch = _ref10.startPitch; // clamp deltaScaleY to [-1, 1] so that rotation is constrained between minPitch and maxPitch. // deltaScaleX does not need to be clamped as bearing does not have constraints. deltaScaleY = clamp(deltaScaleY, -1, 1); var _viewportProps4 = this._viewportProps, minPitch = _viewportProps4.minPitch, maxPitch = _viewportProps4.maxPitch; var bearing = startBearing + 180 * deltaScaleX; var pitch = startPitch; if (deltaScaleY > 0) { // Gradually increase pitch pitch = startPitch + deltaScaleY * (maxPitch - startPitch); } else if (deltaScaleY < 0) { // Gradually decrease pitch pitch = startPitch - deltaScaleY * (minPitch - startPitch); } return { pitch: pitch, bearing: bearing }; } }]); return MapState; }(_viewState2.default); exports.default = MapState; /***/ }), /* 83 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _luma = __webpack_require__(12); var _project = __webpack_require__(344); var _project2 = _interopRequireDefault(_project); var _projectDeprecated = __webpack_require__(334); var _projectDeprecated2 = _interopRequireDefault(_projectDeprecated); var _viewportUniforms = __webpack_require__(345); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var INITIAL_MODULE_OPTIONS = {}; function getUniforms() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_MODULE_OPTIONS; if (opts.viewport) { return (0, _viewportUniforms.getUniformsFromViewport)(opts); } return {}; } exports.default = { name: 'project', dependencies: [_luma.fp32], vs: '' + _project2.default + _projectDeprecated2.default, getUniforms: getUniforms, deprecations: [ // Removed custom picking uinforms // These don't really belong here but we need to check them for all shaders // the project module is by default included for all { type: 'uniform vec3', old: 'selectedPickingColor', new: "luma.gl's picking module" }, { type: 'uniform float', old: 'renderPickingBuffer', new: "luma.gl's picking module" }, { type: 'uniform float', old: 'pickingEnabled', new: "luma.gl's picking module" }, // Removed project uniforms { type: 'uniform float', old: 'projectionMode', new: 'project_uCoordinateSystem' }, { type: 'uniform vec4', old: 'projectionCenter', new: 'project_uCenter' }, { type: 'uniform vec2', old: 'projectionOrigin' }, { type: 'uniform mat4', old: 'modelMatrix', new: 'project_uModelMatrix' }, { type: 'uniform mat4', old: 'viewMatrix' }, { type: 'uniform mat4', old: 'projectionMatrix', new: 'project_uViewProjectionMatrix' }, { type: 'uniform vec3', old: 'projectionPixelsPerUnit', new: 'project_uPixelsPerUnit' }, { type: 'uniform float', old: 'projectionScale', new: 'project_uScale' }, { type: 'uniform vec2', old: 'viewportSize', new: 'project_uViewportSize' }, { type: 'uniform float', old: 'devicePixelRatio', new: 'project_uDevicePixelRatio' }, { type: 'uniform vec3', old: 'cameraPos', new: 'project_uCameraPosition' }, // Deprecated project functions { type: 'function', old: 'scale', new: 'project_scale', deprecated: 1 }, { type: 'function', old: 'preproject', new: 'project_position', deprecated: 1 }, { type: 'function', old: 'project', new: 'project_to_clipspace', deprecated: 1 }] }; /***/ }), /* 84 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.lerp = lerp; exports.isValid = isValid; exports.getEndValueByShortestPath = getEndValueByShortestPath; exports.extractViewportFrom = extractViewportFrom; var _mathUtils = __webpack_require__(127); var VIEWPORT_PROPS = ['width', 'height', 'longitude', 'latitude', 'zoom', 'bearing', 'pitch', 'position']; var WRAPPED_ANGULAR_PROPS = { longitude: 1, bearing: 1 }; function lerp(start, end, step) { if (Array.isArray(start)) { return start.map(function (element, index) { return lerp(element, end[index], step); }); } return step * end + (1 - step) * start; } function isValid(prop) { return Number.isFinite(prop) || Array.isArray(prop); } function isWrappedAngularProp(propName) { return WRAPPED_ANGULAR_PROPS[propName]; } function getEndValueByShortestPath(propName, startValue, endValue) { if (isWrappedAngularProp(propName) && Math.abs(endValue - startValue) > 180) { endValue = endValue < 0 ? endValue + 360 : endValue - 360; } return endValue; } // TODO/xiaoji: This should be merged with the controller's prop constraint system function extractViewportFrom(props) { var viewport = {}; VIEWPORT_PROPS.forEach(function (key) { var value = props[key]; if (isValid(value)) { viewport[key] = value; // Normalize longitude and bearing into [-180, 180) range // This gurantees the props are in same range when they are interpolated. if (isWrappedAngularProp(key)) { viewport[key] = (0, _mathUtils.mod)(value + 180, 360) - 180; } } }); return viewport; } /***/ }), /* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _mathUtils = __webpack_require__(127); var _multiply = __webpack_require__(75); var _multiply2 = _interopRequireDefault(_multiply); var _lookAt = __webpack_require__(102); var _lookAt2 = _interopRequireDefault(_lookAt); var _scale = __webpack_require__(77); var _scale2 = _interopRequireDefault(_scale); var _perspective = __webpack_require__(76); var _perspective2 = _interopRequireDefault(_perspective); var _translate = __webpack_require__(78); var _translate2 = _interopRequireDefault(_translate); var _rotateX = __webpack_require__(157); var _rotateX2 = _interopRequireDefault(_rotateX); var _rotateY = __webpack_require__(235); var _rotateY2 = _interopRequireDefault(_rotateY); var _rotateZ = __webpack_require__(158); var _rotateZ2 = _interopRequireDefault(_rotateZ); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var DEGREES_TO_RADIANS = Math.PI / 180; /* * A deck.gl Viewport class used by OrbitController * Adds zoom and pixel translation on top of the PerspectiveViewport */ var OrbitViewport = function (_Viewport) { _inherits(OrbitViewport, _Viewport); function OrbitViewport(_ref) { var _ref$id = _ref.id, id = _ref$id === undefined ? 'orbit-viewport' : _ref$id, width = _ref.width, height = _ref.height, distance = _ref.distance, _ref$rotationX = _ref.rotationX, rotationX = _ref$rotationX === undefined ? 0 : _ref$rotationX, _ref$rotationOrbit = _ref.rotationOrbit, rotationOrbit = _ref$rotationOrbit === undefined ? 0 : _ref$rotationOrbit, _ref$orbitAxis = _ref.orbitAxis, orbitAxis = _ref$orbitAxis === undefined ? 'Z' : _ref$orbitAxis, _ref$lookAt = _ref.lookAt, lookAt = _ref$lookAt === undefined ? [0, 0, 0] : _ref$lookAt, _ref$up = _ref.up, up = _ref$up === undefined ? [0, 1, 0] : _ref$up, _ref$fov = _ref.fov, fov = _ref$fov === undefined ? 75 : _ref$fov, _ref$near = _ref.near, near = _ref$near === undefined ? 1 : _ref$near, _ref$far = _ref.far, far = _ref$far === undefined ? 100 : _ref$far, _ref$zoom = _ref.zoom, zoom = _ref$zoom === undefined ? 1 : _ref$zoom; _classCallCheck(this, OrbitViewport); var rotationMatrix = (0, _rotateX2.default)([], (0, _mathUtils.createMat4)(), -rotationX / 180 * Math.PI); if (orbitAxis === 'Z') { (0, _rotateZ2.default)(rotationMatrix, rotationMatrix, -rotationOrbit / 180 * Math.PI); } else { (0, _rotateY2.default)(rotationMatrix, rotationMatrix, -rotationOrbit / 180 * Math.PI); } var translateMatrix = (0, _mathUtils.createMat4)(); (0, _scale2.default)(translateMatrix, translateMatrix, [zoom, zoom, zoom]); (0, _translate2.default)(translateMatrix, translateMatrix, [-lookAt[0], -lookAt[1], -lookAt[2]]); var viewMatrix = (0, _lookAt2.default)([], [0, 0, distance], [0, 0, 0], up); var fovRadians = fov * DEGREES_TO_RADIANS; var aspect = width / height; var perspectiveMatrix = (0, _perspective2.default)([], fovRadians, aspect, near, far); var _this = _possibleConstructorReturn(this, (OrbitViewport.__proto__ || Object.getPrototypeOf(OrbitViewport)).call(this, { id: id, viewMatrix: (0, _multiply2.default)(viewMatrix, viewMatrix, (0, _multiply2.default)(rotationMatrix, rotationMatrix, translateMatrix)), projectionMatrix: perspectiveMatrix, width: width, height: height })); _this.width = width; _this.height = height; _this.distance = distance; _this.rotationX = rotationX; _this.rotationOrbit = rotationOrbit; _this.orbitAxis = orbitAxis; _this.lookAt = lookAt; _this.up = up; _this.fov = fov; _this.near = near; _this.far = far; _this.zoom = zoom; return _this; } _createClass(OrbitViewport, [{ key: 'project', value: function project(xyz) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$topLeft = _ref2.topLeft, topLeft = _ref2$topLeft === undefined ? false : _ref2$topLeft; var v = (0, _mathUtils.transformVector)(this.pixelProjectionMatrix, [].concat(_toConsumableArray(xyz), [1])); var _v = _slicedToArray(v, 3), x = _v[0], y = _v[1], z = _v[2]; var y2 = topLeft ? this.height - y : y; return [x, y2, z]; } }, { key: 'unproject', value: function unproject(xyz) { var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref3$topLeft = _ref3.topLeft, topLeft = _ref3$topLeft === undefined ? false : _ref3$topLeft; var _xyz = _slicedToArray(xyz, 3), x = _xyz[0], y = _xyz[1], z = _xyz[2]; var y2 = topLeft ? this.height - y : y; return (0, _mathUtils.transformVector)(this.pixelUnprojectionMatrix, [x, y2, z, 1]); } /** Move camera to make a model bounding box centered at lookat position fit in the viewport. * @param {Array} sizes - [sizeX, sizeY, sizeZ]], define the dimensions of bounding box * @returns a new OrbitViewport object */ }, { key: 'fitBounds', value: function fitBounds(sizes) { var width = this.width, height = this.height, rotationX = this.rotationX, rotationOrbit = this.rotationOrbit, orbitAxis = this.orbitAxis, lookAt = this.lookAt, up = this.up, fov = this.fov, near = this.near, far = this.far, zoom = this.zoom; var size = Math.max(sizes[0], sizes[1], sizes[2]) / 2; var newDistance = size;//size / Math.tan(fov / 180 * Math.PI / 2); return new OrbitViewport({ width: width, height: height, rotationX: rotationX, rotationOrbit: rotationOrbit, orbitAxis: orbitAxis, up: up, fov: fov, near: near, far: far, zoom: zoom, lookAt: lookAt, distance: newDistance }); } }]); return OrbitViewport; }(_viewport2.default); exports.default = OrbitViewport; OrbitViewport.displayName = 'OrbitViewport'; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _viewportMercatorProject = __webpack_require__(79); var _add = __webpack_require__(159); var _add2 = _interopRequireDefault(_add); var _negate = __webpack_require__(160); var _negate2 = _interopRequireDefault(_negate); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // View and Projection Matrix calculations for mapbox-js style // map view properties // TODO - import from viewport-mercator-project // import {fitBounds} from '../viewport-mercator-project/fit-bounds'; // TODO - import from math.gl /* eslint-disable camelcase */ var ERR_ARGUMENT = 'Illegal argument to WebMercatorViewport'; var WebMercatorViewport = function (_Viewport) { _inherits(WebMercatorViewport, _Viewport); /** * @classdesc * Creates view/projection matrices from mercator params * Note: The Viewport is immutable in the sense that it only has accessors. * A new viewport instance should be created if any parameters have changed. */ /* eslint-disable complexity, max-statements */ function WebMercatorViewport() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, WebMercatorViewport); var _opts$latitude = opts.latitude, latitude = _opts$latitude === undefined ? 0 : _opts$latitude, _opts$longitude = opts.longitude, longitude = _opts$longitude === undefined ? 0 : _opts$longitude, _opts$zoom = opts.zoom, zoom = _opts$zoom === undefined ? 11 : _opts$zoom, _opts$pitch = opts.pitch, pitch = _opts$pitch === undefined ? 0 : _opts$pitch, _opts$bearing = opts.bearing, bearing = _opts$bearing === undefined ? 0 : _opts$bearing, _opts$farZMultiplier = opts.farZMultiplier, farZMultiplier = _opts$farZMultiplier === undefined ? 10 : _opts$farZMultiplier; var width = opts.width, height = opts.height, _opts$altitude = opts.altitude, //iclient isGeographicCoordinateSystem= opts.isGeographicCoordinateSystem, altitude = _opts$altitude === undefined ? 1.5 : _opts$altitude; // Silently allow apps to send in 0,0 to facilitate isomorphic render etc width = width || 1; height = height || 1; // Altitude - prevent division by 0 // TODO - just throw an Error instead? altitude = Math.max(0.75, altitude); var projectionMatrix = (0, _viewportMercatorProject.getProjectionMatrix)({ width: width, height: height, pitch: pitch, altitude: altitude, farZMultiplier: farZMultiplier }); // The uncentered matrix allows us two move the center addition to the // shader (cheap) which gives a coordinate system that has its center in // the layer's center position. This makes rotations and other modelMatrx // transforms much more useful. var viewMatrixUncentered = (0, _viewportMercatorProject.getViewMatrix)({ height: height, pitch: pitch, bearing: bearing, altitude: altitude }); // Save parameters var _this = _possibleConstructorReturn(this, (WebMercatorViewport.__proto__ || Object.getPrototypeOf(WebMercatorViewport)).call(this, Object.assign({}, opts, { // x, y, position, ... // TODO / hack - prevent vertical offsets if not FirstPersonViewport position: opts.position && [opts.position[0], opts.position[1], 0], width: width, height: height, viewMatrix: viewMatrixUncentered, longitude: longitude, latitude: latitude, zoom: zoom, projectionMatrix: projectionMatrix, //iclient isGeographicCoordinateSystem:isGeographicCoordinateSystem, focalDistance: 1 // Viewport is already carefully set up to "focus" on ground }))); _this.latitude = latitude; _this.longitude = longitude; _this.zoom = zoom; _this.pitch = pitch; _this.bearing = bearing; _this.altitude = altitude; // Bind methods _this.metersToLngLatDelta = _this.metersToLngLatDelta.bind(_this); _this.lngLatDeltaToMeters = _this.lngLatDeltaToMeters.bind(_this); _this.addMetersToLngLat = _this.addMetersToLngLat.bind(_this); Object.freeze(_this); return _this; } /* eslint-enable complexity, max-statements */ /** * Project [lng,lat] on sphere onto [x,y] on 512*512 Mercator Zoom 0 tile. * Performs the nonlinear part of the web mercator projection. * Remaining projection is done with 4x4 matrices which also handles * perspective. * * @param {Array} lngLat - [lng, lat] coordinates * Specifies a point on the sphere to project onto the map. * @return {Array} [x,y] coordinates. */ _createClass(WebMercatorViewport, [{ key: '_projectFlat', value: function _projectFlat(lngLat) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return (0, _viewportMercatorProject.lngLatToWorld)(lngLat, scale,this.isGeographicCoordinateSystem); } /** * Unproject world point [x,y] on map onto {lat, lon} on sphere * * @param {object|Vector} xy - object with {x,y} members * representing point on projected map plane * @return {GeoCoordinates} - object with {lat,lon} of point on sphere. * Has toArray method if you need a GeoJSON Array. * Per cartographic tradition, lat and lon are specified as degrees. */ }, { key: '_unprojectFlat', value: function _unprojectFlat(xy) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return (0, _viewportMercatorProject.worldToLngLat)(xy, scale,this.isGeographicCoordinateSystem); } /** * Converts a meter offset to a lnglat offset * * Note: Uses simple linear approximation around the viewport center * Error increases with size of offset (roughly 1% per 100km) * * @param {[Number,Number]|[Number,Number,Number]) xyz - array of meter deltas * @return {[Number,Number]|[Number,Number,Number]) - array of [lng,lat,z] deltas */ }, { key: 'metersToLngLatDelta', value: function metersToLngLatDelta(xyz) { var _xyz = _slicedToArray(xyz, 3), x = _xyz[0], y = _xyz[1], _xyz$ = _xyz[2], z = _xyz$ === undefined ? 0 : _xyz$; (0, _assert2.default)(Number.isFinite(x) && Number.isFinite(y) && Number.isFinite(z), ERR_ARGUMENT); var _distanceScales = this.distanceScales, pixelsPerMeter = _distanceScales.pixelsPerMeter, degreesPerPixel = _distanceScales.degreesPerPixel; var deltaLng = x * pixelsPerMeter[0] * degreesPerPixel[0]; var deltaLat = y * pixelsPerMeter[1] * degreesPerPixel[1]; return xyz.length === 2 ? [deltaLng, deltaLat] : [deltaLng, deltaLat, z]; } /** * Converts a lnglat offset to a meter offset * * Note: Uses simple linear approximation around the viewport center * Error increases with size of offset (roughly 1% per 100km) * * @param {[Number,Number]|[Number,Number,Number]) deltaLngLatZ - array of [lng,lat,z] deltas * @return {[Number,Number]|[Number,Number,Number]) - array of meter deltas */ }, { key: 'lngLatDeltaToMeters', value: function lngLatDeltaToMeters(deltaLngLatZ) { var _deltaLngLatZ = _slicedToArray(deltaLngLatZ, 3), deltaLng = _deltaLngLatZ[0], deltaLat = _deltaLngLatZ[1], _deltaLngLatZ$ = _deltaLngLatZ[2], deltaZ = _deltaLngLatZ$ === undefined ? 0 : _deltaLngLatZ$; (0, _assert2.default)(Number.isFinite(deltaLng) && Number.isFinite(deltaLat) && Number.isFinite(deltaZ), ERR_ARGUMENT); var _distanceScales2 = this.distanceScales, pixelsPerDegree = _distanceScales2.pixelsPerDegree, metersPerPixel = _distanceScales2.metersPerPixel; var deltaX = deltaLng * pixelsPerDegree[0] * metersPerPixel[0]; var deltaY = deltaLat * pixelsPerDegree[1] * metersPerPixel[1]; return deltaLngLatZ.length === 2 ? [deltaX, deltaY] : [deltaX, deltaY, deltaZ]; } /** * Add a meter delta to a base lnglat coordinate, returning a new lnglat array * * Note: Uses simple linear approximation around the viewport center * Error increases with size of offset (roughly 1% per 100km) * * @param {[Number,Number]|[Number,Number,Number]) lngLatZ - base coordinate * @param {[Number,Number]|[Number,Number,Number]) xyz - array of meter deltas * @return {[Number,Number]|[Number,Number,Number]) array of [lng,lat,z] deltas */ }, { key: 'addMetersToLngLat', value: function addMetersToLngLat(lngLatZ, xyz) { var _lngLatZ = _slicedToArray(lngLatZ, 3), lng = _lngLatZ[0], lat = _lngLatZ[1], _lngLatZ$ = _lngLatZ[2], Z = _lngLatZ$ === undefined ? 0 : _lngLatZ$; var _metersToLngLatDelta = this.metersToLngLatDelta(xyz), _metersToLngLatDelta2 = _slicedToArray(_metersToLngLatDelta, 3), deltaLng = _metersToLngLatDelta2[0], deltaLat = _metersToLngLatDelta2[1], _metersToLngLatDelta3 = _metersToLngLatDelta2[2], deltaZ = _metersToLngLatDelta3 === undefined ? 0 : _metersToLngLatDelta3; return lngLatZ.length === 2 ? [lng + deltaLng, lat + deltaLat] : [lng + deltaLng, lat + deltaLat, Z + deltaZ]; } /** * Get the map center that place a given [lng, lat] coordinate at screen * point [x, y] * * @param {Array} lngLat - [lng,lat] coordinates * Specifies a point on the sphere. * @param {Array} pos - [x,y] coordinates * Specifies a point on the screen. * @return {Array} [lng,lat] new map center. */ }, { key: 'getMapCenterByLngLatPosition', value: function getMapCenterByLngLatPosition(_ref) { var lngLat = _ref.lngLat, pos = _ref.pos; var fromLocation = (0, _viewportMercatorProject.pixelsToWorld)(pos, this.pixelUnprojectionMatrix); var toLocation = (0, _viewportMercatorProject.lngLatToWorld)(lngLat, this.scale); var translate = (0, _add2.default)([], toLocation, (0, _negate2.default)([], fromLocation)); var newCenter = (0, _add2.default)([], this.center, translate); return (0, _viewportMercatorProject.worldToLngLat)(newCenter, this.scale,this.isGeographicCoordinateSystem); } // Legacy method name }, { key: 'getLocationAtPoint', value: function getLocationAtPoint(_ref2) { var lngLat = _ref2.lngLat, pos = _ref2.pos; return this.getMapCenterByLngLatPosition({ lngLat: lngLat, pos: pos }); } /** * Returns a new viewport that fit around the given rectangle. * Only supports non-perspective mode. * @param {Array} bounds - [[lon, lat], [lon, lat]] * @param {Number} [options.padding] - The amount of padding in pixels to add to the given bounds. * @param {Array} [options.offset] - The center of the given bounds relative to the map's center, * [x, y] measured in pixels. * @returns {WebMercatorViewport} */ }, { key: 'fitBounds', value: function fitBounds(bounds) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var width = this.width, height = this.height; var _fitBounds2 = (0, _viewportMercatorProject.fitBounds)(Object.assign({ width: width, height: height, bounds: bounds }, options)), longitude = _fitBounds2.longitude, latitude = _fitBounds2.latitude, zoom = _fitBounds2.zoom; return new WebMercatorViewport({ width: width, height: height, longitude: longitude, latitude: latitude, zoom: zoom }); } // TODO - should support user supplied constraints }, { key: 'isMapSynched', value: function isMapSynched() { var EPSILON = 0.000001; var MAPBOX_LIMITS = { pitch: 60, zoom: 40 }; var pitch = this.pitch, zoom = this.zoom; return pitch <= MAPBOX_LIMITS.pitch + EPSILON && zoom <= MAPBOX_LIMITS.zoom + EPSILON; } }]); return WebMercatorViewport; }(_viewport2.default); exports.default = WebMercatorViewport; WebMercatorViewport.displayName = 'WebMercatorViewport'; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(24); var toLength = __webpack_require__(11); var toAbsoluteIndex = __webpack_require__(57); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); var length = toLength(O.length); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare if (IS_INCLUDES && el != el) while (length > index) { value = O[index++]; // eslint-disable-next-line no-self-compare if (value != value) return true; // Array#indexOf ignores holes, Array#includes - not } else for (;length > index; index++) if (IS_INCLUDES || index in O) { if (O[index] === el) return IS_INCLUDES || index || 0; } return !IS_INCLUDES && -1; }; }; /***/ }), /* 88 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var $export = __webpack_require__(0); var redefine = __webpack_require__(20); var redefineAll = __webpack_require__(55); var meta = __webpack_require__(44); var forOf = __webpack_require__(49); var anInstance = __webpack_require__(48); var isObject = __webpack_require__(5); var fails = __webpack_require__(4); var $iterDetect = __webpack_require__(93); var setToStringTag = __webpack_require__(64); var inheritIfRequired = __webpack_require__(135); module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) { var Base = global[NAME]; var C = Base; var ADDER = IS_MAP ? 'set' : 'add'; var proto = C && C.prototype; var O = {}; var fixMethod = function (KEY) { var fn = proto[KEY]; redefine(proto, KEY, KEY == 'delete' ? function (a) { return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'has' ? function has(a) { return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a); } : KEY == 'get' ? function get(a) { return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a); } : KEY == 'add' ? function add(a) { fn.call(this, a === 0 ? 0 : a); return this; } : function set(a, b) { fn.call(this, a === 0 ? 0 : a, b); return this; } ); }; if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () { new C().entries().next(); }))) { // create collection constructor C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER); redefineAll(C.prototype, methods); meta.NEED = true; } else { var instance = new C(); // early implementations not supports chaining var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance; // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false var THROWS_ON_PRIMITIVES = fails(function () { instance.has(1); }); // most early implementations doesn't supports iterables, most modern - not close it correctly var ACCEPT_ITERABLES = $iterDetect(function (iter) { new C(iter); }); // eslint-disable-line no-new // for early implementations -0 and +0 not the same var BUGGY_ZERO = !IS_WEAK && fails(function () { // V8 ~ Chromium 42- fails only with 5+ elements var $instance = new C(); var index = 5; while (index--) $instance[ADDER](index, index); return !$instance.has(-0); }); if (!ACCEPT_ITERABLES) { C = wrapper(function (target, iterable) { anInstance(target, C, NAME); var that = inheritIfRequired(new Base(), target, C); if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); return that; }); C.prototype = proto; proto.constructor = C; } if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) { fixMethod('delete'); fixMethod('has'); IS_MAP && fixMethod('get'); } if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER); // weak collections should not contains .clear method if (IS_WEAK && proto.clear) delete proto.clear; } setToStringTag(C, NAME); O[NAME] = C; $export($export.G + $export.W + $export.F * (C != Base), O); if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP); return C; }; /***/ }), /* 89 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var hide = __webpack_require__(19); var redefine = __webpack_require__(20); var fails = __webpack_require__(4); var defined = __webpack_require__(34); var wks = __webpack_require__(6); module.exports = function (KEY, length, exec) { var SYMBOL = wks(KEY); var fns = exec(defined, SYMBOL, ''[KEY]); var strfn = fns[0]; var rxfn = fns[1]; if (fails(function () { var O = {}; O[SYMBOL] = function () { return 7; }; return ''[KEY](O) != 7; })) { redefine(String.prototype, KEY, strfn); hide(RegExp.prototype, SYMBOL, length == 2 // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue) // 21.2.5.11 RegExp.prototype[@@split](string, limit) ? function (string, arg) { return rxfn.call(string, this, arg); } // 21.2.5.6 RegExp.prototype[@@match](string) // 21.2.5.9 RegExp.prototype[@@search](string) : function (string) { return rxfn.call(string, this); } ); } }; /***/ }), /* 90 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.2.5.3 get RegExp.prototype.flags var anObject = __webpack_require__(2); module.exports = function () { var that = anObject(this); var result = ''; if (that.global) result += 'g'; if (that.ignoreCase) result += 'i'; if (that.multiline) result += 'm'; if (that.unicode) result += 'u'; if (that.sticky) result += 'y'; return result; }; /***/ }), /* 91 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.2 IsArray(argument) var cof = __webpack_require__(27); module.exports = Array.isArray || function isArray(arg) { return cof(arg) == 'Array'; }; /***/ }), /* 92 */ /***/ (function(module, exports, __webpack_require__) { // 7.2.8 IsRegExp(argument) var isObject = __webpack_require__(5); var cof = __webpack_require__(27); var MATCH = __webpack_require__(6)('match'); module.exports = function (it) { var isRegExp; return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp'); }; /***/ }), /* 93 */ /***/ (function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(6)('iterator'); var SAFE_CLOSING = false; try { var riter = [7][ITERATOR](); riter['return'] = function () { SAFE_CLOSING = true; }; // eslint-disable-next-line no-throw-literal Array.from(riter, function () { throw 2; }); } catch (e) { /* empty */ } module.exports = function (exec, skipClosing) { if (!skipClosing && !SAFE_CLOSING) return false; var safe = false; try { var arr = [7]; var iter = arr[ITERATOR](); iter.next = function () { return { done: safe = true }; }; arr[ITERATOR] = function () { return iter; }; exec(arr); } catch (e) { /* empty */ } return safe; }; /***/ }), /* 94 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // Forced replacement prototype accessors methods module.exports = __webpack_require__(50) || !__webpack_require__(4)(function () { var K = Math.random(); // In FF throws only define methods // eslint-disable-next-line no-undef, no-useless-call __defineSetter__.call(null, K, function () { /* empty */ }); delete __webpack_require__(3)[K]; }); /***/ }), /* 95 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), /* 96 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-setmap-offrom/ var $export = __webpack_require__(0); var aFunction = __webpack_require__(15); var ctx = __webpack_require__(28); var forOf = __webpack_require__(49); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { from: function from(source /* , mapFn, thisArg */) { var mapFn = arguments[1]; var mapping, A, n, cb; aFunction(this); mapping = mapFn !== undefined; if (mapping) aFunction(mapFn); if (source == undefined) return new this(); A = []; if (mapping) { n = 0; cb = ctx(mapFn, arguments[2], 2); forOf(source, false, function (nextItem) { A.push(cb(nextItem, n++)); }); } else { forOf(source, false, A.push, A); } return new this(A); } }); }; /***/ }), /* 97 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-setmap-offrom/ var $export = __webpack_require__(0); module.exports = function (COLLECTION) { $export($export.S, COLLECTION, { of: function of() { var length = arguments.length; var A = new Array(length); while (length--) A[length] = arguments[length]; return new this(A); } }); }; /***/ }), /* 98 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var SHARED = '__core-js_shared__'; var store = global[SHARED] || (global[SHARED] = {}); module.exports = function (key) { return store[key] || (store[key] = {}); }; /***/ }), /* 99 */ /***/ (function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) var anObject = __webpack_require__(2); var aFunction = __webpack_require__(15); var SPECIES = __webpack_require__(6)('species'); module.exports = function (O, D) { var C = anObject(O).constructor; var S; return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S); }; /***/ }), /* 100 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var hide = __webpack_require__(19); var uid = __webpack_require__(58); var TYPED = uid('typed_array'); var VIEW = uid('view'); var ABV = !!(global.ArrayBuffer && global.DataView); var CONSTR = ABV; var i = 0; var l = 9; var Typed; var TypedArrayConstructors = ( 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array' ).split(','); while (i < l) { if (Typed = global[TypedArrayConstructors[i++]]) { hide(Typed.prototype, TYPED, true); hide(Typed.prototype, VIEW, true); } else CONSTR = false; } module.exports = { ABV: ABV, CONSTR: CONSTR, TYPED: TYPED, VIEW: VIEW }; /***/ }), /* 101 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ /** * Use invariant() to assert state which your program assumes to be true. * * Provide sprintf-style format (only %s is supported) and arguments * to provide information about what broke and what you were * expecting. * * The invariant message will be stripped in production, but the invariant * will remain to ensure logic does not differ in production. */ var validateFormat = function validateFormat(format) {}; if (process.env.NODE_ENV !== 'production') { validateFormat = function validateFormat(format) { if (format === undefined) { throw new Error('invariant requires an error message argument'); } }; } function invariant(condition, format, a, b, c, d, e, f) { validateFormat(format); if (!condition) { var error; if (format === undefined) { error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); } else { var args = [a, b, c, d, e, f]; var argIndex = 0; error = new Error(format.replace(/%s/g, function () { return args[argIndex++]; })); error.name = 'Invariant Violation'; } error.framesToPop = 1; // we don't care about invariant's own frame throw error; } } module.exports = invariant; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26))) /***/ }), /* 102 */ /***/ (function(module, exports, __webpack_require__) { var identity = __webpack_require__(572); module.exports = lookAt; /** * Generates a look-at matrix with the given eye position, focal point, and up axis * * @param {mat4} out mat4 frustum matrix will be written into * @param {vec3} eye Position of the viewer * @param {vec3} center Point the viewer is looking at * @param {vec3} up vec3 pointing up * @returns {mat4} out */ function lookAt(out, eye, center, up) { var x0, x1, x2, y0, y1, y2, z0, z1, z2, len, eyex = eye[0], eyey = eye[1], eyez = eye[2], upx = up[0], upy = up[1], upz = up[2], centerx = center[0], centery = center[1], centerz = center[2]; if (Math.abs(eyex - centerx) < 0.000001 && Math.abs(eyey - centery) < 0.000001 && Math.abs(eyez - centerz) < 0.000001) { return identity(out); } z0 = eyex - centerx; z1 = eyey - centery; z2 = eyez - centerz; len = 1 / Math.sqrt(z0 * z0 + z1 * z1 + z2 * z2); z0 *= len; z1 *= len; z2 *= len; x0 = upy * z2 - upz * z1; x1 = upz * z0 - upx * z2; x2 = upx * z1 - upy * z0; len = Math.sqrt(x0 * x0 + x1 * x1 + x2 * x2); if (!len) { x0 = 0; x1 = 0; x2 = 0; } else { len = 1 / len; x0 *= len; x1 *= len; x2 *= len; } y0 = z1 * x2 - z2 * x1; y1 = z2 * x0 - z0 * x2; y2 = z0 * x1 - z1 * x0; len = Math.sqrt(y0 * y0 + y1 * y1 + y2 * y2); if (!len) { y0 = 0; y1 = 0; y2 = 0; } else { len = 1 / len; y0 *= len; y1 *= len; y2 *= len; } out[0] = x0; out[1] = y0; out[2] = z0; out[3] = 0; out[4] = x1; out[5] = y1; out[6] = z1; out[7] = 0; out[8] = x2; out[9] = y2; out[10] = z2; out[11] = 0; out[12] = -(x0 * eyex + x1 * eyey + x2 * eyez); out[13] = -(y0 * eyex + y1 * eyey + y2 * eyez); out[14] = -(z0 * eyex + z1 * eyey + z2 * eyez); out[15] = 1; return out; }; /***/ }), /* 103 */ /***/ (function(module, exports) { module.exports = transformMat4 /** * Transforms the vec4 with a mat4. * * @param {vec4} out the receiving vector * @param {vec4} a the vector to transform * @param {mat4} m matrix to transform with * @returns {vec4} out */ function transformMat4 (out, a, m) { var x = a[0], y = a[1], z = a[2], w = a[3] out[0] = m[0] * x + m[4] * y + m[8] * z + m[12] * w out[1] = m[1] * x + m[5] * y + m[9] * z + m[13] * w out[2] = m[2] * x + m[6] * y + m[10] * z + m[14] * w out[3] = m[3] * x + m[7] * y + m[11] * z + m[15] * w return out } /***/ }), /* 104 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl__ = __webpack_require__(61); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_uniforms__ = __webpack_require__(168); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__geometry_geometry__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__core_object_3d__ = __webpack_require__(250); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__shadertools_shaders__ = __webpack_require__(657); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__shadertools__ = __webpack_require__(642); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__debug_seer_integration__ = __webpack_require__(628); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__webgl_query__ = __webpack_require__(273); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint quotes: ["error", "single", { "allowTemplateLiterals": true }]*/ // A scenegraph object node // import {withParameters} from '../webgl/context-state'; var MSG_INSTANCED_PARAM_DEPRECATED = 'Warning: Model constructor: parameter "instanced" renamed to "isInstanced".\nThis will become a hard error in a future version of luma.gl.'; var ERR_MODEL_PARAMS = 'Model needs drawMode and vertexCount'; var LOG_DRAW_PRIORITY = 2; // These old picking uniforms should be avoided and we should use picking module // and set uniforms using Model class 'updateModuleSettings()' var DEPRECATED_PICKING_UNIFORMS = ['renderPickingBuffer', 'pickingEnabled']; // Model abstract O3D Class var Model = /*#__PURE__*/function (_Object3D) { _inherits(Model, _Object3D); function Model(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Model); var _this = _possibleConstructorReturn(this, (Model.__proto__ || Object.getPrototypeOf(Model)).call(this, opts)); __WEBPACK_IMPORTED_MODULE_9_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl__["isWebGL"])(gl)); _this.gl = gl; _this.init(opts); return _this; } /* eslint-disable max-statements */ /* eslint-disable complexity */ _createClass(Model, [{ key: 'init', value: function init() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$vs = _ref.vs, vs = _ref$vs === undefined ? null : _ref$vs, _ref$fs = _ref.fs, fs = _ref$fs === undefined ? null : _ref$fs, _ref$modules = _ref.modules, modules = _ref$modules === undefined ? null : _ref$modules, _ref$defines = _ref.defines, defines = _ref$defines === undefined ? {} : _ref$defines, _ref$moduleSettings = _ref.moduleSettings, moduleSettings = _ref$moduleSettings === undefined ? {} : _ref$moduleSettings, defaultUniforms = _ref.defaultUniforms, _ref$program = _ref.program, program = _ref$program === undefined ? null : _ref$program, _ref$shaderCache = _ref.shaderCache, shaderCache = _ref$shaderCache === undefined ? null : _ref$shaderCache, _ref$isInstanced = _ref.isInstanced, isInstanced = _ref$isInstanced === undefined ? false : _ref$isInstanced, instanced = _ref.instanced, _ref$vertexCount = _ref.vertexCount, vertexCount = _ref$vertexCount === undefined ? undefined : _ref$vertexCount, _ref$instanceCount = _ref.instanceCount, instanceCount = _ref$instanceCount === undefined ? 0 : _ref$instanceCount, drawMode = _ref.drawMode, _ref$uniforms = _ref.uniforms, uniforms = _ref$uniforms === undefined ? {} : _ref$uniforms, _ref$attributes = _ref.attributes, attributes = _ref$attributes === undefined ? {} : _ref$attributes, _ref$geometry = _ref.geometry, geometry = _ref$geometry === undefined ? null : _ref$geometry, _ref$pickable = _ref.pickable, pickable = _ref$pickable === undefined ? true : _ref$pickable, _ref$pick = _ref.pick, pick = _ref$pick === undefined ? null : _ref$pick, _ref$render = _ref.render, render = _ref$render === undefined ? null : _ref$render, _ref$onBeforeRender = _ref.onBeforeRender, onBeforeRender = _ref$onBeforeRender === undefined ? function () {} : _ref$onBeforeRender, _ref$onAfterRender = _ref.onAfterRender, onAfterRender = _ref$onAfterRender === undefined ? function () {} : _ref$onAfterRender, _ref$varyings = _ref.varyings, varyings = _ref$varyings === undefined ? null : _ref$varyings, _ref$bufferMode = _ref.bufferMode, bufferMode = _ref$bufferMode === undefined ? __WEBPACK_IMPORTED_MODULE_0__webgl__["GL"].SEPARATE_ATTRIBS : _ref$bufferMode, _ref$timerQueryEnable = _ref.timerQueryEnabled, timerQueryEnabled = _ref$timerQueryEnable === undefined ? false : _ref$timerQueryEnable; this._initializeProgram({ vs: vs, fs: fs, modules: modules, defines: defines, moduleSettings: moduleSettings, defaultUniforms: defaultUniforms, program: program, shaderCache: shaderCache, varyings: varyings, bufferMode: bufferMode }); this.uniforms = {}; // Make sure we have some reasonable default uniforms in place uniforms = Object.assign({}, this.program.defaultUniforms, uniforms); this.setUniforms(uniforms); // Get all default uniforms this.setUniforms(this.getModuleUniforms()); // Get unforms for supplied parameters this.setUniforms(this.getModuleUniforms(moduleSettings)); if (instanced) { /* global console */ /* eslint-disable no-console */ console.warn(MSG_INSTANCED_PARAM_DEPRECATED); isInstanced = isInstanced || instanced; } // TODO - remove? this.buffers = {}; this.samplers = {}; this.userData = {}; this.drawParams = {}; this.dynamic = false; this.needsRedraw = true; // Attributes and buffers if (geometry) { this.setGeometry(geometry); } this.attributes = {}; this.setAttributes(attributes); // geometry might have set drawMode and vertexCount if (drawMode !== undefined) { this.drawMode = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__geometry_geometry__["b" /* getDrawMode */])(drawMode); } if (vertexCount !== undefined) { this.vertexCount = vertexCount; } this.isInstanced = isInstanced; this.instanceCount = instanceCount; // picking options this.pickable = Boolean(pickable); this.pick = pick || function () { return false; }; this.onBeforeRender = onBeforeRender; this.onAfterRender = onAfterRender; // assert(program || program instanceof Program); __WEBPACK_IMPORTED_MODULE_9_assert___default()(this.drawMode !== undefined && Number.isFinite(this.vertexCount), ERR_MODEL_PARAMS); this.timerQueryEnabled = timerQueryEnabled && __WEBPACK_IMPORTED_MODULE_8__webgl_query__["a" /* default */].isSupported(this.gl, { timer: true }); this.timeElapsedQuery = undefined; this.lastQueryReturned = true; this.stats = { accumulatedFrameTime: 0, averageFrameTime: 0, profileFrameCount: 0 }; } /* eslint-enable max-statements */ }, { key: 'delete', value: function _delete() { this.program.delete(); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__debug_seer_integration__["a" /* removeModel */])(this.id); } }, { key: 'destroy', value: function destroy() { this.delete(); } }, { key: 'setNeedsRedraw', value: function setNeedsRedraw() { var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.needsRedraw = redraw; return this; } }, { key: 'getNeedsRedraw', value: function getNeedsRedraw() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$clearRedrawFlag = _ref2.clearRedrawFlags, clearRedrawFlags = _ref2$clearRedrawFlag === undefined ? false : _ref2$clearRedrawFlag; var redraw = false; redraw = redraw || this.needsRedraw; this.needsRedraw = this.needsRedraw && !clearRedrawFlags; redraw = redraw || this.geometry.getNeedsRedraw({ clearRedrawFlags: clearRedrawFlags }); return redraw; } }, { key: 'setDrawMode', value: function setDrawMode(drawMode) { this.drawMode = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__geometry_geometry__["b" /* getDrawMode */])(drawMode); return this; } }, { key: 'getDrawMode', value: function getDrawMode() { return this.drawMode; } }, { key: 'setVertexCount', value: function setVertexCount(vertexCount) { __WEBPACK_IMPORTED_MODULE_9_assert___default()(Number.isFinite(vertexCount)); this.vertexCount = vertexCount; return this; } }, { key: 'getVertexCount', value: function getVertexCount() { return this.vertexCount; } }, { key: 'setInstanceCount', value: function setInstanceCount(instanceCount) { __WEBPACK_IMPORTED_MODULE_9_assert___default()(Number.isFinite(instanceCount)); this.instanceCount = instanceCount; return this; } }, { key: 'getInstanceCount', value: function getInstanceCount() { return this.instanceCount; } }, { key: 'getProgram', value: function getProgram() { return this.program; } }, { key: 'setGeometry', // TODO - just set attributes, don't hold on to geometry value: function setGeometry(geometry) { this.geometry = geometry; this.vertexCount = geometry.getVertexCount(); this.drawMode = geometry.drawMode; this._createBuffersFromAttributeDescriptors(this.geometry.getAttributes()); this.setNeedsRedraw(); return this; } }, { key: 'getAttributes', value: function getAttributes() { return this.attributes; } }, { key: 'setAttributes', value: function setAttributes() { var attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // Reutrn early if no attributes to set. if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__utils__["f" /* isObjectEmpty */])(attributes)) { return this; } Object.assign(this.attributes, attributes); this._createBuffersFromAttributeDescriptors(attributes); this.setNeedsRedraw(); return this; } }, { key: 'getUniforms', value: function getUniforms() { return this.uniforms; } // TODO - should actually set the uniforms }, { key: 'setUniforms', value: function setUniforms() { var uniforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; // TODO: we are still setting these uniforms in deck.gl so we don't break any external // application, these are marked deprecated in 5.0, remove them in deck.gl in 6.0. // Disabling since it gets too noisy in console, these are documented as deprecated. // this._checkForDeprecatedUniforms(uniforms); var somethingChanged = false; for (var key in uniforms) { if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_uniforms__["d" /* areUniformsEqual */])(this.uniforms[key], uniforms[key])) { somethingChanged = true; break; } } if (somethingChanged) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl__["checkUniformValues"])(uniforms, this.id); Object.assign(this.uniforms, uniforms); this.setNeedsRedraw(); } return this; } // getModuleUniforms (already on object) }, { key: 'updateModuleSettings', value: function updateModuleSettings(opts) { var uniforms = this.getModuleUniforms(opts); return this.setUniforms(uniforms); } }, { key: 'draw', value: function draw() { var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref3$moduleSettings = _ref3.moduleSettings, moduleSettings = _ref3$moduleSettings === undefined ? null : _ref3$moduleSettings, _ref3$uniforms = _ref3.uniforms, uniforms = _ref3$uniforms === undefined ? {} : _ref3$uniforms, _ref3$attributes = _ref3.attributes, attributes = _ref3$attributes === undefined ? {} : _ref3$attributes, _ref3$samplers = _ref3.samplers, samplers = _ref3$samplers === undefined ? {} : _ref3$samplers, _ref3$parameters = _ref3.parameters, parameters = _ref3$parameters === undefined ? {} : _ref3$parameters, settings = _ref3.settings, _ref3$framebuffer = _ref3.framebuffer, framebuffer = _ref3$framebuffer === undefined ? null : _ref3$framebuffer, _ref3$vertexArray = _ref3.vertexArray, vertexArray = _ref3$vertexArray === undefined ? null : _ref3$vertexArray, _ref3$transformFeedba = _ref3.transformFeedback, transformFeedback = _ref3$transformFeedba === undefined ? null : _ref3$transformFeedba; if (settings) { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].deprecated('settings', 'parameters'); parameters = settings; } if (moduleSettings) { this.updateModuleSettings(moduleSettings); } if (framebuffer) { parameters = Object.assign(parameters, { framebuffer: framebuffer }); } this.render(uniforms, attributes, samplers, transformFeedback, parameters, vertexArray); if (framebuffer) { framebuffer.log({ priority: LOG_DRAW_PRIORITY, message: 'Rendered to ' + framebuffer.id }); } return this; } /* eslint-disable max-params */ }, { key: 'render', value: function render() { var uniforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var attributes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var samplers = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var transformFeedback = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; var parameters = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; var vertexArray = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__debug_seer_integration__["b" /* addModel */])(this); var resolvedUniforms = this.addViewUniforms(uniforms); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__debug_seer_integration__["c" /* getOverrides */])(this.id, resolvedUniforms); this.setUniforms(resolvedUniforms); this.setAttributes(attributes); Object.assign(this.samplers, samplers); __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].group(LOG_DRAW_PRIORITY, '>>> RENDERING MODEL ' + this.id, { collapsed: __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].priority <= 2 }); this.setProgramState({ vertexArray: vertexArray }); this._logAttributesAndUniforms(2, resolvedUniforms); this.onBeforeRender(); var drawParams = this.drawParams; if (drawParams.isInstanced && !this.isInstanced) { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].warn('Found instanced attributes on non-instanced model'); } var isIndexed = drawParams.isIndexed, indexType = drawParams.indexType; var isInstanced = this.isInstanced, instanceCount = this.instanceCount; this._timerQueryStart(); this.program.draw({ parameters: parameters, drawMode: this.getDrawMode(), vertexCount: this.getVertexCount(), vertexArray: vertexArray, transformFeedback: transformFeedback, isIndexed: isIndexed, indexType: indexType, isInstanced: isInstanced, instanceCount: instanceCount }); this._timerQueryEnd(); this.onAfterRender(); this.unsetProgramState(); this.setNeedsRedraw(false); __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].groupEnd(LOG_DRAW_PRIORITY, '>>> RENDERING MODEL ' + this.id); return this; } /* eslint-enable max-params */ }, { key: 'setProgramState', value: function setProgramState() { var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref4$vertexArray = _ref4.vertexArray, vertexArray = _ref4$vertexArray === undefined ? null : _ref4$vertexArray; var program = this.program; program.use(); this.drawParams = {}; program.setBuffers(this.buffers, { drawParams: this.drawParams }); program.checkAttributeBindings({ vertexArray: vertexArray }); program.setUniforms(this.uniforms, this.samplers); return this; } }, { key: 'unsetProgramState', value: function unsetProgramState() { // Ensures all vertex attributes are disabled and ELEMENT_ARRAY_BUFFER // is unbound this.program.unsetBuffers(); return this; } // DEPRECATED METHODS // TODO - uniform names are too strongly linked camera <=> default shaders // At least all special handling is collected here. }, { key: 'addViewUniforms', value: function addViewUniforms(uniforms) { // TODO - special treatment of these parameters should be removed var camera = uniforms.camera, viewMatrix = uniforms.viewMatrix, modelMatrix = uniforms.modelMatrix; // Camera exposes uniforms that can be used directly in shaders var cameraUniforms = camera ? camera.getUniforms() : {}; var viewUniforms = viewMatrix ? this.getCoordinateUniforms(viewMatrix, modelMatrix) : {}; return Object.assign({}, uniforms, cameraUniforms, viewUniforms); } // PRIVATE METHODS }, { key: '_initializeProgram', value: function _initializeProgram(_ref5) { var vs = _ref5.vs, fs = _ref5.fs, modules = _ref5.modules, defines = _ref5.defines, moduleSettings = _ref5.moduleSettings, defaultUniforms = _ref5.defaultUniforms, program = _ref5.program, shaderCache = _ref5.shaderCache, varyings = _ref5.varyings, bufferMode = _ref5.bufferMode; this.getModuleUniforms = function (x) {}; if (!program) { // Assign default shaders if none are provided if (!vs) { vs = __WEBPACK_IMPORTED_MODULE_5__shadertools_shaders__["a" /* MODULAR_SHADERS */].vs; } if (!fs) { fs = __WEBPACK_IMPORTED_MODULE_5__shadertools_shaders__["a" /* MODULAR_SHADERS */].fs; } var assembleResult = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_6__shadertools__["a" /* assembleShaders */])(this.gl, { vs: vs, fs: fs, modules: modules, defines: defines }); vs = assembleResult.vs; fs = assembleResult.fs; if (shaderCache) { program = shaderCache.getProgram(this.gl, { vs: vs, fs: fs, id: this.id }); } else { program = new __WEBPACK_IMPORTED_MODULE_0__webgl__["Program"](this.gl, { vs: vs, fs: fs, varyings: varyings, bufferMode: bufferMode }); } var getUniforms = assembleResult.getUniforms; this.getModuleUniforms = getUniforms || function (x) {}; } this.program = program; __WEBPACK_IMPORTED_MODULE_9_assert___default()(this.program instanceof __WEBPACK_IMPORTED_MODULE_0__webgl__["Program"], 'Model needs a program'); } /* eslint-enable complexity */ }, { key: '_checkForDeprecatedUniforms', value: function _checkForDeprecatedUniforms(uniforms) { // deprecated picking uniforms DEPRECATED_PICKING_UNIFORMS.forEach(function (uniform) { if (uniform in uniforms) { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].deprecated(uniform, 'use picking shader module and Model class updateModuleSettings()'); } }); } }, { key: '_timerQueryStart', value: function _timerQueryStart() { if (this.timerQueryEnabled === true) { if (!this.timeElapsedQuery) { this.timeElapsedQuery = new __WEBPACK_IMPORTED_MODULE_8__webgl_query__["a" /* default */](this.gl); } if (this.lastQueryReturned) { this.lastQueryReturned = false; this.timeElapsedQuery.beginTimeElapsedQuery(); } } } }, { key: '_timerQueryEnd', value: function _timerQueryEnd() { if (this.timerQueryEnabled === true) { this.timeElapsedQuery.end(); // TODO: Skip results if 'gl.getParameter(this.ext.GPU_DISJOINT_EXT)' returns false // should this be incorporated into Query object? if (this.timeElapsedQuery.isResultAvailable()) { this.lastQueryReturned = true; var elapsedTime = this.timeElapsedQuery.getResult(); // Update stats (e.g. for seer) this.stats.lastFrameTime = elapsedTime; this.stats.accumulatedFrameTime += elapsedTime; this.stats.profileFrameCount++; this.stats.averageFrameTime = this.stats.accumulatedFrameTime / this.stats.profileFrameCount; // Log stats __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].log(LOG_DRAW_PRIORITY, 'GPU time ' + this.program.id + ': ' + this.stats.lastFrameTime + 'ms average ' + this.stats.averageFrameTime + 'ms accumulated: ' + this.stats.accumulatedFrameTime + 'ms count: ' + this.stats.profileFrameCount); } } } // Makes sure buffers are created for all attributes // and that the program is updated with those buffers // TODO - do we need the separation between "attributes" and "buffers" // couldn't apps just create buffers directly? }, { key: '_createBuffersFromAttributeDescriptors', value: function _createBuffersFromAttributeDescriptors(attributes) { var gl = this.program.gl; for (var attributeName in attributes) { var attribute = attributes[attributeName]; if (attribute instanceof __WEBPACK_IMPORTED_MODULE_0__webgl__["Buffer"]) { this.buffers[attributeName] = attribute; } else if (attribute.isGeneric) { this.buffers[attributeName] = attribute.value; } else { // Autocreate a buffer this.buffers[attributeName] = this.buffers[attributeName] || new __WEBPACK_IMPORTED_MODULE_0__webgl__["Buffer"](gl, { target: attribute.isIndexed ? __WEBPACK_IMPORTED_MODULE_0__webgl__["GL"].ELEMENT_ARRAY_BUFFER : __WEBPACK_IMPORTED_MODULE_0__webgl__["GL"].ARRAY_BUFFER }); var buffer = this.buffers[attributeName]; buffer.setData({ data: attribute.value }).setDataLayout(attribute); } } return this; } }, { key: '_logAttributesAndUniforms', value: function _logAttributesAndUniforms(priority) { var uniforms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (__WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].priority >= priority) { var attributeTable = this._getAttributesTable({ header: this.id + ' attributes', program: this.program, attributes: Object.assign({}, this.geometry.attributes, this.attributes) }); __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].table(priority, attributeTable); var _getUniformsTable = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_uniforms__["e" /* getUniformsTable */])({ header: this.id + ' uniforms', program: this.program, uniforms: Object.assign({}, this.uniforms, uniforms) }), table = _getUniformsTable.table, unusedTable = _getUniformsTable.unusedTable, unusedCount = _getUniformsTable.unusedCount; __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].table(priority, table); __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].log(priority, (unusedCount || 'No') + ' unused uniforms ', unusedTable); } else { // Always log missing uniforms var _getUniformsTable2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_uniforms__["e" /* getUniformsTable */])({ header: this.id + ' uniforms', program: this.program, uniforms: Object.assign({}, this.uniforms, uniforms), undefinedOnly: true }), _table = _getUniformsTable2.table, count = _getUniformsTable2.count; if (count > 0) { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].table(priority, _table); } } __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__debug_seer_integration__["d" /* logModel */])(this, uniforms); } // Todo move to attributes manager }, { key: '_getAttributesTable', value: function _getAttributesTable() { var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, attributes = _ref6.attributes, _ref6$header = _ref6.header, header = _ref6$header === undefined ? 'Attributes' : _ref6$header, instanced = _ref6.instanced, program = _ref6.program; __WEBPACK_IMPORTED_MODULE_9_assert___default()(program); var attributeLocations = program._attributeLocations; var table = {}; // {[header]: {}}; // Add used attributes for (var attributeName in attributeLocations) { var attribute = attributes[attributeName]; var location = attributeLocations[attributeName]; table[attributeName] = this._getAttributeEntry(attribute, location, header); } // Add any unused attributes for (var _attributeName in attributes) { var _attribute = attributes[_attributeName]; if (!table[_attributeName]) { table[_attributeName] = this._getAttributeEntry(_attribute, null, header); } } return table; } }, { key: '_getAttributeEntry', value: function _getAttributeEntry(attribute, location, header) { var round = function round(num) { return Math.round(num * 10) / 10; }; var type = 'NOT PROVIDED'; var instanced = 0; var size = 'N/A'; var verts = 'N/A'; var bytes = 'N/A'; var value = 'N/A'; if (attribute && location === null) { location = attribute.isIndexed ? 'ELEMENT_ARRAY_BUFFER' : 'NOT USED'; } if (attribute instanceof __WEBPACK_IMPORTED_MODULE_0__webgl__["Buffer"]) { var buffer = attribute; type = buffer.layout.type; instanced = buffer.layout.instanced; size = buffer.layout.size; verts = round(buffer.data.length / buffer.layout.size); bytes = buffer.data.length * buffer.data.BYTES_PER_ELEMENT; } else if (attribute) { type = attribute.value.constructor.name; instanced = attribute.instanced; size = attribute.size; verts = round(attribute.value.length / attribute.size); bytes = attribute.value.length * attribute.value.BYTES_PER_ELEMENT; value = attribute.value; } // Generate a type name by dropping Array from Float32Array etc. type = String(type).replace('Array', ''); // Look for 'nt' to detect integer types, e.g. Int32Array, Uint32Array var isInteger = type.indexOf('nt') !== -1; return _defineProperty({ 'Inst/Verts/Comps/Bytes/Type/Loc': (instanced ? 'I ' : 'P ') + ' ' + verts + ' (x' + size + '=' + bytes + ' ' + type + ') loc=' + location }, header, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__utils__["c" /* formatValue */])(value, { size: size, isInteger: isInteger })); } // DEPRECATED / REMOVED }, { key: 'isPickable', value: function isPickable() { return this.pickable; } }, { key: 'setPickable', value: function setPickable() { var pickable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.pickable = Boolean(pickable); return this; } }, { key: 'getGeometry', value: function getGeometry() { return this.geometry; } }, { key: 'varyingMap', get: function get() { return this.program.varyingMap; } }]); return Model; }(__WEBPACK_IMPORTED_MODULE_3__core_object_3d__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Model); //# sourceMappingURL=model.js.map /***/ }), /* 105 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(45); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var TruncatedConeGeometry = /*#__PURE__*/function (_Geometry) { _inherits(TruncatedConeGeometry, _Geometry); // Primitives inspired by TDL http://code.google.com/p/webglsamples/, // copyright 2011 Google Inc. new BSD License // (http://www.opensource.org/licenses/bsd-license.php). /* eslint-disable max-statements, complexity */ function TruncatedConeGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, TruncatedConeGeometry); var _opts$bottomRadius = opts.bottomRadius, bottomRadius = _opts$bottomRadius === undefined ? 0 : _opts$bottomRadius, _opts$topRadius = opts.topRadius, topRadius = _opts$topRadius === undefined ? 0 : _opts$topRadius, _opts$height = opts.height, height = _opts$height === undefined ? 1 : _opts$height, _opts$nradial = opts.nradial, nradial = _opts$nradial === undefined ? 10 : _opts$nradial, _opts$nvertical = opts.nvertical, nvertical = _opts$nvertical === undefined ? 10 : _opts$nvertical, _opts$topCap = opts.topCap, topCap = _opts$topCap === undefined ? false : _opts$topCap, _opts$bottomCap = opts.bottomCap, bottomCap = _opts$bottomCap === undefined ? false : _opts$bottomCap; var extra = (topCap ? 2 : 0) + (bottomCap ? 2 : 0); var numVertices = (nradial + 1) * (nvertical + 1 + extra); var slant = Math.atan2(bottomRadius - topRadius, height); var msin = Math.sin; var mcos = Math.cos; var mpi = Math.PI; var cosSlant = mcos(slant); var sinSlant = msin(slant); var start = topCap ? -2 : 0; var end = nvertical + (bottomCap ? 2 : 0); var vertsAroundEdge = nradial + 1; var positions = new Float32Array(numVertices * 3); var normals = new Float32Array(numVertices * 3); var texCoords = new Float32Array(numVertices * 2); var indices = new Uint16Array(nradial * (nvertical + extra) * 6); var i3 = 0; var i2 = 0; for (var i = start; i <= end; i++) { var v = i / nvertical; var y = height * v; var ringRadius = void 0; if (i < 0) { y = 0; v = 1; ringRadius = bottomRadius; } else if (i > nvertical) { y = height; v = 1; ringRadius = topRadius; } else { ringRadius = bottomRadius + (topRadius - bottomRadius) * (i / nvertical); } if (i === -2 || i === nvertical + 2) { ringRadius = 0; v = 0; } y -= height / 2; for (var j = 0; j < vertsAroundEdge; j++) { var sin = msin(j * mpi * 2 / nradial); var cos = mcos(j * mpi * 2 / nradial); positions[i3 + 0] = sin * ringRadius; positions[i3 + 1] = y; positions[i3 + 2] = cos * ringRadius; normals[i3 + 0] = i < 0 || i > nvertical ? 0 : sin * cosSlant; normals[i3 + 1] = i < 0 ? -1 : i > nvertical ? 1 : sinSlant; normals[i3 + 2] = i < 0 || i > nvertical ? 0 : cos * cosSlant; texCoords[i2 + 0] = j / nradial; texCoords[i2 + 1] = v; i2 += 2; i3 += 3; } } for (var _i = 0; _i < nvertical + extra; _i++) { for (var _j = 0; _j < nradial; _j++) { var index = (_i * nradial + _j) * 6; indices[index + 0] = vertsAroundEdge * (_i + 0) + 0 + _j; indices[index + 1] = vertsAroundEdge * (_i + 0) + 1 + _j; indices[index + 2] = vertsAroundEdge * (_i + 1) + 1 + _j; indices[index + 3] = vertsAroundEdge * (_i + 0) + 0 + _j; indices[index + 4] = vertsAroundEdge * (_i + 1) + 1 + _j; indices[index + 5] = vertsAroundEdge * (_i + 1) + 0 + _j; } } return _possibleConstructorReturn(this, (TruncatedConeGeometry.__proto__ || Object.getPrototypeOf(TruncatedConeGeometry)).call(this, Object.assign({}, opts, { attributes: { positions: positions, normals: normals, texCoords: texCoords, indices: indices } }))); } return TruncatedConeGeometry; }(__WEBPACK_IMPORTED_MODULE_0__geometry__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (TruncatedConeGeometry); //# sourceMappingURL=truncated-cone-geometry.js.map /***/ }), /* 106 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils_is_browser__ = __webpack_require__(262); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_globals__ = __webpack_require__(261); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils_log__ = __webpack_require__(263); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "global", function() { return __WEBPACK_IMPORTED_MODULE_1__utils_globals__["b"]; }); // Version detection using babel plugin /* global __VERSION__ */ var VERSION = true ? '5.1.4' : 'untranspiled source'; var STARTUP_MESSAGE = 'set luma.log.priority=1 (or higher) to trace rendering'; // Assign luma.log.priority in console to control logging: \ // 0: none, 1: minimal, 2: verbose, 3: attribute/uniforms, 4: gl logs // luma.log.break[], set to gl funcs, luma.log.profile[] set to model names`; if (__WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma && __WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma.VERSION !== VERSION) { throw new Error('luma.gl - multiple VERSIONs detected: ' + __WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma.VERSION + ' vs ' + VERSION); } if (!__WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma) { /* global console */ /* eslint-disable no-console */ if (__WEBPACK_IMPORTED_MODULE_0__utils_is_browser__["a" /* isBrowser */]) { console.log('luma.gl ' + VERSION + ' - ' + STARTUP_MESSAGE); } __WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma = __WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma || { VERSION: VERSION, version: VERSION, log: __WEBPACK_IMPORTED_MODULE_2__utils_log__["a" /* default */], // A global stats object that various components can add information to // E.g. see webgl/resource.js stats: {}, // Keep some luma globals in a sub-object // This allows us to dynamically detect if certain modules have been // included (such as IO and headless) and enable related functionality, // without unconditionally requiring and thus bundling big dependencies // into the app. globals: { headlessGL: null, headlessTypes: null, modules: {}, nodeIO: {} } }; } /* harmony default export */ __webpack_exports__["default"] = (__WEBPACK_IMPORTED_MODULE_1__utils_globals__["b" /* global */].luma); //# sourceMappingURL=init.js.map /***/ }), /* 107 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = clear; /* harmony export (immutable) */ __webpack_exports__["b"] = clearBuffer; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context_state__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); // Should collapse during minification var GL_DEPTH_BUFFER_BIT = 0x00000100; var GL_STENCIL_BUFFER_BIT = 0x00000400; var GL_COLOR_BUFFER_BIT = 0x00004000; var GL_COLOR = 0x1800; var GL_DEPTH = 0x1801; var GL_STENCIL = 0x1802; var GL_DEPTH_STENCIL = 0x84F9; // Should disappear if asserts are removed var ERR_ARGUMENTS = 'clear: bad arguments'; // Optionally clears depth, color and stencil buffers function clear(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$framebuffer = _ref.framebuffer, framebuffer = _ref$framebuffer === undefined ? null : _ref$framebuffer, _ref$color = _ref.color, color = _ref$color === undefined ? null : _ref$color, _ref$depth = _ref.depth, depth = _ref$depth === undefined ? null : _ref$depth, _ref$stencil = _ref.stencil, stencil = _ref$stencil === undefined ? null : _ref$stencil; var parameters = {}; if (framebuffer) { parameters.framebuffer = framebuffer; } var clearFlags = 0; if (color) { clearFlags |= GL_COLOR_BUFFER_BIT; if (color !== true) { parameters.clearColor = color; } } if (depth) { clearFlags |= GL_DEPTH_BUFFER_BIT; if (depth !== true) { parameters.clearDepth = depth; } } if (stencil) { clearFlags |= GL_STENCIL_BUFFER_BIT; if (depth !== true) { parameters.clearStencil = depth; } } __WEBPACK_IMPORTED_MODULE_2_assert___default()(clearFlags !== 0, ERR_ARGUMENTS); // Temporarily set any clear "colors" and call clear __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context_state__["f" /* withParameters */])(gl, parameters, function () { gl.clear(clearFlags); }); } // WebGL2 - clear a specific drawing buffer function clearBuffer(gl) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$framebuffer = _ref2.framebuffer, framebuffer = _ref2$framebuffer === undefined ? null : _ref2$framebuffer, _ref2$buffer = _ref2.buffer, buffer = _ref2$buffer === undefined ? GL_COLOR : _ref2$buffer, _ref2$drawBuffer = _ref2.drawBuffer, drawBuffer = _ref2$drawBuffer === undefined ? 0 : _ref2$drawBuffer, _ref2$value = _ref2.value, value = _ref2$value === undefined ? [0, 0, 0, 0] : _ref2$value; __WEBPACK_IMPORTED_MODULE_2_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__context__["b" /* isWebGL2 */])(gl), __WEBPACK_IMPORTED_MODULE_0__context__["i" /* ERR_WEBGL2 */]); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context_state__["f" /* withParameters */])(gl, { framebuffer: framebuffer }, function () { // Method selection per OpenGL ES 3 docs switch (buffer) { case GL_COLOR: switch (value.constructor) { case Int32Array: gl.clearBufferiv(buffer, drawBuffer, value); break; case Uint32Array: gl.clearBufferuiv(buffer, drawBuffer, value); break; case Float32Array: default: gl.clearBufferfv(buffer, drawBuffer, value); } break; case GL_DEPTH: gl.clearBufferfv(GL_DEPTH, 0, [value]); break; case GL_STENCIL: gl.clearBufferiv(GL_STENCIL, 0, [value]); break; case GL_DEPTH_STENCIL: var _value = _slicedToArray(value, 2), depth = _value[0], stencil = _value[1]; gl.clearBufferfi(GL_DEPTH_STENCIL, 0, depth, stencil); break; default: __WEBPACK_IMPORTED_MODULE_2_assert___default()(false, ERR_ARGUMENTS); } }); } //# sourceMappingURL=clear.js.map /***/ }), /* 108 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FEATURES; }); /* harmony export (immutable) */ __webpack_exports__["b"] = hasFeature; /* harmony export (immutable) */ __webpack_exports__["c"] = hasFeatures; /* harmony export (immutable) */ __webpack_exports__["d"] = getFeatures; /* unused harmony export TEST_EXPORTS */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_assert__); // Feature detection for WebGL // // Provides a function that enables simple checking of which WebGL features are // available in an WebGL1 or WebGL2 environment. /* eslint-disable no-inline-comments, max-len */ // Defines luma.gl "feature" names and semantics var WEBGL_FEATURES = { // API SUPPORT VERTEX_ARRAY_OBJECT: ['OES_vertex_array_object', true], TIMER_QUERY: ['EXT_disjoint_timer_query', 'EXT_disjoint_timer_query_webgl2'], INSTANCED_RENDERING: ['ANGLE_instanced_arrays', true], MULTIPLE_RENDER_TARGETS: ['WEBGL_draw_buffers', true], // FEATURES ELEMENT_INDEX_UINT32: ['OES_element_index_uint', true], BLEND_EQUATION_MINMAX: ['EXT_blend_minmax', true], // TEXTURES, RENDERBUFFERS COLOR_ENCODING_SRGB: ['EXT_sRGB', true], // TEXTURES TEXTURE_DEPTH: ['WEBGL_depth_texture', true], TEXTURE_FLOAT: ['OES_texture_float', true], TEXTURE_HALF_FLOAT: ['OES_texture_half_float', true], TEXTURE_FILTER_LINEAR_FLOAT: ['OES_texture_float_linear'], TEXTURE_FILTER_LINEAR_HALF_FLOAT: ['OES_texture_half_float_linear'], TEXTURE_FILTER_ANISOTROPIC: ['EXT_texture_filter_anisotropic'], // FRAMEBUFFERS, TEXTURES AND RENDERBUFFERS COLOR_ATTACHMENT_RGBA32F: ['WEBGL_color_buffer_float', 'EXT_color_buffer_float'], COLOR_ATTACHMENT_FLOAT: [false, 'EXT_color_buffer_float'], COLOR_ATTACHMENT_HALF_FLOAT: [false, 'EXT_color_buffer_half_float'], // GLSL extensions GLSL_FRAG_DATA: ['WEBGL_draw_buffers', true], GLSL_FRAG_DEPTH: ['EXT_frag_depth', true], GLSL_DERIVATIVES: ['OES_standard_derivatives', true], GLSL_TEXTURE_LOD: ['EXT_shader_texture_lod', true] }; // Create a key-mirrored FEATURES array var FEATURES = {}; Object.keys(WEBGL_FEATURES).forEach(function (key) { FEATURES[key] = key; }); // TODO - cache the value function getFeature(gl, cap) { var feature = WEBGL_FEATURES[cap]; __WEBPACK_IMPORTED_MODULE_1_assert___default()(feature, cap); // Get extension name from table var extensionName = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__context__["b" /* isWebGL2 */])(gl) ? feature[1] || feature[0] : feature[0]; // Check if the value is dependent on checking an extension var value = typeof extensionName === 'string' ? Boolean(gl.getExtension(extensionName)) : extensionName; __WEBPACK_IMPORTED_MODULE_1_assert___default()(value === false || value === true); return value; } // capability can be a WebGL extension name or a luma capability name function hasFeature(gl, feature) { return hasFeatures(gl, feature); } function hasFeatures(gl, features) { features = Array.isArray(features) ? features : [features]; return features.every(function (feature) { return getFeature(gl, feature); }); } function getFeatures(gl) { gl.luma = gl.luma || {}; if (!gl.luma.caps) { gl.luma.caps = {}; gl.luma.caps.webgl2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__context__["b" /* isWebGL2 */])(gl); for (var cap in WEBGL_FEATURES) { gl.luma.caps[cap] = getFeature(gl, cap); } } return gl.luma.caps; } var TEST_EXPORTS = { WEBGL_FEATURES: WEBGL_FEATURES }; //# sourceMappingURL=context-features.js.map /***/ }), /* 109 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export getUniformDescriptors */ /* unused harmony export getVaryingMap */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context_state__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__vertex_array__ = __webpack_require__(169); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__texture__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__framebuffer__ = __webpack_require__(69); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__transform_feedback__ = __webpack_require__(276); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__uniforms__ = __webpack_require__(168); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9__shader__ = __webpack_require__(111); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10__buffer__ = __webpack_require__(67); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable no-inline-comments */ var LOG_PROGRAM_PERF_PRIORITY = 3; // const GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; // const GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; // MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS : 0x8C80, // TRANSFORM_FEEDBACK_BUFFER_START: 0x8C84, // TRANSFORM_FEEDBACK_BUFFER_SIZE : 0x8C85, // TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: 0x8C88, // MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: 0x8C8A, // MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: 0x8C8B, // INTERLEAVED_ATTRIBS: 0x8C8C, // SEPARATE_ATTRIBS : 0x8C8D, var Program = /*#__PURE__*/function (_Resource) { _inherits(Program, _Resource); function Program(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Program); var _this = _possibleConstructorReturn(this, (Program.__proto__ || Object.getPrototypeOf(Program)).call(this, gl, opts)); _this.initialize(opts); _this.vertexAttributes = __WEBPACK_IMPORTED_MODULE_3__vertex_array__["a" /* default */].getDefaultArray(gl); Object.seal(_this); _this._setId(opts.id); return _this; } _createClass(Program, [{ key: 'initialize', value: function initialize() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, vs = _ref.vs, fs = _ref.fs, defaultUniforms = _ref.defaultUniforms, varyings = _ref.varyings, _ref$bufferMode = _ref.bufferMode, bufferMode = _ref$bufferMode === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SEPARATE_ATTRIBS : _ref$bufferMode; // Create shaders if needed this.vs = typeof vs === 'string' ? new __WEBPACK_IMPORTED_MODULE_9__shader__["b" /* VertexShader */](this.gl, vs) : vs; this.fs = typeof fs === 'string' ? new __WEBPACK_IMPORTED_MODULE_9__shader__["c" /* FragmentShader */](this.gl, fs) : fs; __WEBPACK_IMPORTED_MODULE_12_assert___default()(this.vs instanceof __WEBPACK_IMPORTED_MODULE_9__shader__["b" /* VertexShader */], 'Program: bad vertex shader'); __WEBPACK_IMPORTED_MODULE_12_assert___default()(this.fs instanceof __WEBPACK_IMPORTED_MODULE_9__shader__["c" /* FragmentShader */], 'Program: bad fragment shader'); this.defaultUniforms = defaultUniforms; // Setup varyings if supplied if (varyings) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); this.varyings = varyings; this.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode); this.varyingMap = getVaryingMap(varyings, bufferMode); } else { this.varyingMap = {}; } this._compileAndLink(); return this; } // Generates warning if a vertex shader attribute is not setup. }, { key: 'checkAttributeBindings', value: function checkAttributeBindings(_ref2) { var vertexArray = _ref2.vertexArray; var filledLocations = vertexArray ? vertexArray.filledLocations : this.vertexAttributes.filledLocations; for (var attributeName in this._attributeToLocationMap) { var location = this._attributeToLocationMap[attributeName]; if (!filledLocations[location] && !this._warnedLocations[location]) { // throw new Error(`Program ${this.id}: ` + // `Attribute ${location}:${attributeName} not supplied`); __WEBPACK_IMPORTED_MODULE_11__utils__["b" /* log */].warn('Program ' + this.id + ': Attribute ' + location + ':' + attributeName + ' not supplied'); this._warnedLocations[location] = true; } } return this; } }, { key: 'reset', value: function reset() { this.unsetBuffers(); // TODO - reset uniforms and attributes to initial state } }, { key: 'use', value: function use() { this.gl.useProgram(this.handle); return this; } // A good thing about webGL is that there are so many ways to draw things, // e.g. depending on whether data is indexed and/or isInstanced. // This function unifies those into a single call with simple parameters // that have sane defaults. }, { key: 'draw', value: function draw(_ref3) { var _this2 = this; var _ref3$drawMode = _ref3.drawMode, drawMode = _ref3$drawMode === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TRIANGLES : _ref3$drawMode, vertexCount = _ref3.vertexCount, _ref3$offset = _ref3.offset, offset = _ref3$offset === undefined ? 0 : _ref3$offset, start = _ref3.start, end = _ref3.end, _ref3$isIndexed = _ref3.isIndexed, isIndexed = _ref3$isIndexed === undefined ? false : _ref3$isIndexed, _ref3$indexType = _ref3.indexType, indexType = _ref3$indexType === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNSIGNED_SHORT : _ref3$indexType, _ref3$isInstanced = _ref3.isInstanced, isInstanced = _ref3$isInstanced === undefined ? false : _ref3$isInstanced, _ref3$instanceCount = _ref3.instanceCount, instanceCount = _ref3$instanceCount === undefined ? 0 : _ref3$instanceCount, _ref3$vertexArray = _ref3.vertexArray, vertexArray = _ref3$vertexArray === undefined ? null : _ref3$vertexArray, _ref3$transformFeedba = _ref3.transformFeedback, transformFeedback = _ref3$transformFeedba === undefined ? null : _ref3$transformFeedba, _ref3$uniforms = _ref3.uniforms, uniforms = _ref3$uniforms === undefined ? {} : _ref3$uniforms, _ref3$samplers = _ref3.samplers, samplers = _ref3$samplers === undefined ? {} : _ref3$samplers, _ref3$parameters = _ref3.parameters, parameters = _ref3$parameters === undefined ? {} : _ref3$parameters; vertexArray = vertexArray || __WEBPACK_IMPORTED_MODULE_3__vertex_array__["a" /* default */].getDefaultArray(this.gl); vertexArray.bind(function () { _this2.gl.useProgram(_this2.handle); if (transformFeedback) { var primitiveMode = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_7__transform_feedback__["b" /* getTransformFeedbackMode */])({ drawMode: drawMode }); transformFeedback.begin(primitiveMode); } _this2.setUniforms(uniforms, samplers); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context_state__["f" /* withParameters */])(_this2.gl, parameters, function () { // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension if (isIndexed && isInstanced) { _this2.ext.drawElementsInstanced(drawMode, vertexCount, indexType, offset, instanceCount); } else if (isIndexed && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(_this2.gl) && !isNaN(start) && !isNaN(end)) { _this2.gl.drawElementsRange(drawMode, start, end, vertexCount, indexType, offset); } else if (isIndexed) { _this2.gl.drawElements(drawMode, vertexCount, indexType, offset); } else if (isInstanced) { _this2.ext.drawArraysInstanced(drawMode, offset, vertexCount, instanceCount); } else { _this2.gl.drawArrays(drawMode, offset, vertexCount); } }); // this.gl.useProgram(null); if (transformFeedback) { transformFeedback.end(); } }); return this; } /** * Attach a map of Buffers values to a program * Only attributes with names actually present in the linked program * will be updated. Other supplied buffers will be ignored. * * @param {Object} buffers - An object map with attribute names being keys * and values are expected to be instances of Buffer. * @returns {Program} Returns itself for chaining. */ /* eslint-disable max-statements */ }, { key: 'setBuffers', value: function setBuffers(buffers) { var _ref4 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref4$clear = _ref4.clear, clear = _ref4$clear === undefined ? true : _ref4$clear, _ref4$drawParams = _ref4.drawParams, drawParams = _ref4$drawParams === undefined ? {} : _ref4$drawParams; if (clear) { this.vertexAttributes.clearBindings(); } // indexing is autodetected - buffer with target gl.ELEMENT_ARRAY_BUFFER // index type is saved for drawElement calls drawParams.isInstanced = false; drawParams.isIndexed = false; drawParams.indexType = null; var _sortBuffersByLocatio = this._sortBuffersByLocation(buffers), locations = _sortBuffersByLocatio.locations, elements = _sortBuffersByLocatio.elements; // Process locations in order for (var location = 0; location < locations.length; ++location) { var bufferName = locations[location]; var buffer = buffers[bufferName]; // DISABLE MISSING ATTRIBUTE if (!buffer) { this.vertexAttributes.disable(location); } else if (buffer instanceof __WEBPACK_IMPORTED_MODULE_10__buffer__["a" /* default */]) { var divisor = buffer.layout.instanced ? 1 : 0; this.vertexAttributes.setBuffer({ location: location, buffer: buffer }); this.vertexAttributes.setDivisor(location, divisor); drawParams.isInstanced = buffer.layout.instanced > 0; this.vertexAttributes.enable(location); } else { this.vertexAttributes.setGeneric({ location: location, array: buffer }); this.vertexAttributes.disable(location, true); } } // SET ELEMENTS ARRAY BUFFER if (elements) { var _buffer = buffers[elements]; _buffer.bind(); drawParams.isIndexed = true; drawParams.indexType = _buffer.layout.type; } return this; } /* eslint-enable max-statements */ /* * @returns {Program} Returns itself for chaining. */ }, { key: 'unsetBuffers', value: function unsetBuffers() { var length = this._attributeCount; for (var i = 1; i < length; ++i) { // this.vertexAttributes.setDivisor(i, 0); this.vertexAttributes.disable(i); } // Clear elements buffer this.gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ELEMENT_ARRAY_BUFFER, null); return this; } /** * Apply a set of uniform values to a program * Only uniforms with names actually present in the linked program * will be updated. * other uniforms will be ignored * * @param {Object} uniformMap - An object with names being keys * @returns {Program} - returns itself for chaining. */ /* eslint-disable max-depth */ }, { key: 'setUniforms', value: function setUniforms(uniforms) { var samplers = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; for (var uniformName in uniforms) { var uniform = uniforms[uniformName]; var uniformSetter = this._uniformSetters[uniformName]; var sampler = samplers[uniformName]; if (uniformSetter) { if (uniform instanceof __WEBPACK_IMPORTED_MODULE_6__framebuffer__["a" /* default */]) { uniform = uniform.texture; } if (uniform instanceof __WEBPACK_IMPORTED_MODULE_5__texture__["a" /* default */]) { if (uniformSetter.textureIndex === undefined) { uniformSetter.textureIndex = this._textureIndexCounter++; } // Bind texture to index var texture = uniform; var textureIndex = uniformSetter.textureIndex; texture.bind(textureIndex); // Bind a sampler (if supplied) to index if (sampler) { sampler.bind(textureIndex); } // Set the uniform sampler to the texture index uniformSetter(textureIndex); } else { // Just set the value uniformSetter(uniform); } } } return this; } /* eslint-enable max-depth */ // setTransformFeedbackBuffers(buffers) { // for (const buffer of buffers) { // buffer.bindBase() // } // } /** * ATTRIBUTES API * (Locations are numeric indices) * @return {Number} count */ }, { key: 'getAttributeCount', value: function getAttributeCount() { return this._getParameter(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ACTIVE_ATTRIBUTES); } /** * Returns location (index) of a name * @param {String} attributeName - name of an attribute * (matches name in a linked shader) * @returns {Number} - // array of actual attribute names from shader linking */ }, { key: 'getAttributeLocation', value: function getAttributeLocation(attributeName) { return this.gl.getAttribLocation(this.handle, attributeName); } /** * Returns an object with info about attribute at index "location"/ * @param {int} location - index of an attribute * @returns {WebGLActiveInfo} - info about an active attribute * fields: {name, size, type} */ }, { key: 'getAttributeInfo', value: function getAttributeInfo(location) { return this.gl.getActiveAttrib(this.handle, location); } /** * UNIFORMS API * (Locations are numeric indices) * @return {Number} count */ }, { key: 'getUniformCount', value: function getUniformCount() { return this._getParameter(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ACTIVE_UNIFORMS); } /* * @returns {WebGLActiveInfo} - object with {name, size, type} */ }, { key: 'getUniformInfo', value: function getUniformInfo(index) { return this.gl.getActiveUniform(this.handle, index); } /* * @returns {WebGLUniformLocation} - opaque object representing location * of uniform, used by setter methods */ }, { key: 'getUniformLocation', value: function getUniformLocation(name) { return this.gl.getUniformLocation(this.handle, name); } }, { key: 'getUniformValue', value: function getUniformValue(location) { return this.gl.getUniform(this.handle, location); } // WebGL2 /** * @param {GLuint} index * @return {WebGLActiveInfo} - object with {name, size, type} */ }, { key: 'getVarying', value: function getVarying(program, index) { var result = this.gl.getTransformFeedbackVarying(program, index); return result; } // Retrieves the assigned color number binding for the user-defined varying // out variable name for program. program must have previously been linked. }, { key: 'getFragDataLocation', value: function getFragDataLocation(varyingName) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(this.gl); return this.gl.getFragDataLocation(this.handle, varyingName); } // @returns {WebGLShader[]} - array of attached WebGLShader objects }, { key: 'getAttachedShaders', value: function getAttachedShaders() { return this.gl.getAttachedShaders(this.handle); } // PRIVATE METHODS }, { key: '_compileAndLink', value: function _compileAndLink() { var gl = this.gl; gl.attachShader(this.handle, this.vs.handle); gl.attachShader(this.handle, this.fs.handle); __WEBPACK_IMPORTED_MODULE_11__utils__["b" /* log */].time(LOG_PROGRAM_PERF_PRIORITY, 'linkProgram for ' + this._getName()); gl.linkProgram(this.handle); __WEBPACK_IMPORTED_MODULE_11__utils__["b" /* log */].timeEnd(LOG_PROGRAM_PERF_PRIORITY, 'linkProgram for ' + this._getName()); // Avoid checking program linking error in production if (gl.debug || __WEBPACK_IMPORTED_MODULE_11__utils__["b" /* log */].priority > 0) { gl.validateProgram(this.handle); var linked = gl.getProgramParameter(this.handle, gl.LINK_STATUS); if (!linked) { throw new Error('Error linking ' + gl.getProgramInfoLog(this.handle)); } } this._queryAttributeLocations(); this._queryUniformLocations(); } }, { key: '_sortBuffersByLocation', value: function _sortBuffersByLocation(buffers) { var elements = null; var locations = []; // Reutrn early if no buffers to be bound. if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__utils__["f" /* isObjectEmpty */])(buffers)) { return { locations: locations, elements: elements }; } locations = new Array(this._attributeCount); for (var bufferName in buffers) { var buffer = buffers[bufferName]; var location = this._attributeToLocationMap[bufferName]; if (location === undefined) { if (buffer.target === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ELEMENT_ARRAY_BUFFER && elements) { throw new Error(this._print(bufferName) + ' duplicate GL.ELEMENT_ARRAY_BUFFER'); } else if (buffer.target === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ELEMENT_ARRAY_BUFFER) { elements = bufferName; } else if (!this._warnedLocations[location]) { __WEBPACK_IMPORTED_MODULE_11__utils__["b" /* log */].log(2, this._print(bufferName) + ' not used'); this._warnedLocations[location] = true; } } else { if (buffer.target === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ELEMENT_ARRAY_BUFFER) { throw new Error(this._print(bufferName) + ':' + location + ' ' + 'has both location and type gl.ELEMENT_ARRAY_BUFFER'); } locations[location] = bufferName; } } return { locations: locations, elements: elements }; } // Check that all active attributes are enabled }, { key: '_areAllAttributesEnabled', value: function _areAllAttributesEnabled() { var length = this._attributeCount; for (var i = 0; i < length; ++i) { if (!this.vertexAttributes.isEnabled(i)) { return false; } } return true; } }, { key: '_print', value: function _print(bufferName) { return 'Program ' + this.id + ': Attribute ' + bufferName; } }, { key: '_createHandle', value: function _createHandle() { return this.gl.createProgram(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteProgram(this.handle); } }, { key: '_getName', value: function _getName() { var programName = this.vs.getName() || this.fs.getName(); programName = programName.replace(/shader/i, ''); programName = programName ? programName + '-program' : 'program'; return programName; } }, { key: '_getOptionsFromHandle', value: function _getOptionsFromHandle(handle) { var shaderHandles = this.gl.getAttachedShaders(handle); var opts = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = shaderHandles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var shaderHandle = _step.value; var type = this.gl.getShaderParameter(this.handle, __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SHADER_TYPE); switch (type) { case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].VERTEX_SHADER: opts.vs = new __WEBPACK_IMPORTED_MODULE_9__shader__["b" /* VertexShader */]({ handle: shaderHandle }); break; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].FRAGMENT_SHADER: opts.fs = new __WEBPACK_IMPORTED_MODULE_9__shader__["c" /* FragmentShader */]({ handle: shaderHandle }); break; default: } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return opts; } }, { key: '_getParameter', value: function _getParameter(pname) { return this.gl.getProgramParameter(this.handle, pname); } // query attribute locations and build name to location map. }, { key: '_queryAttributeLocations', value: function _queryAttributeLocations() { this._attributeToLocationMap = {}; this._attributeCount = this.getAttributeCount(); for (var location = 0; location < this._attributeCount; location++) { var name = this.getAttributeInfo(location).name; this._attributeToLocationMap[name] = this.getAttributeLocation(name); } this._warnedLocations = {}; } // query uniform locations and build name to setter map. }, { key: '_queryUniformLocations', value: function _queryUniformLocations() { var gl = this.gl; this._uniformSetters = {}; this._uniformCount = this.getUniformCount(); for (var i = 0; i < this._uniformCount; i++) { var info = this.getUniformInfo(i); var parsedName = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__uniforms__["a" /* parseUniformName */])(info.name); var location = this.getUniformLocation(parsedName.name); this._uniformSetters[parsedName.name] = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__uniforms__["b" /* getUniformSetter */])(gl, location, info, parsedName.isArray); } this._textureIndexCounter = 0; } }, { key: '_setId', value: function _setId(id) { // If program is not named, name it after shader names if (!id) { var programName = this._getName(); // TODO - this.id will already have been initialized this.id = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_11__utils__["d" /* uid */])(programName); } } }]); return Program; }(__WEBPACK_IMPORTED_MODULE_4__resource__["a" /* default */]); // create uniform setters // Map of uniform names to setter functions /* harmony default export */ __webpack_exports__["a"] = (Program); function getUniformDescriptors(gl, program) { var uniformDescriptors = {}; var length = program.getUniformCount(); for (var i = 0; i < length; i++) { var info = program.getUniformInfo(i); var location = program.getUniformLocation(info.name); var descriptor = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_8__uniforms__["b" /* getUniformSetter */])(gl, location, info); uniformDescriptors[descriptor.name] = descriptor; } return uniformDescriptors; } // Get a map of buffer indices function getVaryingMap(varyings, bufferMode) { var varyingMap = {}; var index = 0; __WEBPACK_IMPORTED_MODULE_12_assert___default()(bufferMode === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SEPARATE_ATTRIBS || bufferMode === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].INTERLEAVED_ATTRIBS); var indexIncrement = bufferMode === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SEPARATE_ATTRIBS ? 1 : 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = varyings[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var varying = _step2.value; varyingMap[varying] = index; index += indexIncrement; } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return varyingMap; } //# sourceMappingURL=program.js.map /***/ }), /* 110 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export RENDERBUFFER_FORMATS */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _RENDERBUFFER_FORMATS; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint-disable no-inline-comments */ // Define local GL constants to optimize minification var GL_RENDERBUFFER = 0x8D41; var GL_SAMPLES = 0x80A9; var GL_RENDERBUFFER_WIDTH = 0x8D42; var GL_RENDERBUFFER_HEIGHT = 0x8D43; var GL_RENDERBUFFER_INTERNAL_FORMAT = 0x8D44; var GL_RENDERBUFFER_SAMPLES = 0x8CAB; // Define local extension strings to optimize minification // const SRGB = 'EXT_sRGB'; // const CB_FLOAT_WEBGL1 = 'WEBGL_color_buffer_float'; var CB_FLOAT_WEBGL2 = 'EXT_color_buffer_float'; // const CB_HALF_FLOAT_WEBGL1 = 'EXT_color_buffer_half_float'; var RENDERBUFFER_FORMATS = (_RENDERBUFFER_FORMATS = {}, _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].DEPTH_COMPONENT16, {}), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].DEPTH_COMPONENT24, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].DEPTH_COMPONENT32F, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].STENCIL_INDEX8, {}), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].DEPTH_STENCIL, {}), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].DEPTH24_STENCIL8, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].DEPTH32F_STENCIL8, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA4, {}), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB565, {}), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB5_A1, {}), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R8, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R8UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R8I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R16UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R16I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R32UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R32I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG8, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG8UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG8I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG16UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG16I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG32UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG32I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB8, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA8, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB10_A2, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA8UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA8I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGB10_A2UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA16UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA16I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA32I, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA32UI, { gl2: true }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R16F, { gl2: CB_FLOAT_WEBGL2 }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG16F, { gl2: CB_FLOAT_WEBGL2 }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA16F, { gl2: CB_FLOAT_WEBGL2 }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R32F, { gl2: CB_FLOAT_WEBGL2 }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RG32F, { gl2: CB_FLOAT_WEBGL2 }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RGBA32F, { gl2: CB_FLOAT_WEBGL2 }), _defineProperty(_RENDERBUFFER_FORMATS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].R11F_G11F_B10F, { gl2: CB_FLOAT_WEBGL2 }), _RENDERBUFFER_FORMATS); function isFormatSupported(gl, format, formats) { // assert(isWebGL(gl), ERR_WEBGL); var info = formats[format]; if (!info) { return false; } var value = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl) ? info.gl2 || info.gl1 : info.gl1; if (typeof value === 'string') { return gl.getExtension(value); } return value; } var Renderbuffer = /*#__PURE__*/function (_Resource) { _inherits(Renderbuffer, _Resource); _createClass(Renderbuffer, null, [{ key: 'isSupported', value: function isSupported(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, format = _ref.format; return !format || isFormatSupported(gl, format, RENDERBUFFER_FORMATS); } }, { key: 'getSamplesForFormat', value: function getSamplesForFormat(gl, _ref2) { var format = _ref2.format; // Polyfilled to return [0] under WebGL1 return gl.getInternalformatParameter(GL_RENDERBUFFER, format, GL_SAMPLES); } }]); function Renderbuffer(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Renderbuffer); var _this = _possibleConstructorReturn(this, (Renderbuffer.__proto__ || Object.getPrototypeOf(Renderbuffer)).call(this, gl, opts)); _this.initialize(opts); Object.seal(_this); return _this; } // Creates and initializes a renderbuffer object's data store _createClass(Renderbuffer, [{ key: 'initialize', value: function initialize(_ref3) { var format = _ref3.format, _ref3$width = _ref3.width, width = _ref3$width === undefined ? 1 : _ref3$width, _ref3$height = _ref3.height, height = _ref3$height === undefined ? 1 : _ref3$height, _ref3$samples = _ref3.samples, samples = _ref3$samples === undefined ? 0 : _ref3$samples; __WEBPACK_IMPORTED_MODULE_3_assert___default()(format, 'Needs format'); this.gl.bindRenderbuffer(GL_RENDERBUFFER, this.handle); if (samples !== 0 && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(this.gl)) { this.gl.renderbufferStorageMultisample(GL_RENDERBUFFER, samples, format, width, height); } else { this.gl.renderbufferStorage(GL_RENDERBUFFER, format, width, height); } // this.gl.bindRenderbuffer(GL_RENDERBUFFER, null); this.format = format; this.width = width; this.height = height; this.samples = samples; return this; } }, { key: 'resize', value: function resize(_ref4) { var width = _ref4.width, height = _ref4.height; // Don't resize if width/height haven't changed if (width !== this.width || height !== this.height) { return this.initialize({ width: width, height: height, format: this.format, samples: this.samples }); } return this; } // PRIVATE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.createRenderbuffer(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteRenderbuffer(this.handle); } }, { key: '_syncHandle', value: function _syncHandle(handle) { this.format = this.getParameter(GL_RENDERBUFFER_INTERNAL_FORMAT); this.width = this.getParameter(GL_RENDERBUFFER_WIDTH); this.height = this.getParameter(GL_RENDERBUFFER_HEIGHT); this.samples = this.getParameter(GL_RENDERBUFFER_SAMPLES); } // @param {Boolean} opt.autobind=true - method call will bind/unbind object // @returns {GLenum|GLint} - depends on pname }, { key: '_getParameter', value: function _getParameter(pname) { this.gl.bindRenderbuffer(GL_RENDERBUFFER, this.handle); var value = this.gl.getRenderbufferParameter(GL_RENDERBUFFER, pname); // this.gl.bindRenderbuffer(GL_RENDERBUFFER, null); return value; } }]); return Renderbuffer; }(__WEBPACK_IMPORTED_MODULE_2__resource__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Renderbuffer); //# sourceMappingURL=renderbuffer.js.map /***/ }), /* 111 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Shader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return VertexShader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return FragmentShader; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl_utils__ = __webpack_require__(60); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ERR_SOURCE = 'Shader: GLSL source code must be a JavaScript string'; var GL_FRAGMENT_SHADER = 0x8B30; var GL_VERTEX_SHADER = 0x8B31; var GL_COMPILE_STATUS = 0x8B81; var GL_SHADER_TYPE = 0x8B4F; // For now this is an internal class var Shader = /*#__PURE__*/function (_Resource) { _inherits(Shader, _Resource); _createClass(Shader, null, [{ key: 'getTypeName', value: function getTypeName(shaderType) { switch (shaderType) { case GL_VERTEX_SHADER: return 'vertex-shader'; case GL_FRAGMENT_SHADER: return 'fragment-shader'; default: __WEBPACK_IMPORTED_MODULE_4_assert___default()(false);return 'unknown'; } } /* eslint-disable max-statements */ }]); function Shader(gl, source, shaderType) { _classCallCheck(this, Shader); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["j" /* assertWebGLContext */])(gl); __WEBPACK_IMPORTED_MODULE_4_assert___default()(typeof source === 'string', ERR_SOURCE); var _this = _possibleConstructorReturn(this, (Shader.__proto__ || Object.getPrototypeOf(Shader)).call(this, gl, { id: __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl_utils__["i" /* getShaderName */])(source) || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils__["d" /* uid */])(Shader.getTypeName(shaderType)) })); _this.shaderType = shaderType; _this.source = source; _this.opts.source = source; _this.initialize(_this.opts); return _this; } _createClass(Shader, [{ key: 'initialize', value: function initialize(_ref) { var source = _ref.source; var shaderName = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl_utils__["i" /* getShaderName */])(source); if (shaderName) { this.id = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__utils__["d" /* uid */])(shaderName); } this._compile(source); this.opts.source = source; } // Accessors }, { key: 'getParameter', value: function getParameter(pname) { return this.gl.getShaderParameter(this.handle, pname); } }, { key: 'toString', value: function toString() { return this.getTypeName(this.shaderType) + ':' + this.id; } }, { key: 'getName', value: function getName() { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl_utils__["i" /* getShaderName */])(this.opts.source) || 'unnamed-shader'; } }, { key: 'getSource', value: function getSource() { return this.gl.getShaderSource(this.handle); } // Debug method - Returns translated source if available }, { key: 'getTranslatedSource', value: function getTranslatedSource() { var extension = this.gl.getExtension('WEBGL_debug_shaders'); return extension ? extension.getTranslatedShaderSource(this.handle) : 'No translated source available. WEBGL_debug_shaders not implemented'; } // PRIVATE METHODS }, { key: '_compile', value: function _compile() { this.gl.shaderSource(this.handle, this.source); this.gl.compileShader(this.handle); // TODO - For performance reasons, avoid checking shader compilation errors on production? // TODO - Load log even when no error reported, to catch warnings? // https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings var compileStatus = this.getParameter(GL_COMPILE_STATUS); if (!compileStatus) { var infoLog = this.gl.getShaderInfoLog(this.handle); var _parseGLSLCompilerErr = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl_utils__["j" /* parseGLSLCompilerError */])(infoLog, this.source, this.shaderType), shaderName = _parseGLSLCompilerErr.shaderName, errors = _parseGLSLCompilerErr.errors, warnings = _parseGLSLCompilerErr.warnings; __WEBPACK_IMPORTED_MODULE_3__utils__["b" /* log */].error('GLSL compilation errors in ' + shaderName + '\n' + errors); __WEBPACK_IMPORTED_MODULE_3__utils__["b" /* log */].warn('GLSL compilation warnings in ' + shaderName + '\n' + warnings); throw new Error('GLSL compilation errors in ' + shaderName); } } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteShader(this.handle); } }, { key: '_getOptsFromHandle', value: function _getOptsFromHandle() { return { type: this.getParameter(GL_SHADER_TYPE), source: this.getSource() }; } }]); return Shader; }(__WEBPACK_IMPORTED_MODULE_2__resource__["a" /* default */]); var VertexShader = /*#__PURE__*/function (_Shader) { _inherits(VertexShader, _Shader); function VertexShader(gl, source) { _classCallCheck(this, VertexShader); return _possibleConstructorReturn(this, (VertexShader.__proto__ || Object.getPrototypeOf(VertexShader)).call(this, gl, source, GL_VERTEX_SHADER)); } // PRIVATE METHODS _createClass(VertexShader, [{ key: '_createHandle', value: function _createHandle() { return this.gl.createShader(GL_VERTEX_SHADER); } }]); return VertexShader; }(Shader); var FragmentShader = /*#__PURE__*/function (_Shader2) { _inherits(FragmentShader, _Shader2); function FragmentShader(gl, source) { _classCallCheck(this, FragmentShader); return _possibleConstructorReturn(this, (FragmentShader.__proto__ || Object.getPrototypeOf(FragmentShader)).call(this, gl, source, GL_FRAGMENT_SHADER)); } // PRIVATE METHODS _createClass(FragmentShader, [{ key: '_createHandle', value: function _createHandle() { return this.gl.createShader(GL_FRAGMENT_SHADER); } }]); return FragmentShader; }(Shader); //# sourceMappingURL=shader.js.map /***/ }), /* 112 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__common__ = __webpack_require__(31); var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i= 1 && polygon[0].length >= 2 && Number.isFinite(polygon[0][0]); } /** * Normalize to ensure that all polygons in a list are complex - simplifies processing * @param {Array} polygon - either a complex or a simple polygon * @param {Object} opts * @param {Object} opts.dimensions - if 3, the coords will be padded with 0's if needed * @return {Array} - returns a complex polygons */ function normalize(polygon) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$dimensions = _ref.dimensions, dimensions = _ref$dimensions === undefined ? 3 : _ref$dimensions; return isSimple(polygon) ? [polygon] : polygon; } /** * Check if this is a non-nested polygon (i.e. the first element of the first element is a number) * @param {Array} polygon - either a complex or simple polygon * @return {Boolean} - true if the polygon is a simple polygon (i.e. not an array of polygons) */ function getVertexCount(polygon) { return isSimple(polygon) ? polygon.length : polygon.reduce(function (length, simplePolygon) { return length + simplePolygon.length; }, 0); } // Return number of triangles needed to tesselate the polygon function getTriangleCount(polygon) { var triangleCount = 0; var first = true; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = normalize(polygon)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var simplePolygon = _step.value; var size = simplePolygon.length; if (first) { triangleCount += size >= 3 ? size - 2 : 0; } else { triangleCount += size + 1; } first = false; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return triangleCount; } function forEachVertex(polygon, visitor) { if (isSimple(polygon)) { polygon.forEach(visitor); return; } var vertexIndex = 0; polygon.forEach(function (simplePolygon) { simplePolygon.forEach(function (v, i, p) { return visitor(v, vertexIndex, polygon); }); vertexIndex++; }); } /***/ }), /* 121 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 Uber Technologies, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var _mapState = __webpack_require__(82); var _mapState2 = _interopRequireDefault(_mapState); var _linearInterpolator = __webpack_require__(125); var _linearInterpolator2 = _interopRequireDefault(_linearInterpolator); var _transitionManager = __webpack_require__(186); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var NO_TRANSITION_PROPS = { transitionDuration: 0 }; var LINEAR_TRANSITION_PROPS = { transitionDuration: 300, transitionEasing: function transitionEasing(t) { return t; }, transitionInterpolator: new _linearInterpolator2.default(), transitionInterruption: _transitionManager.TRANSITION_EVENTS.BREAK }; // EVENT HANDLING PARAMETERS var PITCH_MOUSE_THRESHOLD = 5; var PITCH_ACCEL = 1.2; var ZOOM_ACCEL = 0.01; var EVENT_TYPES = { WHEEL: ['wheel'], PAN: ['panstart', 'panmove', 'panend'], PINCH: ['pinchstart', 'pinchmove', 'pinchend'], DOUBLE_TAP: ['doubletap'], KEYBOARD: ['keydown'] }; var ViewportControls = function () { /** * @classdesc * A class that handles events and updates mercator style viewport parameters */ function ViewportControls(ViewportState) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, ViewportControls); (0, _assert2.default)(ViewportState); this.ViewportState = ViewportState; this.viewportState = null; this.viewportStateProps = null; this.eventManager = null; this._events = null; this._state = { isDragging: false }; this.events = []; this.handleEvent = this.handleEvent.bind(this); this.setOptions(options); if (this.constructor === ViewportControls) { Object.seal(this); } } /** * Callback for events * @param {hammer.Event} event */ _createClass(ViewportControls, [{ key: 'handleEvent', value: function handleEvent(event) { var ViewportState = this.ViewportState; this.viewportState = new ViewportState(Object.assign({}, this.viewportStateProps, this._state)); switch (event.type) { case 'panstart': return this._onPanStart(event); case 'panmove': return this._onPan(event); case 'panend': return this._onPanEnd(event); case 'pinchstart': return this._onPinchStart(event); case 'pinchmove': return this._onPinch(event); case 'pinchend': return this._onPinchEnd(event); case 'doubletap': return this._onDoubleTap(event); case 'wheel': return this._onWheel(event); case 'keydown': return this._onKeyDown(event); default: return false; } } /* Event utils */ // Event object: http://hammerjs.github.io/api/#event-object }, { key: 'getCenter', value: function getCenter(event) { var _event$offsetCenter = event.offsetCenter, x = _event$offsetCenter.x, y = _event$offsetCenter.y; return [x, y]; } }, { key: 'isFunctionKeyPressed', value: function isFunctionKeyPressed(event) { var srcEvent = event.srcEvent; return Boolean(srcEvent.metaKey || srcEvent.altKey || srcEvent.ctrlKey || srcEvent.shiftKey); } }, { key: 'isDragging', value: function isDragging() { return this._state.isDragging; } /** * Extract interactivity options */ }, { key: 'setOptions', value: function setOptions(options) { var onViewportChange = options.onViewportChange, _options$onStateChang = options.onStateChange, onStateChange = _options$onStateChang === undefined ? this.onStateChange : _options$onStateChang, _options$eventManager = options.eventManager, eventManager = _options$eventManager === undefined ? this.eventManager : _options$eventManager, _options$scrollZoom = options.scrollZoom, scrollZoom = _options$scrollZoom === undefined ? true : _options$scrollZoom, _options$dragPan = options.dragPan, dragPan = _options$dragPan === undefined ? true : _options$dragPan, _options$dragRotate = options.dragRotate, dragRotate = _options$dragRotate === undefined ? true : _options$dragRotate, _options$doubleClickZ = options.doubleClickZoom, doubleClickZoom = _options$doubleClickZ === undefined ? true : _options$doubleClickZ, _options$touchZoom = options.touchZoom, touchZoom = _options$touchZoom === undefined ? true : _options$touchZoom, _options$touchRotate = options.touchRotate, touchRotate = _options$touchRotate === undefined ? false : _options$touchRotate, _options$keyboard = options.keyboard, keyboard = _options$keyboard === undefined ? true : _options$keyboard; this.onViewportChange = onViewportChange; this.onStateChange = onStateChange; this.viewportStateProps = options; if (this.eventManager !== eventManager) { // EventManager has changed this.eventManager = eventManager; this._events = {}; this.toggleEvents(this.events, true); } // Register/unregister events var isInteractive = Boolean(this.onViewportChange); this.toggleEvents(EVENT_TYPES.WHEEL, isInteractive && scrollZoom); this.toggleEvents(EVENT_TYPES.PAN, isInteractive && (dragPan || dragRotate)); this.toggleEvents(EVENT_TYPES.PINCH, isInteractive && (touchZoom || touchRotate)); this.toggleEvents(EVENT_TYPES.DOUBLE_TAP, isInteractive && doubleClickZoom); this.toggleEvents(EVENT_TYPES.KEYBOARD, isInteractive && keyboard); // Interaction toggles this.scrollZoom = scrollZoom; this.dragPan = dragPan; this.dragRotate = dragRotate; this.doubleClickZoom = doubleClickZoom; this.touchZoom = touchZoom; this.touchRotate = touchRotate; this.keyboard = keyboard; } }, { key: 'toggleEvents', value: function toggleEvents(eventNames, enabled) { var _this = this; if (this.eventManager) { eventNames.forEach(function (eventName) { if (_this._events[eventName] !== enabled) { _this._events[eventName] = enabled; if (enabled) { _this.eventManager.on(eventName, _this.handleEvent); } else { _this.eventManager.off(eventName, _this.handleEvent); } } }); } } // Private Methods }, { key: 'setState', value: function setState(newState) { Object.assign(this._state, newState); if (this.onStateChange) { this.onStateChange(this._state); } } /* Callback util */ // formats map state and invokes callback function }, { key: 'updateViewport', value: function updateViewport(newViewportState) { var extraProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var extraState = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var oldViewport = this.viewportState.getViewportProps(); var newViewport = Object.assign({}, newViewportState.getViewportProps(), extraProps); if (this.onViewportChange && Object.keys(newViewport).some(function (key) { return oldViewport[key] !== newViewport[key]; })) { // Viewport has changed var viewport = this.viewportState.getViewport ? this.viewportState.getViewport() : null; this.onViewportChange(newViewport, viewport); } this.setState(Object.assign({}, newViewportState.getInteractiveState(), extraState)); } /* Event handlers */ // Default handler for the `panstart` event. }, { key: '_onPanStart', value: function _onPanStart(event) { var pos = this.getCenter(event); var newViewportState = this.viewportState.panStart({ pos: pos }).rotateStart({ pos: pos }); return this.updateViewport(newViewportState, NO_TRANSITION_PROPS, { isDragging: true }); } // Default handler for the `panmove` event. }, { key: '_onPan', value: function _onPan(event) { return this.isFunctionKeyPressed(event) || event.rightButton ? this._onPanRotate(event) : this._onPanMove(event); } // Default handler for the `panend` event. }, { key: '_onPanEnd', value: function _onPanEnd(event) { var newViewportState = this.viewportState.panEnd().rotateEnd(); return this.updateViewport(newViewportState, null, { isDragging: false }); } // Default handler for panning to move. // Called by `_onPan` when panning without function key pressed. }, { key: '_onPanMove', value: function _onPanMove(event) { if (!this.dragPan) { return false; } var pos = this.getCenter(event); var newViewportState = this.viewportState.pan({ pos: pos }); return this.updateViewport(newViewportState, NO_TRANSITION_PROPS, { isDragging: true }); } // Default handler for panning to rotate. // Called by `_onPan` when panning with function key pressed. }, { key: '_onPanRotate', value: function _onPanRotate(event) { if (!this.dragRotate) { return false; } return this.viewportState instanceof _mapState2.default ? this._onPanRotateMap(event) : this._onPanRotateStandard(event); } // Normal pan to rotate }, { key: '_onPanRotateStandard', value: function _onPanRotateStandard(event) { var deltaX = event.deltaX, deltaY = event.deltaY; var _viewportState$getVie = this.viewportState.getViewportProps(), width = _viewportState$getVie.width, height = _viewportState$getVie.height; var deltaScaleX = deltaX / width; var deltaScaleY = deltaY / height; var newViewportState = this.viewportState.rotate({ deltaScaleX: deltaScaleX, deltaScaleY: deltaScaleY }); return this.updateViewport(newViewportState, NO_TRANSITION_PROPS, { isDragging: true }); } }, { key: '_onPanRotateMap', value: function _onPanRotateMap(event) { var deltaX = event.deltaX, deltaY = event.deltaY; var _getCenter = this.getCenter(event), _getCenter2 = _slicedToArray(_getCenter, 2), centerY = _getCenter2[1]; var startY = centerY - deltaY; var _viewportState$getVie2 = this.viewportState.getViewportProps(), width = _viewportState$getVie2.width, height = _viewportState$getVie2.height; var deltaScaleX = deltaX / width; var deltaScaleY = 0; if (deltaY > 0) { if (Math.abs(height - startY) > PITCH_MOUSE_THRESHOLD) { // Move from 0 to -1 as we drag upwards deltaScaleY = deltaY / (startY - height) * PITCH_ACCEL; } } else if (deltaY < 0) { if (startY > PITCH_MOUSE_THRESHOLD) { // Move from 0 to 1 as we drag upwards deltaScaleY = 1 - centerY / startY; } } deltaScaleY = Math.min(1, Math.max(-1, deltaScaleY)); var newViewportState = this.viewportState.rotate({ deltaScaleX: deltaScaleX, deltaScaleY: deltaScaleY }); return this.updateViewport(newViewportState, NO_TRANSITION_PROPS, { isDragging: true }); } // Default handler for the `wheel` event. }, { key: '_onWheel', value: function _onWheel(event) { if (!this.scrollZoom) { return false; } var pos = this.getCenter(event); var delta = event.delta; // Map wheel delta to relative scale var scale = 2 / (1 + Math.exp(-Math.abs(delta * ZOOM_ACCEL))); if (delta < 0 && scale !== 0) { scale = 1 / scale; } var newViewportState = this.viewportState.zoom({ pos: pos, scale: scale }); return this.updateViewport(newViewportState, NO_TRANSITION_PROPS); } // Default handler for the `pinchstart` event. }, { key: '_onPinchStart', value: function _onPinchStart(event) { var pos = this.getCenter(event); var newViewportState = this.viewportState.zoomStart({ pos: pos }).rotateStart({ pos: pos }); // hack - hammer's `rotation` field doesn't seem to produce the correct angle this._state.startPinchRotation = event.rotation; return this.updateViewport(newViewportState, NO_TRANSITION_PROPS, { isDragging: true }); } // Default handler for the `pinch` event. }, { key: '_onPinch', value: function _onPinch(event) { if (!this.touchZoom && !this.touchRotate) { return false; } var newViewportState = this.viewportState; if (this.touchZoom) { var scale = event.scale; var pos = this.getCenter(event); newViewportState = newViewportState.zoom({ pos: pos, scale: scale }); } if (this.touchRotate) { var rotation = event.rotation; var startPinchRotation = this._state.startPinchRotation; newViewportState = newViewportState.rotate({ deltaScaleX: -(rotation - startPinchRotation) / 180 }); } return this.updateViewport(newViewportState, NO_TRANSITION_PROPS, { isDragging: true }); } // Default handler for the `pinchend` event. }, { key: '_onPinchEnd', value: function _onPinchEnd(event) { var newViewportState = this.viewportState.zoomEnd().rotateEnd(); this._state.startPinchRotation = 0; return this.updateViewport(newViewportState, null, { isDragging: false }); } // Default handler for the `doubletap` event. }, { key: '_onDoubleTap', value: function _onDoubleTap(event) { if (!this.doubleClickZoom) { return false; } var pos = this.getCenter(event); var isZoomOut = this.isFunctionKeyPressed(event); var newViewportState = this.viewportState.zoom({ pos: pos, scale: isZoomOut ? 0.5 : 2 }); return this.updateViewport(newViewportState, LINEAR_TRANSITION_PROPS); } /* eslint-disable complexity */ // Default handler for the `keydown` event }, { key: '_onKeyDown', value: function _onKeyDown(event) { if (!this.keyboard) { return false; } var funcKey = this.isFunctionKeyPressed(event); var viewportState = this.viewportState; var newViewportState = void 0; switch (event.srcEvent.keyCode) { case 189: // - newViewportState = funcKey ? viewportState.zoomOut().zoomOut() : viewportState.zoomOut(); break; case 187: // + newViewportState = funcKey ? viewportState.zoomIn().zoomIn() : viewportState.zoomIn(); break; case 37: // left newViewportState = funcKey ? viewportState.rotateLeft() : viewportState.moveLeft(); break; case 39: // right newViewportState = funcKey ? viewportState.rotateRight() : viewportState.moveRight(); break; case 38: // up newViewportState = funcKey ? viewportState.rotateUp() : viewportState.moveUp(); break; case 40: // down newViewportState = funcKey ? viewportState.rotateDown() : viewportState.moveDown(); break; default: return false; } return this.updateViewport(newViewportState, LINEAR_TRANSITION_PROPS); } /* eslint-enable complexity */ }]); return ViewportControls; }(); exports.default = ViewportControls; /***/ }), /* 122 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var counter = 0; var Effect = function () { function Effect() { _classCallCheck(this, Effect); this.id = 'effect'; this.count = counter++; this.visible = true; this.priority = 0; this.needsRedraw = false; } /** * subclasses should override to set up any resources needed */ _createClass(Effect, [{ key: 'initialize', value: function initialize(_ref) { var gl = _ref.gl, layerManager = _ref.layerManager; } /** * and subclasses should free those resources here */ }, { key: 'finalize', value: function finalize(_ref2) { var gl = _ref2.gl, layerManager = _ref2.layerManager; } /** * override for a callback immediately before drawing each frame */ }, { key: 'preDraw', value: function preDraw(_ref3) { var gl = _ref3.gl, layerManager = _ref3.layerManager; } /** * override for a callback immediately after drawing a frame's layers */ }, { key: 'draw', value: function draw(_ref4) { var gl = _ref4.gl, layerManager = _ref4.layerManager; } }, { key: 'setNeedsRedraw', value: function setNeedsRedraw() { var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.needsRedraw = redraw; } }]); return Effect; }(); exports.default = Effect; /***/ }), /* 123 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* global window */ var _constants = __webpack_require__(70); var _attributeManager = __webpack_require__(182); var _attributeManager2 = _interopRequireDefault(_attributeManager); var _stats = __webpack_require__(185); var _stats2 = _interopRequireDefault(_stats); var _count = __webpack_require__(194); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _createProps = __webpack_require__(340); var _props2 = __webpack_require__(187); var _seerIntegration = __webpack_require__(124); var _luma = __webpack_require__(12); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var LOG_PRIORITY_UPDATE = 1; var EMPTY_PROPS = Object.freeze({}); var noop = function noop() {}; var defaultProps = { // data: Special handling for null, see below dataComparator: null, updateTriggers: {}, // Update triggers: a core change detection mechanism in deck.gl numInstances: undefined, visible: true, pickable: false, opacity: 0.8, onHover: noop, onClick: noop, coordinateSystem: _constants.COORDINATE_SYSTEM.LNGLAT, coordinateOrigin: [0, 0, 0], parameters: {}, uniforms: {}, framebuffer: null, animation: null, // Passed prop animation functions to evaluate props // Offset depth based on layer index to avoid z-fighting. // Negative values pull layer towards the camera // https://www.opengl.org/archives/resources/faq/technical/polygonoffset.htm getPolygonOffset: function getPolygonOffset(_ref) { var layerIndex = _ref.layerIndex; return [0, -layerIndex * 100]; }, // Selection/Highlighting highlightedObjectIndex: null, autoHighlight: false, highlightColor: [0, 0, 128, 128] }; var counter = 0; var Layer = function () { // constructor(...propObjects) function Layer() { _classCallCheck(this, Layer); // Merges incoming props with defaults and freezes them. // TODO switch to spread operator once we no longer transpile this code // this.props = createProps.apply(propObjects); /* eslint-disable prefer-spread */ this.props = _createProps.createProps.apply(this, arguments); /* eslint-enable prefer-spread */ // Define all members before layer is sealed this.id = this.props.id; // The layer's id, used for matching with layers from last render cycle this.oldProps = EMPTY_PROPS; // Props from last render used for change detection this.count = counter++; // Keep track of how many layer instances you are generating this.lifecycle = _constants.LIFECYCLE.NO_STATE; // Helps track and debug the life cycle of the layers this.state = null; // Will be set to the shared layer state object during layer matching this.context = null; // Will reference layer manager's context, contains state shared by layers this.parentLayer = null; // reference to the composite layer parent that rendered this layer // CompositeLayer members, need to be defined here because of the `Object.seal` this.internalState = null; // Seal the layer Object.seal(this); } // clone this layer with modified props _createClass(Layer, [{ key: 'clone', value: function clone(newProps) { return new this.constructor(Object.assign({}, this.props, newProps)); } }, { key: 'toString', value: function toString() { var className = this.constructor.layerName || this.constructor.name; return className + '({id: \'' + this.props.id + '\'})'; } }, { key: 'setState', // Public API // Updates selected state members and marks the object for redraw value: function setState(updateObject) { Object.assign(this.state, updateObject); this.state.needsRedraw = true; } // Sets the redraw flag for this layer, will trigger a redraw next animation frame }, { key: 'setNeedsRedraw', value: function setNeedsRedraw() { var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; if (this.state) { this.state.needsRedraw = redraw; } } // Checks state of attributes and model }, { key: 'getNeedsRedraw', value: function getNeedsRedraw() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$clearRedrawFlag = _ref2.clearRedrawFlags, clearRedrawFlags = _ref2$clearRedrawFlag === undefined ? false : _ref2$clearRedrawFlag; return this._getNeedsRedraw(clearRedrawFlags); } // Return an array of models used by this layer, can be overriden by layer subclass }, { key: 'getModels', value: function getModels() { return this.state.models || (this.state.model ? [this.state.model] : []); } }, { key: 'needsUpdate', value: function needsUpdate() { // Call subclass lifecycle method return this.shouldUpdateState(this._getUpdateParams()); // End lifecycle method } // Returns true if the layer is pickable and visible. }, { key: 'isPickable', value: function isPickable() { return this.props.pickable && this.props.visible; } }, { key: 'getAttributeManager', value: function getAttributeManager() { return this.state && this.state.attributeManager; } // Use iteration (the only required capability on data) to get first element // deprecated }, { key: 'getFirstObject', value: function getFirstObject() { var data = this.props.data; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var object = _step.value; return object; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return null; } // PROJECTION METHODS /** * Projects a point with current map state (lat, lon, zoom, pitch, bearing) * * Note: Position conversion is done in shader, so in many cases there is no need * for this function * @param {Array|TypedArray} lngLat - long and lat values * @return {Array|TypedArray} - x, y coordinates */ }, { key: 'project', value: function project(lngLat) { debugger var viewport = this.context.viewport; (0, _assert2.default)(Array.isArray(lngLat), 'Layer.project needs [lng,lat]'); return viewport.project(lngLat); } }, { key: 'unproject', value: function unproject(xy) { debugger var viewport = this.context.viewport; (0, _assert2.default)(Array.isArray(xy), 'Layer.unproject needs [x,y]'); return viewport.unproject(xy); } }, { key: 'projectFlat', value: function projectFlat(lngLat) { var viewport = this.context.viewport; debugger (0, _assert2.default)(Array.isArray(lngLat), 'Layer.project needs [lng,lat]'); return viewport.projectFlat(lngLat); } }, { key: 'unprojectFlat', value: function unprojectFlat(xy) { var viewport = this.context.viewport; debugger (0, _assert2.default)(Array.isArray(xy), 'Layer.unproject needs [x,y]'); return viewport.unprojectFlat(xy); } // TODO - needs to refer to context }, { key: 'screenToDevicePixels', value: function screenToDevicePixels(screenPixels) { _log2.default.deprecated('screenToDevicePixels', 'DeckGL prop useDevicePixels for conversion'); var devicePixelRatio = typeof window !== 'undefined' ? window.devicePixelRatio : 1; return screenPixels * devicePixelRatio; } /** * Returns the picking color that doesn't match any subfeature * Use if some graphics do not belong to any pickable subfeature * @return {Array} - a black color */ }, { key: 'nullPickingColor', value: function nullPickingColor() { return [0, 0, 0]; } /** * Returns the picking color that doesn't match any subfeature * Use if some graphics do not belong to any pickable subfeature * @param {int} i - index to be decoded * @return {Array} - the decoded color */ }, { key: 'encodePickingColor', value: function encodePickingColor(i) { (0, _assert2.default)((i + 1 >> 24 & 255) === 0, 'index out of picking color range'); return [i + 1 & 255, i + 1 >> 8 & 255, i + 1 >> 8 >> 8 & 255]; } /** * Returns the picking color that doesn't match any subfeature * Use if some graphics do not belong to any pickable subfeature * @param {Uint8Array} color - color array to be decoded * @return {Array} - the decoded picking color */ }, { key: 'decodePickingColor', value: function decodePickingColor(color) { (0, _assert2.default)(color instanceof Uint8Array); var _color = _slicedToArray(color, 3), i1 = _color[0], i2 = _color[1], i3 = _color[2]; // 1 was added to seperate from no selection var index = i1 + i2 * 256 + i3 * 65536 - 1; return index; } // ////////////////////////////////////////////////// // LIFECYCLE METHODS, overridden by the layer subclasses // Called once to set up the initial state // App can create WebGL resources }, { key: 'initializeState', value: function initializeState() { throw new Error('Layer ' + this + ' has not defined initializeState'); } // Let's layer control if updateState should be called }, { key: 'shouldUpdateState', value: function shouldUpdateState(_ref3) { var oldProps = _ref3.oldProps, props = _ref3.props, oldContext = _ref3.oldContext, context = _ref3.context, changeFlags = _ref3.changeFlags; return changeFlags.propsOrDataChanged; } // Default implementation, all attributes will be invalidated and updated // when data changes }, { key: 'updateState', value: function updateState(_ref4) { var oldProps = _ref4.oldProps, props = _ref4.props, oldContext = _ref4.oldContext, context = _ref4.context, changeFlags = _ref4.changeFlags; var attributeManager = this.getAttributeManager(); if (changeFlags.dataChanged && attributeManager) { attributeManager.invalidateAll(); } } // Called once when layer is no longer matched and state will be discarded // App can destroy WebGL resources here }, { key: 'finalizeState', value: function finalizeState() {} // Update attribute transition }, { key: 'updateTransition', value: function updateTransition() { var _state = this.state, model = _state.model, attributeManager = _state.attributeManager; var isInTransition = attributeManager && attributeManager.updateTransition(); if (model && isInTransition) { model.setAttributes(attributeManager.getChangedAttributes({ transition: true })); } } // If state has a model, draw it with supplied uniforms }, { key: 'draw', value: function draw(opts) { var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this.getModels()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var model = _step2.value; model.draw(opts); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } // called to populate the info object that is passed to the event handler // @return null to cancel event }, { key: 'getPickingInfo', value: function getPickingInfo(_ref5) { var info = _ref5.info, mode = _ref5.mode; var index = info.index; if (index >= 0) { // If props.data is an indexable array, get the object if (Array.isArray(this.props.data)) { info.object = this.props.data[index]; } } return info; } // END LIFECYCLE METHODS // ////////////////////////////////////////////////// // Default implementation of attribute invalidation, can be redefined }, { key: 'invalidateAttribute', value: function invalidateAttribute() { var name = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'all'; var diffReason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; var attributeManager = this.getAttributeManager(); if (!attributeManager) { return; } if (name === 'all') { _log2.default.log(LOG_PRIORITY_UPDATE, 'updateTriggers invalidating all attributes: ' + diffReason); attributeManager.invalidateAll(); } else { _log2.default.log(LOG_PRIORITY_UPDATE, 'updateTriggers invalidating attribute ' + name + ': ' + diffReason); attributeManager.invalidate(name); } } // Calls attribute manager to update any WebGL attributes, can be redefined }, { key: 'updateAttributes', value: function updateAttributes(props) { var attributeManager = this.getAttributeManager(); if (!attributeManager) { return; } // Figure out data length var numInstances = this.getNumInstances(props); attributeManager.update({ data: props.data, numInstances: numInstances, props: props, transitions: props.transitions, buffers: props, context: this, // Don't worry about non-attribute props ignoreUnknownAttributes: true }); // TODO - Use getModels? var model = this.state.model; if (model) { var changedAttributes = attributeManager.getChangedAttributes({ clearChangedFlags: true }); model.setAttributes(changedAttributes); } } }, { key: 'calculateInstancePickingColors', value: function calculateInstancePickingColors(attribute, _ref6) { var numInstances = _ref6.numInstances; var value = attribute.value, size = attribute.size; // add 1 to index to seperate from no selection for (var i = 0; i < numInstances; i++) { var pickingColor = this.encodePickingColor(i); value[i * size + 0] = pickingColor[0]; value[i * size + 1] = pickingColor[1]; value[i * size + 2] = pickingColor[2]; } } // INTERNAL METHODS // Deduces numer of instances. Intention is to support: // - Explicit setting of numInstances // - Auto-deduction for ES6 containers that define a size member // - Auto-deduction for Classic Arrays via the built-in length attribute // - Auto-deduction via arrays }, { key: 'getNumInstances', value: function getNumInstances(props) { props = props || this.props; // First check if the layer has set its own value if (this.state && this.state.numInstances !== undefined) { return this.state.numInstances; } // Check if app has provided an explicit value if (props.numInstances !== undefined) { return props.numInstances; } // Use container library to get a count for any ES6 container or object var _props = props, data = _props.data; return (0, _count.count)(data); } // LAYER MANAGER API // Should only be called by the deck.gl LayerManager class // Called by layer manager when a new layer is found /* eslint-disable max-statements */ }, { key: '_initialize', value: function _initialize() { (0, _assert2.default)(arguments.length === 0); (0, _assert2.default)(this.context.gl); (0, _assert2.default)(!this.state); var attributeManager = new _attributeManager2.default(this.context.gl, { id: this.props.id }); // All instanced layers get instancePickingColors attribute by default // Their shaders can use it to render a picking scene // TODO - this slightly slows down non instanced layers attributeManager.addInstanced({ instancePickingColors: { type: _luma.GL.UNSIGNED_BYTE, size: 3, update: this.calculateInstancePickingColors } }); this.internalState = { subLayers: null, // reference to sublayers rendered in a previous cycle stats: new _stats2.default({ id: 'draw' }) // animatedProps: null, // Computing animated props requires layer manager state // TODO - move these fields here (risks breaking layers) // attributeManager, // needsRedraw: true, }; this.state = { attributeManager: attributeManager, model: null, needsRedraw: true }; // Call subclass lifecycle methods this.initializeState(this.context); // End subclass lifecycle methods // initializeState callback tends to clear state this.setChangeFlags({ dataChanged: true, propsChanged: true, viewportChanged: true }); this._updateState(this._getUpdateParams()); if (this.isComposite) { this._renderLayers(true); } var model = this.state.model; if (model) { model.id = this.props.id; model.program.id = this.props.id + '-program'; model.geometry.id = this.props.id + '-geometry'; model.setAttributes(attributeManager.getAttributes()); } // Last but not least, update any sublayers if (this.isComposite) { this._renderLayers(); } this.clearChangeFlags(); } // Called by layer manager // if this layer is new (not matched with an existing layer) oldProps will be empty object }, { key: '_update', value: function _update() { (0, _assert2.default)(arguments.length === 0); // Call subclass lifecycle method var stateNeedsUpdate = this.needsUpdate(); // End lifecycle method var updateParams = this._getUpdateParams(); if (stateNeedsUpdate) { this._updateState(updateParams); } // Render or update previously rendered sublayers if (this.isComposite) { this._renderLayers(stateNeedsUpdate); } this.clearChangeFlags(); // Release old props for GC once update is complete this.oldProps = EMPTY_PROPS; } /* eslint-enable max-statements */ }, { key: '_updateState', value: function _updateState(updateParams) { // Call subclass lifecycle methods this.updateState(updateParams); // End subclass lifecycle methods // Add any subclass attributes this.updateAttributes(this.props); this._updateBaseUniforms(); this._updateModuleSettings(); // Note: Automatic instance count update only works for single layers if (this.state.model) { this.state.model.setInstanceCount(this.getNumInstances()); } } // Called by manager when layer is about to be disposed // Note: not guaranteed to be called on application shutdown }, { key: '_finalize', value: function _finalize() { (0, _assert2.default)(arguments.length === 0); // Call subclass lifecycle method this.finalizeState(this.context); // End lifecycle method (0, _seerIntegration.removeLayerInSeer)(this.id); } // Calculates uniforms }, { key: 'drawLayer', value: function drawLayer(_ref7) { var _this = this; var _ref7$moduleParameter = _ref7.moduleParameters, moduleParameters = _ref7$moduleParameter === undefined ? null : _ref7$moduleParameter, _ref7$uniforms = _ref7.uniforms, uniforms = _ref7$uniforms === undefined ? {} : _ref7$uniforms, _ref7$parameters = _ref7.parameters, parameters = _ref7$parameters === undefined ? {} : _ref7$parameters; if (!uniforms.picking_uActive) { this.updateTransition(); } // TODO/ib - hack move to luma Model.draw if (moduleParameters) { var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = this.getModels()[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var model = _step3.value; model.updateModuleSettings(moduleParameters); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } // Apply polygon offset to avoid z-fighting // TODO - move to draw-layers var getPolygonOffset = this.props.getPolygonOffset; var offsets = getPolygonOffset && getPolygonOffset(uniforms) || [0, 0]; parameters.polygonOffset = offsets; // Call subclass lifecycle method (0, _luma.withParameters)(this.context.gl, parameters, function () { _this.draw({ moduleParameters: moduleParameters, uniforms: uniforms, parameters: parameters, context: _this.context }); }); // End lifecycle method } // {uniforms = {}, ...opts} }, { key: 'pickLayer', value: function pickLayer(opts) { // Call subclass lifecycle method return this.getPickingInfo(opts); // End lifecycle method } // Helper methods }, { key: 'getChangeFlags', value: function getChangeFlags() { return this.internalState.changeFlags; } // Dirty some change flags, will be handled by updateLayer /* eslint-disable complexity */ }, { key: 'setChangeFlags', value: function setChangeFlags(flags) { var _this2 = this; this.internalState.changeFlags = this.internalState.changeFlags || {}; var changeFlags = this.internalState.changeFlags; // Update primary flags if (flags.dataChanged && !changeFlags.dataChanged) { changeFlags.dataChanged = flags.dataChanged; _log2.default.log(LOG_PRIORITY_UPDATE + 1, function () { return 'dataChanged: ' + flags.dataChanged + ' in ' + _this2.id; }); } if (flags.updateTriggersChanged && !changeFlags.updateTriggersChanged) { changeFlags.updateTriggersChanged = changeFlags.updateTriggersChanged && flags.updateTriggersChanged ? Object.assign({}, flags.updateTriggersChanged, changeFlags.updateTriggersChanged) : flags.updateTriggersChanged || changeFlags.updateTriggersChanged; _log2.default.log(LOG_PRIORITY_UPDATE + 1, function () { return 'updateTriggersChanged: ' + (Object.keys(flags.updateTriggersChanged).join(', ') + ' in ' + _this2.id); }); } if (flags.propsChanged && !changeFlags.propsChanged) { changeFlags.propsChanged = flags.propsChanged; _log2.default.log(LOG_PRIORITY_UPDATE + 1, function () { return 'propsChanged: ' + flags.propsChanged + ' in ' + _this2.id; }); } if (flags.viewportChanged && !changeFlags.viewportChanged) { changeFlags.viewportChanged = flags.viewportChanged; _log2.default.log(LOG_PRIORITY_UPDATE + 2, function () { return 'viewportChanged: ' + flags.viewportChanged + ' in ' + _this2.id; }); } // Update composite flags var propsOrDataChanged = flags.dataChanged || flags.updateTriggersChanged || flags.propsChanged; changeFlags.propsOrDataChanged = changeFlags.propsOrDataChanged || propsOrDataChanged; changeFlags.somethingChanged = changeFlags.somethingChanged || propsOrDataChanged || flags.viewportChanged; } /* eslint-enable complexity */ // Clear all changeFlags, typically after an update }, { key: 'clearChangeFlags', value: function clearChangeFlags() { this.internalState.changeFlags = { // Primary changeFlags, can be strings stating reason for change dataChanged: false, propsChanged: false, updateTriggersChanged: false, viewportChanged: false, // Derived changeFlags propsOrDataChanged: false, somethingChanged: false }; } }, { key: 'printChangeFlags', value: function printChangeFlags() { var flags = this.internalState.changeFlags; return '' + (flags.dataChanged ? 'data ' : '') + (flags.propsChanged ? 'props ' : '') + (flags.updateTriggersChanged ? 'triggers ' : '') + (flags.viewportChanged ? 'viewport' : ''); } // Compares the layers props with old props from a matched older layer // and extracts change flags that describe what has change so that state // can be update correctly with minimal effort // TODO - arguments for testing only }, { key: 'diffProps', value: function diffProps() { var newProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props; var oldProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.oldProps; var changeFlags = (0, _props2.diffProps)(newProps, oldProps); // iterate over changedTriggers if (changeFlags.updateTriggersChanged) { for (var key in changeFlags.updateTriggersChanged) { if (changeFlags.updateTriggersChanged[key]) { this._activeUpdateTrigger(key); } } } return this.setChangeFlags(changeFlags); } // PRIVATE METHODS }, { key: '_getUpdateParams', value: function _getUpdateParams() { return { props: this.props, oldProps: this.oldProps, context: this.context, oldContext: this.oldContext || {}, changeFlags: this.internalState.changeFlags }; } // Checks state of attributes and model }, { key: '_getNeedsRedraw', value: function _getNeedsRedraw(clearRedrawFlags) { // this method may be called by the render loop as soon a the layer // has been created, so guard against uninitialized state if (!this.state) { return false; } var redraw = false; redraw = redraw || this.state.needsRedraw && this.id; this.state.needsRedraw = this.state.needsRedraw && !clearRedrawFlags; // TODO - is attribute manager needed? - Model should be enough. var attributeManager = this.getAttributeManager(); var attributeManagerNeedsRedraw = attributeManager && attributeManager.getNeedsRedraw({ clearRedrawFlags: clearRedrawFlags }); redraw = redraw || attributeManagerNeedsRedraw; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = this.getModels()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var model = _step4.value; var modelNeedsRedraw = model.getNeedsRedraw({ clearRedrawFlags: clearRedrawFlags }); if (modelNeedsRedraw && typeof modelNeedsRedraw !== 'string') { modelNeedsRedraw = 'model ' + model.id; } redraw = redraw || modelNeedsRedraw; } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } return redraw; } // Called by layer manager to transfer state from an old layer }, { key: '_transferState', value: function _transferState(oldLayer) { var state = oldLayer.state, internalState = oldLayer.internalState, props = oldLayer.props; (0, _assert2.default)(state && internalState); // Move state state.layer = this; this.state = state; this.internalState = internalState; // Note: We keep the state ref on old layers to support async actions // oldLayer.state = null; // Keep a temporary ref to the old props, for prop comparison this.oldProps = props; // Update model layer reference var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = this.getModels()[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var model = _step5.value; model.userData.layer = this; } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } this.diffProps(); } // Operate on each changed triggers, will be called when an updateTrigger changes }, { key: '_activeUpdateTrigger', value: function _activeUpdateTrigger(propName) { this.invalidateAttribute(propName); } // Helper to check that required props are supplied }, { key: '_checkRequiredProp', value: function _checkRequiredProp(propertyName, condition) { var value = this.props[propertyName]; if (value === undefined) { throw new Error('Property ' + propertyName + ' undefined in layer ' + this); } if (condition && !condition(value)) { throw new Error('Bad property ' + propertyName + ' in layer ' + this); } } }, { key: '_updateBaseUniforms', value: function _updateBaseUniforms() { var uniforms = { // apply gamma to opacity to make it visually "linear" opacity: Math.pow(this.props.opacity, 1 / 2.2), ONE: 1.0 }; var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = this.getModels()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var model = _step6.value; model.setUniforms(uniforms); } // TODO - set needsRedraw on the model(s)? } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } this.state.needsRedraw = true; } }, { key: '_updateModuleSettings', value: function _updateModuleSettings() { var settings = { pickingHighlightColor: this.props.highlightColor }; var _iteratorNormalCompletion7 = true; var _didIteratorError7 = false; var _iteratorError7 = undefined; try { for (var _iterator7 = this.getModels()[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { var model = _step7.value; model.updateModuleSettings(settings); } } catch (err) { _didIteratorError7 = true; _iteratorError7 = err; } finally { try { if (!_iteratorNormalCompletion7 && _iterator7.return) { _iterator7.return(); } } finally { if (_didIteratorError7) { throw _iteratorError7; } } } } // DEPRECATED METHODS // Updates selected state members and marks the object for redraw }, { key: 'setUniforms', value: function setUniforms(uniformMap) { var _iteratorNormalCompletion8 = true; var _didIteratorError8 = false; var _iteratorError8 = undefined; try { for (var _iterator8 = this.getModels()[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) { var model = _step8.value; model.setUniforms(uniformMap); } // TODO - set needsRedraw on the model(s)? } catch (err) { _didIteratorError8 = true; _iteratorError8 = err; } finally { try { if (!_iteratorNormalCompletion8 && _iterator8.return) { _iterator8.return(); } } finally { if (_didIteratorError8) { throw _iteratorError8; } } } this.state.needsRedraw = true; _log2.default.deprecated('layer.setUniforms', 'model.setUniforms'); } }, { key: 'stats', get: function get() { return this.internalState.stats; } }]); return Layer; }(); exports.default = Layer; Layer.layerName = 'Layer'; Layer.defaultProps = defaultProps; /***/ }), /* 124 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.removeLayerInSeer = exports.updateLayerInSeer = exports.initLayerInSeer = exports.seerInitListener = exports.layerEditListener = exports.applyPropOverrides = exports.setPropOverrides = undefined; var _seer = __webpack_require__(173); var _seer2 = _interopRequireDefault(_seer); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } /** * Recursively set a nested property of an object given a properties array and a value */ var recursiveSet = function recursiveSet(obj, path, value) { if (!obj) { return; } if (path.length > 1) { recursiveSet(obj[path[0]], path.slice(1), value); } else { obj[path[0]] = value; } }; var overrides = new Map(); /** * Create an override on the specify layer, indexed by a valuePath array. * Do nothing in case Seer as not been initialized to prevent any preformance drawback. */ var setPropOverrides = exports.setPropOverrides = function setPropOverrides(id, valuePath, value) { if (!_seer2.default.isReady()) { return; } if (!overrides.has(id)) { overrides.set(id, new Map()); } var props = overrides.get(id); props.set(valuePath, value); }; /** * Get the props overrides of a specific layer if Seer as been initialized * Invalidates the data to be sure new ones are always picked up. */ var applyPropOverrides = exports.applyPropOverrides = function applyPropOverrides(props) { if (!_seer2.default.isReady() || !props.id) { return; } var overs = overrides.get(props.id); if (!overs) { return; } overs.forEach(function (value, valuePath) { recursiveSet(props, valuePath, value); // Invalidate data array if we have a data override if (valuePath[0] === 'data') { props.data = [].concat(_toConsumableArray(props.data)); } }); }; /** * Listen for deck.gl edit events */ var layerEditListener = exports.layerEditListener = function layerEditListener(cb) { if (!_seer2.default.isReady()) { return; } _seer2.default.listenFor('deck.gl', cb); }; /** * Listen for seer init events to resend data */ var seerInitListener = exports.seerInitListener = function seerInitListener(cb) { if (!_seer2.default.isReady()) { return; } _seer2.default.listenFor('init', cb); }; var initLayerInSeer = exports.initLayerInSeer = function initLayerInSeer(layer) { if (!_seer2.default.isReady() || !layer) { return; } var badges = [layer.constructor.layerName]; _seer2.default.listItem('deck.gl', layer.id, { badges: badges, // TODO: Seer currently only handles single model layers links: layer.state && layer.state.model ? ['luma.gl:' + layer.state.model.id] : undefined, parent: layer.parentLayer ? layer.parentLayer.id : undefined }); }; /** * Log layer's properties to Seer */ var updateLayerInSeer = exports.updateLayerInSeer = function updateLayerInSeer(layer) { if (!_seer2.default.isReady() || _seer2.default.throttle('deck.gl:' + layer.id, 1e3)) { return; } var data = logPayload(layer); _seer2.default.multiUpdate('deck.gl', layer.id, data); }; /** * On finalize of a specify layer, remove it from seer */ var removeLayerInSeer = exports.removeLayerInSeer = function removeLayerInSeer(id) { if (!_seer2.default.isReady() || !id) { return; } _seer2.default.deleteItem('deck.gl', id); }; function logPayload(layer) { var data = [{ path: 'objects.props', data: layer.props }]; var badges = [layer.constructor.layerName]; if (layer.state) { if (layer.state.attributeManager) { var attrs = layer.state.attributeManager.getAttributes(); data.push({ path: 'objects.attributes', data: attrs }); badges.push(layer.state.attributeManager.stats.getTimeString()); } // TODO: Seer currently only handles single model layers if (layer.state.model) { layer.state.model.timerQueryEnabled = true; var lastFrameTime = layer.state.model.stats.lastFrameTime; if (lastFrameTime) { badges.push((lastFrameTime * 1000).toFixed(0) + '\u03BCs'); } } } data.push({ path: 'badges', data: badges }); return data; } /***/ }), /* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _transitionInterpolator = __webpack_require__(193); var _transitionInterpolator2 = _interopRequireDefault(_transitionInterpolator); var _transitionUtils = __webpack_require__(84); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom', 'bearing', 'pitch']; /** * Performs linear interpolation of two viewports. */ var LinearInterpolator = function (_TransitionInterpolat) { _inherits(LinearInterpolator, _TransitionInterpolat); /** * @param {Array} transitionProps - list of props to apply linear transition to. */ function LinearInterpolator() { var transitionProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : VIEWPORT_TRANSITION_PROPS; _classCallCheck(this, LinearInterpolator); var _this = _possibleConstructorReturn(this, (LinearInterpolator.__proto__ || Object.getPrototypeOf(LinearInterpolator)).call(this)); _this.propNames = transitionProps; return _this; } _createClass(LinearInterpolator, [{ key: 'initializeProps', value: function initializeProps(startProps, endProps) { var startViewportProps = {}; var endViewportProps = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = this.propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; var startValue = startProps[key]; var endValue = endProps[key]; (0, _assert2.default)((0, _transitionUtils.isValid)(startValue) && (0, _transitionUtils.isValid)(endValue), key + ' must be supplied for transition'); startViewportProps[key] = startValue; endViewportProps[key] = (0, _transitionUtils.getEndValueByShortestPath)(key, startValue, endValue); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return { start: startViewportProps, end: endViewportProps }; } }, { key: 'interpolateProps', value: function interpolateProps(startProps, endProps, t) { var viewport = {}; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this.propNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var key = _step2.value; viewport[key] = (0, _transitionUtils.lerp)(startProps[key], endProps[key], t); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return viewport; } }]); return LinearInterpolator; }(_transitionInterpolator2.default); exports.default = LinearInterpolator; /***/ }), /* 126 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.flatten = flatten; exports.countVertices = countVertices; exports.flattenVertices = flattenVertices; exports.fillArray = fillArray; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /** * Flattens a nested array into a single level array, * or a single value into an array with one value * @example flatten([[1, [2]], [3], 4]) => [1, 2, 3, 4] * @example flatten(1) => [1] * @param {Array} array The array to flatten. * @param {Function} filter= - Optional predicate called on each `value` to * determine if it should be included (pushed onto) the resulting array. * @param {Function} map= - Optional transform applied to each array elements. * @param {Array} result=[] - Optional array to push value into * @return {Array} Returns the new flattened array (new array or `result` if provided) */ function flatten(array) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$filter = _ref.filter, filter = _ref$filter === undefined ? function () { return true; } : _ref$filter, _ref$map = _ref.map, map = _ref$map === undefined ? function (x) { return x; } : _ref$map, _ref$result = _ref.result, result = _ref$result === undefined ? [] : _ref$result; // Wrap single object in array if (!Array.isArray(array)) { return filter(array) ? [map(array)] : []; } // Deep flatten and filter the array return flattenArray(array, filter, map, result); } // Deep flattens an array. Helper to `flatten`, see its parameters function flattenArray(array, filter, map, result) { var index = -1; while (++index < array.length) { var value = array[index]; if (Array.isArray(value)) { flattenArray(value, filter, map, result); } else if (filter(value)) { result.push(map(value)); } } return result; } function countVertices(nestedArray) { var count = 0; var index = -1; while (++index < nestedArray.length) { var value = nestedArray[index]; if (Array.isArray(value) || ArrayBuffer.isView(value)) { count += countVertices(value); } else { count++; } } return count; } // Flattens nested array of vertices, padding third coordinate as needed function flattenVertices(nestedArray) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$result = _ref2.result, result = _ref2$result === undefined ? [] : _ref2$result, _ref2$dimensions = _ref2.dimensions, dimensions = _ref2$dimensions === undefined ? 3 : _ref2$dimensions; var index = -1; var vertexLength = 0; while (++index < nestedArray.length) { var value = nestedArray[index]; if (Array.isArray(value) || ArrayBuffer.isView(value)) { flattenVertices(value, { result: result, dimensions: dimensions }); } else { // eslint-disable-next-line if (vertexLength < dimensions) { result.push(value); vertexLength++; } } } // Add a third coordinate if needed if (vertexLength > 0 && vertexLength < dimensions) { result.push(0); } return result; } // Uses copyWithin to significantly speed up typed array value filling function fillArray(_ref3) { var target = _ref3.target, source = _ref3.source, _ref3$start = _ref3.start, start = _ref3$start === undefined ? 0 : _ref3$start, _ref3$count = _ref3.count, count = _ref3$count === undefined ? 1 : _ref3$count; var length = source.length; var total = count * length; var copied = 0; for (var i = start; copied < length; copied++) { target[i++] = source[copied]; } while (copied < total) { // If we have copied less than half, copy everything we got // else copy remaining in one operation if (copied < total - copied) { target.copyWithin(start + copied, start, start + copied); copied *= 2; } else { target.copyWithin(start + copied, start, start + total - copied); copied = total; } } return target; } // Flattens nested array of vertices, padding third coordinate as needed /* export function flattenTypedVertices(nestedArray, { result = [], Type = Float32Array, start = 0, dimensions = 3 } = {}) { let index = -1; let vertexLength = 0; while (++index < nestedArray.length) { const value = nestedArray[index]; if (Array.isArray(value) || ArrayBuffer.isView(value)) { start = flattenTypedVertices(value, {result, start, dimensions}); } else { if (vertexLength < dimensions) { // eslint-disable-line result[start++] = value; vertexLength++; } } } // Add a third coordinate if needed if (vertexLength > 0 && vertexLength < dimensions) { result[start++] = 0; } return start; } */ /***/ }), /* 127 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.transformVector = transformVector; exports.createMat4 = createMat4; exports.extractCameraVectors = extractCameraVectors; exports.mod = mod; var _multiply = __webpack_require__(246); var _multiply2 = _interopRequireDefault(_multiply); var _transformMat = __webpack_require__(103); var _transformMat2 = _interopRequireDefault(_transformMat); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function transformVector(matrix, vector) { // Handle non-invertible matrix if (!matrix) { return null; } var result = (0, _transformMat2.default)([0, 0, 0, 0], vector, matrix); var scale = 1 / result[3]; (0, _multiply2.default)(result, result, [scale, scale, scale, scale]); return result; } // Helper, avoids low-precision 32 bit matrices from gl-matrix mat4.create() // Extensions to math.gl library. Intended to be folded back. function createMat4() { return [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; } // Extract camera vectors (move to math library?) function extractCameraVectors(_ref) { var viewMatrix = _ref.viewMatrix, viewMatrixInverse = _ref.viewMatrixInverse; // Read the translation from the inverse view matrix return { eye: [viewMatrixInverse[12], viewMatrixInverse[13], viewMatrixInverse[14]], direction: [viewMatrix[2], viewMatrix[6], viewMatrix[10]], up: [viewMatrix[1], viewMatrix[5], viewMatrix[9]] }; } function mod(value, divisor) { (0, _assert2.default)(Number.isFinite(value) && Number.isFinite(divisor)); var modulus = value % divisor; return modulus < 0 ? divisor + modulus : modulus; } /***/ }), /* 128 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var toObject = __webpack_require__(14); var toAbsoluteIndex = __webpack_require__(57); var toLength = __webpack_require__(11); module.exports = function fill(value /* , start = 0, end = @length */) { var O = toObject(this); var length = toLength(O.length); var aLen = arguments.length; var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length); var end = aLen > 2 ? arguments[2] : undefined; var endPos = end === undefined ? length : toAbsoluteIndex(end, length); while (endPos > index) O[index++] = value; return O; }; /***/ }), /* 129 */ /***/ (function(module, exports, __webpack_require__) { // 9.4.2.3 ArraySpeciesCreate(originalArray, length) var speciesConstructor = __webpack_require__(368); module.exports = function (original, length) { return new (speciesConstructor(original))(length); }; /***/ }), /* 130 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $defineProperty = __webpack_require__(10); var createDesc = __webpack_require__(54); module.exports = function (object, index, value) { if (index in object) $defineProperty.f(object, index, createDesc(0, value)); else object[index] = value; }; /***/ }), /* 131 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(5); var document = __webpack_require__(3).document; // typeof document.createElement is 'object' in old IE var is = isObject(document) && isObject(document.createElement); module.exports = function (it) { return is ? document.createElement(it) : {}; }; /***/ }), /* 132 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys module.exports = ( 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf' ).split(','); /***/ }), /* 133 */ /***/ (function(module, exports, __webpack_require__) { var MATCH = __webpack_require__(6)('match'); module.exports = function (KEY) { var re = /./; try { '/./'[KEY](re); } catch (e) { try { re[MATCH] = false; return !'/./'[KEY](re); } catch (f) { /* empty */ } } return true; }; /***/ }), /* 134 */ /***/ (function(module, exports, __webpack_require__) { var document = __webpack_require__(3).document; module.exports = document && document.documentElement; /***/ }), /* 135 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(5); var setPrototypeOf = __webpack_require__(143).set; module.exports = function (that, target, C) { var S = target.constructor; var P; if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) { setPrototypeOf(that, P); } return that; }; /***/ }), /* 136 */ /***/ (function(module, exports, __webpack_require__) { // check on default Array iterator var Iterators = __webpack_require__(63); var ITERATOR = __webpack_require__(6)('iterator'); var ArrayProto = Array.prototype; module.exports = function (it) { return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it); }; /***/ }), /* 137 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var create = __webpack_require__(51); var descriptor = __webpack_require__(54); var setToStringTag = __webpack_require__(64); var IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() __webpack_require__(19)(IteratorPrototype, __webpack_require__(6)('iterator'), function () { return this; }); module.exports = function (Constructor, NAME, next) { Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) }); setToStringTag(Constructor, NAME + ' Iterator'); }; /***/ }), /* 138 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(50); var $export = __webpack_require__(0); var redefine = __webpack_require__(20); var hide = __webpack_require__(19); var has = __webpack_require__(18); var Iterators = __webpack_require__(63); var $iterCreate = __webpack_require__(137); var setToStringTag = __webpack_require__(64); var getPrototypeOf = __webpack_require__(23); var ITERATOR = __webpack_require__(6)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; var KEYS = 'keys'; var VALUES = 'values'; var returnThis = function () { return this; }; module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) { $iterCreate(Constructor, NAME, next); var getMethod = function (kind) { if (!BUGGY && kind in proto) return proto[kind]; switch (kind) { case KEYS: return function keys() { return new Constructor(this, kind); }; case VALUES: return function values() { return new Constructor(this, kind); }; } return function entries() { return new Constructor(this, kind); }; }; var TAG = NAME + ' Iterator'; var DEF_VALUES = DEFAULT == VALUES; var VALUES_BUG = false; var proto = Base.prototype; var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]; var $default = (!BUGGY && $native) || getMethod(DEFAULT); var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined; var $anyNative = NAME == 'Array' ? proto.entries || $native : $native; var methods, key, IteratorPrototype; // Fix native if ($anyNative) { IteratorPrototype = getPrototypeOf($anyNative.call(new Base())); if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) { // Set @@toStringTag to native iterators setToStringTag(IteratorPrototype, TAG, true); // fix for some old engines if (!LIBRARY && !has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis); } } // fix Array#{values, @@iterator}.name in V8 / FF if (DEF_VALUES && $native && $native.name !== VALUES) { VALUES_BUG = true; $default = function values() { return $native.call(this); }; } // Define iterator if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) { hide(proto, ITERATOR, $default); } // Plug for library Iterators[NAME] = $default; Iterators[TAG] = returnThis; if (DEFAULT) { methods = { values: DEF_VALUES ? $default : getMethod(VALUES), keys: IS_SET ? $default : getMethod(KEYS), entries: $entries }; if (FORCED) for (key in methods) { if (!(key in proto)) redefine(proto, key, methods[key]); } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods); } return methods; }; /***/ }), /* 139 */ /***/ (function(module, exports) { // 20.2.2.14 Math.expm1(x) var $expm1 = Math.expm1; module.exports = (!$expm1 // Old FF bug || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168 // Tor Browser bug || $expm1(-2e-17) != -2e-17 ) ? function expm1(x) { return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1; } : $expm1; /***/ }), /* 140 */ /***/ (function(module, exports) { // 20.2.2.28 Math.sign(x) module.exports = Math.sign || function sign(x) { // eslint-disable-next-line no-self-compare return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1; }; /***/ }), /* 141 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var macrotask = __webpack_require__(149).set; var Observer = global.MutationObserver || global.WebKitMutationObserver; var process = global.process; var Promise = global.Promise; var isNode = __webpack_require__(27)(process) == 'process'; module.exports = function () { var head, last, notify; var flush = function () { var parent, fn; if (isNode && (parent = process.domain)) parent.exit(); while (head) { fn = head.fn; head = head.next; try { fn(); } catch (e) { if (head) notify(); else last = undefined; throw e; } } last = undefined; if (parent) parent.enter(); }; // Node.js if (isNode) { notify = function () { process.nextTick(flush); }; // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339 } else if (Observer && !(global.navigator && global.navigator.standalone)) { var toggle = true; var node = document.createTextNode(''); new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new notify = function () { node.data = toggle = !toggle; }; // environments with maybe non-completely correct, but existent Promise } else if (Promise && Promise.resolve) { var promise = Promise.resolve(); notify = function () { promise.then(flush); }; // for other environments - macrotask based on: // - setImmediate // - MessageChannel // - window.postMessag // - onreadystatechange // - setTimeout } else { notify = function () { // strange IE + webpack dev server bug - use .call(global) macrotask.call(global, flush); }; } return function (fn) { var task = { fn: fn, next: undefined }; if (last) last.next = task; if (!head) { head = task; notify(); } last = task; }; }; /***/ }), /* 142 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 25.4.1.5 NewPromiseCapability(C) var aFunction = __webpack_require__(15); function PromiseCapability(C) { var resolve, reject; this.promise = new C(function ($$resolve, $$reject) { if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor'); resolve = $$resolve; reject = $$reject; }); this.resolve = aFunction(resolve); this.reject = aFunction(reject); } module.exports.f = function (C) { return new PromiseCapability(C); }; /***/ }), /* 143 */ /***/ (function(module, exports, __webpack_require__) { // Works with __proto__ only. Old v8 can't work with null proto objects. /* eslint-disable no-proto */ var isObject = __webpack_require__(5); var anObject = __webpack_require__(2); var check = function (O, proto) { anObject(O); if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!"); }; module.exports = { set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line function (test, buggy, set) { try { set = __webpack_require__(28)(Function.call, __webpack_require__(22).f(Object.prototype, '__proto__').set, 2); set(test, []); buggy = !(test instanceof Array); } catch (e) { buggy = true; } return function setPrototypeOf(O, proto) { check(O, proto); if (buggy) O.__proto__ = proto; else set(O, proto); return O; }; }({}, false) : undefined), check: check }; /***/ }), /* 144 */ /***/ (function(module, exports, __webpack_require__) { var shared = __webpack_require__(98)('keys'); var uid = __webpack_require__(58); module.exports = function (key) { return shared[key] || (shared[key] = uid(key)); }; /***/ }), /* 145 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(36); var defined = __webpack_require__(34); // true -> String#at // false -> String#codePointAt module.exports = function (TO_STRING) { return function (that, pos) { var s = String(defined(that)); var i = toInteger(pos); var l = s.length; var a, b; if (i < 0 || i >= l) return TO_STRING ? '' : undefined; a = s.charCodeAt(i); return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000; }; }; /***/ }), /* 146 */ /***/ (function(module, exports, __webpack_require__) { // helper for String#{startsWith, endsWith, includes} var isRegExp = __webpack_require__(92); var defined = __webpack_require__(34); module.exports = function (that, searchString, NAME) { if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!"); return String(defined(that)); }; /***/ }), /* 147 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var toInteger = __webpack_require__(36); var defined = __webpack_require__(34); module.exports = function repeat(count) { var str = String(defined(this)); var res = ''; var n = toInteger(count); if (n < 0 || n == Infinity) throw RangeError("Count can't be negative"); for (;n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str; return res; }; /***/ }), /* 148 */ /***/ (function(module, exports) { module.exports = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003' + '\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }), /* 149 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(28); var invoke = __webpack_require__(208); var html = __webpack_require__(134); var cel = __webpack_require__(131); var global = __webpack_require__(3); var process = global.process; var setTask = global.setImmediate; var clearTask = global.clearImmediate; var MessageChannel = global.MessageChannel; var Dispatch = global.Dispatch; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; var defer, channel, port; var run = function () { var id = +this; // eslint-disable-next-line no-prototype-builtins if (queue.hasOwnProperty(id)) { var fn = queue[id]; delete queue[id]; fn(); } }; var listener = function (event) { run.call(event.data); }; // Node.js 0.9+ & IE10+ has setImmediate, otherwise: if (!setTask || !clearTask) { setTask = function setImmediate(fn) { var args = []; var i = 1; while (arguments.length > i) args.push(arguments[i++]); queue[++counter] = function () { // eslint-disable-next-line no-new-func invoke(typeof fn == 'function' ? fn : Function(fn), args); }; defer(counter); return counter; }; clearTask = function clearImmediate(id) { delete queue[id]; }; // Node.js 0.8- if (__webpack_require__(27)(process) == 'process') { defer = function (id) { process.nextTick(ctx(run, id, 1)); }; // Sphere (JS game engine) Dispatch API } else if (Dispatch && Dispatch.now) { defer = function (id) { Dispatch.now(ctx(run, id, 1)); }; // Browsers with MessageChannel, includes WebWorkers } else if (MessageChannel) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; defer = ctx(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) { defer = function (id) { global.postMessage(id + '', '*'); }; global.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in cel('script')) { defer = function (id) { html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () { html.removeChild(this); run.call(id); }; }; // Rest old browsers } else { defer = function (id) { setTimeout(ctx(run, id, 1), 0); }; } } module.exports = { set: setTask, clear: clearTask }; /***/ }), /* 150 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var DESCRIPTORS = __webpack_require__(9); var LIBRARY = __webpack_require__(50); var $typed = __webpack_require__(100); var hide = __webpack_require__(19); var redefineAll = __webpack_require__(55); var fails = __webpack_require__(4); var anInstance = __webpack_require__(48); var toInteger = __webpack_require__(36); var toLength = __webpack_require__(11); var toIndex = __webpack_require__(226); var gOPN = __webpack_require__(52).f; var dP = __webpack_require__(10).f; var arrayFill = __webpack_require__(128); var setToStringTag = __webpack_require__(64); var ARRAY_BUFFER = 'ArrayBuffer'; var DATA_VIEW = 'DataView'; var PROTOTYPE = 'prototype'; var WRONG_LENGTH = 'Wrong length!'; var WRONG_INDEX = 'Wrong index!'; var $ArrayBuffer = global[ARRAY_BUFFER]; var $DataView = global[DATA_VIEW]; var Math = global.Math; var RangeError = global.RangeError; // eslint-disable-next-line no-shadow-restricted-names var Infinity = global.Infinity; var BaseBuffer = $ArrayBuffer; var abs = Math.abs; var pow = Math.pow; var floor = Math.floor; var log = Math.log; var LN2 = Math.LN2; var BUFFER = 'buffer'; var BYTE_LENGTH = 'byteLength'; var BYTE_OFFSET = 'byteOffset'; var $BUFFER = DESCRIPTORS ? '_b' : BUFFER; var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH; var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET; // IEEE754 conversions based on https://github.com/feross/ieee754 function packIEEE754(value, mLen, nBytes) { var buffer = new Array(nBytes); var eLen = nBytes * 8 - mLen - 1; var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0; var i = 0; var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; var e, m, c; value = abs(value); // eslint-disable-next-line no-self-compare if (value != value || value === Infinity) { // eslint-disable-next-line no-self-compare m = value != value ? 1 : 0; e = eMax; } else { e = floor(log(value) / LN2); if (value * (c = pow(2, -e)) < 1) { e--; c *= 2; } if (e + eBias >= 1) { value += rt / c; } else { value += rt * pow(2, 1 - eBias); } if (value * c >= 2) { e++; c /= 2; } if (e + eBias >= eMax) { m = 0; e = eMax; } else if (e + eBias >= 1) { m = (value * c - 1) * pow(2, mLen); e = e + eBias; } else { m = value * pow(2, eBias - 1) * pow(2, mLen); e = 0; } } for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8); e = e << mLen | m; eLen += mLen; for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8); buffer[--i] |= s * 128; return buffer; } function unpackIEEE754(buffer, mLen, nBytes) { var eLen = nBytes * 8 - mLen - 1; var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var nBits = eLen - 7; var i = nBytes - 1; var s = buffer[i--]; var e = s & 127; var m; s >>= 7; for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8); m = e & (1 << -nBits) - 1; e >>= -nBits; nBits += mLen; for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8); if (e === 0) { e = 1 - eBias; } else if (e === eMax) { return m ? NaN : s ? -Infinity : Infinity; } else { m = m + pow(2, mLen); e = e - eBias; } return (s ? -1 : 1) * m * pow(2, e - mLen); } function unpackI32(bytes) { return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0]; } function packI8(it) { return [it & 0xff]; } function packI16(it) { return [it & 0xff, it >> 8 & 0xff]; } function packI32(it) { return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff]; } function packF64(it) { return packIEEE754(it, 52, 8); } function packF32(it) { return packIEEE754(it, 23, 4); } function addGetter(C, key, internal) { dP(C[PROTOTYPE], key, { get: function () { return this[internal]; } }); } function get(view, bytes, index, isLittleEndian) { var numIndex = +index; var intIndex = toIndex(numIndex); if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b; var start = intIndex + view[$OFFSET]; var pack = store.slice(start, start + bytes); return isLittleEndian ? pack : pack.reverse(); } function set(view, bytes, index, conversion, value, isLittleEndian) { var numIndex = +index; var intIndex = toIndex(numIndex); if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX); var store = view[$BUFFER]._b; var start = intIndex + view[$OFFSET]; var pack = conversion(+value); for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1]; } if (!$typed.ABV) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, $ArrayBuffer, ARRAY_BUFFER); var byteLength = toIndex(length); this._b = arrayFill.call(new Array(byteLength), 0); this[$LENGTH] = byteLength; }; $DataView = function DataView(buffer, byteOffset, byteLength) { anInstance(this, $DataView, DATA_VIEW); anInstance(buffer, $ArrayBuffer, DATA_VIEW); var bufferLength = buffer[$LENGTH]; var offset = toInteger(byteOffset); if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!'); byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); this[$BUFFER] = buffer; this[$OFFSET] = offset; this[$LENGTH] = byteLength; }; if (DESCRIPTORS) { addGetter($ArrayBuffer, BYTE_LENGTH, '_l'); addGetter($DataView, BUFFER, '_b'); addGetter($DataView, BYTE_LENGTH, '_l'); addGetter($DataView, BYTE_OFFSET, '_o'); } redefineAll($DataView[PROTOTYPE], { getInt8: function getInt8(byteOffset) { return get(this, 1, byteOffset)[0] << 24 >> 24; }, getUint8: function getUint8(byteOffset) { return get(this, 1, byteOffset)[0]; }, getInt16: function getInt16(byteOffset /* , littleEndian */) { var bytes = get(this, 2, byteOffset, arguments[1]); return (bytes[1] << 8 | bytes[0]) << 16 >> 16; }, getUint16: function getUint16(byteOffset /* , littleEndian */) { var bytes = get(this, 2, byteOffset, arguments[1]); return bytes[1] << 8 | bytes[0]; }, getInt32: function getInt32(byteOffset /* , littleEndian */) { return unpackI32(get(this, 4, byteOffset, arguments[1])); }, getUint32: function getUint32(byteOffset /* , littleEndian */) { return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0; }, getFloat32: function getFloat32(byteOffset /* , littleEndian */) { return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4); }, getFloat64: function getFloat64(byteOffset /* , littleEndian */) { return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8); }, setInt8: function setInt8(byteOffset, value) { set(this, 1, byteOffset, packI8, value); }, setUint8: function setUint8(byteOffset, value) { set(this, 1, byteOffset, packI8, value); }, setInt16: function setInt16(byteOffset, value /* , littleEndian */) { set(this, 2, byteOffset, packI16, value, arguments[2]); }, setUint16: function setUint16(byteOffset, value /* , littleEndian */) { set(this, 2, byteOffset, packI16, value, arguments[2]); }, setInt32: function setInt32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packI32, value, arguments[2]); }, setUint32: function setUint32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packI32, value, arguments[2]); }, setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) { set(this, 4, byteOffset, packF32, value, arguments[2]); }, setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) { set(this, 8, byteOffset, packF64, value, arguments[2]); } }); } else { if (!fails(function () { $ArrayBuffer(1); }) || !fails(function () { new $ArrayBuffer(-1); // eslint-disable-line no-new }) || fails(function () { new $ArrayBuffer(); // eslint-disable-line no-new new $ArrayBuffer(1.5); // eslint-disable-line no-new new $ArrayBuffer(NaN); // eslint-disable-line no-new return $ArrayBuffer.name != ARRAY_BUFFER; })) { $ArrayBuffer = function ArrayBuffer(length) { anInstance(this, $ArrayBuffer); return new BaseBuffer(toIndex(length)); }; var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE]; for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) { if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]); } if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer; } // iOS Safari 7.x bug var view = new $DataView(new $ArrayBuffer(2)); var $setInt8 = $DataView[PROTOTYPE].setInt8; view.setInt8(0, 2147483648); view.setInt8(1, 2147483649); if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], { setInt8: function setInt8(byteOffset, value) { $setInt8.call(this, byteOffset, value << 24 >> 24); }, setUint8: function setUint8(byteOffset, value) { $setInt8.call(this, byteOffset, value << 24 >> 24); } }, true); } setToStringTag($ArrayBuffer, ARRAY_BUFFER); setToStringTag($DataView, DATA_VIEW); hide($DataView[PROTOTYPE], $typed.VIEW, true); exports[ARRAY_BUFFER] = $ArrayBuffer; exports[DATA_VIEW] = $DataView; /***/ }), /* 151 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var navigator = global.navigator; module.exports = navigator && navigator.userAgent || ''; /***/ }), /* 152 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var core = __webpack_require__(33); var LIBRARY = __webpack_require__(50); var wksExt = __webpack_require__(227); var defineProperty = __webpack_require__(10).f; module.exports = function (name) { var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {}); if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) }); }; /***/ }), /* 153 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(71); var ITERATOR = __webpack_require__(6)('iterator'); var Iterators = __webpack_require__(63); module.exports = __webpack_require__(33).getIteratorMethod = function (it) { if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; }; /***/ }), /* 154 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var addToUnscopables = __webpack_require__(43); var step = __webpack_require__(211); var Iterators = __webpack_require__(63); var toIObject = __webpack_require__(24); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() module.exports = __webpack_require__(138)(Array, 'Array', function (iterated, kind) { this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind // 22.1.5.2.1 %ArrayIteratorPrototype%.next() }, function () { var O = this._t; var kind = this._k; var index = this._i++; if (!O || index >= O.length) { this._t = undefined; return step(1); } if (kind == 'keys') return step(0, index); if (kind == 'values') return step(0, O[index]); return step(0, [index, O[index]]); }, 'values'); // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7) Iterators.Arguments = Iterators.Array; addToUnscopables('keys'); addToUnscopables('values'); addToUnscopables('entries'); /***/ }), /* 155 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright (c) 2014-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ var emptyFunction = __webpack_require__(74); /** * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var warning = emptyFunction; if (process.env.NODE_ENV !== 'production') { var printWarning = function printWarning(format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.error(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; warning = function warning(condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } if (format.indexOf('Failed Composite propType: ') === 0) { return; // Ignore CompositeComponent proptype check. } if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } printWarning.apply(undefined, [format].concat(args)); } }; } module.exports = warning; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26))) /***/ }), /* 156 */ /***/ (function(module, exports) { module.exports = invert; /** * Inverts a mat4 * * @param {mat4} out the receiving matrix * @param {mat4} a the source matrix * @returns {mat4} out */ function invert(out, a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32, // Calculate the determinant det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; if (!det) { return null; } det = 1.0 / det; out[0] = (a11 * b11 - a12 * b10 + a13 * b09) * det; out[1] = (a02 * b10 - a01 * b11 - a03 * b09) * det; out[2] = (a31 * b05 - a32 * b04 + a33 * b03) * det; out[3] = (a22 * b04 - a21 * b05 - a23 * b03) * det; out[4] = (a12 * b08 - a10 * b11 - a13 * b07) * det; out[5] = (a00 * b11 - a02 * b08 + a03 * b07) * det; out[6] = (a32 * b02 - a30 * b05 - a33 * b01) * det; out[7] = (a20 * b05 - a22 * b02 + a23 * b01) * det; out[8] = (a10 * b10 - a11 * b08 + a13 * b06) * det; out[9] = (a01 * b08 - a00 * b10 - a03 * b06) * det; out[10] = (a30 * b04 - a31 * b02 + a33 * b00) * det; out[11] = (a21 * b02 - a20 * b04 - a23 * b00) * det; out[12] = (a11 * b07 - a10 * b09 - a12 * b06) * det; out[13] = (a00 * b09 - a01 * b07 + a02 * b06) * det; out[14] = (a31 * b01 - a30 * b03 - a32 * b00) * det; out[15] = (a20 * b03 - a21 * b01 + a22 * b00) * det; return out; }; /***/ }), /* 157 */ /***/ (function(module, exports) { module.exports = rotateX; /** * Rotates a matrix by the given angle around the X axis * * @param {mat4} out the receiving matrix * @param {mat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function rotateX(out, a, rad) { var s = Math.sin(rad), c = Math.cos(rad), a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; if (a !== out) { // If the source and destination differ, copy the unchanged rows out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; out[3] = a[3]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } // Perform axis-specific matrix multiplication out[4] = a10 * c + a20 * s; out[5] = a11 * c + a21 * s; out[6] = a12 * c + a22 * s; out[7] = a13 * c + a23 * s; out[8] = a20 * c - a10 * s; out[9] = a21 * c - a11 * s; out[10] = a22 * c - a12 * s; out[11] = a23 * c - a13 * s; return out; }; /***/ }), /* 158 */ /***/ (function(module, exports) { module.exports = rotateZ; /** * Rotates a matrix by the given angle around the Z axis * * @param {mat4} out the receiving matrix * @param {mat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function rotateZ(out, a, rad) { var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7]; if (a !== out) { // If the source and destination differ, copy the unchanged last row out[8] = a[8]; out[9] = a[9]; out[10] = a[10]; out[11] = a[11]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } // Perform axis-specific matrix multiplication out[0] = a00 * c + a10 * s; out[1] = a01 * c + a11 * s; out[2] = a02 * c + a12 * s; out[3] = a03 * c + a13 * s; out[4] = a10 * c - a00 * s; out[5] = a11 * c - a01 * s; out[6] = a12 * c - a02 * s; out[7] = a13 * c - a03 * s; return out; }; /***/ }), /* 159 */ /***/ (function(module, exports) { module.exports = add /** * Adds two vec2's * * @param {vec2} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @returns {vec2} out */ function add(out, a, b) { out[0] = a[0] + b[0] out[1] = a[1] + b[1] return out } /***/ }), /* 160 */ /***/ (function(module, exports) { module.exports = negate /** * Negates the components of a vec2 * * @param {vec2} out the receiving vector * @param {vec2} a vector to negate * @returns {vec2} out */ function negate(out, a) { out[0] = -a[0] out[1] = -a[1] return out } /***/ }), /* 161 */ /***/ (function(module, exports) { module.exports = scale /** * Scales a vec4 by a scalar number * * @param {vec4} out the receiving vector * @param {vec4} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec4} out */ function scale (out, a, b) { out[0] = a[0] * b out[1] = a[1] * b out[2] = a[2] * b out[3] = a[3] * b return out } /***/ }), /* 162 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = registerShaderModules; /* harmony export (immutable) */ __webpack_exports__["b"] = setDefaultShaderModules; /* harmony export (immutable) */ __webpack_exports__["c"] = getShaderModule; /* harmony export (immutable) */ __webpack_exports__["d"] = resolveModules; /* unused harmony export getShaderDependencies */ /* unused harmony export getDependencyGraph */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); var shaderModules = {}; var defaultShaderModules = []; /** * Registers an array of shader modules * @param {Object[]} shaderModuleList - Array of shader modules */ function registerShaderModules(shaderModuleList) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$ignoreMultipleRe = _ref.ignoreMultipleRegistrations, ignoreMultipleRegistrations = _ref$ignoreMultipleRe === undefined ? false : _ref$ignoreMultipleRe; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = shaderModuleList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var shaderModule = _step.value; registerShaderModule(shaderModule, { ignoreMultipleRegistrations: ignoreMultipleRegistrations }); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } /** * Registers an array of default shader modules. These will be concatenated * automatically at the end of any shader module list passed to * `assembleShaders` (plus `resolveModules` and `getShaderDependencies`) * @param {Object[]} modules - Array of shader modules */ function setDefaultShaderModules(modules) { defaultShaderModules = modules; } // Looks up a moduleName among registered modules and returns definition. // If "inline" module, returns it directly function getShaderModule(moduleOrName) { // Check if "inline" module if (typeof moduleOrName !== 'string') { var _shaderModule = moduleOrName; __WEBPACK_IMPORTED_MODULE_0_assert___default()(typeof _shaderModule.name === 'string'); registerShaderModule(_shaderModule, { ignoreMultipleRegistrations: true }); return _shaderModule; } // Look up module var shaderModule = shaderModules[moduleOrName]; if (!shaderModule) { // console.log(`${moduleOrName} not in registered modules:`, shaderModules); __WEBPACK_IMPORTED_MODULE_0_assert___default()(false, 'Unknown shader module ' + moduleOrName); } return shaderModule; } // registers any supplied modules and returns a list of module names function resolveModules(modules) { var moduleNames = modules.map(function (module) { if (typeof module !== 'string') { registerShaderModules([module], { ignoreMultipleRegistrations: true }); return module.name; } return module; }); return getShaderDependencies(moduleNames); } /** * Takes a list of shader module names and returns a new list of * shader module names that includes all dependencies, sorted so * that modules that are dependencies of other modules come first. * * If the shader glsl code from the returned modules is concatenated * in the reverse order, it is guaranteed that all functions be resolved and * that all function and variable definitions come before use. * * @param {String[]} modules - Array of modules (inline modules or module names) * @return {String[]} - Array of modules */ function getShaderDependencies(modules) { modules = modules.concat(defaultShaderModules); var result = {}; getDependencyGraph({ modules: modules, level: 0, result: result }); // Return a reverse sort so that dependencies come before the modules that use them return Object.keys(result).sort(function (a, b) { return result[b] - result[a]; }); } /** * Recursively checks module dpendencies to calculate dependency * level of each module. * * @param {String[]} modules - Array of modules * @param {Number} level - Current level * @return {result} - Map of module name to its level */ // Adds another level of dependencies to the result map function getDependencyGraph(_ref2) { var modules = _ref2.modules, level = _ref2.level, result = _ref2.result; if (level >= 5) { throw new Error('Possible loop in shader dependency graph'); } // Update level on all current modules var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = modules[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var moduleOrName = _step2.value; var shaderModule = getShaderModule(moduleOrName); if (result[shaderModule.name] === undefined || result[shaderModule.name] < level) { result[shaderModule.name] = level; } } // Recurse } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = modules[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var _moduleOrName = _step3.value; var _shaderModule2 = getShaderModule(_moduleOrName); if (_shaderModule2.dependencies) { getDependencyGraph({ modules: _shaderModule2.dependencies, level: level + 1, result: result }); } } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } return result; } // PRIVATE API function parseDeprecationDefinitions() { var deprecations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; deprecations.forEach(function (def) { switch (def.type) { case 'function': def.regex = new RegExp('\\b' + def.old + '\\('); break; default: def.regex = new RegExp(def.type + ' ' + def.old + ';'); } }); return deprecations; } function registerShaderModule(shaderModule, _ref3) { var _ref3$ignoreMultipleR = _ref3.ignoreMultipleRegistrations, ignoreMultipleRegistrations = _ref3$ignoreMultipleR === undefined ? false : _ref3$ignoreMultipleR; __WEBPACK_IMPORTED_MODULE_0_assert___default()(shaderModule.name, 'shader module has no name'); if (!ignoreMultipleRegistrations && shaderModules[shaderModule.name]) { // TODO - instead verify that definition is not changing... throw new Error('shader module ' + shaderModule.name + ' already registered'); } shaderModules[shaderModule.name] = shaderModule; shaderModule.dependencies = shaderModule.dependencies || []; shaderModule.deprecations = parseDeprecationDefinitions(shaderModule.deprecations); } //# sourceMappingURL=shader-modules.js.map /***/ }), /* 163 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = getGLTypeFromTypedArray; /* harmony export (immutable) */ __webpack_exports__["a"] = getTypedArrayFromGLType; /* harmony export (immutable) */ __webpack_exports__["c"] = flipRows; /* harmony export (immutable) */ __webpack_exports__["d"] = scalePixels; // GL Constants var GL_BYTE = 0x1400; var GL_UNSIGNED_BYTE = 0x1401; var GL_SHORT = 0x1402; var GL_UNSIGNED_SHORT = 0x1403; var GL_INT = 0x1404; var GL_UNSIGNED_INT = 0x1405; var GL_FLOAT = 0x1406; var GL_UNSIGNED_SHORT_4_4_4_4 = 0x8033; var GL_UNSIGNED_SHORT_5_5_5_1 = 0x8034; var GL_UNSIGNED_SHORT_5_6_5 = 0x8363; var ERR_TYPE_DEDUCTION = 'Failed to deduce GL constant from typed array'; // Converts TYPED ARRAYS to corresponding GL constant // Used to auto deduce gl parameter types function getGLTypeFromTypedArray(arrayOrType) { // If typed array, look up constructor var type = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType; switch (type) { case Float32Array: return GL_FLOAT; case Uint16Array: return GL_UNSIGNED_SHORT; case Uint32Array: return GL_UNSIGNED_INT; case Uint8Array: return GL_UNSIGNED_BYTE; case Uint8ClampedArray: return GL_UNSIGNED_BYTE; case Int8Array: return GL_BYTE; case Int16Array: return GL_SHORT; case Int32Array: return GL_INT; default: throw new Error(ERR_TYPE_DEDUCTION); } } // Converts GL constant to corresponding TYPED ARRAY // Used to auto deduce gl parameter types /* eslint-disable complexity */ function getTypedArrayFromGLType(glType) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$clamped = _ref.clamped, clamped = _ref$clamped === undefined ? true : _ref$clamped; // Sorted in some order of likelihood to reduce amount of comparisons switch (glType) { case GL_FLOAT: return Float32Array; case GL_UNSIGNED_SHORT: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_5_5_5_1: return Uint16Array; case GL_UNSIGNED_INT: return Uint32Array; case GL_UNSIGNED_BYTE: return clamped ? Uint8ClampedArray : Uint8Array; case GL_BYTE: return Int8Array; case GL_SHORT: return Int16Array; case GL_INT: return Int32Array; default: throw new Error('Failed to deduce typed array type from GL constant'); } } /* eslint-enable complexity */ // Flip rows (can be used on arrays returned from `Framebuffer.readPixels`) // https://stackoverflow.com/questions/41969562/ // how-can-i-flip-the-result-of-webglrenderingcontext-readpixels function flipRows(_ref2) { var data = _ref2.data, width = _ref2.width, height = _ref2.height, _ref2$bytesPerPixel = _ref2.bytesPerPixel, bytesPerPixel = _ref2$bytesPerPixel === undefined ? 4 : _ref2$bytesPerPixel, temp = _ref2.temp; var bytesPerRow = width * bytesPerPixel; // make a temp buffer to hold one row temp = temp || new Uint8Array(bytesPerRow); for (var y = 0; y < height / 2; ++y) { var topOffset = y * bytesPerRow; var bottomOffset = (height - y - 1) * bytesPerRow; // make copy of a row on the top half temp.set(data.subarray(topOffset, topOffset + bytesPerRow)); // copy a row from the bottom half to the top data.copyWithin(topOffset, bottomOffset, bottomOffset + bytesPerRow); // copy the copy of the top half row to the bottom half data.set(temp, bottomOffset); } } function scalePixels(_ref3) { var data = _ref3.data, width = _ref3.width, height = _ref3.height; var newWidth = Math.round(width / 2); var newHeight = Math.round(height / 2); var newData = new Uint8Array(newWidth * newHeight * 4); for (var y = 0; y < newHeight; y++) { for (var x = 0; x < newWidth; x++) { for (var c = 0; c < 4; c++) { newData[(y * newWidth + x) * 4 + c] = data[(y * 2 * width + x * 2) * 4 + c]; } } } return { data: newData, width: newWidth, height: newHeight }; } //# sourceMappingURL=typed-array-utils.js.map /***/ }), /* 164 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export clone */ /* unused harmony export deepEqual */ /* unused harmony export GL_STATE_SETTERS */ /* harmony export (immutable) */ __webpack_exports__["a"] = trackContextState; /* harmony export (immutable) */ __webpack_exports__["b"] = pushContextState; /* harmony export (immutable) */ __webpack_exports__["c"] = popContextState; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__set_parameters__ = __webpack_require__(266); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__polyfill_context__ = __webpack_require__(265); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // Support for listening to context state changes and intercepting state queries // // NOTE: this system does not handle buffer bindings var clone = function clone(x) { return Array.isArray(x) || ArrayBuffer.isView(x) ? x.slice() : x; }; var deepEqual = function deepEqual(x, y) { var isArrayX = Array.isArray(x) || ArrayBuffer.isView(x); var isArrayY = Array.isArray(y) || ArrayBuffer.isView(y); if (isArrayX && isArrayY && x.length === y.length) { for (var i = 0; i < x.length; ++i) { if (x[i] !== y[i]) { return false; } } return true; } return x === y; }; // interceptors for WEBGL FUNCTIONS that set WebGLRenderingContext state // These "setters" map functions to gl parameters var GL_STATE_SETTERS = { // GENERIC SETTERS enable: function enable(update, cap) { return update(_defineProperty({}, cap, true)); }, disable: function disable(update, cap) { return update(_defineProperty({}, cap, false)); }, pixelStorei: function pixelStorei(update, pname, param) { return update(_defineProperty({}, pname, param)); }, hint: function hint(update, pname, _hint) { return update(_defineProperty({}, pname, _hint)); }, // SPECIFIC SETTERS bindFramebuffer: function bindFramebuffer(update, target, fb) { var _update5; switch (target) { case __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRAMEBUFFER: return update((_update5 = {}, _defineProperty(_update5, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DRAW_FRAMEBUFFER_BINDING, fb), _defineProperty(_update5, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_FRAMEBUFFER_BINDING, fb), _update5)); case __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DRAW_FRAMEBUFFER: return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DRAW_FRAMEBUFFER_BINDING, fb)); case __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_FRAMEBUFFER: return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_FRAMEBUFFER_BINDING, fb)); default: return null; } }, blendColor: function blendColor(update, r, g, b, a) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_COLOR, new Float32Array([r, g, b, a]))); }, blendEquation: function blendEquation(update, mode) { var _update9; return update((_update9 = {}, _defineProperty(_update9, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_RGB, mode), _defineProperty(_update9, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_ALPHA, mode), _update9)); }, blendEquationSeparate: function blendEquationSeparate(update, modeRGB, modeAlpha) { var _update10; return update((_update10 = {}, _defineProperty(_update10, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_RGB, modeRGB), _defineProperty(_update10, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_ALPHA, modeAlpha), _update10)); }, blendFunc: function blendFunc(update, src, dst) { var _update11; return update((_update11 = {}, _defineProperty(_update11, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_RGB, src), _defineProperty(_update11, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_RGB, dst), _defineProperty(_update11, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_ALPHA, src), _defineProperty(_update11, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_ALPHA, dst), _update11)); }, blendFuncSeparate: function blendFuncSeparate(update, srcRGB, dstRGB, srcAlpha, dstAlpha) { var _update12; return update((_update12 = {}, _defineProperty(_update12, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_RGB, srcRGB), _defineProperty(_update12, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_RGB, dstRGB), _defineProperty(_update12, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_ALPHA, srcAlpha), _defineProperty(_update12, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_ALPHA, dstAlpha), _update12)); }, clearColor: function clearColor(update, r, g, b, a) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_CLEAR_VALUE, new Float32Array([r, g, b, a]))); }, clearDepth: function clearDepth(update, depth) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_CLEAR_VALUE, depth)); }, clearStencil: function clearStencil(update, s) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_CLEAR_VALUE, s)); }, colorMask: function colorMask(update, r, g, b, a) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_WRITEMASK, [r, g, b, a])); }, cullFace: function cullFace(update, mode) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CULL_FACE_MODE, mode)); }, depthFunc: function depthFunc(update, func) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_FUNC, func)); }, depthRange: function depthRange(update, zNear, zFar) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_RANGE, new Float32Array([zNear, zFar]))); }, depthMask: function depthMask(update, mask) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_WRITEMASK, mask)); }, frontFace: function frontFace(update, face) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT_FACE, face)); }, lineWidth: function lineWidth(update, width) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].LINE_WIDTH, width)); }, polygonOffset: function polygonOffset(update, factor, units) { var _update23; return update((_update23 = {}, _defineProperty(_update23, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FACTOR, factor), _defineProperty(_update23, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_UNITS, units), _update23)); }, sampleCoverage: function sampleCoverage(update, value, invert) { var _update24; return update((_update24 = {}, _defineProperty(_update24, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_VALUE, value), _defineProperty(_update24, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_INVERT, invert), _update24)); }, scissor: function scissor(update, x, y, width, height) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SCISSOR_BOX, new Int32Array([x, y, width, height]))); }, stencilMask: function stencilMask(update, mask) { var _update26; return update((_update26 = {}, _defineProperty(_update26, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_WRITEMASK, mask), _defineProperty(_update26, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_WRITEMASK, mask), _update26)); }, stencilMaskSeparate: function stencilMaskSeparate(update, face, mask) { return update(_defineProperty({}, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_WRITEMASK : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_WRITEMASK, mask)); }, stencilFunc: function stencilFunc(update, func, ref, mask) { var _update28; return update((_update28 = {}, _defineProperty(_update28, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FUNC, func), _defineProperty(_update28, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_REF, ref), _defineProperty(_update28, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_VALUE_MASK, mask), _defineProperty(_update28, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FUNC, func), _defineProperty(_update28, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_REF, ref), _defineProperty(_update28, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_VALUE_MASK, mask), _update28)); }, stencilFuncSeparate: function stencilFuncSeparate(update, face, func, ref, mask) { var _update29; return update((_update29 = {}, _defineProperty(_update29, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FUNC : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FUNC, func), _defineProperty(_update29, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_REF : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_REF, ref), _defineProperty(_update29, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_VALUE_MASK : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_VALUE_MASK, mask), _update29)); }, stencilOp: function stencilOp(update, fail, zfail, zpass) { var _update30; return update((_update30 = {}, _defineProperty(_update30, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FAIL, fail), _defineProperty(_update30, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_FAIL, zfail), _defineProperty(_update30, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_PASS, zpass), _defineProperty(_update30, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FAIL, fail), _defineProperty(_update30, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_FAIL, zfail), _defineProperty(_update30, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_PASS, zpass), _update30)); }, stencilOpSeparate: function stencilOpSeparate(update, face, fail, zfail, zpass) { var _update31; return update((_update31 = {}, _defineProperty(_update31, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FAIL : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FAIL, fail), _defineProperty(_update31, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_FAIL : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_FAIL, zfail), _defineProperty(_update31, face === __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_PASS : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_PASS, zpass), _update31)); }, viewport: function viewport(update, x, y, width, height) { return update(_defineProperty({}, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].VIEWPORT, new Int32Array([x, y, width, height]))); } }; // HELPER FUNCTIONS - INSTALL GET/SET INTERCEPTORS (SPYS) ON THE CONTEXT // Overrides a WebGLRenderingContext state "getter" function // to return values directly from cache function installGetterOverride(gl, functionName) { // Get the original function from the WebGLRenderingContext var originalGetterFunc = gl[functionName].bind(gl); // Wrap it with a spy so that we can update our state cache when it gets called gl[functionName] = function () { var pname = arguments.length <= 0 ? undefined : arguments[0]; // WebGL limits are not prepopulated in the cache, we must // query first time. They are all primitive (single value) if (!(pname in gl.state.cache)) { gl.state.cache[pname] = originalGetterFunc.apply(undefined, arguments); } // Optionally call the original function to do a "hard" query from the WebGLRenderingContext return gl.state.enable ? // Call the getter the params so that it can e.g. serve from a cache gl.state.cache[pname] : // Optionally call the original function to do a "hard" query from the WebGLRenderingContext originalGetterFunc.apply(undefined, arguments); }; // Set the name of this anonymous function to help in debugging and profiling Object.defineProperty(gl[functionName], 'name', { value: functionName + '-from-cache', configurable: false }); } // Overrides a WebGLRenderingContext state "setter" function // to call a setter spy before the actual setter. Allows us to keep a cache // updated with a copy of the WebGL context state. function installSetterSpy(gl, functionName, setter) { // Get the original function from the WebGLRenderingContext var originalSetterFunc = gl[functionName].bind(gl); // Wrap it with a spy so that we can update our state cache when it gets called gl[functionName] = function () { for (var _len = arguments.length, params = Array(_len), _key = 0; _key < _len; _key++) { params[_key] = arguments[_key]; } // Update the value // Call the setter with the state cache and the params so that it can store the parameters var _setter = setter.apply(undefined, [gl.state._updateCache].concat(params)), valueChanged = _setter.valueChanged, oldValue = _setter.oldValue; // Call the original WebGLRenderingContext func to make sure the context actually gets updated if (valueChanged) { var _gl$state; (_gl$state = gl.state).log.apply(_gl$state, ['gl.' + functionName].concat(params)); // eslint-disable-line originalSetterFunc.apply(undefined, params); } // Note: if the original function fails to set the value, our state cache will be bad // No solution for this at the moment, but assuming that this is unlikely to be a real problem // We could call the setter after the originalSetterFunc. Concern is that this would // cause different behavior in debug mode, where originalSetterFunc can throw exceptions return oldValue; }; // Set the name of this anonymous function to help in debugging and profiling Object.defineProperty(gl[functionName], 'name', { value: functionName + '-to-cache', configurable: false }); } // HELPER CLASS - GLState /* eslint-disable no-shadow */ var GLState = /*#__PURE__*/function () { function GLState(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$copyState = _ref.copyState, copyState = _ref$copyState === undefined ? false : _ref$copyState, _ref$log = _ref.log, log = _ref$log === undefined ? function () {} : _ref$log; _classCallCheck(this, GLState); this.gl = gl; this.stateStack = []; this.enable = true; this.cache = copyState ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__set_parameters__["a" /* getParameters */])(gl) : Object.assign({}, __WEBPACK_IMPORTED_MODULE_1__set_parameters__["b" /* GL_PARAMETER_DEFAULTS */]); this.log = log; this._updateCache = this._updateCache.bind(this); Object.seal(this); } _createClass(GLState, [{ key: 'push', value: function push() { var values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this.stateStack.push({}); } }, { key: 'pop', value: function pop() { __WEBPACK_IMPORTED_MODULE_3_assert___default()(this.stateStack.length > 0); // Use the saved values in the state stack to restore parameters var oldValues = this.stateStack[this.stateStack.length - 1]; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__set_parameters__["c" /* setParameters */])(this.gl, oldValues, this.cache); // Don't pop until we have reset parameters (to make sure other "stack frames" are not affected) this.stateStack.pop(); } // interceptor for context set functions - update our cache and our stack // values (Object) - the key values for this setter }, { key: '_updateCache', value: function _updateCache(values) { var valueChanged = false; var oldValue = void 0; // = undefined var oldValues = this.stateStack.length > 0 && this.stateStack[this.stateStack.length - 1]; for (var key in values) { __WEBPACK_IMPORTED_MODULE_3_assert___default()(key !== undefined); // Check that value hasn't already been shadowed if (!deepEqual(values[key], this.cache[key])) { valueChanged = true; oldValue = this.cache[key]; // First, save current value being shadowed // If a state stack frame is active, save the current parameter values for pop // but first check that value hasn't already been shadowed and saved if (oldValues && !(key in oldValues)) { oldValues[key] = this.cache[key]; } // Save current value being shadowed this.cache[key] = values[key]; } } return { valueChanged: valueChanged, oldValue: oldValue }; } }]); return GLState; }(); // PUBLIC API /** * Initialize WebGL state caching on a context * can be called multiple times to enable/disable * @param {WebGLRenderingContext} - context */ // After calling this function, context state will be cached // gl.state.push() and gl.state.pop() will be available for saving, // temporarily modifying, and then restoring state. function trackContextState(gl) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$enable = _ref2.enable, enable = _ref2$enable === undefined ? true : _ref2$enable, copyState = _ref2.copyState; __WEBPACK_IMPORTED_MODULE_3_assert___default()(copyState !== undefined); if (!gl.state) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__polyfill_context__["a" /* default */])(gl); // Create a state cache gl.state = new GLState(gl, { copyState: copyState, enable: enable }); // intercept all setter functions in the table for (var key in GL_STATE_SETTERS) { var setter = GL_STATE_SETTERS[key]; installSetterSpy(gl, key, setter); } // intercept all getter functions in the table installGetterOverride(gl, 'getParameter'); installGetterOverride(gl, 'isEnabled'); } gl.state.enable = enable; return gl; } function pushContextState(gl) { __WEBPACK_IMPORTED_MODULE_3_assert___default()(gl.state); gl.state.push(); } function popContextState(gl) { __WEBPACK_IMPORTED_MODULE_3_assert___default()(gl.state); gl.state.pop(); } //# sourceMappingURL=track-context-state.js.map /***/ }), /* 165 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = getContextLimits; /* harmony export (immutable) */ __webpack_exports__["b"] = getGLContextInfo; /* unused harmony export getGLContextInfo2 */ /* harmony export (immutable) */ __webpack_exports__["a"] = getContextInfo; /* harmony export (immutable) */ __webpack_exports__["d"] = glGetDebugInfo; /* unused harmony export TEST_EXPORTS */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); var _WEBGL_LIMITS; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint-disable no-inline-comments, max-len */ var WEBGL_LIMITS = (_WEBGL_LIMITS = {}, _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].ALIASED_LINE_WIDTH_RANGE, { gl1: new Float32Array([1, 1]) }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].ALIASED_POINT_SIZE_RANGE, { gl1: new Float32Array([1, 1]) }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_TEXTURE_SIZE, { gl1: 64, gl2: 2048 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_CUBE_MAP_TEXTURE_SIZE, { gl1: 16 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_TEXTURE_IMAGE_UNITS, { gl1: 8 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_COMBINED_TEXTURE_IMAGE_UNITS, { gl1: 8 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VERTEX_TEXTURE_IMAGE_UNITS, { gl1: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_RENDERBUFFER_SIZE, { gl1: 1 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VARYING_VECTORS, { gl1: 8 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VERTEX_ATTRIBS, { gl1: 8 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VERTEX_UNIFORM_VECTORS, { gl1: 128 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_FRAGMENT_UNIFORM_VECTORS, { gl1: 16 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VIEWPORT_DIMS, { gl1: new Int32Array([0, 0]) }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_3D_TEXTURE_SIZE, { gl1: 0, gl2: 256 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_ARRAY_TEXTURE_LAYERS, { gl1: 0, gl2: 256 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_CLIENT_WAIT_TIMEOUT_WEBGL, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_COLOR_ATTACHMENTS, { gl1: 0, gl2: 4 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_COMBINED_UNIFORM_BLOCKS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_DRAW_BUFFERS, { gl1: 0, gl2: 4 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_ELEMENT_INDEX, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_ELEMENTS_INDICES, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_ELEMENTS_VERTICES, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_FRAGMENT_INPUT_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_FRAGMENT_UNIFORM_BLOCKS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_FRAGMENT_UNIFORM_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_SAMPLES, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_SERVER_WAIT_TIMEOUT, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_TEXTURE_LOD_BIAS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_UNIFORM_BLOCK_SIZE, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_UNIFORM_BUFFER_BINDINGS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VARYING_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VERTEX_OUTPUT_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VERTEX_UNIFORM_BLOCKS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_VERTEX_UNIFORM_COMPONENTS, { gl1: 0, gl2: 0 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MIN_PROGRAM_TEXEL_OFFSET, { gl1: 0, gl2: -8, negative: true }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].MAX_PROGRAM_TEXEL_OFFSET, { gl1: 0, gl2: 7 }), _defineProperty(_WEBGL_LIMITS, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNIFORM_BUFFER_OFFSET_ALIGNMENT, { gl1: 0, gl2: 0 // GLint }), _WEBGL_LIMITS); function getContextLimits(gl) { gl.luma = gl.luma || {}; if (!gl.luma.limits) { gl.luma.limits = {}; gl.luma.webgl1MinLimits = {}; gl.luma.webgl2MinLimits = {}; var isWebgl2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl); // WEBGL limits for (var parameter in WEBGL_LIMITS) { var limit = WEBGL_LIMITS[parameter]; var webgl1MinLimit = limit.gl1; var webgl2MinLimit = 'gl2' in limit ? limit.gl2 : limit.gl1; var minLimit = isWebgl2 ? webgl2MinLimit : webgl1MinLimit; // Check if we can query for this limit var limitNotAvailable = 'gl2' in limit && !isWebgl2 || 'extension' in limit && !gl.getExtension(limit.extension); var value = limitNotAvailable ? minLimit : gl.getParameter(parameter); gl.luma.limits[parameter] = value; gl.luma.webgl1MinLimits[parameter] = webgl1MinLimit; gl.luma.webgl2MinLimits[parameter] = webgl2MinLimit; } } return gl.luma.limits; } function getGLContextInfo(gl) { gl.luma = gl.luma || {}; if (!gl.luma.info) { var _gl$luma$info; var info = gl.getExtension('WEBGL_debug_renderer_info'); gl.luma.info = (_gl$luma$info = {}, _defineProperty(_gl$luma$info, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VENDOR, gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VENDOR)), _defineProperty(_gl$luma$info, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RENDERER, gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RENDERER)), _defineProperty(_gl$luma$info, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNMASKED_VENDOR_WEBGL, gl.getParameter(info && info.UNMASKED_VENDOR_WEBGL || __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VENDOR)), _defineProperty(_gl$luma$info, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNMASKED_RENDERER_WEBGL, gl.getParameter(info && info.UNMASKED_RENDERER_WEBGL || __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RENDERER)), _defineProperty(_gl$luma$info, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VERSION, gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VERSION)), _defineProperty(_gl$luma$info, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].SHADING_LANGUAGE_VERSION, gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].SHADING_LANGUAGE_VERSION)), _gl$luma$info); } return gl.luma.info; } var GL_UNMASKED_VENDOR_WEBGL = 0x9245; // vendor string of the graphics driver. var GL_UNMASKED_RENDERER_WEBGL = 0x9246; // renderer string of the graphics driver. function getGLContextInfo2(gl) { var vendorMasked = gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VENDOR); var rendererMasked = gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RENDERER); var ext = gl.getExtension('WEBGL_debug_renderer_info'); var vendorUnmasked = ext && gl.getParameter(ext.UNMASKED_VENDOR_WEBGL || __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VENDOR); var rendererUnmasked = ext && gl.getParameter(ext.UNMASKED_RENDERER_WEBGL || __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RENDERER); return { vendor: vendorUnmasked || vendorMasked, renderer: rendererUnmasked || rendererMasked, vendorMasked: vendorMasked, rendererMasked: rendererMasked, version: gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VERSION), shadingLanguageVersion: gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].SHADING_LANGUAGE_VERSION) }; } function getContextInfo(gl) { var limits = getContextLimits(gl); var info = getGLContextInfo(gl); return { // basic information vendor: info[GL_UNMASKED_VENDOR_WEBGL] || info[__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VENDOR], renderer: info[GL_UNMASKED_RENDERER_WEBGL] || info[__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].RENDERER], version: info[__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].VERSION], shadingLanguageVersion: info[__WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].SHADING_LANGUAGE_VERSION], // info, caps and limits info: info, limits: limits, webgl1MinLimits: gl.luma.webgl1MinLimits, webgl2MinLimits: gl.luma.webgl2MinLimits }; } // DEBUG INFO /** * Provides strings identifying the GPU vendor and driver. * https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/ * @param {WebGLRenderingContext} gl - context * @return {Object} - 'vendor' and 'renderer' string fields. */ function glGetDebugInfo(gl) { return getGLContextInfo2(gl); // const info = gl.getExtension('WEBGL_debug_renderer_info'); // // We can't determine if 'WEBGL_debug_renderer_info' is supported by // // checking whether info is null here. Firefox doesn't follow the // // specs by returning null for unsupported extension. Instead, // // it returns an object without GL_UNMASKED_VENDOR_WEBGL and GL_UNMASKED_RENDERER_WEBGL. // return { // vendor: (info && info.UNMASKED_VENDOR_WEBGL) ? // gl.getParameter(info.UNMASKED_VENDOR_WEBGL) : 'unknown', // renderer: (info && info.UNMASKED_RENDERER_WEBGL) ? // gl.getParameter(info.UNMASKED_RENDERER_WEBGL) : 'unknown' // }; } var TEST_EXPORTS = { WEBGL_LIMITS: WEBGL_LIMITS }; //# sourceMappingURL=context-limits.js.map /***/ }), /* 166 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ERR_DELETED = 'Query was deleted before result was available'; var ERR_CANCEL = 'Query was canceled before result was available'; var noop = function noop(x) { return x; }; var QueryManager = /*#__PURE__*/function () { /** * Internal class that helps "asynchronous WebGL query objects" manage * pending requests (e.g. for EXT_disjoint_timer_query and WebGL2 queries) * * Creates and manages promises for the queries. * Tracks pending queries enabling polling. * Tracks pending queries enabling invalidation. * Encapsulates some standard error messages. * * Remarks: * - Maintains a minimal list of pending queries only to minimize GC impact * - Exported as a singleton class instance. */ function QueryManager() { _classCallCheck(this, QueryManager); this.pendingQueries = new Set(); this.invalidQueryType = null; this.invalidErrorMessage = ''; this.checkInvalid = function () { return false; }; } // API THAT SHOULD BE EXPOSED TO APPLICATION // Checks invalidation callback and then all pending queries for completion // Should only be called once per tick _createClass(QueryManager, [{ key: 'poll', value: function poll(gl) { this.cancelInvalidQueries(gl); // Now check availability of results and resolve promises as appropriate var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = this.pendingQueries.values()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var query = _step.value; var resultAvailable = query.isResultAvailable(); if (resultAvailable) { var result = query.getResult(); this.resolveQuery(query, result); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } // API FOR MANAGED QUERY CLASSES // Registers query invalidation method - used to detect disjoint timer queries }, { key: 'setInvalidator', value: function setInvalidator(_ref) { var queryType = _ref.queryType, errorMessage = _ref.errorMessage, checkInvalid = _ref.checkInvalid; this.invalidQueryType = queryType; this.invalidErrorMessage = errorMessage; this.checkInvalid = checkInvalid; } // Starts a query, sets up a new promise }, { key: 'beginQuery', value: function beginQuery(query) { var onComplete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop; var onError = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : noop; // Make sure disjoint state is cleared, so that this query starts fresh // Cancel other queries if needed this.cancelInvalidQueries(query.gl); // Cancel current promise - noop if already resolved or rejected this.cancelQuery(query); // Create a new promise with attached resolve and reject methods var resolvers = {}; query.promise = new Promise(function (resolve, reject) { resolvers.resolve = resolve; resolvers.reject = reject; }); Object.assign(query.promise, resolvers); // Add this query to the pending queries this.pendingQueries.add(query); // Register the callbacks return query.promise.then(onComplete).catch(onError); } // Resolves a query with a result }, { key: 'resolveQuery', value: function resolveQuery(query, result) { this.pendingQueries.delete(query); query.promise.resolve(result); } // Rejects the promise }, { key: 'rejectQuery', value: function rejectQuery(query, errorMessage) { this.pendingQueries.delete(query); if (query.promise) { query.promise.reject(new Error(errorMessage)); } } // Rejects promise with standard message for Query.delete() }, { key: 'deleteQuery', value: function deleteQuery(query) { return this.rejectQuery(query, ERR_DELETED); } // Rejects promise with standard message for Query.cancel() }, { key: 'cancelQuery', value: function cancelQuery(query) { return this.rejectQuery(query, ERR_CANCEL); } // Rejects promise with registered message for invalidation }, { key: 'invalidateQuery', value: function invalidateQuery(query) { if (query instanceof this.invalidQueryType) { this.rejectQuery(query, this.invalidErrorMessage); } } // Checks all queries to see if need to be invalidated }, { key: 'cancelInvalidQueries', value: function cancelInvalidQueries(gl) { // We assume that we can cancel queries for all context. // Should be OK since this is used to check for "disjoint" GPU state if (this.checkInvalid(gl)) { var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this.pendingQueries.values()[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var query = _step2.value; this.invalidateQuery(query); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } } }]); return QueryManager; }(); /* harmony default export */ __webpack_exports__["a"] = (new QueryManager()); //# sourceMappingURL=query-manager.js.map /***/ }), /* 167 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__texture__ = __webpack_require__(62); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Texture2D = /*#__PURE__*/function (_Texture) { _inherits(Texture2D, _Texture); _createClass(Texture2D, null, [{ key: 'isSupported', value: function isSupported(gl, opts) { return __WEBPACK_IMPORTED_MODULE_2__texture__["a" /* default */].isSupported(gl, opts); } /** * @classdesc * 2D WebGL Texture * Note: Constructor will initialize your texture. * * @class * @param {WebGLRenderingContext} gl - gl context * @param {Image|ArrayBuffer|null} opts= - named options * @param {Image|ArrayBuffer|null} opts.data= - buffer * @param {GLint} width - width of texture * @param {GLint} height - height of texture */ }]); function Texture2D(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Texture2D); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["j" /* assertWebGLContext */])(gl); var _this = _possibleConstructorReturn(this, (Texture2D.__proto__ || Object.getPrototypeOf(Texture2D)).call(this, gl, Object.assign({}, opts, { target: gl.TEXTURE_2D }))); _this.initialize(opts); Object.seal(_this); return _this; } // target cannot be modified by bind: // textures are special because when you first bind them to a target, // they get special information. When you first bind a texture as a // GL_TEXTURE_2D, you are actually setting special state in the texture. // You are saying that this texture is a 2D texture. // And it will always be a 2D texture; this state cannot be changed ever. // If you have a texture that was first bound as a GL_TEXTURE_2D, // you must always bind it as a GL_TEXTURE_2D; // attempting to bind it as GL_TEXTURE_1D will give rise to an error // (while run-time). _createClass(Texture2D, [{ key: 'bind', value: function bind() { var textureUnit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.textureUnit; var gl = this.gl; if (textureUnit === undefined) { throw new Error('Texture.bind: must specify texture unit'); } this.textureUnit = textureUnit; gl.activeTexture(gl.TEXTURE0 + textureUnit); gl.bindTexture(this.target, this.handle); return textureUnit; } }, { key: 'unbind', value: function unbind() { var gl = this.gl; if (this.textureUnit === undefined) { throw new Error('Texture.unbind: texture unit not specified'); } gl.activeTexture(gl.TEXTURE0 + this.textureUnit); gl.bindTexture(this.target, null); return this.textureUnit; } }, { key: 'getActiveUnit', value: function getActiveUnit() { return this.gl.getParameter(__WEBPACK_IMPORTED_MODULE_0__api__["f" /* GL */].ACTIVE_TEXTURE) - __WEBPACK_IMPORTED_MODULE_0__api__["f" /* GL */].TEXTURE0; } }]); return Texture2D; }(__WEBPACK_IMPORTED_MODULE_2__texture__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Texture2D); //# sourceMappingURL=texture-2d.js.map /***/ }), /* 168 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = parseUniformName; /* harmony export (immutable) */ __webpack_exports__["b"] = getUniformSetter; /* harmony export (immutable) */ __webpack_exports__["c"] = checkUniformValues; /* harmony export (immutable) */ __webpack_exports__["e"] = getUniformsTable; /* harmony export (immutable) */ __webpack_exports__["d"] = areUniformsEqual; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__framebuffer__ = __webpack_require__(69); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__texture__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); var _UNIFORM_SETTERS; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // Local constants, will be "collapsed" during minification // WebGL1 var GL_FLOAT = 0x1406; var GL_FLOAT_VEC2 = 0x8B50; var GL_FLOAT_VEC3 = 0x8B51; var GL_FLOAT_VEC4 = 0x8B52; var GL_INT = 0x1404; var GL_INT_VEC2 = 0x8B53; var GL_INT_VEC3 = 0x8B54; var GL_INT_VEC4 = 0x8B55; var GL_BOOL = 0x8B56; var GL_BOOL_VEC2 = 0x8B57; var GL_BOOL_VEC3 = 0x8B58; var GL_BOOL_VEC4 = 0x8B59; var GL_FLOAT_MAT2 = 0x8B5A; var GL_FLOAT_MAT3 = 0x8B5B; var GL_FLOAT_MAT4 = 0x8B5C; var GL_SAMPLER_2D = 0x8B5E; var GL_SAMPLER_CUBE = 0x8B60; // WebGL2 var GL_UNSIGNED_INT = 0x1405; var GL_UNSIGNED_INT_VEC2 = 0x8DC6; var GL_UNSIGNED_INT_VEC3 = 0x8DC7; var GL_UNSIGNED_INT_VEC4 = 0x8DC8; /* eslint-disable camelcase */ var GL_FLOAT_MAT2x3 = 0x8B65; var GL_FLOAT_MAT2x4 = 0x8B66; var GL_FLOAT_MAT3x2 = 0x8B67; var GL_FLOAT_MAT3x4 = 0x8B68; var GL_FLOAT_MAT4x2 = 0x8B69; var GL_FLOAT_MAT4x3 = 0x8B6A; var GL_SAMPLER_3D = 0x8B5F; var GL_SAMPLER_2D_SHADOW = 0x8B62; var GL_SAMPLER_2D_ARRAY = 0x8DC1; var GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; var GL_SAMPLER_CUBE_SHADOW = 0x8DC5; var GL_INT_SAMPLER_2D = 0x8DCA; var GL_INT_SAMPLER_3D = 0x8DCB; var GL_INT_SAMPLER_CUBE = 0x8DCC; var GL_INT_SAMPLER_2D_ARRAY = 0x8DCF; var GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2; var GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3; var GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; var GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; var UNIFORM_SETTERS = (_UNIFORM_SETTERS = {}, _defineProperty(_UNIFORM_SETTERS, GL_FLOAT, function (gl, location, value) { return gl.uniform1f(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_VEC2, function (gl, location, value) { return gl.uniform2fv(location, toFloatArray(value, 2)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_VEC3, function (gl, location, value) { return gl.uniform3fv(location, toFloatArray(value, 3)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_VEC4, function (gl, location, value) { return gl.uniform4fv(location, toFloatArray(value, 4)); }), _defineProperty(_UNIFORM_SETTERS, GL_INT, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_VEC2, function (gl, location, value) { return gl.uniform2iv(location, toIntArray(value, 2)); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_VEC3, function (gl, location, value) { return gl.uniform3iv(location, toIntArray(value, 3)); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_VEC4, function (gl, location, value) { return gl.uniform4iv(location, toIntArray(value, 4)); }), _defineProperty(_UNIFORM_SETTERS, GL_BOOL, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_BOOL_VEC2, function (gl, location, value) { return gl.uniform2iv(location, toIntArray(value, 2)); }), _defineProperty(_UNIFORM_SETTERS, GL_BOOL_VEC3, function (gl, location, value) { return gl.uniform3iv(location, toIntArray(value, 3)); }), _defineProperty(_UNIFORM_SETTERS, GL_BOOL_VEC4, function (gl, location, value) { return gl.uniform4iv(location, toIntArray(value, 4)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT2, function (gl, location, value) { return gl.uniformMatrix2fv(location, false, toFloatArray(value, 4)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT3, function (gl, location, value) { return gl.uniformMatrix3fv(location, false, toFloatArray(value, 9)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT4, function (gl, location, value) { return gl.uniformMatrix4fv(location, false, toFloatArray(value, 16)); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_2D, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_CUBE, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT, function (gl, location, value) { return gl.uniform1ui(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_VEC2, function (gl, location, value) { return gl.uniform2uiv(location, toUIntArray(value, 2)); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_VEC3, function (gl, location, value) { return gl.uniform3uiv(location, toUIntArray(value, 3)); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_VEC4, function (gl, location, value) { return gl.uniform4uiv(location, toUIntArray(value, 4)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT2x3, function (gl, location, value) { return gl.uniformMatrix2x3fv(location, false, toFloatArray(value, 6)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT2x4, function (gl, location, value) { return gl.uniformMatrix2x4fv(location, false, toFloatArray(value, 8)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT3x2, function (gl, location, value) { return gl.uniformMatrix3x2fv(location, false, toFloatArray(value, 6)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT3x4, function (gl, location, value) { return gl.uniformMatrix3x4fv(location, false, toFloatArray(value, 12)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT4x2, function (gl, location, value) { return gl.uniformMatrix4x2fv(location, false, toFloatArray(value, 8)); }), _defineProperty(_UNIFORM_SETTERS, GL_FLOAT_MAT4x3, function (gl, location, value) { return gl.uniformMatrix4x3fv(location, false, toFloatArray(value, 12)); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_3D, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_2D_SHADOW, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_2D_ARRAY, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_2D_ARRAY_SHADOW, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_SAMPLER_CUBE_SHADOW, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_SAMPLER_2D, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_SAMPLER_3D, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_SAMPLER_CUBE, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_INT_SAMPLER_2D_ARRAY, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_SAMPLER_2D, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_SAMPLER_3D, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_SAMPLER_CUBE, function (gl, location, value) { return gl.uniform1i(location, value); }), _defineProperty(_UNIFORM_SETTERS, GL_UNSIGNED_INT_SAMPLER_2D_ARRAY, function (gl, location, value) { return gl.uniform1i(location, value); }), _UNIFORM_SETTERS); // Pre-allocated typed arrays for temporary conversion var FLOAT_ARRAY = {}; var INT_ARRAY = {}; var UINT_ARRAY = {}; /* Functions to ensure the type of uniform values */ function toTypedArray(value, uniformLength, Type, cache) { var length = value.length; if (length % uniformLength) { __WEBPACK_IMPORTED_MODULE_2__utils__["b" /* log */].warn('Uniform size should be multiples of ' + uniformLength, value); } if (value instanceof Type) { return value; } var result = cache[length]; if (!result) { result = new Type(length); cache[length] = result; } for (var i = 0; i < length; i++) { result[i] = value[i]; } return result; } function toFloatArray(value, uniformLength) { return toTypedArray(value, uniformLength, Float32Array, FLOAT_ARRAY); } function toIntArray(value, uniformLength) { return toTypedArray(value, uniformLength, Int32Array, INT_ARRAY); } function toUIntArray(value, uniformLength) { return toTypedArray(value, uniformLength, Uint32Array, UINT_ARRAY); } function parseUniformName(name) { // name = name[name.length - 1] === ']' ? // name.substr(0, name.length - 3) : name; // if array name then clean the array brackets var UNIFORM_NAME_REGEXP = /([^\[]*)(\[[0-9]+\])?/; var matches = name.match(UNIFORM_NAME_REGEXP); if (!matches || matches.length < 2) { throw new Error('Failed to parse GLSL uniform name ' + name); } return { name: matches[1], length: matches[2] || 1, isArray: Boolean(matches[2]) }; } // Returns a Magic Uniform Setter /* eslint-disable complexity */ function getUniformSetter(gl, location, info) { var setter = UNIFORM_SETTERS[info.type]; if (!setter) { throw new Error('Unknown GLSL uniform type ' + info.type); } return setter.bind(null, gl, location); } // Basic checks of uniform values without knowledge of program // To facilitate early detection of e.g. undefined values in JavaScript function checkUniformValues(uniforms, source) { for (var uniformName in uniforms) { var value = uniforms[uniformName]; if (!checkUniformValue(value)) { // Add space to source source = source ? source + ' ' : ''; // Value could be unprintable so write the object on console console.error(source + ' Bad uniform ' + uniformName, value); // eslint-disable-line /* eslint-enable no-console */ throw new Error(source + ' Bad uniform ' + uniformName); } } return true; } // TODO use type information during validation function checkUniformValue(value) { // Check that every element in array is a number, and at least 1 element if (Array.isArray(value)) { return value.length > 0 && value.every(function (element) { return isFinite(element); }); // Typed arrays can only contain numbers, but check length } else if (ArrayBuffer.isView(value)) { // TODO - Can contain NaN return value.length > 0; // Check that single value is a number } else if (isFinite(value)) { return true; // Test for texture (for sampler uniforms) // WebGL2: if (value instanceof Texture || value instanceof Sampler) { } else if (value instanceof __WEBPACK_IMPORTED_MODULE_1__texture__["a" /* default */]) { return true; } else if (value instanceof __WEBPACK_IMPORTED_MODULE_0__framebuffer__["a" /* default */]) { return Boolean(value.texture); } return false; } function isUniformDefined(value) { return value !== undefined && value !== null; } // Helper function addUniformToTable(_ref) { var table = _ref.table, header = _ref.header, uniforms = _ref.uniforms, uniformName = _ref.uniformName, undefinedOnly = _ref.undefinedOnly; var value = uniforms[uniformName]; var isDefined = isUniformDefined(value); if (!undefinedOnly || !isDefined) { table[uniformName] = _defineProperty({ // Add program's unprovided uniforms Type: isDefined ? value : 'NOT PROVIDED' }, header, isDefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["c" /* formatValue */])(value) : 'N/A'); return true; } return false; } // Prepares a table suitable for console.table /* eslint-disable max-statements */ function getUniformsTable() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$header = _ref2.header, header = _ref2$header === undefined ? 'Uniforms' : _ref2$header, program = _ref2.program, uniforms = _ref2.uniforms, _ref2$undefinedOnly = _ref2.undefinedOnly, undefinedOnly = _ref2$undefinedOnly === undefined ? false : _ref2$undefinedOnly; __WEBPACK_IMPORTED_MODULE_3_assert___default()(program); var SHADER_MODULE_UNIFORM_REGEXP = '.*_.*'; var PROJECT_MODULE_UNIFORM_REGEXP = '.*Matrix'; // TODO - Use explicit list var uniformLocations = program._uniformSetters; var table = {}; // {[header]: {}}; // Add program's provided uniforms (in alphabetical order) var uniformNames = Object.keys(uniformLocations).sort(); var count = 0; // First add non-underscored uniforms (assumed not coming from shader modules) var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = uniformNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var _uniformName = _step.value; if (!_uniformName.match(SHADER_MODULE_UNIFORM_REGEXP) && !_uniformName.match(PROJECT_MODULE_UNIFORM_REGEXP)) { if (addUniformToTable({ table: table, header: header, uniforms: uniforms, uniformName: _uniformName, undefinedOnly: undefinedOnly })) { count++; } } } // add underscored uniforms (assumed from shader modules) } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = uniformNames[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _uniformName2 = _step2.value; if (_uniformName2.match(PROJECT_MODULE_UNIFORM_REGEXP)) { if (addUniformToTable({ table: table, header: header, uniforms: uniforms, uniformName: _uniformName2, undefinedOnly: undefinedOnly })) { count++; } } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = uniformNames[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var _uniformName3 = _step3.value; if (!table[_uniformName3]) { if (addUniformToTable({ table: table, header: header, uniforms: uniforms, uniformName: _uniformName3, undefinedOnly: undefinedOnly })) { count++; } } } // Create a table of unused uniforms } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } var unusedCount = 0; var unusedTable = {}; if (!undefinedOnly) { for (var uniformName in uniforms) { var uniform = uniforms[uniformName]; if (!table[uniformName]) { unusedCount++; unusedTable[uniformName] = _defineProperty({ Type: 'NOT USED: ' + uniform }, header, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["c" /* formatValue */])(uniform)); } } } return { table: table, count: count, unusedTable: unusedTable, unusedCount: unusedCount }; } /** * Given two values of a uniform, returns `true` if they are equal */ function areUniformsEqual(uniform1, uniform2) { if (Array.isArray(uniform1) || ArrayBuffer.isView(uniform1)) { if (!uniform2) { return false; } var len = uniform1.length; if (uniform2.length !== len) { return false; } for (var i = 0; i < len; i++) { if (uniform1[i] !== uniform2[i]) { return false; } } return true; } return uniform1 === uniform2; } //# sourceMappingURL=uniforms.js.map /***/ }), /* 169 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__(8); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // WebGL2 VertexArray Objects Helper /* eslint-disable camelcase */ var OES_vertex_array_object = 'OES_vertex_array_object'; var GL_ELEMENT_ARRAY_BUFFER = 0x8893; // const GL_CURRENT_VERTEX_ATTRIB = 0x8626; var GL_VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622; var GL_VERTEX_ATTRIB_ARRAY_SIZE = 0x8623; var GL_VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624; var GL_VERTEX_ATTRIB_ARRAY_TYPE = 0x8625; var GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A; var GL_VERTEX_ATTRIB_ARRAY_POINTER = 0x8645; var GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F; var GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; var GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; var PARAMETERS = [GL_VERTEX_ATTRIB_ARRAY_ENABLED, GL_VERTEX_ATTRIB_ARRAY_SIZE, GL_VERTEX_ATTRIB_ARRAY_STRIDE, GL_VERTEX_ATTRIB_ARRAY_TYPE, GL_VERTEX_ATTRIB_ARRAY_NORMALIZED, GL_VERTEX_ATTRIB_ARRAY_POINTER, GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING, GL_VERTEX_ATTRIB_ARRAY_INTEGER, GL_VERTEX_ATTRIB_ARRAY_DIVISOR]; var ERR_ELEMENTS = 'elements must be GL.ELEMENT_ARRAY_BUFFER'; var VertexArray = /*#__PURE__*/function (_Resource) { _inherits(VertexArray, _Resource); _createClass(VertexArray, [{ key: 'MAX_ATTRIBUTES', get: function get() { return this.gl.getParameter(this.gl.MAX_VERTEX_ATTRIBS); } // Create a VertexArray }], [{ key: 'isSupported', value: function isSupported(gl) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl) || gl.getExtension(OES_vertex_array_object); } }, { key: 'getDefaultArray', value: function getDefaultArray(gl) { gl.luma = gl.luma || {}; if (!gl.luma.defaultVertexArray) { gl.luma.defaultVertexArray = new VertexArray(gl, { handle: null }); } return gl.luma.defaultVertexArray; } }, { key: 'getMaxAttributes', value: function getMaxAttributes(gl) { return gl.getParameter(gl.MAX_VERTEX_ATTRIBS); } }]); function VertexArray(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, VertexArray); var _this = _possibleConstructorReturn(this, (VertexArray.__proto__ || Object.getPrototypeOf(VertexArray)).call(this, gl, opts)); _this.elements = null; _this.buffers = {}; // new Array(this.MAX_VERTEX_ATTRIBS).fill(null); _this.locations = {}; _this.names = {}; _this.drawParameters = {}; _this._bound = false; _this._filledLocations = {}; Object.seal(_this); _this.initialize(opts); return _this; } _createClass(VertexArray, [{ key: 'initialize', value: function initialize() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$buffers = _ref.buffers, buffers = _ref$buffers === undefined ? {} : _ref$buffers, _ref$elements = _ref.elements, elements = _ref$elements === undefined ? null : _ref$elements, _ref$locations = _ref.locations, locations = _ref$locations === undefined ? {} : _ref$locations; this.setLocations(locations); this.setBuffers(buffers, { clear: true }); this.setElements(elements); } }, { key: 'setLocations', // Register an optional buffer name to location mapping value: function setLocations(locations) { this.locations = locations; this.names = {}; } // Set (bind) an elements buffer, for indexed rendering. Must be GL.ELEMENT_ARRAY_BUFFER }, { key: 'setElements', value: function setElements(elements) { __WEBPACK_IMPORTED_MODULE_3_assert___default()(!elements || elements.target === GL_ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS); this.ext.bindVertexArray(this.handle); this.gl.bindBuffer(GL_ELEMENT_ARRAY_BUFFER, elements && elements.handle); this.ext.bindVertexArray(null); this.elements = elements; return this; } // Set (bind) an array or map of vertex array buffers, either in numbered or // named locations. (named locations requires `locations` to have been provided). // For names that are not present in `location`, the supplied buffers will be ignored. // if a single buffer of type GL.ELEMENT_ARRAY_BUFFER is present, it will be set as elements // @param {Object} buffers - An object map with attribute names being keys // and values are expected to be instances of Buffer. }, { key: '_getBufferAndLayout', value: function _getBufferAndLayout(bufferData) { // Check if buffer was supplied var buffer = void 0; var layout = void 0; if (bufferData.handle) { buffer = bufferData; layout = bufferData.layout; } else { buffer = bufferData.buffer; layout = Object.assign({}, buffer.layout, bufferData.layout || {}, bufferData); } return { buffer: buffer, layout: layout }; } }, { key: 'setBuffers', value: function setBuffers(buffers) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$clear = _ref2.clear, clear = _ref2$clear === undefined ? true : _ref2$clear; if (clear) { this.clearBindings(); } var _getLocations2 = this._getLocations(buffers), locations = _getLocations2.locations, elements = _getLocations2.elements; this.ext.bindVertexArray(this.handle); // Process locations in order for (var location in locations) { var bufferData = locations[location]; if (bufferData) { var _getBufferAndLayout2 = this._getBufferAndLayout(bufferData), buffer = _getBufferAndLayout2.buffer, layout = _getBufferAndLayout2.layout; this.setBuffer({ location: location, buffer: buffer, layout: layout }); this.setDivisor(location, layout.instanced ? 1 : 0); this.enable(location); } else { // DISABLE MISSING ATTRIBUTE this.disable(location); } } this.buffers = buffers; this.ext.bindVertexArray(null); if (elements) { this.setElements(elements); } } // Enable an attribute }, { key: 'enable', value: function enable(location) { var _this2 = this; this.bind(function () { _this2.gl.enableVertexAttribArray(location); }); } }, { key: 'clearBindings', value: function clearBindings() { var _this3 = this; var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref3$disableZero = _ref3.disableZero, disableZero = _ref3$disableZero === undefined ? false : _ref3$disableZero; this.bind(function () { for (var location in _this3._filledLocations) { if (_this3._filledLocations[location] && (location > 0 || disableZero)) { _this3.gl.disableVertexAttribArray(location); } } _this3._filledLocations = {}; }); } // Disable an attribute // Perf penalty when disabling attribute 0: // https://stackoverflow.com/questions/20305231/webgl-warning-attribute-0-is-disabled- // this-has-significant-performance-penalt }, { key: 'disable', value: function disable(location) { var _this4 = this; var disableZero = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (location > 0 || disableZero) { this.bind(function () { _this4.gl.disableVertexAttribArray(location); }); } } // Set the frequency divisor used for instanced rendering. }, { key: 'setDivisor', value: function setDivisor(location, divisor) { var _this5 = this; this.bind(function () { _this5.ext.vertexAttribDivisor(location, divisor); }); } // Set a location in vertex attributes array to a buffer }, { key: 'setBuffer', value: function setBuffer() { var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, location = _ref4.location, buffer = _ref4.buffer, target = _ref4.target, layout = _ref4.layout; var gl = this.gl; // Copy main data characteristics from buffer target = target !== undefined ? target : buffer.target; layout = layout !== undefined ? layout : buffer.layout; __WEBPACK_IMPORTED_MODULE_3_assert___default()(target, 'setBuffer needs target'); __WEBPACK_IMPORTED_MODULE_3_assert___default()(layout, 'setBuffer called on uninitialized buffer'); this._filledLocations[location] = true; this.bind(function () { // a non-zero named buffer object must be bound to the GL_ARRAY_BUFFER target buffer.bind({ target: gl.ARRAY_BUFFER }); var _layout = layout, size = _layout.size, type = _layout.type, normalized = _layout.normalized, stride = _layout.stride, offset = _layout.offset; // Attach _bound ARRAY_BUFFER with specified buffer format to location if (!layout.integer) { gl.vertexAttribPointer(location, size, type, normalized, stride, offset); } else { // specifies *integer* data formats and locations of vertex attributes __WEBPACK_IMPORTED_MODULE_3_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl)); gl.vertexAttribIPointer(location, size, type, stride, offset); } }); } // Specify values for generic vertex attributes }, { key: 'setGeneric', value: function setGeneric(_ref5) { var location = _ref5.location, array = _ref5.array; this._filledLocations[location] = true; switch (array.constructor) { case Float32Array: this._setGenericFloatArray(location, array); break; case Int32Array: this._setGenericIntArray(location, array); break; case Uint32Array: this._setGenericUintArray(location, array); break; default: this.setGenericValues.apply(this, [location].concat(_toConsumableArray(array))); } } }, { key: '_setGenericFloatArray', value: function _setGenericFloatArray(location, array) { var gl = this.gl; switch (array.length) { case 1: gl.vertexAttrib1fv(location, array);break; case 2: gl.vertexAttrib2fv(location, array);break; case 3: gl.vertexAttrib3fv(location, array);break; case 4: gl.vertexAttrib4fv(location, array);break; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false); } } }, { key: '_setGenericIntArray', value: function _setGenericIntArray(location, array) { var gl = this.gl; __WEBPACK_IMPORTED_MODULE_3_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl)); switch (array.length) { case 1: gl.vertexAttribI1iv(location, array);break; case 2: gl.vertexAttribI2iv(location, array);break; case 3: gl.vertexAttribI3iv(location, array);break; case 4: gl.vertexAttribI4iv(location, array);break; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false); } } }, { key: '_setGenericUintArray', value: function _setGenericUintArray(location, array) { var gl = this.gl; __WEBPACK_IMPORTED_MODULE_3_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl)); switch (array.length) { case 1: gl.vertexAttribI1uiv(location, array);break; case 2: gl.vertexAttribI2uiv(location, array);break; case 3: gl.vertexAttribI3uiv(location, array);break; case 4: gl.vertexAttribI4uiv(location, array);break; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false); } } // Specify values for generic vertex attributes }, { key: 'setGenericValues', value: function setGenericValues(location, v0, v1, v2, v3) { var gl = this.gl; switch (arguments.length - 1) { case 1: gl.vertexAttrib1f(location, v0);break; case 2: gl.vertexAttrib2f(location, v0, v1);break; case 3: gl.vertexAttrib3f(location, v0, v1, v2);break; case 4: gl.vertexAttrib4f(location, v0, v1, v2, v3);break; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false); } // assert(gl instanceof WebGL2RenderingContext, 'WebGL2 required'); // Looks like these will check how many arguments were supplied? // gl.vertexAttribI4i(location, v0, v1, v2, v3); // gl.vertexAttribI4ui(location, v0, v1, v2, v3); } }, { key: 'bind', value: function bind() { var funcOrHandle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.handle; if (typeof funcOrHandle !== 'function') { this.bindVertexArray(funcOrHandle); return this; } var value = void 0; if (!this._bound) { this.ext.bindVertexArray(this.handle); this._bound = true; value = funcOrHandle(); this.ext.bindVertexArray(null); this._bound = false; } else { value = funcOrHandle(); } return value; } // PRIVATE // Auto detect draw parameters from the complement of buffers provided }, { key: '_deduceDrawParameters', value: function _deduceDrawParameters() { // indexing is autodetected - buffer with target gl.ELEMENT_ARRAY_BUFFER // index type is saved for drawElement calls var isInstanced = false; var isIndexed = false; var indexType = null; // Check if we have an elements array buffer if (this.elements) { isIndexed = true; indexType = this.elements.layout.type; } // Check if any instanced buffers this.buffers.forEach(function (buffer) { if (buffer.layout.instanced > 0) { isInstanced = true; } }); return { isInstanced: isInstanced, isIndexed: isIndexed, indexType: indexType }; } // this._filledLocations[bufferName] = true; }, { key: '_getLocations', value: function _getLocations(buffers) { // Try to extract elements and locations var elements = null; var locations = {}; for (var bufferName in buffers) { var buffer = buffers[bufferName]; // Check if this is an elements array if (buffer && buffer.target === GL_ELEMENT_ARRAY_BUFFER) { __WEBPACK_IMPORTED_MODULE_3_assert___default()(!elements, 'Duplicate GL.ELEMENT_ARRAY_BUFFER'); // assert(location === undefined, 'GL.ELEMENT_ARRAY_BUFFER assigned to location'); elements = buffer; } // else if (!this._warn[bufferName]) { // log.warn(2, `${this._print(bufferName)} not used`); // this._warn[bufferName] = true; // } var location = Number(bufferName); // if key is a number, interpret as the location // if key is not a location number, assume it is a named buffer, look it up in supplied map if (!Number.isFinite(location)) { location = this.locations[bufferName]; } __WEBPACK_IMPORTED_MODULE_3_assert___default()(Number.isFinite(location)); __WEBPACK_IMPORTED_MODULE_3_assert___default()(!locations[location], 'Duplicate attribute for binding point ' + location); locations[location] = buffer; } return { locations: locations, elements: elements }; } }, { key: '_sortBuffersByLocation', value: function _sortBuffersByLocation(buffers) { // Try to extract elements and locations var elements = null; var locations = new Array(this._attributeCount).fill(null); for (var bufferName in buffers) { var buffer = buffers[bufferName]; // Check if this is an elements arrau if (buffer.target === GL_ELEMENT_ARRAY_BUFFER) { __WEBPACK_IMPORTED_MODULE_3_assert___default()(!elements, 'Duplicate GL.ELEMENT_ARRAY_BUFFER'); // assert(location === undefined, 'GL.ELEMENT_ARRAY_BUFFER assigned to location'); elements = buffer; } else if (!this._warn[bufferName]) { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].warn(2, this._print(bufferName) + ' not used'); this._warn[bufferName] = true; } var location = Number(bufferName); // if key is a number, interpret as the location // if key is not a location number, assume it is a named buffer, look it up in supplied map if (!Number.isFinite(location)) { location = this.locations[bufferName]; } locations[location] = bufferName; __WEBPACK_IMPORTED_MODULE_3_assert___default()(locations[location] === null, 'Duplicate attribute for binding point ' + location); locations[location] = location; } return { locations: locations, elements: elements }; } // RESOURCE IMPLEMENTATION }, { key: '_createHandle', value: function _createHandle() { return this.ext.createVertexArray(); } }, { key: '_deleteHandle', value: function _deleteHandle(handle) { this.ext.deleteVertexArray(handle); return [this.elements]; // return [this.elements, ...this.buffers]; } // Generic getter for information about a vertex attribute at a given position // @param {GLuint} location - index of the vertex attribute. // @param {GLenum} pname - specifies the information to query. // @returns {*} - requested vertex attribute information (specified by pname) }, { key: '_getParameter', value: function _getParameter(pname, _ref6) { var location = _ref6.location; __WEBPACK_IMPORTED_MODULE_3_assert___default()(Number.isFinite(location)); this.ext.bindVertexArray(this.handle); // Let the polyfill intercept the query var result = void 0; switch (pname) { case GL_VERTEX_ATTRIB_ARRAY_POINTER: result = this.gl.getVertexAttribOffset(location, pname); break; default: result = this.ext.getVertexAttrib(location, pname); } this.ext.bindVertexArray(null); return result; } }, { key: '_getData', value: function _getData() { var _this6 = this; return new Array(this.MAX_ATTRIBUTES).fill(0).map(function (_, location) { var result = {}; PARAMETERS.forEach(function (parameter) { result[__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["c" /* glKey */])(parameter)] = _this6.getParameter(parameter, { location: location }); }); return result; }); } }, { key: '_bind', value: function _bind(handle) { this.ext.bindVertexArray(handle); } }, { key: 'filledLocations', get: function get() { return this._filledLocations; } }]); return VertexArray; }(__WEBPACK_IMPORTED_MODULE_2__resource__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (VertexArray); //# sourceMappingURL=vertex-array.js.map /***/ }), /* 170 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math_array__ = __webpack_require__(112); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common__ = __webpack_require__(31); var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i 1 && arguments[1] !== undefined ? arguments[1] : {}; if (!isBrowser || !isReady()) { return; } var seen = new Set(); var payload = JSON.stringify(data, replacer(seen)); try { window.postMessage({ type: type, payload: payload, source: 'seer-agent' }, '*'); } catch (e) { if (throttle('seer-log', 2E3)) { return; } console.log(e); // eslint-disable-line } }; var listeners = new Map(); var listener = function listener(message) { if (!message || !message.data || message.data.source !== 'seer-core') { return; } var _message$data = message.data, type = _message$data.type, payload = _message$data.payload; var typeListeners = listeners.get(type); if (typeListeners) { typeListeners.forEach(function (cb) { return cb(payload); }); } }; /** * Initilize window listener. There will be only one for the whole process * to prevent too many registrations. * * This method will be called automatically if you use the `listenFor` method. */ var init = function init() { if (!isBrowser || window.__SEER_LISTENER__) { return; } window.addEventListener('message', listener); window.__SEER_LISTENER__ = true; }; /** * Clean listener. Can be useful in case you want to unregister upcoming events * or liberate memory. */ var clean = function clean() { if (!isBrowser || !window.__SEER_LISTENER__) { return; } window.removeEventListener('message', listener); delete window.__SEER_LISTENER__; }; /** * Create a listener that will be called upon events of the given key. * * @param key {String} The unique tab key * @param cb {Function} A callback that will receive the message payload */ var listenFor = function listenFor(type, cb) { if (!isBrowser) { return; } if (!type || !cb) { throw new Error('Please provide a type and callback'); } if (!listeners.has(type)) { listeners.set(type, []); } if (!window.__SEER_LISTENER__) { init(); } listeners.get(type).push(cb); }; /** * Remove an identity listener * * @param cb {Function} The callback to remove */ var removeListener = function removeListener(cb) { listeners.forEach(function (typeListeners, key) { listeners.set(key, typeListeners.filter(function (l) { return l !== cb; })); }); }; /** * Creates a new indexed list. * It works by index to get O(1) accessing and performance. * * @param key {String} The key of the tab * @param data {Object} The indexed object */ var list = function list(key, data) { return send('LIST', { key: key, data: data }); }; /** * Creates an element in the indexed list, based on the itemKey. * * @param key {String} The key of the tab * @param itemKey {String} The key of the item * @param data {Any} The value of the item */ var listItem = function listItem(key, itemKey) { var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return send('LIST_ITEM', { key: key, itemKey: itemKey, data: data }); }; /** * Update an item property, can be deeply nested. * * @param key {String} The key of the tab * @param itemKey {String} The key of the item * @param path {String} The path of the variable you want to update * @param data {Object} The new value */ var updateItem = function updateItem(key, itemKey, path, data) { return send('UPDATE_ITEM', { key: key, itemKey: itemKey, path: path, data: data }); }; /** * Similar to updateItem, but allows to pass an array with {path,data} pairs for * multiple update of the same item without having to send multiple messages. * * @param key {String} The key of the tab * @param itemKey {String} The key of the item * @param array {Array} The array of updates * @param array.path {String} The path for this update * @param array.data {Object} The value of this update */ var multiUpdate = function multiUpdate(key, itemKey, array) { return send('MULTI_UPDATE_ITEM', { key: key, itemKey: itemKey, array: array }); }; /** * Remove a specific item in a specific tab. * * @param key {String} They key of the tab * @param itemKey {String} The key of the item */ var deleteItem = function deleteItem(key, itemKey) { return send('DELETE_ITEM', { key: key, itemKey: itemKey }); }; /** * Will create a log message to an item, that will be displayde with the current time. * * @param key {String} The key of the tab * @param itemKey {String} The key of the item * @param msg {String} The message to display */ var addLog = function addLog(key, itemKey, msg) { return send('ADD_LOG', { key: key, itemKey: itemKey, msg: msg }); }; exports.default = { send: send, throttle: throttle, isReady: isReady, list: list, listItem: listItem, updateItem: updateItem, multiUpdate: multiUpdate, deleteItem: deleteItem, addLog: addLog, listeners: listeners, listenFor: listenFor, removeListener: removeListener, init: init, clean: clean }; /***/ }), /* 174 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _gridCellLayerVertex = __webpack_require__(297); var _gridCellLayerVertex2 = _interopRequireDefault(_gridCellLayerVertex); var _gridCellLayerVertex3 = __webpack_require__(296); var _gridCellLayerVertex4 = _interopRequireDefault(_gridCellLayerVertex3); var _gridCellLayerFragment = __webpack_require__(295); var _gridCellLayerFragment2 = _interopRequireDefault(_gridCellLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var fp64LowPart = _core.experimental.fp64LowPart, enable64bitSupport = _core.experimental.enable64bitSupport; var DEFAULT_COLOR = [255, 0, 255, 255]; var defaultProps = { cellSize: 1000, coverage: 1, elevationScale: 1, extruded: true, fp64: false, getPosition: function getPosition(x) { return x.position; }, getElevation: function getElevation(x) { return x.elevation; }, getColor: function getColor(x) { return x.color; }, lightSettings: { lightsPosition: [-122.45, 37.65, 8000, -122.45, 37.2, 1000], ambientRatio: 0.4, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [1.0, 0.0, 0.8, 0.0], numberOfLights: 2 } }; var GridCellLayer = function (_Layer) { _inherits(GridCellLayer, _Layer); function GridCellLayer() { _classCallCheck(this, GridCellLayer); return _possibleConstructorReturn(this, (GridCellLayer.__proto__ || Object.getPrototypeOf(GridCellLayer)).apply(this, arguments)); } _createClass(GridCellLayer, [{ key: 'getShaders', /** * A generic GridLayer that takes latitude longitude delta of cells as a uniform * and the min lat lng of cells. grid can be 3d when pass in a height * and set enable3d to true * * @param {array} props.data - * @param {boolean} props.extruded - enable grid elevation * @param {number} props.cellSize - grid cell size in meters * @param {function} props.getPosition - position accessor, returned as [minLng, minLat] * @param {function} props.getElevation - elevation accessor * @param {function} props.getColor - color accessor, returned as [r, g, b, a] */ value: function getShaders() { var shaderCache = this.context.shaderCache; return enable64bitSupport(this.props) ? { vs: _gridCellLayerVertex4.default, fs: _gridCellLayerFragment2.default, modules: ['project64', 'lighting', 'picking'], shaderCache: shaderCache } : { vs: _gridCellLayerVertex2.default, fs: _gridCellLayerFragment2.default, modules: ['lighting', 'picking'], shaderCache: shaderCache }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { var attributeManager = this.getAttributeManager(); /* eslint-disable max-len */ attributeManager.addInstanced({ instancePositions: { size: 4, transition: true, accessor: ['getPosition', 'getElevation'], update: this.calculateInstancePositions }, instanceColors: { size: 4, type: _luma.GL.UNSIGNED_BYTE, transition: true, accessor: 'getColor', update: this.calculateInstanceColors } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.addInstanced({ instancePositions64xyLow: { size: 2, accessor: 'getPosition', update: this.calculateInstancePositions64xyLow } }); } else { attributeManager.remove(['instancePositions64xyLow']); } } } }, { key: 'updateState', value: function updateState(_ref2) { var props = _ref2.props, oldProps = _ref2.oldProps, changeFlags = _ref2.changeFlags; _get(GridCellLayer.prototype.__proto__ || Object.getPrototypeOf(GridCellLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); // Re-generate model if geometry changed if (props.fp64 !== oldProps.fp64) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); this.updateUniforms(); } }, { key: '_getModel', value: function _getModel(gl) { return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: new _luma.CubeGeometry(), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'updateUniforms', value: function updateUniforms() { var _props = this.props, opacity = _props.opacity, extruded = _props.extruded, elevationScale = _props.elevationScale, coverage = _props.coverage, lightSettings = _props.lightSettings; var model = this.state.model; model.setUniforms(Object.assign({}, { extruded: extruded, elevationScale: elevationScale, opacity: opacity, coverage: coverage }, lightSettings)); } }, { key: 'draw', value: function draw(_ref3) { var uniforms = _ref3.uniforms; var viewport = this.context.viewport; // TODO - this should be a standard uniform in project package var _viewport$getDistance = viewport.getDistanceScales(), pixelsPerMeter = _viewport$getDistance.pixelsPerMeter; // cellSize needs to be updated on every draw call // because it is based on viewport _get(GridCellLayer.prototype.__proto__ || Object.getPrototypeOf(GridCellLayer.prototype), 'draw', this).call(this, { uniforms: Object.assign({ cellSize: this.props.cellSize * pixelsPerMeter[0] }, uniforms) }); } }, { key: 'calculateInstancePositions', value: function calculateInstancePositions(attribute) { var _props2 = this.props, data = _props2.data, getPosition = _props2.getPosition, getElevation = _props2.getElevation; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var object = _step.value; var position = getPosition(object); var elevation = getElevation(object) || 0; value[i + 0] = position[0]; value[i + 1] = position[1]; value[i + 2] = 0; value[i + 3] = elevation; i += size; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'calculateInstancePositions64xyLow', value: function calculateInstancePositions64xyLow(attribute) { var _props3 = this.props, data = _props3.data, getPosition = _props3.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var point = _step2.value; var position = getPosition(point); value[i++] = fp64LowPart(position[0]); value[i++] = fp64LowPart(position[1]); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: 'calculateInstanceColors', value: function calculateInstanceColors(attribute) { var _props4 = this.props, data = _props4.data, getColor = _props4.getColor; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var object = _step3.value; var color = getColor(object) || DEFAULT_COLOR; value[i + 0] = color[0]; value[i + 1] = color[1]; value[i + 2] = color[2]; value[i + 3] = Number.isFinite(color[3]) ? color[3] : DEFAULT_COLOR[3]; i += size; } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } }]); return GridCellLayer; }(_core.Layer); exports.default = GridCellLayer; GridCellLayer.layerName = 'GridCellLayer'; GridCellLayer.defaultProps = defaultProps; /***/ }), /* 175 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _hexagonCellLayerVertex = __webpack_require__(302); var _hexagonCellLayerVertex2 = _interopRequireDefault(_hexagonCellLayerVertex); var _hexagonCellLayerVertex3 = __webpack_require__(301); var _hexagonCellLayerVertex4 = _interopRequireDefault(_hexagonCellLayerVertex3); var _hexagonCellLayerFragment = __webpack_require__(300); var _hexagonCellLayerFragment2 = _interopRequireDefault(_hexagonCellLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var log = _core.experimental.log, fp64LowPart = _core.experimental.fp64LowPart, enable64bitSupport = _core.experimental.enable64bitSupport; var DEFAULT_COLOR = [255, 0, 255, 255]; var defaultProps = { hexagonVertices: null, radius: null, angle: null, coverage: 1, elevationScale: 1, extruded: true, fp64: false, getCentroid: function getCentroid(x) { return x.centroid; }, getColor: function getColor(x) { return x.color; }, getElevation: function getElevation(x) { return x.elevation; }, lightSettings: { lightsPosition: [-122.45, 37.75, 8000, -122.0, 38.0, 5000], ambientRatio: 0.4, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [1.2, 0.0, 0.8, 0.0], numberOfLights: 2 } }; var HexagonCellLayer = function (_Layer) { _inherits(HexagonCellLayer, _Layer); function HexagonCellLayer(props) { _classCallCheck(this, HexagonCellLayer); var missingProps = false; if (!props.hexagonVertices && (!props.radius || !Number.isFinite(props.angle))) { log.once(0, 'HexagonCellLayer: Either hexagonVertices or radius and angle are ' + 'needed to calculate primitive hexagon.'); missingProps = true; } else if (props.hexagonVertices && (!Array.isArray(props.hexagonVertices) || props.hexagonVertices.length < 6)) { log.once(0, 'HexagonCellLayer: hexagonVertices needs to be an array of 6 points'); missingProps = true; } if (missingProps) { log.once(0, 'Now using 1000 meter as default radius, 0 as default angle'); props.radius = 1000; props.angle = 0; } return _possibleConstructorReturn(this, (HexagonCellLayer.__proto__ || Object.getPrototypeOf(HexagonCellLayer)).call(this, props)); } _createClass(HexagonCellLayer, [{ key: 'getShaders', value: function getShaders() { return enable64bitSupport(this.props) ? { vs: _hexagonCellLayerVertex4.default, fs: _hexagonCellLayerFragment2.default, modules: ['project64', 'lighting', 'picking'] } : { vs: _hexagonCellLayerVertex2.default, fs: _hexagonCellLayerFragment2.default, modules: ['lighting', 'picking'] }; // 'project' module added by default. } /** * DeckGL calls initializeState when GL context is available * Essentially a deferred constructor */ }, { key: 'initializeState', value: function initializeState() { var attributeManager = this.getAttributeManager(); /* eslint-disable max-len */ attributeManager.addInstanced({ instancePositions: { size: 3, transition: true, accessor: ['getCentroid', 'getElevation'], update: this.calculateInstancePositions }, instanceColors: { size: 4, type: _luma.GL.UNSIGNED_BYTE, transition: true, accessor: 'getColor', update: this.calculateInstanceColors } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.addInstanced({ instancePositions64xyLow: { size: 2, accessor: 'getCentroid', update: this.calculateInstancePositions64xyLow } }); } else { attributeManager.remove(['instancePositions64xyLow']); } } } }, { key: 'updateState', value: function updateState(_ref2) { var props = _ref2.props, oldProps = _ref2.oldProps, changeFlags = _ref2.changeFlags; _get(HexagonCellLayer.prototype.__proto__ || Object.getPrototypeOf(HexagonCellLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); if (props.fp64 !== oldProps.fp64) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); this.updateUniforms(); } }, { key: 'updateRadiusAngle', value: function updateRadiusAngle() { var angle = void 0; var radius = void 0; var hexagonVertices = this.props.hexagonVertices; if (Array.isArray(hexagonVertices) && hexagonVertices.length >= 6) { // calculate angle and vertices from hexagonVertices if provided var vertices = this.props.hexagonVertices; var vertex0 = vertices[0]; var vertex3 = vertices[3]; // transform to space coordinates var spaceCoord0 = this.projectFlat(vertex0); var spaceCoord3 = this.projectFlat(vertex3); // distance between two close centroids var dx = spaceCoord0[0] - spaceCoord3[0]; var dy = spaceCoord0[1] - spaceCoord3[1]; var dxy = Math.sqrt(dx * dx + dy * dy); // Calculate angle that the perpendicular hexagon vertex axis is tilted angle = Math.acos(dx / dxy) * -Math.sign(dy) + Math.PI / 2; radius = dxy / 2; } else if (this.props.radius && Number.isFinite(this.props.angle)) { // if no hexagonVertices provided, try use radius & angle var viewport = this.context.viewport; // TODO - this should be a standard uniform in project package var _viewport$getDistance = viewport.getDistanceScales(), pixelsPerMeter = _viewport$getDistance.pixelsPerMeter; angle = this.props.angle; radius = this.props.radius * pixelsPerMeter[0]; } return { angle: angle, radius: radius }; } }, { key: 'getCylinderGeometry', value: function getCylinderGeometry(radius) { return new _luma.CylinderGeometry({ radius: radius, topRadius: radius, bottomRadius: radius, topCap: true, bottomCap: true, height: 1, nradial: 6, nvertical: 1 }); } }, { key: 'updateUniforms', value: function updateUniforms() { var _props = this.props, opacity = _props.opacity, elevationScale = _props.elevationScale, extruded = _props.extruded, coverage = _props.coverage, lightSettings = _props.lightSettings; var model = this.state.model; model.setUniforms(Object.assign({}, { extruded: extruded, opacity: opacity, coverage: coverage, elevationScale: elevationScale }, lightSettings)); } }, { key: '_getModel', value: function _getModel(gl) { return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: this.getCylinderGeometry(1), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'draw', value: function draw(_ref3) { var uniforms = _ref3.uniforms; _get(HexagonCellLayer.prototype.__proto__ || Object.getPrototypeOf(HexagonCellLayer.prototype), 'draw', this).call(this, { uniforms: Object.assign(this.updateRadiusAngle(), uniforms) }); } }, { key: 'calculateInstancePositions', value: function calculateInstancePositions(attribute) { var _props2 = this.props, data = _props2.data, getCentroid = _props2.getCentroid, getElevation = _props2.getElevation; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var object = _step.value; var _getCentroid = getCentroid(object), _getCentroid2 = _slicedToArray(_getCentroid, 2), lon = _getCentroid2[0], lat = _getCentroid2[1]; var elevation = getElevation(object); value[i + 0] = lon; value[i + 1] = lat; value[i + 2] = elevation || 0; i += size; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'calculateInstancePositions64xyLow', value: function calculateInstancePositions64xyLow(attribute) { var _props3 = this.props, data = _props3.data, getCentroid = _props3.getCentroid; var value = attribute.value; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var object = _step2.value; var position = getCentroid(object); value[i++] = fp64LowPart(position[0]); value[i++] = fp64LowPart(position[1]); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: 'calculateInstanceColors', value: function calculateInstanceColors(attribute) { var _props4 = this.props, data = _props4.data, getColor = _props4.getColor; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var object = _step3.value; var color = getColor(object) || DEFAULT_COLOR; value[i + 0] = color[0]; value[i + 1] = color[1]; value[i + 2] = color[2]; value[i + 3] = Number.isFinite(color[3]) ? color[3] : DEFAULT_COLOR[3]; i += size; } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } }]); return HexagonCellLayer; }(_core.Layer); exports.default = HexagonCellLayer; HexagonCellLayer.layerName = 'HexagonCellLayer'; HexagonCellLayer.defaultProps = defaultProps; /***/ }), /* 176 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _scatterplotLayerVertex = __webpack_require__(324); var _scatterplotLayerVertex2 = _interopRequireDefault(_scatterplotLayerVertex); var _scatterplotLayerVertex3 = __webpack_require__(323); var _scatterplotLayerVertex4 = _interopRequireDefault(_scatterplotLayerVertex3); var _scatterplotLayerFragment = __webpack_require__(322); var _scatterplotLayerFragment2 = _interopRequireDefault(_scatterplotLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var fp64LowPart = _core.experimental.fp64LowPart, enable64bitSupport = _core.experimental.enable64bitSupport; var DEFAULT_COLOR = [0, 0, 0, 255]; var defaultProps = { radiusScale: 1, radiusMinPixels: 0, // min point radius in pixels radiusMaxPixels: Number.MAX_SAFE_INTEGER, // max point radius in pixels strokeWidth: 1, outline: false, fp64: false, getPosition: function getPosition(x) { return x.position; }, getRadius: function getRadius(x) { return x.radius || 1; }, getColor: function getColor(x) { return x.color || DEFAULT_COLOR; } }; var ScatterplotLayer = function (_Layer) { _inherits(ScatterplotLayer, _Layer); function ScatterplotLayer() { _classCallCheck(this, ScatterplotLayer); return _possibleConstructorReturn(this, (ScatterplotLayer.__proto__ || Object.getPrototypeOf(ScatterplotLayer)).apply(this, arguments)); } _createClass(ScatterplotLayer, [{ key: 'getShaders', value: function getShaders(id) { var shaderCache = this.context.shaderCache; return enable64bitSupport(this.props) ? { vs: _scatterplotLayerVertex4.default, fs: _scatterplotLayerFragment2.default, modules: ['project64', 'picking'], shaderCache: shaderCache } : { vs: _scatterplotLayerVertex2.default, fs: _scatterplotLayerFragment2.default, modules: ['picking'], shaderCache: shaderCache }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { /* eslint-disable max-len */ this.state.attributeManager.addInstanced({ instancePositions: { size: 3, transition: true, accessor: 'getPosition', update: this.calculateInstancePositions }, instanceRadius: { size: 1, transition: true, accessor: 'getRadius', defaultValue: 1, update: this.calculateInstanceRadius }, instanceColors: { size: 4, transition: true, type: _luma.GL.UNSIGNED_BYTE, accessor: 'getColor', update: this.calculateInstanceColors } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.addInstanced({ instancePositions64xyLow: { size: 2, accessor: 'getPosition', update: this.calculateInstancePositions64xyLow } }); } else { attributeManager.remove(['instancePositions64xyLow']); } } } }, { key: 'updateState', value: function updateState(_ref2) { var props = _ref2.props, oldProps = _ref2.oldProps, changeFlags = _ref2.changeFlags; _get(ScatterplotLayer.prototype.__proto__ || Object.getPrototypeOf(ScatterplotLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); if (props.fp64 !== oldProps.fp64) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); } }, { key: 'draw', value: function draw(_ref3) { var uniforms = _ref3.uniforms; var _props = this.props, radiusScale = _props.radiusScale, radiusMinPixels = _props.radiusMinPixels, radiusMaxPixels = _props.radiusMaxPixels, outline = _props.outline, strokeWidth = _props.strokeWidth; this.state.model.render(Object.assign({}, uniforms, { outline: outline ? 1 : 0, strokeWidth: strokeWidth, radiusScale: radiusScale, radiusMinPixels: radiusMinPixels, radiusMaxPixels: radiusMaxPixels })); } }, { key: '_getModel', value: function _getModel(gl) { // a square that minimally cover the unit circle var positions = [-1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0]; return new _luma.Model(gl, Object.assign(this.getShaders(), { id: this.props.id, geometry: new _luma.Geometry({ drawMode: _luma.GL.TRIANGLE_FAN, attributes: { positions: new Float32Array(positions) } }), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'calculateInstancePositions', value: function calculateInstancePositions(attribute) { var _props2 = this.props, data = _props2.data, getPosition = _props2.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var point = _step.value; var position = getPosition(point); value[i++] = position[0]; value[i++] = position[1]; value[i++] = position[2] || 0; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'calculateInstancePositions64xyLow', value: function calculateInstancePositions64xyLow(attribute) { var _props3 = this.props, data = _props3.data, getPosition = _props3.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var point = _step2.value; var position = getPosition(point); value[i++] = fp64LowPart(position[0]); value[i++] = fp64LowPart(position[1]); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: 'calculateInstanceRadius', value: function calculateInstanceRadius(attribute) { var _props4 = this.props, data = _props4.data, getRadius = _props4.getRadius; var value = attribute.value; var i = 0; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var point = _step3.value; var radius = getRadius(point); value[i++] = isNaN(radius) ? 1 : radius; } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } }, { key: 'calculateInstanceColors', value: function calculateInstanceColors(attribute) { var _props5 = this.props, data = _props5.data, getColor = _props5.getColor; var value = attribute.value; var i = 0; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = data[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var point = _step4.value; var color = getColor(point) || DEFAULT_COLOR; value[i++] = color[0]; value[i++] = color[1]; value[i++] = color[2]; value[i++] = isNaN(color[3]) ? 255 : color[3]; } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } } }]); return ScatterplotLayer; }(_core.Layer); exports.default = ScatterplotLayer; ScatterplotLayer.layerName = 'ScatterplotLayer'; ScatterplotLayer.defaultProps = defaultProps; /***/ }), /* 177 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _props2 = __webpack_require__(187); var _polygonTesselator = __webpack_require__(329); var _polygonTesselatorExtruded = __webpack_require__(328); var _solidPolygonLayerVertex = __webpack_require__(332); var _solidPolygonLayerVertex2 = _interopRequireDefault(_solidPolygonLayerVertex); var _solidPolygonLayerVertex3 = __webpack_require__(331); var _solidPolygonLayerVertex4 = _interopRequireDefault(_solidPolygonLayerVertex3); var _solidPolygonLayerFragment = __webpack_require__(330); var _solidPolygonLayerFragment2 = _interopRequireDefault(_solidPolygonLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var enable64bitSupport = _core.experimental.enable64bitSupport, get = _core.experimental.get; // Polygon geometry generation is managed by the polygon tesselator var defaultProps = { // Whether to extrude extruded: false, // Whether to draw a GL.LINES wireframe of the polygon wireframe: false, fp64: false, // elevation multiplier elevationScale: 1, // Accessor for polygon geometry getPolygon: function getPolygon(f) { return get(f, 'polygon') || get(f, 'geometry.coordinates'); }, // Accessor for extrusion height getElevation: function getElevation(f) { return get(f, 'elevation') || get(f, 'properties.height') || 0; }, // Accessor for color getColor: function getColor(f) { return get(f, 'color') || get(f, 'properties.color'); }, // Optional settings for 'lighting' shader module lightSettings: { lightsPosition: [-122.45, 37.75, 8000, -122.0, 38.0, 5000], ambientRatio: 0.05, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [2.0, 0.0, 0.0, 0.0], numberOfLights: 2 } }; var SolidPolygonLayer = function (_Layer) { _inherits(SolidPolygonLayer, _Layer); function SolidPolygonLayer() { _classCallCheck(this, SolidPolygonLayer); return _possibleConstructorReturn(this, (SolidPolygonLayer.__proto__ || Object.getPrototypeOf(SolidPolygonLayer)).apply(this, arguments)); } _createClass(SolidPolygonLayer, [{ key: 'getShaders', value: function getShaders() { return enable64bitSupport(this.props) ? { vs: _solidPolygonLayerVertex4.default, fs: _solidPolygonLayerFragment2.default, modules: ['project64', 'lighting', 'picking'] } : { vs: _solidPolygonLayerVertex2.default, fs: _solidPolygonLayerFragment2.default, modules: ['lighting', 'picking'] }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { var gl = this.context.gl; this.setState({ numInstances: 0, IndexType: gl.getExtension('OES_element_index_uint') ? Uint32Array : Uint16Array }); var attributeManager = this.getAttributeManager(); var noAlloc = true; /* eslint-disable max-len */ attributeManager.add({ indices: { size: 1, isIndexed: true, update: this.calculateIndices, noAlloc: noAlloc }, positions: { size: 3, accessor: 'getElevation', update: this.calculatePositions, noAlloc: noAlloc }, normals: { size: 3, update: this.calculateNormals, noAlloc: noAlloc }, colors: { size: 4, type: _luma.GL.UNSIGNED_BYTE, accessor: 'getColor', update: this.calculateColors, noAlloc: noAlloc }, pickingColors: { size: 3, type: _luma.GL.UNSIGNED_BYTE, update: this.calculatePickingColors, noAlloc: noAlloc } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.add({ positions64xyLow: { size: 2, update: this.calculatePositionsLow } }); } else { attributeManager.remove(['positions64xyLow']); } } } }, { key: 'draw', value: function draw(_ref2) { var uniforms = _ref2.uniforms; var _props = this.props, extruded = _props.extruded, lightSettings = _props.lightSettings, elevationScale = _props.elevationScale; this.state.model.render(Object.assign({}, uniforms, { extruded: extruded ? 1.0 : 0.0, elevationScale: elevationScale }, lightSettings)); } }, { key: 'updateState', value: function updateState(_ref3) { var props = _ref3.props, oldProps = _ref3.oldProps, changeFlags = _ref3.changeFlags; _get(SolidPolygonLayer.prototype.__proto__ || Object.getPrototypeOf(SolidPolygonLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); var regenerateModel = this.updateGeometry({ props: props, oldProps: oldProps, changeFlags: changeFlags }); if (regenerateModel) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); } /* eslint-disable complexity */ }, { key: 'updateGeometry', value: function updateGeometry(_ref4) { var _this2 = this; var props = _ref4.props, oldProps = _ref4.oldProps, changeFlags = _ref4.changeFlags; var geometryConfigChanged = props.extruded !== oldProps.extruded || props.wireframe !== oldProps.wireframe || props.fp64 !== oldProps.fp64 || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon); // check if updateTriggers.getElevation has been triggered var getElevationTriggered = changeFlags.updateTriggersChanged && (0, _props2.compareProps)({ oldProps: oldProps.updateTriggers.getElevation || {}, newProps: props.updateTriggers.getElevation || {}, triggerName: 'getElevation' }); // When the geometry config or the data is changed, // tessellator needs to be invoked if (changeFlags.dataChanged || geometryConfigChanged || getElevationTriggered) { var getPolygon = props.getPolygon, extruded = props.extruded, wireframe = props.wireframe, getElevation = props.getElevation; // TODO - avoid creating a temporary array here: let the tesselator iterate var polygons = props.data.map(getPolygon); this.setState({ polygonTesselator: !extruded ? new _polygonTesselator.PolygonTesselator({ polygons: polygons, fp64: this.props.fp64 }) : new _polygonTesselatorExtruded.PolygonTesselatorExtruded({ polygons: polygons, wireframe: wireframe, getHeight: function getHeight(polygonIndex) { return getElevation(_this2.props.data[polygonIndex]); }, fp64: this.props.fp64 }) }); this.state.attributeManager.invalidateAll(); } return geometryConfigChanged; } /* eslint-disable complexity */ }, { key: '_getModel', value: function _getModel(gl) { return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: new _luma.Geometry({ drawMode: this.props.wireframe ? _luma.GL.LINES : _luma.GL.TRIANGLES, attributes: {} }), vertexCount: 0, isIndexed: true, shaderCache: this.context.shaderCache })); } }, { key: 'calculateIndices', value: function calculateIndices(attribute) { attribute.value = this.state.polygonTesselator.indices(); attribute.target = _luma.GL.ELEMENT_ARRAY_BUFFER; this.state.model.setVertexCount(attribute.value.length / attribute.size); } }, { key: 'calculatePositions', value: function calculatePositions(attribute) { attribute.value = this.state.polygonTesselator.positions().positions; } }, { key: 'calculatePositionsLow', value: function calculatePositionsLow(attribute) { attribute.value = this.state.polygonTesselator.positions().positions64xyLow; } }, { key: 'calculateNormals', value: function calculateNormals(attribute) { attribute.value = this.state.polygonTesselator.normals(); } }, { key: 'calculateColors', value: function calculateColors(attribute) { var _this3 = this; attribute.value = this.state.polygonTesselator.colors({ getColor: function getColor(polygonIndex) { return _this3.props.getColor(_this3.props.data[polygonIndex]); } }); } // Override the default picking colors calculation }, { key: 'calculatePickingColors', value: function calculatePickingColors(attribute) { attribute.value = this.state.polygonTesselator.pickingColors(); } }]); return SolidPolygonLayer; }(_core.Layer); exports.default = SolidPolygonLayer; SolidPolygonLayer.layerName = 'SolidPolygonLayer'; SolidPolygonLayer.defaultProps = defaultProps; /***/ }), /* 178 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _viewportControls = __webpack_require__(121); var _viewportControls2 = _interopRequireDefault(_viewportControls); var _mapState = __webpack_require__(82); var _mapState2 = _interopRequireDefault(_mapState); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 Uber Technologies, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var MapControls = function (_ViewportControls) { _inherits(MapControls, _ViewportControls); /** * @classdesc * A class that handles events and updates mercator style viewport parameters */ function MapControls(options) { _classCallCheck(this, MapControls); return _possibleConstructorReturn(this, (MapControls.__proto__ || Object.getPrototypeOf(MapControls)).call(this, _mapState2.default, options)); } // Default handler for the `panmove` event. _createClass(MapControls, [{ key: '_onPan', value: function _onPan(event) { return this.isFunctionKeyPressed(event) ? this._onPanRotate(event) : this._onPanMove(event); } }]); return MapControls; }(_viewportControls2.default); exports.default = MapControls; /***/ }), /* 179 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _orbitViewport = __webpack_require__(85); var _orbitViewport2 = _interopRequireDefault(_orbitViewport); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var defaultState = { lookAt: [0, 0, 0], rotationX: 0, rotationOrbit: 0, fov: 50, near: 1, far: 100, translationX: 0, translationY: 0, zoom: 1 }; var defaultConstraints = { minZoom: 0, maxZoom: Infinity }; /* Helpers */ // Constrain number between bounds function clamp(x, min, max) { return x < min ? min : x > max ? max : x; } function ensureFinite(value, fallbackValue) { return Number.isFinite(value) ? value : fallbackValue; } var OrbitState = function () { function OrbitState(_ref) { var width = _ref.width, height = _ref.height, distance = _ref.distance, rotationX = _ref.rotationX, rotationOrbit = _ref.rotationOrbit, orbitAxis = _ref.orbitAxis, bounds = _ref.bounds, lookAt = _ref.lookAt, fov = _ref.fov, near = _ref.near, far = _ref.far, translationX = _ref.translationX, translationY = _ref.translationY, zoom = _ref.zoom, minZoom = _ref.minZoom, maxZoom = _ref.maxZoom, startPanViewport = _ref.startPanViewport, startPanPos = _ref.startPanPos, isPanning = _ref.isPanning, startRotateViewport = _ref.startRotateViewport, isRotating = _ref.isRotating, startZoomViewport = _ref.startZoomViewport, startZoomPos = _ref.startZoomPos; _classCallCheck(this, OrbitState); (0, _assert2.default)(Number.isFinite(width), '`width` must be supplied'); (0, _assert2.default)(Number.isFinite(height), '`height` must be supplied'); (0, _assert2.default)(Number.isFinite(distance), '`distance` must be supplied'); this._viewportProps = this._applyConstraints({ width: width, height: height, distance: distance, rotationX: ensureFinite(rotationX, defaultState.rotationX), rotationOrbit: ensureFinite(rotationOrbit, defaultState.rotationOrbit), orbitAxis: orbitAxis, bounds: bounds, lookAt: lookAt || defaultState.lookAt, fov: ensureFinite(fov, defaultState.fov), near: ensureFinite(near, defaultState.near), far: ensureFinite(far, defaultState.far), translationX: ensureFinite(translationX, defaultState.translationX), translationY: ensureFinite(translationY, defaultState.translationY), zoom: ensureFinite(zoom, defaultState.zoom), minZoom: ensureFinite(minZoom, defaultConstraints.minZoom), maxZoom: ensureFinite(maxZoom, defaultConstraints.maxZoom) }); this._interactiveState = { startPanViewport: startPanViewport, startPanPos: startPanPos, isPanning: isPanning, startRotateViewport: startRotateViewport, isRotating: isRotating, startZoomViewport: startZoomViewport, startZoomPos: startZoomPos }; } /* Public API */ _createClass(OrbitState, [{ key: 'getViewportProps', value: function getViewportProps() { return this._viewportProps; } }, { key: 'getInteractiveState', value: function getInteractiveState() { return this._interactiveState; } /** * Start panning * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'panStart', value: function panStart(_ref2) { var pos = _ref2.pos; var viewport = new _orbitViewport2.default(this._viewportProps); return this._getUpdatedOrbitState({ startPanPos: pos, startPanViewport: viewport }); } /** * Pan * @param {[Number, Number]} pos - position on screen where the pointer is */ }, { key: 'pan', value: function pan(_ref3) { var pos = _ref3.pos, startPos = _ref3.startPos; if (this._interactiveState.isRotating) { return this._getUpdatedOrbitState(); } var startPanPos = this._interactiveState.startPanPos || startPos; (0, _assert2.default)(startPanPos, '`startPanPos` props is required'); var viewport = this._interactiveState.startPanViewport || new _orbitViewport2.default(this._viewportProps); var deltaX = pos[0] - startPanPos[0]; var deltaY = pos[1] - startPanPos[1]; var center = viewport.project(viewport.lookAt); var newLookAt = viewport.unproject([center[0] - deltaX, center[1] - deltaY, center[2]]); return this._getUpdatedOrbitState({ lookAt: newLookAt, isPanning: true }); } /** * End panning * Must call if `panStart()` was called */ }, { key: 'panEnd', value: function panEnd() { return this._getUpdatedOrbitState({ startPanViewport: null, startPanPos: null, isPanning: null }); } /** * Start rotating * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'rotateStart', value: function rotateStart(_ref4) { var pos = _ref4.pos; // Rotation center should be the worldspace position at the center of the // the screen. If not found, use the last one. var viewport = new _orbitViewport2.default(this._viewportProps); return this._getUpdatedOrbitState({ startRotateViewport: viewport }); } /** * Rotate * @param {[Number, Number]} pos - position on screen where the pointer is */ }, { key: 'rotate', value: function rotate(_ref5) { var deltaScaleX = _ref5.deltaScaleX, deltaScaleY = _ref5.deltaScaleY; if (this._interactiveState.isPanning) { return this._getUpdatedOrbitState(); } var startRotateViewport = this._interactiveState.startRotateViewport; var _ref6 = startRotateViewport || {}, rotationX = _ref6.rotationX, rotationOrbit = _ref6.rotationOrbit; rotationX = ensureFinite(rotationX, this._viewportProps.rotationX); rotationOrbit = ensureFinite(rotationOrbit, this._viewportProps.rotationOrbit); var newRotationX = clamp(rotationX - deltaScaleY * 180, -89.999, 89.999); var newRotationOrbit = (rotationOrbit - deltaScaleX * 180) % 360; return this._getUpdatedOrbitState({ rotationX: newRotationX, rotationOrbit: newRotationOrbit, isRotating: true }); } /** * End rotating * Must call if `rotateStart()` was called */ }, { key: 'rotateEnd', value: function rotateEnd() { return this._getUpdatedOrbitState({ startRotateViewport: null, isRotating: null }); } /** * Start zooming * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'zoomStart', value: function zoomStart(_ref7) { var pos = _ref7.pos; var viewport = new _orbitViewport2.default(this._viewportProps); return this._getUpdatedOrbitState({ startZoomViewport: viewport, startZoomPos: pos }); } /** * Zoom * @param {[Number, Number]} pos - position on screen where the current center is * @param {[Number, Number]} startPos - the center position at * the start of the operation. Must be supplied of `zoomStart()` was not called * @param {Number} scale - a number between [0, 1] specifying the accumulated * relative scale. */ }, { key: 'zoom', value: function zoom(_ref8) { var pos = _ref8.pos, startPos = _ref8.startPos, scale = _ref8.scale; var _viewportProps = this._viewportProps, zoom = _viewportProps.zoom, minZoom = _viewportProps.minZoom, maxZoom = _viewportProps.maxZoom, width = _viewportProps.width, height = _viewportProps.height; var startZoomPos = this._interactiveState.startZoomPos || startPos || pos; var viewport = this._interactiveState.startZoomViewport || new _orbitViewport2.default(this._viewportProps); var newZoom = clamp(zoom * scale, minZoom, maxZoom); var deltaX = pos[0] - startZoomPos[0]; var deltaY = pos[1] - startZoomPos[1]; // Zoom around the center position var cx = startZoomPos[0] - width / 2; var cy = height / 2 - startZoomPos[1]; var center = viewport.project(viewport.lookAt); var newCenterX = center[0] - cx + cx * newZoom / zoom + deltaX; var newCenterY = center[1] + cy - cy * newZoom / zoom - deltaY; var newLookAt = viewport.unproject([newCenterX, newCenterY, center[2]]); return this._getUpdatedOrbitState({ lookAt: newLookAt, zoom: newZoom }); } /** * End zooming * Must call if `zoomStart()` was called */ }, { key: 'zoomEnd', value: function zoomEnd() { return this._getUpdatedOrbitState({ startZoomPos: null }); } /* Private methods */ }, { key: '_getUpdatedOrbitState', value: function _getUpdatedOrbitState(newProps) { // Update _viewportProps return new OrbitState(Object.assign({}, this._viewportProps, this._interactiveState, newProps)); } // Apply any constraints (mathematical or defined by _viewportProps) to map state }, { key: '_applyConstraints', value: function _applyConstraints(props) { // Ensure zoom is within specified range var maxZoom = props.maxZoom, minZoom = props.minZoom, zoom = props.zoom; props.zoom = zoom > maxZoom ? maxZoom : zoom; props.zoom = zoom < minZoom ? minZoom : zoom; return props; } }]); return OrbitState; }(); exports.default = OrbitState; /***/ }), /* 180 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _math = __webpack_require__(16); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var SphericalCoordinates = _math.experimental.SphericalCoordinates; var defaultState = { position: [0, 0, 0], lookAt: [0, 0, 0], up: [0, 0, 1], rotationX: 0, rotationY: 0, fov: 50, near: 1, far: 100 }; /* Helpers */ var ViewState = function () { function ViewState(opts) { _classCallCheck(this, ViewState); var width = opts.width, height = opts.height, _opts$position = opts.position, position = _opts$position === undefined ? defaultState.position : _opts$position; (0, _assert2.default)(Number.isFinite(width), '`width` must be supplied'); (0, _assert2.default)(Number.isFinite(height), '`height` must be supplied'); this._viewportProps = this._applyConstraints(Object.assign({}, opts, { position: new _math.Vector3(position) })); } _createClass(ViewState, [{ key: 'getViewportProps', value: function getViewportProps() { return this._viewportProps; } }, { key: 'getDirection', value: function getDirection() { var spherical = new SphericalCoordinates({ bearing: this._viewportProps.bearing, pitch: this._viewportProps.pitch }); var direction = spherical.toVector3().normalize(); return direction; } }, { key: 'getDirectionFromBearing', value: function getDirectionFromBearing(bearing) { var spherical = new SphericalCoordinates({ bearing: bearing, pitch: 90 }); var direction = spherical.toVector3().normalize(); return direction; } // Redefined by subclass // Apply any constraints (mathematical or defined by _viewportProps) to map state }, { key: '_applyConstraints', value: function _applyConstraints(props) { return props; } }]); return ViewState; }(); exports.default = ViewState; /***/ }), /* 181 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* eslint-disable no-try-catch */ var EffectManager = function () { function EffectManager(_ref) { var gl = _ref.gl, layerManager = _ref.layerManager; _classCallCheck(this, EffectManager); this.gl = gl; this.layerManager = layerManager; this._effects = []; } /** * Adds an effect to be managed. That effect's initialize function will * be called, and the effect's preDraw and draw callbacks will be * called at the appropriate times in the render loop * @param {Effect} effect - the effect to be added */ _createClass(EffectManager, [{ key: "addEffect", value: function addEffect(effect) { this._effects.push(effect); this._sortEffects(); effect.initialize({ gl: this.gl, layerManager: this.layerManager }); } /** * Removes an effect that is already being managed. That effect's * finalize function will be called, and its callbacks will no longer * be envoked in the render loop * @param {Effect} effect - the effect to be removed * @return {bool} - True if the effect was already being managed, and * thus successfully removed; false otherwise */ }, { key: "removeEffect", value: function removeEffect(effect) { var i = this._effects.indexOf(effect); if (i >= 0) { effect.finalize({ gl: this.gl, layerManager: this.layerManager }); this._effects.splice(i, 1); return true; } return false; } /** * Envoke the preDraw callback of all managed events, in order of * decreasing priority */ }, { key: "preDraw", value: function preDraw() { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = this._effects[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var effect = _step.value; if (effect.needsRedraw) { effect.preDraw({ gl: this.gl, layerManager: this.layerManager }); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } /** * Envoke the draw callback of all managed events, in order of * decreasing priority */ }, { key: "draw", value: function draw() { var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this._effects[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var effect = _step2.value; if (effect.needsRedraw) { effect.draw({ gl: this.gl, layerManager: this.layerManager }); } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: "_sortEffects", value: function _sortEffects() { this._effects.sort(function (a, b) { if (a.priority > b.priority) { return -1; } else if (a.priority < b.priority) { return 1; } return a.count - b.count; }); } }]); return EffectManager; }(); exports.default = EffectManager; /***/ }), /* 182 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* eslint-disable guard-for-in */ exports.glArrayFromType = glArrayFromType; var _stats = __webpack_require__(185); var _stats2 = _interopRequireDefault(_stats); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _luma = __webpack_require__(12); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); var _attributeTransitionManager = __webpack_require__(335); var _attributeTransitionManager2 = _interopRequireDefault(_attributeTransitionManager); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var LOG_START_END_PRIORITY = 1; var LOG_DETAIL_PRIORITY = 2; function noop() {} /* eslint-disable complexity */ function glArrayFromType(glType) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$clamped = _ref.clamped, clamped = _ref$clamped === undefined ? true : _ref$clamped; // Sorted in some order of likelihood to reduce amount of comparisons switch (glType) { case _luma.GL.FLOAT: return Float32Array; case _luma.GL.UNSIGNED_SHORT: case _luma.GL.UNSIGNED_SHORT_5_6_5: case _luma.GL.UNSIGNED_SHORT_4_4_4_4: case _luma.GL.UNSIGNED_SHORT_5_5_5_1: return Uint16Array; case _luma.GL.UNSIGNED_INT: return Uint32Array; case _luma.GL.UNSIGNED_BYTE: return clamped ? Uint8ClampedArray : Uint8Array; case _luma.GL.BYTE: return Int8Array; case _luma.GL.SHORT: return Int16Array; case _luma.GL.INT: return Int32Array; default: throw new Error('Failed to deduce type from array'); } } /* eslint-enable complexity */ // Default loggers var logFunctions = { savedMessages: null, timeStart: null, onLog: function onLog(_ref2) { var level = _ref2.level, message = _ref2.message; _log2.default.log(level, message); }, onUpdateStart: function onUpdateStart(_ref3) { var level = _ref3.level, id = _ref3.id, numInstances = _ref3.numInstances; logFunctions.savedMessages = []; logFunctions.timeStart = new Date(); }, onUpdate: function onUpdate(_ref4) { var level = _ref4.level, message = _ref4.message; if (logFunctions.savedMessages) { logFunctions.savedMessages.push(message); } }, onUpdateEnd: function onUpdateEnd(_ref5) { var level = _ref5.level, id = _ref5.id, numInstances = _ref5.numInstances; var timeMs = Math.round(new Date() - logFunctions.timeStart); var time = timeMs + 'ms'; _log2.default.group(level, 'Updated attributes for ' + numInstances + ' instances in ' + id + ' in ' + time, { collapsed: true }); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = logFunctions.savedMessages[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var message = _step.value; _log2.default.log(level, message); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } _log2.default.groupEnd(level, 'Updated attributes for ' + numInstances + ' instances in ' + id + ' in ' + time); logFunctions.savedMessages = null; } }; var AttributeManager = function () { _createClass(AttributeManager, null, [{ key: 'setDefaultLogFunctions', /** * Sets log functions to help trace or time attribute updates. * Default logging uses deck logger. * * `onLog` is called for each attribute. * * To enable detailed control of timming and e.g. hierarchical logging, * hooks are also provided for update start and end. * * @param {Object} [opts] * @param {String} [opts.onLog=] - called to print * @param {String} [opts.onUpdateStart=] - called before update() starts * @param {String} [opts.onUpdateEnd=] - called after update() ends */ value: function setDefaultLogFunctions() { var _ref6 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, onLog = _ref6.onLog, onUpdateStart = _ref6.onUpdateStart, onUpdate = _ref6.onUpdate, onUpdateEnd = _ref6.onUpdateEnd; if (onLog !== undefined) { logFunctions.onLog = onLog || noop; } if (onUpdateStart !== undefined) { logFunctions.onUpdateStart = onUpdateStart || noop; } if (onUpdate !== undefined) { logFunctions.onUpdate = onUpdate || noop; } if (onUpdateEnd !== undefined) { logFunctions.onUpdateEnd = onUpdateEnd || noop; } } /** * @classdesc * Automated attribute generation and management. Suitable when a set of * vertex shader attributes are generated by iteration over a data array, * and updates to these attributes are needed either when the data itself * changes, or when other data relevant to the calculations change. * * - First the application registers descriptions of its dynamic vertex * attributes using AttributeManager.add(). * - Then, when any change that affects attributes is detected by the * application, the app will call AttributeManager.invalidate(). * - Finally before it renders, it calls AttributeManager.update() to * ensure that attributes are automatically rebuilt if anything has been * invalidated. * * The application provided update functions describe how attributes * should be updated from a data array and are expected to traverse * that data array (or iterable) and fill in the attribute's typed array. * * Note that the attribute manager intentionally does not do advanced * change detection, but instead makes it easy to build such detection * by offering the ability to "invalidate" each attribute separately. * * Summary: * - keeps track of valid state for each attribute * - auto reallocates attributes when needed * - auto updates attributes with registered updater functions * - allows overriding with application supplied buffers * * Limitations: * - There are currently no provisions for only invalidating a range of * indices in an attribute. * * @class * @param {Object} [props] * @param {String} [props.id] - identifier (for debugging) */ }]); function AttributeManager(gl) { var _ref7 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref7$id = _ref7.id, id = _ref7$id === undefined ? 'attribute-manager' : _ref7$id; _classCallCheck(this, AttributeManager); this.id = id; this.gl = gl; this.attributes = {}; this.updateTriggers = {}; this.accessors = {}; this.allocedInstances = -1; this.needsRedraw = true; this.userData = {}; this.stats = new _stats2.default({ id: 'attr' }); this.attributeTransitionManger = new _attributeTransitionManager2.default(gl, { id: id + '-transitions' }); // For debugging sanity, prevent uninitialized members Object.seal(this); } /** * Adds attributes * Takes a map of attribute descriptor objects * - keys are attribute names * - values are objects with attribute fields * * attribute.size - number of elements per object * attribute.updater - number of elements * attribute.instanced=0 - is this is an instanced attribute (a.k.a. divisor) * attribute.noAlloc=false - if this attribute should not be allocated * * @example * attributeManager.add({ * positions: {size: 2, update: calculatePositions} * colors: {size: 3, update: calculateColors} * }); * * @param {Object} attributes - attribute map (see above) * @param {Object} updaters - separate map of update functions (deprecated) */ _createClass(AttributeManager, [{ key: 'add', value: function add(attributes) { var updaters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._add(attributes, updaters); } /** * Removes attributes * Takes an array of attribute names and delete them from * the attribute map if they exists * * @example * attributeManager.remove(['position']); * * @param {Object} attributeNameArray - attribute name array (see above) */ }, { key: 'remove', value: function remove(attributeNameArray) { for (var i = 0; i < attributeNameArray.length; i++) { var name = attributeNameArray[i]; if (this.attributes[name] !== undefined) { delete this.attributes[name]; } } } /* Marks an attribute for update * @param {string} triggerName: attribute or accessor name */ }, { key: 'invalidate', value: function invalidate(triggerName) { var invalidatedAttributes = this._invalidateTrigger(triggerName); // For performance tuning logFunctions.onLog({ level: LOG_DETAIL_PRIORITY, message: 'invalidated attributes ' + invalidatedAttributes + ' (' + triggerName + ') for ' + this.id, id: this.identifier }); } }, { key: 'invalidateAll', value: function invalidateAll() { for (var attributeName in this.attributes) { this.attributes[attributeName].needsUpdate = true; } // For performance tuning logFunctions.onLog({ level: LOG_DETAIL_PRIORITY, message: 'invalidated all attributes for ' + this.id, id: this.identifier }); } }, { key: '_invalidateTrigger', value: function _invalidateTrigger(triggerName) { var attributes = this.attributes, updateTriggers = this.updateTriggers; var invalidatedAttributes = updateTriggers[triggerName]; if (!invalidatedAttributes) { var message = 'invalidating non-existent trigger ' + triggerName + ' for ' + this.id + '\n'; message += 'Valid triggers: ' + Object.keys(attributes).join(', '); _log2.default.warn(message, invalidatedAttributes); } else { invalidatedAttributes.forEach(function (name) { var attribute = attributes[name]; if (attribute) { attribute.needsUpdate = true; } }); } return invalidatedAttributes; } /** * Ensure all attribute buffers are updated from props or data. * * Note: Any preallocated buffers in "buffers" matching registered attribute * names will be used. No update will happen in this case. * Note: Calls onUpdateStart and onUpdateEnd log callbacks before and after. * * @param {Object} opts - options * @param {Object} opts.data - data (iterable object) * @param {Object} opts.numInstances - count of data * @param {Object} opts.buffers = {} - pre-allocated buffers * @param {Object} opts.props - passed to updaters * @param {Object} opts.context - Used as "this" context for updaters */ }, { key: 'update', value: function update() { var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, data = _ref8.data, numInstances = _ref8.numInstances, transitions = _ref8.transitions, _ref8$props = _ref8.props, props = _ref8$props === undefined ? {} : _ref8$props, _ref8$buffers = _ref8.buffers, buffers = _ref8$buffers === undefined ? {} : _ref8$buffers, _ref8$context = _ref8.context, context = _ref8$context === undefined ? {} : _ref8$context, _ref8$ignoreUnknownAt = _ref8.ignoreUnknownAttributes, ignoreUnknownAttributes = _ref8$ignoreUnknownAt === undefined ? false : _ref8$ignoreUnknownAt; // First apply any application provided buffers this._checkExternalBuffers({ buffers: buffers, ignoreUnknownAttributes: ignoreUnknownAttributes }); this._setExternalBuffers(buffers); // Only initiate alloc/update (and logging) if actually needed if (this._analyzeBuffers({ numInstances: numInstances })) { logFunctions.onUpdateStart({ level: LOG_START_END_PRIORITY, id: this.id, numInstances: numInstances }); this.stats.timeStart(); this._updateBuffers({ numInstances: numInstances, data: data, props: props, context: context }); this.stats.timeEnd(); logFunctions.onUpdateEnd({ level: LOG_START_END_PRIORITY, id: this.id, numInstances: numInstances }); } this.attributeTransitionManger.update(this.attributes, transitions); } /** * Returns all attribute descriptors * Note: Format matches luma.gl Model/Program.setAttributes() * @return {Object} attributes - descriptors */ }, { key: 'getAttributes', value: function getAttributes() { return this.attributes; } /** * Returns changed attribute descriptors * This indicates which WebGLBuggers need to be updated * @return {Object} attributes - descriptors */ }, { key: 'getChangedAttributes', value: function getChangedAttributes(_ref9) { var _ref9$transition = _ref9.transition, transition = _ref9$transition === undefined ? false : _ref9$transition, _ref9$clearChangedFla = _ref9.clearChangedFlags, clearChangedFlags = _ref9$clearChangedFla === undefined ? false : _ref9$clearChangedFla; var attributes = this.attributes, attributeTransitionManger = this.attributeTransitionManger; if (transition) { return attributeTransitionManger.getAttributes(); } var changedAttributes = {}; for (var attributeName in attributes) { var attribute = attributes[attributeName]; if (attribute.changed) { attribute.changed = attribute.changed && !clearChangedFlags; // Only return non-transition attributes if (!attributeTransitionManger.hasAttribute(attributeName)) { changedAttributes[attributeName] = attribute; } } } return changedAttributes; } /** * Returns the redraw flag, optionally clearing it. * Redraw flag will be set if any attributes attributes changed since * flag was last cleared. * * @param {Object} [opts] * @param {String} [opts.clearRedrawFlags=false] - whether to clear the flag * @return {false|String} - reason a redraw is needed. */ }, { key: 'getNeedsRedraw', value: function getNeedsRedraw() { var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref10$clearRedrawFla = _ref10.clearRedrawFlags, clearRedrawFlags = _ref10$clearRedrawFla === undefined ? false : _ref10$clearRedrawFla; var redraw = this.needsRedraw; this.needsRedraw = this.needsRedraw && !clearRedrawFlags; return redraw && this.id; } /** * Sets the redraw flag. * @param {Boolean} redraw=true * @return {AttributeManager} - for chaining */ }, { key: 'setNeedsRedraw', value: function setNeedsRedraw() { var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.needsRedraw = true; return this; } // DEPRECATED METHODS /** * Adds attributes * @param {Object} attributes - attribute map (see above) * @param {Object} updaters - separate map of update functions (deprecated) */ }, { key: 'addInstanced', value: function addInstanced(attributes) { var updaters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this._add(attributes, updaters, { instanced: 1 }); } // PROTECTED METHODS - Only to be used by collaborating classes, not by apps /** * Returns object containing all accessors as keys, with non-null values * @return {Object} - accessors object */ }, { key: 'getAccessors', value: function getAccessors() { return this.updateTriggers; } // PRIVATE METHODS // Used to register an attribute }, { key: '_add', value: function _add(attributes) { var updaters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var _extraProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var newAttributes = {}; for (var attributeName in attributes) { // support for separate update function map // For now, just copy any attributes from that map into the main map // TODO - Attribute maps are a deprecated feature, remove if (attributeName in updaters) { attributes[attributeName] = Object.assign({}, attributes[attributeName], updaters[attributeName]); } var attribute = attributes[attributeName]; var isGeneric = attribute.isGeneric || false; var isIndexed = attribute.isIndexed || attribute.elements; var size = attribute.elements && 1 || attribute.size; var value = attribute.value || null; // Initialize the attribute descriptor, with WebGL and metadata fields var attributeData = Object.assign({ // Ensure that fields are present before Object.seal() target: undefined, userData: {} // Reserved for application }, // Metadata attribute, { // State isExternalBuffer: false, needsAlloc: false, needsUpdate: false, changed: false, // Luma fields isGeneric: isGeneric, isIndexed: isIndexed, size: size, value: value }, _extraProps); // Sanity - no app fields on our attributes. Use userData instead. Object.seal(attributeData); // Check all fields and generate helpful error messages this._validateAttributeDefinition(attributeName, attributeData); // Add to both attributes list (for registration with model) newAttributes[attributeName] = attributeData; } Object.assign(this.attributes, newAttributes); this._mapUpdateTriggersToAttributes(); } // build updateTrigger name to attribute name mapping }, { key: '_mapUpdateTriggersToAttributes', value: function _mapUpdateTriggersToAttributes() { var _this = this; var triggers = {}; var _loop = function _loop(attributeName) { var attribute = _this.attributes[attributeName]; var accessor = attribute.accessor; // Backards compatibility: allow attribute name to be used as update trigger key triggers[attributeName] = [attributeName]; // use accessor name as update trigger key if (typeof accessor === 'string') { accessor = [accessor]; } if (Array.isArray(accessor)) { accessor.forEach(function (accessorName) { if (!triggers[accessorName]) { triggers[accessorName] = []; } triggers[accessorName].push(attributeName); }); } }; for (var attributeName in this.attributes) { _loop(attributeName); } this.updateTriggers = triggers; } }, { key: '_validateAttributeDefinition', value: function _validateAttributeDefinition(attributeName, attribute) { (0, _assert2.default)(attribute.size >= 1 && attribute.size <= 4, 'Attribute definition for ' + attributeName + ' invalid size'); // Check that either 'accessor' or 'update' is a valid function var hasUpdater = attribute.noAlloc || typeof attribute.update === 'function' || typeof attribute.accessor === 'string'; if (!hasUpdater) { throw new Error('Attribute ' + attributeName + ' missing update or accessor'); } } // Checks that any attribute buffers in props are valid // Note: This is just to help app catch mistakes }, { key: '_checkExternalBuffers', value: function _checkExternalBuffers() { var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref11$buffers = _ref11.buffers, buffers = _ref11$buffers === undefined ? {} : _ref11$buffers, _ref11$ignoreUnknownA = _ref11.ignoreUnknownAttributes, ignoreUnknownAttributes = _ref11$ignoreUnknownA === undefined ? false : _ref11$ignoreUnknownA; var attributes = this.attributes; for (var attributeName in buffers) { var attribute = attributes[attributeName]; if (!attribute && !ignoreUnknownAttributes) { throw new Error('Unknown attribute prop ' + attributeName); } // const buffer = buffers[attributeName]; // TODO - check buffer type } } // Set the buffers for the supplied attributes // Update attribute buffers from any attributes in props // Detach any previously set buffers, marking all // Attributes for auto allocation /* eslint-disable max-statements */ }, { key: '_setExternalBuffers', value: function _setExternalBuffers(bufferMap) { var attributes = this.attributes, numInstances = this.numInstances; // Copy the refs of any supplied buffers in the props for (var attributeName in attributes) { var attribute = attributes[attributeName]; var buffer = bufferMap[attributeName]; attribute.isExternalBuffer = false; if (buffer) { var ArrayType = glArrayFromType(attribute.type || _luma.GL.FLOAT); if (!(buffer instanceof ArrayType)) { throw new Error('Attribute ' + attributeName + ' must be of type ' + ArrayType.name); } if (attribute.auto && buffer.length <= numInstances * attribute.size) { throw new Error('Attribute prop array must match length and size'); } attribute.isExternalBuffer = true; attribute.needsUpdate = false; if (attribute.value !== buffer) { attribute.value = buffer; attribute.changed = true; this.needsRedraw = true; } } } } /* eslint-enable max-statements */ /* Checks that typed arrays for attributes are big enough * sets alloc flag if not * @return {Boolean} whether any updates are needed */ }, { key: '_analyzeBuffers', value: function _analyzeBuffers(_ref12) { var numInstances = _ref12.numInstances; var attributes = this.attributes; (0, _assert2.default)(numInstances !== undefined, 'numInstances not defined'); // Track whether any allocations or updates are needed var needsUpdate = false; for (var attributeName in attributes) { var attribute = attributes[attributeName]; if (!attribute.isExternalBuffer) { // Do we need to reallocate the attribute's typed array? var needsAlloc = attribute.value === null || attribute.value.length / attribute.size < numInstances; if (needsAlloc && (attribute.update || attribute.accessor)) { attribute.needsAlloc = true; needsUpdate = true; } if (attribute.needsUpdate) { needsUpdate = true; } } } return needsUpdate; } /** * @private * Calls update on any buffers that need update * TODO? - If app supplied all attributes, no need to iterate over data * * @param {Object} opts - options * @param {Object} opts.data - data (iterable object) * @param {Object} opts.numInstances - count of data * @param {Object} opts.buffers = {} - pre-allocated buffers * @param {Object} opts.props - passed to updaters * @param {Object} opts.context - Used as "this" context for updaters */ /* eslint-disable max-statements, complexity */ }, { key: '_updateBuffers', value: function _updateBuffers(_ref13) { var numInstances = _ref13.numInstances, data = _ref13.data, props = _ref13.props, context = _ref13.context; var attributes = this.attributes; // Allocate at least one element to ensure a valid buffer var allocCount = Math.max(numInstances, 1); for (var attributeName in attributes) { var attribute = attributes[attributeName]; // Allocate a new typed array if needed if (attribute.needsAlloc) { var ArrayType = glArrayFromType(attribute.type || _luma.GL.FLOAT); attribute.value = new ArrayType(attribute.size * allocCount); logFunctions.onUpdate({ level: LOG_DETAIL_PRIORITY, message: attributeName + ' allocated ' + allocCount, id: this.id }); attribute.needsAlloc = false; attribute.needsUpdate = true; } } for (var _attributeName in attributes) { var _attribute = attributes[_attributeName]; // Call updater function if needed if (_attribute.needsUpdate) { this._updateBuffer({ attribute: _attribute, attributeName: _attributeName, numInstances: numInstances, data: data, props: props, context: context }); } } this.allocedInstances = allocCount; } }, { key: '_updateBuffer', value: function _updateBuffer(_ref14) { var attribute = _ref14.attribute, attributeName = _ref14.attributeName, numInstances = _ref14.numInstances, data = _ref14.data, props = _ref14.props, context = _ref14.context; var update = attribute.update, accessor = attribute.accessor; var timeStart = new Date(); if (update) { // Custom updater - typically for non-instanced layers update.call(context, attribute, { data: data, props: props, numInstances: numInstances }); this._checkAttributeArray(attribute, attributeName); } else if (accessor) { // Standard updater this._updateBufferViaStandardAccessor({ attribute: attribute, data: data, props: props }); this._checkAttributeArray(attribute, attributeName); } else { logFunctions.onUpdate({ level: LOG_DETAIL_PRIORITY, message: attributeName + ' missing update function', id: this.id }); } var timeMs = Math.round(new Date() - timeStart); var time = timeMs + 'ms'; logFunctions.onUpdate({ level: LOG_DETAIL_PRIORITY, message: attributeName + ' updated ' + numInstances + ' ' + time, id: this.id }); attribute.needsUpdate = false; attribute.changed = true; this.needsRedraw = true; } /* eslint-enable max-statements */ }, { key: '_updateBufferViaStandardAccessor', value: function _updateBufferViaStandardAccessor(_ref15) { var attribute = _ref15.attribute, data = _ref15.data, props = _ref15.props; var accessor = attribute.accessor, value = attribute.value, size = attribute.size; var accessorFunc = props[accessor]; (0, _assert2.default)(typeof accessorFunc === 'function', 'accessor "' + accessor + '" is not a function'); var _attribute$defaultVal = attribute.defaultValue, defaultValue = _attribute$defaultVal === undefined ? [0, 0, 0, 0] : _attribute$defaultVal; defaultValue = Array.isArray(defaultValue) ? defaultValue : [defaultValue]; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var object = _step2.value; var objectValue = accessorFunc(object); objectValue = Array.isArray(objectValue) ? objectValue : [objectValue]; /* eslint-disable no-fallthrough, default-case */ switch (size) { case 4: value[i + 3] = Number.isFinite(objectValue[3]) ? objectValue[3] : defaultValue[3]; case 3: value[i + 2] = Number.isFinite(objectValue[2]) ? objectValue[2] : defaultValue[2]; case 2: value[i + 1] = Number.isFinite(objectValue[1]) ? objectValue[1] : defaultValue[1]; case 1: value[i + 0] = Number.isFinite(objectValue[0]) ? objectValue[0] : defaultValue[0]; } i += size; } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: '_checkAttributeArray', value: function _checkAttributeArray(attribute, attributeName) { var value = attribute.value; if (value && value.length >= 4) { var valid = Number.isFinite(value[0]) && Number.isFinite(value[1]) && Number.isFinite(value[2]) && Number.isFinite(value[3]); if (!valid) { throw new Error('Illegal attribute generated for ' + attributeName); } } } /** * Update attribute transition to the current timestamp * Returns `true` if any transition is in progress */ }, { key: 'updateTransition', value: function updateTransition() { var attributeTransitionManger = this.attributeTransitionManger; var transitionUpdated = attributeTransitionManger.setCurrentTime(Date.now()); this.needsRedraw = this.needsRedraw || transitionUpdated; return transitionUpdated; } }]); return AttributeManager; }(); exports.default = AttributeManager; /***/ }), /* 183 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPixelRatio = undefined; exports.drawLayers = drawLayers; exports.drawPickingBuffer = drawPickingBuffer; var _luma = __webpack_require__(12); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var LOG_PRIORITY_DRAW = 2; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* global window */ var renderCount = 0; // TODO - Exported for pick-layers.js - Move to util? var getPixelRatio = exports.getPixelRatio = function getPixelRatio(_ref) { var useDevicePixels = _ref.useDevicePixels; (0, _assert2.default)(typeof useDevicePixels === 'boolean', 'Invalid useDevicePixels'); return useDevicePixels && typeof window !== 'undefined' ? window.devicePixelRatio : 1; }; // Convert viewport top-left CSS coordinates to bottom up WebGL coordinates var getGLViewport = function getGLViewport(gl, _ref2) { var viewport = _ref2.viewport, pixelRatio = _ref2.pixelRatio; // TODO - dummy default for node var height = gl.canvas ? gl.canvas.clientHeight : 100; // Convert viewport top-left CSS coordinates to bottom up WebGL coordinates var dimensions = viewport; return [dimensions.x * pixelRatio, (height - dimensions.y - dimensions.height) * pixelRatio, dimensions.width * pixelRatio, dimensions.height * pixelRatio]; }; // Helper functions function clearCanvas(gl, _ref3) { var useDevicePixels = _ref3.useDevicePixels; // const pixelRatio = getPixelRatio({useDevicePixels}); var width = gl.drawingBufferWidth; var height = gl.drawingBufferHeight; // clear depth and color buffers, restoring transparency (0, _luma.withParameters)(gl, { viewport: [0, 0, width, height] }, function () { gl.clear(_luma.GL.COLOR_BUFFER_BIT | _luma.GL.DEPTH_BUFFER_BIT); }); } // Draw a list of layers in a list of viewports function drawLayers(gl, _ref4) { var layers = _ref4.layers, viewports = _ref4.viewports, onViewportActive = _ref4.onViewportActive, useDevicePixels = _ref4.useDevicePixels, _ref4$drawPickingColo = _ref4.drawPickingColors, drawPickingColors = _ref4$drawPickingColo === undefined ? false : _ref4$drawPickingColo, _ref4$deviceRect = _ref4.deviceRect, deviceRect = _ref4$deviceRect === undefined ? null : _ref4$deviceRect, _ref4$parameters = _ref4.parameters, parameters = _ref4$parameters === undefined ? {} : _ref4$parameters, _ref4$layerFilter = _ref4.layerFilter, layerFilter = _ref4$layerFilter === undefined ? null : _ref4$layerFilter, _ref4$pass = _ref4.pass, pass = _ref4$pass === undefined ? 'draw' : _ref4$pass, _ref4$redrawReason = _ref4.redrawReason, redrawReason = _ref4$redrawReason === undefined ? '' : _ref4$redrawReason; clearCanvas(gl, { useDevicePixels: useDevicePixels }); // effectManager.preDraw(); viewports.forEach(function (viewportOrDescriptor, i) { var viewport = getViewportFromDescriptor(viewportOrDescriptor); // Update context to point to this viewport onViewportActive(viewport); // render this viewport drawLayersInViewport(gl, { layers: layers, viewport: viewport, useDevicePixels: useDevicePixels, drawPickingColors: drawPickingColors, deviceRect: deviceRect, parameters: parameters, layerFilter: layerFilter, pass: pass, redrawReason: redrawReason }); }); // effectManager.draw(); } // Draws list of layers and viewports into the picking buffer // Note: does not sample the buffer, that has to be done by the caller function drawPickingBuffer(gl, _ref5) { var layers = _ref5.layers, viewports = _ref5.viewports, onViewportActive = _ref5.onViewportActive, useDevicePixels = _ref5.useDevicePixels, pickingFBO = _ref5.pickingFBO, _ref5$deviceRect = _ref5.deviceRect, x = _ref5$deviceRect.x, y = _ref5$deviceRect.y, width = _ref5$deviceRect.width, height = _ref5$deviceRect.height, _ref5$layerFilter = _ref5.layerFilter, layerFilter = _ref5$layerFilter === undefined ? null : _ref5$layerFilter, _ref5$redrawReason = _ref5.redrawReason, redrawReason = _ref5$redrawReason === undefined ? '' : _ref5$redrawReason; // Make sure we clear scissor test and fbo bindings in case of exceptions // We are only interested in one pixel, no need to render anything else // Note that the callback here is called synchronously. // Set blend mode for picking // always overwrite existing pixel with [r,g,b,layerIndex] return (0, _luma.withParameters)(gl, { framebuffer: pickingFBO, scissorTest: true, scissor: [x, y, width, height], clearColor: [0, 0, 0, 0] }, function () { drawLayers(gl, { layers: layers, viewports: viewports, onViewportActive: onViewportActive, useDevicePixels: useDevicePixels, drawPickingColors: true, layerFilter: layerFilter, pass: 'picking', redrawReason: redrawReason, parameters: { blend: true, blendFunc: [gl.ONE, gl.ZERO, gl.CONSTANT_ALPHA, gl.ZERO], blendEquation: gl.FUNC_ADD, blendColor: [0, 0, 0, 0] } }); }); } // Draws a list of layers in one viewport // TODO - when picking we could completely skip rendering viewports that dont // intersect with the picking rect function drawLayersInViewport(gl, _ref6) { var layers = _ref6.layers, viewport = _ref6.viewport, useDevicePixels = _ref6.useDevicePixels, _ref6$drawPickingColo = _ref6.drawPickingColors, drawPickingColors = _ref6$drawPickingColo === undefined ? false : _ref6$drawPickingColo, _ref6$deviceRect = _ref6.deviceRect, deviceRect = _ref6$deviceRect === undefined ? null : _ref6$deviceRect, _ref6$parameters = _ref6.parameters, parameters = _ref6$parameters === undefined ? {} : _ref6$parameters, layerFilter = _ref6.layerFilter, _ref6$pass = _ref6.pass, pass = _ref6$pass === undefined ? 'draw' : _ref6$pass, _ref6$redrawReason = _ref6.redrawReason, redrawReason = _ref6$redrawReason === undefined ? '' : _ref6$redrawReason; var pixelRatio = getPixelRatio({ useDevicePixels: useDevicePixels }); var glViewport = getGLViewport(gl, { viewport: viewport, pixelRatio: pixelRatio }); // render layers in normal colors var renderStats = { totalCount: layers.length, visibleCount: 0, compositeCount: 0, pickableCount: 0 }; // const {x, y, width, height} = deviceRect || []; (0, _luma.setParameters)(gl, parameters || {}); // render layers in normal colors layers.forEach(function (layer, layerIndex) { // Check if we should draw layer var shouldDrawLayer = layer.props.visible; if (drawPickingColors) { shouldDrawLayer = shouldDrawLayer && layer.props.pickable; } if (shouldDrawLayer && layerFilter) { shouldDrawLayer = layerFilter({ layer: layer, viewport: viewport, isPicking: drawPickingColors }); } // Calculate stats if (shouldDrawLayer && layer.props.pickable) { renderStats.pickableCount++; } if (layer.isComposite) { renderStats.compositeCount++; } // Draw the layer if (shouldDrawLayer) { if (!layer.isComposite) { renderStats.visibleCount++; } drawLayerInViewport({ gl: gl, layer: layer, layerIndex: layerIndex, drawPickingColors: drawPickingColors, glViewport: glViewport, parameters: parameters }); } }); renderCount++; logRenderStats({ renderStats: renderStats, pass: pass, redrawReason: redrawReason }); } function drawLayerInViewport(_ref7) { var gl = _ref7.gl, layer = _ref7.layer, layerIndex = _ref7.layerIndex, drawPickingColors = _ref7.drawPickingColors, glViewport = _ref7.glViewport, parameters = _ref7.parameters; var moduleParameters = Object.assign({}, layer.props, { viewport: layer.context.viewport, pickingActive: drawPickingColors ? 1 : 0 }); var uniforms = Object.assign({}, layer.context.uniforms, { layerIndex: layerIndex }); // All parameter resolving is done here instead of the layer // Blend parameters must not be overriden var layerParameters = Object.assign({}, layer.props.parameters || {}, parameters); Object.assign(layerParameters, { viewport: glViewport }); if (drawPickingColors) { Object.assign(layerParameters, { blendColor: [0, 0, 0, (layerIndex + 1) / 255] }); } else { Object.assign(moduleParameters, getObjectHighlightParameters(layer)); } layer.drawLayer({ moduleParameters: moduleParameters, uniforms: uniforms, parameters: layerParameters }); } function logRenderStats(_ref8) { var renderStats = _ref8.renderStats, pass = _ref8.pass, redrawReason = _ref8.redrawReason; if (_log2.default.priority >= LOG_PRIORITY_DRAW) { var totalCount = renderStats.totalCount, visibleCount = renderStats.visibleCount, compositeCount = renderStats.compositeCount, pickableCount = renderStats.pickableCount; var primitiveCount = totalCount - compositeCount; var hiddenCount = primitiveCount - visibleCount; var message = ''; message += 'RENDER #' + renderCount + ' ' + visibleCount + ' (of ' + totalCount + ' layers) to ' + pass + ' because ' + redrawReason + ' '; if (_log2.default.priority > LOG_PRIORITY_DRAW) { message += '(' + hiddenCount + ' hidden, ' + compositeCount + ' composite ' + pickableCount + ' unpickable)'; } _log2.default.log(LOG_PRIORITY_DRAW, message); } } // Get a viewport from a viewport descriptor (which can be a plain viewport) function getViewportFromDescriptor(viewportOrDescriptor) { return viewportOrDescriptor.viewport ? viewportOrDescriptor.viewport : viewportOrDescriptor; } /** * Returns the picking color of currenlty selected object of the given 'layer'. * @return {Array} - the picking color or null if layers selected object is invalid. */ function getObjectHighlightParameters(layer) { // TODO - inefficient to update settings every render? // TODO: Add warning if 'highlightedObjectIndex' is > numberOfInstances of the model. // Update picking module settings if highlightedObjectIndex is set. // This will overwrite any settings from auto highlighting. if (Number.isInteger(layer.props.highlightedObjectIndex)) { var pickingSelectedColor = layer.props.highlightedObjectIndex >= 0 ? layer.encodePickingColor(layer.props.highlightedObjectIndex) : null; return { pickingSelectedColor: pickingSelectedColor }; } return null; } /***/ }), /* 184 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // TODO - remove, just for dummy initialization var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); var _luma = __webpack_require__(12); var _seer = __webpack_require__(173); var _seer2 = _interopRequireDefault(_seer); var _layer = __webpack_require__(123); var _layer2 = _interopRequireDefault(_layer); var _drawLayers2 = __webpack_require__(183); var _pickLayers = __webpack_require__(339); var _constants = __webpack_require__(70); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _webMercatorViewport = __webpack_require__(86); var _webMercatorViewport2 = _interopRequireDefault(_webMercatorViewport); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _flatten = __webpack_require__(126); var _seerIntegration = __webpack_require__(124); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var LOG_PRIORITY_LIFECYCLE = 2; var LOG_PRIORITY_LIFECYCLE_MINOR = 4; var initialContext = { uniforms: {}, viewports: [], viewport: null, layerFilter: null, viewportChanged: true, pickingFBO: null, useDevicePixels: true, lastPickedInfo: { index: -1, layerId: null } }; var layerName = function layerName(layer) { return layer instanceof _layer2.default ? '' + layer : !layer ? 'null' : 'invalid'; }; var LayerManager = function () { // eslint-disable-next-line function LayerManager(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, eventManager = _ref.eventManager, //iclient isGeographicCoordinateSystem=_ref.isGeographicCoordinateSystem; _classCallCheck(this, LayerManager); // Currently deck.gl expects the DeckGL.layers array to be different // whenever React rerenders. If the same layers array is used, the // LayerManager's diffing algorithm will generate a fatal error and // break the rendering. // `this.lastRenderedLayers` stores the UNFILTERED layers sent // down to LayerManager, so that `layers` reference can be compared. // If it's the same across two React render calls, the diffing logic // will be skipped. this.lastRenderedLayers = []; this.prevLayers = []; this.layers = []; this.oldContext = {}; this.context = Object.assign({}, initialContext, { gl: gl, // Enabling luma.gl Program caching using private API (_cachePrograms) shaderCache: new _luma.ShaderCache({ gl: gl, _cachePrograms: true }) }); // List of view descriptors, gets re-evaluated when width/height changes this.width = 100; this.height = 100; this.viewDescriptors = []; this.viewDescriptorsChanged = true; this.viewports = []; // Generated viewports this._needsRedraw = 'Initial render'; // Event handling this._pickingRadius = 0; this._eventManager = null; this._onLayerClick = null; this._onLayerHover = null; this._onClick = this._onClick.bind(this); this._onPointerMove = this._onPointerMove.bind(this); this._onPointerLeave = this._onPointerLeave.bind(this); this._pickAndCallback = this._pickAndCallback.bind(this); // Seer integration this._initSeer = this._initSeer.bind(this); this._editSeer = this._editSeer.bind(this); (0, _seerIntegration.seerInitListener)(this._initSeer); (0, _seerIntegration.layerEditListener)(this._editSeer); Object.seal(this); if (eventManager) { this._initEventHandling(eventManager); } // Init with dummy viewport this.setViewports([new _webMercatorViewport2.default({ width: 1, height: 1, latitude: 0, longitude: 0, zoom: 1,isGeographicCoordinateSystem:isGeographicCoordinateSystem })]); } /** * Method to call when the layer manager is not needed anymore. * * Currently used in the componentWillUnmount lifecycle to unbind Seer listeners. */ _createClass(LayerManager, [{ key: 'finalize', value: function finalize() { _seer2.default.removeListener(this._initSeer); _seer2.default.removeListener(this._editSeer); } }, { key: 'needsRedraw', value: function needsRedraw() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$clearRedrawFlag = _ref2.clearRedrawFlags, clearRedrawFlags = _ref2$clearRedrawFlag === undefined ? true : _ref2$clearRedrawFlag; return this._checkIfNeedsRedraw(clearRedrawFlags); } // Normally not called by app }, { key: 'setNeedsRedraw', value: function setNeedsRedraw(reason) { this._needsRedraw = this._needsRedraw || reason; } // Gets an (optionally) filtered list of layers }, { key: 'getLayers', value: function getLayers() { var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref3$layerIds = _ref3.layerIds, layerIds = _ref3$layerIds === undefined ? null : _ref3$layerIds; // Filtering by layerId compares beginning of strings, so that sublayers will be included // Dependes on the convention of adding suffixes to the parent's layer name return layerIds ? this.layers.filter(function (layer) { return layerIds.find(function (layerId) { return layer.id.indexOf(layerId) === 0; }); }) : this.layers; } // Get a set of viewports for a given width and height // TODO - Intention is for deck.gl to autodeduce width and height and drop the need for props }, { key: 'getViewports', value: function getViewports() { var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, width = _ref4.width, height = _ref4.height; if (width !== this.width || height !== this.height || this.viewDescriptorsChanged) { this._rebuildViewportsFromViews({ viewDescriptors: this.viewDescriptors, width: width, height: height }); this.width = width; this.height = height; } return this.viewports; } /** * Set parameters needed for layer rendering and picking. * Parameters are to be passed as a single object, with the following values: * @param {Boolean} useDevicePixels */ }, { key: 'setParameters', value: function setParameters(parameters) { if ('eventManager' in parameters) { this._initEventHandling(parameters.eventManager); } if ('pickingRadius' in parameters || 'onLayerClick' in parameters || 'onLayerHover' in parameters) { this._setEventHandlingParameters(parameters); } // TODO - For now we set layers before viewports to preservenchangeFlags if ('layers' in parameters) { this.setLayers(parameters.layers); } if ('viewports' in parameters) { this.setViewports(parameters.viewports); } if ('layerFilter' in parameters) { this.context.layerFilter = parameters.layerFilter; if (this.context.layerFilter !== parameters.layerFilter) { this.setNeedsRedraw('layerFilter changed'); } } if ('drawPickingColors' in parameters) { if (this.context.drawPickingColors !== parameters.drawPickingColors) { this.setNeedsRedraw('drawPickingColors changed'); } } Object.assign(this.context, parameters); } // Update the view descriptor list and set change flag if needed }, { key: 'setViewports', value: function setViewports(viewports) { // Ensure viewports are wrapped in descriptors var viewDescriptors = (0, _flatten.flatten)(viewports, { filter: Boolean }).map(function (viewport) { return viewport instanceof _viewport2.default ? { viewport: viewport } : viewport; }); this.viewDescriptorsChanged = this.viewDescriptorsChanged || this._diffViews(viewDescriptors, this.viewDescriptors); // Try to not actually rebuild the viewports until `getViewports` is called if (this.viewDescriptorsChanged) { this.viewDescriptors = viewDescriptors; this._rebuildViewportsFromViews({ viewDescriptors: this.viewDescriptors }); this.viewDescriptorsChanged = false; } } // Supply a new layer list, initiating sublayer generation and layer matching }, { key: 'setLayers', value: function setLayers(newLayers) { (0, _assert2.default)(this.context.viewport, 'LayerManager.updateLayers: viewport not set'); // TODO - something is generating state updates that cause rerender of the same if (newLayers === this.lastRenderedLayers) { _log2.default.log(3, 'Ignoring layer update due to layer array not changed'); return this; } this.lastRenderedLayers = newLayers; newLayers = (0, _flatten.flatten)(newLayers, { filter: Boolean }); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = newLayers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var layer = _step.value; layer.context = this.context; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } this.prevLayers = this.layers; var _updateLayers2 = this._updateLayers({ oldLayers: this.prevLayers, newLayers: newLayers }), error = _updateLayers2.error, generatedLayers = _updateLayers2.generatedLayers; this.layers = generatedLayers; // Throw first error found, if any if (error) { throw error; } return this; } }, { key: 'drawLayers', value: function drawLayers() { var _ref5 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref5$pass = _ref5.pass, pass = _ref5$pass === undefined ? 'render to screen' : _ref5$pass, _ref5$redrawReason = _ref5.redrawReason, redrawReason = _ref5$redrawReason === undefined ? 'unknown reason' : _ref5$redrawReason; var _context = this.context, gl = _context.gl, useDevicePixels = _context.useDevicePixels, drawPickingColors = _context.drawPickingColors; // render this viewport (0, _drawLayers2.drawLayers)(gl, { layers: this.layers, viewports: this.getViewports(), onViewportActive: this._activateViewport.bind(this), useDevicePixels: useDevicePixels, drawPickingColors: drawPickingColors, pass: pass, layerFilter: this.context.layerFilter, redrawReason: redrawReason }); } // Pick the closest info at given coordinate }, { key: 'pickObject', value: function pickObject(_ref6) { var x = _ref6.x, y = _ref6.y, mode = _ref6.mode, _ref6$radius = _ref6.radius, radius = _ref6$radius === undefined ? 0 : _ref6$radius, layerIds = _ref6.layerIds, layerFilter = _ref6.layerFilter; var _context2 = this.context, gl = _context2.gl, useDevicePixels = _context2.useDevicePixels; var layers = this.getLayers({ layerIds: layerIds }); return (0, _pickLayers.pickObject)(gl, { // User params x: x, y: y, radius: radius, layers: layers, mode: mode, layerFilter: layerFilter, // Injected params viewports: this.getViewports(), onViewportActive: this._activateViewport.bind(this), pickingFBO: this._getPickingBuffer(), lastPickedInfo: this.context.lastPickedInfo, useDevicePixels: useDevicePixels }); } // Get all unique infos within a bounding box }, { key: 'pickObjects', value: function pickObjects(_ref7) { var x = _ref7.x, y = _ref7.y, width = _ref7.width, height = _ref7.height, layerIds = _ref7.layerIds, layerFilter = _ref7.layerFilter; var _context3 = this.context, gl = _context3.gl, useDevicePixels = _context3.useDevicePixels; var layers = this.getLayers({ layerIds: layerIds }); return (0, _pickLayers.pickVisibleObjects)(gl, { x: x, y: y, width: width, height: height, layers: layers, layerFilter: layerFilter, mode: 'pickObjects', // TODO - how does this interact with multiple viewports? viewport: this.context.viewport, viewports: this.getViewports(), onViewportActive: this._activateViewport.bind(this), pickingFBO: this._getPickingBuffer(), useDevicePixels: useDevicePixels }); } // // DEPRECATED METHODS in V5 // }, { key: 'updateLayers', value: function updateLayers(_ref8) { var newLayers = _ref8.newLayers; _log2.default.deprecated('updateLayers', 'setLayers'); this.setLayers(newLayers); } }, { key: 'setViewport', value: function setViewport(viewport) { _log2.default.deprecated('setViewport', 'setViewports'); this.setViewports([viewport]); return this; } // // PRIVATE METHODS // }, { key: '_checkIfNeedsRedraw', value: function _checkIfNeedsRedraw(clearRedrawFlags) { var redraw = this._needsRedraw; if (clearRedrawFlags) { this._needsRedraw = false; } // This layers list doesn't include sublayers, relying on composite layers var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this.layers[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var layer = _step2.value; // Call every layer to clear their flags var layerNeedsRedraw = layer.getNeedsRedraw({ clearRedrawFlags: clearRedrawFlags }); redraw = redraw || layerNeedsRedraw; } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return redraw; } // Rebuilds viewports from descriptors towards a certain window size }, { key: '_rebuildViewportsFromViews', value: function _rebuildViewportsFromViews(_ref9) { var _this = this; var viewDescriptors = _ref9.viewDescriptors, width = _ref9.width, height = _ref9.height; var newViewports = viewDescriptors.map(function (viewDescriptor) { return ( // If a `Viewport` instance was supplied, use it, otherwise build it viewDescriptor.viewport instanceof _viewport2.default ? viewDescriptor.viewport : _this._makeViewportFromViewDescriptor({ viewDescriptor: viewDescriptor, width: width, height: height }) ); }); this.setNeedsRedraw('Viewport(s) changed'); // Ensure one viewport is activated, layers may expect it // TODO - handle empty viewport list (using dummy viewport), or assert // const oldViewports = this.context.viewports; // if (viewportsChanged) { var viewport = newViewports[0]; (0, _assert2.default)(viewport instanceof _viewport2.default, 'Invalid viewport'); this.context.viewports = newViewports; this._activateViewport(viewport); // } // We've just rebuilt the viewports to match the descriptors, so clear the flag this.viewports = newViewports; this.viewDescriptorsChanged = false; } // Build a `Viewport` from a view descriptor // TODO - add support for autosizing viewports using width and height }, { key: '_makeViewportFromViewDescriptor', value: function _makeViewportFromViewDescriptor(_ref10) { var viewDescriptor = _ref10.viewDescriptor, width = _ref10.width, height = _ref10.height; // Get the type of the viewport // TODO - default to WebMercator? var ViewportType = viewDescriptor.type, viewState = viewDescriptor.viewState; // Resolve relative viewport dimensions // TODO - we need to have width and height available var viewportDimensions = this._getViewDimensions({ viewDescriptor: viewDescriptor }); // Create the viewport, giving preference to view state in `viewState` return new ViewportType(Object.assign({}, viewDescriptor, viewportDimensions, viewState // Object.assign handles undefined )); } // Check if viewport array has changed, returns true if any change // Note that descriptors can be the same }, { key: '_diffViews', value: function _diffViews(newViews, oldViews) { var _this2 = this; if (newViews.length !== oldViews.length) { return true; } return newViews.some(function (_, i) { return _this2._diffView(newViews[i], oldViews[i]); }); } }, { key: '_diffView', value: function _diffView(newView, oldView) { // `View` hiearchy supports an `equals` method if (newView.viewport) { return !oldView.viewport || !newView.viewport.equals(oldView.viewport); } // TODO - implement deep equal on view descriptors return newView !== oldView; } // Support for relative viewport dimensions (e.g {y: '50%', height: '50%'}) }, { key: '_getViewDimensions', value: function _getViewDimensions(_ref11) { var viewDescriptor = _ref11.viewDescriptor, width = _ref11.width, height = _ref11.height; var parsePercent = function parsePercent(value, max) { return value; }; // TODO - enable to support percent size specifiers // const parsePercent = (value, max) => value ? // Math.round(parseFloat(value) / 100 * max) : // (value === null ? max : value); return { x: parsePercent(viewDescriptor.x, width), y: parsePercent(viewDescriptor.y, height), width: parsePercent(viewDescriptor.width, width), height: parsePercent(viewDescriptor.height, height) }; } /** * @param {Object} eventManager A source of DOM input events */ }, { key: '_initEventHandling', value: function _initEventHandling(eventManager) { this._eventManager = eventManager; // TODO: add/remove handlers on demand at runtime, not all at once on init. // Consider both top-level handlers like onLayerClick/Hover // and per-layer handlers attached to individual layers. // https://github.com/uber/deck.gl/issues/634 this._eventManager.on({ click: this._onClick, pointermove: this._onPointerMove, pointerleave: this._onPointerLeave }); } // Set parameters for input event handling. }, { key: '_setEventHandlingParameters', value: function _setEventHandlingParameters(_ref12) { var pickingRadius = _ref12.pickingRadius, onLayerClick = _ref12.onLayerClick, onLayerHover = _ref12.onLayerHover; if (!isNaN(pickingRadius)) { this._pickingRadius = pickingRadius; } if (typeof onLayerClick !== 'undefined') { this._onLayerClick = onLayerClick; } if (typeof onLayerHover !== 'undefined') { this._onLayerHover = onLayerHover; } this._validateEventHandling(); } // Make a viewport "current" in layer context, primed for draw }, { key: '_activateViewport', value: function _activateViewport(viewport) { // TODO - viewport change detection breaks METER_OFFSETS mode // const oldViewport = this.context.viewport; // const viewportChanged = !oldViewport || !viewport.equals(oldViewport); var viewportChanged = true; if (viewportChanged) { Object.assign(this.oldContext, this.context); this.context.viewport = viewport; this.context.viewportChanged = true; this.context.uniforms = {}; (0, _log2.default)(4, viewport); // Update layers states // Let screen space layers update their state based on viewport // TODO - reimplement viewport change detection (single viewport optimization) // TODO - don't set viewportChanged during setViewports? if (this.context.viewportChanged) { var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = this.layers[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var layer = _step3.value; layer.setChangeFlags({ viewportChanged: 'Viewport changed' }); this._updateLayer(layer); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } } (0, _assert2.default)(this.context.viewport, 'LayerManager: viewport not set'); return this; } }, { key: '_getPickingBuffer', value: function _getPickingBuffer() { var gl = this.context.gl; // Create a frame buffer if not already available this.context.pickingFBO = this.context.pickingFBO || new _luma.Framebuffer(gl); // Resize it to current canvas size (this is a noop if size hasn't changed) this.context.pickingFBO.resize({ width: gl.canvas.width, height: gl.canvas.height }); return this.context.pickingFBO; } // Match all layers, checking for caught errors // To avoid having an exception in one layer disrupt other layers // TODO - mark layers with exceptions as bad and remove from rendering cycle? }, { key: '_updateLayers', value: function _updateLayers(_ref13) { var oldLayers = _ref13.oldLayers, newLayers = _ref13.newLayers; // Create old layer map var oldLayerMap = {}; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = oldLayers[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var oldLayer = _step4.value; if (oldLayerMap[oldLayer.id]) { _log2.default.warn('Multiple old layers with same id ' + layerName(oldLayer)); } else { oldLayerMap[oldLayer.id] = oldLayer; } } // Allocate array for generated layers } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } var generatedLayers = []; // Match sublayers var error = this._updateSublayersRecursively({ newLayers: newLayers, oldLayerMap: oldLayerMap, generatedLayers: generatedLayers }); // Finalize unmatched layers var error2 = this._finalizeOldLayers(oldLayerMap); var firstError = error || error2; return { error: firstError, generatedLayers: generatedLayers }; } // Note: adds generated layers to `generatedLayers` array parameter }, { key: '_updateSublayersRecursively', value: function _updateSublayersRecursively(_ref14) { var newLayers = _ref14.newLayers, oldLayerMap = _ref14.oldLayerMap, generatedLayers = _ref14.generatedLayers; var error = null; var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = newLayers[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var newLayer = _step5.value; newLayer.context = this.context; // Given a new coming layer, find its matching old layer (if any) var oldLayer = oldLayerMap[newLayer.id]; if (oldLayer === null) { // null, rather than undefined, means this id was originally there _log2.default.warn('Multiple new layers with same id ' + layerName(newLayer)); } // Remove the old layer from candidates, as it has been matched with this layer oldLayerMap[newLayer.id] = null; var sublayers = null; // We must not generate exceptions until after layer matching is complete try { if (!oldLayer) { this._initializeLayer(newLayer); (0, _seerIntegration.initLayerInSeer)(newLayer); // Initializes layer in seer chrome extension (if connected) } else { this._transferLayerState(oldLayer, newLayer); this._updateLayer(newLayer); (0, _seerIntegration.updateLayerInSeer)(newLayer); // Updates layer in seer chrome extension (if connected) } generatedLayers.push(newLayer); // Call layer lifecycle method: render sublayers sublayers = newLayer.isComposite && newLayer.getSubLayers(); // End layer lifecycle method: render sublayers } catch (err) { _log2.default.warn('error during matching of ' + layerName(newLayer), err); error = error || err; // Record first exception } if (sublayers) { this._updateSublayersRecursively({ newLayers: sublayers, oldLayerMap: oldLayerMap, generatedLayers: generatedLayers }); } } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } return error; } // Finalize any old layers that were not matched }, { key: '_finalizeOldLayers', value: function _finalizeOldLayers(oldLayerMap) { var error = null; for (var layerId in oldLayerMap) { var layer = oldLayerMap[layerId]; if (layer) { error = error || this._finalizeLayer(layer); } } return error; } // Initializes a single layer, calling layer methods }, { key: '_initializeLayer', value: function _initializeLayer(layer) { (0, _assert2.default)(!layer.state); (0, _log2.default)(LOG_PRIORITY_LIFECYCLE, 'initializing ' + layerName(layer)); var error = null; try { layer._initialize(); layer.lifecycle = _constants.LIFECYCLE.INITIALIZED; } catch (err) { _log2.default.warn('error while initializing ' + layerName(layer) + '\n', err); error = error || err; // TODO - what should the lifecycle state be here? LIFECYCLE.INITIALIZATION_FAILED? } (0, _assert2.default)(layer.state); // Set back pointer (used in picking) layer.state.layer = layer; // Save layer on model for picking purposes // store on model.userData rather than directly on model var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = layer.getModels()[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var model = _step6.value; model.userData.layer = layer; } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } return error; } }, { key: '_transferLayerState', value: function _transferLayerState(oldLayer, newLayer) { if (newLayer !== oldLayer) { (0, _log2.default)(LOG_PRIORITY_LIFECYCLE_MINOR, 'matched ' + layerName(newLayer), oldLayer, '->', newLayer); newLayer.lifecycle = _constants.LIFECYCLE.MATCHED; oldLayer.lifecycle = _constants.LIFECYCLE.AWAITING_GC; newLayer._transferState(oldLayer); } else { _log2.default.log(LOG_PRIORITY_LIFECYCLE_MINOR, 'Matching layer is unchanged ' + newLayer.id); newLayer.lifecycle = _constants.LIFECYCLE.MATCHED; newLayer.oldProps = newLayer.props; } } // Updates a single layer, cleaning all flags }, { key: '_updateLayer', value: function _updateLayer(layer) { _log2.default.log(LOG_PRIORITY_LIFECYCLE_MINOR, 'updating ' + layer + ' because: ' + layer.printChangeFlags()); var error = null; try { layer._update(); } catch (err) { _log2.default.warn('error during update of ' + layerName(layer), err); // Save first error error = err; } return error; } // Finalizes a single layer }, { key: '_finalizeLayer', value: function _finalizeLayer(layer) { (0, _assert2.default)(layer.state); (0, _assert2.default)(layer.lifecycle !== _constants.LIFECYCLE.AWAITING_FINALIZATION); layer.lifecycle = _constants.LIFECYCLE.AWAITING_FINALIZATION; var error = null; this.setNeedsRedraw('finalized ' + layerName(layer)); try { layer._finalize(); } catch (err) { _log2.default.warn('error during finalization of ' + layerName(layer), err); error = err; } layer.lifecycle = _constants.LIFECYCLE.FINALIZED; (0, _log2.default)(LOG_PRIORITY_LIFECYCLE, 'finalizing ' + layerName(layer)); return error; } /** * Warn if a deck-level mouse event has been specified, * but no layers are `pickable`. */ }, { key: '_validateEventHandling', value: function _validateEventHandling() { if (this.onLayerClick || this.onLayerHover) { if (this.layers.length && !this.layers.some(function (layer) { return layer.props.pickable; })) { _log2.default.warn('You have supplied a top-level input event handler (e.g. `onLayerClick`), ' + 'but none of your layers have set the `pickable` flag.'); } } } /** * Route click events to layers. * `pickLayer` will call the `onClick` prop of any picked layer, * and `onLayerClick` is called directly from here * with any picking info generated by `pickLayer`. * @param {Object} event An object encapsulating an input event, * with the following shape: * {Object: {x, y}} offsetCenter: center of the event * {Object} srcEvent: native JS Event object */ }, { key: '_onClick', value: function _onClick(event) { if (!event.offsetCenter) { // Do not trigger onHover callbacks when click position is invalid. return; } this._pickAndCallback({ callback: this._onLayerClick, event: event, mode: 'click' }); } /** * Route click events to layers. * `pickLayer` will call the `onHover` prop of any picked layer, * and `onLayerHover` is called directly from here * with any picking info generated by `pickLayer`. * @param {Object} event An object encapsulating an input event, * with the following shape: * {Object: {x, y}} offsetCenter: center of the event * {Object} srcEvent: native JS Event object */ }, { key: '_onPointerMove', value: function _onPointerMove(event) { if (event.leftButton || event.rightButton) { // Do not trigger onHover callbacks if mouse button is down. return; } this._pickAndCallback({ callback: this._onLayerHover, event: event, mode: 'hover' }); } }, { key: '_onPointerLeave', value: function _onPointerLeave(event) { this.pickObject({ x: -1, y: -1, radius: this._pickingRadius, mode: 'hover' }); } }, { key: '_pickAndCallback', value: function _pickAndCallback(options) { var pos = options.event.offsetCenter; var radius = this._pickingRadius; var selectedInfos = this.pickObject({ x: pos.x, y: pos.y, radius: radius, mode: options.mode }); if (options.callback) { var firstInfo = selectedInfos.find(function (info) { return info.index >= 0; }) || null; // As per documentation, send null value when no valid object is picked. options.callback(firstInfo, selectedInfos, options.event.srcEvent); } } // SEER INTEGRATION /** * Called upon Seer initialization, manually sends layers data. */ }, { key: '_initSeer', value: function _initSeer() { this.layers.forEach(function (layer) { (0, _seerIntegration.initLayerInSeer)(layer); (0, _seerIntegration.updateLayerInSeer)(layer); }); } /** * On Seer property edition, set override and update layers. */ }, { key: '_editSeer', value: function _editSeer(payload) { if (payload.type !== 'edit' || payload.valuePath[0] !== 'props') { return; } (0, _seerIntegration.setPropOverrides)(payload.itemKey, payload.valuePath.slice(1), payload.value); var newLayers = this.layers.map(function (layer) { return new layer.constructor(layer.props); }); this.updateLayers({ newLayers: newLayers }); } }]); return LayerManager; }(); exports.default = LayerManager; /***/ }), /* 185 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); exports.formatTime = formatTime; exports.leftPad = leftPad; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Stats = function () { function Stats(_ref) { var id = _ref.id; _classCallCheck(this, Stats); this.id = id; this.time = 0; this.total = 0; this.average = 0; this.count = 0; this._time = 0; } _createClass(Stats, [{ key: 'timeStart', value: function timeStart() { this._time = this.timestampMs(); } }, { key: 'timeEnd', value: function timeEnd() { this.time = this.timestampMs() - this._time; this.total += this.time; this.count++; this.average = this.total / this.count; } }, { key: 'timestampMs', value: function timestampMs() { /* global window */ return typeof window !== 'undefined' && window.performance ? window.performance.now() : Date.now(); } }, { key: 'getTimeString', value: function getTimeString() { return this.id + ':' + formatTime(this.time) + '(' + this.count + ')'; } }]); return Stats; }(); // TODO: Currently unused, keeping in case we want it later for log formatting exports.default = Stats; function formatTime(ms) { var formatted = void 0; if (ms < 10) { formatted = ms.toFixed(2) + 'ms'; } else if (ms < 100) { formatted = ms.toFixed(1) + 'ms'; } else if (ms < 1000) { formatted = ms.toFixed(0) + 'ms'; } else { formatted = (ms / 1000).toFixed(2) + 's'; } return formatted; } function leftPad(string) { var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 8; while (string.length < length) { string = ' ' + string; } return string; } /***/ }), /* 186 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TRANSITION_EVENTS = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global requestAnimationFrame, cancelAnimationFrame */ var _linearInterpolator = __webpack_require__(125); var _linearInterpolator2 = _interopRequireDefault(_linearInterpolator); var _transitionUtils = __webpack_require__(84); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var noop = function noop() {}; var TRANSITION_EVENTS = exports.TRANSITION_EVENTS = { BREAK: 1, SNAP_TO_END: 2, IGNORE: 3 }; var DEFAULT_PROPS = { transitionDuration: 0, transitionEasing: function transitionEasing(t) { return t; }, transitionInterpolator: new _linearInterpolator2.default(), transitionInterruption: TRANSITION_EVENTS.BREAK, onTransitionStart: noop, onTransitionInterrupt: noop, onTransitionEnd: noop }; var DEFAULT_STATE = { animation: null, propsInTransition: null, startProps: null, endProps: null }; var TransitionManager = function () { function TransitionManager(props) { _classCallCheck(this, TransitionManager); this.props = props; this.state = DEFAULT_STATE; this._onTransitionFrame = this._onTransitionFrame.bind(this); } // Returns current transitioned viewport. _createClass(TransitionManager, [{ key: 'getViewportInTransition', value: function getViewportInTransition() { return this.state.propsInTransition; } // Process the vewiport change, either ignore or trigger a new transiton. // Return true if a new transition is triggered, false otherwise. }, { key: 'processViewportChange', value: function processViewportChange(nextProps) { var transitionTriggered = false; var currentProps = this.props; // Set this.props here as '_triggerTransition' calls '_updateViewport' that uses this.props. this.props = nextProps; // NOTE: Be cautious re-ordering statements in this function. if (this._shouldIgnoreViewportChange(currentProps, nextProps)) { return transitionTriggered; } var isTransitionInProgress = this._isTransitionInProgress(); if (this._isTransitionEnabled(nextProps)) { var startProps = Object.assign({}, currentProps, this.state.interruption === TRANSITION_EVENTS.SNAP_TO_END ? this.state.endProps : this.state.propsInTransition || currentProps); if (isTransitionInProgress) { currentProps.onTransitionInterrupt(); } nextProps.onTransitionStart(); this._triggerTransition(startProps, nextProps); transitionTriggered = true; } else if (isTransitionInProgress) { currentProps.onTransitionInterrupt(); this._endTransition(); } return transitionTriggered; } // Helper methods }, { key: '_isTransitionInProgress', value: function _isTransitionInProgress() { return this.state.propsInTransition; } }, { key: '_isTransitionEnabled', value: function _isTransitionEnabled(props) { return props.transitionDuration > 0 && props.transitionInterpolator; } }, { key: '_isUpdateDueToCurrentTransition', value: function _isUpdateDueToCurrentTransition(props) { if (this.state.propsInTransition) { return this.state.interpolator.arePropsEqual(props, this.state.propsInTransition); } return false; } }, { key: '_shouldIgnoreViewportChange', value: function _shouldIgnoreViewportChange(currentProps, nextProps) { if (this._isTransitionInProgress()) { // Ignore update if it is requested to be ignored return this.state.interruption === TRANSITION_EVENTS.IGNORE || // Ignore update if it is due to current active transition. this._isUpdateDueToCurrentTransition(nextProps); } else if (this._isTransitionEnabled(nextProps)) { // Ignore if none of the viewport props changed. return nextProps.transitionInterpolator.arePropsEqual(currentProps, nextProps); } return true; } }, { key: '_triggerTransition', value: function _triggerTransition(startProps, endProps) { (0, _assert2.default)(this._isTransitionEnabled(endProps), 'Transition is not enabled'); cancelAnimationFrame(this.state.animation); var initialProps = endProps.transitionInterpolator.initializeProps(startProps, endProps); this.state = { // Save current transition props duration: endProps.transitionDuration, easing: endProps.transitionEasing, interpolator: endProps.transitionInterpolator, interruption: endProps.transitionInterruption, startTime: Date.now(), startProps: initialProps.start, endProps: initialProps.end, animation: null, propsInTransition: {} }; this._onTransitionFrame(); } }, { key: '_onTransitionFrame', value: function _onTransitionFrame() { // _updateViewport() may cancel the animation this.state.animation = requestAnimationFrame(this._onTransitionFrame); this._updateViewport(); } }, { key: '_endTransition', value: function _endTransition() { cancelAnimationFrame(this.state.animation); this.state = DEFAULT_STATE; } }, { key: '_updateViewport', value: function _updateViewport() { // NOTE: Be cautious re-ordering statements in this function. var currentTime = Date.now(); var _state = this.state, startTime = _state.startTime, duration = _state.duration, easing = _state.easing, interpolator = _state.interpolator, startProps = _state.startProps, endProps = _state.endProps; var shouldEnd = false; var t = (currentTime - startTime) / duration; if (t >= 1) { t = 1; shouldEnd = true; } t = easing(t); var viewport = interpolator.interpolateProps(startProps, endProps, t); // This extractViewportFrom gurantees angle props (bearing, longitude) are normalized // So when viewports are compared they are in same range. this.state.propsInTransition = (0, _transitionUtils.extractViewportFrom)(Object.assign({}, this.props, viewport)); if (this.props.onViewportChange) { this.props.onViewportChange(this.state.propsInTransition, { inTransition: true }); } if (shouldEnd) { this._endTransition(); this.props.onTransitionEnd(); } } }]); return TransitionManager; }(); exports.default = TransitionManager; TransitionManager.defaultProps = DEFAULT_PROPS; /***/ }), /* 187 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.diffProps = diffProps; exports.compareProps = compareProps; var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Returns an object with "change flags", either false or strings indicating reason for change function diffProps(props, oldProps) { // First check if any props have changed (ignore props that will be examined separately) var propsChangedReason = compareProps({ newProps: props, oldProps: oldProps, ignoreProps: { data: null, updateTriggers: null } }); // Now check if any data related props have changed var dataChangedReason = diffDataProps(props, oldProps); // Check update triggers to determine if any attributes need regeneration // Note - if data has changed, all attributes will need regeneration, so skip this step var updateTriggersChangedReason = false; if (!dataChangedReason) { updateTriggersChangedReason = diffUpdateTriggers(props, oldProps); } return { dataChanged: dataChangedReason, propsChanged: propsChangedReason, updateTriggersChanged: updateTriggersChangedReason }; } /** * Performs equality by iterating through keys on an object and returning false * when any key has values which are not strictly equal between the arguments. * @param {Object} opt.oldProps - object with old key/value pairs * @param {Object} opt.newProps - object with new key/value pairs * @param {Object} opt.ignoreProps={} - object, keys that should not be compared * @returns {null|String} - null when values of all keys are strictly equal. * if unequal, returns a string explaining what changed. */ /* eslint-disable max-statements, max-depth, complexity */ function compareProps() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, newProps = _ref.newProps, oldProps = _ref.oldProps, _ref$ignoreProps = _ref.ignoreProps, ignoreProps = _ref$ignoreProps === undefined ? {} : _ref$ignoreProps, _ref$shallowComparePr = _ref.shallowCompareProps, shallowCompareProps = _ref$shallowComparePr === undefined ? {} : _ref$shallowComparePr, _ref$triggerName = _ref.triggerName, triggerName = _ref$triggerName === undefined ? 'props' : _ref$triggerName; (0, _assert2.default)(oldProps !== undefined && newProps !== undefined, 'compareProps args'); // shallow equality => deep equality if (oldProps === newProps) { return null; } // TODO - do we need these checks? Should never happen... if ((typeof newProps === 'undefined' ? 'undefined' : _typeof(newProps)) !== 'object' || newProps === null) { return triggerName + ' changed shallowly'; } if ((typeof oldProps === 'undefined' ? 'undefined' : _typeof(oldProps)) !== 'object' || oldProps === null) { return triggerName + ' changed shallowly'; } // Test if new props different from old props for (var key in oldProps) { if (!(key in ignoreProps)) { if (!(key in newProps)) { return triggerName + '.' + key + ' dropped: ' + oldProps[key] + ' -> undefined'; } // If object has an equals function, invoke it var equals = newProps[key] && oldProps[key] && newProps[key].equals; if (equals && !equals.call(newProps[key], oldProps[key])) { return triggerName + '.' + key + ' changed deeply: ' + oldProps[key] + ' -> ' + newProps[key]; } // If both new and old value are functions, ignore differences if (key in shallowCompareProps) { var type = _typeof(newProps[key]); if (type === 'function' && typeof oldProps[key] === 'function') { equals = true; } } if (!equals && oldProps[key] !== newProps[key]) { return triggerName + '.' + key + ' changed shallowly: ' + oldProps[key] + ' -> ' + newProps[key]; } } } // Test if any new props have been added for (var _key in newProps) { if (!(_key in ignoreProps)) { if (!(_key in oldProps)) { return triggerName + '.' + _key + ' added: undefined -> ' + newProps[_key]; } } } return null; } /* eslint-enable max-statements, max-depth, complexity */ // HELPERS // The comparison of the data prop requires special handling // the dataComparator should be used if supplied function diffDataProps(props, oldProps) { if (oldProps === null) { return 'oldProps is null, initial diff'; } // Support optional app defined comparison of data var dataComparator = props.dataComparator; if (dataComparator) { if (!dataComparator(props.data, oldProps.data)) { return 'Data comparator detected a change'; } // Otherwise, do a shallow equal on props } else if (props.data !== oldProps.data) { return 'A new data container was supplied'; } return null; } // Checks if any update triggers have changed // also calls callback to invalidate attributes accordingly. function diffUpdateTriggers(props, oldProps) { if (oldProps === null) { return 'oldProps is null, initial diff'; } // If the 'all' updateTrigger fires, ignore testing others if ('all' in props.updateTriggers) { var diffReason = diffUpdateTrigger(oldProps, props, 'all'); if (diffReason) { return { all: true }; } } var triggerChanged = {}; var reason = false; // If the 'all' updateTrigger didn't fire, need to check all others for (var triggerName in props.updateTriggers) { if (triggerName !== 'all') { var _diffReason = diffUpdateTrigger(oldProps, props, triggerName); if (_diffReason) { triggerChanged[triggerName] = true; reason = triggerChanged; } } } return reason; } function diffUpdateTrigger(props, oldProps, triggerName) { var newTriggers = props.updateTriggers[triggerName] || {}; var oldTriggers = oldProps.updateTriggers[triggerName] || {}; var diffReason = compareProps({ oldProps: oldTriggers, newProps: newTriggers, triggerName: triggerName }); return diffReason; } /***/ }), /* 188 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _propTypes = __webpack_require__(116); var _propTypes2 = _interopRequireDefault(_propTypes); var _mjolnir = __webpack_require__(115); var _mapControls = __webpack_require__(178); var _mapControls2 = _interopRequireDefault(_mapControls); var _mapState = __webpack_require__(82); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var PREFIX = '-webkit-'; var CURSOR = { GRABBING: PREFIX + 'grabbing', GRAB: PREFIX + 'grab', POINTER: 'pointer' }; var propTypes = { width: _propTypes2.default.number.isRequired /** The width of the map. */ , height: _propTypes2.default.number.isRequired /** The height of the map. */ , longitude: _propTypes2.default.number.isRequired /** The longitude of the center of the map. */ , latitude: _propTypes2.default.number.isRequired /** The latitude of the center of the map. */ , zoom: _propTypes2.default.number.isRequired /** The tile zoom level of the map. */ , bearing: _propTypes2.default.number /** Specify the bearing of the viewport */ , pitch: _propTypes2.default.number /** Specify the pitch of the viewport */ , // Note: Non-public API, see https://github.com/mapbox/mapbox-gl-js/issues/1137 altitude: _propTypes2.default.number /** Altitude of the viewport camera. Default 1.5 "screen heights" */ , /** Viewport constraints */ maxZoom: _propTypes2.default.number, // Max zoom level minZoom: _propTypes2.default.number, // Min zoom level maxPitch: _propTypes2.default.number, // Max pitch in degrees minPitch: _propTypes2.default.number, // Min pitch in degrees /** * `onViewportChange` callback is fired when the user interacted with the * map. The object passed to the callback contains viewport properties * such as `longitude`, `latitude`, `zoom` etc. */ onViewportChange: _propTypes2.default.func, /** Enables control event handling */ scrollZoom: _propTypes2.default.bool, // Scroll to zoom dragPan: _propTypes2.default.bool, // Drag to pan dragRotate: _propTypes2.default.bool, // Drag to rotate doubleClickZoom: _propTypes2.default.bool, // Double click to zoom touchZoomRotate: _propTypes2.default.bool, // Pinch to zoom / rotate /** Accessor that returns a cursor style to show interactive state */ getCursor: _propTypes2.default.func, // A map control instance to replace the default map controls // The object must expose one property: `events` as an array of subscribed // event names; and two methods: `setState(state)` and `handle(event)` controls: _propTypes2.default.shape({ events: _propTypes2.default.arrayOf(_propTypes2.default.string), handleEvent: _propTypes2.default.func }) }; var getDefaultCursor = function getDefaultCursor(_ref) { var isDragging = _ref.isDragging; return isDragging ? CURSOR.GRABBING : CURSOR.GRAB; }; var defaultProps = Object.assign({}, _mapState.MAPBOX_LIMITS, { onViewportChange: null, scrollZoom: true, dragPan: true, dragRotate: true, doubleClickZoom: true, touchZoomRotate: true, getCursor: getDefaultCursor }); var MapControllerJS = function () { function MapControllerJS(props) { _classCallCheck(this, MapControllerJS); props = Object.assign({}, defaultProps, props); this.props = props; this.state = { isDragging: false // Whether the cursor is down }; this.canvas = props.canvas; var eventManager = new _mjolnir.EventManager(this.canvas); this._eventManager = eventManager; // If props.controls is not provided, fallback to default MapControls instance // Cannot use defaultProps here because it needs to be per map instance this._controls = this.props.controls || new _mapControls2.default(); this._controls.setOptions(Object.assign({}, this.props, { onStateChange: this._onInteractiveStateChange.bind(this), eventManager: eventManager })); } _createClass(MapControllerJS, [{ key: 'setProps', value: function setProps(props) { props = Object.assign({}, this.props, props); this.props = props; this._controls.setOptions(props); } }, { key: 'finalize', value: function finalize() { this._eventManager.destroy(); } }, { key: '_onInteractiveStateChange', value: function _onInteractiveStateChange(_ref2) { var _ref2$isDragging = _ref2.isDragging, isDragging = _ref2$isDragging === undefined ? false : _ref2$isDragging; if (isDragging !== this.state.isDragging) { this.state.isDragging = isDragging; var getCursor = this.props.getCursor; this.canvas.style.cursor = getCursor(this.state); } } }]); return MapControllerJS; }(); exports.default = MapControllerJS; MapControllerJS.displayName = 'MapController'; MapControllerJS.propTypes = propTypes; MapControllerJS.defaultProps = defaultProps; /***/ }), /* 189 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _propTypes = __webpack_require__(116); var _propTypes2 = _interopRequireDefault(_propTypes); var _orbitViewport = __webpack_require__(85); var _orbitViewport2 = _interopRequireDefault(_orbitViewport); var _orbitState = __webpack_require__(179); var _orbitState2 = _interopRequireDefault(_orbitState); var _viewportControls = __webpack_require__(121); var _viewportControls2 = _interopRequireDefault(_viewportControls); var _mjolnir = __webpack_require__(115); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var PREFIX = '-webkit-'; var CURSOR = { GRABBING: PREFIX + 'grabbing', GRAB: PREFIX + 'grab', POINTER: 'pointer' }; var propTypes = { /* Viewport properties */ lookAt: _propTypes2.default.arrayOf(_propTypes2.default.number), // target position distance: _propTypes2.default.number, // distance from camera to the target rotationX: _propTypes2.default.number, // rotation around X axis rotationY: _propTypes2.default.number, // rotation around Y axis translationX: _propTypes2.default.number, // translation x in screen space translationY: _propTypes2.default.number, // translation y in screen space zoom: _propTypes2.default.number, // scale in screen space minZoom: _propTypes2.default.number, maxZoom: _propTypes2.default.number, fov: _propTypes2.default.number, // field of view near: _propTypes2.default.number, far: _propTypes2.default.number, width: _propTypes2.default.number.isRequired, // viewport width in pixels height: _propTypes2.default.number.isRequired, // viewport height in pixels /* Model properties */ bounds: _propTypes2.default.object, // bounds in the shape of {minX, minY, minZ, maxX, maxY, maxZ} /* Callbacks */ onViewportChange: _propTypes2.default.func.isRequired, /** Accessor that returns a cursor style to show interactive state */ getCursor: _propTypes2.default.func, /* Controls */ orbitControls: _propTypes2.default.object }; var getDefaultCursor = function getDefaultCursor(_ref) { var isDragging = _ref.isDragging; return isDragging ? CURSOR.GRABBING : CURSOR.GRAB; }; var defaultProps = { lookAt: [0, 0, 0], rotationX: 0, rotationY: 0, translationX: 0, translationY: 0, distance: 10, zoom: 1, minZoom: 0, maxZoom: Infinity, fov: 50, near: 1, far: 1000, getCursor: getDefaultCursor }; /* * Maps mouse interaction to a deck.gl Viewport */ var OrbitControllerJS = function () { _createClass(OrbitControllerJS, null, [{ key: 'getViewport', // Returns a deck.gl Viewport instance, to be used with the DeckGL component value: function getViewport(viewport) { return new _orbitViewport2.default(viewport); } }]); function OrbitControllerJS(props) { _classCallCheck(this, OrbitControllerJS); props = Object.assign({}, defaultProps, props); this.props = props; this.state = { // Whether the cursor is down isDragging: false }; this.canvas = props.canvas; var eventManager = new _mjolnir.EventManager(this.canvas); this._eventManager = eventManager; this._controls = props.orbitControls || new _viewportControls2.default(_orbitState2.default); this._controls.setOptions(Object.assign({}, this.props, { onStateChange: this._onInteractiveStateChange.bind(this), eventManager: eventManager })); } _createClass(OrbitControllerJS, [{ key: 'setProps', value: function setProps(props) { props = Object.assign({}, this.props, props); this.props = props; this._controls.setOptions(props); } }, { key: 'finalize', value: function finalize() { this._eventManager.destroy(); } }, { key: '_onInteractiveStateChange', value: function _onInteractiveStateChange(_ref2) { var _ref2$isDragging = _ref2.isDragging, isDragging = _ref2$isDragging === undefined ? false : _ref2$isDragging; if (isDragging !== this.state.isDragging) { this.state.isDragging = isDragging; var getCursor = this.props.getCursor; this.canvas.style.cursor = getCursor(this.state); } } }]); return OrbitControllerJS; }(); exports.default = OrbitControllerJS; OrbitControllerJS.displayName = 'OrbitController'; OrbitControllerJS.propTypes = propTypes; OrbitControllerJS.defaultProps = defaultProps; /***/ }), /* 190 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.lighting = exports.project64 = exports.project = exports.picking = exports.fp64 = exports.fp32 = undefined; exports.initializeShaderModules = initializeShaderModules; var _luma = __webpack_require__(12); var _project = __webpack_require__(83); var _project2 = _interopRequireDefault(_project); var _project3 = __webpack_require__(192); var _project4 = _interopRequireDefault(_project3); var _lighting = __webpack_require__(191); var _lighting2 = _interopRequireDefault(_lighting); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function initializeShaderModules() { (0, _luma.registerShaderModules)([_luma.fp32, _luma.fp64, _project2.default, _project4.default, _lighting2.default, _luma.picking]); (0, _luma.setDefaultShaderModules)([_project2.default]); } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. initializeShaderModules(); exports.fp32 = _luma.fp32; exports.fp64 = _luma.fp64; exports.picking = _luma.picking; exports.project = _project2.default; exports.project64 = _project4.default; exports.lighting = _lighting2.default; /***/ }), /* 191 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _lighting = __webpack_require__(342); var _lighting2 = _interopRequireDefault(_lighting); var _project = __webpack_require__(83); var _project2 = _interopRequireDefault(_project); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = { name: 'lighting', dependencies: [_project2.default], vs: _lighting2.default }; /***/ }), /* 192 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _luma = __webpack_require__(12); var _project = __webpack_require__(83); var _project2 = _interopRequireDefault(_project); var _fp = __webpack_require__(195); var _memoize = __webpack_require__(196); var _memoize2 = _interopRequireDefault(_memoize); var _project3 = __webpack_require__(343); var _project4 = _interopRequireDefault(_project3); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } exports.default = { name: 'project64', dependencies: [_project2.default, _luma.fp64], vs: _project4.default, getUniforms: getUniforms, deprecations: [{ type: 'uniform vec2', old: 'projectionFP64[16]', new: 'project_uViewProjectionMatrixFP64' }, { type: 'uniform vec2', old: 'projectionScaleFP64', new: 'project64_uScale' }] }; // TODO - this module should calculate the 64 bit uniforms // It is currently done by project to minimize duplicated work // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var DEFAULT_MODULE_OPTIONS = {}; var getMemoizedUniforms = (0, _memoize2.default)(calculateUniforms); function getUniforms() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS; var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // These two uniforms are generated by the fp32 project module var project_uViewProjectionMatrix = context.project_uViewProjectionMatrix, project_uScale = context.project_uScale; if (project_uViewProjectionMatrix && project_uScale) { // We only need to update fp64 uniforms if fp32 projection is being updated return getMemoizedUniforms({ project_uViewProjectionMatrix: project_uViewProjectionMatrix, project_uScale: project_uScale }); } return {}; } function calculateUniforms(_ref) { var project_uViewProjectionMatrix = _ref.project_uViewProjectionMatrix, project_uScale = _ref.project_uScale; var glViewProjectionMatrixFP64 = (0, _fp.fp64ifyMatrix4)(project_uViewProjectionMatrix); var scaleFP64 = (0, _fp.fp64ify)(project_uScale); return { project_uViewProjectionMatrixFP64: glViewProjectionMatrixFP64, project64_uViewProjectionMatrix: glViewProjectionMatrixFP64, project64_uScale: scaleFP64 }; } /***/ }), /* 193 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _math = __webpack_require__(16); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var TransitionInterpolator = function () { function TransitionInterpolator() { _classCallCheck(this, TransitionInterpolator); } _createClass(TransitionInterpolator, [{ key: 'arePropsEqual', /** * Checks if two sets of props need transition in between * @param currentProps {object} - a list of viewport props * @param nextProps {object} - a list of viewport props * @returns {bool} - true if two props are equivalent */ value: function arePropsEqual(currentProps, nextProps) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = (this.propNames || [])[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; if (!(0, _math.equals)(currentProps[key], nextProps[key])) { return false; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return true; } /** * Called before transition starts to validate/pre-process start and end props * @param startProps {object} - a list of starting viewport props * @param endProps {object} - a list of target viewport props * @returns {Object} {start, end} - start and end props to be passed * to `interpolateProps` */ }, { key: 'initializeProps', value: function initializeProps(startProps, endProps) { return { start: startProps, end: endProps }; } /** * Returns viewport props in transition * @param startProps {object} - a list of starting viewport props * @param endProps {object} - a list of target viewport props * @param t {number} - a time factor between [0, 1] * @returns {object} - a list of interpolated viewport props */ }, { key: 'interpolateProps', value: function interpolateProps(startProps, endProps, t) { (0, _assert2.default)(false, 'interpolateProps is not implemented'); } }]); return TransitionInterpolator; }(); exports.default = TransitionInterpolator; /***/ }), /* 194 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.count = count; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var ERR_NOT_OBJECT = 'count(): argument not an object'; var ERR_NOT_CONTAINER = 'count(): argument not a container'; /** * Deduces numer of elements in a JavaScript container. * - Auto-deduction for ES6 containers that define a count() method * - Auto-deduction for ES6 containers that define a size member * - Auto-deduction for Classic Arrays via the built-in length attribute * - Also handles objects, although note that this an O(N) operation */ function count(container) { if (!isObject(container)) { throw new Error(ERR_NOT_OBJECT); } // Check if ES6 collection "count" function is available if (typeof container.count === 'function') { return container.count(); } // Check if ES6 collection "size" attribute is set if (Number.isFinite(container.size)) { return container.size; } // Check if array length attribute is set // Note: checking this last since some ES6 collections (Immutable.js) // emit profuse warnings when trying to access `length` attribute if (Number.isFinite(container.length)) { return container.length; } // Note that getting the count of an object is O(N) if (isPlainObject(container)) { return Object.keys(container).length; } throw new Error(ERR_NOT_CONTAINER); } /** * Checks if argument is a plain object (not a class or array etc) * @param {*} value - JavaScript value to be tested * @return {Boolean} - true if argument is a plain JavaScript object */ function isPlainObject(value) { return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object' && value.constructor === Object; } /** * Checks if argument is an indexable object (not a primitive value, nor null) * @param {*} value - JavaScript value to be tested * @return {Boolean} - true if argument is a JavaScript object */ function isObject(value) { return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object'; } /***/ }), /* 195 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.fp64ify = fp64ify; exports.fp64ifyMatrix4 = fp64ifyMatrix4; exports.fp64LowPart = fp64LowPart; exports.enable64bitSupport = enable64bitSupport; var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _constants = __webpack_require__(70); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // TODO - utils should not import from lib /* * Frequently used small math utils: bundlers, especially webpack, * adds a thunk around every exported function that adds enough overhead to pull down performance. * It may be worth it to also export these as part of an object. */ // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // TODO - move to shaderlib utilities function fp64ify(a) { var array = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; var hiPart = Math.fround(a); var loPart = a - Math.fround(a); array[startIndex] = hiPart; array[startIndex + 1] = loPart; return array; } // calculate WebGL 64 bit matrix (transposed "Float64Array") function fp64ifyMatrix4(matrix) { // Transpose the projection matrix to column major for GLSL. var matrixFP64 = new Float32Array(32); for (var i = 0; i < 4; ++i) { for (var j = 0; j < 4; ++j) { var index = i * 4 + j; fp64ify(matrix[j * 4 + i], matrixFP64, index * 2); } } return matrixFP64; } function fp64LowPart(a) { return a - Math.fround(a); } function enable64bitSupport(props) { if (props.fp64) { if (props.coordinateSystem === _constants.COORDINATE_SYSTEM.LNGLAT) { return true; } _log2.default.once(0, '64-bit mode only works with coordinateSystem set to\n COORDINATE_SYSTEM.LNGLAT. Rendering in 32-bit mode instead'); } return false; } /***/ }), /* 196 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = memoize; function isEqual(a, b) { if (a === b) { return true; } if (Array.isArray(a)) { // Special treatment for arrays: compare 1-level deep // This is to support equality of matrix/coordinate props var len = a.length; if (!b || b.length !== len) { return false; } for (var i = 0; i < len; i++) { if (a[i] !== b[i]) { return false; } } return true; } return false; } /** * Speed up consecutive function calls by caching the result of calls with identical input * https://en.wikipedia.org/wiki/Memoization * @param {function} compute - the function to be memoized */ function memoize(compute) { var cachedArgs = {}; var cachedResult = void 0; return function (args) { for (var key in args) { if (!isEqual(args[key], cachedArgs[key])) { cachedResult = compute(args); cachedArgs = args; break; } } return cachedResult; }; } /***/ }), /* 197 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = autobind; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var PREDEFINED = ['constructor', 'render', 'componentWillMount', 'componentDidMount', 'componentWillReceiveProps', 'shouldComponentUpdate', 'componentWillUpdate', 'componentDidUpdate', 'componentWillUnmount']; /** * Binds the "this" argument of all functions on a class instance to the instance * @param {Object} obj - class instance (typically a react component) */ function autobind(obj) { var proto = Object.getPrototypeOf(obj); var propNames = Object.getOwnPropertyNames(proto); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { var _loop = function _loop() { var key = _step.value; if (typeof obj[key] === 'function') { if (!PREDEFINED.find(function (name) { return key === name; })) { obj[key] = obj[key].bind(obj); } } }; for (var _iterator = propNames[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { _loop(); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } /***/ }), /* 198 */ /***/ (function(module, exports, __webpack_require__) { var cof = __webpack_require__(27); module.exports = function (it, msg) { if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg); return +it; }; /***/ }), /* 199 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) var toObject = __webpack_require__(14); var toAbsoluteIndex = __webpack_require__(57); var toLength = __webpack_require__(11); module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) { var O = toObject(this); var len = toLength(O.length); var to = toAbsoluteIndex(target, len); var from = toAbsoluteIndex(start, len); var end = arguments.length > 2 ? arguments[2] : undefined; var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to); var inc = 1; if (from < to && to < from + count) { inc = -1; from += count - 1; to += count - 1; } while (count-- > 0) { if (from in O) O[to] = O[from]; else delete O[to]; to += inc; from += inc; } return O; }; /***/ }), /* 200 */ /***/ (function(module, exports, __webpack_require__) { var forOf = __webpack_require__(49); module.exports = function (iter, ITERATOR) { var result = []; forOf(iter, false, result.push, result, ITERATOR); return result; }; /***/ }), /* 201 */ /***/ (function(module, exports, __webpack_require__) { var aFunction = __webpack_require__(15); var toObject = __webpack_require__(14); var IObject = __webpack_require__(72); var toLength = __webpack_require__(11); module.exports = function (that, callbackfn, aLen, memo, isRight) { aFunction(callbackfn); var O = toObject(that); var self = IObject(O); var length = toLength(O.length); var index = isRight ? length - 1 : 0; var i = isRight ? -1 : 1; if (aLen < 2) for (;;) { if (index in self) { memo = self[index]; index += i; break; } index += i; if (isRight ? index < 0 : length <= index) { throw TypeError('Reduce of empty array with no initial value'); } } for (;isRight ? index >= 0 : length > index; index += i) if (index in self) { memo = callbackfn(memo, self[index], index, O); } return memo; }; /***/ }), /* 202 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var aFunction = __webpack_require__(15); var isObject = __webpack_require__(5); var invoke = __webpack_require__(208); var arraySlice = [].slice; var factories = {}; var construct = function (F, len, args) { if (!(len in factories)) { for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']'; // eslint-disable-next-line no-new-func factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')'); } return factories[len](F, args); }; module.exports = Function.bind || function bind(that /* , ...args */) { var fn = aFunction(this); var partArgs = arraySlice.call(arguments, 1); var bound = function (/* args... */) { var args = partArgs.concat(arraySlice.call(arguments)); return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that); }; if (isObject(fn.prototype)) bound.prototype = fn.prototype; return bound; }; /***/ }), /* 203 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var dP = __webpack_require__(10).f; var create = __webpack_require__(51); var redefineAll = __webpack_require__(55); var ctx = __webpack_require__(28); var anInstance = __webpack_require__(48); var forOf = __webpack_require__(49); var $iterDefine = __webpack_require__(138); var step = __webpack_require__(211); var setSpecies = __webpack_require__(56); var DESCRIPTORS = __webpack_require__(9); var fastKey = __webpack_require__(44).fastKey; var validate = __webpack_require__(66); var SIZE = DESCRIPTORS ? '_s' : 'size'; var getEntry = function (that, key) { // fast case var index = fastKey(key); var entry; if (index !== 'F') return that._i[index]; // frozen object case for (entry = that._f; entry; entry = entry.n) { if (entry.k == key) return entry; } }; module.exports = { getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { var C = wrapper(function (that, iterable) { anInstance(that, C, NAME, '_i'); that._t = NAME; // collection type that._i = create(null); // index that._f = undefined; // first entry that._l = undefined; // last entry that[SIZE] = 0; // size if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.1.3.1 Map.prototype.clear() // 23.2.3.2 Set.prototype.clear() clear: function clear() { for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) { entry.r = true; if (entry.p) entry.p = entry.p.n = undefined; delete data[entry.i]; } that._f = that._l = undefined; that[SIZE] = 0; }, // 23.1.3.3 Map.prototype.delete(key) // 23.2.3.4 Set.prototype.delete(value) 'delete': function (key) { var that = validate(this, NAME); var entry = getEntry(that, key); if (entry) { var next = entry.n; var prev = entry.p; delete that._i[entry.i]; entry.r = true; if (prev) prev.n = next; if (next) next.p = prev; if (that._f == entry) that._f = next; if (that._l == entry) that._l = prev; that[SIZE]--; } return !!entry; }, // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined) // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined) forEach: function forEach(callbackfn /* , that = undefined */) { validate(this, NAME); var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); var entry; while (entry = entry ? entry.n : this._f) { f(entry.v, entry.k, this); // revert to the last existing entry while (entry && entry.r) entry = entry.p; } }, // 23.1.3.7 Map.prototype.has(key) // 23.2.3.7 Set.prototype.has(value) has: function has(key) { return !!getEntry(validate(this, NAME), key); } }); if (DESCRIPTORS) dP(C.prototype, 'size', { get: function () { return validate(this, NAME)[SIZE]; } }); return C; }, def: function (that, key, value) { var entry = getEntry(that, key); var prev, index; // change existing entry if (entry) { entry.v = value; // create new entry } else { that._l = entry = { i: index = fastKey(key, true), // <- index k: key, // <- key v: value, // <- value p: prev = that._l, // <- previous entry n: undefined, // <- next entry r: false // <- removed }; if (!that._f) that._f = entry; if (prev) prev.n = entry; that[SIZE]++; // add to index if (index !== 'F') that._i[index] = entry; } return that; }, getEntry: getEntry, setStrong: function (C, NAME, IS_MAP) { // add .keys, .values, .entries, [@@iterator] // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11 $iterDefine(C, NAME, function (iterated, kind) { this._t = validate(iterated, NAME); // target this._k = kind; // kind this._l = undefined; // previous }, function () { var that = this; var kind = that._k; var entry = that._l; // revert to the last existing entry while (entry && entry.r) entry = entry.p; // get next entry if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) { // or finish the iteration that._t = undefined; return step(1); } // return step by kind if (kind == 'keys') return step(0, entry.k); if (kind == 'values') return step(0, entry.v); return step(0, [entry.k, entry.v]); }, IS_MAP ? 'entries' : 'values', !IS_MAP, true); // add [@@species], 23.1.2.2, 23.2.2.2 setSpecies(NAME); } }; /***/ }), /* 204 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var classof = __webpack_require__(71); var from = __webpack_require__(200); module.exports = function (NAME) { return function toJSON() { if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic"); return from(this); }; }; /***/ }), /* 205 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var redefineAll = __webpack_require__(55); var getWeak = __webpack_require__(44).getWeak; var anObject = __webpack_require__(2); var isObject = __webpack_require__(5); var anInstance = __webpack_require__(48); var forOf = __webpack_require__(49); var createArrayMethod = __webpack_require__(32); var $has = __webpack_require__(18); var validate = __webpack_require__(66); var arrayFind = createArrayMethod(5); var arrayFindIndex = createArrayMethod(6); var id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (that) { return that._l || (that._l = new UncaughtFrozenStore()); }; var UncaughtFrozenStore = function () { this.a = []; }; var findUncaughtFrozen = function (store, key) { return arrayFind(store.a, function (it) { return it[0] === key; }); }; UncaughtFrozenStore.prototype = { get: function (key) { var entry = findUncaughtFrozen(this, key); if (entry) return entry[1]; }, has: function (key) { return !!findUncaughtFrozen(this, key); }, set: function (key, value) { var entry = findUncaughtFrozen(this, key); if (entry) entry[1] = value; else this.a.push([key, value]); }, 'delete': function (key) { var index = arrayFindIndex(this.a, function (it) { return it[0] === key; }); if (~index) this.a.splice(index, 1); return !!~index; } }; module.exports = { getConstructor: function (wrapper, NAME, IS_MAP, ADDER) { var C = wrapper(function (that, iterable) { anInstance(that, C, NAME, '_i'); that._t = NAME; // collection type that._i = id++; // collection id that._l = undefined; // leak store for uncaught frozen objects if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that); }); redefineAll(C.prototype, { // 23.3.3.2 WeakMap.prototype.delete(key) // 23.4.3.3 WeakSet.prototype.delete(value) 'delete': function (key) { if (!isObject(key)) return false; var data = getWeak(key); if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key); return data && $has(data, this._i) && delete data[this._i]; }, // 23.3.3.4 WeakMap.prototype.has(key) // 23.4.3.4 WeakSet.prototype.has(value) has: function has(key) { if (!isObject(key)) return false; var data = getWeak(key); if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key); return data && $has(data, this._i); } }); return C; }, def: function (that, key, value) { var data = getWeak(anObject(key), true); if (data === true) uncaughtFrozenStore(that).set(key, value); else data[that._i] = value; return that; }, ufstore: uncaughtFrozenStore }; /***/ }), /* 206 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray var isArray = __webpack_require__(91); var isObject = __webpack_require__(5); var toLength = __webpack_require__(11); var ctx = __webpack_require__(28); var IS_CONCAT_SPREADABLE = __webpack_require__(6)('isConcatSpreadable'); function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) { var targetIndex = start; var sourceIndex = 0; var mapFn = mapper ? ctx(mapper, thisArg, 3) : false; var element, spreadable; while (sourceIndex < sourceLen) { if (sourceIndex in source) { element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; spreadable = false; if (isObject(element)) { spreadable = element[IS_CONCAT_SPREADABLE]; spreadable = spreadable !== undefined ? !!spreadable : isArray(element); } if (spreadable && depth > 0) { targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; } else { if (targetIndex >= 0x1fffffffffffff) throw TypeError(); target[targetIndex] = element; } targetIndex++; } sourceIndex++; } return targetIndex; } module.exports = flattenIntoArray; /***/ }), /* 207 */ /***/ (function(module, exports, __webpack_require__) { module.exports = !__webpack_require__(9) && !__webpack_require__(4)(function () { return Object.defineProperty(__webpack_require__(131)('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), /* 208 */ /***/ (function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 module.exports = function (fn, args, that) { var un = that === undefined; switch (args.length) { case 0: return un ? fn() : fn.call(that); case 1: return un ? fn(args[0]) : fn.call(that, args[0]); case 2: return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]); case 3: return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]); case 4: return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]); } return fn.apply(that, args); }; /***/ }), /* 209 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var isObject = __webpack_require__(5); var floor = Math.floor; module.exports = function isInteger(it) { return !isObject(it) && isFinite(it) && floor(it) === it; }; /***/ }), /* 210 */ /***/ (function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error var anObject = __webpack_require__(2); module.exports = function (iterator, fn, value, entries) { try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); // 7.4.6 IteratorClose(iterator, completion) } catch (e) { var ret = iterator['return']; if (ret !== undefined) anObject(ret.call(iterator)); throw e; } }; /***/ }), /* 211 */ /***/ (function(module, exports) { module.exports = function (done, value) { return { value: value, done: !!done }; }; /***/ }), /* 212 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.16 Math.fround(x) var sign = __webpack_require__(140); var pow = Math.pow; var EPSILON = pow(2, -52); var EPSILON32 = pow(2, -23); var MAX32 = pow(2, 127) * (2 - EPSILON32); var MIN32 = pow(2, -126); var roundTiesToEven = function (n) { return n + 1 / EPSILON - 1 / EPSILON; }; module.exports = Math.fround || function fround(x) { var $abs = Math.abs(x); var $sign = sign(x); var a, result; if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32; a = (1 + EPSILON32 / EPSILON) * $abs; result = a - (a - $abs); // eslint-disable-next-line no-self-compare if (result > MAX32 || result != result) return $sign * Infinity; return $sign * result; }; /***/ }), /* 213 */ /***/ (function(module, exports) { // 20.2.2.20 Math.log1p(x) module.exports = Math.log1p || function log1p(x) { return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x); }; /***/ }), /* 214 */ /***/ (function(module, exports) { // https://rwaldron.github.io/proposal-math-extensions/ module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) { if ( arguments.length === 0 // eslint-disable-next-line no-self-compare || x != x // eslint-disable-next-line no-self-compare || inLow != inLow // eslint-disable-next-line no-self-compare || inHigh != inHigh // eslint-disable-next-line no-self-compare || outLow != outLow // eslint-disable-next-line no-self-compare || outHigh != outHigh ) return NaN; if (x === Infinity || x === -Infinity) return x; return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow; }; /***/ }), /* 215 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) var getKeys = __webpack_require__(53); var gOPS = __webpack_require__(95); var pIE = __webpack_require__(73); var toObject = __webpack_require__(14); var IObject = __webpack_require__(72); var $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) module.exports = !$assign || __webpack_require__(4)(function () { var A = {}; var B = {}; // eslint-disable-next-line no-undef var S = Symbol(); var K = 'abcdefghijklmnopqrst'; A[S] = 7; K.split('').forEach(function (k) { B[k] = k; }); return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K; }) ? function assign(target, source) { // eslint-disable-line no-unused-vars var T = toObject(target); var aLen = arguments.length; var index = 1; var getSymbols = gOPS.f; var isEnum = pIE.f; while (aLen > index) { var S = IObject(arguments[index++]); var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S); var length = keys.length; var j = 0; var key; while (length > j) if (isEnum.call(S, key = keys[j++])) T[key] = S[key]; } return T; } : $assign; /***/ }), /* 216 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(10); var anObject = __webpack_require__(2); var getKeys = __webpack_require__(53); module.exports = __webpack_require__(9) ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); var keys = getKeys(Properties); var length = keys.length; var i = 0; var P; while (length > i) dP.f(O, P = keys[i++], Properties[P]); return O; }; /***/ }), /* 217 */ /***/ (function(module, exports, __webpack_require__) { // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window var toIObject = __webpack_require__(24); var gOPN = __webpack_require__(52).f; var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return gOPN(it); } catch (e) { return windowNames.slice(); } }; module.exports.f = function getOwnPropertyNames(it) { return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it)); }; /***/ }), /* 218 */ /***/ (function(module, exports, __webpack_require__) { var has = __webpack_require__(18); var toIObject = __webpack_require__(24); var arrayIndexOf = __webpack_require__(87)(false); var IE_PROTO = __webpack_require__(144)('IE_PROTO'); module.exports = function (object, names) { var O = toIObject(object); var i = 0; var result = []; var key; for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key); // Don't enum bug & hidden keys while (names.length > i) if (has(O, key = names[i++])) { ~arrayIndexOf(result, key) || result.push(key); } return result; }; /***/ }), /* 219 */ /***/ (function(module, exports, __webpack_require__) { var getKeys = __webpack_require__(53); var toIObject = __webpack_require__(24); var isEnum = __webpack_require__(73).f; module.exports = function (isEntries) { return function (it) { var O = toIObject(it); var keys = getKeys(O); var length = keys.length; var i = 0; var result = []; var key; while (length > i) if (isEnum.call(O, key = keys[i++])) { result.push(isEntries ? [key, O[key]] : O[key]); } return result; }; }; /***/ }), /* 220 */ /***/ (function(module, exports, __webpack_require__) { // all object keys, includes non-enumerable and symbols var gOPN = __webpack_require__(52); var gOPS = __webpack_require__(95); var anObject = __webpack_require__(2); var Reflect = __webpack_require__(3).Reflect; module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) { var keys = gOPN.f(anObject(it)); var getSymbols = gOPS.f; return getSymbols ? keys.concat(getSymbols(it)) : keys; }; /***/ }), /* 221 */ /***/ (function(module, exports, __webpack_require__) { var $parseFloat = __webpack_require__(3).parseFloat; var $trim = __webpack_require__(65).trim; module.exports = 1 / $parseFloat(__webpack_require__(148) + '-0') !== -Infinity ? function parseFloat(str) { var string = $trim(String(str), 3); var result = $parseFloat(string); return result === 0 && string.charAt(0) == '-' ? -0 : result; } : $parseFloat; /***/ }), /* 222 */ /***/ (function(module, exports, __webpack_require__) { var $parseInt = __webpack_require__(3).parseInt; var $trim = __webpack_require__(65).trim; var ws = __webpack_require__(148); var hex = /^[-+]?0[xX]/; module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) { var string = $trim(String(str), 3); return $parseInt(string, (radix >>> 0) || (hex.test(string) ? 16 : 10)); } : $parseInt; /***/ }), /* 223 */ /***/ (function(module, exports) { module.exports = function (exec) { try { return { e: false, v: exec() }; } catch (e) { return { e: true, v: e }; } }; /***/ }), /* 224 */ /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(2); var isObject = __webpack_require__(5); var newPromiseCapability = __webpack_require__(142); module.exports = function (C, x) { anObject(C); if (isObject(x) && x.constructor === C) return x; var promiseCapability = newPromiseCapability.f(C); var resolve = promiseCapability.resolve; resolve(x); return promiseCapability.promise; }; /***/ }), /* 225 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-string-pad-start-end var toLength = __webpack_require__(11); var repeat = __webpack_require__(147); var defined = __webpack_require__(34); module.exports = function (that, maxLength, fillString, left) { var S = String(defined(that)); var stringLength = S.length; var fillStr = fillString === undefined ? ' ' : String(fillString); var intMaxLength = toLength(maxLength); if (intMaxLength <= stringLength || fillStr == '') return S; var fillLen = intMaxLength - stringLength; var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length)); if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); return left ? stringFiller + S : S + stringFiller; }; /***/ }), /* 226 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/ecma262/#sec-toindex var toInteger = __webpack_require__(36); var toLength = __webpack_require__(11); module.exports = function (it) { if (it === undefined) return 0; var number = toInteger(it); var length = toLength(number); if (number !== length) throw RangeError('Wrong length!'); return length; }; /***/ }), /* 227 */ /***/ (function(module, exports, __webpack_require__) { exports.f = __webpack_require__(6); /***/ }), /* 228 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var strong = __webpack_require__(203); var validate = __webpack_require__(66); var MAP = 'Map'; // 23.1 Map Objects module.exports = __webpack_require__(88)(MAP, function (get) { return function Map() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.1.3.6 Map.prototype.get(key) get: function get(key) { var entry = strong.getEntry(validate(this, MAP), key); return entry && entry.v; }, // 23.1.3.9 Map.prototype.set(key, value) set: function set(key, value) { return strong.def(validate(this, MAP), key === 0 ? 0 : key, value); } }, strong, true); /***/ }), /* 229 */ /***/ (function(module, exports, __webpack_require__) { // 21.2.5.3 get RegExp.prototype.flags() if (__webpack_require__(9) && /./g.flags != 'g') __webpack_require__(10).f(RegExp.prototype, 'flags', { configurable: true, get: __webpack_require__(90) }); /***/ }), /* 230 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var strong = __webpack_require__(203); var validate = __webpack_require__(66); var SET = 'Set'; // 23.2 Set Objects module.exports = __webpack_require__(88)(SET, function (get) { return function Set() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.2.3.1 Set.prototype.add(value) add: function add(value) { return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value); } }, strong); /***/ }), /* 231 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var each = __webpack_require__(32)(0); var redefine = __webpack_require__(20); var meta = __webpack_require__(44); var assign = __webpack_require__(215); var weak = __webpack_require__(205); var isObject = __webpack_require__(5); var fails = __webpack_require__(4); var validate = __webpack_require__(66); var WEAK_MAP = 'WeakMap'; var getWeak = meta.getWeak; var isExtensible = Object.isExtensible; var uncaughtFrozenStore = weak.ufstore; var tmp = {}; var InternalMap; var wrapper = function (get) { return function WeakMap() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }; var methods = { // 23.3.3.3 WeakMap.prototype.get(key) get: function get(key) { if (isObject(key)) { var data = getWeak(key); if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key); return data ? data[this._i] : undefined; } }, // 23.3.3.5 WeakMap.prototype.set(key, value) set: function set(key, value) { return weak.def(validate(this, WEAK_MAP), key, value); } }; // 23.3 WeakMap Objects var $WeakMap = module.exports = __webpack_require__(88)(WEAK_MAP, wrapper, methods, weak, true, true); // IE11 WeakMap frozen keys fix if (fails(function () { return new $WeakMap().set((Object.freeze || Object)(tmp), 7).get(tmp) != 7; })) { InternalMap = weak.getConstructor(wrapper, WEAK_MAP); assign(InternalMap.prototype, methods); meta.NEED = true; each(['delete', 'has', 'get', 'set'], function (key) { var proto = $WeakMap.prototype; var method = proto[key]; redefine(proto, key, function (a, b) { // store frozen objects on internal weakmap shim if (isObject(a) && !isExtensible(a)) { if (!this._f) this._f = new InternalMap(); var result = this._f[key](a, b); return key == 'set' ? this : result; // store all the rest on native weakmap } return method.call(this, a, b); }); }); } /***/ }), /* 232 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = earcut; module.exports.default = earcut; function earcut(data, holeIndices, dim) { dim = dim || 2; var hasHoles = holeIndices && holeIndices.length, outerLen = hasHoles ? holeIndices[0] * dim : data.length, outerNode = linkedList(data, 0, outerLen, dim, true), triangles = []; if (!outerNode) return triangles; var minX, minY, maxX, maxY, x, y, invSize; if (hasHoles) outerNode = eliminateHoles(data, holeIndices, outerNode, dim); // if the shape is not too simple, we'll use z-order curve hash later; calculate polygon bbox if (data.length > 80 * dim) { minX = maxX = data[0]; minY = maxY = data[1]; for (var i = dim; i < outerLen; i += dim) { x = data[i]; y = data[i + 1]; if (x < minX) minX = x; if (y < minY) minY = y; if (x > maxX) maxX = x; if (y > maxY) maxY = y; } // minX, minY and invSize are later used to transform coords into integers for z-order calculation invSize = Math.max(maxX - minX, maxY - minY); invSize = invSize !== 0 ? 1 / invSize : 0; } earcutLinked(outerNode, triangles, dim, minX, minY, invSize); return triangles; } // create a circular doubly linked list from polygon points in the specified winding order function linkedList(data, start, end, dim, clockwise) { var i, last; if (clockwise === (signedArea(data, start, end, dim) > 0)) { for (i = start; i < end; i += dim) last = insertNode(i, data[i], data[i + 1], last); } else { for (i = end - dim; i >= start; i -= dim) last = insertNode(i, data[i], data[i + 1], last); } if (last && equals(last, last.next)) { removeNode(last); last = last.next; } return last; } // eliminate colinear or duplicate points function filterPoints(start, end) { if (!start) return start; if (!end) end = start; var p = start, again; do { again = false; if (!p.steiner && (equals(p, p.next) || area(p.prev, p, p.next) === 0)) { removeNode(p); p = end = p.prev; if (p === p.next) break; again = true; } else { p = p.next; } } while (again || p !== end); return end; } // main ear slicing loop which triangulates a polygon (given as a linked list) function earcutLinked(ear, triangles, dim, minX, minY, invSize, pass) { if (!ear) return; // interlink polygon nodes in z-order if (!pass && invSize) indexCurve(ear, minX, minY, invSize); var stop = ear, prev, next; // iterate through ears, slicing them one by one while (ear.prev !== ear.next) { prev = ear.prev; next = ear.next; if (invSize ? isEarHashed(ear, minX, minY, invSize) : isEar(ear)) { // cut off the triangle triangles.push(prev.i / dim); triangles.push(ear.i / dim); triangles.push(next.i / dim); removeNode(ear); // skipping the next vertice leads to less sliver triangles ear = next.next; stop = next.next; continue; } ear = next; // if we looped through the whole remaining polygon and can't find any more ears if (ear === stop) { // try filtering points and slicing again if (!pass) { earcutLinked(filterPoints(ear), triangles, dim, minX, minY, invSize, 1); // if this didn't work, try curing all small self-intersections locally } else if (pass === 1) { ear = cureLocalIntersections(ear, triangles, dim); earcutLinked(ear, triangles, dim, minX, minY, invSize, 2); // as a last resort, try splitting the remaining polygon into two } else if (pass === 2) { splitEarcut(ear, triangles, dim, minX, minY, invSize); } break; } } } // check whether a polygon node forms a valid ear with adjacent nodes function isEar(ear) { var a = ear.prev, b = ear, c = ear.next; if (area(a, b, c) >= 0) return false; // reflex, can't be an ear // now make sure we don't have other points inside the potential ear var p = ear.next.next; while (p !== ear.prev) { if (pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.next; } return true; } function isEarHashed(ear, minX, minY, invSize) { var a = ear.prev, b = ear, c = ear.next; if (area(a, b, c) >= 0) return false; // reflex, can't be an ear // triangle bbox; min & max are calculated like this for speed var minTX = a.x < b.x ? (a.x < c.x ? a.x : c.x) : (b.x < c.x ? b.x : c.x), minTY = a.y < b.y ? (a.y < c.y ? a.y : c.y) : (b.y < c.y ? b.y : c.y), maxTX = a.x > b.x ? (a.x > c.x ? a.x : c.x) : (b.x > c.x ? b.x : c.x), maxTY = a.y > b.y ? (a.y > c.y ? a.y : c.y) : (b.y > c.y ? b.y : c.y); // z-order range for the current triangle bbox; var minZ = zOrder(minTX, minTY, minX, minY, invSize), maxZ = zOrder(maxTX, maxTY, minX, minY, invSize); var p = ear.prevZ, n = ear.nextZ; // look for points inside the triangle in both directions while (p && p.z >= minZ && n && n.z <= maxZ) { if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.prevZ; if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; n = n.nextZ; } // look for remaining points in decreasing z-order while (p && p.z >= minZ) { if (p !== ear.prev && p !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, p.x, p.y) && area(p.prev, p, p.next) >= 0) return false; p = p.prevZ; } // look for remaining points in increasing z-order while (n && n.z <= maxZ) { if (n !== ear.prev && n !== ear.next && pointInTriangle(a.x, a.y, b.x, b.y, c.x, c.y, n.x, n.y) && area(n.prev, n, n.next) >= 0) return false; n = n.nextZ; } return true; } // go through all polygon nodes and cure small local self-intersections function cureLocalIntersections(start, triangles, dim) { var p = start; do { var a = p.prev, b = p.next.next; if (!equals(a, b) && intersects(a, p, p.next, b) && locallyInside(a, b) && locallyInside(b, a)) { triangles.push(a.i / dim); triangles.push(p.i / dim); triangles.push(b.i / dim); // remove two nodes involved removeNode(p); removeNode(p.next); p = start = b; } p = p.next; } while (p !== start); return p; } // try splitting polygon into two and triangulate them independently function splitEarcut(start, triangles, dim, minX, minY, invSize) { // look for a valid diagonal that divides the polygon into two var a = start; do { var b = a.next.next; while (b !== a.prev) { if (a.i !== b.i && isValidDiagonal(a, b)) { // split the polygon in two by the diagonal var c = splitPolygon(a, b); // filter colinear points around the cuts a = filterPoints(a, a.next); c = filterPoints(c, c.next); // run earcut on each half earcutLinked(a, triangles, dim, minX, minY, invSize); earcutLinked(c, triangles, dim, minX, minY, invSize); return; } b = b.next; } a = a.next; } while (a !== start); } // link every hole into the outer loop, producing a single-ring polygon without holes function eliminateHoles(data, holeIndices, outerNode, dim) { var queue = [], i, len, start, end, list; for (i = 0, len = holeIndices.length; i < len; i++) { start = holeIndices[i] * dim; end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; list = linkedList(data, start, end, dim, false); if (list === list.next) list.steiner = true; queue.push(getLeftmost(list)); } queue.sort(compareX); // process holes from left to right for (i = 0; i < queue.length; i++) { eliminateHole(queue[i], outerNode); outerNode = filterPoints(outerNode, outerNode.next); } return outerNode; } function compareX(a, b) { return a.x - b.x; } // find a bridge between vertices that connects hole with an outer ring and and link it function eliminateHole(hole, outerNode) { outerNode = findHoleBridge(hole, outerNode); if (outerNode) { var b = splitPolygon(outerNode, hole); filterPoints(b, b.next); } } // David Eberly's algorithm for finding a bridge between hole and outer polygon function findHoleBridge(hole, outerNode) { var p = outerNode, hx = hole.x, hy = hole.y, qx = -Infinity, m; // find a segment intersected by a ray from the hole's leftmost point to the left; // segment's endpoint with lesser x will be potential connection point do { if (hy <= p.y && hy >= p.next.y && p.next.y !== p.y) { var x = p.x + (hy - p.y) * (p.next.x - p.x) / (p.next.y - p.y); if (x <= hx && x > qx) { qx = x; if (x === hx) { if (hy === p.y) return p; if (hy === p.next.y) return p.next; } m = p.x < p.next.x ? p : p.next; } } p = p.next; } while (p !== outerNode); if (!m) return null; if (hx === qx) return m.prev; // hole touches outer segment; pick lower endpoint // look for points inside the triangle of hole point, segment intersection and endpoint; // if there are no points found, we have a valid connection; // otherwise choose the point of the minimum angle with the ray as connection point var stop = m, mx = m.x, my = m.y, tanMin = Infinity, tan; p = m.next; while (p !== stop) { if (hx >= p.x && p.x >= mx && hx !== p.x && pointInTriangle(hy < my ? hx : qx, hy, mx, my, hy < my ? qx : hx, hy, p.x, p.y)) { tan = Math.abs(hy - p.y) / (hx - p.x); // tangential if ((tan < tanMin || (tan === tanMin && p.x > m.x)) && locallyInside(p, hole)) { m = p; tanMin = tan; } } p = p.next; } return m; } // interlink polygon nodes in z-order function indexCurve(start, minX, minY, invSize) { var p = start; do { if (p.z === null) p.z = zOrder(p.x, p.y, minX, minY, invSize); p.prevZ = p.prev; p.nextZ = p.next; p = p.next; } while (p !== start); p.prevZ.nextZ = null; p.prevZ = null; sortLinked(p); } // Simon Tatham's linked list merge sort algorithm // http://www.chiark.greenend.org.uk/~sgtatham/algorithms/listsort.html function sortLinked(list) { var i, p, q, e, tail, numMerges, pSize, qSize, inSize = 1; do { p = list; list = null; tail = null; numMerges = 0; while (p) { numMerges++; q = p; pSize = 0; for (i = 0; i < inSize; i++) { pSize++; q = q.nextZ; if (!q) break; } qSize = inSize; while (pSize > 0 || (qSize > 0 && q)) { if (pSize !== 0 && (qSize === 0 || !q || p.z <= q.z)) { e = p; p = p.nextZ; pSize--; } else { e = q; q = q.nextZ; qSize--; } if (tail) tail.nextZ = e; else list = e; e.prevZ = tail; tail = e; } p = q; } tail.nextZ = null; inSize *= 2; } while (numMerges > 1); return list; } // z-order of a point given coords and inverse of the longer side of data bbox function zOrder(x, y, minX, minY, invSize) { // coords are transformed into non-negative 15-bit integer range x = 32767 * (x - minX) * invSize; y = 32767 * (y - minY) * invSize; x = (x | (x << 8)) & 0x00FF00FF; x = (x | (x << 4)) & 0x0F0F0F0F; x = (x | (x << 2)) & 0x33333333; x = (x | (x << 1)) & 0x55555555; y = (y | (y << 8)) & 0x00FF00FF; y = (y | (y << 4)) & 0x0F0F0F0F; y = (y | (y << 2)) & 0x33333333; y = (y | (y << 1)) & 0x55555555; return x | (y << 1); } // find the leftmost node of a polygon ring function getLeftmost(start) { var p = start, leftmost = start; do { if (p.x < leftmost.x) leftmost = p; p = p.next; } while (p !== start); return leftmost; } // check if a point lies within a convex triangle function pointInTriangle(ax, ay, bx, by, cx, cy, px, py) { return (cx - px) * (ay - py) - (ax - px) * (cy - py) >= 0 && (ax - px) * (by - py) - (bx - px) * (ay - py) >= 0 && (bx - px) * (cy - py) - (cx - px) * (by - py) >= 0; } // check if a diagonal between two polygon nodes is valid (lies in polygon interior) function isValidDiagonal(a, b) { return a.next.i !== b.i && a.prev.i !== b.i && !intersectsPolygon(a, b) && locallyInside(a, b) && locallyInside(b, a) && middleInside(a, b); } // signed area of a triangle function area(p, q, r) { return (q.y - p.y) * (r.x - q.x) - (q.x - p.x) * (r.y - q.y); } // check if two points are equal function equals(p1, p2) { return p1.x === p2.x && p1.y === p2.y; } // check if two segments intersect function intersects(p1, q1, p2, q2) { if ((equals(p1, q1) && equals(p2, q2)) || (equals(p1, q2) && equals(p2, q1))) return true; return area(p1, q1, p2) > 0 !== area(p1, q1, q2) > 0 && area(p2, q2, p1) > 0 !== area(p2, q2, q1) > 0; } // check if a polygon diagonal intersects any polygon segments function intersectsPolygon(a, b) { var p = a; do { if (p.i !== a.i && p.next.i !== a.i && p.i !== b.i && p.next.i !== b.i && intersects(p, p.next, a, b)) return true; p = p.next; } while (p !== a); return false; } // check if a polygon diagonal is locally inside the polygon function locallyInside(a, b) { return area(a.prev, a, a.next) < 0 ? area(a, b, a.next) >= 0 && area(a, a.prev, b) >= 0 : area(a, b, a.prev) < 0 || area(a, a.next, b) < 0; } // check if the middle point of a polygon diagonal is inside the polygon function middleInside(a, b) { var p = a, inside = false, px = (a.x + b.x) / 2, py = (a.y + b.y) / 2; do { if (((p.y > py) !== (p.next.y > py)) && p.next.y !== p.y && (px < (p.next.x - p.x) * (py - p.y) / (p.next.y - p.y) + p.x)) inside = !inside; p = p.next; } while (p !== a); return inside; } // link two polygon vertices with a bridge; if the vertices belong to the same ring, it splits polygon into two; // if one belongs to the outer ring and another to a hole, it merges it into a single ring function splitPolygon(a, b) { var a2 = new Node(a.i, a.x, a.y), b2 = new Node(b.i, b.x, b.y), an = a.next, bp = b.prev; a.next = b; b.prev = a; a2.next = an; an.prev = a2; b2.next = a2; a2.prev = b2; bp.next = b2; b2.prev = bp; return b2; } // create a node and optionally link it with previous one (in a circular doubly linked list) function insertNode(i, x, y, last) { var p = new Node(i, x, y); if (!last) { p.prev = p; p.next = p; } else { p.next = last.next; p.prev = last; last.next.prev = p; last.next = p; } return p; } function removeNode(p) { p.next.prev = p.prev; p.prev.next = p.next; if (p.prevZ) p.prevZ.nextZ = p.nextZ; if (p.nextZ) p.nextZ.prevZ = p.prevZ; } function Node(i, x, y) { // vertice index in coordinates array this.i = i; // vertex coordinates this.x = x; this.y = y; // previous and next vertice nodes in a polygon ring this.prev = null; this.next = null; // z-order curve value this.z = null; // previous and next nodes in z-order this.prevZ = null; this.nextZ = null; // indicates whether this is a steiner point this.steiner = false; } // return a percentage difference between the polygon area and its triangulation area; // used to verify correctness of triangulation earcut.deviation = function (data, holeIndices, dim, triangles) { var hasHoles = holeIndices && holeIndices.length; var outerLen = hasHoles ? holeIndices[0] * dim : data.length; var polygonArea = Math.abs(signedArea(data, 0, outerLen, dim)); if (hasHoles) { for (var i = 0, len = holeIndices.length; i < len; i++) { var start = holeIndices[i] * dim; var end = i < len - 1 ? holeIndices[i + 1] * dim : data.length; polygonArea -= Math.abs(signedArea(data, start, end, dim)); } } var trianglesArea = 0; for (i = 0; i < triangles.length; i += 3) { var a = triangles[i] * dim; var b = triangles[i + 1] * dim; var c = triangles[i + 2] * dim; trianglesArea += Math.abs( (data[a] - data[c]) * (data[b + 1] - data[a + 1]) - (data[a] - data[b]) * (data[c + 1] - data[a + 1])); } return polygonArea === 0 && trianglesArea === 0 ? 0 : Math.abs((trianglesArea - polygonArea) / polygonArea); }; function signedArea(data, start, end, dim) { var sum = 0; for (var i = start, j = end - dim; i < end; i += dim) { sum += (data[j] - data[i]) * (data[i + 1] + data[j + 1]); j = i; } return sum; } // turn a polygon in a multi-dimensional array form (e.g. as in GeoJSON) into a form Earcut accepts earcut.flatten = function (data) { var dim = data[0][0].length, result = {vertices: [], holes: [], dimensions: dim}, holeIndex = 0; for (var i = 0; i < data.length; i++) { for (var j = 0; j < data[i].length; j++) { for (var d = 0; d < dim; d++) result.vertices.push(data[i][j][d]); } if (i > 0) { holeIndex += data[i - 1].length; result.holes.push(holeIndex); } } return result; }; /***/ }), /* 233 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ var emptyObject = {}; if (process.env.NODE_ENV !== 'production') { Object.freeze(emptyObject); } module.exports = emptyObject; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26))) /***/ }), /* 234 */ /***/ (function(module, exports) { module.exports = ortho; /** * Generates a orthogonal projection matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {number} left Left bound of the frustum * @param {number} right Right bound of the frustum * @param {number} bottom Bottom bound of the frustum * @param {number} top Top bound of the frustum * @param {number} near Near bound of the frustum * @param {number} far Far bound of the frustum * @returns {mat4} out */ function ortho(out, left, right, bottom, top, near, far) { var lr = 1 / (left - right), bt = 1 / (bottom - top), nf = 1 / (near - far); out[0] = -2 * lr; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = -2 * bt; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 2 * nf; out[11] = 0; out[12] = (left + right) * lr; out[13] = (top + bottom) * bt; out[14] = (far + near) * nf; out[15] = 1; return out; }; /***/ }), /* 235 */ /***/ (function(module, exports) { module.exports = rotateY; /** * Rotates a matrix by the given angle around the Y axis * * @param {mat4} out the receiving matrix * @param {mat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @returns {mat4} out */ function rotateY(out, a, rad) { var s = Math.sin(rad), c = Math.cos(rad), a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11]; if (a !== out) { // If the source and destination differ, copy the unchanged rows out[4] = a[4]; out[5] = a[5]; out[6] = a[6]; out[7] = a[7]; out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } // Perform axis-specific matrix multiplication out[0] = a00 * c - a20 * s; out[1] = a01 * c - a21 * s; out[2] = a02 * c - a22 * s; out[3] = a03 * c - a23 * s; out[8] = a00 * s + a20 * c; out[9] = a01 * s + a21 * c; out[10] = a02 * s + a22 * c; out[11] = a03 * s + a23 * c; return out; }; /***/ }), /* 236 */ /***/ (function(module, exports, __webpack_require__) { /** * Normalize a quat * * @param {quat} out the receiving quaternion * @param {quat} a quaternion to normalize * @returns {quat} out * @function */ module.exports = __webpack_require__(247) /***/ }), /* 237 */ /***/ (function(module, exports) { module.exports = setAxisAngle /** * Sets a quat from the given angle and rotation axis, * then returns it. * * @param {quat} out the receiving quaternion * @param {vec3} axis the axis around which to rotate * @param {Number} rad the angle in radians * @returns {quat} out **/ function setAxisAngle (out, axis, rad) { rad = rad * 0.5 var s = Math.sin(rad) out[0] = s * axis[0] out[1] = s * axis[1] out[2] = s * axis[2] out[3] = Math.cos(rad) return out } /***/ }), /* 238 */ /***/ (function(module, exports) { module.exports = lerp /** * Performs a linear interpolation between two vec2's * * @param {vec2} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @param {Number} t interpolation amount between the two inputs * @returns {vec2} out */ function lerp(out, a, b, t) { var ax = a[0], ay = a[1] out[0] = ax + t * (b[0] - ax) out[1] = ay + t * (b[1] - ay) return out } /***/ }), /* 239 */ /***/ (function(module, exports) { module.exports = cross; /** * Computes the cross product of two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ function cross(out, a, b) { var ax = a[0], ay = a[1], az = a[2], bx = b[0], by = b[1], bz = b[2] out[0] = ay * bz - az * by out[1] = az * bx - ax * bz out[2] = ax * by - ay * bx return out } /***/ }), /* 240 */ /***/ (function(module, exports) { module.exports = dot; /** * Calculates the dot product of two vec3's * * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {Number} dot product of a and b */ function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] } /***/ }), /* 241 */ /***/ (function(module, exports) { module.exports = length; /** * Calculates the length of a vec3 * * @param {vec3} a vector to calculate length of * @returns {Number} length of a */ function length(a) { var x = a[0], y = a[1], z = a[2] return Math.sqrt(x*x + y*y + z*z) } /***/ }), /* 242 */ /***/ (function(module, exports) { module.exports = normalize; /** * Normalize a vec3 * * @param {vec3} out the receiving vector * @param {vec3} a vector to normalize * @returns {vec3} out */ function normalize(out, a) { var x = a[0], y = a[1], z = a[2] var len = x*x + y*y + z*z if (len > 0) { //TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len) out[0] = a[0] * len out[1] = a[1] * len out[2] = a[2] * len } return out } /***/ }), /* 243 */ /***/ (function(module, exports) { module.exports = add /** * Adds two vec4's * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {vec4} out */ function add (out, a, b) { out[0] = a[0] + b[0] out[1] = a[1] + b[1] out[2] = a[2] + b[2] out[3] = a[3] + b[3] return out } /***/ }), /* 244 */ /***/ (function(module, exports) { module.exports = dot /** * Calculates the dot product of two vec4's * * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {Number} dot product of a and b */ function dot (a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3] } /***/ }), /* 245 */ /***/ (function(module, exports) { module.exports = lerp /** * Performs a linear interpolation between two vec4's * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @param {Number} t interpolation amount between the two inputs * @returns {vec4} out */ function lerp (out, a, b, t) { var ax = a[0], ay = a[1], az = a[2], aw = a[3] out[0] = ax + t * (b[0] - ax) out[1] = ay + t * (b[1] - ay) out[2] = az + t * (b[2] - az) out[3] = aw + t * (b[3] - aw) return out } /***/ }), /* 246 */ /***/ (function(module, exports) { module.exports = multiply /** * Multiplies two vec4's * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {vec4} out */ function multiply (out, a, b) { out[0] = a[0] * b[0] out[1] = a[1] * b[1] out[2] = a[2] * b[2] out[3] = a[3] * b[3] return out } /***/ }), /* 247 */ /***/ (function(module, exports) { module.exports = normalize /** * Normalize a vec4 * * @param {vec4} out the receiving vector * @param {vec4} a vector to normalize * @returns {vec4} out */ function normalize (out, a) { var x = a[0], y = a[1], z = a[2], w = a[3] var len = x * x + y * y + z * z + w * w if (len > 0) { len = 1 / Math.sqrt(len) out[0] = x * len out[1] = y * len out[2] = z * len out[3] = w * len } return out } /***/ }), /* 248 */ /***/ (function(module, exports) { module.exports = set /** * Set the components of a vec4 to the given values * * @param {vec4} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @param {Number} w W component * @returns {vec4} out */ function set (out, x, y, z, w) { out[0] = x out[1] = y out[2] = z out[3] = w return out } /***/ }), /* 249 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = requestAnimationFrame; /* harmony export (immutable) */ __webpack_exports__["c"] = cancelAnimationFrame; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_utils__ = __webpack_require__(60); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__webgl__ = __webpack_require__(61); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /* global window, setTimeout, clearTimeout */ // Node.js polyfills for requestAnimationFrame and cancelAnimationFrame function requestAnimationFrame(callback) { return __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* isBrowser */] ? window.requestAnimationFrame(callback) : setTimeout(callback, 1000 / 60); } function cancelAnimationFrame(timerId) { return __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* isBrowser */] ? window.cancelAnimationFrame(timerId) : clearTimeout(timerId); } var DEFAULT_GL_OPTIONS = { preserveDrawingBuffer: true }; var AnimationLoop = /*#__PURE__*/function () { /* * @param {HTMLCanvasElement} canvas - if provided, width and height will be passed to context */ function AnimationLoop() { var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, AnimationLoop); var _props$onCreateContex = props.onCreateContext, onCreateContext = _props$onCreateContex === undefined ? function (opts) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__webgl__["createGLContext"])(opts); } : _props$onCreateContex, _props$onInitialize = props.onInitialize, onInitialize = _props$onInitialize === undefined ? function () {} : _props$onInitialize, _props$onRender = props.onRender, onRender = _props$onRender === undefined ? function () {} : _props$onRender, _props$onFinalize = props.onFinalize, onFinalize = _props$onFinalize === undefined ? function () {} : _props$onFinalize, _props$gl = props.gl, gl = _props$gl === undefined ? null : _props$gl, _props$glOptions = props.glOptions, glOptions = _props$glOptions === undefined ? {} : _props$glOptions, _props$width = props.width, width = _props$width === undefined ? null : _props$width, _props$height = props.height, height = _props$height === undefined ? null : _props$height, _props$createFramebuf = props.createFramebuffer, createFramebuffer = _props$createFramebuf === undefined ? false : _props$createFramebuf, _props$autoResizeView = props.autoResizeViewport, autoResizeViewport = _props$autoResizeView === undefined ? true : _props$autoResizeView, _props$autoResizeDraw = props.autoResizeDrawingBuffer, autoResizeDrawingBuffer = _props$autoResizeDraw === undefined ? true : _props$autoResizeDraw; var _props$useDevicePixel = props.useDevicePixels, useDevicePixels = _props$useDevicePixel === undefined ? true : _props$useDevicePixel; //iclient var _props$isGeographicCoordinateSystem = props.isGeographicCoordinateSystem, isGeographicCoordinateSystem = _props$isGeographicCoordinateSystem === undefined ? false : _props$isGeographicCoordinateSystem; this.isGeographicCoordinateSystem=isGeographicCoordinateSystem; if ('useDevicePixelRatio' in props) { __WEBPACK_IMPORTED_MODULE_0__utils__["b" /* log */].deprecated('useDevicePixelRatio', 'useDevicePixels'); useDevicePixels = props.useDevicePixelRatio; } this._onCreateContext = onCreateContext; this.start = this.start.bind(this); this.stop = this.stop.bind(this); this._renderFrame = this._renderFrame.bind(this); this.glOptions = glOptions; this._createFramebuffer = createFramebuffer; this._onInitialize = onInitialize; this._onRender = onRender; this._onFinalize = onFinalize; this.width = width; this.height = height; this.gl = gl; this.setProps({ autoResizeViewport: autoResizeViewport, autoResizeDrawingBuffer: autoResizeDrawingBuffer, useDevicePixels: useDevicePixels }); return this; } _createClass(AnimationLoop, [{ key: 'setNeedsRedraw', value: function setNeedsRedraw(reason) { this.needsRedraw = this.needsRedraw || reason; return this; } }, { key: 'setProps', value: function setProps(props) { if ('autoResizeViewport' in props) { this.autoResizeViewport = props.autoResizeViewport; } if ('autoResizeDrawingBuffer' in props) { this.autoResizeDrawingBuffer = props.autoResizeDrawingBuffer; } if ('useDevicePixels' in props) { this.useDevicePixels = props.useDevicePixels; } return this; } // Starts a render loop if not already running // @param {Object} context - contains frame specific info (E.g. tick, width, height, etc) }, { key: 'start', value: function start() { var _this = this; var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this._stopped = false; // console.debug(`Starting ${this.constructor.name}`); if (!this._animationFrameId) { // Wait for start promise before rendering frame this._startPromise = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils__["g" /* getPageLoadPromise */])().then(function () { if (_this._stopped) { return null; } // Create the WebGL context _this._createWebGLContext(opts); // Initialize the callback data _this._initializeCallbackData(); _this._updateCallbackData(); // Default viewport setup, in case onInitialize wants to render _this._resizeCanvasDrawingBuffer(); _this._resizeViewport(); // Note: onIntialize can return a promise (in case it needs to load resources) return _this._onInitialize(_this._callbackData); }).then(function (appContext) { if (!_this._stopped) { _this._addCallbackData(appContext || {}); if (appContext !== false && !_this._animationFrameId) { _this._animationFrameId = requestAnimationFrame(_this._renderFrame); } } }); } return this; } // Stops a render loop if already running, finalizing }, { key: 'stop', value: function stop() { // console.debug(`Stopping ${this.constructor.name}`); if (this._animationFrameId) { this._finalizeCallbackData(); cancelAnimationFrame(this._animationFrameId); this._animationFrameId = null; this._stopped = true; } return this; } // DEPRECATED METHODS // Update parameters }, { key: 'setViewParameters', value: function setViewParameters(_ref) { var _ref$autoResizeDrawin = _ref.autoResizeDrawingBuffer, autoResizeDrawingBuffer = _ref$autoResizeDrawin === undefined ? true : _ref$autoResizeDrawin, _ref$autoResizeCanvas = _ref.autoResizeCanvas, autoResizeCanvas = _ref$autoResizeCanvas === undefined ? true : _ref$autoResizeCanvas, _ref$autoResizeViewpo = _ref.autoResizeViewport, autoResizeViewport = _ref$autoResizeViewpo === undefined ? true : _ref$autoResizeViewpo, _ref$useDevicePixels = _ref.useDevicePixels, useDevicePixels = _ref$useDevicePixels === undefined ? true : _ref$useDevicePixels, _ref$useDevicePixelRa = _ref.useDevicePixelRatio, useDevicePixelRatio = _ref$useDevicePixelRa === undefined ? null : _ref$useDevicePixelRa; __WEBPACK_IMPORTED_MODULE_0__utils__["b" /* log */].deprecated('AnimationLoop.setViewParameters', 'AnimationLoop.setProps'); this.autoResizeViewport = autoResizeViewport; this.autoResizeCanvas = autoResizeCanvas; this.autoResizeDrawingBuffer = autoResizeDrawingBuffer; this.useDevicePixels = useDevicePixels; if (useDevicePixelRatio !== null) { __WEBPACK_IMPORTED_MODULE_0__utils__["b" /* log */].deprecated('useDevicePixelRatio', 'useDevicePixels'); this.useDevicePixels = useDevicePixelRatio; } return this; } // PRIVATE METHODS }, { key: '_setupFrame', value: function _setupFrame() { if (this._onSetupFrame) { // call callback this._onSetupFrame(this._callbackData); // end callback } else { this._resizeCanvasDrawingBuffer(); this._resizeViewport(); this._resizeFramebuffer(); } } /** * @private * Handles a render loop frame- updates context and calls the application * callback */ }, { key: '_renderFrame', value: function _renderFrame() { this._setupFrame(); this._updateCallbackData(); // call callback this._onRender(this._callbackData); // end callback // Increment tick this._callbackData.tick++; if (!this._stopped) { // Request another render frame (now ) this._animationFrameId = requestAnimationFrame(this._renderFrame); } } // Initialize the object that will be passed to app callbacks }, { key: '_initializeCallbackData', value: function _initializeCallbackData() { this._callbackData = { gl: this.gl, canvas: this.gl.canvas, framebuffer: this.framebuffer, stop: this.stop, // Initial values tick: 0, tock: 0, //iclient isGeographicCoordinateSystem:this.isGeographicCoordinateSystem, useDevicePixels: this.useDevicePixels }; } // Update the context object that will be passed to app callbacks }, { key: '_updateCallbackData', value: function _updateCallbackData() { // CallbackData width and height represent drawing buffer width and height var canvas = this.gl.canvas; this._callbackData.width = canvas.width; this._callbackData.height = canvas.height; this._callbackData.aspect = canvas.width / canvas.height; } }, { key: '_finalizeCallbackData', value: function _finalizeCallbackData() { // call callback this._onFinalize(this._callbackData); // end callback } // Add application's data to the app context object }, { key: '_addCallbackData', value: function _addCallbackData(appContext) { if ((typeof appContext === 'undefined' ? 'undefined' : _typeof(appContext)) === 'object' && appContext !== null) { this._callbackData = Object.assign({}, this._callbackData, appContext); } } // Either uses supplied or existing context, or calls provided callback to create one }, { key: '_createWebGLContext', value: function _createWebGLContext(opts) { // Create the WebGL context if necessary opts = Object.assign({}, opts, DEFAULT_GL_OPTIONS, this.glOptions); if (opts.gl) { this.gl = opts.gl; } else { this.gl = this._onCreateContext(opts); } if (!__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__webgl__["isWebGL"])(this.gl)) { throw new Error('AnimationLoop.onCreateContext - illegal context returned'); } // Setup default framebuffer if (this._createFramebuffer) { this.framebuffer = new __WEBPACK_IMPORTED_MODULE_2__webgl__["Framebuffer"](this.gl); } // Reset the WebGL context. __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__webgl__["resetParameters"])(this.gl); } // Default viewport setup }, { key: '_resizeViewport', value: function _resizeViewport() { if (this.autoResizeViewport) { this.gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height); } } }, { key: '_resizeFramebuffer', value: function _resizeFramebuffer() { if (this.framebuffer) { this.framebuffer.resize({ width: this.gl.canvas.width, height: this.gl.canvas.height }); } } // Resize the render buffer of the canvas to match canvas client size // Optionally multiplying with devicePixel ratio }, { key: '_resizeCanvasDrawingBuffer', value: function _resizeCanvasDrawingBuffer() { if (this.autoResizeDrawingBuffer) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_utils__["h" /* resizeDrawingBuffer */])(this.gl.canvas, { useDevicePixels: this.useDevicePixels }); } } }]); return AnimationLoop; }(); /* harmony default export */ __webpack_exports__["a"] = (AnimationLoop); //# sourceMappingURL=animation-loop.js.map /***/ }), /* 250 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_math_gl__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Object3D = /*#__PURE__*/function () { function Object3D(_ref) { var id = _ref.id, _ref$display = _ref.display, display = _ref$display === undefined ? true : _ref$display; _classCallCheck(this, Object3D); // model position, rotation, scale and all in all matrix this.position = new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Vector3"](); this.rotation = new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Vector3"](); this.scale = new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Vector3"](1, 1, 1); this.matrix = new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Matrix4"](); // whether to display the object at all this.id = id || __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__utils__["d" /* uid */])(this.constructor.name); this.display = true; this.userData = {}; } _createClass(Object3D, [{ key: 'setPosition', value: function setPosition(position) { __WEBPACK_IMPORTED_MODULE_2_assert___default()(position.length === 3, 'setPosition requires vector argument'); this.position = position; return this; } }, { key: 'setRotation', value: function setRotation(rotation) { __WEBPACK_IMPORTED_MODULE_2_assert___default()(rotation.length === 3, 'setRotation requires vector argument'); this.rotation = rotation; return this; } }, { key: 'setScale', value: function setScale(scale) { __WEBPACK_IMPORTED_MODULE_2_assert___default()(scale.length === 3, 'setScale requires vector argument'); this.scale = scale; return this; } }, { key: 'setMatrixComponents', value: function setMatrixComponents(_ref2) { var position = _ref2.position, rotation = _ref2.rotation, scale = _ref2.scale, _ref2$update = _ref2.update, update = _ref2$update === undefined ? true : _ref2$update; if (position) { this.setPosition(position); } if (rotation) { this.setRotation(rotation); } if (scale) { this.setScale(scale); } if (update) { this.updateMatrix(); } return this; } }, { key: 'updateMatrix', value: function updateMatrix() { var pos = this.position; var rot = this.rotation; var scale = this.scale; this.matrix.identity(); this.matrix.translate(pos); this.matrix.rotateXYZ(rot); this.matrix.scale(scale); return this; } }, { key: 'update', value: function update() { var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, position = _ref3.position, rotation = _ref3.rotation, scale = _ref3.scale; if (position) { this.setPosition(position); } if (rotation) { this.setRotation(rotation); } if (scale) { this.setScale(scale); } this.updateMatrix(); return this; } }, { key: 'getCoordinateUniforms', value: function getCoordinateUniforms(viewMatrix, modelMatrix) { // TODO - solve multiple class problem // assert(viewMatrix instanceof Matrix4); __WEBPACK_IMPORTED_MODULE_2_assert___default()(viewMatrix); modelMatrix = modelMatrix || this.matrix; var worldMatrix = new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Matrix4"](viewMatrix).multiplyRight(modelMatrix); var worldInverse = worldMatrix.invert(); var worldInverseTranspose = worldInverse.transpose(); return { viewMatrix: viewMatrix, modelMatrix: modelMatrix, objectMatrix: modelMatrix, worldMatrix: worldMatrix, worldInverseMatrix: worldInverse, worldInverseTransposeMatrix: worldInverseTranspose }; } // TODO - copied code, not yet vetted }, { key: 'transform', value: function transform() { if (!this.parent) { this.endPosition.set(this.position); this.endRotation.set(this.rotation); this.endScale.set(this.scale); } else { var parent = this.parent; this.endPosition.set(this.position.add(parent.endPosition)); this.endRotation.set(this.rotation.add(parent.endRotation)); this.endScale.set(this.scale.add(parent.endScale)); } var ch = this.children; for (var i = 0; i < ch.length; ++i) { ch[i].transform(); } return this; } }]); return Object3D; }(); /* harmony default export */ __webpack_exports__["a"] = (Object3D); //# sourceMappingURL=object-3d.js.map /***/ }), /* 251 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__truncated_cone_geometry__ = __webpack_require__(105); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ConeGeometry = /*#__PURE__*/function (_TruncatedConeGeometr) { _inherits(ConeGeometry, _TruncatedConeGeometr); function ConeGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, ConeGeometry); var _opts$radius = opts.radius, radius = _opts$radius === undefined ? 1 : _opts$radius, _opts$cap = opts.cap, cap = _opts$cap === undefined ? true : _opts$cap; return _possibleConstructorReturn(this, (ConeGeometry.__proto__ || Object.getPrototypeOf(ConeGeometry)).call(this, Object.assign({}, opts, { topRadius: 0, topCap: Boolean(cap), bottomCap: Boolean(cap), bottomRadius: radius }))); } return ConeGeometry; }(__WEBPACK_IMPORTED_MODULE_0__truncated_cone_geometry__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (ConeGeometry); //# sourceMappingURL=cone-geometry.js.map /***/ }), /* 252 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var CubeGeometry = /*#__PURE__*/function (_Geometry) { _inherits(CubeGeometry, _Geometry); function CubeGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, CubeGeometry); var _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__utils__["d" /* uid */])('cube-geometry') : _opts$id; return _possibleConstructorReturn(this, (CubeGeometry.__proto__ || Object.getPrototypeOf(CubeGeometry)).call(this, Object.assign({}, opts, { id: id, attributes: getCubeAttributes() }))); } return CubeGeometry; }(__WEBPACK_IMPORTED_MODULE_0__geometry__["a" /* default */]); /* eslint-disable no-multi-spaces, indent */ /* harmony default export */ __webpack_exports__["a"] = (CubeGeometry); var CUBE_INDICES = new Uint16Array([0, 1, 2, 0, 2, 3, 4, 5, 6, 4, 6, 7, 8, 9, 10, 8, 10, 11, 12, 13, 14, 12, 14, 15, 16, 17, 18, 16, 18, 19, 20, 21, 22, 20, 22, 23]); var CUBE_POSITIONS = new Float32Array([-1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, -1, -1, 1, 1, -1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1]); var CUBE_NORMALS = new Float32Array([ // Front face 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, // Back face 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, // Top face 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // Bottom face 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, // Right face 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, // Left face -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0, -1.0, 0.0, 0.0]); var CUBE_TEX_COORDS = new Float32Array([ // Front face 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, // Back face 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, // Top face 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, // Bottom face 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, // Right face 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0, // Left face 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0]); /* eslint-enable no-multi-spaces, indent */ function getCubeAttributes() { return { indices: new Uint16Array(CUBE_INDICES), positions: new Float32Array(CUBE_POSITIONS), normals: new Float32Array(CUBE_NORMALS), texCoords: new Float32Array(CUBE_TEX_COORDS) }; } //# sourceMappingURL=cube-geometry.js.map /***/ }), /* 253 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__truncated_cone_geometry__ = __webpack_require__(105); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var CylinderGeometry = /*#__PURE__*/function (_TruncatedConeGeometr) { _inherits(CylinderGeometry, _TruncatedConeGeometr); function CylinderGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, CylinderGeometry); var _opts$radius = opts.radius, radius = _opts$radius === undefined ? 1 : _opts$radius; return _possibleConstructorReturn(this, (CylinderGeometry.__proto__ || Object.getPrototypeOf(CylinderGeometry)).call(this, Object.assign({}, opts, { bottomRadius: radius, topRadius: radius }))); } return CylinderGeometry; }(__WEBPACK_IMPORTED_MODULE_0__truncated_cone_geometry__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (CylinderGeometry); //# sourceMappingURL=cylinder-geometry.js.map /***/ }), /* 254 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_math_gl__ = __webpack_require__(16); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable comma-spacing, max-statements, complexity */ var ICO_POSITIONS = [-1, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 1, 0, -1, 0, 1, 0, 0]; var ICO_INDICES = [3, 4, 5, 3, 5, 1, 3, 1, 0, 3, 0, 4, 4, 0, 2, 4, 2, 5, 2, 0, 1, 5, 2, 1]; var IcoSphereGeometry = /*#__PURE__*/function (_Geometry) { _inherits(IcoSphereGeometry, _Geometry); function IcoSphereGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, IcoSphereGeometry); var _opts$iterations = opts.iterations, iterations = _opts$iterations === undefined ? 0 : _opts$iterations; var PI = Math.PI; var PI2 = PI * 2; var positions = [].concat(ICO_POSITIONS); var indices = [].concat(ICO_INDICES); positions.push(); indices.push(); var getMiddlePoint = function () { var pointMemo = {}; return function (i1, i2) { i1 *= 3; i2 *= 3; var mini = i1 < i2 ? i1 : i2; var maxi = i1 > i2 ? i1 : i2; var key = mini + '|' + maxi; if (key in pointMemo) { return pointMemo[key]; } var x1 = positions[i1]; var y1 = positions[i1 + 1]; var z1 = positions[i1 + 2]; var x2 = positions[i2]; var y2 = positions[i2 + 1]; var z2 = positions[i2 + 2]; var xm = (x1 + x2) / 2; var ym = (y1 + y2) / 2; var zm = (z1 + z2) / 2; var len = Math.sqrt(xm * xm + ym * ym + zm * zm); xm /= len; ym /= len; zm /= len; positions.push(xm, ym, zm); return pointMemo[key] = positions.length / 3 - 1; }; }(); for (var i = 0; i < iterations; i++) { var indices2 = []; for (var j = 0; j < indices.length; j += 3) { var a = getMiddlePoint(indices[j + 0], indices[j + 1]); var b = getMiddlePoint(indices[j + 1], indices[j + 2]); var c = getMiddlePoint(indices[j + 2], indices[j + 0]); indices2.push(c, indices[j + 0], a, a, indices[j + 1], b, b, indices[j + 2], c, a, b, c); } indices = indices2; } // Calculate texCoords and normals var normals = new Array(indices.length * 3); var texCoords = new Array(indices.length * 2); var l = indices.length; for (var _i = l - 3; _i >= 0; _i -= 3) { var i1 = indices[_i + 0]; var i2 = indices[_i + 1]; var i3 = indices[_i + 2]; var in1 = i1 * 3; var in2 = i2 * 3; var in3 = i3 * 3; var iu1 = i1 * 2; var iu2 = i2 * 2; var iu3 = i3 * 2; var x1 = positions[in1 + 0]; var y1 = positions[in1 + 1]; var z1 = positions[in1 + 2]; var theta1 = Math.acos(z1 / Math.sqrt(x1 * x1 + y1 * y1 + z1 * z1)); var phi1 = Math.atan2(y1, x1) + PI; var v1 = theta1 / PI; var u1 = 1 - phi1 / PI2; var x2 = positions[in2 + 0]; var y2 = positions[in2 + 1]; var z2 = positions[in2 + 2]; var theta2 = Math.acos(z2 / Math.sqrt(x2 * x2 + y2 * y2 + z2 * z2)); var phi2 = Math.atan2(y2, x2) + PI; var v2 = theta2 / PI; var u2 = 1 - phi2 / PI2; var x3 = positions[in3 + 0]; var y3 = positions[in3 + 1]; var z3 = positions[in3 + 2]; var theta3 = Math.acos(z3 / Math.sqrt(x3 * x3 + y3 * y3 + z3 * z3)); var phi3 = Math.atan2(y3, x3) + PI; var v3 = theta3 / PI; var u3 = 1 - phi3 / PI2; var vec1 = [x3 - x2, y3 - y2, z3 - z2]; var vec2 = [x1 - x2, y1 - y2, z1 - z2]; var normal = new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Vector3"](vec1).cross(vec2).normalize(); var newIndex = void 0; if ((u1 === 0 || u2 === 0 || u3 === 0) && (u1 === 0 || u1 > 0.5) && (u2 === 0 || u2 > 0.5) && (u3 === 0 || u3 > 0.5)) { positions.push(positions[in1 + 0], positions[in1 + 1], positions[in1 + 2]); newIndex = positions.length / 3 - 1; indices.push(newIndex); texCoords[newIndex * 2 + 0] = 1; texCoords[newIndex * 2 + 1] = v1; normals[newIndex * 3 + 0] = normal.x; normals[newIndex * 3 + 1] = normal.y; normals[newIndex * 3 + 2] = normal.z; positions.push(positions[in2 + 0], positions[in2 + 1], positions[in2 + 2]); newIndex = positions.length / 3 - 1; indices.push(newIndex); texCoords[newIndex * 2 + 0] = 1; texCoords[newIndex * 2 + 1] = v2; normals[newIndex * 3 + 0] = normal.x; normals[newIndex * 3 + 1] = normal.y; normals[newIndex * 3 + 2] = normal.z; positions.push(positions[in3 + 0], positions[in3 + 1], positions[in3 + 2]); newIndex = positions.length / 3 - 1; indices.push(newIndex); texCoords[newIndex * 2 + 0] = 1; texCoords[newIndex * 2 + 1] = v3; normals[newIndex * 3 + 0] = normal.x; normals[newIndex * 3 + 1] = normal.y; normals[newIndex * 3 + 2] = normal.z; } normals[in1 + 0] = normals[in2 + 0] = normals[in3 + 0] = normal.x; normals[in1 + 1] = normals[in2 + 1] = normals[in3 + 1] = normal.y; normals[in1 + 2] = normals[in2 + 2] = normals[in3 + 2] = normal.z; texCoords[iu1 + 0] = u1; texCoords[iu1 + 1] = v1; texCoords[iu2 + 0] = u2; texCoords[iu2 + 1] = v2; texCoords[iu3 + 0] = u3; texCoords[iu3 + 1] = v3; } return _possibleConstructorReturn(this, (IcoSphereGeometry.__proto__ || Object.getPrototypeOf(IcoSphereGeometry)).call(this, Object.assign({}, opts, { attributes: { positions: new Float32Array(positions), normals: new Float32Array(normals), texCoords: new Float32Array(texCoords), indices: new Uint16Array(indices) } }))); } return IcoSphereGeometry; }(__WEBPACK_IMPORTED_MODULE_0__geometry__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (IcoSphereGeometry); //# sourceMappingURL=ico-sphere-geometry.js.map /***/ }), /* 255 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var PlaneGeometry = /*#__PURE__*/function (_Geometry) { _inherits(PlaneGeometry, _Geometry); // Primitives inspired by TDL http://code.google.com/p/webglsamples/, // copyright 2011 Google Inc. new BSD License // (http://www.opensource.org/licenses/bsd-license.php). /* eslint-disable max-statements, complexity */ /* eslint-disable complexity, max-statements */ function PlaneGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, PlaneGeometry); var _opts$type = opts.type, type = _opts$type === undefined ? 'x,y' : _opts$type, _opts$offset = opts.offset, offset = _opts$offset === undefined ? 0 : _opts$offset, _opts$flipCull = opts.flipCull, flipCull = _opts$flipCull === undefined ? false : _opts$flipCull, _opts$unpack = opts.unpack, unpack = _opts$unpack === undefined ? false : _opts$unpack, _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__utils__["d" /* uid */])('plane-geometry') : _opts$id; var coords = type.split(','); // width, height var c1len = opts[coords[0] + 'len']; var c2len = opts[coords[1] + 'len']; // subdivisionsWidth, subdivisionsDepth var subdivisions1 = opts['n' + coords[0]] || 1; var subdivisions2 = opts['n' + coords[1]] || 1; var numVertices = (subdivisions1 + 1) * (subdivisions2 + 1); var positions = new Float32Array(numVertices * 3); var normals = new Float32Array(numVertices * 3); var texCoords = new Float32Array(numVertices * 2); if (flipCull) { c1len = -c1len; } var i2 = 0; var i3 = 0; for (var z = 0; z <= subdivisions2; z++) { for (var x = 0; x <= subdivisions1; x++) { var u = x / subdivisions1; var v = z / subdivisions2; texCoords[i2 + 0] = flipCull ? 1 - u : u; texCoords[i2 + 1] = v; switch (type) { case 'x,y': positions[i3 + 0] = c1len * u - c1len * 0.5; positions[i3 + 1] = c2len * v - c2len * 0.5; positions[i3 + 2] = offset; normals[i3 + 0] = 0; normals[i3 + 1] = 0; normals[i3 + 2] = flipCull ? 1 : -1; break; case 'x,z': positions[i3 + 0] = c1len * u - c1len * 0.5; positions[i3 + 1] = offset; positions[i3 + 2] = c2len * v - c2len * 0.5; normals[i3 + 0] = 0; normals[i3 + 1] = flipCull ? 1 : -1; normals[i3 + 2] = 0; break; case 'y,z': positions[i3 + 0] = offset; positions[i3 + 1] = c1len * u - c1len * 0.5; positions[i3 + 2] = c2len * v - c2len * 0.5; normals[i3 + 0] = flipCull ? 1 : -1; normals[i3 + 1] = 0; normals[i3 + 2] = 0; break; default: break; } i2 += 2; i3 += 3; } } var numVertsAcross = subdivisions1 + 1; var indices = new Uint16Array(subdivisions1 * subdivisions2 * 6); for (var _z = 0; _z < subdivisions2; _z++) { for (var _x2 = 0; _x2 < subdivisions1; _x2++) { var index = (_z * subdivisions1 + _x2) * 6; // Make triangle 1 of quad. indices[index + 0] = (_z + 0) * numVertsAcross + _x2; indices[index + 1] = (_z + 1) * numVertsAcross + _x2; indices[index + 2] = (_z + 0) * numVertsAcross + _x2 + 1; // Make triangle 2 of quad. indices[index + 3] = (_z + 1) * numVertsAcross + _x2; indices[index + 4] = (_z + 1) * numVertsAcross + _x2 + 1; indices[index + 5] = (_z + 0) * numVertsAcross + _x2 + 1; } } // Optionally, unpack indexed geometry if (unpack) { var positions2 = new Float32Array(indices.length * 3); var normals2 = new Float32Array(indices.length * 3); var texCoords2 = new Float32Array(indices.length * 2); for (var _x3 = 0; _x3 < indices.length; ++_x3) { var _index = indices[_x3]; positions2[_x3 * 3 + 0] = positions[_index * 3 + 0]; positions2[_x3 * 3 + 1] = positions[_index * 3 + 1]; positions2[_x3 * 3 + 2] = positions[_index * 3 + 2]; normals2[_x3 * 3 + 0] = normals[_index * 3 + 0]; normals2[_x3 * 3 + 1] = normals[_index * 3 + 1]; normals2[_x3 * 3 + 2] = normals[_index * 3 + 2]; texCoords2[_x3 * 2 + 0] = texCoords[_index * 2 + 0]; texCoords2[_x3 * 2 + 1] = texCoords[_index * 2 + 1]; } positions = positions2; normals = normals2; texCoords = texCoords2; indices = undefined; } var attributes = { positions: positions, normals: normals, texCoords: texCoords }; if (indices) { attributes.indices = indices; } return _possibleConstructorReturn(this, (PlaneGeometry.__proto__ || Object.getPrototypeOf(PlaneGeometry)).call(this, Object.assign({}, opts, { attributes: attributes, id: id }))); } return PlaneGeometry; }(__WEBPACK_IMPORTED_MODULE_0__geometry__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (PlaneGeometry); //# sourceMappingURL=plane-geometry.js.map /***/ }), /* 256 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(45); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var SphereGeometry = /*#__PURE__*/function (_Geometry) { _inherits(SphereGeometry, _Geometry); function SphereGeometry() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, SphereGeometry); var _opts$nlat = opts.nlat, nlat = _opts$nlat === undefined ? 10 : _opts$nlat, _opts$nlong = opts.nlong, nlong = _opts$nlong === undefined ? 10 : _opts$nlong, _opts$radius = opts.radius, radius = _opts$radius === undefined ? 1 : _opts$radius, _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__utils__["d" /* uid */])('sphere-geometry') : _opts$id; return _possibleConstructorReturn(this, (SphereGeometry.__proto__ || Object.getPrototypeOf(SphereGeometry)).call(this, Object.assign({}, opts, { id: id, attributes: getSphereAttributes(nlat, nlong, radius) }))); } return SphereGeometry; }(__WEBPACK_IMPORTED_MODULE_0__geometry__["a" /* default */]); // Primitives inspired by TDL http://code.google.com/p/webglsamples/, // copyright 2011 Google Inc. new BSD License // (http://www.opensource.org/licenses/bsd-license.php). /* eslint-disable max-statements, complexity */ /* harmony default export */ __webpack_exports__["a"] = (SphereGeometry); function getSphereAttributes(nlat, nlong, radius) { var startLat = 0; var endLat = Math.PI; var latRange = endLat - startLat; var startLong = 0; var endLong = 2 * Math.PI; var longRange = endLong - startLong; var numVertices = (nlat + 1) * (nlong + 1); if (typeof radius === 'number') { var value = radius; radius = function radius(n1, n2, n3, u, v) { return value; }; } var positions = new Float32Array(numVertices * 3); var normals = new Float32Array(numVertices * 3); var texCoords = new Float32Array(numVertices * 2); var indices = new Uint16Array(nlat * nlong * 6); // Create positions, normals and texCoords for (var y = 0; y <= nlat; y++) { for (var x = 0; x <= nlong; x++) { var u = x / nlong; var v = y / nlat; var index = x + y * (nlong + 1); var i2 = index * 2; var i3 = index * 3; var theta = longRange * u; var phi = latRange * v; var sinTheta = Math.sin(theta); var cosTheta = Math.cos(theta); var sinPhi = Math.sin(phi); var cosPhi = Math.cos(phi); var ux = cosTheta * sinPhi; var uy = cosPhi; var uz = sinTheta * sinPhi; var r = radius(ux, uy, uz, u, v); positions[i3 + 0] = r * ux; positions[i3 + 1] = r * uy; positions[i3 + 2] = r * uz; normals[i3 + 0] = ux; normals[i3 + 1] = uy; normals[i3 + 2] = uz; texCoords[i2 + 0] = u; texCoords[i2 + 1] = v; } } // Create indices var numVertsAround = nlat + 1; for (var _x2 = 0; _x2 < nlat; _x2++) { for (var _y = 0; _y < nlong; _y++) { var _index = (_x2 * nlong + _y) * 6; indices[_index + 0] = _y * numVertsAround + _x2; indices[_index + 1] = _y * numVertsAround + _x2 + 1; indices[_index + 2] = (_y + 1) * numVertsAround + _x2; indices[_index + 3] = (_y + 1) * numVertsAround + _x2; indices[_index + 4] = _y * numVertsAround + _x2 + 1; indices[_index + 5] = (_y + 1) * numVertsAround + _x2 + 1; } } return { positions: positions, indices: indices, normals: normals, texCoords: texCoords }; } //# sourceMappingURL=sphere-geometry.js.map /***/ }), /* 257 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setPathPrefix = setPathPrefix; exports.loadFile = loadFile; exports.loadImage = loadImage; var _browserRequestFile = __webpack_require__(629); var pathPrefix = ''; /* * Set a relative path prefix */ function setPathPrefix(prefix) { pathPrefix = prefix; } function loadFile(url, opts) { if (typeof url !== 'string' && !opts) { // TODO - warn for deprecated mode opts = url; url = opts.url; } opts.url = pathPrefix ? pathPrefix + url : url; return (0, _browserRequestFile.requestFile)(opts); } /* global Image */ /* * Loads images asynchronously * image.crossOrigin can be set via opts.crossOrigin, default to 'anonymous' * returns a promise tracking the load */ function loadImage(url, opts) { url = pathPrefix ? pathPrefix + url : url; return new Promise(function (resolve, reject) { try { var image = new Image(); image.onload = function () { return resolve(image); }; image.onerror = function () { return reject(new Error('Could not load image ' + url + '.')); }; image.crossOrigin = opts && opts.crossOrigin || 'anonymous'; image.src = url; } catch (error) { reject(error); } }); } //# sourceMappingURL=browser-load.js.map /***/ }), /* 258 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = assembleShaders; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__shader_modules__ = __webpack_require__(162); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__platform_defines__ = __webpack_require__(643); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__modules_module_injectors__ = __webpack_require__(655); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__utils__ = __webpack_require__(8); var _SHADER_TYPE, _MODULE_INJECTORS; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var VERTEX_SHADER = 'vs'; var FRAGMENT_SHADER = 'fs'; var SHADER_TYPE = (_SHADER_TYPE = {}, _defineProperty(_SHADER_TYPE, VERTEX_SHADER, 'vertex'), _defineProperty(_SHADER_TYPE, FRAGMENT_SHADER, 'fragment'), _SHADER_TYPE); var MODULE_INJECTORS = (_MODULE_INJECTORS = {}, _defineProperty(_MODULE_INJECTORS, VERTEX_SHADER, __WEBPACK_IMPORTED_MODULE_2__modules_module_injectors__["a" /* MODULE_INJECTORS_VS */]), _defineProperty(_MODULE_INJECTORS, FRAGMENT_SHADER, __WEBPACK_IMPORTED_MODULE_2__modules_module_injectors__["b" /* MODULE_INJECTORS_FS */]), _MODULE_INJECTORS); // Precision prologue to inject before functions are injected in shader // TODO - extract any existing prologue in the fragment source and move it up... var FRAGMENT_SHADER_PROLOGUE = '#ifdef GL_ES\nprecision highp float;\n#endif\n\n'; // Generate "glslify-compatible" SHADER_NAME defines // These are understood by the GLSL error parsing function // If id is provided and no SHADER_NAME constant is present in source, create one function getShaderName(_ref) { var id = _ref.id, source = _ref.source, type = _ref.type; var injectShaderName = id && typeof id === 'string' && source.indexOf('SHADER_NAME') === -1; return injectShaderName ? '\n#define SHADER_NAME ' + id + '_' + SHADER_TYPE[type] + '\n\n' : ''; } // Generates application defines from an object function getApplicationDefines() { var defines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var count = 0; var sourceText = ''; for (var define in defines) { if (count === 0) { sourceText += '\n// APPLICATION DEFINES\n'; } count++; sourceText += '#define ' + define.toUpperCase() + ' ' + defines[define] + '\n'; } if (count === 0) { sourceText += '\n'; } return sourceText; } // Warn about deprecated uniforms or functions function checkDeprecation(moduleName, shaderSource) { var shaderModule = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__shader_modules__["c" /* getShaderModule */])(moduleName); shaderModule.deprecations.forEach(function (def) { if (def.regex.test(shaderSource)) { if (def.deprecated) { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].deprecated(def.old, def.new); } else { __WEBPACK_IMPORTED_MODULE_4__utils__["b" /* log */].removed(def.old, def.new); } } }); } // Extracts the source code chunk for the specified shader type from the named shader module function getModuleSource(moduleName, type) { var shaderModule = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__shader_modules__["c" /* getShaderModule */])(moduleName); var moduleSource = void 0; switch (type) { case VERTEX_SHADER: moduleSource = shaderModule.vs || shaderModule.vertexShader; break; case FRAGMENT_SHADER: moduleSource = shaderModule.fs || shaderModule.fragmentShader; break; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false); } if (typeof moduleSource !== 'string') { return ''; } return '#define MODULE_' + moduleName.toUpperCase() + '\n' + moduleSource + '// END MODULE_' + moduleName + '\n\n'; } // Pulls together complete source code for either a vertex or a fragment shader // adding prologues, requested module chunks, and any final injections. function assembleShader(gl, _ref2) { var id = _ref2.id, source = _ref2.source, type = _ref2.type, _ref2$modules = _ref2.modules, modules = _ref2$modules === undefined ? [] : _ref2$modules, _ref2$defines = _ref2.defines, defines = _ref2$defines === undefined ? {} : _ref2$defines; __WEBPACK_IMPORTED_MODULE_3_assert___default()(typeof source === 'string', 'shader source must be a string'); var sourceLines = source.split('\n'); var versionLine = ''; var coreSource = source; // Extract any version directive string from source. // TODO : keep all pre-processor statements at the begining of the shader. if (sourceLines[0].indexOf('#version ') === 0) { versionLine = sourceLines[0]; coreSource = sourceLines.slice(1).join('\n'); } // Add platform defines (use these to work around platform-specific bugs and limitations) // Add common defines (GLSL version compatibility, feature detection) // Add precision declaration for fragment shaders var assembledSource = getShaderName({ id: id, source: source, type: type }) + '\n' + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__platform_defines__["a" /* getPlatformShaderDefines */])(gl) + '\n' + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__platform_defines__["b" /* getVersionDefines */])(gl) + '\n' + getApplicationDefines(defines) + '\n' + (type === FRAGMENT_SHADER ? FRAGMENT_SHADER_PROLOGUE : '') + '\n'; // Add source of dependent modules in resolved order var inject = false; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = modules[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var moduleName = _step.value; switch (moduleName) { case 'inject': inject = true; break; default: checkDeprecation(moduleName, coreSource); // Add the module source, and a #define that declares it presence assembledSource += getModuleSource(moduleName, type); } } // Add the version directive and actual source of this shader } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } assembledSource = versionLine + assembledSource + coreSource; // Finally, if requested, insert an automatic module injector chunk if (inject) { assembledSource.replace('}\s*$', MODULE_INJECTORS); } return assembledSource; } // Returns a combined `getUniforms` covering the options for all the modules, // the created function will pass on options to the inidividual `getUniforms` // function of each shader module and combine the results into one object that // can be passed to setUniforms. function assembleGetUniforms(modules) { return function getUniforms(opts) { var uniforms = {}; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = modules[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var moduleName = _step2.value; var shaderModule = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__shader_modules__["c" /* getShaderModule */])(moduleName); // `modules` is already sorted by dependency level. This guarantees that // modules have access to the uniforms that are generated by their dependencies. var moduleUniforms = shaderModule.getUniforms ? shaderModule.getUniforms(opts, uniforms) : {}; Object.assign(uniforms, moduleUniforms); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return uniforms; }; } // Returns a map with module names as keys, resolving to their module definitions // The presence of a key indicates that the module is available in this program, // whether directly included, or through a dependency of some other module function assembleModuleMap(modules) { var result = {}; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = modules[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var moduleName = _step3.value; var shaderModule = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__shader_modules__["c" /* getShaderModule */])(moduleName); result[moduleName] = shaderModule; } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } return result; } /** * Apply set of modules */ function assembleShaders(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var vs = opts.vs, fs = opts.fs; var modules = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__shader_modules__["d" /* resolveModules */])(opts.modules || []); return { gl: gl, vs: assembleShader(gl, Object.assign({}, opts, { source: vs, type: VERTEX_SHADER, modules: modules })), fs: assembleShader(gl, Object.assign({}, opts, { source: fs, type: FRAGMENT_SHADER, modules: modules })), getUniforms: assembleGetUniforms(modules), modules: assembleModuleMap(modules) }; } //# sourceMappingURL=assemble-shaders.js.map /***/ }), /* 259 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl_shader__ = __webpack_require__(111); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_program__ = __webpack_require__(109); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var ShaderCache = /*#__PURE__*/function () { /** * A cache of compiled shaders, keyed by shader source strings. * Compilation of long shaders can be time consuming. * By using this class, the application can ensure that each shader * is only compiled once. */ function ShaderCache() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, gl = _ref.gl, _ref$_cachePrograms = _ref._cachePrograms, _cachePrograms = _ref$_cachePrograms === undefined ? false : _ref$_cachePrograms; _classCallCheck(this, ShaderCache); __WEBPACK_IMPORTED_MODULE_2_assert___default()(gl); this.gl = gl; this.vertexShaders = {}; this.fragmentShaders = {}; this.programs = {}; this._cachePrograms = _cachePrograms; } /** * Deletes shader references * @return {ShaderCache} - returns this for chaining */ _createClass(ShaderCache, [{ key: 'delete', value: function _delete() { // TODO - requires reference counting to avoid deleting shaders in use return this; } /** * Returns a compiled `VertexShader` object corresponding to the supplied * GLSL source code string, if possible from cache. * * @param {WebGLRenderingContext} gl - gl context * @param {String} source - Source code for shader * @return {VertexShader} - a compiled vertex shader */ }, { key: 'getVertexShader', value: function getVertexShader(gl, source) { __WEBPACK_IMPORTED_MODULE_2_assert___default()(typeof source === 'string'); __WEBPACK_IMPORTED_MODULE_2_assert___default()(this._compareContexts(gl, this.gl)); var shader = this.vertexShaders[source]; if (!shader) { shader = new __WEBPACK_IMPORTED_MODULE_0__webgl_shader__["b" /* VertexShader */](gl, source); this.vertexShaders[source] = shader; } return shader; } /** * Returns a compiled `VertexShader` object corresponding to the supplied * GLSL source code string, if possible from cache. * @param {WebGLRenderingContext} gl - gl context * @param {String} source - Source code for shader * @return {FragmentShader} - a compiled fragment shader, possibly from chache */ }, { key: 'getFragmentShader', value: function getFragmentShader(gl, source) { __WEBPACK_IMPORTED_MODULE_2_assert___default()(typeof source === 'string'); __WEBPACK_IMPORTED_MODULE_2_assert___default()(this._compareContexts(gl, this.gl)); var shader = this.fragmentShaders[source]; if (!shader) { shader = new __WEBPACK_IMPORTED_MODULE_0__webgl_shader__["c" /* FragmentShader */](gl, source); this.fragmentShaders[source] = shader; } return shader; } // Retrive Shaders from cache if exists, otherwise create new instance. }, { key: 'getProgram', value: function getProgram(gl, opts) { __WEBPACK_IMPORTED_MODULE_2_assert___default()(this._compareContexts(gl, this.gl)); __WEBPACK_IMPORTED_MODULE_2_assert___default()(typeof opts.vs === 'string'); __WEBPACK_IMPORTED_MODULE_2_assert___default()(typeof opts.fs === 'string'); __WEBPACK_IMPORTED_MODULE_2_assert___default()(typeof opts.id === 'string'); var cacheKey = this._getProgramKey(opts); var program = this.programs[cacheKey]; if (program) { this._resetProgram(program); return program; } program = this._createNewProgram(gl, opts); // Check if program can be cached // Program caching is experimental and expects // each Model to have a unique-id (wich is used in key generation) if (this._cachePrograms && this._checkProgramProp(program)) { this.programs[cacheKey] = program; } return program; } }, { key: '_getProgramKey', value: function _getProgramKey(opts) { return opts.id + '-' + opts.vs + '-' + opts.fs; } }, { key: '_checkProgramProp', value: function _checkProgramProp(program) { // Check for transform feedback props (varyings, etc), we can't key such programs for now return !program.varyings; } }, { key: '_createNewProgram', value: function _createNewProgram(gl, opts) { var vs = opts.vs, fs = opts.fs; var vertexShader = this.getVertexShader(gl, vs); var fragmentShader = this.getFragmentShader(gl, fs); return new __WEBPACK_IMPORTED_MODULE_1__webgl_program__["a" /* default */](this.gl, Object.assign({}, opts, { vs: vertexShader, fs: fragmentShader })); } }, { key: '_resetProgram', value: function _resetProgram(program, opts) { program.reset(); } // Handle debug contexts }, { key: '_compareContexts', value: function _compareContexts(gl1, gl2) { return (gl1.gl || gl1) === (gl2.gl || gl2); } }]); return ShaderCache; }(); /* harmony default export */ __webpack_exports__["a"] = (ShaderCache); //# sourceMappingURL=shader-cache.js.map /***/ }), /* 260 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_math_gl__ = __webpack_require__(16); var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; var DEFAULT_MODULE_OPTIONS = { modelMatrix: IDENTITY_MATRIX, viewMatrix: IDENTITY_MATRIX, projectionMatrix: IDENTITY_MATRIX, cameraPositionWorld: [0, 0, 0] }; function getUniforms() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS; var prevUniforms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; // const viewProjectionInverse = viewProjection.invert(); // viewInverseMatrix: view.invert(), // viewProjectionInverseMatrix: viewProjectionInverse var uniforms = {}; if (opts.modelMatrix !== undefined) { uniforms.modelMatrix = opts.modelMatrix; } if (opts.viewMatrix !== undefined) { uniforms.viewMatrix = opts.viewMatrix; } if (opts.projectionMatrix !== undefined) { uniforms.projectionMatrix = opts.projectionMatrix; } if (opts.cameraPositionWorld !== undefined) { uniforms.cameraPositionWorld = opts.cameraPositionWorld; } // COMPOSITE UNIFORMS if (opts.projectionMatrix !== undefined || opts.viewMatrix !== undefined) { uniforms.viewProjectionMatrix = new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Matrix4"](opts.projectionMatrix).multiplyRight(opts.viewMatrix); } return uniforms; } var common = 'varying vec4 project_vPositionWorld;\nvarying vec3 project_vNormalWorld;\n\nvec4 project_getPosition_World() {\n return project_vPositionWorld;\n}\n\nvec3 project_getNormal_World() {\n return project_vNormalWorld;\n}\n'; var vs = common + '\n\n// Unprefixed uniforms\nuniform mat4 modelMatrix;\nuniform mat4 viewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewProjectionMatrix;\nuniform vec3 cameraPositionWorld;\n\nstruct World {\n vec3 position;\n vec3 normal;\n};\n\nWorld world;\n\nvoid project_setPosition(vec4 position) {\n project_vPositionWorld = position;\n}\n\nvoid project_setNormal(vec3 normal) {\n project_vNormalWorld = normal;\n}\n\nvoid project_setPositionAndNormal_World(vec3 position, vec3 normal) {\n world.position = position;\n world.normal = normal;\n}\n\nvoid project_setPositionAndNormal_Model(vec3 position, vec3 normal) {\n world.position = (modelMatrix * vec4(position, 1.)).xyz;\n world.normal = mat3(modelMatrix) * normal;\n}\n\nvec4 project_model_to_clipspace(vec4 position) {\n return viewProjectionMatrix * modelMatrix * position;\n}\n\nvec4 project_model_to_clipspace(vec3 position) {\n return viewProjectionMatrix * modelMatrix * vec4(position, 1.);\n}\n\nvec4 project_world_to_clipspace(vec3 position) {\n return viewProjectionMatrix * vec4(position, 1.);\n}\n\nvec4 project_view_to_clipspace(vec3 position) {\n return projectionMatrix * vec4(position, 1.);\n}\n\nvec4 project_to_clipspace(vec3 position) {\n return viewProjectionMatrix * vec4(position, 1.);\n}\n'; var fs = '\n' + common; /* harmony default export */ __webpack_exports__["a"] = ({ name: 'project', getUniforms: getUniforms, vs: vs, fs: fs }); //# sourceMappingURL=project.js.map /***/ }), /* 261 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return window_; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return global_; }); /* unused harmony export document */ /* global window, global, document */ var window_ = typeof window !== 'undefined' ? window : global; var global_ = typeof global !== 'undefined' ? global : window; var document_ = typeof document !== 'undefined' ? document : {}; //# sourceMappingURL=globals.js.map /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(47))) /***/ }), /* 262 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export isNode */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isBrowser; }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // This function is needed in initialization stages, // make sure it can be imported in isolation /* global process */ var isNode = (typeof process === 'undefined' ? 'undefined' : _typeof(process)) === 'object' && String(process) === '[object process]' && !process.browser; var isBrowser = !isNode; /* unused harmony default export */ var _unused_webpack_default_export = (isBrowser); //# sourceMappingURL=is-browser.js.map /* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(26))) /***/ }), /* 263 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = formatValue; /* eslint-disable no-console */ /* global console, window, Image */ console.debug = console.debug || console.log; var cache = {}; var _log = { priority: 0, table: function table(priority, _table) { if (priority <= _log.priority && _table) { console.table(_table); } }, log: function log(priority, arg) { if (priority <= _log.priority) { var _console; for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { args[_key - 2] = arguments[_key]; } (_console = console).debug.apply(_console, ['luma.gl: ' + arg].concat(args)); } }, info: function info(priority, arg) { if (priority <= _log.priority) { var _console2; for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } (_console2 = console).log.apply(_console2, ['luma.gl: ' + arg].concat(args)); } }, once: function once(priority, arg) { if (!cache[arg]) { for (var _len3 = arguments.length, args = Array(_len3 > 2 ? _len3 - 2 : 0), _key3 = 2; _key3 < _len3; _key3++) { args[_key3 - 2] = arguments[_key3]; } _log.log.apply(_log, [priority, arg].concat(args)); cache[arg] = true; } }, warn: function warn(arg) { if (!cache[arg]) { var _console3; for (var _len4 = arguments.length, args = Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) { args[_key4 - 1] = arguments[_key4]; } (_console3 = console).warn.apply(_console3, ['luma.gl: ' + arg].concat(args)); cache[arg] = true; } }, error: function error(arg) { var _console4; for (var _len5 = arguments.length, args = Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) { args[_key5 - 1] = arguments[_key5]; } (_console4 = console).error.apply(_console4, ['luma.gl: ' + arg].concat(args)); }, image: function image(_ref) { var priority = _ref.priority, _image = _ref.image, _ref$message = _ref.message, message = _ref$message === undefined ? '' : _ref$message, _ref$scale = _ref.scale, scale = _ref$scale === undefined ? 1 : _ref$scale; if (priority > _log.priority) { return; } if (typeof window === 'undefined') { // Let's not try this under node return; } if (typeof _image === 'string') { var img = new Image(); img.onload = logImage.bind(null, img, message, scale); img.src = _image; } var element = _image.nodeName || ''; if (element.toLowerCase() === 'img') { logImage(_image, message, scale); } if (element.toLowerCase() === 'canvas') { var _img = new Image(); _img.onload = logImage.bind(null, _img, message, scale); _img.src = _image.toDataURL(); } }, deprecated: function deprecated(oldUsage, newUsage) { _log.warn('`' + oldUsage + '` is deprecated and will be removed in a later version. Use `' + newUsage + '` instead'); }, removed: function removed(oldUsage, newUsage) { _log.error('`' + oldUsage + '` is no longer supported. Use `' + newUsage + '` instead, check our Upgrade Guide for more details'); }, group: function group(priority, arg) { var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}, _ref2$collapsed = _ref2.collapsed, collapsed = _ref2$collapsed === undefined ? false : _ref2$collapsed; if (priority <= _log.priority) { if (collapsed) { console.groupCollapsed('luma.gl: ' + arg); } else { console.group('luma.gl: ' + arg); } } }, groupEnd: function groupEnd(priority, arg) { if (priority <= _log.priority) { console.groupEnd('luma.gl: ' + arg); } }, time: function time(priority, label) { if (priority <= _log.priority) { // In case the platform doesn't have console.time if (console.time) { console.time(label); } else { console.info(label); } } }, timeEnd: function timeEnd(priority, label) { if (priority <= _log.priority) { // In case the platform doesn't have console.timeEnd if (console.timeEnd) { console.timeEnd(label); } else { console.info(label); } } } }; // Inspired by https://github.com/hughsk/console-image (MIT license) function logImage(image, message, scale) { var width = image.width * scale; var height = image.height * scale; var imageUrl = image.src.replace(/\(/g, '%28').replace(/\)/g, '%29'); console.log(message + ' %c+', ['font-size:1px;', 'padding:' + Math.floor(height / 2) + 'px ' + Math.floor(width / 2) + 'px;', 'line-height:' + height + 'px;', 'background:url(' + imageUrl + ');', 'background-size:' + width + 'px ' + height + 'px;', 'color:transparent;'].join('')); } function formatArrayValue(v, opts) { var _opts$maxElts = opts.maxElts, maxElts = _opts$maxElts === undefined ? 16 : _opts$maxElts, _opts$size = opts.size, size = _opts$size === undefined ? 1 : _opts$size; var string = '['; for (var i = 0; i < v.length && i < maxElts; ++i) { if (i > 0) { string += ',' + (i % size === 0 ? ' ' : ''); } string += formatValue(v[i], opts); } var terminator = v.length > maxElts ? '...' : ']'; return '' + string + terminator; } function formatValue(v) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var EPSILON = 1e-16; var _opts$isInteger = opts.isInteger, isInteger = _opts$isInteger === undefined ? false : _opts$isInteger; if (Array.isArray(v) || ArrayBuffer.isView(v)) { return formatArrayValue(v, opts); } if (!Number.isFinite(v)) { return String(v); } if (Math.abs(v) < EPSILON) { return isInteger ? '0' : '0.'; } if (isInteger) { return v.toFixed(0); } if (Math.abs(v) > 100 && Math.abs(v) < 10000) { return v.toFixed(0); } var string = v.toPrecision(2); var decimal = string.indexOf('.0'); return decimal === string.length - 2 ? string.slice(0, -1) : string; } /* harmony default export */ __webpack_exports__["a"] = (_log); //# sourceMappingURL=log.js.map /***/ }), /* 264 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = getShaderName; /* harmony export (immutable) */ __webpack_exports__["b"] = getShaderTypeName; var GL_FRAGMENT_SHADER = 0x8B30; var GL_VERTEX_SHADER = 0x8B31; // Supports GLSLIFY style naming of shaders // #define SHADER_NAME ... function getShaderName(shader) { var SHADER_NAME_REGEXP = /#define[\s*]SHADER_NAME[\s*]([A-Za-z0-9_-]+)[\s*]/; var match = shader.match(SHADER_NAME_REGEXP); return match ? match[1] : 'unnamed'; } function getShaderTypeName(type) { switch (type) { case GL_FRAGMENT_SHADER: return 'fragment'; case GL_VERTEX_SHADER: return 'vertex'; default: return 'unknown type'; } } //# sourceMappingURL=get-shader-name.js.map /***/ }), /* 265 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = polyfillContext; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__polyfill_get_parameter__ = __webpack_require__(666); var _WEBGL_CONTEXT_POLYFI; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // WebGL1/WebGL2 extension polyfill support // // Provides a function that creates polyfills for WebGL2 functions based // on available extensions and installs them on a supplied target (could be // the WebGLContext or its prototype, or a separate object). // // This is intended to be a stand-alone file with minimal dependencies, // easy to reuse or repurpose in other projects. /* eslint-disable camelcase, brace-style */ var OES_vertex_array_object = 'OES_vertex_array_object'; var ANGLE_instanced_arrays = 'ANGLE_instanced_arrays'; var WEBGL_draw_buffers = 'WEBGL_draw_buffers'; var EXT_disjoint_timer_query = 'EXT_disjoint_timer_query'; var EXT_disjoint_timer_query_webgl2 = 'EXT_disjoint_timer_query_webgl2'; var EXT_texture_filter_anisotropic = 'EXT_texture_filter_anisotropic'; var ERR_VAO_NOT_SUPPORTED = 'VertexArray requires WebGL2 or OES_vertex_array_object extension'; // Return true if WebGL2 context function isWebGL2(gl) { var GL_TEXTURE_BINDING_3D = 0x806A; return gl && gl.TEXTURE_BINDING_3D === GL_TEXTURE_BINDING_3D; } // Return object with webgl2 flag and an extension function getExtensionData(gl, extension) { return { webgl2: isWebGL2(gl), ext: gl.getExtension(extension) }; } // function mapExtensionConstant(gl, constant) { // switch (constant) { // case ext.FRAGMENT_SHADER_DERIVATIVE_HINT_OES: return GL.FRAGMENT_SHADER_DERIVATIVE_HINT; // } // } var WEBGL_CONTEXT_POLYFILLS = (_WEBGL_CONTEXT_POLYFI = {}, _defineProperty(_WEBGL_CONTEXT_POLYFI, OES_vertex_array_object, { meta: { suffix: 'OES' }, // NEW METHODS createVertexArray: function createVertexArray() { __WEBPACK_IMPORTED_MODULE_0_assert___default()(false, ERR_VAO_NOT_SUPPORTED); }, deleteVertexArray: function deleteVertexArray() {}, bindVertexArray: function bindVertexArray() {}, isVertexArray: function isVertexArray() { return false; } }), _defineProperty(_WEBGL_CONTEXT_POLYFI, ANGLE_instanced_arrays, { meta: { suffix: 'ANGLE' // constants: { // VERTEX_ATTRIB_ARRAY_DIVISOR: 'VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE' // } }, vertexAttribDivisor: function vertexAttribDivisor(location, divisor) { // Accept divisor 0 even if instancing is not supported (0 = no instancing) __WEBPACK_IMPORTED_MODULE_0_assert___default()(divisor === 0, 'WebGL instanced rendering not supported'); }, drawElementsInstanced: function drawElementsInstanced() {}, drawArraysInstanced: function drawArraysInstanced() {} }), _defineProperty(_WEBGL_CONTEXT_POLYFI, WEBGL_draw_buffers, { meta: { suffix: 'WEBGL' }, drawBuffers: function drawBuffers() { __WEBPACK_IMPORTED_MODULE_0_assert___default()(false); } }), _defineProperty(_WEBGL_CONTEXT_POLYFI, EXT_disjoint_timer_query, { meta: { suffix: 'EXT' }, // WebGL1: Polyfills the WebGL2 Query API createQuery: function createQuery() { __WEBPACK_IMPORTED_MODULE_0_assert___default()(false); }, deleteQuery: function deleteQuery() { __WEBPACK_IMPORTED_MODULE_0_assert___default()(false); }, beginQuery: function beginQuery() { __WEBPACK_IMPORTED_MODULE_0_assert___default()(false); }, endQuery: function endQuery() {}, getQuery: function getQuery(handle, pname) { return this.getQueryObject(handle, pname); }, // The WebGL1 extension uses getQueryObject rather then getQueryParameter getQueryParameter: function getQueryParameter(handle, pname) { return this.getQueryObject(handle, pname); }, // plus the additional `queryCounter` method queryCounter: function queryCounter() {}, getQueryObject: function getQueryObject() {} }), _defineProperty(_WEBGL_CONTEXT_POLYFI, EXT_disjoint_timer_query_webgl2, { meta: { suffix: 'EXT' }, // install `queryCounter` // `null` avoids overwriting WebGL1 `queryCounter` if the WebGL2 extension is not available queryCounter: null }), _defineProperty(_WEBGL_CONTEXT_POLYFI, 'OVERRIDES', { // Ensure readBuffer is a no-op readBuffer: function readBuffer(gl, originalFunc, attachment) { if (isWebGL2(gl)) { originalFunc(attachment); } else { // assert(attachment !== GL_COLOR_ATTACHMENT0 && attachment !== GL_FRONT); } }, // Override for getVertexAttrib that returns sane values for non-WebGL1 constants getVertexAttrib: function getVertexAttrib(gl, originalFunc, location, pname) { // const gl = this; // eslint-disable-line var _getExtensionData = getExtensionData(gl, ANGLE_instanced_arrays), webgl2 = _getExtensionData.webgl2, ext = _getExtensionData.ext; var GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; var GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; var result = void 0; switch (pname) { // WebGL1 attributes will never be integer case GL_VERTEX_ATTRIB_ARRAY_INTEGER: result = !webgl2 ? false : undefined;break; // if instancing is not available, return 0 meaning divisor has not been set case GL_VERTEX_ATTRIB_ARRAY_DIVISOR: result = !webgl2 && !ext ? 0 : undefined;break; default: } return result !== undefined ? result : originalFunc(location, pname); }, // Handle transform feedback and uniform block queries in WebGL1 getProgramParameter: function getProgramParameter(gl, originalFunc, program, pname) { var GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; var GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; var GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36; var GL_SEPARATE_ATTRIBS = 0x8C8D; if (!isWebGL2(gl)) { switch (pname) { case GL_TRANSFORM_FEEDBACK_BUFFER_MODE: return GL_SEPARATE_ATTRIBS; case GL_TRANSFORM_FEEDBACK_VARYINGS: return 0; case GL_ACTIVE_UNIFORM_BLOCKS: return 0; default: } } return originalFunc(program, pname); }, getInternalformatParameter: function getInternalformatParameter(gl, originalFunc, target, format, pname) { var GL_SAMPLES = 0x80A9; if (!isWebGL2(gl)) { switch (pname) { case GL_SAMPLES: return new Int32Array([0]); default: } } return gl.getInternalformatParameter(target, format, pname); }, getTexParameter: function getTexParameter(gl, originalFunc, target, pname) { var GL_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE; switch (pname) { case GL_TEXTURE_MAX_ANISOTROPY_EXT: var extensions = gl.luma.extensions; var ext = extensions[EXT_texture_filter_anisotropic]; pname = ext && ext.TEXTURE_MAX_ANISOTROPY_EXT || GL_TEXTURE_MAX_ANISOTROPY_EXT; break; default: } return originalFunc(target, pname); }, getParameter: __WEBPACK_IMPORTED_MODULE_1__polyfill_get_parameter__["a" /* getParameterPolyfill */], hint: function hint(gl, originalFunc, pname, value) { // TODO - handle GL.FRAGMENT_SHADER_DERIVATIVE_HINT: // switch (pname) { // case GL.FRAGMENT_SHADER_DERIVATIVE_HINT: // } return originalFunc(pname, value); } }), _WEBGL_CONTEXT_POLYFI); function initializeExtensions(gl) { gl.luma.extensions = {}; var EXTENSIONS = gl.getSupportedExtensions(); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = EXTENSIONS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var extension = _step.value; gl.luma[extension] = gl.getExtension(extension); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } // Polyfills a single WebGL extension into the `target` object function polyfillExtension(gl, _ref) { var extension = _ref.extension, target = _ref.target, target2 = _ref.target2; var defaults = WEBGL_CONTEXT_POLYFILLS[extension]; __WEBPACK_IMPORTED_MODULE_0_assert___default()(defaults); var _defaults$meta = defaults.meta, meta = _defaults$meta === undefined ? {} : _defaults$meta; var _meta$suffix = meta.suffix, suffix = _meta$suffix === undefined ? '' : _meta$suffix; var ext = gl.getExtension(extension); Object.keys(defaults).forEach(function (key) { var extKey = '' + key + suffix; var polyfill = null; if (key === 'meta') { // ignore } else if (typeof gl[key] === 'function') { // WebGL2 implementation is already } else if (ext && typeof ext[extKey] === 'function') { // pick extension implemenentation,if available polyfill = function polyfill() { return ext[extKey].apply(ext, arguments); }; } else if (typeof defaults[key] === 'function') { // pick the mock implementation, if no implementation was detected polyfill = defaults[key].bind(target); } if (polyfill) { target[key] = polyfill; target2[key] = polyfill; } }); } // Install simple overrides (mostly get* functions) function installOverrides(gl, _ref2) { var target = _ref2.target, target2 = _ref2.target2; var OVERRIDES = WEBGL_CONTEXT_POLYFILLS.OVERRIDES; Object.keys(OVERRIDES).forEach(function (key) { if (typeof OVERRIDES[key] === 'function') { // install an override, if no implementation was detected var originalFunc = gl[key] ? gl[key].bind(gl) : function () {}; var polyfill = OVERRIDES[key].bind(null, gl, originalFunc); target[key] = polyfill; target2[key] = polyfill; } }); } // Registers polyfill or mock functions for all known extensions function polyfillContext(gl) { gl.luma = gl.luma || {}; initializeExtensions(gl); if (!gl.luma.polyfilled) { for (var extension in WEBGL_CONTEXT_POLYFILLS) { if (extension !== 'overrides') { polyfillExtension(gl, { extension: extension, target: gl.luma, target2: gl }); } } installOverrides(gl, { target: gl.luma, target2: gl }); gl.luma.polyfilled = true; } return gl; } //# sourceMappingURL=polyfill-context.js.map /***/ }), /* 266 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return GL_PARAMETER_DEFAULTS; }); /* unused harmony export GL_PARAMETER_SETTERS */ /* unused harmony export GL_PARAMETER_GETTERS */ /* harmony export (immutable) */ __webpack_exports__["e"] = setParameter; /* harmony export (immutable) */ __webpack_exports__["c"] = setParameters; /* harmony export (immutable) */ __webpack_exports__["d"] = getParameter; /* harmony export (immutable) */ __webpack_exports__["a"] = getParameters; /* unused harmony export getDefaultParameters */ /* harmony export (immutable) */ __webpack_exports__["f"] = resetParameters; /* harmony export (immutable) */ __webpack_exports__["g"] = getModifiedParameters; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _GL_PARAMETER_DEFAULT, _GL_PARAMETER_SETTERS, _GL_PARAMETER_GETTERS; function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // Provides a unified API for getting and setting any WebGL parameter // Also knows default values of all parameters, enabling fast cache initialization // Provides base functionality for the state caching. // DEFAULT SETTINGS - FOR FAST CACHE INITIALIZATION AND CONTEXT RESETS var GL_PARAMETER_DEFAULTS = (_GL_PARAMETER_DEFAULT = {}, _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_COLOR, new Float32Array([0, 0, 0, 0])), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_RGB, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FUNC_ADD), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_ALPHA, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FUNC_ADD), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_RGB, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].ONE), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_RGB, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].ZERO), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_ALPHA, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].ONE), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_ALPHA, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].ZERO), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_CLEAR_VALUE, new Float32Array([0, 0, 0, 0])), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_WRITEMASK, [true, true, true, true]), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CULL_FACE, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CULL_FACE_MODE, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BACK), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_TEST, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_CLEAR_VALUE, 1), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_FUNC, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].LESS), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_RANGE, new Float32Array([0, 1])), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_WRITEMASK, true), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DITHER, true), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRAMEBUFFER_BINDING, null), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT_FACE, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CCW), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].GENERATE_MIPMAP_HINT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DONT_CARE), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].LINE_WIDTH, 1), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FILL, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FACTOR, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_UNITS, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_VALUE, 1.0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_INVERT, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SCISSOR_TEST, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SCISSOR_BOX, new Int32Array([0, 0, 1024, 1024])), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_TEST, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_CLEAR_VALUE, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_WRITEMASK, 0xFFFFFFFF), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_WRITEMASK, 0xFFFFFFFF), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FUNC, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].ALWAYS), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_REF, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_VALUE_MASK, 0xFFFFFFFF), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FUNC, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].ALWAYS), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_REF, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_VALUE_MASK, 0xFFFFFFFF), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FAIL, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].KEEP), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_FAIL, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].KEEP), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_PASS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].KEEP), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FAIL, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].KEEP), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_FAIL, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].KEEP), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_PASS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].KEEP), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].VIEWPORT, new Int32Array([0, 0, 1024, 1024])), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_ALIGNMENT, 4), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_ALIGNMENT, 4), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_FLIP_Y_WEBGL, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_PREMULTIPLY_ALPHA_WEBGL, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_COLORSPACE_CONVERSION_WEBGL, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BROWSER_DEFAULT_WEBGL), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRAGMENT_SHADER_DERIVATIVE_HINT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DONT_CARE), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_FRAMEBUFFER_BINDING, null), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].RASTERIZER_DISCARD, false), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_ROW_LENGTH, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_SKIP_PIXELS, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_SKIP_ROWS, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_ROW_LENGTH, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_IMAGE_HEIGHT, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_SKIP_PIXELS, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_SKIP_ROWS, 0), _defineProperty(_GL_PARAMETER_DEFAULT, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_SKIP_IMAGES, 0), _GL_PARAMETER_DEFAULT); // SETTER TABLES - ENABLES SETTING ANY PARAMETER WITH A COMMON API var enable = function enable(gl, value, key) { return value ? gl.enable(key) : gl.disable(key); }; var hint = function hint(gl, value, key) { return gl.hint(key, value); }; var pixelStorei = function pixelStorei(gl, value, key) { return gl.pixelStorei(key, value); }; var drawFramebuffer = function drawFramebuffer(gl, value) { var target = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_context__["b" /* isWebGL2 */])(gl) ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DRAW_FRAMEBUFFER : __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRAMEBUFFER; return gl.bindFramebuffer(target, value); }; var readFramebuffer = function readFramebuffer(gl, value) { return gl.bindFramebuffer(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_FRAMEBUFFER, value); }; // Map from WebGL parameter names to corresponding WebGL setter functions // WegGL constants are read by parameter names, but set by function names // NOTE: When value type is a string, it will be handled by 'COMPOSITE_GL_PARAMETER_SETTERS' var GL_PARAMETER_SETTERS = (_GL_PARAMETER_SETTERS = {}, _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_COLOR, function (gl, value) { return gl.blendColor.apply(gl, _toConsumableArray(value)); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_RGB, 'blendEquation'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_ALPHA, 'blendEquation'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_RGB, 'blendFunc'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_RGB, 'blendFunc'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_ALPHA, 'blendFunc'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_ALPHA, 'blendFunc'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_CLEAR_VALUE, function (gl, value) { return gl.clearColor.apply(gl, _toConsumableArray(value)); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_WRITEMASK, function (gl, value) { return gl.colorMask.apply(gl, _toConsumableArray(value)); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CULL_FACE, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CULL_FACE_MODE, function (gl, value) { return gl.cullFace(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_TEST, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_CLEAR_VALUE, function (gl, value) { return gl.clearDepth(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_FUNC, function (gl, value) { return gl.depthFunc(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_RANGE, function (gl, value) { return gl.depthRange.apply(gl, _toConsumableArray(value)); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_WRITEMASK, function (gl, value) { return gl.depthMask(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DITHER, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRAGMENT_SHADER_DERIVATIVE_HINT, hint), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRAMEBUFFER_BINDING, drawFramebuffer), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT_FACE, function (gl, value) { return gl.frontFace(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].GENERATE_MIPMAP_HINT, hint), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].LINE_WIDTH, function (gl, value) { return gl.lineWidth(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FILL, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FACTOR, 'polygonOffset'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_UNITS, 'polygonOffset'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].RASTERIZER_DISCARD, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_VALUE, 'sampleCoverage'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_INVERT, 'sampleCoverage'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SCISSOR_TEST, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SCISSOR_BOX, function (gl, value) { return gl.scissor.apply(gl, _toConsumableArray(value)); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_TEST, enable), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_CLEAR_VALUE, function (gl, value) { return gl.clearStencil(value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_WRITEMASK, function (gl, value) { return gl.stencilMaskSeparate(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT, value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_WRITEMASK, function (gl, value) { return gl.stencilMaskSeparate(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BACK, value); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FUNC, 'stencilFuncFront'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_REF, 'stencilFuncFront'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_VALUE_MASK, 'stencilFuncFront'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FUNC, 'stencilFuncBack'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_REF, 'stencilFuncBack'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_VALUE_MASK, 'stencilFuncBack'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FAIL, 'stencilOpFront'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_FAIL, 'stencilOpFront'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_PASS, 'stencilOpFront'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FAIL, 'stencilOpBack'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_FAIL, 'stencilOpBack'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_PASS, 'stencilOpBack'), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].VIEWPORT, function (gl, value) { return gl.viewport.apply(gl, _toConsumableArray(value)); }), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_ALIGNMENT, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_ALIGNMENT, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_FLIP_Y_WEBGL, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_PREMULTIPLY_ALPHA_WEBGL, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_COLORSPACE_CONVERSION_WEBGL, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_ROW_LENGTH, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_SKIP_PIXELS, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].PACK_SKIP_ROWS, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_FRAMEBUFFER_BINDING, readFramebuffer), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_ROW_LENGTH, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_IMAGE_HEIGHT, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_SKIP_PIXELS, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_SKIP_ROWS, pixelStorei), _defineProperty(_GL_PARAMETER_SETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNPACK_SKIP_IMAGES, pixelStorei), _GL_PARAMETER_SETTERS); // COMPOSITE_WEBGL_PARAMETER_ var COMPOSITE_GL_PARAMETER_SETTERS = { blendEquation: function blendEquation(gl, values) { return gl.blendEquationSeparate(values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_RGB], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_EQUATION_ALPHA]); }, blendFunc: function blendFunc(gl, values) { return gl.blendFuncSeparate(values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_RGB], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_RGB], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_SRC_ALPHA], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND_DST_ALPHA]); }, polygonOffset: function polygonOffset(gl, values) { return gl.polygonOffset(values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FACTOR], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_UNITS]); }, sampleCoverage: function sampleCoverage(gl, values) { return gl.sampleCoverage(values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_VALUE], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE_INVERT]); }, stencilFuncFront: function stencilFuncFront(gl, values) { return gl.stencilFuncSeparate(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT, values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FUNC], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_REF], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_VALUE_MASK]); }, stencilFuncBack: function stencilFuncBack(gl, values) { return gl.stencilFuncSeparate(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BACK, values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FUNC], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_REF], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_VALUE_MASK]); }, stencilOpFront: function stencilOpFront(gl, values) { return gl.stencilOpSeparate(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].FRONT, values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_FAIL], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_FAIL], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_PASS_DEPTH_PASS]); }, stencilOpBack: function stencilOpBack(gl, values) { return gl.stencilOpSeparate(__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BACK, values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_FAIL], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_FAIL], values[__WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_BACK_PASS_DEPTH_PASS]); } }; // GETTER TABLE - FOR READING OUT AN ENTIRE CONTEXT var isEnabled = function isEnabled(gl, key) { return gl.isEnabled(key); }; // Exceptions for any keys that cannot be queried by gl.getParameters var GL_PARAMETER_GETTERS = (_GL_PARAMETER_GETTERS = {}, _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].BLEND, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].CULL_FACE, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DEPTH_TEST, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].DITHER, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].POLYGON_OFFSET_FILL, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_ALPHA_TO_COVERAGE, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLE_COVERAGE, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SCISSOR_TEST, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].STENCIL_TEST, isEnabled), _defineProperty(_GL_PARAMETER_GETTERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].RASTERIZER_DISCARD, isEnabled), _GL_PARAMETER_GETTERS); // HELPER METHODS var deepArrayEqual = function deepArrayEqual(x, y) { if (x === y) { return true; } var isArrayX = Array.isArray(x) || ArrayBuffer.isView(x); var isArrayY = Array.isArray(y) || ArrayBuffer.isView(y); if (isArrayX && isArrayY && x.length === y.length) { for (var i = 0; i < x.length; ++i) { if (x[i] !== y[i]) { return false; } } return true; } return false; }; // PUBLIC METHODS // Sets any single GL parameter regardless of function (gl.getParameter/gl.isEnabled...) // Returns the previous value // Note: limited to parameter values function setParameter(gl, key, value) { var getter = GL_PARAMETER_GETTERS[key]; var prevValue = getter ? getter(gl, Number(key)) : gl.getParameter(Number(key)); var setter = GL_PARAMETER_SETTERS[key]; __WEBPACK_IMPORTED_MODULE_2_assert___default()(typeof setter === 'function'); setter(gl, value, Number(key)); return prevValue; } // Sets any GL parameter regardless of function (gl.blendMode, ...) // Note: requires a `cache` object to be set on the context (gl.state.cache) // This object is used to fill in any missing values for composite setter functions function setParameters(gl, values) { var compositeSetters = {}; // HANDLE PRIMITIVE SETTERS (and make note of any composite setters) for (var key in values) { var setter = GL_PARAMETER_SETTERS[key]; if (setter) { // Composite setters should only be called once, so save them if (typeof setter === 'string') { compositeSetters[setter] = true; // only call setter if value has changed // TODO - deep equal on values? } else { // Note - the setter will automatically update this.state setter(gl, values[key], Number(key)); } } } // HANDLE COMPOSITE SETTERS // NOTE: any non-provided values needed by composite setters are filled in from state cache // The cache parameter is automatically retrieved from the context // This depends on `trackContextState`, which is technically a "circular" dependency. // But it is too inconvenient to always require a cache parameter here. // This is the ONLY external dependency in this module/ var cache = gl.state && gl.state.cache; if (cache) { var mergedValues = Object.assign({}, cache, values); for (var _key in compositeSetters) { // TODO - avoid calling composite setters if values have not changed. var compositeSetter = COMPOSITE_GL_PARAMETER_SETTERS[_key]; // Note - if `trackContextState` has been called, // the setter will automatically update this.state.cache compositeSetter(gl, mergedValues); } } // Add a log for the else case? } // Queries any single GL parameter regardless of function (gl.getParameter/gl.isEnabled...) function getParameter(gl, key) { var getter = GL_PARAMETER_GETTERS[key]; return getter ? getter(gl, Number(key)) : gl.getParameter(Number(key)); } // Copies the state from a context (gl.getParameter should not be overriden) // Reads the entire WebGL state from a context // Caveat: This generates a huge amount of synchronous driver roundtrips and should be // considered a very slow operation, to be used only if/when a context already manipulated // by external code needs to be synchronized for the first time // @return {Object} - a newly created map, with values keyed by GL parameters function getParameters(gl, parameters) { // default to querying all parameters parameters = parameters || GL_PARAMETER_DEFAULTS; // support both arrays of parameters and objects (keys represent parameters) var parameterKeys = Array.isArray(parameters) ? parameters : Object.keys(parameters); var state = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = parameterKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; state[key] = getParameter(gl, key); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return state; } function getDefaultParameters(gl) { // TODO - Query GL.VIEWPORT and GL.SCISSOR_BOX since these are dynamic return Object.assign({}, GL_PARAMETER_DEFAULTS, { // TODO: For viewport and scissor default values are set at the time of // context creation based on canvas size, we can query them here but it will // not match with what we have in GL_PARAMETER_DEFAULTS table, we should revisit. // [GL.VIEWPORT]: gl.constructor.prototype.getParameter.call(gl, GL.VIEWPORT), // [GL.SCISSOR_BOX]: gl.constructor.prototype.getParameter.call(gl, GL.SCISSOR_BOX) }); } // Reset all parameters to a pure context state function resetParameters(gl) { setParameters(gl, getDefaultParameters(gl)); } // Get all parameters that have been modified from a pure context state function getModifiedParameters(gl) { var values = getParameters(GL_PARAMETER_DEFAULTS); var modified = {}; for (var key in GL_PARAMETER_DEFAULTS) { if (!deepArrayEqual(values[key], GL_PARAMETER_DEFAULTS[key])) { modified[key] = values[key]; } } return modified; } //# sourceMappingURL=set-parameters.js.map /***/ }), /* 267 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export GLenum */ /* unused harmony export GLfloat */ /* unused harmony export GLint */ /* unused harmony export GLuint */ /* unused harmony export GLboolean */ /* harmony export (immutable) */ __webpack_exports__["a"] = installParameterDefinitions; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__ = __webpack_require__(46); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__buffer__ = __webpack_require__(67); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__fence_sync__ = __webpack_require__(271); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__framebuffer__ = __webpack_require__(69); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__program__ = __webpack_require__(109); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__renderbuffer__ = __webpack_require__(110); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__sampler__ = __webpack_require__(274); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__texture__ = __webpack_require__(62); var _BUFFER_PARAMETERS, _FRAMEBUFFER_STATUS, _PROGRAM_PARAMETERS, _RENDERBUFFER_PARAMET, _SAMPLER_PARAMETERS, _TEXTURE_PARAMETERS; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } // Parameter support. // Installs definitions that enable querying an object for all its parameters // with resource.getParameters(). This is mainly useful during debugging. // Note: Kept separate to avoid bundling in production applications // TODO - separate install parameter definitions function from api metadata // import Shader from './shader'; // WebGL specification 'types' var GLenum = 'GLenum'; var GLfloat = 'GLfloat'; var GLint = 'GLint'; var GLuint = 'GLint'; var GLboolean = 'GLboolean'; /* TODO - will most likely remove some of these fields from the main struct but they can be useful for debugging/seer integration, so keep them here for now export const DBG_PARAMETERS = { blend: { type: GLboolean, params: GL.BLEND, value: false, setter: (gl, value) => value ? gl.enable(GL.BLEND) : gl.disable(GL.BLEND) }, blendColor: { type: new Float32Array(4), value: new Float32Array([0, 0, 0, 0]), params: GL.BLEND_COLOR, setter: (gl, value) => gl.blendColor(...value) }, blendEquation: { type: [GLenum, GLenum], object: ['rgb', 'alpha'], alias: 'blendEquationSeparate', value: [GL.FUNC_ADD, GL.FUNC_ADD], params: [GL.BLEND_EQUATION_RGB, GL.BLEND_EQUATION_ALPHA], setter: (gl, value) => gl.blendEquationSeparate(...value), normalizeArgs: args => isArray(args) ? args : [args, args] }, // blend func blendFunc: { type: [GLenum, GLenum, GLenum, GLenum], object: ['srcRgb', 'dstRgb', 'srcAlpha', 'dstAlpha'], value: [GL.ONE, GL.ZERO, GL.ONE, GL.ZERO], params: [GL.BLEND_SRC_RGB, GL.BLEND_DST_RGB, GL.BLEND_SRC_ALPHA, GL.BLEND_DST_ALPHA], setter: (gl, value) => gl.blendFuncSeparate(...value), normalizeArgs: args => isArray(args) && args.length === 3 ? [...args, ...args] : args }, clearColor: { type: new Float32Array(4), params: GL.COLOR_CLEAR_VALUE, value: new Float32Array([0, 0, 0, 0]), // TBD setter: (gl, value) => gl.clearColor(...value) }, colorMask: { type: [GLboolean, GLboolean, GLboolean, GLboolean], params: GL.COLOR_WRITEMASK, value: [true, true, true, true], setter: (gl, value) => gl.colorMask(...value) }, // TODO - We have a name clash here cullFace: { type: GLboolean, params: GL.CULL_FACE, value: false, setter: (gl, value) => value ? gl.enable(GL.CULL_FACE) : gl.disable(GL.CULL_FACE) }, cullFaceMode: { type: GLenum, params: GL.CULL_FACE_MODE, value: GL.BACK, setter: (gl, value) => gl.cullFace(value) }, depthTest: { type: GLboolean, params: GL.DEPTH_TEST, value: false, setter: (gl, value) => value ? gl.enable(GL.DEPTH_TEST) : gl.disable(GL.DEPTH_TEST) }, depthClearValue: { type: GLfloat, params: GL.DEPTH_CLEAR_VALUE, value: 1, setter: (gl, value) => gl.clearDepth(value) }, depthFunc: { type: GLenum, params: GL.DEPTH_FUNC, value: GL.LESS, setter: (gl, value) => gl.depthFunc(value) }, depthRange: { type: new Float32Array(2), object: ['min', 'max'], params: GL.DEPTH_RANGE, value: new Float32Array([0, 1]), // TBD setter: (gl, value) => gl.depthRange(...value) }, depthWritemask: { type: GLboolean, params: GL.DEPTH_WRITEMASK, value: true, setter: (gl, value) => gl.depthMask(value) }, dither: { type: GLboolean, params: GL.DITHER, value: true, setter: (gl, value) => value ? gl.enable(GL.DITHER) : gl.disable(GL.DITHER) }, fragmentShaderDerivativeHint: { type: GLenum, params: GL.FRAGMENT_SHADER_DERIVATIVE_HINT, value: GL.DONT_CARE, setter: (gl, value) => gl.hint(GL.FRAGMENT_SHADER_DERIVATIVE_HINT, value), gl1: 'OES_standard_derivatives' }, frontFace: { type: GLenum, params: GL.FRONT_FACE, value: GL.CCW, setter: (gl, value) => gl.frontFace(value) }, // Hint for quality of images generated with glGenerateMipmap generateMipmapHint: { type: GLenum, params: GL.GENERATE_MIPMAP_HINT, value: GL.DONT_CARE, setter: (gl, value) => gl.hint(GL.GENERATE_MIPMAP_HINT, value) }, lineWidth: { type: GLfloat, params: GL.LINE_WIDTH, value: 1, setter: (gl, value) => gl.lineWidth(value) }, polygonOffsetFill: { type: GLboolean, params: GL.POLYGON_OFFSET_FILL, value: false, setter: (gl, value) => value ? gl.enable(GL.POLYGON_OFFSET_FILL) : gl.disable(GL.POLYGON_OFFSET_FILL) }, // Add small offset to fragment depth values (by factor × DZ + r × units) // Useful for rendering hidden-line images, for applying decals to surfaces, // and for rendering solids with highlighted edges. // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glPolygonOffset.xml polygonOffset: { type: [GLfloat, GLfloat], object: ['factor', 'units'], params: [GL.POLYGON_OFFSET_FACTOR, GL.POLYGON_OFFSET_UNITS], value: [0, 0], setter: (gl, value) => gl.polygonOffset(...value) }, // TODO - enabling multisampling // glIsEnabled with argument GL_SAMPLE_ALPHA_TO_COVERAGE // glIsEnabled with argument GL_SAMPLE_COVERAGE // specify multisample coverage parameters // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glSampleCoverage.xml sampleCoverage: { type: [GLfloat, GLboolean], object: ['value', 'invert'], params: [GL.SAMPLE_COVERAGE_VALUE, GL.SAMPLE_COVERAGE_INVERT], value: [1.0, false], setter: (gl, value) => gl.sampleCoverage(...value) }, scissorTest: { type: GLboolean, params: GL.SCISSOR_TEST, value: false, setter: (gl, value) => value ? gl.enable(GL.SCISSOR_TEST) : gl.disable(GL.SCISSOR_TEST) }, scissorBox: { type: new Int32Array(4), object: ['x', 'y', 'width', 'height'], // When scissor test enabled we expect users to set correct scissor box, // otherwise we default to following value array. params: GL.SCISSOR_BOX, value: new Int32Array([0, 0, 1024, 1024]), setter: (gl, value) => gl.scissor(...value) }, stencilTest: { type: GLboolean, params: GL.STENCIL_TEST, value: false, setter: (gl, value) => value ? gl.enable(GL.STENCIL_TEST) : gl.disable(GL.STENCIL_TEST) }, // Sets index used when stencil buffer is cleared. stencilClearValue: { type: GLint, params: GL.STENCIL_CLEAR_VALUE, value: 0, setter: (gl, value) => gl.clearStencil(value) }, // Sets bit mask enabling writing of individual bits in the stencil planes // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glStencilMaskSeparate.xml stencilMask: { type: [GLuint, GLuint], object: ['mask', 'backMask'], value: [0xFFFFFFFF, 0xFFFFFFFF], params: [GL.STENCIL_WRITEMASK, GL.STENCIL_BACK_WRITEMASK], setter: (gl, value) => { value = isArray(value) ? value : [value, value]; const [mask, backMask] = value; gl.stencilMaskSeparate(GL.FRONT, mask); gl.stencilMaskSeparate(GL.BACK, backMask); } }, // Set stencil testing function, reference value and mask for front and back // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glStencilFuncSeparate.xml stencilFunc: { type: [GLenum, GLint, GLuint, GLenum, GLint, GLuint], object: [ 'func', 'ref', 'valueMask', 'backFunc', 'backRef', 'backValueMask' ], value: [GL.ALWAYS, 0, 0xFFFFFFFF, GL.ALWAYS, 0, 0xFFFFFFFF], params: [ // front GL.STENCIL_FUNC, GL.STENCIL_REF, GL.STENCIL_VALUE_MASK, // back GL.STENCIL_BACK_FUNC, GL.STENCIL_BACK_REF, GL.STENCIL_BACK_VALUE_MASK ], setter: (gl, value) => { const [func, ref, mask, backFunc, backRef, backMask] = value; gl.stencilFuncSeparate(GL.FRONT, func, ref, mask); gl.stencilFuncSeparate(GL.BACK, backFunc, backRef, backMask); } }, // Specifies the action to take when the stencil test fails, front and back. // Stencil test fail action, depth test fail action, pass action // GL.KEEP, GL.ZERO, GL.REPLACE, GL.INCR, GL.INCR_WRAP, GL.DECR, GL.DECR_WRAP, // and GL.INVERT // https://www.khronos.org/opengles/sdk/docs/man/xhtml/glStencilOpSeparate.xml stencilOp: { type: [GLenum, GLenum, GLenum, GLenum, GLenum, GLenum], object: [ 'fail', 'passDepthFail', 'passDepthPass', 'backFail', 'backPassDepthFail', 'backPassDepthPass' ], params: [ // front GL.STENCIL_FAIL, GL.STENCIL_PASS_DEPTH_FAIL, GL.STENCIL_PASS_DEPTH_PASS, // back GL.STENCIL_BACK_FAIL, GL.STENCIL_BACK_PASS_DEPTH_FAIL, GL.STENCIL_BACK_PASS_DEPTH_PASS ], value: [GL.KEEP, GL.KEEP, GL.KEEP, GL.KEEP, GL.KEEP, GL.KEEP], setter: (gl, value) => { const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = value; gl.stencilOpSeparate(GL.FRONT, sfail, dpfail, dppass); gl.stencilOpSeparate(GL.BACK, backSfail, backDpfail, backDppass); } }, viewport: { type: new Int32Array(4), object: ['x', 'y', 'width', 'height'], // We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame. params: GL.VIEWPORT, value: new Int32Array([0, 0, 1024, 1024]), setter: (gl, value) => gl.viewport(...value) }, // WEBGL1 PIXEL PACK/UNPACK MODES // Packing of pixel data in memory (1,2,4,8) [GL.PACK_ALIGNMENT]: { type: GLint, params: GL.PACK_ALIGNMENT, value: 4, setter: (gl, value) => gl.pixelStorei(GL.PACK_ALIGNMENT, value) }, // Unpacking pixel data from memory(1,2,4,8) [GL.UNPACK_ALIGNMENT]: { type: GLint, params: GL.UNPACK_ALIGNMENT, value: 4, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_ALIGNMENT, value) }, // Flip source data along its vertical axis [GL.UNPACK_FLIP_Y_WEBGL]: { type: GLboolean, params: GL.UNPACK_FLIP_Y_WEBGL, value: false, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_FLIP_Y_WEBGL, value) }, // Multiplies the alpha channel into the other color channels [GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL]: { type: GLboolean, params: GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL, value: false, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_PREMULTIPLY_ALPHA_WEBGL, value) }, // Default color space conversion or no color space conversion. [GL.UNPACK_COLORSPACE_CONVERSION_WEBGL]: { type: GLenum, params: GL.UNPACK_COLORSPACE_CONVERSION_WEBGL, value: GL.BROWSER_DEFAULT_WEBGL, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_COLORSPACE_CONVERSION_WEBGL, value) }, // WEBGL2 PIXEL PACK/UNPACK MODES // Number of pixels in a row. [GL.PACK_ROW_LENGTH]: { type: GLint, params: GL.PACK_ROW_LENGTH, value: 0, setter: (gl, value) => gl.pixelStorei(GL.PACK_ROW_LENGTH, value), webgl2: true }, // Number of pixels skipped before the first pixel is written into memory. [GL.PACK_SKIP_PIXELS]: { type: GLint, params: GL.PACK_SKIP_PIXELS, value: 0, setter: (gl, value) => gl.pixelStorei(GL.PACK_SKIP_PIXELS, value), webgl2: true }, // Number of rows of pixels skipped before first pixel is written to memory. [GL.PACK_SKIP_ROWS]: { type: GLint, params: GL.PACK_SKIP_ROWS, value: 0, setter: (gl, value) => gl.pixelStorei(GL.PACK_SKIP_ROWS, value), webgl2: true }, // Number of pixels in a row. [GL.UNPACK_ROW_LENGTH]: { type: GLint, params: GL.UNPACK_ROW_LENGTH, value: 0, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_ROW_LENGTH, value), webgl2: true }, // Image height used for reading pixel data from memory [GL.UNPACK_IMAGE_HEIGHT]: { type: GLint, params: GL.UNPACK_IMAGE_HEIGHT, value: 0, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_IMAGE_HEIGHT, value), webgl2: true }, // Number of pixel images skipped before first pixel is read from memory [GL.UNPACK_SKIP_PIXELS]: { type: GLint, params: GL.UNPACK_SKIP_PIXELS, value: 0, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_SKIP_PIXELS, value), webgl2: true }, // Number of rows of pixels skipped before first pixel is read from memory [GL.UNPACK_SKIP_ROWS]: { type: GLint, params: GL.UNPACK_SKIP_ROWS, value: 0, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_SKIP_ROWS, value), webgl2: true }, // Number of pixel images skipped before first pixel is read from memory [GL.UNPACK_SKIP_IMAGES]: { type: GLint, params: GL.UNPACK_SKIP_IMAGES, value: 0, setter: (gl, value) => gl.pixelStorei(GL.UNPACK_SKIP_IMAGES, value), webgl2: true } }; */ var BUFFER_PARAMETERS = (_BUFFER_PARAMETERS = {}, _defineProperty(_BUFFER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BUFFER_SIZE, { webgl1: 0 }), _defineProperty(_BUFFER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].BUFFER_USAGE, { webgl1: 0 // GLenum indicating the usage pattern of the buffer. }), _BUFFER_PARAMETERS); var FENCE_SYNC_PARAMETERS = [__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].OBJECT_TYPE, // GLenum, type of sync object (always GL.SYNC_FENCE). __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].SYNC_STATUS, // GLenum, status of sync object (GL.SIGNALED/GL.UNSIGNALED) __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].SYNC_CONDITION, // GLenum. object condition (always GL.SYNC_GPU_COMMANDS_COMPLETE). __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].SYNC_FLAGS // GLenum, flags sync object was created with (always 0) ]; var FRAMEBUFFER_ATTACHMENT_PARAMETERS = [__WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_OBJECT_NAME, // WebGLRenderbuffer or WebGLTexture __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE, // GL.RENDERBUFFER, GL.TEXTURE, GL.NONE __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE, // GL.TEXTURE_CUBE_MAP_POSITIVE_X, etc. __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL, // GLint // EXT_sRGB or WebGL2 __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING, // GL.LINEAR, GL.SRBG // WebGL2 __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_RED_SIZE, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_GREEN_SIZE, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_BLUE_SIZE, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE, // GLint __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE // GL.FLOAT, GL.INT, GL.UNSIGNED_INT, GL.SIGNED_NORMALIZED, OR GL.UNSIGNED_NORMALIZED. ]; var FRAMEBUFFER_STATUS = (_FRAMEBUFFER_STATUS = {}, _defineProperty(_FRAMEBUFFER_STATUS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_COMPLETE, 'Success. Framebuffer is correctly set up'), _defineProperty(_FRAMEBUFFER_STATUS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_INCOMPLETE_ATTACHMENT, 'Framebuffer attachment types mismatched or some attachment point not attachment complete'), _defineProperty(_FRAMEBUFFER_STATUS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT, 'Framebuffer has no attachment'), _defineProperty(_FRAMEBUFFER_STATUS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_INCOMPLETE_DIMENSIONS, 'Framebuffer attachments do not have the same size'), _defineProperty(_FRAMEBUFFER_STATUS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_UNSUPPORTED, 'Framebuffer attachment format not supported or depth and stencil attachments are not same'), _defineProperty(_FRAMEBUFFER_STATUS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].FRAMEBUFFER_INCOMPLETE_MULTISAMPLE, 'Framebuffer attachement SAMPLES differs among renderbuffers, or are mixed with textures'), _FRAMEBUFFER_STATUS); var PROGRAM_PARAMETERS = (_PROGRAM_PARAMETERS = {}, _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].DELETE_STATUS, { webgl1: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].LINK_STATUS, { webgl1: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].VALIDATE_STATUS, { webgl1: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].ATTACHED_SHADERS, { webgl1: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].ACTIVE_ATTRIBUTES, { webgl1: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].ACTIVE_UNIFORMS, { webgl1: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TRANSFORM_FEEDBACK_BUFFER_MODE, { webgl2: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TRANSFORM_FEEDBACK_VARYINGS, { webgl2: 0 }), _defineProperty(_PROGRAM_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].ACTIVE_UNIFORM_BLOCKS, { webgl2: 0 // GLint }), _PROGRAM_PARAMETERS); // parameters var RENDERBUFFER_PARAMETERS = (_RENDERBUFFER_PARAMET = {}, _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_WIDTH, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_HEIGHT, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_INTERNAL_FORMAT, { type: 'GLenum', webgl1: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RGBA4 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_GREEN_SIZE, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_BLUE_SIZE, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_RED_SIZE, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_ALPHA_SIZE, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_DEPTH_SIZE, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_STENCIL_SIZE, { webgl1: 0 }), _defineProperty(_RENDERBUFFER_PARAMET, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].RENDERBUFFER_SAMPLES, { webgl2: 1 }), _RENDERBUFFER_PARAMET); var SAMPLER_PARAMETERS = (_SAMPLER_PARAMETERS = {}, _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MAG_FILTER, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MIN_FILTER, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WRAP_S, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WRAP_T, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WRAP_R, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_BASE_LEVEL, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MAX_LEVEL, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_COMPARE_FUNC, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_COMPARE_MODE, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MIN_LOD, { webgl2: true }), _defineProperty(_SAMPLER_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MAX_LOD, { webgl2: true // maximum level-of-detail value // [GL.TEXTURE_MAX_ANISOTROPY_EXT]: {webgl2: 'EXT_texture_filter_anisotropic'} }), _SAMPLER_PARAMETERS); // const SHADER_PARAMETERS = [ // GL.DELETE_STATUS, // GLboolean - whether shader is flagged for deletion. // GL.COMPILE_STATUS, // GLboolean - was last shader compilation successful. // GL.SHADER_TYPE // GLenum - GL.VERTEX_SHADER or GL.FRAGMENT_SHADER. // ]; var TEXTURE_PARAMETERS = (_TEXTURE_PARAMETERS = {}, _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MAG_FILTER, { type: 'GLenum', webgl1: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].LINEAR }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MIN_FILTER, { type: 'GLenum', webgl1: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].NEAREST_MIPMAP_LINEAR }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WRAP_S, { type: 'GLenum', webgl1: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].REPEAT }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WRAP_T, { type: 'GLenum', webgl1: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].REPEAT }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WRAP_R, { type: 'GLenum', webgl2: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].REPEAT }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_BASE_LEVEL, { webgl2: 0 }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MAX_LEVEL, { webgl2: 1000 }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_COMPARE_FUNC, { type: 'GLenum', webgl2: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].LEQUAL }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_COMPARE_MODE, { type: 'GLenum', webgl2: __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].NONE }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MIN_LOD, { webgl2: -1000 }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_MAX_LOD, { webgl2: 1000 }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_WIDTH, { webgl1: 0 }), _defineProperty(_TEXTURE_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__webgl_utils_constants__["a" /* default */].TEXTURE_HEIGHT, { webgl1: 0 }), _TEXTURE_PARAMETERS); function installParameterDefinitions() { __WEBPACK_IMPORTED_MODULE_1__buffer__["a" /* default */].PARAMETERS = BUFFER_PARAMETERS; __WEBPACK_IMPORTED_MODULE_2__fence_sync__["a" /* default */].PARAMETERS = FENCE_SYNC_PARAMETERS; __WEBPACK_IMPORTED_MODULE_3__framebuffer__["a" /* default */].ATTACHMENT_PARAMETERS = FRAMEBUFFER_ATTACHMENT_PARAMETERS; __WEBPACK_IMPORTED_MODULE_3__framebuffer__["a" /* default */].STATUS = FRAMEBUFFER_STATUS; __WEBPACK_IMPORTED_MODULE_4__program__["a" /* default */].PARAMETERS = PROGRAM_PARAMETERS; __WEBPACK_IMPORTED_MODULE_5__renderbuffer__["a" /* default */].PARAMETERS = RENDERBUFFER_PARAMETERS; __WEBPACK_IMPORTED_MODULE_6__sampler__["a" /* default */].PARAMETERS = SAMPLER_PARAMETERS; // Shader.PARAMETERS = SHADER_PARAMETERS; __WEBPACK_IMPORTED_MODULE_7__texture__["a" /* default */].PARAMETERS = TEXTURE_PARAMETERS; } //# sourceMappingURL=debug-parameters.js.map /***/ }), /* 268 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return webGLTypesAvailable; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return Image; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return WebGLRenderingContext; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return WebGLProgram; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return WebGLShader; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return WebGLBuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return WebGLFramebuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return WebGLRenderbuffer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return WebGLTexture; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return WebGLUniformLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return WebGLActiveInfo; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return WebGLShaderPrecisionFormat; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return WebGL2RenderingContext; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__init__ = __webpack_require__(106); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // WEBGL BUILT-IN TYPES // 1) Exports all WebGL constants as {GL} // 2) Enables app to "import" WebGL types // - Importing these types makes them known to eslint etc. // - Provides dummy types for WebGL2 when not available to streamline // library code. // - Exports types from headless gl when running under Node.js var DummyType = /*#__PURE__*/function DummyType() { _classCallCheck(this, DummyType); }; var _ref = __WEBPACK_IMPORTED_MODULE_0__init__["default"].globals.headlessTypes || __WEBPACK_IMPORTED_MODULE_0__init__["global"], _ref$WebGLRenderingCo = _ref.WebGLRenderingContext, WebGLRenderingContext = _ref$WebGLRenderingCo === undefined ? DummyType : _ref$WebGLRenderingCo, _ref$WebGLProgram = _ref.WebGLProgram, WebGLProgram = _ref$WebGLProgram === undefined ? DummyType : _ref$WebGLProgram, _ref$WebGLShader = _ref.WebGLShader, WebGLShader = _ref$WebGLShader === undefined ? DummyType : _ref$WebGLShader, _ref$WebGLBuffer = _ref.WebGLBuffer, WebGLBuffer = _ref$WebGLBuffer === undefined ? DummyType : _ref$WebGLBuffer, _ref$WebGLFramebuffer = _ref.WebGLFramebuffer, WebGLFramebuffer = _ref$WebGLFramebuffer === undefined ? DummyType : _ref$WebGLFramebuffer, _ref$WebGLRenderbuffe = _ref.WebGLRenderbuffer, WebGLRenderbuffer = _ref$WebGLRenderbuffe === undefined ? DummyType : _ref$WebGLRenderbuffe, _ref$WebGLTexture = _ref.WebGLTexture, WebGLTexture = _ref$WebGLTexture === undefined ? DummyType : _ref$WebGLTexture, _ref$WebGLUniformLoca = _ref.WebGLUniformLocation, WebGLUniformLocation = _ref$WebGLUniformLoca === undefined ? DummyType : _ref$WebGLUniformLoca, _ref$WebGLActiveInfo = _ref.WebGLActiveInfo, WebGLActiveInfo = _ref$WebGLActiveInfo === undefined ? DummyType : _ref$WebGLActiveInfo, _ref$WebGLShaderPreci = _ref.WebGLShaderPrecisionFormat, WebGLShaderPrecisionFormat = _ref$WebGLShaderPreci === undefined ? DummyType : _ref$WebGLShaderPreci; var webGLTypesAvailable = WebGLRenderingContext !== DummyType && WebGLProgram !== DummyType && WebGLShader !== DummyType && WebGLBuffer !== DummyType && WebGLFramebuffer !== DummyType && WebGLRenderbuffer !== DummyType && WebGLTexture !== DummyType && WebGLUniformLocation !== DummyType && WebGLActiveInfo !== DummyType && WebGLShaderPrecisionFormat !== DummyType; // Ensures that WebGL2RenderingContext is defined in non-WebGL2 environments // so that apps can test their gl contexts with instanceof // E.g. if (gl instanceof WebGL2RenderingContext) { } function getWebGL2RenderingContext() { var WebGL2RenderingContextNotSupported = /*#__PURE__*/function WebGL2RenderingContextNotSupported() { _classCallCheck(this, WebGL2RenderingContextNotSupported); }; return __WEBPACK_IMPORTED_MODULE_0__init__["global"].WebGL2RenderingContext || WebGL2RenderingContextNotSupported; } // Ensure that Image is defined under Node.js function getImage() { var ImageNotSupported = /*#__PURE__*/function ImageNotSupported() { _classCallCheck(this, ImageNotSupported); }; return __WEBPACK_IMPORTED_MODULE_0__init__["global"].Image || ImageNotSupported; } var WebGL2RenderingContext = getWebGL2RenderingContext(); var Image = getImage(); // Export the standard WebGL types //# sourceMappingURL=types.js.map /***/ }), /* 269 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export enableDebug */ /* harmony export (immutable) */ __webpack_exports__["a"] = makeDebugContext; /* unused harmony export getRealContext */ /* unused harmony export getDebugContext */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_webgl_debug__ = __webpack_require__(688); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_webgl_debug___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_webgl_debug__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__api_debug_parameters__ = __webpack_require__(267); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Khronos Debug support module __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__api_debug_parameters__["a" /* installParameterDefinitions */])(); // Helper to get shared context data function getContextData(gl) { gl.luma = gl.luma || {}; return gl.luma; } // Enable or disable debug checks in debug contexts // Non-debug contexts do not have checks (to ensure performance) // Turning off debug for debug contexts removes most of the performance penalty function enableDebug(debug) { __WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].debug = debug; } // Returns (a potentially new) context with debug instrumentation turned off or on. // Note that this actually returns a new context function makeDebugContext(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, debug = _ref.debug; if (gl === null) { // Return to ensure we don't create a context in this case. return null; } return debug ? getDebugContext(gl) : getRealContext(gl); } // Returns the real context from either of the real/debug contexts function getRealContext(gl) { if (gl === null) { // Return to ensure we don't create a context in this case. return null; } var data = getContextData(gl); // If the context has a realContext member, it is a debug context so return the realContext return data.realContext ? data.realContext : gl; } // Returns the debug context from either of the real/debug contexts function getDebugContext(gl) { if (gl === null) { // Return to ensure we don't create a context in this case. return null; } var data = getContextData(gl); // If this *is* a debug context, return itself if (data.realContext) { return gl; } // If this already has a debug context, return it. if (data.debugContext) { return data.debugContext; } // Create a new debug context var WebGLDebugContext = /*#__PURE__*/function WebGLDebugContext() { _classCallCheck(this, WebGLDebugContext); }; var debugContext = __WEBPACK_IMPORTED_MODULE_0_webgl_debug___default.a.makeDebugContext(gl, throwOnError, validateArgsAndLog); Object.assign(WebGLDebugContext.prototype, debugContext); // Store the debug context data.debugContext = debugContext; debugContext.debug = true; debugContext.gl = gl; // Return it return debugContext; } // DEBUG TRACING function getFunctionString(functionName, functionArgs) { var args = __WEBPACK_IMPORTED_MODULE_0_webgl_debug___default.a.glFunctionArgsToString(functionName, functionArgs); args = '' + args.slice(0, 100) + (args.length > 100 ? '...' : ''); return 'gl.' + functionName + '(' + args + ')'; } function throwOnError(err, functionName, args) { if (!__WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].nothrow) { var errorMessage = __WEBPACK_IMPORTED_MODULE_0_webgl_debug___default.a.glEnumToString(err); var functionArgs = __WEBPACK_IMPORTED_MODULE_0_webgl_debug___default.a.glFunctionArgsToString(functionName, args); throw new Error(errorMessage + ' in gl.' + functionName + '(' + functionArgs + ')'); } } // Don't generate function string until it is needed function validateArgsAndLog(functionName, functionArgs) { if (!__WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].debug) { return; } var functionString = void 0; if (__WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].priority >= 4) { functionString = getFunctionString(functionName, functionArgs); __WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].info(4, '' + functionString); } if (__WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].break) { functionString = functionString || getFunctionString(functionName, functionArgs); var isBreakpoint = __WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].break && __WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].break.every(function (breakOn) { return functionString.indexOf(breakOn) !== -1; }); if (isBreakpoint) { /* eslint-disable no-debugger */ debugger; /* eslint-enable no-debugger */ } } var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = functionArgs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var arg = _step.value; if (arg === undefined) { functionString = functionString || getFunctionString(functionName, functionArgs); throw new Error('Undefined argument: ' + functionString); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } //# sourceMappingURL=context-debug.js.map /***/ }), /* 270 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = draw; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); /* eslint-disable */ // TODO - generic draw call // One of the good things about GL is that there are so many ways to draw things // A good thing about webGL is that there are so many ways to draw things, // e.g. depending on whether data is indexed and/or isInstanced. // This function unifies those into a single call with simple parameters // that have sane defaults. function draw(gl, _ref) { var _ref$drawMode = _ref.drawMode, drawMode = _ref$drawMode === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES : _ref$drawMode, vertexCount = _ref.vertexCount, _ref$offset = _ref.offset, offset = _ref$offset === undefined ? 0 : _ref$offset, _ref$isIndexed = _ref.isIndexed, isIndexed = _ref$isIndexed === undefined ? false : _ref$isIndexed, _ref$indexType = _ref.indexType, indexType = _ref$indexType === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].UNSIGNED_SHORT : _ref$indexType, _ref$isInstanced = _ref.isInstanced, isInstanced = _ref$isInstanced === undefined ? false : _ref$isInstanced, _ref$instanceCount = _ref.instanceCount, instanceCount = _ref$instanceCount === undefined ? 0 : _ref$instanceCount; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["j" /* assertWebGLContext */])(gl); var extension = gl.getExtension('ANGLE_instanced_arrays'); // TODO - Use polyfilled WebGL2RenderingContext instead of ANGLE extension if (isInstanced) { var webgl2 = isWebGL2(gl); var _extension = gl.getExtension('ANGLE_instanced_arrays'); var context = webgl2 ? gl : _extension; var suffix = webgl2 ? '' : 'ANGLE'; var drawElements = 'drawElementsInstanced' + suffix; var drawArrays = 'drawArraysInstanced' + suffix; if (isIndexed) { context[drawElements](drawMode, vertexCount, indexType, offset, instanceCount); } else { context[drawArrays](drawMode, offset, vertexCount, instanceCount); } } else if (isIndexed) { gl.drawElements(drawMode, vertexCount, indexType, offset); } else { gl.drawArrays(drawMode, offset, vertexCount); } } //# sourceMappingURL=draw.js.map /***/ }), /* 271 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__helpers_query_manager__ = __webpack_require__(166); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var FenceSync = /*#__PURE__*/function (_Resource) { _inherits(FenceSync, _Resource); /* * @class * @param {WebGL2RenderingContext} gl */ function FenceSync(gl, opts) { _classCallCheck(this, FenceSync); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(gl); // query manager needs a promise field var _this = _possibleConstructorReturn(this, (FenceSync.__proto__ || Object.getPrototypeOf(FenceSync)).call(this, gl, opts)); _this.promise = null; Object.seal(_this); return _this; } /** * The method is a no-op in the absence of the possibility of * synchronizing between multiple GL contexts. * Prevent commands from being added to GPU command queue. * Note: commands can still be buffered in driver. * * @param {GLbitfield} flags * @param {GLint64} timeout * @return {Sync} status */ _createClass(FenceSync, [{ key: 'wait', value: function wait() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref$flags = _ref.flags, flags = _ref$flags === undefined ? 0 : _ref$flags, _ref$timeout = _ref.timeout, timeout = _ref$timeout === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TIMEOUT_IGNORED : _ref$timeout; this.gl.waitSync(this.handle, flags, timeout); return this; } /** * Block all CPU operations until fence is signalled * @param {GLbitfield} flags * @param {GLint64} timeout * @return {GLenum} result */ }, { key: 'clientWait', value: function clientWait(_ref2) { var _ref2$flags = _ref2.flags, flags = _ref2$flags === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SYNC_FLUSH_COMMANDS_BIT : _ref2$flags, timeout = _ref2.timeout; var result = this.gl.clientWaitSync(this.handle, flags, timeout); // TODO - map to boolean? switch (result) { case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].ALREADY_SIGNALED: // Indicates that sync object was signaled when this method was called. break; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TIMEOUT_EXPIRED: // Indicates that timeout time passed, sync object did not become signaled break; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].CONDITION_SATISFIED: // Indicates that sync object was signaled before timeout expired. break; case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].WAIT_FAILED: // Indicates that an error occurred during execution. break; default: } return result; } }, { key: 'cancel', value: function cancel() { __WEBPACK_IMPORTED_MODULE_3__helpers_query_manager__["a" /* default */].cancelQuery(this); } }, { key: 'isSignaled', value: function isSignaled() { return this.getParameter(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SYNC_STATUS) === __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SIGNALED; } // TODO - Query manager needs these? }, { key: 'isResultAvailable', value: function isResultAvailable() { return this.isSignaled(); } }, { key: 'getResult', value: function getResult() { return this.isSignaled(); } }, { key: 'getParameter', value: function getParameter(pname) { return this.gl.getSyncParameter(this.handle, pname); } // PRIVATE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.fenceSync(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].SYNC_GPU_COMMANDS_COMPLETE, 0); } }, { key: '_deleteHandle', value: function _deleteHandle() { __WEBPACK_IMPORTED_MODULE_3__helpers_query_manager__["a" /* default */].deleteQuery(this); this.gl.deleteSync(this.handle); } }]); return FenceSync; }(__WEBPACK_IMPORTED_MODULE_2__resource__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (FenceSync); //# sourceMappingURL=fence-sync.js.map /***/ }), /* 272 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = readPixels; /* unused harmony export readPixelsToBuffer */ /* unused harmony export blitFramebuffer */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* eslint-disable */ // TODO - generic draw call // One of the good things about GL is that there are so many ways to draw things /** * Read pixels from a target * * Will read from the currently bound framebuffer, or the currently bound * drawing buffer - if context has been created with * preserveDrawingBuffers * * @param {WebGLRenderingContext} gl * @param {Object} opts * @param {Number} opts.x - leftmost coord to be read * @param {Number} opts.y - bottommost (or topmost if sourceHeight supplied) * @param {Number} opts.width=1 - width of area to be read * @param {Number} opts.height=1 - height of area to be read * @param {Number} opts.sourceHeight= - target height, implies top left coords * @param {Number} opts.dataOffset=0 - WebGL2 only - offset into data array * @param {Number} opts.format=GL.RBGA - Can be set to GL.RGB or GL.ALPHA * * @return {ArrayView} - types array, either passed in or autoallocated */ function readPixels(gl, _ref) { var x = _ref.x, y = _ref.y, _ref$width = _ref.width, width = _ref$width === undefined ? 1 : _ref$width, _ref$height = _ref.height, height = _ref$height === undefined ? 1 : _ref$height, data = _ref.data, _ref$dataOffset = _ref.dataOffset, dataOffset = _ref$dataOffset === undefined ? 0 : _ref$dataOffset, _ref$type = _ref.type, type = _ref$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNSIGNED_BYTE : _ref$type, sourceHeight = _ref.sourceHeight, _ref$format = _ref.format, format = _ref$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGBA : _ref$format; // Read color in the central pixel, to be mapped with picking colors data = data || new Uint8Array(4 * width * height); // If source height is specified, a top left coordinate system is used y = sourceHeight ? sourceHeight - y : y; if (dataOffset) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(gl); gl.readPixels(x, y, width, height, format, type, data, dataOffset); } else { gl.readPixels(x, y, width, height, format, type, data); } return data; } /** * Read pixels directly into webgl buffer * NOTE: WebGL2 only * * @param {WebGLRenderingContext} gl * @param {Object} options * @return {WebGLBuffer} the passed in buffer */ function readPixelsToBuffer(gl, _ref2) { var x = _ref2.x, y = _ref2.y, _ref2$width = _ref2.width, width = _ref2$width === undefined ? 1 : _ref2$width, _ref2$height = _ref2.height, height = _ref2$height === undefined ? 1 : _ref2$height, buffer = _ref2.buffer, _ref2$dataOffset = _ref2.dataOffset, dataOffset = _ref2$dataOffset === undefined ? 0 : _ref2$dataOffset, _ref2$type = _ref2.type, type = _ref2$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNSIGNED_BYTE : _ref2$type, sourceHeight = _ref2.sourceHeight, _ref2$format = _ref2.format, format = _ref2$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGBA : _ref2$format; __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(gl); // If source height is specified, a top left coordinate system is used y = sourceHeight ? sourceHeight - y : y; gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].PIXEL_PACK_BUFFER, buffer.handle); gl.readPixels(x, y, width, height, format, type, dataOffset); gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].PIXEL_PACK_BUFFER, null); return buffer; } /* * @param {} opt.filter */ function blitFramebuffer(gl, _ref3) { var _ref3$source = _slicedToArray(_ref3.source, 4), sourceX = _ref3$source[0], sourceY = _ref3$source[1], sourceWidth = _ref3$source[2], sourceHeight = _ref3$source[3], _ref3$dest = _slicedToArray(_ref3.dest, 4), destX = _ref3$dest[0], destY = _ref3$dest[1], destWidth = _ref3$dest[2], destHeight = _ref3$dest[3], _ref3$mask = _ref3.mask, mask = _ref3$mask === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].COLOR_BUFFER_BIT | __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].DEPTH_BUFFER_BIT | __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].STENCIL_BUFFER_BIT : _ref3$mask, _ref3$filter = _ref3.filter, filter = _ref3$filter === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].LINEAR : _ref3$filter; } //# sourceMappingURL=functions.js.map /***/ }), /* 273 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__ = __webpack_require__(166); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context_features__ = __webpack_require__(108); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__webgl_utils__ = __webpack_require__(60); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // WebGL2 Query (also handles disjoint timer extensions) var noop = function noop(x) { return x; }; var ERR_GPU_DISJOINT = 'Disjoint GPU operation invalidated timer queries'; var ERR_TIMER_QUERY_NOT_SUPPORTED = 'Timer queries require "EXT_disjoint_timer_query" extension'; var GL_QUERY_COUNTER_BITS_EXT = 0x8864; // # bits in query result for the given target. var GL_QUERY_RESULT = 0x8866; // Returns a GLuint containing the query result. var GL_QUERY_RESULT_AVAILABLE = 0x8867; // whether query result is available. var GL_TIME_ELAPSED_EXT = 0x88BF; // Elapsed time (in nanoseconds). var GL_TIMESTAMP_EXT = 0x8E28; // The current time. var GL_GPU_DISJOINT_EXT = 0x8FBB; // Whether GPU performed any disjoint operation. var GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; // #primitives written to feedback buffers var GL_ANY_SAMPLES_PASSED = 0x8C2F; // Occlusion query (if drawing passed depth test) var GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; // Occlusion query less accurate/faster version var Query = /*#__PURE__*/function (_Resource) { _inherits(Query, _Resource); _createClass(Query, null, [{ key: 'isSupported', // Returns true if Query is supported by the WebGL implementation // Can also check whether timestamp queries are available. value: function isSupported(gl) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$queries = _ref.queries, queries = _ref$queries === undefined ? false : _ref$queries, _ref$timers = _ref.timers, timers = _ref$timers === undefined ? false : _ref$timers, _ref$timestamps = _ref.timestamps, timestamps = _ref$timestamps === undefined ? false : _ref$timestamps; var webgl2 = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_3__context__["b" /* isWebGL2 */])(gl); var hasTimerQueries = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context_features__["c" /* hasFeatures */])(gl, __WEBPACK_IMPORTED_MODULE_2__context_features__["a" /* FEATURES */].TIMER_QUERY); var supported = webgl2 || hasTimerQueries; if (queries) { supported = supported && webgl2; } if (timers) { supported = supported && hasTimerQueries; } if (timestamps) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_4__webgl_utils__["f" /* polyfillContext */])(gl); var queryCounterBits = gl.getQuery(GL_TIMESTAMP_EXT, GL_QUERY_COUNTER_BITS_EXT); supported = supported && queryCounterBits > 0; } return supported; } // Create a query class }]); function Query(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Query); var _this = _possibleConstructorReturn(this, (Query.__proto__ || Object.getPrototypeOf(Query)).call(this, gl, opts)); var _opts$onComplete = opts.onComplete, onComplete = _opts$onComplete === undefined ? noop : _opts$onComplete, _opts$onError = opts.onError, onError = _opts$onError === undefined ? noop : _opts$onError; _this.target = null; _this.onComplete = onComplete; _this.onError = onError; // query manager needs a promise field _this.promise = null; Object.seal(_this); return _this; } // Shortcut for timer query (dependent on extension in both WebGL1 and 2) // Measures GPU time delta between this call and a matching `end` call in the // GPU instruction stream. _createClass(Query, [{ key: 'beginTimeElapsedQuery', value: function beginTimeElapsedQuery() { return this.begin(GL_TIME_ELAPSED_EXT); } // Shortcut for occlusion queries }, { key: 'beginOcclusionQuery', value: function beginOcclusionQuery() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$conservative = _ref2.conservative, conservative = _ref2$conservative === undefined ? false : _ref2$conservative; return this.begin(conservative ? GL_ANY_SAMPLES_PASSED_CONSERVATIVE : GL_ANY_SAMPLES_PASSED); } // Shortcut for transformFeedbackQuery }, { key: 'beginTransformFeedbackQuery', value: function beginTransformFeedbackQuery() { return this.begin(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN); } // Generates a GPU time stamp when the GPU instruction stream reaches this instruction. // To measure time deltas, two timestamp queries are needed. // Note: timestamp() queries may not be available even when the timer query extension is. }, { key: 'getTimestamp', value: function getTimestamp() { __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].beginQuery(this, this.onComplete, this.onError); try { this.gl.queryCounter(this.handle, GL_TIMESTAMP_EXT); } catch (error) { __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].rejectQuery(this, ERR_TIMER_QUERY_NOT_SUPPORTED); } return this; } // Due to OpenGL API limitations, after calling `begin()` on one Query // instance, `end()` must be called on that same instance before // calling `begin()` on another query. While there can be multiple // outstanding queries representing disjoint `begin()`/`end()` intervals. // It is not possible to interleave or overlap `begin` and `end` calls. }, { key: 'begin', value: function begin(target) { // - Triggering a new query when a Query is already tracking an // unresolved query causes that query to be cancelled. __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].beginQuery(this, this.onComplete, this.onError); this.target = target; try { this.gl.beginQuery(this.target, this.handle); } catch (error) { __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].rejectQuery(this, 'Query not supported'); } return this; } // ends the current query }, { key: 'end', value: function end() { // Note: calling end does not affect the pending promise if (this.target) { this.ext.endQuery(this.target); this.target = null; } return this; } // Cancels a pending query }, { key: 'cancel', value: function cancel() { this.end(); __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].cancelQuery(this); return this; } // Returns true if the query result is available }, { key: 'isResultAvailable', value: function isResultAvailable() { return this.gl.getQueryParameter(this.handle, GL_QUERY_RESULT_AVAILABLE); } // Returns the query result, converted to milliseconds to match JavaScript conventions. // TODO - what about non-timer queries }, { key: 'getResult', value: function getResult() { var result = this.gl.getQueryParameter(this.handle, GL_QUERY_RESULT); return Number.isFinite(result) ? result / 1e6 : 0; } }, { key: '_createHandle', value: function _createHandle() { return Query.isSupported(this.gl) ? this.gl.createQuery() : null; } }, { key: '_deleteHandle', value: function _deleteHandle() { __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].deleteQuery(this); this.gl.deleteQuery(this.handle); } }], [{ key: 'poll', value: function poll(gl) { __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].poll(gl); } }]); return Query; }(__WEBPACK_IMPORTED_MODULE_0__resource__["a" /* default */]); // NOTE: This call lets the queryManager know how to detect disjoint GPU state // It will check dsjoint state on polls and before adding a new query // and reject any outstanding TimerQueries with our supplied error message. /* harmony default export */ __webpack_exports__["a"] = (Query); __WEBPACK_IMPORTED_MODULE_1__helpers_query_manager__["a" /* default */].setInvalidator({ queryType: Query, errorMessage: ERR_GPU_DISJOINT, // Note: Querying the disjoint state resets it checkInvalid: function checkInvalid(gl) { return gl.getParameter(GL_GPU_DISJOINT_EXT); } }); //# sourceMappingURL=query.js.map /***/ }), /* 274 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__resource__ = __webpack_require__(30); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable no-inline-comments */ var Sampler = /*#__PURE__*/function (_Resource) { _inherits(Sampler, _Resource); _createClass(Sampler, null, [{ key: 'isSupported', value: function isSupported(gl) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl); } }, { key: 'isHandle', value: function isHandle(handle) { return this.gl.isSampler(this.handle); } }]); function Sampler(gl, opts) { _classCallCheck(this, Sampler); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(gl); var _this = _possibleConstructorReturn(this, (Sampler.__proto__ || Object.getPrototypeOf(Sampler)).call(this, gl, opts)); Object.seal(_this); return _this; } /** * Bind to the same texture unit as a texture to control sampling for that texture * @param {GLuint} unit - texture unit index * @return {Sampler} - returns self to enable chaining */ _createClass(Sampler, [{ key: 'bind', value: function bind(unit) { this.gl.bindSampler(unit, this.handle); return this; } /** * Bind to the same texture unit as a texture to control sampling for that texture * @param {GLuint} unit - texture unit index * @return {Sampler} - returns self to enable chaining */ }, { key: 'unbind', value: function unbind(unit) { this.gl.bindSampler(unit, null); return this; } // RESOURCE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.createSampler(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteSampler(this.handle); } }, { key: '_getParameter', value: function _getParameter(pname) { var value = this.gl.getSamplerParameter(this.handle, pname); return value; } }, { key: '_setParameter', value: function _setParameter(pname, param) { // Apparently there are some conversion integer/float rules that made // the WebGL committe expose two parameter setting functions in JavaScript. // For now, pick the float version for parameters specified as GLfloat. switch (pname) { case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_MIN_LOD: case __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_MAX_LOD: this.gl.samplerParameterf(this.handle, pname, param); break; default: this.gl.samplerParameteri(this.handle, pname, param); break; } return this; } }]); return Sampler; }(__WEBPACK_IMPORTED_MODULE_2__resource__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Sampler); //# sourceMappingURL=sampler.js.map /***/ }), /* 275 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__texture__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // import {withParameters} from './context'; var FACES = [__WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_POSITIVE_X, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_NEGATIVE_X, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_POSITIVE_Y, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_NEGATIVE_Y, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_POSITIVE_Z, __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_NEGATIVE_Z]; var TextureCube = /*#__PURE__*/function (_Texture) { _inherits(TextureCube, _Texture); function TextureCube(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, TextureCube); var _this = _possibleConstructorReturn(this, (TextureCube.__proto__ || Object.getPrototypeOf(TextureCube)).call(this, gl, Object.assign({}, opts, { target: __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP }))); _this.initialize(opts); Object.seal(_this); return _this; } /* eslint-disable max-len, max-statements */ _createClass(TextureCube, [{ key: 'initialize', value: function initialize() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _opts$format = opts.format, format = _opts$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].RGBA : _opts$format, _opts$mipmaps = opts.mipmaps, mipmaps = _opts$mipmaps === undefined ? true : _opts$mipmaps; var _opts$width = opts.width, width = _opts$width === undefined ? 1 : _opts$width, _opts$height = opts.height, height = _opts$height === undefined ? 1 : _opts$height, _opts$type = opts.type, type = _opts$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].UNSIGNED_BYTE : _opts$type, dataFormat = opts.dataFormat; // Deduce width and height based on one of the faces var _deduceParameters = this._deduceParameters({ format: format, type: type, dataFormat: dataFormat }); type = _deduceParameters.type; dataFormat = _deduceParameters.dataFormat; // Enforce cube var _deduceImageSize = this._deduceImageSize({ data: opts[__WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP_POSITIVE_X], width: width, height: height }); width = _deduceImageSize.width; height = _deduceImageSize.height; __WEBPACK_IMPORTED_MODULE_2_assert___default()(width === height); // Temporarily apply any pixel store paramaters and build textures // withParameters(this.gl, opts, () => { // for (const face of CUBE_MAP_FACES) { // this.setImageData({ // target: face, // data: opts[face], // width, height, format, type, dataFormat, border, mipmaps // }); // } // }); this.setCubeMapImageData(opts); // Called here so that GL. // TODO - should genMipmap() be called on the cubemap or on the faces? if (mipmaps) { this.generateMipmap(opts); } // Store opts for accessors this.opts = opts; } }, { key: 'subImage', value: function subImage(_ref) { var face = _ref.face, data = _ref.data, _ref$x = _ref.x, x = _ref$x === undefined ? 0 : _ref$x, _ref$y = _ref.y, y = _ref$y === undefined ? 0 : _ref$y, _ref$mipmapLevel = _ref.mipmapLevel, mipmapLevel = _ref$mipmapLevel === undefined ? 0 : _ref$mipmapLevel; return this._subImage({ target: face, data: data, x: x, y: y, mipmapLevel: mipmapLevel }); } /* eslint-disable max-statements, max-len */ }, { key: 'setCubeMapImageData', value: function setCubeMapImageData(_ref2) { var width = _ref2.width, height = _ref2.height, pixels = _ref2.pixels, data = _ref2.data, _ref2$border = _ref2.border, border = _ref2$border === undefined ? 0 : _ref2$border, _ref2$format = _ref2.format, format = _ref2$format === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].RGBA : _ref2$format, _ref2$type = _ref2.type, type = _ref2$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].UNSIGNED_BYTE : _ref2$type, _ref2$generateMipmap = _ref2.generateMipmap, generateMipmap = _ref2$generateMipmap === undefined ? false : _ref2$generateMipmap; var gl = this.gl; pixels = pixels || data; this.bind(); if (this.width || this.height) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = FACES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var face = _step.value; gl.texImage2D(face, 0, format, width, height, border, format, type, pixels[face]); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } else { var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = FACES[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _face = _step2.value; gl.texImage2D(_face, 0, format, format, type, pixels[_face]); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } } }, { key: 'bind', value: function bind() { var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, index = _ref3.index; if (index !== undefined) { this.gl.activeTexture(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE0 + index); } this.gl.bindTexture(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP, this.handle); return index; } }, { key: 'unbind', value: function unbind() { this.gl.bindTexture(__WEBPACK_IMPORTED_MODULE_0__gl_constants__["d" /* GL */].TEXTURE_CUBE_MAP, null); return this; } }]); return TextureCube; }(__WEBPACK_IMPORTED_MODULE_1__texture__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (TextureCube); TextureCube.FACES = FACES; //# sourceMappingURL=texture-cube.js.map /***/ }), /* 276 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export getPrimitiveCount */ /* unused harmony export getVertexCount */ /* harmony export (immutable) */ __webpack_exports__["b"] = getTransformFeedbackMode; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__gl_constants__ = __webpack_require__(25); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__resource__ = __webpack_require__(30); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; var GL_TRANSFORM_FEEDBACK = 0x8E22; var TranformFeedback = /*#__PURE__*/function (_Resource) { _inherits(TranformFeedback, _Resource); _createClass(TranformFeedback, null, [{ key: 'isSupported', value: function isSupported(gl) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["b" /* isWebGL2 */])(gl); } }, { key: 'isHandle', value: function isHandle(handle) { return this.gl.isTransformFeedback(this.handle); } /** * @class * @param {WebGL2RenderingContext} gl - context * @param {Object} opts - options */ }]); function TranformFeedback(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, TranformFeedback); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context__["g" /* assertWebGL2Context */])(gl); var _this = _possibleConstructorReturn(this, (TranformFeedback.__proto__ || Object.getPrototypeOf(TranformFeedback)).call(this, gl, opts)); _this.buffers = {}; Object.seal(_this); _this.initialize(opts); return _this; } _createClass(TranformFeedback, [{ key: 'initialize', value: function initialize(_ref) { var _ref$buffers = _ref.buffers, buffers = _ref$buffers === undefined ? {} : _ref$buffers, _ref$varyingMap = _ref.varyingMap, varyingMap = _ref$varyingMap === undefined ? {} : _ref$varyingMap; this.bindBuffers(buffers, { clear: true, varyingMap: varyingMap }); } }, { key: 'bindBuffers', value: function bindBuffers() { var buffers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$clear = _ref2.clear, clear = _ref2$clear === undefined ? false : _ref2$clear, _ref2$varyingMap = _ref2.varyingMap, varyingMap = _ref2$varyingMap === undefined ? {} : _ref2$varyingMap; if (clear) { this._unbindBuffers(); this.buffers = {}; } for (var bufferName in buffers) { var buffer = buffers[bufferName]; var index = Number.isFinite(Number(bufferName)) ? Number(bufferName) : varyingMap[bufferName]; __WEBPACK_IMPORTED_MODULE_3_assert___default()(Number.isFinite(index)); this.buffers[index] = buffer; } } // TODO: Activation is tightly coupled to the current program. Since we try to encapsulate // program.use, should we move these methods (begin/pause/resume/end) to the Program? }, { key: 'begin', value: function begin(primitiveMode) { this._bindBuffers(); this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, this.handle); this.gl.beginTransformFeedback(primitiveMode); return this; } }, { key: 'pause', value: function pause() { this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, this.handle); this.gl.pauseTransformFeedback(); this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, null); this._unbindBuffers(); return this; } }, { key: 'resume', value: function resume() { this._bindBuffers(); this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, this.handle); this.gl.resumeTransformFeedback(); return this; } }, { key: 'end', value: function end() { this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, this.handle); this.gl.endTransformFeedback(); this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, null); this._unbindBuffers(); return this; } }, { key: 'bindBuffer', value: function bindBuffer(_ref3) { var index = _ref3.index, buffer = _ref3.buffer, _ref3$offset = _ref3.offset, offset = _ref3$offset === undefined ? 0 : _ref3$offset, size = _ref3.size; // Need to avoid chrome bug where buffer that is already bound to a different target // cannot be bound to 'TRANSFORM_FEEDBACK_BUFFER' target. buffer.unbind(); this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, this.handle); if (size === undefined) { this.gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, index, buffer.handle); } else { this.gl.bindBufferRange(GL_TRANSFORM_FEEDBACK_BUFFER, index, buffer.handle, offset, size); } return this; } }, { key: 'unbindBuffer', value: function unbindBuffer(_ref4) { var index = _ref4.index; this.gl.bindTransformFeedback(GL_TRANSFORM_FEEDBACK, this.handle); this.gl.bindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, index, null); return this; } // PRIVATE METHODS // See https://github.com/KhronosGroup/WebGL/issues/2346 // If it was true that having a buffer on an unused TF was a problem // it would make the entire concept of transform feedback objects pointless. // The whole point of them is like VertexArrayObjects. // You set them up with all in outputs at init time and // then in one call you can setup all the outputs just before drawing. // Since the point of transform feedback is to generate data that will // then be used as inputs to attributes it makes zero sense you'd // have to unbind them from every unused transform feedback object // before you could use them in an attribute. If that was the case // there would be no reason to setup transform feedback objects ever. // You'd always use the default because you'd always have to bind and // unbind all the buffers. }, { key: '_bindBuffers', value: function _bindBuffers() { for (var bufferIndex in this.buffers) { this.bindBuffer({ buffer: this.buffers[bufferIndex], index: Number(bufferIndex) }); } } }, { key: '_unbindBuffers', value: function _unbindBuffers() { for (var bufferIndex in this.buffers) { this.unbindBuffer({ buffer: this.buffers[bufferIndex], index: Number(bufferIndex) }); } } // RESOURCE METHODS }, { key: '_createHandle', value: function _createHandle() { return this.gl.createTransformFeedback(); } }, { key: '_deleteHandle', value: function _deleteHandle() { this.gl.deleteTransformFeedback(this.handle); } }]); return TranformFeedback; }(__WEBPACK_IMPORTED_MODULE_1__resource__["a" /* default */]); // Counts the number of complete "primitives" given a number of vertices and a drawMode /* harmony default export */ __webpack_exports__["a"] = (TranformFeedback); function getPrimitiveCount(_ref5) { var drawMode = _ref5.drawMode, vertexCount = _ref5.vertexCount, countVertices = _ref5.countVertices; switch (drawMode) { case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].POINTS: return vertexCount; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINES: return vertexCount / 2; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINE_STRIP: return vertexCount - 1; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINE_LOOP: return vertexCount; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES: return vertexCount / 3; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLE_STRIP: return vertexCount - 2; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLE_FAN: return vertexCount - 2; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false);return 0; } } // Counts the number of vertices after splitting the vertex stream into separate "primitives" function getVertexCount(_ref6) { var drawMode = _ref6.drawMode, vertexCount = _ref6.vertexCount; var primitiveCount = getPrimitiveCount({ drawMode: drawMode, vertexCount: vertexCount }); switch (drawMode) { case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].POINTS: return primitiveCount; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINES: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINE_STRIP: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINE_LOOP: return vertexCount * 2; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLE_STRIP: case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLE_FAN: return vertexCount * 3; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false);return 0; } } // Counts the number of complete primitives given a number of vertices and a drawMode function getTransformFeedbackMode(_ref7) { var drawMode = _ref7.drawMode; switch (drawMode) { case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].POINTS: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].POINTS; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINES: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINES; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINE_STRIP: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINES; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINE_LOOP: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].LINES; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLE_STRIP: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES; case __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLE_FAN: return __WEBPACK_IMPORTED_MODULE_0__gl_constants__["a" /* default */].TRIANGLES; default: __WEBPACK_IMPORTED_MODULE_3_assert___default()(false);return 0; } } //# sourceMappingURL=transform-feedback.js.map /***/ }), /* 277 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = assert; function assert(condition,message){if(!condition)throw new Error("Assertion failed. "+message)} //# sourceMappingURL=assert.js.map /***/ }), /* 278 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export validateMatrix4 */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math_array__ = __webpack_require__(112); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common__ = __webpack_require__(31); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__vector2__ = __webpack_require__(280); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__vector3__ = __webpack_require__(113); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__vector4__ = __webpack_require__(281); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__lib_assert__ = __webpack_require__(277); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_gl_mat4_determinant__ = __webpack_require__(569); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_gl_mat4_determinant___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_gl_mat4_determinant__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_gl_mat4_fromQuat__ = __webpack_require__(570); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_7_gl_mat4_fromQuat___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_7_gl_mat4_fromQuat__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_gl_mat4_frustum__ = __webpack_require__(571); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_8_gl_mat4_frustum___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_8_gl_mat4_frustum__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_gl_mat4_lookAt__ = __webpack_require__(102); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_9_gl_mat4_lookAt___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_9_gl_mat4_lookAt__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_gl_mat4_ortho__ = __webpack_require__(234); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_10_gl_mat4_ortho___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_10_gl_mat4_ortho__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_gl_mat4_perspective__ = __webpack_require__(76); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_11_gl_mat4_perspective___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_11_gl_mat4_perspective__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_gl_mat4_transpose__ = __webpack_require__(574); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_12_gl_mat4_transpose___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_12_gl_mat4_transpose__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_gl_mat4_invert__ = __webpack_require__(156); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_13_gl_mat4_invert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_13_gl_mat4_invert__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_gl_mat4_multiply__ = __webpack_require__(75); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_14_gl_mat4_multiply___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_14_gl_mat4_multiply__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_gl_mat4_rotateX__ = __webpack_require__(157); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_15_gl_mat4_rotateX___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_15_gl_mat4_rotateX__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_gl_mat4_rotateY__ = __webpack_require__(235); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_16_gl_mat4_rotateY___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_16_gl_mat4_rotateY__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_gl_mat4_rotateZ__ = __webpack_require__(158); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_17_gl_mat4_rotateZ___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_17_gl_mat4_rotateZ__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_gl_mat4_rotate__ = __webpack_require__(573); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_18_gl_mat4_rotate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_18_gl_mat4_rotate__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19_gl_mat4_scale__ = __webpack_require__(77); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_19_gl_mat4_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_19_gl_mat4_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_gl_mat4_translate__ = __webpack_require__(78); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_20_gl_mat4_translate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_20_gl_mat4_translate__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21_gl_vec2_transformMat4__ = __webpack_require__(602); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_21_gl_vec2_transformMat4___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_21_gl_vec2_transformMat4__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22_gl_vec3_transformMat4__ = __webpack_require__(615); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_22_gl_vec3_transformMat4___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_22_gl_vec3_transformMat4__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23_gl_vec4_transformMat4__ = __webpack_require__(103); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_23_gl_vec4_transformMat4___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_23_gl_vec4_transformMat4__); var _slicedToArray=function(){function sliceIterator(arr,i){var _arr=[],_n=!0,_d=!1,_e=void 0;try{for(var _s,_i=arr[Symbol.iterator]();!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!(i&&_arr.length===i));_n=!0);}catch(err){_d=!0,_e=err}finally{try{!_n&&_i['return']&&_i['return']()}finally{if(_d)throw _e}}return _arr}return function(arr,i){if(Array.isArray(arr))return arr;if(Symbol.iterator in Object(arr))return sliceIterator(arr,i);throw new TypeError('Invalid attempt to destructure non-iterable instance')}}(),_createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;i2*_MathPI)throw Error('radians');return __WEBPACK_IMPORTED_MODULE_11_gl_mat4_perspective___default()(this,fov,aspect,near,far),this.check(),this}},{key:'transpose',value:function transpose(){return __WEBPACK_IMPORTED_MODULE_12_gl_mat4_transpose___default()(this,this),this.check(),this}},{key:'invert',value:function invert(){return __WEBPACK_IMPORTED_MODULE_13_gl_mat4_invert___default()(this,this),this.check(),this}},{key:'multiplyLeft',value:function multiplyLeft(a){return __WEBPACK_IMPORTED_MODULE_14_gl_mat4_multiply___default()(this,a,this),this.check(),this}},{key:'multiplyRight',value:function multiplyRight(a){return __WEBPACK_IMPORTED_MODULE_14_gl_mat4_multiply___default()(this,this,a),this.check(),this}},{key:'rotateX',value:function rotateX(radians){return __WEBPACK_IMPORTED_MODULE_15_gl_mat4_rotateX___default()(this,this,radians),this.check(),this}},{key:'rotateY',value:function rotateY(radians){return __WEBPACK_IMPORTED_MODULE_16_gl_mat4_rotateY___default()(this,this,radians),this.check(),this}},{key:'rotateZ',value:function rotateZ(radians){return __WEBPACK_IMPORTED_MODULE_17_gl_mat4_rotateZ___default()(this,this,radians),this.check(),this}},{key:'rotateXYZ',value:function rotateXYZ(_ref5){var _ref6=_slicedToArray(_ref5,3),rx=_ref6[0],ry=_ref6[1],rz=_ref6[2];return this.rotateX(rx).rotateY(ry).rotateZ(rz)}},{key:'rotateAxis',value:function rotateAxis(radians,axis){return __WEBPACK_IMPORTED_MODULE_18_gl_mat4_rotate___default()(this,this,radians,axis),this.check(),this}},{key:'scale',value:function scale(vec){return __WEBPACK_IMPORTED_MODULE_19_gl_mat4_scale___default()(this,this,vec),this.check(),this}},{key:'translate',value:function translate(vec){return __WEBPACK_IMPORTED_MODULE_20_gl_mat4_translate___default()(this,this,vec),this.check(),this}},{key:'transformVector2',value:function transformVector2(vector,out){return out=out||new __WEBPACK_IMPORTED_MODULE_2__vector2__["a" /* default */],__WEBPACK_IMPORTED_MODULE_21_gl_vec2_transformMat4___default()(out,vector,this),__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__lib_assert__["a" /* default */])(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__vector2__["b" /* validateVector2 */])(out)),out}},{key:'transformVector3',value:function transformVector3(vector){var out=1 0; var drawLines = lineFeatures && lineFeatures.length > 0; var hasPolygonLines = polygonOutlineFeatures && polygonOutlineFeatures.length > 0; var hasPolygon = polygonFeatures && polygonFeatures.length > 0; // Filled Polygon Layer var polygonFillLayer = filled && hasPolygon && new subLayers.PolygonLayer(this.getSubLayerProps({ id: 'polygon-fill', updateTriggers: { getElevation: updateTriggers.getElevation, getColor: updateTriggers.getFillColor } }), { data: polygonFeatures, fp64: fp64, extruded: extruded, elevationScale: elevationScale, wireframe: false, lightSettings: lightSettings, getPolygon: getCoordinates, getElevation: getElevation, getColor: getFillColor }); var polygonWireframeLayer = wireframe && extruded && hasPolygon && new subLayers.PolygonLayer(this.getSubLayerProps({ id: 'polygon-wireframe', updateTriggers: { getElevation: updateTriggers.getElevation, getColor: updateTriggers.getLineColor } }), { data: polygonFeatures, fp64: fp64, extruded: extruded, elevationScale: elevationScale, wireframe: true, getPolygon: getCoordinates, getElevation: getElevation, getColor: getLineColor }); var polygonLineLayer = !extruded && stroked && hasPolygonLines && new subLayers.LineLayer(this.getSubLayerProps({ id: 'polygon-outline', updateTriggers: { getColor: updateTriggers.getLineColor, getWidth: updateTriggers.getLineWidth } }), { data: polygonOutlineFeatures, fp64: fp64, widthScale: lineWidthScale, widthMinPixels: lineWidthMinPixels, widthMaxPixels: lineWidthMaxPixels, rounded: lineJointRounded, miterLimit: lineMiterLimit, getPath: getCoordinates, getColor: getLineColor, getWidth: getLineWidth }); var pathLayer = drawLines && new subLayers.LineLayer(this.getSubLayerProps({ id: 'line-paths', updateTriggers: { getColor: updateTriggers.getLineColor, getWidth: updateTriggers.getLineWidth } }), { data: lineFeatures, fp64: fp64, widthScale: lineWidthScale, widthMinPixels: lineWidthMinPixels, widthMaxPixels: lineWidthMaxPixels, rounded: lineJointRounded, miterLimit: lineMiterLimit, getPath: getCoordinates, getColor: getLineColor, getWidth: getLineWidth }); var pointLayer = drawPoints && new subLayers.PointLayer(this.getSubLayerProps({ id: 'points', updateTriggers: { getColor: updateTriggers.getFillColor, getRadius: updateTriggers.getRadius } }), { data: pointFeatures, fp64: fp64, radiusScale: pointRadiusScale, radiusMinPixels: pointRadiusMinPixels, radiusMaxPixels: pointRadiusMaxPixels, getPosition: getCoordinates, getColor: getFillColor, getRadius: getRadius }); return [ // If not extruded: flat fill layer is drawn below outlines !extruded && polygonFillLayer, polygonWireframeLayer, polygonLineLayer, pathLayer, pointLayer, // If extruded: draw fill layer last for correct blending behavior extruded && polygonFillLayer]; } /* eslint-enable complexity */ }]); return GeoJsonLayer; }(_core.CompositeLayer); exports.default = GeoJsonLayer; GeoJsonLayer.layerName = 'GeoJsonLayer'; GeoJsonLayer.defaultProps = defaultProps; /***/ }), /* 294 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getGeojsonFeatures = getGeojsonFeatures; exports.separateGeojsonFeatures = separateGeojsonFeatures; var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * "Normalizes" complete or partial GeoJSON data into iterable list of features * Can accept GeoJSON geometry or "Feature", "FeatureCollection" in addition * to plain arrays and iterables. * Works by extracting the feature array or wrapping single objects in an array, * so that subsequent code can simply iterate over features. * * @param {object} geojson - geojson data * @param {Object|Array} data - geojson object (FeatureCollection, Feature or * Geometry) or array of features * @return {Array|"iteratable"} - iterable list of features */ function getGeojsonFeatures(geojson) { // If array, assume this is a list of features if (Array.isArray(geojson)) { return geojson; } (0, _assert2.default)(geojson.type, 'GeoJSON does not have type'); switch (geojson.type) { case 'GeometryCollection': (0, _assert2.default)(Array.isArray(geojson.geometries), 'GeoJSON does not have geometries array'); return geojson.geometries.map(function (geometry) { return { geometry: geometry }; }); case 'Feature': // Wrap the feature in a 'Features' array return [geojson]; case 'FeatureCollection': // Just return the 'Features' array from the collection (0, _assert2.default)(Array.isArray(geojson.features), 'GeoJSON does not have features array'); return geojson.features; default: // Assume it's a geometry, we'll check type in separateGeojsonFeatures // Wrap the geometry object in a 'Feature' object and wrap in an array return [{ geometry: geojson }]; } } // Linearize // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. function separateGeojsonFeatures(features) { var pointFeatures = []; var lineFeatures = []; var polygonFeatures = []; var polygonOutlineFeatures = []; features.forEach(function (feature) { (0, _assert2.default)(feature && feature.geometry, 'GeoJSON does not have geometry'); var _feature$geometry = feature.geometry, type = _feature$geometry.type, coordinates = _feature$geometry.coordinates, properties = feature.properties; checkCoordinates(type, coordinates); switch (type) { case 'Point': pointFeatures.push(feature); break; case 'MultiPoint': // TODO - split multipoints coordinates.forEach(function (point) { pointFeatures.push({ geometry: { coordinates: point }, properties: properties, feature: feature }); }); break; case 'LineString': lineFeatures.push(feature); break; case 'MultiLineString': // Break multilinestrings into multiple lines with same properties coordinates.forEach(function (path) { lineFeatures.push({ geometry: { coordinates: path }, properties: properties, feature: feature }); }); break; case 'Polygon': polygonFeatures.push(feature); // Break polygon into multiple lines with same properties coordinates.forEach(function (path) { polygonOutlineFeatures.push({ geometry: { coordinates: path }, properties: properties, feature: feature }); }); break; case 'MultiPolygon': // Break multipolygons into multiple polygons with same properties coordinates.forEach(function (polygon) { polygonFeatures.push({ geometry: { coordinates: polygon }, properties: properties, feature: feature }); // Break polygon into multiple lines with same properties polygon.forEach(function (path) { polygonOutlineFeatures.push({ geometry: { coordinates: path }, properties: properties, feature: feature }); }); }); break; default: } }); return { pointFeatures: pointFeatures, lineFeatures: lineFeatures, polygonFeatures: polygonFeatures, polygonOutlineFeatures: polygonOutlineFeatures }; } /** * Simple GeoJSON validation util. For perf reasons we do not validate against the full spec, * only the following: - geometry.type is supported - geometry.coordinate has correct nesting level */ var COORDINATE_NEST_LEVEL = { Point: 1, MultiPoint: 2, LineString: 2, MultiLineString: 3, Polygon: 3, MultiPolygon: 4 }; function checkCoordinates(type, coordinates) { var nestLevel = COORDINATE_NEST_LEVEL[type]; (0, _assert2.default)(nestLevel, 'Unknown GeoJSON type ' + type); while (coordinates && --nestLevel > 0) { coordinates = coordinates[0]; } (0, _assert2.default)(coordinates && Number.isFinite(coordinates[0]), type + ' coordinates are malformed'); } /***/ }), /* 295 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME grid-cell-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 296 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Inspired by screen-grid-layer vertex shader in deck.gl exports.default = "#define SHADER_NAME grid-cell-layer-vertex-shader-64\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec4 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Custom uniforms\nuniform float extruded;\nuniform float cellSize;\nuniform float coverage;\nuniform float opacity;\nuniform float elevationScale;\n\n// A magic number to scale elevation so that 1 unit approximate to 1 meter\n#define ELEVATION_SCALE 0.8\n\n// Result\nvarying vec4 vColor;\n\nvoid main(void) {\n vec4 instancePositions64xy = vec4(\n instancePositions.x,\n instancePositions64xyLow.x,\n instancePositions.y,\n instancePositions64xyLow.y);\n\n vec2 projected_coord_xy[2];\n project_position_fp64(instancePositions64xy, projected_coord_xy);\n\n // if ahpha == 0.0 or z < 0.0, do not render element\n float noRender = float(instanceColors.a == 0.0 || instancePositions.w < 0.0);\n float finalCellSize = cellSize * mix(1.0, 0.0, noRender);\n\n projected_coord_xy[0] = sum_fp64(projected_coord_xy[0],\n vec2((positions.x * coverage + 1.0) * finalCellSize / 2.0, 0.0));\n projected_coord_xy[1] = sum_fp64(projected_coord_xy[1],\n vec2((positions.y * coverage - 1.0) * finalCellSize / 2.0, 0.0));\n\n float elevation = 0.0;\n\n if (extruded > 0.5) {\n elevation = project_scale(instancePositions.w * (positions.z + 1.0) *\n ELEVATION_SCALE * elevationScale) + 1.0;\n }\n\n vec2 vertex_pos_modelspace[4];\n vertex_pos_modelspace[0] = projected_coord_xy[0];\n vertex_pos_modelspace[1] = projected_coord_xy[1];\n vertex_pos_modelspace[2] = vec2(elevation, 0.0);\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n vec4 position_worldspace = vec4(\n vertex_pos_modelspace[0].x, vertex_pos_modelspace[1].x,\n vertex_pos_modelspace[2].x, vertex_pos_modelspace[3].x);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n\n float lightWeight = 1.0;\n\n if (extruded > 0.5) {\n lightWeight = getLightWeight(\n position_worldspace.xyz, // the w component is always 1.0\n normals\n );\n }\n\n vec3 lightWeightedColor = lightWeight * instanceColors.rgb;\n vec4 color = vec4(lightWeightedColor, instanceColors.a * opacity) / 255.0;\n vColor = color;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Inspired by screen-grid-layer vertex shader in deck.gl exports.default = "#define SHADER_NAME grid-cell-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec4 instancePositions;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Custom uniforms\nuniform float extruded;\nuniform float cellSize;\nuniform float coverage;\nuniform float opacity;\nuniform float elevationScale;\n\n// A magic number to scale elevation so that 1 unit approximate to 1 meter\n#define ELEVATION_SCALE 0.8\n\n// Result\nvarying vec4 vColor;\n\nvoid main(void) {\n\n vec2 topLeftPos = project_position(instancePositions.xy);\n\n // if ahpha == 0.0 or z < 0.0, do not render element\n float noRender = float(instanceColors.a == 0.0 || instancePositions.w < 0.0);\n float finalCellSize = cellSize * mix(1.0, 0.0, noRender);\n\n // cube gemoetry vertics are between -1 to 1, scale and transform it to between 0, 1\n vec2 pos = topLeftPos + vec2(\n (positions.x * coverage + 1.0) / 2.0 * finalCellSize,\n (positions.y * coverage - 1.0) / 2.0 * finalCellSize);\n\n float elevation = 0.0;\n\n if (extruded > 0.5) {\n elevation = project_scale(instancePositions.w * (positions.z + 1.0) *\n ELEVATION_SCALE * elevationScale);\n }\n\n // extrude positions\n vec3 extrudedPosition = vec3(pos.xy, elevation + 1.0);\n vec4 position_worldspace = vec4(extrudedPosition, 1.0);\n gl_Position = project_to_clipspace(position_worldspace);\n\n float lightWeight = 1.0;\n\n if (extruded > 0.5) {\n lightWeight = getLightWeight(\n position_worldspace.xyz, // the w component is always 1.0\n normals\n );\n }\n\n vec3 lightWeightedColor = lightWeight * instanceColors.rgb;\n vec4 color = vec4(lightWeightedColor, instanceColors.a * opacity) / 255.0;\n vColor = color;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pointToDensityGridData = pointToDensityGridData; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var R_EARTH = 6378000; /** * Calculate density grid from an array of points * @param {array} points * @param {number} cellSize - cell size in meters * @param {function} getPosition - position accessor * @returns {object} - grid data, cell dimension */ function pointToDensityGridData(points, cellSize, getPosition) { var _pointsToGridHashing2 = _pointsToGridHashing(points, cellSize, getPosition), gridHash = _pointsToGridHashing2.gridHash, gridOffset = _pointsToGridHashing2.gridOffset; var layerData = _getGridLayerDataFromGridHash(gridHash, gridOffset); return { gridOffset: gridOffset, layerData: layerData }; } /** * Project points into each cell, return a hash table of cells * @param {array} points * @param {number} cellSize - unit size in meters * @param {function} getPosition - position accessor * @returns {object} - grid hash and cell dimension */ function _pointsToGridHashing() { var points = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var cellSize = arguments[1]; var getPosition = arguments[2]; // find the geometric center of sample points var latMin = Infinity; var latMax = -Infinity; var pLat = void 0; for (var p = 0; p < points.length; p++) { pLat = getPosition(points[p])[1]; if (Number.isFinite(pLat)) { latMin = pLat < latMin ? pLat : latMin; latMax = pLat > latMax ? pLat : latMax; } } var centerLat = (latMin + latMax) / 2; var gridOffset = _calculateGridLatLonOffset(cellSize, centerLat); if (gridOffset.xOffset <= 0 || gridOffset.yOffset <= 0) { return { gridHash: {}, gridOffset: gridOffset }; } // calculate count per cell var gridHash = points.reduce(function (accu, pt) { var lat = getPosition(pt)[1]; var lng = getPosition(pt)[0]; if (!Number.isFinite(lat) || !Number.isFinite(lng)) { return accu; } var latIdx = Math.floor((lat + 90) / gridOffset.yOffset); var lonIdx = Math.floor((lng + 180) / gridOffset.xOffset); var key = latIdx + '-' + lonIdx; accu[key] = accu[key] || { count: 0, points: [] }; accu[key].count += 1; accu[key].points.push(pt); return accu; }, {}); return { gridHash: gridHash, gridOffset: gridOffset }; } function _getGridLayerDataFromGridHash(gridHash, gridOffset) { return Object.keys(gridHash).reduce(function (accu, key, i) { var idxs = key.split('-'); var latIdx = parseInt(idxs[0], 10); var lonIdx = parseInt(idxs[1], 10); accu.push(Object.assign({ index: i, position: [-180 + gridOffset.xOffset * lonIdx, -90 + gridOffset.yOffset * latIdx] }, gridHash[key])); return accu; }, []); } /** * calculate grid layer cell size in lat lon based on world unit size * and current latitude * @param {number} cellSize * @param {number} latitude * @returns {object} - lat delta and lon delta */ function _calculateGridLatLonOffset(cellSize, latitude) { var yOffset = _calculateLatOffset(cellSize); var xOffset = _calculateLonOffset(latitude, cellSize); return { yOffset: yOffset, xOffset: xOffset }; } /** * with a given x-km change, calculate the increment of latitude * based on stackoverflow http://stackoverflow.com/questions/7477003 * @param {number} dy - change in km * @return {number} - increment in latitude */ function _calculateLatOffset(dy) { return dy / R_EARTH * (180 / Math.PI); } /** * with a given x-km change, and current latitude * calculate the increment of longitude * based on stackoverflow http://stackoverflow.com/questions/7477003 * @param {number} lat - latitude of current location (based on city) * @param {number} dx - change in km * @return {number} - increment in longitude */ function _calculateLonOffset(lat, dx) { return dx / R_EARTH * (180 / Math.PI) / Math.cos(lat * Math.PI / 180); } /***/ }), /* 299 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _gridCellLayer = __webpack_require__(174); var _gridCellLayer2 = _interopRequireDefault(_gridCellLayer); var _gridAggregator = __webpack_require__(298); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var BinSorter = _core.experimental.BinSorter, defaultColorRange = _core.experimental.defaultColorRange, getQuantizeScale = _core.experimental.getQuantizeScale, getLinearScale = _core.experimental.getLinearScale; function nop() {} var defaultProps = { // color colorDomain: null, colorRange: defaultColorRange, getColorValue: function getColorValue(points) { return points.length; }, lowerPercentile: 0, upperPercentile: 100, onSetColorDomain: nop, // elevation elevationDomain: null, elevationRange: [0, 1000], getElevationValue: function getElevationValue(points) { return points.length; }, elevationLowerPercentile: 0, elevationUpperPercentile: 100, elevationScale: 1, onSetElevationDomain: nop, // grid cellSize: 1000, coverage: 1, getPosition: function getPosition(x) { return x.position; }, extruded: false, fp64: false, // Optional settings for 'lighting' shader module lightSettings: { lightsPosition: [-122.45, 37.75, 8000, -122.0, 38.0, 5000], ambientRatio: 0.05, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [2.0, 0.0, 0.0, 0.0], numberOfLights: 2 } }; var GridLayer = function (_CompositeLayer) { _inherits(GridLayer, _CompositeLayer); function GridLayer() { _classCallCheck(this, GridLayer); return _possibleConstructorReturn(this, (GridLayer.__proto__ || Object.getPrototypeOf(GridLayer)).apply(this, arguments)); } _createClass(GridLayer, [{ key: 'initializeState', value: function initializeState() { this.state = { layerData: [], sortedColorBins: null, sortedElevationBins: null, colorValueDomain: null, elevationValueDomain: null, colorScaleFunc: nop, elevationScaleFunc: nop, dimensionUpdaters: this.getDimensionUpdaters() }; } }, { key: 'updateState', value: function updateState(_ref) { var _this2 = this; var oldProps = _ref.oldProps, props = _ref.props, changeFlags = _ref.changeFlags; var dimensionChanges = this.getDimensionChanges(oldProps, props); if (changeFlags.dataChanged || this.needsReProjectPoints(oldProps, props)) { // project data into hexagons, and get sortedBins this.getLayerData(); } else if (dimensionChanges) { dimensionChanges.forEach(function (f) { return typeof f === 'function' && f.apply(_this2); }); } } }, { key: 'needsReProjectPoints', value: function needsReProjectPoints(oldProps, props) { return oldProps.cellSize !== props.cellSize; } }, { key: 'getDimensionUpdaters', value: function getDimensionUpdaters() { // dimension updaters are sequential, // if the first one needs to be called, the 2nd and 3rd one will automatically // be called. e.g. if ColorValue needs to be updated, getColorValueDomain and getColorScale // will automatically be called return { getColor: [{ id: 'value', triggers: ['getColorValue'], updater: this.getSortedColorBins }, { id: 'domain', triggers: ['lowerPercentile', 'upperPercentile'], updater: this.getColorValueDomain }, { id: 'scaleFunc', triggers: ['colorDomain', 'colorRange'], updater: this.getColorScale }], getElevation: [{ id: 'value', triggers: ['getElevationValue'], updater: this.getSortedElevationBins }, { id: 'domain', triggers: ['elevationLowerPercentile', 'elevationUpperPercentile'], updater: this.getElevationValueDomain }, { id: 'scaleFunc', triggers: ['elevationDomain', 'elevationRange'], updater: this.getElevationScale }] }; } }, { key: 'getDimensionChanges', value: function getDimensionChanges(oldProps, props) { var dimensionUpdaters = this.state.dimensionUpdaters; var updaters = []; // get dimension to be updated for (var dimensionKey in dimensionUpdaters) { // return the first triggered updater for each dimension var needUpdate = dimensionUpdaters[dimensionKey].find(function (item) { return item.triggers.some(function (t) { return oldProps[t] !== props[t]; }); }); if (needUpdate) { updaters.push(needUpdate.updater); } } return updaters.length ? updaters : null; } }, { key: 'getPickingInfo', value: function getPickingInfo(_ref2) { var info = _ref2.info; var _state = this.state, sortedColorBins = _state.sortedColorBins, sortedElevationBins = _state.sortedElevationBins; var isPicked = info.picked && info.index > -1; var object = null; if (isPicked) { var cell = this.state.layerData[info.index]; var colorValue = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value; var elevationValue = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value; object = Object.assign({ colorValue: colorValue, elevationValue: elevationValue }, cell); } // add bin colorValue and elevationValue to info return Object.assign(info, { picked: Boolean(object), // override object with picked cell object: object }); } }, { key: 'getUpdateTriggers', value: function getUpdateTriggers() { var _this3 = this; var dimensionUpdaters = this.state.dimensionUpdaters; // merge all dimension triggers var updateTriggers = {}; var _loop = function _loop(dimensionKey) { updateTriggers[dimensionKey] = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = dimensionUpdaters[dimensionKey][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var step = _step.value; step.triggers.forEach(function (prop) { updateTriggers[dimensionKey][prop] = _this3.props[prop]; }); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } }; for (var dimensionKey in dimensionUpdaters) { _loop(dimensionKey); } return updateTriggers; } }, { key: 'getLayerData', value: function getLayerData() { var _props = this.props, data = _props.data, cellSize = _props.cellSize, getPosition = _props.getPosition; var _pointToDensityGridDa = (0, _gridAggregator.pointToDensityGridData)(data, cellSize, getPosition), layerData = _pointToDensityGridDa.layerData; this.setState({ layerData: layerData }); this.getSortedBins(); } }, { key: 'getValueDomain', value: function getValueDomain() { this.getColorValueDomain(); this.getElevationValueDomain(); } }, { key: 'getSortedBins', value: function getSortedBins() { this.getSortedColorBins(); this.getSortedElevationBins(); } }, { key: 'getSortedColorBins', value: function getSortedColorBins() { var getColorValue = this.props.getColorValue; var sortedColorBins = new BinSorter(this.state.layerData || [], getColorValue); this.setState({ sortedColorBins: sortedColorBins }); this.getColorValueDomain(); } }, { key: 'getSortedElevationBins', value: function getSortedElevationBins() { var getElevationValue = this.props.getElevationValue; var sortedElevationBins = new BinSorter(this.state.layerData || [], getElevationValue); this.setState({ sortedElevationBins: sortedElevationBins }); this.getElevationValueDomain(); } }, { key: 'getColorValueDomain', value: function getColorValueDomain() { var _props2 = this.props, lowerPercentile = _props2.lowerPercentile, upperPercentile = _props2.upperPercentile, onSetColorDomain = _props2.onSetColorDomain; this.state.colorValueDomain = this.state.sortedColorBins.getValueRange([lowerPercentile, upperPercentile]); if (typeof onSetColorDomain === 'function') { onSetColorDomain(this.state.colorValueDomain); } this.getColorScale(); } }, { key: 'getElevationValueDomain', value: function getElevationValueDomain() { var _props3 = this.props, elevationLowerPercentile = _props3.elevationLowerPercentile, elevationUpperPercentile = _props3.elevationUpperPercentile, onSetElevationDomain = _props3.onSetElevationDomain; this.state.elevationValueDomain = this.state.sortedElevationBins.getValueRange([elevationLowerPercentile, elevationUpperPercentile]); if (typeof onSetElevationDomain === 'function') { onSetElevationDomain(this.state.elevationValueDomain); } this.getElevationScale(); } }, { key: 'getColorScale', value: function getColorScale() { var colorRange = this.props.colorRange; var colorDomain = this.props.colorDomain || this.state.colorValueDomain; this.state.colorScaleFunc = getQuantizeScale(colorDomain, colorRange); } }, { key: 'getElevationScale', value: function getElevationScale() { var elevationRange = this.props.elevationRange; var elevationDomain = this.props.elevationDomain || this.state.elevationValueDomain; this.state.elevationScaleFunc = getLinearScale(elevationDomain, elevationRange); } }, { key: '_onGetSublayerColor', value: function _onGetSublayerColor(cell) { var _state2 = this.state, sortedColorBins = _state2.sortedColorBins, colorScaleFunc = _state2.colorScaleFunc, colorValueDomain = _state2.colorValueDomain; var cv = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value; var colorDomain = this.props.colorDomain || colorValueDomain; var isColorValueInDomain = cv >= colorDomain[0] && cv <= colorDomain[colorDomain.length - 1]; // if cell value is outside domain, set alpha to 0 var color = isColorValueInDomain ? colorScaleFunc(cv) : [0, 0, 0, 0]; // add alpha to color if not defined in colorRange color[3] = Number.isFinite(color[3]) ? color[3] : 255; return color; } }, { key: '_onGetSublayerElevation', value: function _onGetSublayerElevation(cell) { var _state3 = this.state, sortedElevationBins = _state3.sortedElevationBins, elevationScaleFunc = _state3.elevationScaleFunc, elevationValueDomain = _state3.elevationValueDomain; var ev = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value; var elevationDomain = this.props.elevationDomain || elevationValueDomain; var isElevationValueInDomain = ev >= elevationDomain[0] && ev <= elevationDomain[elevationDomain.length - 1]; // if cell value is outside domain, set elevation to -1 return isElevationValueInDomain ? elevationScaleFunc(ev) : -1; } // for subclassing, override this method to return // customized sub layer props }, { key: 'getSubLayerProps', value: function getSubLayerProps() { var _props4 = this.props, elevationScale = _props4.elevationScale, fp64 = _props4.fp64, extruded = _props4.extruded, cellSize = _props4.cellSize, coverage = _props4.coverage, lightSettings = _props4.lightSettings; // return props to the sublayer constructor return _get(GridLayer.prototype.__proto__ || Object.getPrototypeOf(GridLayer.prototype), 'getSubLayerProps', this).call(this, { id: 'grid-cell', data: this.state.layerData, fp64: fp64, cellSize: cellSize, coverage: coverage, lightSettings: lightSettings, elevationScale: elevationScale, extruded: extruded, getColor: this._onGetSublayerColor.bind(this), getElevation: this._onGetSublayerElevation.bind(this), updateTriggers: this.getUpdateTriggers() }); } // for subclassing, override this method to return // customized sub layer class }, { key: 'getSubLayerClass', value: function getSubLayerClass() { return _gridCellLayer2.default; } }, { key: 'renderLayers', value: function renderLayers() { var SubLayerClass = this.getSubLayerClass(); return new SubLayerClass(this.getSubLayerProps()); } }]); return GridLayer; }(_core.CompositeLayer); exports.default = GridLayer; GridLayer.layerName = 'GridLayer'; GridLayer.defaultProps = defaultProps; /***/ }), /* 300 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME hexagon-cell-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 301 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME hexagon-cell-layer-vertex-shader-64\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Custom uniforms\nuniform float opacity;\nuniform float radius;\nuniform float angle;\nuniform float extruded;\nuniform float coverage;\nuniform float elevationScale;\n\n// Result\nvarying vec4 vColor;\n\n// A magic number to scale elevation so that 1 unit approximate to 1 meter.\n#define ELEVATION_SCALE 0.8\n\nvoid main(void) {\n\n // rotate primitive position and normal\n mat2 rotationMatrix = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n\n vec2 rPos = rotationMatrix * positions.xz;\n vec2 rNorm = rotationMatrix * normals.xz; // the hexagon cells has y axis as the vertical axis\n\n vec3 rotatedPositions = vec3(rPos.x, positions.y, rPos.y);\n vec3 rotatedNormals = vec3(rNorm.x, rNorm.y, normals.y);\n\n // calculate elevation, if 3d not enabled set to 0\n // cylindar gemoetry height are between -0.5 to 0.5, transform it to between 0, 1\n float elevation = 0.0;\n\n if (extruded > 0.5) {\n elevation = project_scale(instancePositions.z * (positions.y + 0.5) *\n ELEVATION_SCALE * elevationScale);\n }\n\n // if alpha == 0.0 or z < 0.0, do not render element\n float noRender = float(instanceColors.a == 0.0 || instancePositions.z < 0.0);\n float dotRadius = radius * mix(coverage, 0.0, noRender);\n\n // project center of hexagon\n\n vec4 instancePositions64xy = vec4(\n instancePositions.x, instancePositions64xyLow.x,\n instancePositions.y, instancePositions64xyLow.y);\n\n vec2 projected_coord_xy[2];\n project_position_fp64(instancePositions64xy, projected_coord_xy);\n\n vec2 vertex_pos_localspace[4];\n vec4_fp64(vec4(rotatedPositions.xz * dotRadius, 0.0, 1.0), vertex_pos_localspace);\n\n vec2 vertex_pos_modelspace[4];\n vertex_pos_modelspace[0] = sum_fp64(vertex_pos_localspace[0], projected_coord_xy[0]);\n vertex_pos_modelspace[1] = sum_fp64(vertex_pos_localspace[1], projected_coord_xy[1]);\n vertex_pos_modelspace[2] = sum_fp64(vertex_pos_localspace[2], vec2(elevation, 0.0));\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n vec4 position_worldspace = vec4(\n vertex_pos_modelspace[0].x, vertex_pos_modelspace[1].x,\n vertex_pos_modelspace[2].x, vertex_pos_modelspace[3].x);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n\n // Light calculations\n // Worldspace is the linear space after Mercator projection\n\n vec3 normals_worldspace = rotatedNormals;\n\n float lightWeight = 1.0;\n\n if (extruded > 0.5) {\n lightWeight = getLightWeight(\n position_worldspace.xyz, // the w component is always 1.0\n normals_worldspace\n );\n }\n\n vec3 lightWeightedColor = lightWeight * instanceColors.rgb;\n\n // Color: Either opacity-multiplied instance color, or picking color\n vColor = vec4(lightWeightedColor, opacity * instanceColors.a) / 255.0;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 302 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "\n#define SHADER_NAME hexagon-cell-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 normals;\n\nattribute vec3 instancePositions;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Custom uniforms\nuniform float opacity;\nuniform float radius;\nuniform float angle;\nuniform float extruded;\nuniform float coverage;\nuniform float elevationScale;\n\n// Result\nvarying vec4 vColor;\n\n// A magic number to scale elevation so that 1 unit approximate to 1 meter.\n#define ELEVATION_SCALE 0.8\n\nvoid main(void) {\n\n // rotate primitive position and normal\n mat2 rotationMatrix = mat2(cos(angle), -sin(angle), sin(angle), cos(angle));\n\n vec2 rPos = rotationMatrix * positions.xz;\n vec2 rNorm = rotationMatrix * normals.xz; // the hexagon cells has y axis as the vertical axis\n\n vec3 rotatedPositions = vec3(rPos.x, positions.y, rPos.y);\n vec3 rotatedNormals = vec3(rNorm.x, rNorm.y, normals.y);\n\n // calculate elevation, if 3d not enabled set to 0\n // cylindar gemoetry height are between -0.5 to 0.5, transform it to between 0, 1\n float elevation = 0.0;\n\n if (extruded > 0.5) {\n elevation = project_scale(instancePositions.z * (positions.y + 0.5) *\n ELEVATION_SCALE * elevationScale);\n }\n\n // if ahpha == 0.0 or z < 0.0, do not render element\n float noRender = float(instanceColors.a == 0.0 || instancePositions.z < 0.0);\n float dotRadius = radius * mix(coverage, 0.0, noRender);\n\n // project center of hexagon\n vec4 centroidPosition = vec4(project_position(instancePositions.xy), elevation, 0.0);\n\n vec4 position_worldspace = centroidPosition + vec4(vec2(rotatedPositions.xz * dotRadius), 0., 1.);\n\n gl_Position = project_to_clipspace(position_worldspace);\n\n // Light calculations\n // Worldspace is the linear space after Mercator projection\n\n vec3 normals_worldspace = rotatedNormals;\n\n float lightWeight = 1.0;\n\n if (extruded > 0.5) {\n lightWeight = getLightWeight(\n position_worldspace.xyz, // the w component is always 1.0\n normals_worldspace\n );\n }\n\n vec3 lightWeightedColor = lightWeight * instanceColors.rgb;\n\n // opacity-multiplied instance color\n vColor = vec4(lightWeightedColor, opacity * instanceColors.a) / 255.0;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 303 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pointToHexbin = pointToHexbin; exports.getRadiusInPixel = getRadiusInPixel; var _d3Hexbin = __webpack_require__(567); /** * Use d3-hexbin to performs hexagonal binning from geo points to hexagons * @param {Array} data - array of points * @param {Number} radius - hexagon radius in meter * @param {function} getPosition - get points lon lat * @param {Object} viewport - current viewport object * @return {Object} - hexagons and countRange */ function pointToHexbin(_ref, viewport) { var data = _ref.data, radius = _ref.radius, getPosition = _ref.getPosition; // get hexagon radius in mercator world unit var radiusInPixel = getRadiusInPixel(radius, viewport); // add world space coordinates to points var screenPoints = data.map(function (pt) { return Object.assign({ screenCoord: viewport.projectFlat(getPosition(pt)) }, pt); }); var newHexbin = (0, _d3Hexbin.hexbin)().radius(radiusInPixel).x(function (d) { return d.screenCoord[0]; }).y(function (d) { return d.screenCoord[1]; }); var hexagonBins = newHexbin(screenPoints); return { hexagons: hexagonBins.map(function (hex, index) { return { centroid: viewport.unprojectFlat([hex.x, hex.y]), points: hex, index: index }; }) }; } /** * Get radius in mercator world space coordinates from meter * @param {Number} radius - in meter * @param {Object} viewport - current viewport object * @return {Number} radius in mercator world spcae coordinates */ // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. function getRadiusInPixel(radius, viewport) { var _viewport$getDistance = viewport.getDistanceScales(), pixelsPerMeter = _viewport$getDistance.pixelsPerMeter; // x, y distance should be the same return radius * pixelsPerMeter[0]; } /***/ }), /* 304 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _hexagonCellLayer = __webpack_require__(175); var _hexagonCellLayer2 = _interopRequireDefault(_hexagonCellLayer); var _hexagonAggregator2 = __webpack_require__(303); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var log = _core.experimental.log, BinSorter = _core.experimental.BinSorter, getQuantizeScale = _core.experimental.getQuantizeScale, getLinearScale = _core.experimental.getLinearScale, defaultColorRange = _core.experimental.defaultColorRange; function nop() {} var defaultProps = { // color colorDomain: null, colorRange: defaultColorRange, getColorValue: function getColorValue(points) { return points.length; }, lowerPercentile: 0, upperPercentile: 100, onSetColorDomain: nop, // elevation elevationDomain: null, elevationRange: [0, 1000], getElevationValue: function getElevationValue(points) { return points.length; }, elevationLowerPercentile: 0, elevationUpperPercentile: 100, elevationScale: 1, onSetElevationDomain: nop, radius: 1000, coverage: 1, extruded: false, hexagonAggregator: _hexagonAggregator2.pointToHexbin, getPosition: function getPosition(x) { return x.position; }, fp64: false, // Optional settings for 'lighting' shader module lightSettings: { lightsPosition: [-122.45, 37.75, 8000, -122.0, 38.0, 5000], ambientRatio: 0.05, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [2.0, 0.0, 0.0, 0.0], numberOfLights: 2 } }; var HexagonLayer = function (_CompositeLayer) { _inherits(HexagonLayer, _CompositeLayer); function HexagonLayer(props) { _classCallCheck(this, HexagonLayer); if (!props.hexagonAggregator && !props.radius) { log.once(0, 'HexagonLayer: Default hexagonAggregator requires radius prop to be set, ' + 'Now using 1000 meter as default'); props.radius = defaultProps.radius; } if (Number.isFinite(props.upperPercentile) && (props.upperPercentile > 100 || props.upperPercentile < 0)) { log.once(0, 'HexagonLayer: upperPercentile should be between 0 and 100. ' + 'Assign to 100 by default'); props.upperPercentile = defaultProps.upperPercentile; } if (Number.isFinite(props.lowerPercentile) && (props.lowerPercentile > 100 || props.lowerPercentile < 0)) { log.once(0, 'HexagonLayer: lowerPercentile should be between 0 and 100. ' + 'Assign to 0 by default'); props.lowerPercentile = defaultProps.upperPercentile; } if (props.lowerPercentile >= props.upperPercentile) { log.once(0, 'HexagonLayer: lowerPercentile should not be bigger than ' + 'upperPercentile. Assign to 0 by default'); props.lowerPercentile = defaultProps.lowerPercentile; } return _possibleConstructorReturn(this, (HexagonLayer.__proto__ || Object.getPrototypeOf(HexagonLayer)).call(this, props)); } _createClass(HexagonLayer, [{ key: 'initializeState', value: function initializeState() { this.state = { hexagons: [], hexagonVertices: null, sortedColorBins: null, sortedElevationBins: null, colorValueDomain: null, elevationValueDomain: null, colorScaleFunc: nop, elevationScaleFunc: nop, dimensionUpdaters: this.getDimensionUpdaters() }; } }, { key: 'updateState', value: function updateState(_ref) { var _this2 = this; var oldProps = _ref.oldProps, props = _ref.props, changeFlags = _ref.changeFlags; var dimensionChanges = this.getDimensionChanges(oldProps, props); if (changeFlags.dataChanged || this.needsReProjectPoints(oldProps, props)) { // project data into hexagons, and get sortedColorBins this.getHexagons(); } else if (dimensionChanges) { dimensionChanges.forEach(function (f) { return typeof f === 'function' && f.apply(_this2); }); } } }, { key: 'needsReProjectPoints', value: function needsReProjectPoints(oldProps, props) { return oldProps.radius !== props.radius || oldProps.hexagonAggregator !== props.hexagonAggregator; } }, { key: 'getDimensionUpdaters', value: function getDimensionUpdaters() { // dimension updaters are sequential, // if the first one needs to be called, the 2nd and 3rd one will automatically // be called. e.g. if ColorValue needs to be updated, getColorValueDomain and getColorScale // will automatically be called return { getColor: [{ id: 'value', triggers: ['getColorValue'], updater: this.getSortedColorBins }, { id: 'domain', triggers: ['lowerPercentile', 'upperPercentile'], updater: this.getColorValueDomain }, { id: 'scaleFunc', triggers: ['colorDomain', 'colorRange'], updater: this.getColorScale }], getElevation: [{ id: 'value', triggers: ['getElevationValue'], updater: this.getSortedElevationBins }, { id: 'domain', triggers: ['elevationLowerPercentile', 'elevationUpperPercentile'], updater: this.getElevationValueDomain }, { id: 'scaleFunc', triggers: ['elevationDomain', 'elevationRange'], updater: this.getElevationScale }] }; } }, { key: 'getDimensionChanges', value: function getDimensionChanges(oldProps, props) { var dimensionUpdaters = this.state.dimensionUpdaters; var updaters = []; // get dimension to be updated for (var dimensionKey in dimensionUpdaters) { // return the first triggered updater for each dimension var needUpdate = dimensionUpdaters[dimensionKey].find(function (item) { return item.triggers.some(function (t) { return oldProps[t] !== props[t]; }); }); if (needUpdate) { updaters.push(needUpdate.updater); } } return updaters.length ? updaters : null; } }, { key: 'getHexagons', value: function getHexagons() { var hexagonAggregator = this.props.hexagonAggregator; var viewport = this.context.viewport; var _hexagonAggregator = hexagonAggregator(this.props, viewport), hexagons = _hexagonAggregator.hexagons, hexagonVertices = _hexagonAggregator.hexagonVertices; this.setState({ hexagons: hexagons, hexagonVertices: hexagonVertices }); this.getSortedBins(); } }, { key: 'getPickingInfo', value: function getPickingInfo(_ref2) { var info = _ref2.info; var _state = this.state, sortedColorBins = _state.sortedColorBins, sortedElevationBins = _state.sortedElevationBins; var isPicked = info.picked && info.index > -1; var object = null; if (isPicked) { var cell = this.state.hexagons[info.index]; var colorValue = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value; var elevationValue = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value; object = Object.assign({ colorValue: colorValue, elevationValue: elevationValue }, cell); } // add bin colorValue and elevationValue to info return Object.assign(info, { picked: Boolean(object), // override object with picked cell object: object }); } }, { key: 'getUpdateTriggers', value: function getUpdateTriggers() { var _this3 = this; var dimensionUpdaters = this.state.dimensionUpdaters; // merge all dimension triggers var updateTriggers = {}; var _loop = function _loop(dimensionKey) { updateTriggers[dimensionKey] = {}; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = dimensionUpdaters[dimensionKey][Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var step = _step.value; step.triggers.forEach(function (prop) { updateTriggers[dimensionKey][prop] = _this3.props[prop]; }); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } }; for (var dimensionKey in dimensionUpdaters) { _loop(dimensionKey); } return updateTriggers; } }, { key: 'getValueDomain', value: function getValueDomain() { this.getColorValueDomain(); this.getElevationValueDomain(); } }, { key: 'getSortedBins', value: function getSortedBins() { this.getSortedColorBins(); this.getSortedElevationBins(); } }, { key: 'getSortedColorBins', value: function getSortedColorBins() { var getColorValue = this.props.getColorValue; var sortedColorBins = new BinSorter(this.state.hexagons || [], getColorValue); this.setState({ sortedColorBins: sortedColorBins }); this.getColorValueDomain(); } }, { key: 'getSortedElevationBins', value: function getSortedElevationBins() { var getElevationValue = this.props.getElevationValue; var sortedElevationBins = new BinSorter(this.state.hexagons || [], getElevationValue); this.setState({ sortedElevationBins: sortedElevationBins }); this.getElevationValueDomain(); } }, { key: 'getColorValueDomain', value: function getColorValueDomain() { var _props = this.props, lowerPercentile = _props.lowerPercentile, upperPercentile = _props.upperPercentile, onSetColorDomain = _props.onSetColorDomain; this.state.colorValueDomain = this.state.sortedColorBins.getValueRange([lowerPercentile, upperPercentile]); if (typeof onSetColorDomain === 'function') { onSetColorDomain(this.state.colorValueDomain); } this.getColorScale(); } }, { key: 'getElevationValueDomain', value: function getElevationValueDomain() { var _props2 = this.props, elevationLowerPercentile = _props2.elevationLowerPercentile, elevationUpperPercentile = _props2.elevationUpperPercentile, onSetElevationDomain = _props2.onSetElevationDomain; this.state.elevationValueDomain = this.state.sortedElevationBins.getValueRange([elevationLowerPercentile, elevationUpperPercentile]); if (typeof onSetElevationDomain === 'function') { onSetElevationDomain(this.state.elevationValueDomain); } this.getElevationScale(); } }, { key: 'getColorScale', value: function getColorScale() { var colorRange = this.props.colorRange; var colorDomain = this.props.colorDomain || this.state.colorValueDomain; this.state.colorScaleFunc = getQuantizeScale(colorDomain, colorRange); } }, { key: 'getElevationScale', value: function getElevationScale() { var elevationRange = this.props.elevationRange; var elevationDomain = this.props.elevationDomain || this.state.elevationValueDomain; this.state.elevationScaleFunc = getLinearScale(elevationDomain, elevationRange); } }, { key: '_onGetSublayerColor', value: function _onGetSublayerColor(cell) { var _state2 = this.state, sortedColorBins = _state2.sortedColorBins, colorScaleFunc = _state2.colorScaleFunc, colorValueDomain = _state2.colorValueDomain; var cv = sortedColorBins.binMap[cell.index] && sortedColorBins.binMap[cell.index].value; var colorDomain = this.props.colorDomain || colorValueDomain; var isColorValueInDomain = cv >= colorDomain[0] && cv <= colorDomain[colorDomain.length - 1]; // if cell value is outside domain, set alpha to 0 var color = isColorValueInDomain ? colorScaleFunc(cv) : [0, 0, 0, 0]; // add alpha to color if not defined in colorRange color[3] = Number.isFinite(color[3]) ? color[3] : 255; return color; } }, { key: '_onGetSublayerElevation', value: function _onGetSublayerElevation(cell) { var _state3 = this.state, sortedElevationBins = _state3.sortedElevationBins, elevationScaleFunc = _state3.elevationScaleFunc, elevationValueDomain = _state3.elevationValueDomain; var ev = sortedElevationBins.binMap[cell.index] && sortedElevationBins.binMap[cell.index].value; var elevationDomain = this.props.elevationDomain || elevationValueDomain; var isElevationValueInDomain = ev >= elevationDomain[0] && ev <= elevationDomain[elevationDomain.length - 1]; // if cell value is outside domain, set elevation to -1 return isElevationValueInDomain ? elevationScaleFunc(ev) : -1; } // for subclassing, override this method to return // customized sub layer props }, { key: 'getSubLayerProps', value: function getSubLayerProps() { var _props3 = this.props, radius = _props3.radius, elevationScale = _props3.elevationScale, extruded = _props3.extruded, coverage = _props3.coverage, lightSettings = _props3.lightSettings, fp64 = _props3.fp64; // return props to the sublayer constructor return _get(HexagonLayer.prototype.__proto__ || Object.getPrototypeOf(HexagonLayer.prototype), 'getSubLayerProps', this).call(this, { id: 'hexagon-cell', data: this.state.hexagons, fp64: fp64, hexagonVertices: this.state.hexagonVertices, radius: radius, elevationScale: elevationScale, angle: Math.PI, extruded: extruded, coverage: coverage, lightSettings: lightSettings, getColor: this._onGetSublayerColor.bind(this), getElevation: this._onGetSublayerElevation.bind(this), updateTriggers: this.getUpdateTriggers() }); } // for subclassing, override this method to return // customized sub layer class }, { key: 'getSubLayerClass', value: function getSubLayerClass() { return _hexagonCellLayer2.default; } }, { key: 'renderLayers', value: function renderLayers() { var SubLayerClass = this.getSubLayerClass(); return new SubLayerClass(this.getSubLayerProps()); } }]); return HexagonLayer; }(_core.CompositeLayer); exports.default = HexagonLayer; HexagonLayer.layerName = 'HexagonLayer'; HexagonLayer.defaultProps = defaultProps; /***/ }), /* 305 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME icon-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform float opacity;\nuniform sampler2D iconsTexture;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\n\nconst float MIN_ALPHA = 0.05;\n\nvoid main(void) {\n vec4 texColor = texture2D(iconsTexture, vTextureCoords);\n\n // if colorMode == 0, use pixel color from the texture\n // if colorMode == 1 or rendering picking buffer, use texture as transparency mask\n vec3 color = mix(texColor.rgb, vColor.rgb, vColorMode);\n float a = texColor.a * opacity * mix(1.0, vColor.a, vColorMode);\n\n if (a < MIN_ALPHA) {\n discard;\n }\n\n gl_FragColor = vec4(color, a);\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 306 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME icon-layer-vertex-shader-64\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n vec2 iconSize = instanceIconFrames.zw;\n // scale icon height to match instanceSize\n float instanceScale = iconSize.y == 0.0 ? 0.0 : instanceSizes / iconSize.y;\n\n // scale and rotate vertex in \"pixel\" value and convert back to fraction in clipspace\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * sizeScale * instanceScale;\n pixelOffset.y *= -1.0;\n\n vec4 instancePositions64xy = vec4(\n instancePositions.x, instancePositions64xyLow.x,\n instancePositions.y, instancePositions64xyLow.y);\n\n vec2 projected_coord_xy[2];\n project_position_fp64(instancePositions64xy, projected_coord_xy);\n\n vec2 vertex_pos_modelspace[4];\n vertex_pos_modelspace[0] = projected_coord_xy[0];\n vertex_pos_modelspace[1] = projected_coord_xy[1];\n vertex_pos_modelspace[2] = vec2(project_scale(instancePositions.z), 0.0);\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n gl_Position += project_pixel_to_clipspace(pixelOffset);\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / iconsTextureDim;\n\n vTextureCoords.y = 1.0 - vTextureCoords.y;\n\n vColor = instanceColors / 255.;\n\n vColorMode = instanceColorModes;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 307 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME icon-layer-vertex-shader\n\nattribute vec2 positions;\n\nattribute vec3 instancePositions;\nattribute float instanceSizes;\nattribute float instanceAngles;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec4 instanceIconFrames;\nattribute float instanceColorModes;\nattribute vec2 instanceOffsets;\n\nuniform float sizeScale;\nuniform vec2 iconsTextureDim;\n\nvarying float vColorMode;\nvarying vec4 vColor;\nvarying vec2 vTextureCoords;\n\nvec2 rotate_by_angle(vec2 vertex, float angle) {\n float angle_radian = angle * PI / 180.0;\n float cos_angle = cos(angle_radian);\n float sin_angle = sin(angle_radian);\n mat2 rotationMatrix = mat2(cos_angle, -sin_angle, sin_angle, cos_angle);\n return rotationMatrix * vertex;\n}\n\nvoid main(void) {\n vec2 iconSize = instanceIconFrames.zw;\n // scale icon height to match instanceSize\n float instanceScale = iconSize.y == 0.0 ? 0.0 : instanceSizes / iconSize.y;\n\n // scale and rotate vertex in \"pixel\" value and convert back to fraction in clipspace\n vec2 pixelOffset = positions / 2.0 * iconSize + instanceOffsets;\n pixelOffset = rotate_by_angle(pixelOffset, instanceAngles) * sizeScale * instanceScale;\n pixelOffset.y *= -1.0;\n\n vec3 center = project_position(instancePositions);\n gl_Position = project_to_clipspace(vec4(center, 1.0));\n gl_Position += project_pixel_to_clipspace(pixelOffset);\n\n vTextureCoords = mix(\n instanceIconFrames.xy,\n instanceIconFrames.xy + iconSize,\n (positions.xy + 1.0) / 2.0\n ) / iconsTextureDim;\n\n vTextureCoords.y = 1.0 - vTextureCoords.y;\n\n vColor = instanceColors / 255.;\n\n vColorMode = instanceColorModes;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 308 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _iconLayerVertex = __webpack_require__(307); var _iconLayerVertex2 = _interopRequireDefault(_iconLayerVertex); var _iconLayerVertex3 = __webpack_require__(306); var _iconLayerVertex4 = _interopRequireDefault(_iconLayerVertex3); var _iconLayerFragment = __webpack_require__(305); var _iconLayerFragment2 = _interopRequireDefault(_iconLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var fp64LowPart = _core.experimental.fp64LowPart, enable64bitSupport = _core.experimental.enable64bitSupport; var DEFAULT_COLOR = [0, 0, 0, 255]; var DEFAULT_TEXTURE_MIN_FILTER = _luma.GL.LINEAR_MIPMAP_LINEAR; // GL.LINEAR is the default value but explicitly set it here var DEFAULT_TEXTURE_MAG_FILTER = _luma.GL.LINEAR; /* * @param {object} props * @param {Texture2D | string} props.iconAtlas - atlas image url or texture * @param {object} props.iconMapping - icon names mapped to icon definitions * @param {object} props.iconMapping[icon_name].x - x position of icon on the atlas image * @param {object} props.iconMapping[icon_name].y - y position of icon on the atlas image * @param {object} props.iconMapping[icon_name].width - width of icon on the atlas image * @param {object} props.iconMapping[icon_name].height - height of icon on the atlas image * @param {object} props.iconMapping[icon_name].anchorX - x anchor of icon on the atlas image, * default to width / 2 * @param {object} props.iconMapping[icon_name].anchorY - y anchor of icon on the atlas image, * default to height / 2 * @param {object} props.iconMapping[icon_name].mask - whether icon is treated as a transparency * mask. If true, user defined color is applied. If false, original color from the image is * applied. Default to false. * @param {number} props.size - icon size in pixels * @param {func} props.getPosition - returns anchor position of the icon, in [lng, lat, z] * @param {func} props.getIcon - returns icon name as a string * @param {func} props.getSize - returns icon size multiplier as a number * @param {func} props.getColor - returns color of the icon in [r, g, b, a]. Only works on icons * with mask: true. * @param {func} props.getAngle - returns rotating angle (in degree) of the icon. */ var defaultProps = { iconAtlas: null, iconMapping: {}, sizeScale: 1, fp64: false, getPosition: function getPosition(x) { return x.position; }, getIcon: function getIcon(x) { return x.icon; }, getColor: function getColor(x) { return x.color || DEFAULT_COLOR; }, getSize: function getSize(x) { return x.size || 1; }, getAngle: function getAngle(x) { return x.angle || 0; } }; var IconLayer = function (_Layer) { _inherits(IconLayer, _Layer); function IconLayer() { _classCallCheck(this, IconLayer); return _possibleConstructorReturn(this, (IconLayer.__proto__ || Object.getPrototypeOf(IconLayer)).apply(this, arguments)); } _createClass(IconLayer, [{ key: 'getShaders', value: function getShaders() { return enable64bitSupport(this.props) ? { vs: _iconLayerVertex4.default, fs: _iconLayerFragment2.default, modules: ['project64', 'picking'] } : { vs: _iconLayerVertex2.default, fs: _iconLayerFragment2.default, modules: ['picking'] }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { var attributeManager = this.getAttributeManager(); /* eslint-disable max-len */ attributeManager.addInstanced({ instancePositions: { size: 3, transition: true, accessor: 'getPosition', update: this.calculateInstancePositions }, instanceSizes: { size: 1, transition: true, accessor: 'getSize', update: this.calculateInstanceSizes }, instanceOffsets: { size: 2, accessor: 'getIcon', update: this.calculateInstanceOffsets }, instanceIconFrames: { size: 4, accessor: 'getIcon', update: this.calculateInstanceIconFrames }, instanceColorModes: { size: 1, type: _luma.GL.UNSIGNED_BYTE, accessor: 'getIcon', update: this.calculateInstanceColorMode }, instanceColors: { size: 4, type: _luma.GL.UNSIGNED_BYTE, transition: true, accessor: 'getColor', update: this.calculateInstanceColors }, instanceAngles: { size: 1, transition: true, accessor: 'getAngle', update: this.calculateInstanceAngles } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.addInstanced({ instancePositions64xyLow: { size: 2, accessor: 'getPosition', update: this.calculateInstancePositions64xyLow } }); } else { attributeManager.remove(['instancePositions64xyLow']); } } } }, { key: 'updateState', value: function updateState(_ref2) { var _this2 = this; var oldProps = _ref2.oldProps, props = _ref2.props, changeFlags = _ref2.changeFlags; _get(IconLayer.prototype.__proto__ || Object.getPrototypeOf(IconLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); var iconAtlas = props.iconAtlas, iconMapping = props.iconMapping; if (oldProps.iconMapping !== iconMapping) { var attributeManager = this.getAttributeManager(); attributeManager.invalidate('instanceOffsets'); attributeManager.invalidate('instanceIconFrames'); attributeManager.invalidate('instanceColorModes'); } if (oldProps.iconAtlas !== iconAtlas) { if (iconAtlas instanceof _luma.Texture2D) { var _iconAtlas$setParamet; iconAtlas.setParameters((_iconAtlas$setParamet = {}, _defineProperty(_iconAtlas$setParamet, _luma.GL.TEXTURE_MIN_FILTER, DEFAULT_TEXTURE_MIN_FILTER), _defineProperty(_iconAtlas$setParamet, _luma.GL.TEXTURE_MAG_FILTER, DEFAULT_TEXTURE_MAG_FILTER), _iconAtlas$setParamet)); this.setState({ iconsTexture: iconAtlas }); } else if (typeof iconAtlas === 'string') { (0, _luma.loadTextures)(this.context.gl, { urls: [iconAtlas] }).then(function (_ref3) { var _texture$setParameter; var _ref4 = _slicedToArray(_ref3, 1), texture = _ref4[0]; texture.setParameters((_texture$setParameter = {}, _defineProperty(_texture$setParameter, _luma.GL.TEXTURE_MIN_FILTER, DEFAULT_TEXTURE_MIN_FILTER), _defineProperty(_texture$setParameter, _luma.GL.TEXTURE_MAG_FILTER, DEFAULT_TEXTURE_MAG_FILTER), _texture$setParameter)); _this2.setState({ iconsTexture: texture }); }); } } if (props.fp64 !== oldProps.fp64) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); } }, { key: 'draw', value: function draw(_ref5) { var uniforms = _ref5.uniforms; var sizeScale = this.props.sizeScale; var iconsTexture = this.state.iconsTexture; if (iconsTexture) { this.state.model.render(Object.assign({}, uniforms, { iconsTexture: iconsTexture, iconsTextureDim: [iconsTexture.width, iconsTexture.height], sizeScale: sizeScale })); } } }, { key: '_getModel', value: function _getModel(gl) { var positions = [-1, -1, 0, -1, 1, 0, 1, 1, 0, 1, -1, 0]; return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: new _luma.Geometry({ drawMode: _luma.GL.TRIANGLE_FAN, attributes: { positions: new Float32Array(positions) } }), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'calculateInstancePositions', value: function calculateInstancePositions(attribute) { var _props = this.props, data = _props.data, getPosition = _props.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var object = _step.value; var position = getPosition(object); value[i++] = position[0]; value[i++] = position[1]; value[i++] = position[2] || 0; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'calculateInstancePositions64xyLow', value: function calculateInstancePositions64xyLow(attribute) { var _props2 = this.props, data = _props2.data, getPosition = _props2.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var point = _step2.value; var position = getPosition(point); value[i++] = fp64LowPart(position[0]); value[i++] = fp64LowPart(position[1]); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: 'calculateInstanceSizes', value: function calculateInstanceSizes(attribute) { var _props3 = this.props, data = _props3.data, getSize = _props3.getSize; var value = attribute.value; var i = 0; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var object = _step3.value; value[i++] = getSize(object); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } }, { key: 'calculateInstanceAngles', value: function calculateInstanceAngles(attribute) { var _props4 = this.props, data = _props4.data, getAngle = _props4.getAngle; var value = attribute.value; var i = 0; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = data[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var object = _step4.value; value[i++] = getAngle(object); } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } } }, { key: 'calculateInstanceColors', value: function calculateInstanceColors(attribute) { var _props5 = this.props, data = _props5.data, getColor = _props5.getColor; var value = attribute.value; var i = 0; var _iteratorNormalCompletion5 = true; var _didIteratorError5 = false; var _iteratorError5 = undefined; try { for (var _iterator5 = data[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { var object = _step5.value; var color = getColor(object); value[i++] = color[0]; value[i++] = color[1]; value[i++] = color[2]; value[i++] = isNaN(color[3]) ? 255 : color[3]; } } catch (err) { _didIteratorError5 = true; _iteratorError5 = err; } finally { try { if (!_iteratorNormalCompletion5 && _iterator5.return) { _iterator5.return(); } } finally { if (_didIteratorError5) { throw _iteratorError5; } } } } }, { key: 'calculateInstanceOffsets', value: function calculateInstanceOffsets(attribute) { var _props6 = this.props, data = _props6.data, iconMapping = _props6.iconMapping, getIcon = _props6.getIcon; var value = attribute.value; var i = 0; var _iteratorNormalCompletion6 = true; var _didIteratorError6 = false; var _iteratorError6 = undefined; try { for (var _iterator6 = data[Symbol.iterator](), _step6; !(_iteratorNormalCompletion6 = (_step6 = _iterator6.next()).done); _iteratorNormalCompletion6 = true) { var object = _step6.value; var icon = getIcon(object); var rect = iconMapping[icon] || {}; value[i++] = rect.width / 2 - rect.anchorX || 0; value[i++] = rect.height / 2 - rect.anchorY || 0; } } catch (err) { _didIteratorError6 = true; _iteratorError6 = err; } finally { try { if (!_iteratorNormalCompletion6 && _iterator6.return) { _iterator6.return(); } } finally { if (_didIteratorError6) { throw _iteratorError6; } } } } }, { key: 'calculateInstanceColorMode', value: function calculateInstanceColorMode(attribute) { var _props7 = this.props, data = _props7.data, iconMapping = _props7.iconMapping, getIcon = _props7.getIcon; var value = attribute.value; var i = 0; var _iteratorNormalCompletion7 = true; var _didIteratorError7 = false; var _iteratorError7 = undefined; try { for (var _iterator7 = data[Symbol.iterator](), _step7; !(_iteratorNormalCompletion7 = (_step7 = _iterator7.next()).done); _iteratorNormalCompletion7 = true) { var object = _step7.value; var icon = getIcon(object); var colorMode = iconMapping[icon] && iconMapping[icon].mask; value[i++] = colorMode ? 1 : 0; } } catch (err) { _didIteratorError7 = true; _iteratorError7 = err; } finally { try { if (!_iteratorNormalCompletion7 && _iterator7.return) { _iterator7.return(); } } finally { if (_didIteratorError7) { throw _iteratorError7; } } } } }, { key: 'calculateInstanceIconFrames', value: function calculateInstanceIconFrames(attribute) { var _props8 = this.props, data = _props8.data, iconMapping = _props8.iconMapping, getIcon = _props8.getIcon; var value = attribute.value; var i = 0; var _iteratorNormalCompletion8 = true; var _didIteratorError8 = false; var _iteratorError8 = undefined; try { for (var _iterator8 = data[Symbol.iterator](), _step8; !(_iteratorNormalCompletion8 = (_step8 = _iterator8.next()).done); _iteratorNormalCompletion8 = true) { var object = _step8.value; var icon = getIcon(object); var rect = iconMapping[icon] || {}; value[i++] = rect.x || 0; value[i++] = rect.y || 0; value[i++] = rect.width || 0; value[i++] = rect.height || 0; } } catch (err) { _didIteratorError8 = true; _iteratorError8 = err; } finally { try { if (!_iteratorNormalCompletion8 && _iterator8.return) { _iterator8.return(); } } finally { if (_didIteratorError8) { throw _iteratorError8; } } } } }]); return IconLayer; }(_core.Layer); exports.default = IconLayer; IconLayer.layerName = 'IconLayer'; IconLayer.defaultProps = defaultProps; /***/ }), /* 309 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _arcLayer = __webpack_require__(292); Object.defineProperty(exports, 'ArcLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_arcLayer).default; } }); var _iconLayer = __webpack_require__(308); Object.defineProperty(exports, 'IconLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_iconLayer).default; } }); var _lineLayer = __webpack_require__(313); Object.defineProperty(exports, 'LineLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_lineLayer).default; } }); var _pointCloudLayer = __webpack_require__(320); Object.defineProperty(exports, 'PointCloudLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_pointCloudLayer).default; } }); var _scatterplotLayer = __webpack_require__(176); Object.defineProperty(exports, 'ScatterplotLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_scatterplotLayer).default; } }); var _screenGridLayer = __webpack_require__(327); Object.defineProperty(exports, 'ScreenGridLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_screenGridLayer).default; } }); var _gridLayer = __webpack_require__(299); Object.defineProperty(exports, 'GridLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_gridLayer).default; } }); var _gridCellLayer = __webpack_require__(174); Object.defineProperty(exports, 'GridCellLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_gridCellLayer).default; } }); var _hexagonLayer = __webpack_require__(304); Object.defineProperty(exports, 'HexagonLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_hexagonLayer).default; } }); var _hexagonCellLayer = __webpack_require__(175); Object.defineProperty(exports, 'HexagonCellLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_hexagonCellLayer).default; } }); var _pathLayer = __webpack_require__(119); Object.defineProperty(exports, 'PathLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_pathLayer).default; } }); var _polygonLayer = __webpack_require__(321); Object.defineProperty(exports, 'PolygonLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_polygonLayer).default; } }); var _geojsonLayer = __webpack_require__(293); Object.defineProperty(exports, 'GeoJsonLayer', { enumerable: true, get: function get() { return _interopRequireDefault(_geojsonLayer).default; } }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), /* 310 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME line-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 311 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME line-layer-vertex-shader-64\n\nattribute vec3 positions;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceTargetPositions;\nattribute vec4 instanceSourceTargetPositions64xyLow;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float strokeWidth;\nuniform float opacity;\n\nvarying vec4 vColor;\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset_screenspace = dir_screenspace * offset_direction * strokeWidth / 2.0;\n vec2 offset_clipspace = project_pixel_to_clipspace(offset_screenspace).xy;\n\n return offset_clipspace;\n}\n\nvoid main(void) {\n // Position\n vec4 instanceSourcePositions64 = vec4(\n instanceSourcePositions.x, instanceSourceTargetPositions64xyLow.x,\n instanceSourcePositions.y, instanceSourceTargetPositions64xyLow.y);\n\n vec4 instanceTargetPositions64 = vec4(\n instanceTargetPositions.x, instanceSourceTargetPositions64xyLow.z,\n instanceTargetPositions.y, instanceSourceTargetPositions64xyLow.w);\n\n vec2 projected_source_coord[2];\n vec2 projected_target_coord[2];\n\n project_position_fp64(instanceSourcePositions64, projected_source_coord);\n project_position_fp64(instanceTargetPositions64, projected_target_coord);\n\n vec2 source_pos_modelspace[4];\n source_pos_modelspace[0] = projected_source_coord[0];\n source_pos_modelspace[1] = projected_source_coord[1];\n source_pos_modelspace[2] = vec2(project_scale(instanceSourcePositions.z), 0.0);\n source_pos_modelspace[3] = vec2(1.0, 0.0);\n\n vec4 source_pos_clipspace = project_to_clipspace_fp64(source_pos_modelspace);\n\n vec2 target_pos_modelspace[4];\n target_pos_modelspace[0] = projected_target_coord[0];\n target_pos_modelspace[1] = projected_target_coord[1];\n target_pos_modelspace[2] = vec2(project_scale(instanceTargetPositions.z), 0.0);\n target_pos_modelspace[3] = vec2(1.0, 0.0);\n\n vec4 target_pos_clipspace = project_to_clipspace_fp64(target_pos_modelspace);\n\n float segmentIndex = positions.x;\n vec4 p = mix(source_pos_clipspace, target_pos_clipspace, segmentIndex);\n\n vec2 offset = getExtrusionOffset(target_pos_clipspace.xy - source_pos_clipspace.xy, positions.y);\n\n gl_Position = p + vec4(offset, 0.0, 0.0);\n\n // Color\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 312 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME line-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 instanceSourcePositions;\nattribute vec3 instanceTargetPositions;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float strokeWidth;\nuniform float opacity;\n\nvarying vec4 vColor;\n\n// offset vector by strokeWidth pixels\n// offset_direction is -1 (left) or 1 (right)\nvec2 getExtrusionOffset(vec2 line_clipspace, float offset_direction) {\n // normalized direction of the line\n vec2 dir_screenspace = normalize(line_clipspace * project_uViewportSize);\n // rotate by 90 degrees\n dir_screenspace = vec2(-dir_screenspace.y, dir_screenspace.x);\n\n vec2 offset_screenspace = dir_screenspace * offset_direction * strokeWidth / 2.0;\n vec2 offset_clipspace = project_pixel_to_clipspace(offset_screenspace).xy;\n\n return offset_clipspace;\n}\n\nvoid main(void) {\n // Position\n vec3 sourcePos = project_position(instanceSourcePositions);\n vec3 targetPos = project_position(instanceTargetPositions);\n vec4 source = project_to_clipspace(vec4(sourcePos, 1.0));\n vec4 target = project_to_clipspace(vec4(targetPos, 1.0));\n\n // linear interpolation of source & target to pick right coord\n float segmentIndex = positions.x;\n vec4 p = mix(source, target, segmentIndex);\n\n // extrude\n vec2 offset = getExtrusionOffset(target.xy - source.xy, positions.y);\n gl_Position = p + vec4(offset, 0.0, 0.0);\n\n // Color\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 313 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _lineLayerVertex = __webpack_require__(312); var _lineLayerVertex2 = _interopRequireDefault(_lineLayerVertex); var _lineLayerVertex3 = __webpack_require__(311); var _lineLayerVertex4 = _interopRequireDefault(_lineLayerVertex3); var _lineLayerFragment = __webpack_require__(310); var _lineLayerFragment2 = _interopRequireDefault(_lineLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var fp64LowPart = _core.experimental.fp64LowPart, enable64bitSupport = _core.experimental.enable64bitSupport; var DEFAULT_COLOR = [0, 0, 0, 255]; var defaultProps = { strokeWidth: 1, fp64: false, getSourcePosition: function getSourcePosition(x) { return x.sourcePosition; }, getTargetPosition: function getTargetPosition(x) { return x.targetPosition; }, getColor: function getColor(x) { return x.color || DEFAULT_COLOR; } }; var LineLayer = function (_Layer) { _inherits(LineLayer, _Layer); function LineLayer() { _classCallCheck(this, LineLayer); return _possibleConstructorReturn(this, (LineLayer.__proto__ || Object.getPrototypeOf(LineLayer)).apply(this, arguments)); } _createClass(LineLayer, [{ key: 'getShaders', value: function getShaders() { return enable64bitSupport(this.props) ? { vs: _lineLayerVertex4.default, fs: _lineLayerFragment2.default, modules: ['project64', 'picking'] } : { vs: _lineLayerVertex2.default, fs: _lineLayerFragment2.default, modules: ['picking'] }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { var attributeManager = this.getAttributeManager(); /* eslint-disable max-len */ attributeManager.addInstanced({ instanceSourcePositions: { size: 3, transition: true, accessor: 'getSourcePosition', update: this.calculateInstanceSourcePositions }, instanceTargetPositions: { size: 3, transition: true, accessor: 'getTargetPosition', update: this.calculateInstanceTargetPositions }, instanceColors: { size: 4, type: _luma.GL.UNSIGNED_BYTE, transition: true, accessor: 'getColor', update: this.calculateInstanceColors } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.addInstanced({ instanceSourceTargetPositions64xyLow: { size: 4, accessor: ['getSourcePosition', 'getTargetPosition'], update: this.calculateInstanceSourceTargetPositions64xyLow } }); } else { attributeManager.remove(['instanceSourceTargetPositions64xyLow']); } } } }, { key: 'updateState', value: function updateState(_ref2) { var props = _ref2.props, oldProps = _ref2.oldProps, changeFlags = _ref2.changeFlags; _get(LineLayer.prototype.__proto__ || Object.getPrototypeOf(LineLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); if (props.fp64 !== oldProps.fp64) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); } }, { key: 'draw', value: function draw(_ref3) { var uniforms = _ref3.uniforms; var strokeWidth = this.props.strokeWidth; this.state.model.render(Object.assign({}, uniforms, { strokeWidth: strokeWidth })); } }, { key: '_getModel', value: function _getModel(gl) { /* * (0, -1)-------------_(1, -1) * | _,-" | * o _,-" o * | _,-" | * (0, 1)"-------------(1, 1) */ var positions = [0, -1, 0, 0, 1, 0, 1, -1, 0, 1, 1, 0]; return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: new _luma.Geometry({ drawMode: _luma.GL.TRIANGLE_STRIP, attributes: { positions: new Float32Array(positions) } }), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'calculateInstanceSourcePositions', value: function calculateInstanceSourcePositions(attribute) { var _props = this.props, data = _props.data, getSourcePosition = _props.getSourcePosition; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var object = _step.value; var sourcePosition = getSourcePosition(object); value[i + 0] = sourcePosition[0]; value[i + 1] = sourcePosition[1]; value[i + 2] = isNaN(sourcePosition[2]) ? 0 : sourcePosition[2]; i += size; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'calculateInstanceTargetPositions', value: function calculateInstanceTargetPositions(attribute) { var _props2 = this.props, data = _props2.data, getTargetPosition = _props2.getTargetPosition; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var object = _step2.value; var targetPosition = getTargetPosition(object); value[i + 0] = targetPosition[0]; value[i + 1] = targetPosition[1]; value[i + 2] = isNaN(targetPosition[2]) ? 0 : targetPosition[2]; i += size; } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: 'calculateInstanceSourceTargetPositions64xyLow', value: function calculateInstanceSourceTargetPositions64xyLow(attribute) { var _props3 = this.props, data = _props3.data, getSourcePosition = _props3.getSourcePosition, getTargetPosition = _props3.getTargetPosition; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var object = _step3.value; var sourcePosition = getSourcePosition(object); var targetPosition = getTargetPosition(object); value[i + 0] = fp64LowPart(sourcePosition[0]); value[i + 1] = fp64LowPart(sourcePosition[1]); value[i + 2] = fp64LowPart(targetPosition[0]); value[i + 3] = fp64LowPart(targetPosition[1]); i += size; } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } }, { key: 'calculateInstanceColors', value: function calculateInstanceColors(attribute) { var _props4 = this.props, data = _props4.data, getColor = _props4.getColor; var value = attribute.value, size = attribute.size; var i = 0; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = data[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var object = _step4.value; var color = getColor(object); value[i + 0] = color[0]; value[i + 1] = color[1]; value[i + 2] = color[2]; value[i + 3] = isNaN(color[3]) ? 255 : color[3]; i += size; } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } } }]); return LineLayer; }(_core.Layer); exports.default = LineLayer; LineLayer.layerName = 'LineLayer'; LineLayer.defaultProps = defaultProps; /***/ }), /* 314 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME path-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform float jointType;\nuniform float miterLimit;\nuniform float alignMode;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vDashArray;\nvarying float vPathPosition;\nvarying float vPathLength;\n\n// mod doesn't work correctly for negative numbers\nfloat mod2(float a, float b) {\n return a - floor(a / b) * b;\n}\n\nfloat round(float x) {\n return floor(x + 0.5);\n}\n\n// if given position is in the gap part of the dashed line\n// dashArray.x: solid stroke length, relative to width\n// dashArray.y: gap length, relative to width\n// alignMode:\n// 0 - no adjustment\n// o---- ---- ---- ---- o---- -o---- ---- o\n// 1 - stretch to fit, draw half dash at each end for nicer joints\n// o-- ---- ---- ---- --o-- --o-- ---- --o\nbool dash_isFragInGap() {\n float solidLength = vDashArray.x;\n float gapLength = vDashArray.y;\n\n float unitLength = solidLength + gapLength;\n\n if (unitLength == 0.0) {\n return false;\n }\n\n unitLength = mix(\n unitLength,\n vPathLength / round(vPathLength / unitLength),\n alignMode\n );\n\n float offset = alignMode * solidLength / 2.0;\n\n return gapLength > 0.0 &&\n vPathPosition >= 0.0 &&\n vPathPosition <= vPathLength &&\n mod2(vPathPosition + offset, unitLength) > solidLength;\n}\n\nvoid main(void) {\n // if joint is rounded, test distance from the corner\n if (jointType > 0.0 && vMiterLength > 0.0 && length(vCornerOffset) > 1.0) {\n // Enable to debug joints\n // gl_FragColor = vec4(0., 1., 0., 1.);\n // return;\n discard;\n }\n if (jointType == 0.0 && vMiterLength > miterLimit) {\n // Enable to debug joints\n // gl_FragColor = vec4(0., 0., 1., 1.);\n // return;\n discard;\n }\n if (vColor.a == 0.0 || dash_isFragInGap()) {\n // Enable to debug joints\n // gl_FragColor = vec4(0., 1., 1., 1.);\n // return;\n discard;\n }\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 315 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "\n#define SHADER_NAME path-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec4 instanceStartEndPositions64xyLow;\nattribute vec3 instanceLeftDeltas;\nattribute vec3 instanceRightDeltas;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec2 instanceDashArrays;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float miterLimit;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vDashArray;\nvarying float vPathPosition;\nvarying float vPathLength;\n\nconst float EPSILON = 0.001;\nconst float PIXEL_EPSILON = 0.1;\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\n\nvec3 lineJoin(vec2 prevPoint64[2], vec2 currPoint64[2], vec2 nextPoint64[2]) {\n\n float width = clamp(project_scale(instanceStrokeWidths * widthScale),\n widthMinPixels, widthMaxPixels) / 2.0;\n\n vec2 deltaA64[2];\n vec2 deltaB64[2];\n\n vec2_sub_fp64(currPoint64, prevPoint64, deltaA64);\n vec2_sub_fp64(nextPoint64, currPoint64, deltaB64);\n\n vec2 lengthA64 = vec2_length_fp64(deltaA64);\n vec2 lengthB64 = vec2_length_fp64(deltaB64);\n\n vec2 deltaA = vec2(deltaA64[0].x, deltaA64[1].x);\n vec2 deltaB = vec2(deltaB64[0].x, deltaB64[1].x);\n\n float lenA = lengthA64.x;\n float lenB = lengthB64.x;\n\n vec2 offsetVec;\n float offsetScale;\n float offsetDirection;\n\n // when two points are closer than PIXEL_EPSILON in pixels,\n // assume they are the same point to avoid precision issue\n lenA = lenA > PIXEL_EPSILON ? lenA : 0.0;\n lenB = lenB > PIXEL_EPSILON ? lenB : 0.0;\n vec2 dirA = lenA > 0. ? deltaA / lenA : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? deltaB / lenB : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n\n // tangent of the corner\n vec2 tangent = vec2(dirA + dirB);\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n // direction of the corner\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n // width offset from current position\n vec2 perp = mix(perpB, perpA, positions.x);\n float L = mix(lenB, lenA, positions.x);\n\n // cap super sharp angles\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n bool turnsRight = dirA.x * dirB.y > dirA.y * dirB.x;\n\n // relative position to the corner:\n // -1: inside (smaller side of the angle)\n // 0: center\n // 1: outside (bigger side of the angle)\n float cornerPosition = mix(\n flipIfTrue(turnsRight == (positions.y > 0.0)),\n 0.0,\n positions.z\n );\n\n offsetScale = 1.0 / max(sinHalfA, EPSILON);\n\n // do not bevel if line segment is too short\n cornerPosition *= float(cornerPosition <= 0.0 || sinHalfA < min(lenA, lenB) / width * cosHalfA);\n // trim if inside corner extends further than the line segment\n offsetScale = mix(\n offsetScale,\n min(offsetScale, L / width / max(cosHalfA, EPSILON)),\n float(cornerPosition < 0.0)\n );\n\n vMiterLength = mix(\n offsetScale * cornerPosition,\n mix(offsetScale, 0.0, cornerPosition),\n step(0.0, cornerPosition)\n ) - sinHalfA * jointType;\n offsetDirection = mix(\n positions.y,\n mix(\n flipIfTrue(turnsRight),\n positions.y * flipIfTrue(turnsRight == (positions.x == 1.)),\n cornerPosition\n ),\n step(0.0, cornerPosition)\n );\n offsetVec = mix(miterVec, -tangent, step(0.5, cornerPosition));\n offsetScale = mix(offsetScale, 1.0 / max(cosHalfA, 0.001), step(0.5, cornerPosition));\n\n // special treatment for start cap and end cap\n // using a small number as the limit for determining if the lenA or lenB is 0\n float isStartCap = step(lenA, 1.0e-5);\n float isEndCap = step(lenB, 1.0e-5);\n float isCap = max(isStartCap, isEndCap);\n\n // 0: center, 1: side\n cornerPosition = isCap * (1.0 - positions.z);\n\n // start of path: use next - curr\n offsetVec = mix(offsetVec, mix(dirB, perpB, cornerPosition), isStartCap);\n // end of path: use curr - prev\n offsetVec = mix(offsetVec, mix(dirA, perpA, cornerPosition), isEndCap);\n\n // extend out a triangle to envelope the round cap\n offsetScale = mix(\n offsetScale,\n mix(4.0 * jointType, 1.0, cornerPosition),\n isCap\n );\n vMiterLength = mix(vMiterLength, 1.0 - cornerPosition, isCap);\n\n offsetDirection = mix(\n offsetDirection,\n mix(flipIfTrue(isStartCap > 0.), positions.y, cornerPosition),\n isCap\n );\n\n vCornerOffset = offsetVec * offsetDirection * offsetScale;\n\n // Generate variables for dash calculation\n vDashArray = instanceDashArrays;\n vPathLength = L / width;\n float isEnd = positions.x;\n vec2 offsetFromStartOfPath = mix(vCornerOffset, vCornerOffset + deltaA / width, isEnd);\n vec2 dir = mix(dirB, dirA, isEnd);\n vPathPosition = dot(offsetFromStartOfPath, dir);\n\n return vec3(vCornerOffset * width, 0.0);\n}\n\nvoid main() {\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n\n float isEnd = positions.x;\n\n // Calculate current position\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n currPosition = project_position(currPosition);\n\n // Calculate current position 64bit\n\n vec2 instanceStartPositions64[2];\n instanceStartPositions64[0] = vec2(instanceStartPositions.x, instanceStartEndPositions64xyLow.x);\n instanceStartPositions64[1] = vec2(instanceStartPositions.y, instanceStartEndPositions64xyLow.y);\n\n vec2 instanceEndPositions64[2];\n instanceEndPositions64[0] = vec2(instanceEndPositions.x, instanceStartEndPositions64xyLow.z);\n instanceEndPositions64[1] = vec2(instanceEndPositions.y, instanceStartEndPositions64xyLow.w);\n\n vec2 tempCurrPosition64[2];\n vec2_mix_fp64(instanceStartPositions64, instanceEndPositions64, isEnd, tempCurrPosition64);\n\n vec4 currPosition64 = vec4(tempCurrPosition64[0].xy, tempCurrPosition64[1].xy);\n\n vec2 projected_curr_position[2];\n project_position_fp64(currPosition64, projected_curr_position);\n float projected_curr_position_z = project_scale(currPosition.z);\n\n // Calculate previous position\n\n vec3 prevPosition = mix(-instanceLeftDeltas, vec3(0.0), isEnd);\n\n // Calculate prev position 64bit\n\n vec2 tempPrevPosition64[2];\n tempPrevPosition64[0] = sum_fp64(vec2(prevPosition.x, 0.0), instanceStartPositions64[0]);\n tempPrevPosition64[1] = sum_fp64(vec2(prevPosition.y, 0.0), instanceStartPositions64[1]);\n\n vec4 prevPosition64 = vec4(tempPrevPosition64[0].xy, tempPrevPosition64[1].xy);\n\n vec2 projected_prev_position[2];\n project_position_fp64(prevPosition64, projected_prev_position);\n\n // Calculate next positions\n vec3 nextPosition = mix(vec3(0.0), instanceRightDeltas, isEnd);\n\n // Calculate next position 64bit\n\n vec2 tempNextPosition64[2];\n tempNextPosition64[0] = sum_fp64(vec2(nextPosition.x, 0.0), instanceEndPositions64[0]);\n tempNextPosition64[1] = sum_fp64(vec2(nextPosition.y, 0.0), instanceEndPositions64[1]);\n\n vec4 nextPosition64 = vec4(tempNextPosition64[0].xy, tempNextPosition64[1].xy);\n\n vec2 projected_next_position[2];\n project_position_fp64(nextPosition64, projected_next_position);\n\n vec3 pos = lineJoin(projected_prev_position, projected_curr_position, projected_next_position);\n vec2 vertex_pos_modelspace[4];\n\n vertex_pos_modelspace[0] = sum_fp64(vec2(pos.x, 0.0), projected_curr_position[0]);\n vertex_pos_modelspace[1] = sum_fp64(vec2(pos.y, 0.0), projected_curr_position[1]);\n vertex_pos_modelspace[2] = vec2(pos.z + projected_curr_position_z, 0.0);\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n}\n"; /***/ }), /* 316 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME path-layer-vertex-shader-64\n\nattribute vec3 positions;\n\nattribute vec3 instanceStartPositions;\nattribute vec3 instanceEndPositions;\nattribute vec3 instanceLeftDeltas;\nattribute vec3 instanceRightDeltas;\nattribute float instanceStrokeWidths;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\nattribute vec2 instanceDashArrays;\n\nuniform float widthScale;\nuniform float widthMinPixels;\nuniform float widthMaxPixels;\nuniform float jointType;\nuniform float miterLimit;\n\nuniform float opacity;\n\nvarying vec4 vColor;\nvarying vec2 vCornerOffset;\nvarying float vMiterLength;\nvarying vec2 vDashArray;\nvarying float vPathPosition;\nvarying float vPathLength;\n\nconst float EPSILON = 0.001;\nconst float PIXEL_EPSILON = 0.1;\n\nfloat flipIfTrue(bool flag) {\n return -(float(flag) * 2. - 1.);\n}\n\n// calculate line join positions\nvec3 lineJoin(\n vec3 prevPoint, vec3 currPoint, vec3 nextPoint,\n float relativePosition, bool isEnd, bool isJoint,\n float width\n) {\n vec2 deltaA = currPoint.xy - prevPoint.xy;\n vec2 deltaB = nextPoint.xy - currPoint.xy;\n\n float lenA = length(deltaA);\n float lenB = length(deltaB);\n\n // when two points are closer than PIXEL_EPSILON in pixels,\n // assume they are the same point to avoid precision issue\n lenA = lenA > PIXEL_EPSILON ? lenA : 0.0;\n lenB = lenB > PIXEL_EPSILON ? lenB : 0.0;\n\n vec2 dirA = lenA > 0. ? normalize(deltaA) : vec2(0.0, 0.0);\n vec2 dirB = lenB > 0. ? normalize(deltaB) : vec2(0.0, 0.0);\n\n vec2 perpA = vec2(-dirA.y, dirA.x);\n vec2 perpB = vec2(-dirB.y, dirB.x);\n\n // tangent of the corner\n vec2 tangent = vec2(dirA + dirB);\n tangent = length(tangent) > 0. ? normalize(tangent) : perpA;\n // direction of the corner\n vec2 miterVec = vec2(-tangent.y, tangent.x);\n // width offset from current position\n vec2 perp = isEnd ? perpA : perpB;\n float L = isEnd ? lenA : lenB;\n\n // cap super sharp angles\n float sinHalfA = abs(dot(miterVec, perp));\n float cosHalfA = abs(dot(dirA, miterVec));\n\n bool turnsRight = dirA.x * dirB.y > dirA.y * dirB.x;\n\n float offsetScale = 1.0 / max(sinHalfA, EPSILON);\n\n float cornerPosition = isJoint ?\n 0.0 :\n flipIfTrue(turnsRight == (relativePosition > 0.0));\n\n // do not bevel if line segment is too short\n cornerPosition *=\n float(cornerPosition <= 0.0 || sinHalfA < min(lenA, lenB) / width * cosHalfA);\n\n // trim if inside corner extends further than the line segment\n if (cornerPosition < 0.0) {\n offsetScale = min(offsetScale, L / width / max(cosHalfA, EPSILON));\n }\n\n vMiterLength = cornerPosition >= 0.0 ?\n mix(offsetScale, 0.0, cornerPosition) :\n offsetScale * cornerPosition;\n vMiterLength -= sinHalfA * jointType;\n\n float offsetDirection = mix(\n positions.y,\n mix(\n flipIfTrue(turnsRight),\n positions.y * flipIfTrue(turnsRight == (positions.x == 1.)),\n cornerPosition\n ),\n step(0.0, cornerPosition)\n );\n\n vec2 offsetVec = mix(miterVec, -tangent, step(0.5, cornerPosition));\n offsetScale = mix(offsetScale, 1.0 / max(cosHalfA, 0.001), step(0.5, cornerPosition));\n\n // special treatment for start cap and end cap\n // TODO - This has an issue. len is always positive because it is length.\n // Step returns zero if -lenA<0, so practically this is a comparison of\n // lenA with zero, with lots of problems because of the -lenA. Can we use EPSILON?\n bool isStartCap = step(0.0, -lenA) > 0.5;\n bool isEndCap = step(0.0, -lenB) > 0.5;\n bool isCap = isStartCap || isEndCap;\n\n // 0: center, 1: side\n cornerPosition = isCap ? (1.0 - positions.z) : 0.;\n\n // start of path: use next - curr\n if (isStartCap) {\n offsetVec = mix(dirB, perpB, cornerPosition);\n }\n\n // end of path: use curr - prev\n if (isEndCap) {\n offsetVec = mix(dirA, perpA, cornerPosition);\n }\n\n // extend out a triangle to envelope the round cap\n if (isCap) {\n offsetScale = mix(4.0 * jointType, 1.0, cornerPosition);\n vMiterLength = 1.0 - cornerPosition;\n offsetDirection = mix(flipIfTrue(isStartCap), positions.y, cornerPosition);\n }\n\n vCornerOffset = offsetVec * offsetDirection * offsetScale;\n\n // Generate variables for dash calculation\n vDashArray = instanceDashArrays;\n vPathLength = L / width;\n // vec2 offsetFromStartOfPath = isEnd ? vCornerOffset + deltaA / width : vCornerOffset;\n vec2 offsetFromStartOfPath = vCornerOffset;\n if (isEnd) {\n offsetFromStartOfPath += deltaA / width;\n }\n vec2 dir = isEnd ? dirA : dirB;\n vPathPosition = dot(offsetFromStartOfPath, dir);\n\n return currPoint + vec3(vCornerOffset * width, 0.0);\n}\n\n// calculate line join positions\n// extract params from attributes and uniforms\nvec3 lineJoin(vec3 prevPoint, vec3 currPoint, vec3 nextPoint) {\n\n // relative position to the corner:\n // -1: inside (smaller side of the angle)\n // 0: center\n // 1: outside (bigger side of the angle)\n\n float relativePosition = positions.y;\n bool isEnd = positions.x > EPSILON;\n bool isJoint = positions.z > EPSILON;\n\n float width = clamp(project_scale(instanceStrokeWidths * widthScale),\n widthMinPixels, widthMaxPixels) / 2.0;\n\n return lineJoin(\n prevPoint, currPoint, nextPoint,\n relativePosition, isEnd, isJoint,\n width\n );\n}\n\nvoid main() {\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n\n float isEnd = positions.x;\n\n vec3 prevPosition = mix(-instanceLeftDeltas, vec3(0.0), isEnd) + instanceStartPositions;\n prevPosition = project_position(prevPosition);\n\n vec3 currPosition = mix(instanceStartPositions, instanceEndPositions, isEnd);\n currPosition = project_position(currPosition);\n\n vec3 nextPosition = mix(vec3(0.0), instanceRightDeltas, isEnd) + instanceEndPositions;\n nextPosition = project_position(nextPosition);\n\n vec3 pos = lineJoin(prevPosition, currPosition, nextPosition);\n\n gl_Position = project_to_clipspace(vec4(pos, 1.0));\n}\n"; /***/ }), /* 317 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME point-cloud-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n\n float distToCenter = length(unitPosition);\n\n if (distToCenter > 1.0) {\n discard;\n }\n\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 318 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME point-cloud-layer-vertex-shader-64\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute vec3 instanceNormals;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusPixels;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n // position on the containing square in [-1, 1] space\n unitPosition = positions.xy;\n\n vec4 instancePositions64xy = vec4(\n instancePositions.x, instancePositions64xyLow.x,\n instancePositions.y, instancePositions64xyLow.y);\n\n vec2 projected_coord_xy[2];\n project_position_fp64(instancePositions64xy, projected_coord_xy);\n\n vec2 vertex_pos_modelspace[4];\n vertex_pos_modelspace[0] = projected_coord_xy[0];\n vertex_pos_modelspace[1] = projected_coord_xy[1];\n vertex_pos_modelspace[2] = vec2(project_scale(instancePositions.z), 0.0);\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n gl_Position += project_pixel_to_clipspace(positions.xy * radiusPixels);\n\n vec4 position_worldspace = vec4(\n projected_coord_xy[0].x, projected_coord_xy[1].x,\n project_scale(instancePositions.z), 1.0);\n\n // Apply lighting\n float lightWeight = getLightWeight(position_worldspace.xyz, // the w component is always 1.0\n instanceNormals);\n\n // Apply opacity to instance color, or return instance picking color\n vColor = vec4(lightWeight * instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 319 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME point-cloud-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec3 instanceNormals;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusPixels;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\n\nvoid main(void) {\n // position on the containing square in [-1, 1] space\n unitPosition = positions.xy;\n\n // Find the center of the point and add the current vertex\n vec4 position_worldspace = vec4(project_position(instancePositions), 1.0);\n gl_Position = project_to_clipspace(position_worldspace) ;\n gl_Position += project_pixel_to_clipspace(positions.xy * radiusPixels);\n\n // Apply lighting\n float lightWeight = getLightWeight(position_worldspace.xyz, // the w component is always 1.0\n instanceNormals);\n\n // Apply opacity to instance color, or return instance picking color\n vColor = vec4(lightWeight * instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 320 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _pointCloudLayerVertex = __webpack_require__(319); var _pointCloudLayerVertex2 = _interopRequireDefault(_pointCloudLayerVertex); var _pointCloudLayerVertex3 = __webpack_require__(318); var _pointCloudLayerVertex4 = _interopRequireDefault(_pointCloudLayerVertex3); var _pointCloudLayerFragment = __webpack_require__(317); var _pointCloudLayerFragment2 = _interopRequireDefault(_pointCloudLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var fp64LowPart = _core.experimental.fp64LowPart, enable64bitSupport = _core.experimental.enable64bitSupport; var DEFAULT_COLOR = [0, 0, 0, 255]; var defaultProps = { radiusPixels: 10, // point radius in pixels fp64: false, getPosition: function getPosition(x) { return x.position; }, getNormal: function getNormal(x) { return x.normal; }, getColor: function getColor(x) { return x.color || DEFAULT_COLOR; }, lightSettings: { lightsPosition: [0, 0, 5000, -1000, 1000, 8000, 5000, -5000, 1000], ambientRatio: 0.2, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [1.0, 0.0, 0.8, 0.0, 0.4, 0.0], numberOfLights: 3 } }; var PointCloudLayer = function (_Layer) { _inherits(PointCloudLayer, _Layer); function PointCloudLayer() { _classCallCheck(this, PointCloudLayer); return _possibleConstructorReturn(this, (PointCloudLayer.__proto__ || Object.getPrototypeOf(PointCloudLayer)).apply(this, arguments)); } _createClass(PointCloudLayer, [{ key: 'getShaders', value: function getShaders(id) { var shaderCache = this.context.shaderCache; return enable64bitSupport(this.props) ? { vs: _pointCloudLayerVertex4.default, fs: _pointCloudLayerFragment2.default, modules: ['project64', 'lighting', 'picking'], shaderCache: shaderCache } : { vs: _pointCloudLayerVertex2.default, fs: _pointCloudLayerFragment2.default, modules: ['lighting', 'picking'], shaderCache: shaderCache }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { /* eslint-disable max-len */ this.state.attributeManager.addInstanced({ instancePositions: { size: 3, transition: true, accessor: 'getPosition', update: this.calculateInstancePositions }, instanceNormals: { size: 3, transition: true, accessor: 'getNormal', defaultValue: 1, update: this.calculateInstanceNormals }, instanceColors: { size: 4, type: _luma.GL.UNSIGNED_BYTE, transition: true, accessor: 'getColor', update: this.calculateInstanceColors } }); /* eslint-enable max-len */ } }, { key: 'updateAttribute', value: function updateAttribute(_ref) { var props = _ref.props, oldProps = _ref.oldProps, changeFlags = _ref.changeFlags; if (props.fp64 !== oldProps.fp64) { var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); if (props.fp64 && props.coordinateSystem === _core.COORDINATE_SYSTEM.LNGLAT) { attributeManager.addInstanced({ instancePositions64xyLow: { size: 2, accessor: 'getPosition', update: this.calculateInstancePositions64xyLow } }); } else { attributeManager.remove(['instancePositions64xyLow']); } } } }, { key: 'updateState', value: function updateState(_ref2) { var props = _ref2.props, oldProps = _ref2.oldProps, changeFlags = _ref2.changeFlags; _get(PointCloudLayer.prototype.__proto__ || Object.getPrototypeOf(PointCloudLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); if (props.fp64 !== oldProps.fp64) { var gl = this.context.gl; this.setState({ model: this._getModel(gl) }); } this.updateAttribute({ props: props, oldProps: oldProps, changeFlags: changeFlags }); } }, { key: 'draw', value: function draw(_ref3) { var uniforms = _ref3.uniforms; var _props = this.props, radiusPixels = _props.radiusPixels, lightSettings = _props.lightSettings; this.state.model.render(Object.assign({}, uniforms, { radiusPixels: radiusPixels }, lightSettings)); } }, { key: '_getModel', value: function _getModel(gl) { // a triangle that minimally cover the unit circle var positions = []; for (var i = 0; i < 3; i++) { var angle = i / 3 * Math.PI * 2; positions.push(Math.cos(angle) * 2, Math.sin(angle) * 2, 0); } return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: new _luma.Geometry({ drawMode: _luma.GL.TRIANGLES, attributes: { positions: new Float32Array(positions) } }), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'calculateInstancePositions', value: function calculateInstancePositions(attribute) { var _props2 = this.props, data = _props2.data, getPosition = _props2.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var point = _step.value; var position = getPosition(point); value[i++] = position[0]; value[i++] = position[1]; value[i++] = position[2] || 0; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'calculateInstancePositions64xyLow', value: function calculateInstancePositions64xyLow(attribute) { var _props3 = this.props, data = _props3.data, getPosition = _props3.getPosition; var value = attribute.value; var i = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = data[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var point = _step2.value; var position = getPosition(point); value[i++] = fp64LowPart(position[0]); value[i++] = fp64LowPart(position[1]); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } } }, { key: 'calculateInstanceNormals', value: function calculateInstanceNormals(attribute) { var _props4 = this.props, data = _props4.data, getNormal = _props4.getNormal; var value = attribute.value; var i = 0; var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = data[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var point = _step3.value; var normal = getNormal(point); value[i++] = normal[0]; value[i++] = normal[1]; value[i++] = normal[2]; } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } } }, { key: 'calculateInstanceColors', value: function calculateInstanceColors(attribute) { var _props5 = this.props, data = _props5.data, getColor = _props5.getColor; var value = attribute.value; var i = 0; var _iteratorNormalCompletion4 = true; var _didIteratorError4 = false; var _iteratorError4 = undefined; try { for (var _iterator4 = data[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { var point = _step4.value; var color = getColor(point); value[i++] = color[0]; value[i++] = color[1]; value[i++] = color[2]; value[i++] = isNaN(color[3]) ? 255 : color[3]; } } catch (err) { _didIteratorError4 = true; _iteratorError4 = err; } finally { try { if (!_iteratorNormalCompletion4 && _iterator4.return) { _iterator4.return(); } } finally { if (_didIteratorError4) { throw _iteratorError4; } } } } }]); return PointCloudLayer; }(_core.Layer); exports.default = PointCloudLayer; PointCloudLayer.layerName = 'PointCloudLayer'; PointCloudLayer.defaultProps = defaultProps; /***/ }), /* 321 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _core = __webpack_require__(13); var _solidPolygonLayer = __webpack_require__(177); var _solidPolygonLayer2 = _interopRequireDefault(_solidPolygonLayer); var _pathLayer = __webpack_require__(119); var _pathLayer2 = _interopRequireDefault(_pathLayer); var _polygon = __webpack_require__(120); var Polygon = _interopRequireWildcard(_polygon); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var get = _core.experimental.get; var defaultLineColor = [0x0, 0x0, 0x0, 0xff]; var defaultFillColor = [0x0, 0x0, 0x0, 0xff]; var defaultProps = { stroked: true, filled: true, extruded: false, elevationScale: 1, wireframe: false, lineWidthScale: 1, lineWidthMinPixels: 0, lineWidthMaxPixels: Number.MAX_SAFE_INTEGER, lineJointRounded: false, lineMiterLimit: 4, lineDashJustified: false, fp64: false, getPolygon: function getPolygon(f) { return get(f, 'polygon'); }, // Polygon fill color getFillColor: function getFillColor(f) { return get(f, 'fillColor') || defaultFillColor; }, // Point, line and polygon outline color getLineColor: function getLineColor(f) { return get(f, 'lineColor') || defaultLineColor; }, // Line and polygon outline accessors getLineWidth: function getLineWidth(f) { return get(f, 'lineWidth') || 1; }, // Line dash array accessor getLineDashArray: null, // Polygon extrusion accessor getElevation: function getElevation(f) { return get(f, 'elevation') || 1000; }, // Optional settings for 'lighting' shader module lightSettings: { lightsPosition: [-122.45, 37.75, 8000, -122.0, 38.0, 5000], ambientRatio: 0.05, diffuseRatio: 0.6, specularRatio: 0.8, lightsStrength: [2.0, 0.0, 0.0, 0.0], numberOfLights: 2 } }; var PolygonLayer = function (_CompositeLayer) { _inherits(PolygonLayer, _CompositeLayer); function PolygonLayer() { _classCallCheck(this, PolygonLayer); return _possibleConstructorReturn(this, (PolygonLayer.__proto__ || Object.getPrototypeOf(PolygonLayer)).apply(this, arguments)); } _createClass(PolygonLayer, [{ key: 'initializeState', value: function initializeState() { this.state = { paths: [] }; } }, { key: 'updateState', value: function updateState(_ref) { var _this2 = this; var oldProps = _ref.oldProps, props = _ref.props, changeFlags = _ref.changeFlags; var geometryChanged = changeFlags.dataChanged || changeFlags.updateTriggersChanged && (changeFlags.updateTriggersChanged.all || changeFlags.updateTriggersChanged.getPolygon); if (geometryChanged) { var _props = this.props, data = _props.data, getPolygon = _props.getPolygon; this.state.paths = []; data.forEach(function (object) { var complexPolygon = Polygon.normalize(getPolygon(object)); complexPolygon.forEach(function (polygon) { return _this2.state.paths.push({ path: polygon, object: object }); }); }); } } }, { key: 'getPickingInfo', value: function getPickingInfo(_ref2) { var info = _ref2.info; return Object.assign(info, { // override object with picked data object: info.object && info.object.object || info.object }); } /* eslint-disable complexity */ }, { key: 'renderLayers', value: function renderLayers() { // Layer composition props var _props2 = this.props, data = _props2.data, stroked = _props2.stroked, filled = _props2.filled, extruded = _props2.extruded, wireframe = _props2.wireframe, elevationScale = _props2.elevationScale; // Rendering props underlying layer var _props3 = this.props, lineWidthScale = _props3.lineWidthScale, lineWidthMinPixels = _props3.lineWidthMinPixels, lineWidthMaxPixels = _props3.lineWidthMaxPixels, lineJointRounded = _props3.lineJointRounded, lineMiterLimit = _props3.lineMiterLimit, lineDashJustified = _props3.lineDashJustified, fp64 = _props3.fp64; // Accessor props for underlying layers var _props4 = this.props, getFillColor = _props4.getFillColor, getLineColor = _props4.getLineColor, getLineWidth = _props4.getLineWidth, getLineDashArray = _props4.getLineDashArray, getElevation = _props4.getElevation, getPolygon = _props4.getPolygon, updateTriggers = _props4.updateTriggers, lightSettings = _props4.lightSettings; var paths = this.state.paths; var hasData = data && data.length > 0; // Filled Polygon Layer var polygonLayer = filled && hasData && new _solidPolygonLayer2.default(this.getSubLayerProps({ id: 'fill', updateTriggers: { getElevation: updateTriggers.getElevation, getColor: updateTriggers.getFillColor } }), { data: data, extruded: extruded, elevationScale: elevationScale, fp64: fp64, wireframe: false, getPolygon: getPolygon, getElevation: getElevation, getColor: getFillColor, lightSettings: lightSettings }); var polygonWireframeLayer = extruded && wireframe && hasData && new _solidPolygonLayer2.default(this.getSubLayerProps({ id: 'wireframe', updateTriggers: { getElevation: updateTriggers.getElevation, getColor: updateTriggers.getLineColor } }), { data: data, fp64: fp64, extruded: true, elevationScale: elevationScale, wireframe: true, getPolygon: getPolygon, getElevation: getElevation, getColor: getLineColor }); // Polygon line layer var polygonLineLayer = !extruded && stroked && hasData && new _pathLayer2.default(this.getSubLayerProps({ id: 'stroke', updateTriggers: { getWidth: updateTriggers.getLineWidth, getColor: updateTriggers.getLineColor, getDashArray: updateTriggers.getLineDashArray } }), { data: paths, fp64: fp64, widthScale: lineWidthScale, widthMinPixels: lineWidthMinPixels, widthMaxPixels: lineWidthMaxPixels, rounded: lineJointRounded, miterLimit: lineMiterLimit, dashJustified: lineDashJustified, getPath: function getPath(x) { return x.path; }, getColor: function getColor(x) { return getLineColor(x.object); }, getWidth: function getWidth(x) { return getLineWidth(x.object); }, getDashArray: getLineDashArray && function (x) { return getLineDashArray(x.object); } }); return [ // If not extruded: flat fill layer is drawn below outlines !extruded && polygonLayer, polygonWireframeLayer, polygonLineLayer, // If extruded: draw fill layer last for correct blending behavior extruded && polygonLayer]; } /* eslint-enable complexity */ }]); return PolygonLayer; }(_core.CompositeLayer); exports.default = PolygonLayer; PolygonLayer.layerName = 'PolygonLayer'; PolygonLayer.defaultProps = defaultProps; /***/ }), /* 322 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME scatterplot-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\n\nvoid main(void) {\n\n float distToCenter = length(unitPosition);\n\n if (distToCenter > 1.0 || distToCenter < innerUnitRadius) {\n discard;\n }\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 323 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME scatterplot-layer-vertex-shader-64\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute vec2 instancePositions64xyLow;\nattribute float instanceRadius;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\n// Only one-dimensional arrays may be declared in GLSL ES 1.0. specs p.24\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float outline;\nuniform float strokeWidth;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\n\nvoid main(void) {\n // Multiply out radius and clamp to limits\n float outerRadiusPixels = clamp(\n project_scale(radiusScale * instanceRadius),\n radiusMinPixels, radiusMaxPixels\n );\n\n // outline is centered at the radius\n // outer radius needs to offset by half stroke width\n outerRadiusPixels += outline * strokeWidth / 2.0;\n\n // position on the containing square in [-1, 1] space\n unitPosition = positions.xy;\n // 0 - solid circle, 1 - stroke with lineWidth=0\n innerUnitRadius = outline * (1.0 - strokeWidth / outerRadiusPixels);\n\n vec4 instancePositions64xy = vec4(\n instancePositions.x, instancePositions64xyLow.x,\n instancePositions.y, instancePositions64xyLow.y);\n\n vec2 projected_coord_xy[2];\n project_position_fp64(instancePositions64xy, projected_coord_xy);\n\n vec2 vertex_pos_localspace[4];\n vec4_fp64(vec4(positions * outerRadiusPixels, 0.0), vertex_pos_localspace);\n\n vec2 vertex_pos_modelspace[4];\n vertex_pos_modelspace[0] = sum_fp64(vertex_pos_localspace[0], projected_coord_xy[0]);\n vertex_pos_modelspace[1] = sum_fp64(vertex_pos_localspace[1], projected_coord_xy[1]);\n vertex_pos_modelspace[2] = sum_fp64(vertex_pos_localspace[2],\n vec2(project_scale(instancePositions.z), 0.0));\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 324 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME scatterplot-layer-vertex-shader\n\nattribute vec3 positions;\n\nattribute vec3 instancePositions;\nattribute float instanceRadius;\nattribute vec4 instanceColors;\nattribute vec3 instancePickingColors;\n\nuniform float opacity;\nuniform float radiusScale;\nuniform float radiusMinPixels;\nuniform float radiusMaxPixels;\nuniform float outline;\nuniform float strokeWidth;\n\nvarying vec4 vColor;\nvarying vec2 unitPosition;\nvarying float innerUnitRadius;\n\nvoid main(void) {\n // Multiply out radius and clamp to limits\n float outerRadiusPixels = clamp(\n project_scale(radiusScale * instanceRadius),\n radiusMinPixels, radiusMaxPixels\n );\n // outline is centered at the radius\n // outer radius needs to offset by half stroke width\n outerRadiusPixels += outline * strokeWidth / 2.0;\n\n // position on the containing square in [-1, 1] space\n unitPosition = positions.xy;\n // 0 - solid circle, 1 - stroke with lineWidth=0\n innerUnitRadius = outline * (1.0 - strokeWidth / outerRadiusPixels);\n\n // Find the center of the point and add the current vertex\n vec3 center = project_position(instancePositions);\n vec3 vertex = positions * outerRadiusPixels;\n gl_Position = project_to_clipspace(vec4(center + vertex, 1.0));\n\n // Apply opacity to instance color, or return instance picking color\n vColor = vec4(instanceColors.rgb, instanceColors.a * opacity) / 255.;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n}\n"; /***/ }), /* 325 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* fragment shader for the grid-layer */ exports.default = "#define SHADER_NAME screen-grid-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 326 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME screen-grid-layer-vertex-shader\n\nattribute vec3 vertices;\nattribute vec3 instancePositions;\nattribute float instanceCount;\nattribute vec3 instancePickingColors;\n\nuniform float maxCount;\nuniform float opacity;\nuniform vec4 minColor;\nuniform vec4 maxColor;\nuniform vec3 cellScale;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n vec4 color = mix(minColor, maxColor, instanceCount / maxCount) / 255.;\n\n vColor = vec4(color.rgb, color.a * opacity);\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(instancePickingColors);\n\n gl_Position = vec4(instancePositions + vertices * cellScale, 1.);\n}\n"; /***/ }), /* 327 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } }; var _core = __webpack_require__(13); var _luma = __webpack_require__(12); var _screenGridLayerVertex = __webpack_require__(326); var _screenGridLayerVertex2 = _interopRequireDefault(_screenGridLayerVertex); var _screenGridLayerFragment = __webpack_require__(325); var _screenGridLayerFragment2 = _interopRequireDefault(_screenGridLayerFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var defaultProps = { cellSizePixels: 100, // Color range? minColor: [0, 0, 0, 255], maxColor: [0, 255, 0, 255], getPosition: function getPosition(d) { return d.position; }, getWeight: function getWeight(d) { return 1; } }; var ScreenGridLayer = function (_Layer) { _inherits(ScreenGridLayer, _Layer); function ScreenGridLayer() { _classCallCheck(this, ScreenGridLayer); return _possibleConstructorReturn(this, (ScreenGridLayer.__proto__ || Object.getPrototypeOf(ScreenGridLayer)).apply(this, arguments)); } _createClass(ScreenGridLayer, [{ key: 'getShaders', value: function getShaders() { return { vs: _screenGridLayerVertex2.default, fs: _screenGridLayerFragment2.default, modules: ['picking'] }; // 'project' module added by default. } }, { key: 'initializeState', value: function initializeState() { var attributeManager = this.getAttributeManager(); var gl = this.context.gl; /* eslint-disable max-len */ attributeManager.addInstanced({ instancePositions: { size: 3, update: this.calculateInstancePositions }, instanceCount: { size: 1, accessor: ['getPosition', 'getWeight'], update: this.calculateInstanceCount } }); /* eslint-disable max-len */ this.setState({ model: this._getModel(gl) }); } }, { key: 'shouldUpdateState', value: function shouldUpdateState(_ref) { var changeFlags = _ref.changeFlags; return changeFlags.somethingChanged; } }, { key: 'updateState', value: function updateState(_ref2) { var oldProps = _ref2.oldProps, props = _ref2.props, changeFlags = _ref2.changeFlags; _get(ScreenGridLayer.prototype.__proto__ || Object.getPrototypeOf(ScreenGridLayer.prototype), 'updateState', this).call(this, { props: props, oldProps: oldProps, changeFlags: changeFlags }); var cellSizeChanged = props.cellSizePixels !== oldProps.cellSizePixels; if (cellSizeChanged || changeFlags.viewportChanged) { this.updateCell(); } } }, { key: 'draw', value: function draw(_ref3) { var uniforms = _ref3.uniforms; var _props = this.props, minColor = _props.minColor, maxColor = _props.maxColor, _props$parameters = _props.parameters, parameters = _props$parameters === undefined ? {} : _props$parameters; var _state = this.state, model = _state.model, cellScale = _state.cellScale, maxCount = _state.maxCount; uniforms = Object.assign({}, uniforms, { minColor: minColor, maxColor: maxColor, cellScale: cellScale, maxCount: maxCount }); model.draw({ uniforms: uniforms, parameters: Object.assign({ depthTest: false, depthMask: false }, parameters) }); } }, { key: '_getModel', value: function _getModel(gl) { return new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: this.props.id, geometry: new _luma.Geometry({ drawMode: _luma.GL.TRIANGLE_FAN, attributes: { vertices: new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0]) } }), isInstanced: true, shaderCache: this.context.shaderCache })); } }, { key: 'updateCell', value: function updateCell() { var _context$viewport = this.context.viewport, width = _context$viewport.width, height = _context$viewport.height; var cellSizePixels = this.props.cellSizePixels; var MARGIN = 2; var cellScale = new Float32Array([(cellSizePixels - MARGIN) / width * 2, -(cellSizePixels - MARGIN) / height * 2, 1]); var numCol = Math.ceil(width / cellSizePixels); var numRow = Math.ceil(height / cellSizePixels); this.setState({ cellScale: cellScale, numCol: numCol, numRow: numRow, numInstances: numCol * numRow }); var attributeManager = this.getAttributeManager(); attributeManager.invalidateAll(); } }, { key: 'calculateInstancePositions', value: function calculateInstancePositions(attribute, _ref4) { var numInstances = _ref4.numInstances; var _context$viewport2 = this.context.viewport, width = _context$viewport2.width, height = _context$viewport2.height; var cellSizePixels = this.props.cellSizePixels; var numCol = this.state.numCol; var value = attribute.value, size = attribute.size; for (var i = 0; i < numInstances; i++) { var x = i % numCol; var y = Math.floor(i / numCol); value[i * size + 0] = x * cellSizePixels / width * 2 - 1; value[i * size + 1] = 1 - y * cellSizePixels / height * 2; value[i * size + 2] = 0; } } }, { key: 'calculateInstanceCount', value: function calculateInstanceCount(attribute) { var _props2 = this.props, data = _props2.data, cellSizePixels = _props2.cellSizePixels, getPosition = _props2.getPosition, getWeight = _props2.getWeight; var _state2 = this.state, numCol = _state2.numCol, numRow = _state2.numRow; var value = attribute.value; var maxCount = 0; value.fill(0.0); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = data[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var point = _step.value; var pixel = this.project(getPosition(point)); var colId = Math.floor(pixel[0] / cellSizePixels); var rowId = Math.floor(pixel[1] / cellSizePixels); if (colId >= 0 && colId < numCol && rowId >= 0 && rowId < numRow) { var i = colId + rowId * numCol; value[i] += getWeight(point); if (value[i] > maxCount) { maxCount = value[i]; } } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } this.setState({ maxCount: maxCount }); } }]); return ScreenGridLayer; }(_core.Layer); exports.default = ScreenGridLayer; ScreenGridLayer.layerName = 'ScreenGridLayer'; ScreenGridLayer.defaultProps = defaultProps; /***/ }), /* 328 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PolygonTesselatorExtruded = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var _polygon = __webpack_require__(120); var Polygon = _interopRequireWildcard(_polygon); var _core = __webpack_require__(13); var _earcut = __webpack_require__(232); var _earcut2 = _interopRequireDefault(_earcut); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var fp64LowPart = _core.experimental.fp64LowPart, fillArray = _core.experimental.fillArray; function getPickingColor(index) { return [index + 1 & 255, index + 1 >> 8 & 255, index + 1 >> 8 >> 8 & 255]; } function arrayPush(array, values) { var length = values.length; var offset = array.length; for (var index = 0; index < length; index++) { array[offset++] = values[index]; } return array; } function flatten(values, level) { var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; if (level > 1) { values.forEach(function (v) { return flatten(v, level - 1, result); }); } else { arrayPush(result, values); } return result; } var DEFAULT_COLOR = [0, 0, 0, 255]; // Black var PolygonTesselatorExtruded = exports.PolygonTesselatorExtruded = function () { function PolygonTesselatorExtruded(_ref) { var polygons = _ref.polygons, _ref$getHeight = _ref.getHeight, getHeight = _ref$getHeight === undefined ? function (x) { return 1000; } : _ref$getHeight, _ref$getColor = _ref.getColor, getColor = _ref$getColor === undefined ? function (x) { return DEFAULT_COLOR; } : _ref$getColor, _ref$wireframe = _ref.wireframe, wireframe = _ref$wireframe === undefined ? false : _ref$wireframe, _ref$fp = _ref.fp64, fp64 = _ref$fp === undefined ? false : _ref$fp; _classCallCheck(this, PolygonTesselatorExtruded); this.fp64 = fp64; // Expensive operation, convert all polygons to arrays polygons = polygons.map(function (complexPolygon, polygonIndex) { var height = getHeight(polygonIndex) || 0; return Polygon.normalize(complexPolygon).map(function (polygon) { return polygon.map(function (coord) { return [coord[0], coord[1], height]; }); }); }); var groupedVertices = polygons; this.groupedVertices = polygons; var pointCount = getPointCount(polygons); this.pointCount = pointCount; this.wireframe = wireframe; this.attributes = {}; var positionsJS = calculatePositionsJS({ groupedVertices: groupedVertices, pointCount: pointCount, wireframe: wireframe }); Object.assign(this.attributes, { positions: calculatePositions(positionsJS, this.fp64), indices: calculateIndices({ groupedVertices: groupedVertices, wireframe: wireframe }), normals: calculateNormals({ groupedVertices: groupedVertices, pointCount: pointCount, wireframe: wireframe }), // colors: calculateColors({groupedVertices, wireframe, getColor}), pickingColors: calculatePickingColors({ groupedVertices: groupedVertices, pointCount: pointCount, wireframe: wireframe }) }); } _createClass(PolygonTesselatorExtruded, [{ key: 'indices', value: function indices() { return this.attributes.indices; } }, { key: 'positions', value: function positions() { return this.attributes.positions; } }, { key: 'normals', value: function normals() { return this.attributes.normals; } }, { key: 'colors', value: function colors() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$getColor = _ref2.getColor, getColor = _ref2$getColor === undefined ? function (x) { return DEFAULT_COLOR; } : _ref2$getColor; var groupedVertices = this.groupedVertices, pointCount = this.pointCount, wireframe = this.wireframe; return calculateColors({ groupedVertices: groupedVertices, pointCount: pointCount, wireframe: wireframe, getColor: getColor }); } }, { key: 'pickingColors', value: function pickingColors() { return this.attributes.pickingColors; } // updateTriggers: { // positions: ['getHeight'], // colors: ['getColors'] // pickingColors: 'none' // } }]); return PolygonTesselatorExtruded; }(); // Count number of points in a list of complex polygons function getPointCount(polygons) { return polygons.reduce(function (points, polygon) { return points + Polygon.getVertexCount(polygon); }, 0); } function calculateIndices(_ref3) { var groupedVertices = _ref3.groupedVertices, _ref3$wireframe = _ref3.wireframe, wireframe = _ref3$wireframe === undefined ? false : _ref3$wireframe; // adjust index offset for multiple polygons var multiplier = wireframe ? 2 : 5; var offsets = []; groupedVertices.reduce(function (vertexIndex, vertices) { offsets.push(vertexIndex); return vertexIndex + Polygon.getVertexCount(vertices) * multiplier; }, 0); var indices = groupedVertices.map(function (vertices, polygonIndex) { return wireframe ? // 1. get sequentially ordered indices of each polygons wireframe // 2. offset them by the number of indices in previous polygons calculateContourIndices(vertices, offsets[polygonIndex]) : // 1. get triangulated indices for the internal areas // 2. offset them by the number of indices in previous polygons calculateSurfaceIndices(vertices, offsets[polygonIndex]); }); return new Uint32Array(flatten(indices, 2)); } // Calculate a flat position array in JS - can be mapped to 32 or 64 bit typed arrays // Remarks: // * each top vertex is on 3 surfaces // * each bottom vertex is on 2 surfaces function calculatePositionsJS(_ref4) { var groupedVertices = _ref4.groupedVertices, pointCount = _ref4.pointCount, _ref4$wireframe = _ref4.wireframe, wireframe = _ref4$wireframe === undefined ? false : _ref4$wireframe; var multiplier = wireframe ? 2 : 5; var positions = new Float32Array(pointCount * 3 * multiplier); var vertexIndex = 0; groupedVertices.forEach(function (vertices) { var topVertices = flatten(vertices, 3); var baseVertices = topVertices.slice(0); var i = topVertices.length - 1; while (i > 0) { baseVertices[i] = 0; i -= 3; } var len = topVertices.length; if (wireframe) { fillArray({ target: positions, source: topVertices, start: vertexIndex }); fillArray({ target: positions, source: baseVertices, start: vertexIndex + len }); } else { fillArray({ target: positions, source: topVertices, start: vertexIndex, count: 3 }); fillArray({ target: positions, source: baseVertices, start: vertexIndex + len * 3, count: 2 }); } vertexIndex += len * multiplier; }); return positions; } function calculatePositions(positionsJS, fp64) { var positionLow = void 0; if (fp64) { // We only need x, y component var vertexCount = positionsJS.length / 3; positionLow = new Float32Array(vertexCount * 2); for (var i = 0; i < vertexCount; i++) { positionLow[i * 2 + 0] = fp64LowPart(positionsJS[i * 3 + 0]); positionLow[i * 2 + 1] = fp64LowPart(positionsJS[i * 3 + 1]); } } return { positions: positionsJS, positions64xyLow: positionLow }; } function calculateNormals(_ref5) { var groupedVertices = _ref5.groupedVertices, pointCount = _ref5.pointCount, wireframe = _ref5.wireframe; var up = [0, 0, 1]; var multiplier = wireframe ? 2 : 5; var normals = new Float32Array(pointCount * 3 * multiplier); var vertexIndex = 0; if (wireframe) { return fillArray({ target: normals, source: up, count: pointCount * multiplier }); } groupedVertices.map(function (vertices, polygonIndex) { var vertexCount = Polygon.getVertexCount(vertices); fillArray({ target: normals, source: up, start: vertexIndex, count: vertexCount }); vertexIndex += vertexCount * 3; var sideNormalsForward = []; var sideNormalsBackward = []; vertices.forEach(function (polygon) { var sideNormals = calculateSideNormals(polygon); var firstNormal = sideNormals.slice(0, 3); arrayPush(sideNormalsForward, sideNormals); arrayPush(sideNormalsForward, firstNormal); arrayPush(sideNormalsBackward, firstNormal); arrayPush(sideNormalsBackward, sideNormals); }); fillArray({ target: normals, start: vertexIndex, count: 2, source: sideNormalsForward.concat(sideNormalsBackward) }); vertexIndex += vertexCount * 3 * 4; }); return normals; } function calculateSideNormals(vertices) { var normals = []; var lastVertice = null; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = vertices[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var vertice = _step.value; if (lastVertice) { // vertex[i-1], vertex[i] var n = getNormal(lastVertice, vertice); arrayPush(normals, n); } lastVertice = vertice; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return normals; } function calculateColors(_ref6) { var groupedVertices = _ref6.groupedVertices, pointCount = _ref6.pointCount, getColor = _ref6.getColor, _ref6$wireframe = _ref6.wireframe, wireframe = _ref6$wireframe === undefined ? false : _ref6$wireframe; var multiplier = wireframe ? 2 : 5; var colors = new Uint8ClampedArray(pointCount * 4 * multiplier); var vertexIndex = 0; groupedVertices.forEach(function (complexPolygon, polygonIndex) { var color = getColor(polygonIndex); color[3] = Number.isFinite(color[3]) ? color[3] : 255; var numVertices = Polygon.getVertexCount(complexPolygon); fillArray({ target: colors, source: color, start: vertexIndex, count: numVertices * multiplier }); vertexIndex += color.length * numVertices * multiplier; }); return colors; } function calculatePickingColors(_ref7) { var groupedVertices = _ref7.groupedVertices, pointCount = _ref7.pointCount, _ref7$wireframe = _ref7.wireframe, wireframe = _ref7$wireframe === undefined ? false : _ref7$wireframe; var multiplier = wireframe ? 2 : 5; var colors = new Uint8ClampedArray(pointCount * 3 * multiplier); var vertexIndex = 0; groupedVertices.forEach(function (vertices, polygonIndex) { var numVertices = Polygon.getVertexCount(vertices); var color = getPickingColor(polygonIndex); fillArray({ target: colors, source: color, start: vertexIndex, count: numVertices * multiplier }); vertexIndex += color.length * numVertices * multiplier; }); return colors; } function calculateContourIndices(vertices, offset) { var stride = Polygon.getVertexCount(vertices); var indices = []; vertices.forEach(function (polygon) { indices.push(offset); var numVertices = polygon.length; // polygon top // use vertex pairs for GL.LINES => [0, 1, 1, 2, 2, ..., n-1, n-1, 0] for (var i = 1; i < numVertices - 1; i++) { indices.push(i + offset, i + offset); } indices.push(offset); // polygon sides for (var _i = 0; _i < numVertices - 1; _i++) { indices.push(_i + offset, _i + stride + offset); } offset += numVertices; }); return indices; } function drawSurfaceRectangle(targetArray, offset, stride) { targetArray.push(offset + stride, offset + stride * 3, offset + stride * 2 + 1, offset + stride * 2 + 1, offset + stride * 3, offset + stride * 4 + 1); } function calculateSurfaceIndices(vertices, offset) { var stride = Polygon.getVertexCount(vertices); var holes = null; var holeCount = vertices.length - 1; if (holeCount) { holes = []; var vertexIndex = 0; for (var i = 0; i < holeCount; i++) { vertexIndex += vertices[i].length; holes[i] = vertexIndex; } } var indices = (0, _earcut2.default)(flatten(vertices, 3), holes, 3).map(function (index) { return index + offset; }); vertices.forEach(function (polygon) { var numVertices = polygon.length; // polygon sides for (var _i2 = 0; _i2 < numVertices - 1; _i2++) { drawSurfaceRectangle(indices, offset + _i2, stride); } offset += numVertices; }); return indices; } // helpers // get normal vector of line segment function getNormal(p1, p2) { return [p1[1] - p2[1], p2[0] - p1[0], 0]; } /***/ }), /* 329 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PolygonTesselator = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Handles tesselation of polygons with holes // - 2D surfaces // - 2D outlines // - 3D surfaces (top and sides only) // - 3D wireframes (not yet) var _polygon = __webpack_require__(120); var Polygon = _interopRequireWildcard(_polygon); var _earcut = __webpack_require__(232); var _earcut2 = _interopRequireDefault(_earcut); var _core = __webpack_require__(13); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var fp64LowPart = _core.experimental.fp64LowPart, flattenVertices = _core.experimental.flattenVertices, fillArray = _core.experimental.fillArray; // Maybe deck.gl or luma.gl needs to export this function getPickingColor(index) { return [(index + 1) % 256, Math.floor((index + 1) / 256) % 256, Math.floor((index + 1) / 256 / 256) % 256]; } var DEFAULT_COLOR = [0, 0, 0, 255]; // Black // This class is set up to allow querying one attribute at a time // the way the AttributeManager expects it var PolygonTesselator = exports.PolygonTesselator = function () { function PolygonTesselator(_ref) { var polygons = _ref.polygons, _ref$fp = _ref.fp64, fp64 = _ref$fp === undefined ? false : _ref$fp; _classCallCheck(this, PolygonTesselator); // Normalize all polygons this.polygons = polygons.map(function (polygon) { return Polygon.normalize(polygon); }); // Count all polygon vertices this.pointCount = getPointCount(this.polygons); this.fp64 = fp64; } _createClass(PolygonTesselator, [{ key: 'indices', value: function indices() { var polygons = this.polygons, indexCount = this.indexCount; return calculateIndices({ polygons: polygons, indexCount: indexCount }); } }, { key: 'positions', value: function positions() { var polygons = this.polygons, pointCount = this.pointCount; return calculatePositions({ polygons: polygons, pointCount: pointCount, fp64: this.fp64 }); } }, { key: 'normals', value: function normals() { var polygons = this.polygons, pointCount = this.pointCount; return calculateNormals({ polygons: polygons, pointCount: pointCount }); } }, { key: 'colors', value: function colors() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, _ref2$getColor = _ref2.getColor, getColor = _ref2$getColor === undefined ? function (x) { return DEFAULT_COLOR; } : _ref2$getColor; var polygons = this.polygons, pointCount = this.pointCount; return calculateColors({ polygons: polygons, pointCount: pointCount, getColor: getColor }); } }, { key: 'pickingColors', value: function pickingColors() { var polygons = this.polygons, pointCount = this.pointCount; return calculatePickingColors({ polygons: polygons, pointCount: pointCount }); } // getAttribute({size, accessor}) { // const {polygons, pointCount} = this; // return calculateAttribute({polygons, pointCount, size, accessor}); // } }]); return PolygonTesselator; }(); // Count number of points in a list of complex polygons function getPointCount(polygons) { return polygons.reduce(function (points, polygon) { return points + Polygon.getVertexCount(polygon); }, 0); } // COunt number of triangles in a list of complex polygons function getTriangleCount(polygons) { return polygons.reduce(function (triangles, polygon) { return triangles + Polygon.getTriangleCount(polygon); }, 0); } // Returns the offsets of each complex polygon in the combined array of all polygons function getPolygonOffsets(polygons) { var offsets = new Array(polygons.length + 1); offsets[0] = 0; var offset = 0; polygons.forEach(function (polygon, i) { offset += Polygon.getVertexCount(polygon); offsets[i + 1] = offset; }); return offsets; } // Returns the offset of each hole polygon in the flattened array for that polygon function getHoleIndices(complexPolygon) { var holeIndices = null; if (complexPolygon.length > 1) { var polygonStartIndex = 0; holeIndices = []; complexPolygon.forEach(function (polygon) { polygonStartIndex += polygon.length; holeIndices.push(polygonStartIndex); }); // Last element points to end of the flat array, remove it holeIndices.pop(); } return holeIndices; } function calculateIndices(_ref3) { var polygons = _ref3.polygons, _ref3$IndexType = _ref3.IndexType, IndexType = _ref3$IndexType === undefined ? Uint32Array : _ref3$IndexType; // Calculate length of index array (3 * number of triangles) var indexCount = 3 * getTriangleCount(polygons); var offsets = getPolygonOffsets(polygons); // Allocate the attribute // TODO it's not the index count but the vertex count that must be checked if (IndexType === Uint16Array && indexCount > 65535) { throw new Error("Vertex count exceeds browser's limit"); } var attribute = new IndexType(indexCount); // 1. get triangulated indices for the internal areas // 2. offset them by the number of indices in previous polygons var i = 0; polygons.forEach(function (polygon, polygonIndex) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = calculateSurfaceIndices(polygon)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var index = _step.value; attribute[i++] = index + offsets[polygonIndex]; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } }); return attribute; } /* * Get vertex indices for drawing complexPolygon mesh * @private * @param {[Number,Number,Number][][]} complexPolygon * @returns {[Number]} indices */ function calculateSurfaceIndices(complexPolygon) { // Prepare an array of hole indices as expected by earcut var holeIndices = getHoleIndices(complexPolygon); // Flatten the polygon as expected by earcut var verts = flattenVertices(complexPolygon); // Let earcut triangulate the polygon return (0, _earcut2.default)(verts, holeIndices, 3); } function calculatePositions(_ref4) { var polygons = _ref4.polygons, pointCount = _ref4.pointCount, fp64 = _ref4.fp64; // Flatten out all the vertices of all the sub subPolygons var attribute = new Float32Array(pointCount * 3); var attributeLow = void 0; if (fp64) { // We only need x, y component attributeLow = new Float32Array(pointCount * 2); } var i = 0; var j = 0; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = polygons[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var polygon = _step2.value; // eslint-disable-next-line Polygon.forEachVertex(polygon, function (vertex) { var x = vertex[0]; var y = vertex[1]; var z = vertex[2] || 0; attribute[i++] = x; attribute[i++] = y; attribute[i++] = z; if (fp64) { attributeLow[j++] = fp64LowPart(x); attributeLow[j++] = fp64LowPart(y); } }); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return { positions: attribute, positions64xyLow: attributeLow }; } function calculateNormals(_ref5) { var polygons = _ref5.polygons, pointCount = _ref5.pointCount; // TODO - use generic vertex attribute? var attribute = new Float32Array(pointCount * 3); // normals is not used in flat polygon shader // fillArray({target: attribute, source: [0, 0, 1], start: 0, count: pointCount}); return attribute; } function calculateColors(_ref6) { var polygons = _ref6.polygons, pointCount = _ref6.pointCount, getColor = _ref6.getColor; var attribute = new Uint8ClampedArray(pointCount * 4); var i = 0; polygons.forEach(function (complexPolygon, polygonIndex) { // Calculate polygon color var color = getColor(polygonIndex); color[3] = Number.isFinite(color[3]) ? color[3] : 255; var vertexCount = Polygon.getVertexCount(complexPolygon); fillArray({ target: attribute, source: color, start: i, count: vertexCount }); i += color.length * vertexCount; }); return attribute; } function calculatePickingColors(_ref7) { var polygons = _ref7.polygons, pointCount = _ref7.pointCount; var attribute = new Uint8ClampedArray(pointCount * 3); var i = 0; polygons.forEach(function (complexPolygon, polygonIndex) { var color = getPickingColor(polygonIndex); var vertexCount = Polygon.getVertexCount(complexPolygon); fillArray({ target: attribute, source: color, start: i, count: vertexCount }); i += color.length * vertexCount; }); return attribute; } /***/ }), /* 330 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME solid-polygon-layer-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nvarying vec4 vColor;\n\nvoid main(void) {\n gl_FragColor = vColor;\n\n // use highlight color if this fragment belongs to the selected object.\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n\n // use picking color if rendering to picking FBO.\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n}\n"; /***/ }), /* 331 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME solid-polygon-layer-vertex-shader-64\n\nattribute vec3 positions;\nattribute vec2 positions64xyLow;\nattribute vec3 normals;\nattribute vec4 colors;\nattribute vec3 pickingColors;\n\nuniform float extruded;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n vec4 positions64xy = vec4(positions.x, positions64xyLow.x, positions.y, positions64xyLow.y);\n\n vec2 projected_coord_xy[2];\n project_position_fp64(positions64xy, projected_coord_xy);\n\n vec2 vertex_pos_modelspace[4];\n vertex_pos_modelspace[0] = projected_coord_xy[0];\n vertex_pos_modelspace[1] = projected_coord_xy[1];\n vertex_pos_modelspace[2] = vec2(project_scale(positions.z * elevationScale), 0.0);\n vertex_pos_modelspace[3] = vec2(1.0, 0.0);\n\n gl_Position = project_to_clipspace_fp64(vertex_pos_modelspace);\n\n vec4 position_worldspace = vec4(\n vertex_pos_modelspace[0].x, vertex_pos_modelspace[1].x,\n vertex_pos_modelspace[2].x, vertex_pos_modelspace[3].x);\n\n float lightWeight = 1.0;\n\n if (extruded > 0.5) {\n lightWeight = getLightWeight(\n position_worldspace.xyz, // the w component is always 1.0\n project_normal(normals)\n );\n }\n\n vec3 lightWeightedColor = lightWeight * colors.rgb;\n vColor = vec4(lightWeightedColor, colors.a * opacity) / 255.0;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(pickingColors);\n}\n"; /***/ }), /* 332 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME solid-polygon-layer-vertex-shader\n\nattribute vec3 positions;\nattribute vec3 normals;\nattribute vec4 colors;\nattribute vec3 pickingColors;\n\nuniform float extruded;\nuniform float elevationScale;\nuniform float opacity;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n \n vec4 position_worldspace = vec4(project_position(\n vec3(positions.x, positions.y, positions.z * elevationScale)),\n 1.0\n );\n gl_Position = project_to_clipspace(position_worldspace);\n\n float lightWeight = 1.0;\n \n if (extruded > 0.5) {\n // Here, the input parameters should be\n // position_worldspace.xyz / position_worldspace.w.\n // However, this calculation generates all zeros on\n // MacBook Pro with Intel Iris Pro GPUs for unclear reasons.\n // (see https://github.com/uber/deck.gl/issues/559)\n // Since the w component is always 1.0 in our shaders,\n // we decided to just provide xyz component of position_worldspace\n // to the getLightWeight() function\n lightWeight = getLightWeight(\n position_worldspace.xyz,\n project_normal(normals)\n );\n }\n\n vec3 lightWeightedColor = lightWeight * colors.rgb;\n vColor = vec4(lightWeightedColor, colors.a * opacity) / 255.0;\n\n // Set color to be rendered to picking fbo (also used to check for selection highlight).\n picking_setPickingColor(pickingColors);\n}\n"; /***/ }), /* 333 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _viewState = __webpack_require__(180); var _viewState2 = _interopRequireDefault(_viewState); var _math = __webpack_require__(16); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var MOVEMENT_SPEED = 1; // 1 meter per keyboard click var ROTATION_STEP_DEGREES = 2; /* Helpers */ // Constrain number between bounds function clamp(x, min, max) { return x < min ? min : x > max ? max : x; } function ensureFinite(value, fallbackValue) { return Number.isFinite(value) ? value : fallbackValue; } var FirstPersonState = function (_ViewState) { _inherits(FirstPersonState, _ViewState); function FirstPersonState(_ref) { var width = _ref.width, height = _ref.height, position = _ref.position, bearing = _ref.bearing, pitch = _ref.pitch, longitude = _ref.longitude, latitude = _ref.latitude, zoom = _ref.zoom, _ref$syncBearing = _ref.syncBearing, syncBearing = _ref$syncBearing === undefined ? true : _ref$syncBearing, bounds = _ref.bounds, startPanEventPosition = _ref.startPanEventPosition, startPanPosition = _ref.startPanPosition, startRotateCenter = _ref.startRotateCenter, startRotateViewport = _ref.startRotateViewport, startZoomPos = _ref.startZoomPos, startZoom = _ref.startZoom; _classCallCheck(this, FirstPersonState); var _this = _possibleConstructorReturn(this, (FirstPersonState.__proto__ || Object.getPrototypeOf(FirstPersonState)).call(this, { width: width, height: height, position: position, bearing: bearing, pitch: pitch, longitude: longitude, latitude: latitude, zoom: zoom })); _this._interactiveState = { startPanEventPosition: startPanEventPosition, startPanPosition: startPanPosition, startRotateCenter: startRotateCenter, startRotateViewport: startRotateViewport, startZoomPos: startZoomPos, startZoom: startZoom }; return _this; } /* Public API */ _createClass(FirstPersonState, [{ key: 'getInteractiveState', value: function getInteractiveState() { return this._interactiveState; } /** * Start panning * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'panStart', value: function panStart(_ref2) { var pos = _ref2.pos; var _viewportProps = this._viewportProps, translationX = _viewportProps.translationX, translationY = _viewportProps.translationY; return this._getUpdatedState({ startPanPosition: [translationX, translationY], startPanEventPosition: pos }); } /** * Pan * @param {[Number, Number]} pos - position on screen where the pointer is */ }, { key: 'pan', value: function pan(_ref3) { var pos = _ref3.pos, startPos = _ref3.startPos; var startPanEventPosition = this._interactiveState.startPanEventPosition || startPos; (0, _assert2.default)(startPanEventPosition, '`startPanEventPosition` props is required'); var _ref4 = this._interactiveState.startPanPosition || [], _ref5 = _slicedToArray(_ref4, 2), translationX = _ref5[0], translationY = _ref5[1]; translationX = ensureFinite(translationX, this._viewportProps.translationX); translationY = ensureFinite(translationY, this._viewportProps.translationY); var deltaX = pos[0] - startPanEventPosition[0]; var deltaY = pos[1] - startPanEventPosition[1]; return this._getUpdatedState({ translationX: translationX + deltaX, translationY: translationY - deltaY }); } /** * End panning * Must call if `panStart()` was called */ }, { key: 'panEnd', value: function panEnd() { return this._getUpdatedState({ startPanPosition: null, startPanPos: null }); } /** * Start rotating * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'rotateStart', value: function rotateStart(_ref6) { var pos = _ref6.pos; return this._getUpdatedState({ startRotateCenter: this._viewportProps.position, startRotateViewport: this._viewportProps }); } /** * Rotate * @param {[Number, Number]} pos - position on screen where the pointer is */ }, { key: 'rotate', value: function rotate(_ref7) { var deltaScaleX = _ref7.deltaScaleX, deltaScaleY = _ref7.deltaScaleY; var _viewportProps2 = this._viewportProps, bearing = _viewportProps2.bearing, pitch = _viewportProps2.pitch; return this._getUpdatedState({ bearing: bearing + deltaScaleX * 10, pitch: pitch - deltaScaleY * 10 }); } /** * End rotating * Must call if `rotateStart()` was called */ }, { key: 'rotateEnd', value: function rotateEnd() { return this._getUpdatedState({ startRotateCenter: null, startRotateViewport: null }); } /** * Start zooming * @param {[Number, Number]} pos - position on screen where the pointer grabs */ }, { key: 'zoomStart', value: function zoomStart(_ref8) { var pos = _ref8.pos; return this._getUpdatedState({ startZoomPos: pos, startZoom: this._viewportProps.zoom }); } /** * Zoom * @param {[Number, Number]} pos - position on screen where the current center is * @param {[Number, Number]} startPos - the center position at * the start of the operation. Must be supplied of `zoomStart()` was not called * @param {Number} scale - a number between [0, 1] specifying the accumulated * relative scale. */ }, { key: 'zoom', value: function zoom(_ref9) { var pos = _ref9.pos, startPos = _ref9.startPos, scale = _ref9.scale; var _viewportProps3 = this._viewportProps, zoom = _viewportProps3.zoom, minZoom = _viewportProps3.minZoom, maxZoom = _viewportProps3.maxZoom, width = _viewportProps3.width, height = _viewportProps3.height, translationX = _viewportProps3.translationX, translationY = _viewportProps3.translationY; var startZoomPos = this._interactiveState.startZoomPos || startPos || pos; var newZoom = clamp(zoom * scale, minZoom, maxZoom); var deltaX = pos[0] - startZoomPos[0]; var deltaY = pos[1] - startZoomPos[1]; // Zoom around the center position var cx = startZoomPos[0] - width / 2; var cy = height / 2 - startZoomPos[1]; /* eslint-disable no-unused-vars */ var newTranslationX = cx - (cx - translationX) * newZoom / zoom + deltaX; var newTranslationY = cy - (cy - translationY) * newZoom / zoom - deltaY; /* eslint-enable no-unused-vars */ // return this._getUpdatedState({ // position // translationX: newTranslationX, // translationY: newTranslationY // }); // TODO HACK return newZoom / zoom < 1 ? this.moveBackward() : this.moveForward(); } /** * End zooming * Must call if `zoomStart()` was called */ }, { key: 'zoomEnd', value: function zoomEnd() { return this._getUpdatedState({ startZoomPos: null, startZoom: null }); } }, { key: 'moveLeft', value: function moveLeft() { var bearing = this._viewportProps.bearing; var newBearing = bearing - ROTATION_STEP_DEGREES; return this._getUpdatedState({ bearing: newBearing }); } }, { key: 'moveRight', value: function moveRight() { var bearing = this._viewportProps.bearing; var newBearing = bearing + ROTATION_STEP_DEGREES; return this._getUpdatedState({ bearing: newBearing }); } }, { key: 'moveForward', value: function moveForward() { var position = this._viewportProps.position; var direction = this.getDirection(); var delta = new _math.Vector3(direction).normalize().scale(MOVEMENT_SPEED); return this._getUpdatedState({ position: new _math.Vector3(position).add(delta) }); } }, { key: 'moveBackward', value: function moveBackward() { var position = this._viewportProps.position; var direction = this.getDirection(); var delta = new _math.Vector3(direction).normalize().scale(-MOVEMENT_SPEED); return this._getUpdatedState({ position: new _math.Vector3(position).add(delta) }); } }, { key: 'moveUp', value: function moveUp() { var position = this._viewportProps.position; var delta = [0, 0, 1]; return this._getUpdatedState({ position: new _math.Vector3(position).add(delta) }); } }, { key: 'moveDown', value: function moveDown() { var position = this._viewportProps.position; var delta = position[2] >= 1 ? [0, 0, -1] : [0, 0, 0]; return this._getUpdatedState({ position: new _math.Vector3(position).add(delta) }); } }, { key: 'zoomIn', value: function zoomIn() { return this._getUpdatedState({ zoom: this._viewportProps.zoom + 0.2 }); } }, { key: 'zoomOut', value: function zoomOut() { return this._getUpdatedState({ zoom: this._viewportProps.zoom - 0.2 }); } /* Private methods */ }, { key: '_getUpdatedState', value: function _getUpdatedState(newProps) { // Update _viewportProps return new FirstPersonState(Object.assign({}, this._viewportProps, this._interactiveState, newProps)); } }]); return FirstPersonState; }(_viewState2.default); exports.default = FirstPersonState; /***/ }), /* 334 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "float scale(float position) {\n return project_scale(position);\n}\n\nvec2 scale(vec2 position) {\n return project_scale(position);\n}\n\nvec3 scale(vec3 position) {\n return project_scale(position);\n}\n\nvec4 scale(vec4 position) {\n return project_scale(position);\n}\n\nvec2 preproject(vec2 position) {\n return project_position(position);\n}\n\nvec3 preproject(vec3 position) {\n return project_position(position);\n}\n\nvec4 preproject(vec4 position) {\n return project_position(position);\n}\n\nvec4 project(vec4 position) {\n return project_to_clipspace(position);\n}\n"; /***/ }), /* 335 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _luma = __webpack_require__(12); var _attributeTransitionModel = __webpack_require__(336); var _attributeTransitionModel2 = _interopRequireDefault(_attributeTransitionModel); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var TRANSITION_STATE = { NONE: 0, PENDING: 1, STARTED: 2, ENDED: 3 }; var noop = function noop() {}; var AttributeTransitionManager = function () { function AttributeTransitionManager(gl, _ref) { var id = _ref.id; _classCallCheck(this, AttributeTransitionManager); this.id = id; this.gl = gl; this.isSupported = _luma.TransformFeedback.isSupported(gl); this.attributeTransitions = {}; this.needsRedraw = false; this.model = null; if (this.isSupported) { this.transformFeedback = new _luma.TransformFeedback(gl); } else { _log2.default.warn(0, 'WebGL2 not supported by this browser. Transition animation is disabled.'); } } /* Public methods */ // Called when attribute manager updates // Check the latest attributes for updates. _createClass(AttributeTransitionManager, [{ key: 'update', value: function update(attributes) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this.opts = opts; if (!this.isSupported) { return; } var needsNewModel = false; var attributeTransitions = this.attributeTransitions; var changedTransitions = {}; for (var attributeName in attributes) { var transition = this._updateAttribute(attributeName, attributes[attributeName]); if (transition) { if (!attributeTransitions[attributeName]) { // New animated attribute is added attributeTransitions[attributeName] = transition; needsNewModel = true; } changedTransitions[attributeName] = transition; } } for (var _attributeName in attributeTransitions) { var attribute = attributes[_attributeName]; if (!attribute || !attribute.transition) { // Animated attribute has been removed delete attributeTransitions[_attributeName]; needsNewModel = true; } } if (needsNewModel) { this._createModel(); } else if (this.model) { this.model.setTransitions(changedTransitions); } } // Returns `true` if attribute is transition-enabled }, { key: 'hasAttribute', value: function hasAttribute(attributeName) { return attributeName in this.attributeTransitions; } // Get all the animated attributes }, { key: 'getAttributes', value: function getAttributes() { var animatedAttributes = {}; for (var attributeName in this.attributeTransitions) { var transition = this.attributeTransitions[attributeName]; if (transition.buffer) { animatedAttributes[attributeName] = transition.buffer; } } return animatedAttributes; } /* eslint-disable max-statements */ // Called every render cycle, run transform feedback // Returns `true` if anything changes }, { key: 'setCurrentTime', value: function setCurrentTime(currentTime) { if (!this.model) { return false; } var uniforms = {}; var buffers = {}; var needsRedraw = this.needsRedraw; this.needsRedraw = false; for (var attributeName in this.attributeTransitions) { var transition = this.attributeTransitions[attributeName]; buffers[transition.bufferIndex] = transition.buffer; var time = 1; if (transition.state === TRANSITION_STATE.PENDING) { transition.startTime = currentTime; transition.state = TRANSITION_STATE.STARTED; transition.onStart(transition); } if (transition.state === TRANSITION_STATE.STARTED) { time = (currentTime - transition.startTime) / transition.duration; if (time >= 1) { time = 1; transition.state = TRANSITION_STATE.ENDED; transition.onEnd(transition); } needsRedraw = true; } uniforms[transition.name + 'Time'] = transition.easing(time); } if (needsRedraw) { this._runTransformFeedback({ uniforms: uniforms, buffers: buffers }); } return needsRedraw; } /* eslint-enable max-statements */ /* Private methods */ // Check an attributes for updates // Returns a transition object if a new transition is triggered. }, { key: '_updateAttribute', value: function _updateAttribute(attributeName, attribute) { var settings = this._getTransitionSettings(attribute); if (settings) { var hasChanged = void 0; var transition = this.attributeTransitions[attributeName]; if (transition) { hasChanged = attribute.changed; } else { // New animated attributes have been added transition = { name: attributeName, attribute: attribute }; hasChanged = true; } if (hasChanged) { this._triggerTransition(transition, settings); return transition; } } return null; } // Redraw the transform feedback }, { key: '_runTransformFeedback', value: function _runTransformFeedback(_ref2) { var uniforms = _ref2.uniforms, buffers = _ref2.buffers; var model = this.model, transformFeedback = this.transformFeedback; transformFeedback.bindBuffers(buffers, {}); model.draw({ uniforms: uniforms, transformFeedback: transformFeedback, parameters: _defineProperty({}, _luma.GL.RASTERIZER_DISCARD, true) }); } // Create a model for the transform feedback }, { key: '_createModel', value: function _createModel() { if (this.model) { this.model.destroy(); } this.model = new _attributeTransitionModel2.default(this.gl, { id: this.id, transitions: this.attributeTransitions }); } // get current values of an attribute, clipped/padded to the size of the new buffer }, { key: '_getCurrentAttributeState', value: function _getCurrentAttributeState(transition) { var attribute = transition.attribute, buffer = transition.buffer; var value = attribute.value, type = attribute.type, size = attribute.size; if (buffer) { // If new buffer is bigger than old buffer, back fill with destination values var oldBufferData = new Float32Array(value); buffer.getData({ dstData: oldBufferData }); // Hack/Xiaoji: WebGL2 throws error if TransformFeedback does not render to // a buffer of type Float32Array. // Therefore we need to read data as a Float32Array then re-cast to attribute type if (!(value instanceof Float32Array)) { oldBufferData = new value.constructor(oldBufferData); } return { size: size, type: type, value: oldBufferData }; } return { size: size, type: type, value: value }; } // Returns transition settings object if transition is enabled, otherwise `null` }, { key: '_getTransitionSettings', value: function _getTransitionSettings(attribute) { var opts = this.opts; var transition = attribute.transition, accessor = attribute.accessor; if (!transition) { return null; } return Array.isArray(accessor) ? accessor.map(function (a) { return opts[a]; }).find(Boolean) : opts[accessor]; } // Normalizes transition settings object, merge with default settings }, { key: '_normalizeTransitionSettings', value: function _normalizeTransitionSettings(settings) { // Shorthand: use duration instead of parameter object if (Number.isFinite(settings)) { settings = { duration: settings }; } // Check if settings is valid (0, _assert2.default)(settings && settings.duration > 0); return { duration: settings.duration, easing: settings.easing || function (t) { return t; }, onStart: settings.onStart || noop, onEnd: settings.onEnd || noop, onInterrupt: settings.onInterrupt || noop }; } // Start a new transition using the current settings // Updates transition state and from/to buffer }, { key: '_triggerTransition', value: function _triggerTransition(transition, settings) { this.needsRedraw = true; var attribute = transition.attribute, buffer = transition.buffer; var value = attribute.value, size = attribute.size; var transitionSettings = this._normalizeTransitionSettings(settings); var needsNewBuffer = !buffer || transition.bufferSize < value.length; // Attribute descriptor to transition from // _getCurrentAttributeState must be called before the current buffer is deleted var fromState = this._getCurrentAttributeState(transition); // Attribute descriptor to transition to // Pre-converting to buffer to reuse in the case where no transition is needed var toState = new _luma.Buffer(this.gl, { size: size, data: value }); if (needsNewBuffer) { if (buffer) { buffer.delete(); } transition.buffer = new _luma.Buffer(this.gl, { size: size, instanced: attribute.instanced, // WebGL2 throws error if `value` is not cast to Float32Array: // `transformfeedback buffers : buffer or buffer range not large enough` data: new Float32Array(value.length), usage: _luma.GL.DYNAMIC_COPY }); transition.bufferSize = value.length; } Object.assign(transition, transitionSettings); transition.fromState = fromState; transition.toState = toState; // Reset transition state if (transition.state === TRANSITION_STATE.STARTED) { transition.onInterrupt(transition); } transition.state = TRANSITION_STATE.PENDING; } }]); return AttributeTransitionManager; }(); exports.default = AttributeTransitionManager; /***/ }), /* 336 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _luma = __webpack_require__(12); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ATTRIBUTE_MAPPING = { 1: 'float', 2: 'vec2', 3: 'vec3', 4: 'vec4' }; function getShaders(transitions) { // Build shaders var varyings = []; var attributeDeclarations = []; var uniformsDeclarations = []; var varyingDeclarations = []; var calculations = []; for (var attributeName in transitions) { var transition = transitions[attributeName]; var attributeType = ATTRIBUTE_MAPPING[transition.attribute.size]; if (attributeType) { transition.bufferIndex = varyings.length; varyings.push(attributeName); attributeDeclarations.push('attribute ' + attributeType + ' ' + attributeName + 'From;'); attributeDeclarations.push('attribute ' + attributeType + ' ' + attributeName + 'To;'); uniformsDeclarations.push('uniform float ' + attributeName + 'Time;'); varyingDeclarations.push('varying ' + attributeType + ' ' + attributeName + ';'); calculations.push(attributeName + ' = mix(' + attributeName + 'From, ' + attributeName + 'To,\n ' + attributeName + 'Time);'); } } var vs = '\n#define SHADER_NAME feedback-vertex-shader\n' + attributeDeclarations.join('\n') + '\n' + uniformsDeclarations.join('\n') + '\n' + varyingDeclarations.join('\n') + '\n\nvoid main(void) {\n ' + calculations.join('\n') + '\n gl_Position = vec4(0.0);\n}\n'; var fs = '#define SHADER_NAME feedback-fragment-shader\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\n' + varyingDeclarations.join('\n') + '\n\nvoid main(void) {\n gl_FragColor = vec4(0.0);\n}\n'; return { vs: vs, fs: fs, varyings: varyings }; } var AttributeTransitionModel = function (_Model) { _inherits(AttributeTransitionModel, _Model); function AttributeTransitionModel(gl, _ref) { var id = _ref.id, transitions = _ref.transitions; _classCallCheck(this, AttributeTransitionModel); var _this = _possibleConstructorReturn(this, (AttributeTransitionModel.__proto__ || Object.getPrototypeOf(AttributeTransitionModel)).call(this, gl, Object.assign({ id: id, geometry: new _luma.Geometry({ id: id, drawMode: _luma.GL.POINTS }), vertexCount: 0, isIndexed: true }, getShaders(transitions)))); _this.setTransitions(transitions); return _this; } // Update attributes and vertex count _createClass(AttributeTransitionModel, [{ key: 'setTransitions', value: function setTransitions(transitions) { for (var attributeName in transitions) { var _setAttributes; var _transitions$attribut = transitions[attributeName], fromState = _transitions$attribut.fromState, toState = _transitions$attribut.toState, attribute = _transitions$attribut.attribute; this.setAttributes((_setAttributes = {}, _defineProperty(_setAttributes, attributeName + 'From', fromState), _defineProperty(_setAttributes, attributeName + 'To', toState), _setAttributes)); this.setVertexCount(attribute.value.length / attribute.size); } } }]); return AttributeTransitionModel; }(_luma.Model); exports.default = AttributeTransitionModel; /***/ }), /* 337 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _layer = __webpack_require__(123); var _layer2 = _interopRequireDefault(_layer); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _flatten = __webpack_require__(126); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var CompositeLayer = function (_Layer) { _inherits(CompositeLayer, _Layer); function CompositeLayer(props) { _classCallCheck(this, CompositeLayer); return _possibleConstructorReturn(this, (CompositeLayer.__proto__ || Object.getPrototypeOf(CompositeLayer)).call(this, props)); } _createClass(CompositeLayer, [{ key: 'getSubLayers', value: function getSubLayers() { return this.internalState.subLayers || []; } // initializeState is usually not needed for composite layers // Provide empty definition to disable check for missing definition }, { key: 'initializeState', value: function initializeState() {} // called to augment the info object that is bubbled up from a sublayer // override Layer.getPickingInfo() because decoding / setting uniform do // not apply to a composite layer. // @return null to cancel event }, { key: 'getPickingInfo', value: function getPickingInfo(_ref) { var info = _ref.info; return info; } // Implement to generate subLayers }, { key: 'renderLayers', value: function renderLayers() { return null; } // Returns sub layer props for a specific sublayer }, { key: 'getSubLayerProps', value: function getSubLayerProps(sublayerProps) { var _props = this.props, opacity = _props.opacity, pickable = _props.pickable, visible = _props.visible, parameters = _props.parameters, getPolygonOffset = _props.getPolygonOffset, highlightedObjectIndex = _props.highlightedObjectIndex, autoHighlight = _props.autoHighlight, highlightColor = _props.highlightColor, coordinateSystem = _props.coordinateSystem, coordinateOrigin = _props.coordinateOrigin, modelMatrix = _props.modelMatrix; var newProps = { opacity: opacity, pickable: pickable, visible: visible, parameters: parameters, getPolygonOffset: getPolygonOffset, highlightedObjectIndex: highlightedObjectIndex, autoHighlight: autoHighlight, highlightColor: highlightColor, coordinateSystem: coordinateSystem, coordinateOrigin: coordinateOrigin, modelMatrix: modelMatrix }; if (sublayerProps) { Object.assign(newProps, sublayerProps, { id: this.props.id + '-' + sublayerProps.id, updateTriggers: Object.assign({ all: this.props.updateTriggers.all }, sublayerProps.updateTriggers) }); } return newProps; } // Called by layer manager to render subLayers }, { key: '_renderLayers', value: function _renderLayers() { var subLayers = this.internalState.subLayers; if (subLayers && !this.needsUpdate()) { _log2.default.log(3, 'Composite layer reused subLayers ' + this, this.internalState.subLayers); } else { subLayers = this.renderLayers(); // Flatten the returned array, removing any null, undefined or false // this allows layers to render sublayers conditionally // (see CompositeLayer.renderLayers docs) subLayers = (0, _flatten.flatten)(subLayers, { filter: Boolean }); this.internalState.subLayers = subLayers; _log2.default.log(2, 'Composite layer rendered new subLayers ' + this, subLayers); } // populate reference to parent layer (this layer) // NOTE: needs to be done even when reusing layers as the parent may have changed var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = subLayers[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var layer = _step.value; layer.parentLayer = this; } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } } }, { key: 'isComposite', get: function get() { return true; } }]); return CompositeLayer; }(_layer2.default); exports.default = CompositeLayer; CompositeLayer.layerName = 'CompositeLayer'; /***/ }), /* 338 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _globals = __webpack_require__(350); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // Version detection using babel plugin // Fallback for tests and SSR since global variable is defined by Webpack. /* global __VERSION__ */ // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var version = true ? '5.1.3' : _globals.global.DECK_VERSION || 'untranspiled source'; var STARTUP_MESSAGE = 'set deck.log.priority=1 (or higher) to trace attribute updates'; if (_globals.global.deck && _globals.global.deck.VERSION !== version) { throw new Error('deck.gl - multiple versions detected: ' + _globals.global.deck.VERSION + ' vs ' + version); } if (!_globals.global.deck) { /* global console */ /* eslint-disable no-console */ console.log('deck.gl ' + version + ' - ' + STARTUP_MESSAGE); _globals.global.deck = _globals.global.deck || { VERSION: version, version: version, log: _log2.default }; } // TODO - Hack, remove when luma.gl 4.1.0-alpha.5 is published if (!console.table) { console.table = function () {}; } // Make sure we register shader modules __webpack_require__(190); /***/ }), /* 339 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pickObject = pickObject; exports.pickVisibleObjects = pickVisibleObjects; exports.getClosestFromPickingBuffer = getClosestFromPickingBuffer; var _drawLayers = __webpack_require__(183); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var NO_PICKED_OBJECT = { pickedColor: null, pickedLayer: null, pickedObjectIndex: -1 }; /* eslint-disable max-depth, max-statements */ // Pick the closest object at the given (x,y) coordinate // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. function pickObject(gl, _ref) { var layers = _ref.layers, viewports = _ref.viewports, x = _ref.x, y = _ref.y, radius = _ref.radius, layerFilter = _ref.layerFilter, mode = _ref.mode, onViewportActive = _ref.onViewportActive, pickingFBO = _ref.pickingFBO, lastPickedInfo = _ref.lastPickedInfo, useDevicePixels = _ref.useDevicePixels; // Convert from canvas top-left to WebGL bottom-left coordinates // And compensate for pixelRatio var pixelRatio = (0, _drawLayers.getPixelRatio)({ useDevicePixels: useDevicePixels }); var deviceX = Math.round(x * pixelRatio); var deviceY = Math.round(gl.canvas.height - y * pixelRatio); var deviceRadius = Math.round(radius * pixelRatio); var deviceRect = getPickingRect({ deviceX: deviceX, deviceY: deviceY, deviceRadius: deviceRadius, deviceWidth: pickingFBO.width, deviceHeight: pickingFBO.height }); var pickedColors = deviceRect && drawAndSamplePickingBuffer(gl, { layers: layers, viewports: viewports, onViewportActive: onViewportActive, useDevicePixels: useDevicePixels, pickingFBO: pickingFBO, deviceRect: deviceRect, layerFilter: layerFilter, redrawReason: mode }); var pickInfo = pickedColors && getClosestFromPickingBuffer(gl, { pickedColors: pickedColors, layers: layers, deviceX: deviceX, deviceY: deviceY, deviceRadius: deviceRadius, deviceRect: deviceRect }) || NO_PICKED_OBJECT; return processPickInfo({ pickInfo: pickInfo, lastPickedInfo: lastPickedInfo, mode: mode, layers: layers, viewports: viewports, x: x, y: y, deviceX: deviceX, deviceY: deviceY, pixelRatio: pixelRatio }); } // Pick all objects within the given bounding box function pickVisibleObjects(gl, _ref2) { var layers = _ref2.layers, viewports = _ref2.viewports, x = _ref2.x, y = _ref2.y, width = _ref2.width, height = _ref2.height, mode = _ref2.mode, layerFilter = _ref2.layerFilter, onViewportActive = _ref2.onViewportActive, pickingFBO = _ref2.pickingFBO, useDevicePixels = _ref2.useDevicePixels; // Convert from canvas top-left to WebGL bottom-left coordinates // And compensate for pixelRatio var pixelRatio = (0, _drawLayers.getPixelRatio)({ useDevicePixels: useDevicePixels }); var deviceLeft = Math.round(x * pixelRatio); var deviceBottom = Math.round(gl.canvas.height - y * pixelRatio); var deviceRight = Math.round((x + width) * pixelRatio); var deviceTop = Math.round(gl.canvas.height - (y + height) * pixelRatio); var deviceRect = { x: deviceLeft, y: deviceTop, width: deviceRight - deviceLeft, height: deviceBottom - deviceTop }; var pickedColors = drawAndSamplePickingBuffer(gl, { layers: layers, viewports: viewports, onViewportActive: onViewportActive, pickingFBO: pickingFBO, useDevicePixels: useDevicePixels, deviceRect: deviceRect, layerFilter: layerFilter, redrawReason: mode }); var pickInfos = getUniquesFromPickingBuffer(gl, { pickedColors: pickedColors, layers: layers }); // Only return unique infos, identified by info.object var uniqueInfos = new Map(); pickInfos.forEach(function (pickInfo) { var info = { color: pickInfo.pickedColor, layer: null, index: pickInfo.pickedObjectIndex, picked: true, x: x, y: y, width: width, height: height, pixelRatio: pixelRatio }; info = getLayerPickingInfo({ layer: pickInfo.pickedLayer, info: info, mode: mode }); if (!uniqueInfos.has(info.object)) { uniqueInfos.set(info.object, info); } }); return Array.from(uniqueInfos.values()); } // HELPER METHODS // returns pickedColor or null if no pickable layers found. function drawAndSamplePickingBuffer(gl, _ref3) { var layers = _ref3.layers, viewports = _ref3.viewports, onViewportActive = _ref3.onViewportActive, useDevicePixels = _ref3.useDevicePixels, pickingFBO = _ref3.pickingFBO, deviceRect = _ref3.deviceRect, layerFilter = _ref3.layerFilter, redrawReason = _ref3.redrawReason; (0, _assert2.default)(deviceRect); (0, _assert2.default)(Number.isFinite(deviceRect.width) && deviceRect.width > 0, '`width` must be > 0'); (0, _assert2.default)(Number.isFinite(deviceRect.height) && deviceRect.height > 0, '`height` must be > 0'); var pickableLayers = layers.filter(function (layer) { return layer.isPickable(); }); if (pickableLayers.length < 1) { return null; } (0, _drawLayers.drawPickingBuffer)(gl, { layers: layers, viewports: viewports, onViewportActive: onViewportActive, useDevicePixels: useDevicePixels, pickingFBO: pickingFBO, deviceRect: deviceRect, layerFilter: layerFilter, redrawReason: redrawReason }); // Read from an already rendered picking buffer // Returns an Uint8ClampedArray of picked pixels var x = deviceRect.x, y = deviceRect.y, width = deviceRect.width, height = deviceRect.height; var pickedColors = new Uint8Array(width * height * 4); pickingFBO.readPixels({ x: x, y: y, width: width, height: height, pixelArray: pickedColors }); return pickedColors; } // Indentifies which viewport, if any corresponds to x and y // Returns first viewport if no match // TODO - need to determine which viewport we are in // TODO - document concept of "primary viewport" that matches all coords? // TODO - static method on Viewport class? function getViewportFromCoordinates(_ref4) { var viewports = _ref4.viewports; var viewport = viewports[0]; return viewport; } // Calculate a picking rect centered on deviceX and deviceY and clipped to device // Returns null if pixel is outside of device function getPickingRect(_ref5) { var deviceX = _ref5.deviceX, deviceY = _ref5.deviceY, deviceRadius = _ref5.deviceRadius, deviceWidth = _ref5.deviceWidth, deviceHeight = _ref5.deviceHeight; var valid = deviceX >= 0 && deviceY >= 0 && deviceX < deviceWidth && deviceY < deviceHeight; // x, y out of bounds. if (!valid) { return null; } // Create a box of size `radius * 2 + 1` centered at [deviceX, deviceY] var x = Math.max(0, deviceX - deviceRadius); var y = Math.max(0, deviceY - deviceRadius); var width = Math.min(deviceWidth, deviceX + deviceRadius) - x + 1; var height = Math.min(deviceHeight, deviceY + deviceRadius) - y + 1; return { x: x, y: y, width: width, height: height }; } // TODO - break this monster function into 3+ parts function processPickInfo(_ref6) { var pickInfo = _ref6.pickInfo, lastPickedInfo = _ref6.lastPickedInfo, mode = _ref6.mode, layers = _ref6.layers, viewports = _ref6.viewports, x = _ref6.x, y = _ref6.y, deviceX = _ref6.deviceX, deviceY = _ref6.deviceY, pixelRatio = _ref6.pixelRatio; var pickedColor = pickInfo.pickedColor, pickedLayer = pickInfo.pickedLayer, pickedObjectIndex = pickInfo.pickedObjectIndex; var affectedLayers = pickedLayer ? [pickedLayer] : []; if (mode === 'hover') { // only invoke onHover events if picked object has changed var lastPickedObjectIndex = lastPickedInfo.index; var lastPickedLayerId = lastPickedInfo.layerId; var pickedLayerId = pickedLayer && pickedLayer.props.id; // proceed only if picked object changed if (pickedLayerId !== lastPickedLayerId || pickedObjectIndex !== lastPickedObjectIndex) { if (pickedLayerId !== lastPickedLayerId) { // We cannot store a ref to lastPickedLayer in the context because // the state of an outdated layer is no longer valid // and the props may have changed var lastPickedLayer = layers.find(function (layer) { return layer.props.id === lastPickedLayerId; }); if (lastPickedLayer) { // Let leave event fire before enter event affectedLayers.unshift(lastPickedLayer); } } // Update layer manager context lastPickedInfo.layerId = pickedLayerId; lastPickedInfo.index = pickedObjectIndex; } } var viewport = getViewportFromCoordinates({ viewports: viewports }); // TODO - add coords var baseInfo = { color: null, layer: null, index: -1, picked: false, x: x, y: y, pixel: [x, y], lngLat: viewport.unproject([x, y]), devicePixel: [deviceX, deviceY], pixelRatio: pixelRatio }; // Use a Map to store all picking infos. // The following two forEach loops are the result of // https://github.com/uber/deck.gl/issues/443 // Please be very careful when changing this pattern var infos = new Map(); affectedLayers.forEach(function (layer) { var info = Object.assign({}, baseInfo); if (layer === pickedLayer) { info.color = pickedColor; info.index = pickedObjectIndex; info.picked = true; } info = getLayerPickingInfo({ layer: layer, info: info, mode: mode }); // This guarantees that there will be only one copy of info for // one composite layer if (info) { infos.set(info.layer.id, info); } var pickingSelectedColor = layer.props.autoHighlight && pickedLayer === layer ? pickedColor : null; var pickingParameters = { pickingSelectedColor: pickingSelectedColor }; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = layer.getModels()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var model = _step.value; model.updateModuleSettings(pickingParameters); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } }); var unhandledPickInfos = callLayerPickingCallbacks(infos, mode); return unhandledPickInfos; } // Per-layer event handlers (e.g. onClick, onHover) are provided by the // user and out of deck.gl's control. It's very much possible that // the user calls React lifecycle methods in these function, such as // ReactComponent.setState(). React lifecycle methods sometimes induce // a re-render and re-generation of props of deck.gl and its layers, // which invalidates all layers currently passed to this very function. // Therefore, per-layer event handlers must be invoked at the end // of the picking operation. NO operation that relies on the states of current // layers should be called after this code. function callLayerPickingCallbacks(infos, mode) { var unhandledPickInfos = []; infos.forEach(function (info) { var handled = false; switch (mode) { case 'click': handled = info.layer.props.onClick(info); break; case 'hover': handled = info.layer.props.onHover(info); break; case 'query': break; default: throw new Error('unknown pick type'); } if (!handled) { unhandledPickInfos.push(info); } }); return unhandledPickInfos; } /** * Pick at a specified pixel with a tolerance radius * Returns the closest object to the pixel in shape `{pickedColor, pickedLayer, pickedObjectIndex}` */ function getClosestFromPickingBuffer(gl, _ref7) { var pickedColors = _ref7.pickedColors, layers = _ref7.layers, deviceX = _ref7.deviceX, deviceY = _ref7.deviceY, deviceRadius = _ref7.deviceRadius, deviceRect = _ref7.deviceRect; (0, _assert2.default)(pickedColors); // Traverse all pixels in picking results and find the one closest to the supplied // [deviceX, deviceY] var x = deviceRect.x, y = deviceRect.y, width = deviceRect.width, height = deviceRect.height; var minSquareDistanceToCenter = deviceRadius * deviceRadius; var closestPixelIndex = -1; var i = 0; for (var row = 0; row < height; row++) { var dy = row + y - deviceY; var dy2 = dy * dy; if (dy2 > minSquareDistanceToCenter) { // skip this row i += 4 * width; } else { for (var col = 0; col < width; col++) { // Decode picked layer from color var pickedLayerIndex = pickedColors[i + 3] - 1; if (pickedLayerIndex >= 0) { var dx = col + x - deviceX; var d2 = dx * dx + dy2; if (d2 <= minSquareDistanceToCenter) { minSquareDistanceToCenter = d2; closestPixelIndex = i; } } i += 4; } } } if (closestPixelIndex >= 0) { // Decode picked object index from color var _pickedLayerIndex = pickedColors[closestPixelIndex + 3] - 1; var pickedColor = pickedColors.slice(closestPixelIndex, closestPixelIndex + 4); var pickedLayer = layers[_pickedLayerIndex]; if (pickedLayer) { var pickedObjectIndex = pickedLayer.decodePickingColor(pickedColor); return { pickedColor: pickedColor, pickedLayer: pickedLayer, pickedObjectIndex: pickedObjectIndex }; } _log2.default.error('Picked non-existent layer. Is picking buffer corrupt?'); } return NO_PICKED_OBJECT; } /* eslint-enable max-depth, max-statements */ /** * Examines a picking buffer for unique colors * Returns array of unique objects in shape `{x, y, pickedColor, pickedLayer, pickedObjectIndex}` */ function getUniquesFromPickingBuffer(gl, _ref8) { var pickedColors = _ref8.pickedColors, layers = _ref8.layers; var uniqueColors = new Map(); // Traverse all pixels in picking results and get unique colors if (pickedColors) { for (var i = 0; i < pickedColors.length; i += 4) { // Decode picked layer from color var pickedLayerIndex = pickedColors[i + 3] - 1; if (pickedLayerIndex >= 0) { var pickedColor = pickedColors.slice(i, i + 4); var colorKey = pickedColor.join(','); // eslint-disable-next-line if (!uniqueColors.has(colorKey)) { var pickedLayer = layers[pickedLayerIndex]; // eslint-disable-next-line if (pickedLayer) { uniqueColors.set(colorKey, { pickedColor: pickedColor, pickedLayer: pickedLayer, pickedObjectIndex: pickedLayer.decodePickingColor(pickedColor) }); } else { _log2.default.error('Picked non-existent layer. Is picking buffer corrupt?'); } } } } } return Array.from(uniqueColors.values()); } // Walk up the layer composite chain to populate the info object function getLayerPickingInfo(_ref9) { var layer = _ref9.layer, info = _ref9.info, mode = _ref9.mode; while (layer && info) { // For a composite layer, sourceLayer will point to the sublayer // where the event originates from. // It provides additional context for the composite layer's // getPickingInfo() method to populate the info object var sourceLayer = info.layer || layer; info.layer = layer; // layer.pickLayer() function requires a non-null ```layer.state``` // object to funtion properly. So the layer refereced here // must be the "current" layer, not an "out-dated" / "invalidated" layer info = layer.pickLayer({ info: info, mode: mode, sourceLayer: sourceLayer }); layer = layer.parentLayer; } return info; } /***/ }), /* 340 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EMPTY_ARRAY = undefined; exports.createProps = createProps; var _seerIntegration = __webpack_require__(124); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var EMPTY_ARRAY = exports.EMPTY_ARRAY = Object.freeze([]); // Create a property object function createProps() { var propObjects = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var layer = this; // eslint-disable-line // Get default prop object (a prototype chain for now) var _getDefaultProps = getDefaultProps(layer.constructor), defaultProps = _getDefaultProps.defaultProps; // Create a new prop object with the default props as prototype var newProps = Object.create(defaultProps, { _layer: { enumerable: false, value: layer }, _asyncProps: { enumerable: false, value: {} } }); // "Copy" all sync props for (var i = 0; i < arguments.length; ++i) { Object.assign(newProps, arguments[i]); } newProps.data = newProps.data || EMPTY_ARRAY; // SEER: Apply any overrides from the seer debug extension if it is active (0, _seerIntegration.applyPropOverrides)(newProps); // Props must be immutable Object.freeze(newProps); return newProps; } // Helper methods // Constructors have their super class constructors as prototypes function getOwnProperty(object, prop) { return Object.prototype.hasOwnProperty.call(object, prop) && object[prop]; } function getLayerName(layerClass) { var layerName = getOwnProperty(layerClass, 'layerName'); if (!layerName) { _log2.default.once(0, layerClass.name + '.layerName not specified'); } return layerName || layerClass.name; } // ALT 1: Layer Prop Object Implementation // Create a new Prop object if needed function getDefaultProps(layerClass) { var props = getOwnProperty(layerClass, '_props'); if (props) { return props; } var parent = layerClass.prototype; if (!parent) { return { defaultProps: {} }; } var parentClass = Object.getPrototypeOf(layerClass); var parentProps = parent && getDefaultProps(parentClass) || null; // Parse propTypes from Layer.defaultProps var defaultProps = getOwnProperty(layerClass, 'defaultProps') || {}; // Create any necessary property descriptors and create the default prop object // Assign merged default props var myDefaultProps = Object.create(null); Object.assign(myDefaultProps, parentProps && parentProps.defaultProps, defaultProps); createPropDescriptors(myDefaultProps, layerClass); // Store the props layerClass._props = { defaultProps: myDefaultProps }; return layerClass._props; } function createPropDescriptors(props, layerClass) { var descriptors = {}; delete props.id; Object.assign(descriptors, { id: { configurable: false, writable: true, value: getLayerName(layerClass) } }); Object.defineProperties(props, descriptors); } /***/ }), /* 341 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var _layerManager = __webpack_require__(184); var _layerManager2 = _interopRequireDefault(_layerManager); var _effectManager = __webpack_require__(181); var _effectManager2 = _interopRequireDefault(_effectManager); var _effect = __webpack_require__(122); var _effect2 = _interopRequireDefault(_effect); var _webMercatorViewport = __webpack_require__(86); var _webMercatorViewport2 = _interopRequireDefault(_webMercatorViewport); var _mjolnir = __webpack_require__(115); var _luma = __webpack_require__(12); var _propTypes = __webpack_require__(116); var _propTypes2 = _interopRequireDefault(_propTypes); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /* global document */ function noop() {} var propTypes = { id: _propTypes2.default.string, width: _propTypes2.default.number.isRequired, height: _propTypes2.default.number.isRequired, layers: _propTypes2.default.array, // Array can contain falsy values viewports: _propTypes2.default.array, // Array can contain falsy values effects: _propTypes2.default.arrayOf(_propTypes2.default.instanceOf(_effect2.default)), layerFilter: _propTypes2.default.func, glOptions: _propTypes2.default.object, gl: _propTypes2.default.object, pickingRadius: _propTypes2.default.number, onWebGLInitialized: _propTypes2.default.func, onBeforeRender: _propTypes2.default.func, onAfterRender: _propTypes2.default.func, onLayerClick: _propTypes2.default.func, onLayerHover: _propTypes2.default.func, useDevicePixels: _propTypes2.default.bool, // Debug settings debug: _propTypes2.default.bool, drawPickingColors: _propTypes2.default.bool }; var defaultProps = { id: 'deckgl-overlay', pickingRadius: 0, layerFilter: null, glOptions: {}, gl: null, layers: [], effects: [], onWebGLInitialized: noop, onBeforeRender: noop, onAfterRender: noop, onLayerClick: null, onLayerHover: null, useDevicePixels: true, debug: false, drawPickingColors: false }; // TODO - should this class be joined with `LayerManager`? var DeckGLJS = function () { function DeckGLJS(props) { var _this = this; _classCallCheck(this, DeckGLJS); props = Object.assign({}, defaultProps, props); this.state = {}; this.needsRedraw = true; this.layerManager = null; this.effectManager = null; this.viewports = []; // Bind methods this._onRendererInitialized = this._onRendererInitialized.bind(this); this._onRenderFrame = this._onRenderFrame.bind(this); this.canvas = this._createCanvas(props); var _props = props, width = _props.width, height = _props.height, gl = _props.gl, glOptions = _props.glOptions, debug = _props.debug, //iclient isGeographicCoordinateSystem =_props.isGeographicCoordinateSystem, useDevicePixels = _props.useDevicePixels; this.animationLoop = new _luma.AnimationLoop({ width: width, height: height, useDevicePixels: useDevicePixels, //iclient isGeographicCoordinateSystem : isGeographicCoordinateSystem, onCreateContext: function onCreateContext(opts) { return gl || (0, _luma.createGLContext)(Object.assign({}, glOptions, { canvas: _this.canvas, debug: debug })); }, onInitialize: this._onRendererInitialized, onRender: this._onRenderFrame, onBeforeRender: props.onBeforeRender, onAfterRender: props.onAfterRender }); this.animationLoop.start(); this.setProps(props); } _createClass(DeckGLJS, [{ key: 'setProps', value: function setProps(props) { props = Object.assign({}, this.props, props); this.props = props; if (!this.layerManager) { return; } var _props2 = props, layers = _props2.layers, pickingRadius = _props2.pickingRadius, onLayerClick = _props2.onLayerClick, onLayerHover = _props2.onLayerHover, useDevicePixels = _props2.useDevicePixels, drawPickingColors = _props2.drawPickingColors, layerFilter = _props2.layerFilter; // Update viewports (creating one if not supplied) var viewports = props.viewports || props.viewport; if (!viewports) { var _props3 = props, width = _props3.width, height = _props3.height, latitude = _props3.latitude, longitude = _props3.longitude, zoom = _props3.zoom, pitch = _props3.pitch, bearing = _props3.bearing; viewports = [new _webMercatorViewport2.default({ width: width, height: height, latitude: latitude, longitude: longitude, zoom: zoom, pitch: pitch, bearing: bearing ,isGeographicCoordinateSystem:props.isGeographicCoordinateSystem})]; } // If more parameters need to be updated on layerManager add them to this method. this.layerManager.setParameters({ layers: layers, viewports: viewports, useDevicePixels: useDevicePixels, drawPickingColors: drawPickingColors, layerFilter: layerFilter, pickingRadius: pickingRadius, onLayerClick: onLayerClick, onLayerHover: onLayerHover }); // TODO - unify setParameters/setOptions/setProps etc naming. this.animationLoop.setViewParameters({ useDevicePixels: useDevicePixels }); } }, { key: 'finalize', value: function finalize() { this.animationLoop.stop(); this.animationLoop = null; if (this.layerManager) { this.layerManager.finalize(); this.layerManager = null; } } // Public API }, { key: 'pickObject', value: function pickObject(_ref) { var x = _ref.x, y = _ref.y, _ref$radius = _ref.radius, radius = _ref$radius === undefined ? 0 : _ref$radius, _ref$layerIds = _ref.layerIds, layerIds = _ref$layerIds === undefined ? null : _ref$layerIds; var selectedInfos = this.layerManager.pickObject({ x: x, y: y, radius: radius, layerIds: layerIds, mode: 'query' }); return selectedInfos.length ? selectedInfos[0] : null; } }, { key: 'pickObjects', value: function pickObjects(_ref2) { var x = _ref2.x, y = _ref2.y, _ref2$width = _ref2.width, width = _ref2$width === undefined ? 1 : _ref2$width, _ref2$height = _ref2.height, height = _ref2$height === undefined ? 1 : _ref2$height, _ref2$layerIds = _ref2.layerIds, layerIds = _ref2$layerIds === undefined ? null : _ref2$layerIds; return this.layerManager.pickObjects({ x: x, y: y, width: width, height: height, layerIds: layerIds }); } }, { key: 'getViewports', value: function getViewports() { return this.layerManager ? this.layerManager.getViewports() : []; } // Private Methods }, { key: '_createCanvas', value: function _createCanvas(props) { if (props.canvas) { return props.canvas; } var id = props.id, width = props.width, height = props.height, style = props.style; var canvas = document.createElement('canvas'); canvas.id = id; canvas.width = width; canvas.height = height; canvas.style = style; var parent = props.parent || document.body; parent.appendChild(canvas); return canvas; } // Callbacks }, { key: '_onRendererInitialized', value: function _onRendererInitialized(_ref3) { var gl = _ref3.gl, canvas = _ref3.canvas; (0, _luma.setParameters)(gl, { blend: true, blendFunc: [_luma.GL.SRC_ALPHA, _luma.GL.ONE_MINUS_SRC_ALPHA, _luma.GL.ONE, _luma.GL.ONE_MINUS_SRC_ALPHA], polygonOffsetFill: true, depthTest: true, depthFunc: _luma.GL.LEQUAL }); this.props.onWebGLInitialized(gl); // Note: avoid React setState due GL animation loop / setState timing issue this.layerManager = new _layerManager2.default(gl, { eventManager: new _mjolnir.EventManager(canvas), isGeographicCoordinateSystem:_ref3.isGeographicCoordinateSystem }); this.effectManager = new _effectManager2.default({ gl: gl, layerManager: this.layerManager }); var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = this.props.effects[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var effect = _step.value; this.effectManager.addEffect(effect); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } this.setProps(this.props); } }, { key: '_onRenderFrame', value: function _onRenderFrame(_ref4) { var gl = _ref4.gl; var redrawReason = this.layerManager.needsRedraw({ clearRedrawFlags: true }); if (!redrawReason) { return; } this.props.onBeforeRender({ gl: gl }); // TODO - should be called by AnimationLoop this.layerManager.drawLayers({ pass: 'screen', redrawReason: redrawReason, // Helps debug layer picking, especially in framebuffer powered layers drawPickingColors: this.props.drawPickingColors }); this.props.onAfterRender({ gl: gl }); // TODO - should be called by AnimationLoop } }]); return DeckGLJS; }(); exports.default = DeckGLJS; DeckGLJS.propTypes = propTypes; DeckGLJS.defaultProps = defaultProps; /***/ }), /* 342 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // lighting exports.default = "#define NUM_OF_LIGHTS 2\n\n// TODO these should be using lighting_ prefix\nuniform vec3 lightsPosition[16];\nuniform vec2 lightsStrength[16];\nuniform float ambientRatio;\nuniform float diffuseRatio;\nuniform float specularRatio;\n\nfloat lighting_getLightWeight(vec3 position_worldspace_vec3, vec3 normals_worldspace) {\n float lightWeight = 0.0;\n\n vec3 normals_worldspace_vec3 = normals_worldspace.xyz;\n\n vec3 camera_pos_worldspace = project_uCameraPosition;\n vec3 view_direction = normalize(camera_pos_worldspace - position_worldspace_vec3);\n\n for (int i = 0; i < NUM_OF_LIGHTS; i++) {\n vec3 light_position_worldspace = project_position(lightsPosition[i]);\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace_vec3);\n\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normals_worldspace_vec3);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normals_worldspace_vec3, halfway_direction), 0.0);\n specular = pow(specular_angle, 32.0);\n }\n lambertian = max(lambertian, 0.0);\n lightWeight += (ambientRatio + lambertian * diffuseRatio + specular * specularRatio) *\n lightsStrength[i].x;\n\n }\n\n return lightWeight;\n}\n\n// DEPRECATED - Backwards compatibility\n\nfloat getLightWeight(vec3 position_worldspace_vec3, vec3 normals_worldspace) {\n return lighting_getLightWeight(position_worldspace_vec3, normals_worldspace);\n}\n"; /***/ }), /* 343 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "\nconst vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097);\n\nuniform vec2 project64_uScale;\nuniform vec2 project_uViewProjectionMatrixFP64[16];\n\n// longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw\nvoid mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) {\n\n#if defined(NVIDIA_FP64_WORKAROUND)\n out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE);\n#else\n out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64);\n#endif\n out_val[1] = sub_fp64(PI_FP64,\n log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0))));\n return;\n}\n\nvoid project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) {\n vec2 pos_fp64[2];\n mercatorProject_fp64(position_fp64, pos_fp64);\n vec2 x_fp64 = mul_fp64(pos_fp64[0], project64_uScale);\n vec2 y_fp64 = mul_fp64(pos_fp64[1], project64_uScale);\n out_val[0] = mul_fp64(x_fp64, WORLD_SCALE_FP64);\n out_val[1] = mul_fp64(y_fp64, WORLD_SCALE_FP64);\n\n return;\n}\n\nvec4 project_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) {\n vec2 vertex_pos_clipspace[4];\n mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace,\n vertex_pos_clipspace);\n return vec4(\n vertex_pos_clipspace[0].x,\n vertex_pos_clipspace[1].x,\n vertex_pos_clipspace[2].x,\n vertex_pos_clipspace[3].x\n );\n}\n"; /***/ }), /* 344 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "// EXTERNAL CONSTANTS: these must match JavaScript constants in \"src/core/lib/constants.js\"\nconst float COORDINATE_SYSTEM_IDENTITY = 0.;\nconst float COORDINATE_SYSTEM_LNG_LAT = 1.;\nconst float COORDINATE_SYSTEM_METER_OFFSETS = 2.;\nconst float COORDINATE_SYSTEM_LNGLAT_OFFSETS = 3.;\n\nuniform float project_uCoordinateSystem;\nuniform float project_uScale;\nuniform vec3 project_uPixelsPerMeter;\nuniform vec3 project_uPixelsPerDegree;\nuniform vec3 project_uPixelsPerUnit;\nuniform vec3 project_uPixelsPerUnit2;\nuniform vec4 project_uCenter;\nuniform mat4 project_uModelMatrix;\nuniform mat4 project_uViewProjectionMatrix;\nuniform vec2 project_uViewportSize;\nuniform float project_uDevicePixelRatio;\nuniform float project_uFocalDistance;\nuniform vec3 project_uCameraPosition;\n\nconst float TILE_SIZE = 512.0;\nconst float PI = 3.1415926536;\nconst float WORLD_SCALE = TILE_SIZE / (PI * 2.0);\n\n//\n// Scaling offsets - scales meters to \"pixels\"\n// Note the scalar version of project_scale is for scaling the z component only\n//\nfloat project_scale(float meters) {\n return meters * project_uPixelsPerMeter.z;\n}\n\nvec2 project_scale(vec2 meters) {\n return meters * project_uPixelsPerMeter.xy;\n}\n\nvec3 project_scale(vec3 meters) {\n return meters * project_uPixelsPerMeter;\n}\n\nvec4 project_scale(vec4 meters) {\n return vec4(meters.xyz * project_uPixelsPerMeter, meters.w);\n}\n\n//\n// Projecting normal - transform deltas from current coordinate system to\n// normals in the worldspace\n//\nvec3 project_normal(vec3 vector) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNG_LAT ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n return normalize(vector * project_uPixelsPerDegree);\n }\n return normalize(vector * project_uPixelsPerMeter);\n}\n\nvec4 project_offset_(vec4 offset) {\n vec3 pixelsPerUnit = project_uPixelsPerUnit + project_uPixelsPerUnit2 * offset.y;\n return vec4(offset.xyz * pixelsPerUnit, offset.w);\n}\n\n//\n// Projecting positions - non-linear projection: lnglats => unit tile [0-1, 0-1]\n//\nvec2 project_mercator_(vec2 lnglat) {\n return vec2(\n radians(lnglat.x) + PI,\n PI - log(tan_fp32(PI * 0.25 + radians(lnglat.y) * 0.5))\n );\n}\n\n//\n// Projects lnglats (or meter offsets, depending on mode) to pixels\n//\nvec4 project_position(vec4 position) {\n // TODO - why not simply subtract center and fall through?\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNG_LAT) {\n return project_uModelMatrix * vec4(\n project_mercator_(position.xy) * WORLD_SCALE * project_uScale,\n project_scale(position.z),\n position.w\n );\n }\n\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n return project_offset_(position);\n }\n\n // METER_OFFSETS or IDENTITY\n // Apply model matrix\n vec4 position_modelspace = project_uModelMatrix * position;\n return project_offset_(position_modelspace);\n}\n\nvec3 project_position(vec3 position) {\n vec4 projected_position = project_position(vec4(position, 1.0));\n return projected_position.xyz;\n}\n\nvec2 project_position(vec2 position) {\n vec4 projected_position = project_position(vec4(position, 0.0, 1.0));\n return projected_position.xy;\n}\n\n//\n// Projects from \"world\" coordinates to clip space.\n// Uses project_uViewProjectionMatrix\n//\nvec4 project_to_clipspace(vec4 position) {\n if (project_uCoordinateSystem == COORDINATE_SYSTEM_METER_OFFSETS ||\n project_uCoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSETS) {\n // Needs to be divided with project_uPixelsPerMeter\n position.w *= project_uPixelsPerMeter.z;\n }\n return project_uViewProjectionMatrix * position + project_uCenter;\n}\n\n// Returns a clip space offset that corresponds to a given number of **non-device** pixels\nvec4 project_pixel_to_clipspace(vec2 pixels) {\n vec2 offset = pixels / project_uViewportSize * project_uDevicePixelRatio;\n return vec4(offset * project_uFocalDistance, 0.0, 0.0);\n}\n"; /***/ }), /* 345 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getUniformsFromViewport = getUniformsFromViewport; var _multiply = __webpack_require__(75); var _multiply2 = _interopRequireDefault(_multiply); var _transformMat = __webpack_require__(103); var _transformMat2 = _interopRequireDefault(_transformMat); var _log = __webpack_require__(17); var _log2 = _interopRequireDefault(_log); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); var _constants = __webpack_require__(70); var _memoize = __webpack_require__(196); var _memoize2 = _interopRequireDefault(_memoize); var _viewportMercatorProject = __webpack_require__(79); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // To quickly set a vector to zero var ZERO_VECTOR = [0, 0, 0, 0]; // 4x4 matrix that drops 4th component of vector // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* global window */ var VECTOR_TO_POINT_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]; var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; var DEFAULT_PIXELS_PER_UNIT2 = [0, 0, 0]; var DEFAULT_COORDINATE_ORIGIN = [0, 0, 0]; var getMemoizedViewportUniforms = (0, _memoize2.default)(calculateViewportUniforms); // The code that utilizes Matrix4 does the same calculation as their mat4 counterparts, // has lower performance but provides error checking. // Uncomment when debugging function calculateMatrixAndOffset(_ref) { var viewport = _ref.viewport, coordinateSystem = _ref.coordinateSystem, coordinateOrigin = _ref.coordinateOrigin, coordinateZoom = _ref.coordinateZoom; var viewMatrixUncentered = viewport.viewMatrixUncentered; var viewMatrix = viewport.viewMatrix; var projectionMatrix = viewport.projectionMatrix; var viewProjectionMatrix = viewport.viewProjectionMatrix; var projectionCenter = void 0; switch (coordinateSystem) { case _constants.COORDINATE_SYSTEM.IDENTITY: case _constants.COORDINATE_SYSTEM.LNGLAT: projectionCenter = ZERO_VECTOR; break; // TODO: make lighting work for meter offset mode case _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS: case _constants.COORDINATE_SYSTEM.METER_OFFSETS: // Calculate transformed projectionCenter (using 64 bit precision JS) // This is the key to offset mode precision // (avoids doing this addition in 32 bit precision in GLSL) var positionPixels = (0, _viewportMercatorProject.lngLatToWorld)(coordinateOrigin, Math.pow(2, coordinateZoom)); // projectionCenter = new Matrix4(viewProjectionMatrix) // .transformVector([positionPixels[0], positionPixels[1], 0.0, 1.0]); projectionCenter = (0, _transformMat2.default)([], [positionPixels[0], positionPixels[1], 0.0, 1.0], viewProjectionMatrix); // Always apply uncentered projection matrix if available (shader adds center) viewMatrix = viewMatrixUncentered || viewMatrix; // Zero out 4th coordinate ("after" model matrix) - avoids further translations // viewMatrix = new Matrix4(viewMatrixUncentered || viewMatrix) // .multiplyRight(VECTOR_TO_POINT_MATRIX); viewProjectionMatrix = (0, _multiply2.default)([], projectionMatrix, viewMatrix); viewProjectionMatrix = (0, _multiply2.default)([], viewProjectionMatrix, VECTOR_TO_POINT_MATRIX); break; default: throw new Error('Unknown projection mode'); } return { viewMatrix: viewMatrix, viewProjectionMatrix: viewProjectionMatrix, projectionCenter: projectionCenter, cameraPos: viewport.cameraPosition }; } /** * Returns uniforms for shaders based on current projection * includes: projection matrix suitable for shaders * * TODO - Ensure this works with any viewport, not just WebMercatorViewports * * @param {WebMercatorViewport} viewport - * @return {Float32Array} - 4x4 projection matrix that can be used in shaders */ function getUniformsFromViewport() { var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, viewport = _ref2.viewport, _ref2$modelMatrix = _ref2.modelMatrix, modelMatrix = _ref2$modelMatrix === undefined ? null : _ref2$modelMatrix, _ref2$coordinateSyste = _ref2.coordinateSystem, coordinateSystem = _ref2$coordinateSyste === undefined ? _constants.COORDINATE_SYSTEM.LNGLAT : _ref2$coordinateSyste, _ref2$coordinateOrigi = _ref2.coordinateOrigin, coordinateOrigin = _ref2$coordinateOrigi === undefined ? DEFAULT_COORDINATE_ORIGIN : _ref2$coordinateOrigi, projectionMode = _ref2.projectionMode, positionOrigin = _ref2.positionOrigin; (0, _assert2.default)(viewport); if (projectionMode !== undefined) { _log2.default.removed('projectionMode', 'coordinateSystem'); } if (positionOrigin !== undefined) { _log2.default.removed('positionOrigin', 'coordinateOrigin'); } return Object.assign({ project_uModelMatrix: modelMatrix || IDENTITY_MATRIX }, getMemoizedViewportUniforms({ viewport: viewport, coordinateSystem: coordinateSystem, coordinateOrigin: coordinateOrigin })); } function calculateViewportUniforms(_ref3) { var viewport = _ref3.viewport, coordinateSystem = _ref3.coordinateSystem, coordinateOrigin = _ref3.coordinateOrigin; var coordinateZoom = viewport.zoom; var _calculateMatrixAndOf = calculateMatrixAndOffset({ coordinateSystem: coordinateSystem, coordinateOrigin: coordinateOrigin, coordinateZoom: coordinateZoom, viewport: viewport }), projectionCenter = _calculateMatrixAndOf.projectionCenter, viewProjectionMatrix = _calculateMatrixAndOf.viewProjectionMatrix, cameraPos = _calculateMatrixAndOf.cameraPos; (0, _assert2.default)(viewProjectionMatrix, 'Viewport missing modelViewProjectionMatrix'); // Calculate projection pixels per unit var distanceScales = viewport.getDistanceScales(); // TODO - does this depend on useDevicePixels? var devicePixelRatio = typeof window !== 'undefined' && window.devicePixelRatio || 1; var viewportSize = [viewport.width * devicePixelRatio, viewport.height * devicePixelRatio]; var uniforms = { // Projection mode values project_uCoordinateSystem: coordinateSystem, project_uCenter: projectionCenter, // Screen size project_uViewportSize: viewportSize, project_uDevicePixelRatio: devicePixelRatio, // Distance at which screen pixels are projected project_uFocalDistance: viewport.focalDistance || 1, project_uPixelsPerMeter: distanceScales.pixelsPerMeter, project_uPixelsPerDegree: distanceScales.pixelsPerDegree, project_uPixelsPerUnit: distanceScales.pixelsPerMeter, project_uPixelsPerUnit2: DEFAULT_PIXELS_PER_UNIT2, project_uScale: viewport.scale, // This is the mercator scale (2 ** zoom) project_uViewProjectionMatrix: viewProjectionMatrix, // This is for lighting calculations project_uCameraPosition: cameraPos }; if (coordinateSystem === _constants.COORDINATE_SYSTEM.METER_OFFSETS) { var distanceScalesAtOrigin = viewport.getDistanceScales(coordinateOrigin); uniforms.project_uPixelsPerUnit = distanceScalesAtOrigin.pixelsPerMeter; uniforms.project_uPixelsPerUnit2 = distanceScalesAtOrigin.pixelsPerMeter2; } if (coordinateSystem === _constants.COORDINATE_SYSTEM.LNGLAT_OFFSETS) { var _distanceScalesAtOrigin = viewport.getDistanceScales(coordinateOrigin); uniforms.project_uPixelsPerUnit = _distanceScalesAtOrigin.pixelsPerDegree; uniforms.project_uPixelsPerUnit2 = _distanceScalesAtOrigin.pixelsPerDegree2; } return uniforms; } /***/ }), /* 346 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _transitionInterpolator = __webpack_require__(193); var _transitionInterpolator2 = _interopRequireDefault(_transitionInterpolator); var _transitionUtils = __webpack_require__(84); var _viewportMercatorProject = __webpack_require__(79); var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom', 'bearing', 'pitch']; var REQUIRED_PROPS = ['latitude', 'longitude', 'zoom', 'width', 'height']; var LINEARLY_INTERPOLATED_PROPS = ['bearing', 'pitch']; /** * This class adapts mapbox-gl-js Map#flyTo animation so it can be used in * react/redux architecture. * mapbox-gl-js flyTo : https://www.mapbox.com/mapbox-gl-js/api/#map#flyto. * It implements “Smooth and efficient zooming and panning.” algorithm by * "Jarke J. van Wijk and Wim A.A. Nuij" */ var ViewportFlyToInterpolator = function (_TransitionInterpolat) { _inherits(ViewportFlyToInterpolator, _TransitionInterpolat); function ViewportFlyToInterpolator() { _classCallCheck(this, ViewportFlyToInterpolator); var _this = _possibleConstructorReturn(this, (ViewportFlyToInterpolator.__proto__ || Object.getPrototypeOf(ViewportFlyToInterpolator)).call(this)); _this.propNames = VIEWPORT_TRANSITION_PROPS; return _this; } _createClass(ViewportFlyToInterpolator, [{ key: 'initializeProps', value: function initializeProps(startProps, endProps) { var startViewportProps = {}; var endViewportProps = {}; // Check minimum required props var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = REQUIRED_PROPS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; var startValue = startProps[key]; var endValue = endProps[key]; (0, _assert2.default)((0, _transitionUtils.isValid)(startValue) && (0, _transitionUtils.isValid)(endValue), key + ' must be supplied for transition'); startViewportProps[key] = startValue; endViewportProps[key] = (0, _transitionUtils.getEndValueByShortestPath)(key, startValue, endValue); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = LINEARLY_INTERPOLATED_PROPS[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var _key = _step2.value; var _startValue = startProps[_key] || 0; var _endValue = endProps[_key] || 0; startViewportProps[_key] = _startValue; endViewportProps[_key] = (0, _transitionUtils.getEndValueByShortestPath)(_key, _startValue, _endValue); } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return { start: startViewportProps, end: endViewportProps }; } }, { key: 'interpolateProps', value: function interpolateProps(startProps, endProps, t) { var viewport = (0, _viewportMercatorProject.flyToViewport)(startProps, endProps, t); // Linearly interpolate 'bearing' and 'pitch' if exist. var _iteratorNormalCompletion3 = true; var _didIteratorError3 = false; var _iteratorError3 = undefined; try { for (var _iterator3 = LINEARLY_INTERPOLATED_PROPS[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { var key = _step3.value; viewport[key] = (0, _transitionUtils.lerp)(startProps[key], endProps[key], t); } } catch (err) { _didIteratorError3 = true; _iteratorError3 = err; } finally { try { if (!_iteratorNormalCompletion3 && _iterator3.return) { _iterator3.return(); } } finally { if (_didIteratorError3) { throw _iteratorError3; } } } return viewport; } }]); return ViewportFlyToInterpolator; }(_transitionInterpolator2.default); exports.default = ViewportFlyToInterpolator; /***/ }), /* 347 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // getValue takes an array of points returns a value to sort the bins on. // by default it returns the number of points // this is where to pass in a function to color the bins by // avg/mean/max of specific value of the point var defaultGetValue = function defaultGetValue(points) { return points.length; }; var BinSorter = function () { function BinSorter() { var bins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var getValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultGetValue; _classCallCheck(this, BinSorter); this.sortedBins = this.getSortedBins(bins, getValue); this.maxCount = this.getMaxCount(); this.binMap = this.getBinMap(); } /** * Get an array of object with sorted values and index of bins * @param {Array} bins * @param {Function} getValue * @return {Array} array of values and index lookup */ _createClass(BinSorter, [{ key: "getSortedBins", value: function getSortedBins(bins, getValue) { return bins.reduce(function (accu, h, i) { var value = getValue(h.points); if (value !== null && value !== undefined) { // filter bins if value is null or undefined accu.push({ i: Number.isFinite(h.index) ? h.index : i, value: value, counts: h.points.length }); } return accu; }, []).sort(function (a, b) { return a.value - b.value; }); } /** * Get range of values of all bins * @param {Number[]} range * @param {Number} range[0] - lower bound * @param {Number} range[1] - upper bound * @return {Array} array of new value range */ }, { key: "getValueRange", value: function getValueRange(_ref) { var _ref2 = _slicedToArray(_ref, 2), lower = _ref2[0], upper = _ref2[1]; var len = this.sortedBins.length; if (!len) { return [0, 0]; } var lowerIdx = Math.ceil(lower / 100 * (len - 1)); var upperIdx = Math.floor(upper / 100 * (len - 1)); return [this.sortedBins[lowerIdx].value, this.sortedBins[upperIdx].value]; } /** * Get ths max count of all bins * @return {Number | Boolean} max count */ }, { key: "getMaxCount", value: function getMaxCount() { var maxCount = 0; this.sortedBins.forEach(function (x) { return maxCount = maxCount > x.counts ? maxCount : x.counts; }); return maxCount; } /** * Get a mapping from cell/hexagon index to sorted bin * This is used to retrieve bin value for color calculation * @return {Object} bin index to sortedBins */ }, { key: "getBinMap", value: function getBinMap() { return this.sortedBins.reduce(function (mapper, curr) { return Object.assign(mapper, _defineProperty({}, curr.i, curr)); }, {}); } }]); return BinSorter; }(); exports.default = BinSorter; /***/ }), /* 348 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var defaultColorRange = exports.defaultColorRange = [[255, 255, 178], [254, 217, 118], [254, 178, 76], [253, 141, 60], [240, 59, 32], [189, 0, 38]]; /***/ }), /* 349 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; exports.get = get; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /** * Access properties of nested containers using dot-path notation * - Supports plain objects and arrays, as well as classes with `get` methods * such as ES6 Maps, Immutable.js objects etc * - Returns undefined if any container is not valid, instead of throwing * * @param {Object} container - container that supports get * @param {String|*} compositeKey - key to access, can be '.'-separated string * @return {*} - value in the final key of the nested container */ function get(container, compositeKey) { // Split the key into subkeys var keyList = getKeys(compositeKey); // Recursively get the value of each key; var value = container; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = keyList[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; // If any intermediate subfield is not a container, return undefined if (!isObject(value)) { return undefined; } // Get the `getter` for this container var getter = getGetter(value); // Use the getter to get the value for the key value = getter(value, key); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return value; } /** * Checks if argument is an indexable object (not a primitive value, nor null) * @param {*} value - JavaScript value to be tested * @return {Boolean} - true if argument is a JavaScript object */ function isObject(value) { return value !== null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) === 'object'; } // Default getter is container indexing var squareBracketGetter = function squareBracketGetter(container, key) { return container[key]; }; var getMethodGetter = function getMethodGetter(obj, key) { return obj.get(key); }; // Cache key to key arrays for speed var keyMap = {}; // Looks for a `get` function on the prototype // TODO - follow prototype chain? // @private // @return {Function} - get function: (container, key) => value function getGetter(container) { // Check if container has a special get method var prototype = Object.getPrototypeOf(container); return prototype.get ? getMethodGetter : squareBracketGetter; } // Takes a string of '.' separated keys and returns an array of keys // E.g. 'feature.geometry.type' => 'feature', 'geometry', 'type' // @private function getKeys(compositeKey) { if (typeof compositeKey === 'string') { // else assume string and split around dots var keyList = keyMap[compositeKey]; if (!keyList) { keyList = compositeKey.split('.'); keyMap[compositeKey] = keyList; } return keyList; } // Wrap in array if needed return Array.isArray(compositeKey) ? compositeKey : [compositeKey]; } /***/ }), /* 350 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process, global) { var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Purpose: include this in your module to avoids adding dependencies on // micro modules like 'global' and 'is-browser'; /* global process, window, global, document */ var isBrowser = (typeof process === 'undefined' ? 'undefined' : _typeof(process)) !== 'object' || String(process) !== '[object process]' || process.browser; module.exports = { window: typeof window !== 'undefined' ? window : global, global: typeof global !== 'undefined' ? global : window, document: typeof document !== 'undefined' ? document : {}, isBrowser: isBrowser }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26), __webpack_require__(47))) /***/ }), /* 351 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.inheritsFrom = inheritsFrom; // Check if one JavaScript class inherits from another function inheritsFrom(Type, ParentType) { while (Type) { if (Type === ParentType) { return true; } Type = Object.getPrototypeOf(Type); } return false; } /***/ }), /* 352 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); exports.linearScale = linearScale; exports.quantizeScale = quantizeScale; exports.getQuantizeScale = getQuantizeScale; exports.getLinearScale = getLinearScale; exports.clamp = clamp; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // Linear scale maps continuous domain to continuous range function linearScale(domain, range, value) { return (value - domain[0]) / (domain[1] - domain[0]) * (range[1] - range[0]) + range[0]; } // Quantize scale is similar to linear scales, // except it uses a discrete rather than continuous range function quantizeScale(domain, range, value) { var step = (domain[1] - domain[0]) / range.length; var idx = Math.floor((value - domain[0]) / step); var clampIdx = Math.max(Math.min(idx, range.length - 1), 0); return range[clampIdx]; } // return a quantize scale function function getQuantizeScale(domain, range) { return function (value) { var step = (domain[1] - domain[0]) / range.length; var idx = Math.floor((value - domain[0]) / step); var clampIdx = Math.max(Math.min(idx, range.length - 1), 0); return range[clampIdx]; }; } // return a linear scale funciton function getLinearScale(domain, range) { return function (value) { return (value - domain[0]) / (domain[1] - domain[0]) * (range[1] - range[0]) + range[0]; }; } function clamp(_ref, value) { var _ref2 = _slicedToArray(_ref, 2), min = _ref2[0], max = _ref2[1]; return Math.min(max, Math.max(min, value)); } /***/ }), /* 353 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _math = __webpack_require__(16); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var SphericalCoordinates = _math.experimental.SphericalCoordinates; function getDirectionFromBearingAndPitch(_ref) { var bearing = _ref.bearing, pitch = _ref.pitch; var spherical = new SphericalCoordinates({ bearing: bearing, pitch: pitch }); var direction = spherical.toVector3().normalize(); return direction; } var FirstPersonViewport = function (_Viewport) { _inherits(FirstPersonViewport, _Viewport); function FirstPersonViewport() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, FirstPersonViewport); // TODO - push direction handling into Matrix4.lookAt var _opts$modelMatrix = opts.modelMatrix, modelMatrix = _opts$modelMatrix === undefined ? null : _opts$modelMatrix, bearing = opts.bearing, _opts$up = opts.up, up = _opts$up === undefined ? [0, 0, 1] : _opts$up; // Always calculate direction from bearing and pitch var dir = getDirectionFromBearingAndPitch({ bearing: bearing, pitch: 89 }); // Direction is relative to model coordinates, of course var center = modelMatrix ? modelMatrix.transformDirection(dir) : dir; // Just the direction. All the positioning is done in viewport.js var viewMatrix = new _math.Matrix4().lookAt({ eye: [0, 0, 0], center: center, up: up }); return _possibleConstructorReturn(this, (FirstPersonViewport.__proto__ || Object.getPrototypeOf(FirstPersonViewport)).call(this, Object.assign({}, opts, { zoom: null, // triggers meter level zoom viewMatrix: viewMatrix }))); } return FirstPersonViewport; }(_viewport2.default); exports.default = FirstPersonViewport; FirstPersonViewport.displayName = 'FirstPersonViewport'; /***/ }), /* 354 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _lookAt = __webpack_require__(102); var _lookAt2 = _interopRequireDefault(_lookAt); var _ortho = __webpack_require__(234); var _ortho2 = _interopRequireDefault(_ortho); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var OrthographicViewport = function (_Viewport) { _inherits(OrthographicViewport, _Viewport); function OrthographicViewport(_ref) { var width = _ref.width, height = _ref.height, _ref$eye = _ref.eye, eye = _ref$eye === undefined ? [0, 0, 1] : _ref$eye, _ref$lookAt = _ref.lookAt, lookAt = _ref$lookAt === undefined ? [0, 0, 0] : _ref$lookAt, _ref$up = _ref.up, up = _ref$up === undefined ? [0, 1, 0] : _ref$up, _ref$near = _ref.near, near = _ref$near === undefined ? 1 : _ref$near, _ref$far = _ref.far, far = _ref$far === undefined ? 100 : _ref$far, left = _ref.left, top = _ref.top, _ref$right = _ref.right, right = _ref$right === undefined ? null : _ref$right, _ref$bottom = _ref.bottom, bottom = _ref$bottom === undefined ? null : _ref$bottom; _classCallCheck(this, OrthographicViewport); right = Number.isFinite(right) ? right : left + width; bottom = Number.isFinite(bottom) ? bottom : top + height; return _possibleConstructorReturn(this, (OrthographicViewport.__proto__ || Object.getPrototypeOf(OrthographicViewport)).call(this, { viewMatrix: (0, _lookAt2.default)([], eye, lookAt, up), projectionMatrix: (0, _ortho2.default)([], left, right, bottom, top, near, far), width: width, height: height })); } return OrthographicViewport; }(_viewport2.default); exports.default = OrthographicViewport; /***/ }), /* 355 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _lookAt = __webpack_require__(102); var _lookAt2 = _interopRequireDefault(_lookAt); var _perspective = __webpack_require__(76); var _perspective2 = _interopRequireDefault(_perspective); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var DEGREES_TO_RADIANS = Math.PI / 180; var PerspectiveViewport = function (_Viewport) { _inherits(PerspectiveViewport, _Viewport); function PerspectiveViewport(_ref) { var width = _ref.width, height = _ref.height, eye = _ref.eye, _ref$lookAt = _ref.lookAt, lookAt = _ref$lookAt === undefined ? [0, 0, 0] : _ref$lookAt, _ref$up = _ref.up, up = _ref$up === undefined ? [0, 1, 0] : _ref$up, _ref$fovy = _ref.fovy, fovy = _ref$fovy === undefined ? 75 : _ref$fovy, _ref$near = _ref.near, near = _ref$near === undefined ? 1 : _ref$near, _ref$far = _ref.far, far = _ref$far === undefined ? 100 : _ref$far, _ref$aspect = _ref.aspect, aspect = _ref$aspect === undefined ? null : _ref$aspect; _classCallCheck(this, PerspectiveViewport); var fovyRadians = fovy * DEGREES_TO_RADIANS; aspect = Number.isFinite(aspect) ? aspect : width / height; return _possibleConstructorReturn(this, (PerspectiveViewport.__proto__ || Object.getPrototypeOf(PerspectiveViewport)).call(this, { viewMatrix: (0, _lookAt2.default)([], eye, lookAt, up), projectionMatrix: (0, _perspective2.default)([], fovyRadians, aspect, near, far), width: width, height: height })); } return PerspectiveViewport; }(_viewport2.default); exports.default = PerspectiveViewport; /***/ }), /* 356 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _viewport = __webpack_require__(42); var _viewport2 = _interopRequireDefault(_viewport); var _math = __webpack_require__(16); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var SphericalCoordinates = _math.experimental.SphericalCoordinates; function getDirectionFromBearingAndPitch(_ref) { var bearing = _ref.bearing, pitch = _ref.pitch; var spherical = new SphericalCoordinates({ bearing: bearing, pitch: pitch }); return spherical.toVector3().normalize(); } var ThirdPersonViewport = function (_Viewport) { _inherits(ThirdPersonViewport, _Viewport); function ThirdPersonViewport(opts) { _classCallCheck(this, ThirdPersonViewport); var bearing = opts.bearing, pitch = opts.pitch, position = opts.position, up = opts.up, zoom = opts.zoom; var direction = getDirectionFromBearingAndPitch({ bearing: bearing, pitch: pitch }); var distance = zoom * 50; // TODO somehow need to flip z to make it work // check if the position offset is done in the base viewport var eye = direction.scale(-distance).multiply(new _math.Vector3(1, 1, -1)); var viewMatrix = new _math.Matrix4().multiplyRight(new _math.Matrix4().lookAt({ eye: eye, center: position, up: up })); return _possibleConstructorReturn(this, (ThirdPersonViewport.__proto__ || Object.getPrototypeOf(ThirdPersonViewport)).call(this, Object.assign({}, opts, { // use meter level zoom: null, viewMatrix: viewMatrix }))); } return ThirdPersonViewport; }(_viewport2.default); exports.default = ThirdPersonViewport; ThirdPersonViewport.displayName = 'ThirdPersonViewport'; /***/ }), /* 357 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME reflection-effect-fs\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D reflectionTexture;\nuniform int reflectionTextureWidth;\nuniform int reflectionTextureHeight;\n\nuniform float reflectivity;\nuniform float blur;\n\n\nvarying vec2 uv;\n\n#define KERNEL_SIZE 7\n\n/*\n * Samples from tex with a gaussian-shaped patch, centered at uv and\n * with standard deviation sigma. The size of the texture in\n * pixels must be specified by dim\n */\nvec4 sample_gaussian(sampler2D tex, vec2 dim, vec2 uv, float sigma) {\n if (sigma == 0.0) {\n return texture2D(tex, uv);\n }\n\n vec2 delta = 1.0 / dim;\n vec2 top_left = uv - delta * float(KERNEL_SIZE+1) / 2.0;\n\n vec4 color = vec4(0);\n float sum = 0.0;\n for (int i = 0; i < KERNEL_SIZE; ++i) {\n for (int j = 0; j < KERNEL_SIZE; ++j) {\n vec2 uv2 = top_left + vec2(i, j) * delta;\n float d = length((uv2 - uv) * dim);\n float f = exp(-(d*d) / (2.0*sigma * sigma));\n color += f * texture2D(tex, uv2);\n sum += f;\n }\n }\n return color / sum;\n}\n\nvoid main(void) {\n //map blur in [0, 1] to sigma in [0, inf]\n //alpha will determine the \"steepness\" of our curve.\n //this was picked just to make the scale feel \"natural\"\n //if our image is 1000 pixels wide, a blur of 0.5 should correspond\n //to a sigma of 1 pixels\n float alpha = 1000.0;\n float sigma = blur / (alpha * (1.0 - blur));\n //let this be our standard deviation in terms of screen-widths.\n //rewrite this in terms of pixels.\n sigma *= float(reflectionTextureWidth);\n\n\n gl_FragColor = sample_gaussian(reflectionTexture, vec2(reflectionTextureWidth,\n reflectionTextureHeight), vec2(uv.x, 1. - uv.y), sigma);\n //because our canvas expects alphas to be pre-multiplied, we multiply by whole\n //color vector by reflectivity, not just the alpha channel\n gl_FragColor *= reflectivity;\n}\n"; /***/ }), /* 358 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. exports.default = "#define SHADER_NAME reflection-effect-vs\n\nattribute vec3 vertices;\n\nvarying vec2 uv;\n\nvoid main(void) {\n uv = vertices.xy;\n gl_Position = vec4(2. * vertices.xy - vec2(1., 1.), 1., 1.);\n}\n"; /***/ }), /* 359 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _luma = __webpack_require__(12); var _effect = __webpack_require__(122); var _effect2 = _interopRequireDefault(_effect); var _webMercatorViewport = __webpack_require__(86); var _webMercatorViewport2 = _interopRequireDefault(_webMercatorViewport); var _reflectionEffectVertex = __webpack_require__(358); var _reflectionEffectVertex2 = _interopRequireDefault(_reflectionEffectVertex); var _reflectionEffectFragment = __webpack_require__(357); var _reflectionEffectFragment2 = _interopRequireDefault(_reflectionEffectFragment); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* global window */ var ReflectionEffect = function (_Effect) { _inherits(ReflectionEffect, _Effect); /** * @classdesc * ReflectionEffect * * @class * @param reflectivity How visible reflections should be over the map, between 0 and 1 * @param blur how blurry the reflection should be, between 0 and 1 */ function ReflectionEffect() { var reflectivity = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0.5; var blur = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0.5; _classCallCheck(this, ReflectionEffect); var _this = _possibleConstructorReturn(this, (ReflectionEffect.__proto__ || Object.getPrototypeOf(ReflectionEffect)).call(this)); _this.reflectivity = reflectivity; _this.blur = blur; _this.framebuffer = null; _this.setNeedsRedraw(); return _this; } _createClass(ReflectionEffect, [{ key: 'getShaders', value: function getShaders() { return { vs: _reflectionEffectVertex2.default, fs: _reflectionEffectFragment2.default, modules: [], shaderCache: this.context.shaderCache }; } }, { key: 'initialize', value: function initialize(_ref) { var gl = _ref.gl, layerManager = _ref.layerManager; this.unitQuad = new _luma.Model(gl, Object.assign({}, this.getShaders(), { id: 'reflection-effect', geometry: new _luma.Geometry({ drawMode: _luma.GL.TRIANGLE_FAN, vertices: new Float32Array([0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0]) }) })); this.framebuffer = new _luma.Framebuffer(gl, { depth: true }); } }, { key: 'preDraw', value: function preDraw(_ref2) { var gl = _ref2.gl, layerManager = _ref2.layerManager; var viewport = layerManager.context.viewport; /* * the renderer already has a reference to this, but we don't have a reference to the renderer. * when we refactor the camera code, we should make sure we get a reference to the renderer so * that we can keep this in one place. */ var dpi = typeof window !== 'undefined' && window.devicePixelRatio || 1; this.framebuffer.resize({ width: dpi * viewport.width, height: dpi * viewport.height }); var pitch = viewport.pitch; this.framebuffer.bind(); /* this is a huge hack around the existing viewport class. * TODO in the future, once we implement bona-fide cameras, we really need to fix this. */ layerManager.setViewport(new _webMercatorViewport2.default(Object.assign({}, viewport, { pitch: -180 - pitch }))); gl.clear(_luma.GL.COLOR_BUFFER_BIT | _luma.GL.DEPTH_BUFFER_BIT); layerManager.drawLayers({ pass: 'reflection' }); layerManager.setViewport(viewport); this.framebuffer.unbind(); } }, { key: 'draw', value: function draw(_ref3) { var gl = _ref3.gl, layerManager = _ref3.layerManager; /* * Render our unit quad. * This will cover the entire screen, but will lie behind all other geometry. * This quad will sample the previously generated reflection texture * in order to create the reflection effect */ this.unitQuad.render({ reflectionTexture: this.framebuffer.texture, reflectionTextureWidth: this.framebuffer.width, reflectionTextureHeight: this.framebuffer.height, reflectivity: this.reflectivity, blur: this.blur }); } }, { key: 'finalize', value: function finalize(_ref4) { /* TODO: Free resources? */ var gl = _ref4.gl, layerManager = _ref4.layerManager; } }]); return ReflectionEffect; }(_effect2.default); exports.default = ReflectionEffect; /***/ }), /* 360 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = __webpack_require__(117); var _react2 = _interopRequireDefault(_react); var _autobind = __webpack_require__(197); var _autobind2 = _interopRequireDefault(_autobind); var _inheritsFrom = __webpack_require__(351); var _core = __webpack_require__(13); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var DeckGLJS = _core.experimental.DeckGLJS, log = _core.experimental.log; var DeckGL = function (_React$Component) { _inherits(DeckGL, _React$Component); function DeckGL(props) { _classCallCheck(this, DeckGL); var _this = _possibleConstructorReturn(this, (DeckGL.__proto__ || Object.getPrototypeOf(DeckGL)).call(this, props)); _this.state = {}; _this.children = []; (0, _autobind2.default)(_this); return _this; } _createClass(DeckGL, [{ key: 'componentDidMount', value: function componentDidMount() { this.deck = new DeckGLJS(Object.assign({}, this.props, { canvas: this.overlay })); this._updateFromProps(this.props); } }, { key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { this._updateFromProps(nextProps); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.deck.finalize(); } // Public API }, { key: 'queryObject', value: function queryObject(opts) { log.deprecated('queryObject', 'pickObject'); return this.deck.pickObject(opts); } }, { key: 'pickObject', value: function pickObject(_ref) { var x = _ref.x, y = _ref.y, _ref$radius = _ref.radius, radius = _ref$radius === undefined ? 0 : _ref$radius, _ref$layerIds = _ref.layerIds, layerIds = _ref$layerIds === undefined ? null : _ref$layerIds; return this.deck.pickObject({ x: x, y: y, radius: radius, layerIds: layerIds }); } }, { key: 'queryVisibleObjects', value: function queryVisibleObjects(opts) { log.deprecated('queryVisibleObjects', 'pickObjects'); return this.pickObjects(opts); } }, { key: 'pickObjects', value: function pickObjects(_ref2) { var x = _ref2.x, y = _ref2.y, _ref2$width = _ref2.width, width = _ref2$width === undefined ? 1 : _ref2$width, _ref2$height = _ref2.height, height = _ref2$height === undefined ? 1 : _ref2$height, _ref2$layerIds = _ref2.layerIds, layerIds = _ref2$layerIds === undefined ? null : _ref2$layerIds; return this.deck.pickObjects({ x: x, y: y, width: width, height: height, layerIds: layerIds }); } // Private Helpers // Extract any JSX layers from the react children // Needs to be called both from initial mount, and when new props arrive }, { key: '_updateFromProps', value: function _updateFromProps(nextProps) { // extract any deck.gl layers masquerading as react elements from props.children var _extractJSXLayers2 = this._extractJSXLayers(nextProps.children), layers = _extractJSXLayers2.layers, children = _extractJSXLayers2.children; if (this.deck) { this.deck.setProps(Object.assign({}, nextProps, { // Avoid modifying layers array if no JSX layers were found layers: layers ? [].concat(_toConsumableArray(layers), _toConsumableArray(nextProps.layers)) : nextProps.layers })); } this.children = children; } // extracts any deck.gl layers masquerading as react elements from props.children }, { key: '_extractJSXLayers', value: function _extractJSXLayers(children) { var reactChildren = []; // extract real react elements (i.e. not deck.gl layers) var layers = null; // extracted layer from react children, will add to deck.gl layer array _react2.default.Children.forEach(children, function (reactElement) { if (reactElement) { // For some reason Children.forEach doesn't filter out `null`s var LayerType = reactElement.type; if ((0, _inheritsFrom.inheritsFrom)(LayerType, _core.Layer)) { var layer = new LayerType(reactElement.props); layers = layers || []; layers.push(layer); } else { reactChildren.push(reactElement); } } }); return { layers: layers, children: reactChildren }; } // Iterate over viewport descriptors and render children associate with viewports // at the specified positions // TODO - Can we supply a similar function for the non-React case? }, { key: '_renderChildrenUnderViewports', value: function _renderChildrenUnderViewports(children) { var _this2 = this; // Flatten out nested viewports array var viewports = this.deck ? this.deck.getViewports() : []; // Build a viewport id to viewport index var viewportMap = {}; viewports.forEach(function (viewport) { if (viewport.id) { viewportMap[viewport.id] = viewport; } }); return children.map( // If child specifies props.viewportId, position under viewport, otherwise render as normal function (child, i) { return child.props.viewportId ? _this2._positionChild({ child: child, viewportMap: viewportMap, i: i }) : child; }); } }, { key: '_positionChild', value: function _positionChild(_ref3) { var child = _ref3.child, viewportMap = _ref3.viewportMap, i = _ref3.i; var viewportId = child.props.viewportId; var viewport = viewportId && viewportMap[viewportId]; // Drop (aut-hide) elements with viewportId that are not matched by any current viewport if (!viewport) { return null; } // Resolve potentially relative dimensions using the deck.gl container size var x = viewport.x, y = viewport.y, width = viewport.width, height = viewport.height; // Clone the element with width and height set per viewport var newProps = Object.assign({}, child.props, { width: width, height: height }); // Inject map properties // TODO - this is too react-map-gl specific Object.assign(newProps, viewport.getMercatorParams(), { visible: viewport.isMapSynched() }); var clone = (0, _react.cloneElement)(child, newProps); // Wrap it in an absolutely positioning div var style = { position: 'absolute', left: x, top: y, width: width, height: height }; var key = 'viewport-child-' + viewportId + '-' + i; return (0, _react.createElement)('div', { key: key, id: key, style: style }, clone); } }, { key: 'render', value: function render() { var _this3 = this; // Render the background elements (typically react-map-gl instances) // using the viewport descriptors var children = this._renderChildrenUnderViewports(this.children); // Render deck.gl as last child var _props = this.props, id = _props.id, width = _props.width, height = _props.height, style = _props.style; var deck = (0, _react.createElement)('canvas', { ref: function ref(c) { return _this3.overlay = c; }, key: 'overlay', id: id, style: Object.assign({}, { position: 'absolute', left: 0, top: 0, width: width, height: height }, style) }); children.push(deck); return (0, _react.createElement)('div', { id: 'deckgl-wrapper' }, children); } }]); return DeckGL; }(_react2.default.Component); exports.default = DeckGL; DeckGL.propTypes = DeckGLJS.propTypes; DeckGL.defaultProps = DeckGLJS.defaultProps; /***/ }), /* 361 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = __webpack_require__(117); var _orbitControllerJs = __webpack_require__(189); var _orbitControllerJs2 = _interopRequireDefault(_orbitControllerJs); var _orbitViewport = __webpack_require__(85); var _orbitViewport2 = _interopRequireDefault(_orbitViewport); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var OrbitController = function (_PureComponent) { _inherits(OrbitController, _PureComponent); _createClass(OrbitController, null, [{ key: 'getViewport', // Returns a deck.gl Viewport instance, to be used with the DeckGL component value: function getViewport(viewport) { return new _orbitViewport2.default(viewport); } }]); function OrbitController(props) { _classCallCheck(this, OrbitController); var _this = _possibleConstructorReturn(this, (OrbitController.__proto__ || Object.getPrototypeOf(OrbitController)).call(this, props)); _this.controller = null; return _this; } _createClass(OrbitController, [{ key: 'componentDidMount', value: function componentDidMount() { this.controller = new _orbitControllerJs2.default(Object.assign({}, this.props, { canvas: this.eventCanvas })); } }, { key: 'componentWillUpdate', value: function componentWillUpdate(nextProps) { this.controller.setProps(nextProps); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.controller.finalize(); } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, width = _props.width, height = _props.height; var eventCanvasStyle = { width: width, height: height, position: 'relative' }; return (0, _react.createElement)('div', { key: 'map-controls', ref: function ref(c) { return _this2.eventCanvas = c; }, style: eventCanvasStyle }, this.props.children); } }]); return OrbitController; }(_react.PureComponent); exports.default = OrbitController; OrbitController.displayName = 'OrbitController'; OrbitController.propTypes = _orbitControllerJs2.default.propTypes; OrbitController.defaultProps = _orbitControllerJs2.default.defaultProps; /***/ }), /* 362 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _deckgl = __webpack_require__(360); Object.defineProperty(exports, 'DeckGL', { enumerable: true, get: function get() { return _interopRequireDefault(_deckgl).default; } }); Object.defineProperty(exports, 'default', { enumerable: true, get: function get() { return _interopRequireDefault(_deckgl).default; } }); var _viewportController = __webpack_require__(365); Object.defineProperty(exports, 'ViewportController', { enumerable: true, get: function get() { return _interopRequireDefault(_viewportController).default; } }); var _mapController = __webpack_require__(363); Object.defineProperty(exports, 'MapController', { enumerable: true, get: function get() { return _interopRequireDefault(_mapController).default; } }); var _orbitController = __webpack_require__(361); Object.defineProperty(exports, 'OrbitController', { enumerable: true, get: function get() { return _interopRequireDefault(_orbitController).default; } }); var _autobind = __webpack_require__(197); Object.defineProperty(exports, 'autobind', { enumerable: true, get: function get() { return _interopRequireDefault(_autobind).default; } }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), /* 363 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = __webpack_require__(117); var _mapControllerJs = __webpack_require__(188); var _mapControllerJs2 = _interopRequireDefault(_mapControllerJs); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var MapController = function (_PureComponent) { _inherits(MapController, _PureComponent); function MapController(props) { _classCallCheck(this, MapController); var _this = _possibleConstructorReturn(this, (MapController.__proto__ || Object.getPrototypeOf(MapController)).call(this, props)); _this.controller = null; return _this; } _createClass(MapController, [{ key: 'componentDidMount', value: function componentDidMount() { this.controller = new _mapControllerJs2.default(Object.assign({}, this.props, { canvas: this.eventCanvas })); } }, { key: 'componentWillUpdate', value: function componentWillUpdate(nextProps) { this.controller.setProps(nextProps); } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this.controller.finalize(); } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, width = _props.width, height = _props.height; var eventCanvasStyle = { width: width, height: height, position: 'relative' }; return (0, _react.createElement)('div', { key: 'map-controls', ref: function ref(c) { return _this2.eventCanvas = c; }, style: eventCanvasStyle }, this.props.children); } }]); return MapController; }(_react.PureComponent); exports.default = MapController; MapController.displayName = 'MapController'; MapController.propTypes = _mapControllerJs2.default.propTypes; MapController.defaultProps = _mapControllerJs2.default.defaultProps; /***/ }), /* 364 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // Copyright (c) 2015 Uber Technologies, Inc. // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // import browser from 'bowser'; var PREFIX = '-webkit-'; // browser.webkit || browser.blink ? '-webkit-' : // browser.gecko ? '-moz-' : // ''; exports.default = { GRABBING: PREFIX + 'grabbing', GRAB: PREFIX + 'grab', POINTER: 'pointer' }; /***/ }), /* 365 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _react = __webpack_require__(117); var _propTypes = __webpack_require__(116); var _propTypes2 = _interopRequireDefault(_propTypes); var _mjolnir = __webpack_require__(115); var _core = __webpack_require__(13); var _cursors = __webpack_require__(364); var _cursors2 = _interopRequireDefault(_cursors); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var ViewportControls = _core.experimental.ViewportControls, TransitionManager = _core.experimental.TransitionManager; var propTypes = { viewportState: _propTypes2.default.func, state: _propTypes2.default.object, /** Viewport props */ /** The width of the map. */ width: _propTypes2.default.number.isRequired, /** The height of the map. */ height: _propTypes2.default.number.isRequired, /** The longitude of the center of the map. */ longitude: _propTypes2.default.number.isRequired, /** The latitude of the center of the map. */ latitude: _propTypes2.default.number.isRequired, /** The tile zoom level of the map. */ zoom: _propTypes2.default.number.isRequired, /** Specify the bearing of the viewport */ bearing: _propTypes2.default.number, /** Specify the pitch of the viewport */ pitch: _propTypes2.default.number, /** Altitude of the viewport camera. Default 1.5 "screen heights" */ // Note: Non-public API, see https://github.com/mapbox/mapbox-gl-js/issues/1137 altitude: _propTypes2.default.number, // Camera position for FirstPersonViewport position: _propTypes2.default.array, /** Viewport constraints */ // Max zoom level maxZoom: _propTypes2.default.number, // Min zoom level minZoom: _propTypes2.default.number, // Max pitch in degrees maxPitch: _propTypes2.default.number, // Min pitch in degrees minPitch: _propTypes2.default.number, /** * `onViewportChange` callback is fired when the user interacted with the * map. The object passed to the callback contains viewport properties * such as `longitude`, `latitude`, `zoom` etc. */ onViewportChange: _propTypes2.default.func, /** Viewport transition **/ // transition duration for viewport change transitionDuration: _propTypes2.default.number, // an instance of ViewportTransitionInterpolator, can be used to perform custom transitions. transitionInterpolator: _propTypes2.default.object, // type of interruption of current transition on update. transitionInterruption: _propTypes2.default.number, // easing function transitionEasing: _propTypes2.default.func, // transition status update functions onTransitionStart: _propTypes2.default.func, onTransitionInterrupt: _propTypes2.default.func, onTransitionEnd: _propTypes2.default.func, /** Enables control event handling */ // Scroll to zoom scrollZoom: _propTypes2.default.bool, // Drag to pan dragPan: _propTypes2.default.bool, // Drag to rotate dragRotate: _propTypes2.default.bool, // Double click to zoom doubleClickZoom: _propTypes2.default.bool, // Pinch to zoom / rotate touchZoomRotate: _propTypes2.default.bool, /** Accessor that returns a cursor style to show interactive state */ getCursor: _propTypes2.default.func, // A map control instance to replace the default map controls // The object must expose one property: `events` as an array of subscribed // event names; and two methods: `setState(state)` and `handle(event)` controls: _propTypes2.default.shape({ events: _propTypes2.default.arrayOf(_propTypes2.default.string), handleEvent: _propTypes2.default.func }) }; var getDefaultCursor = function getDefaultCursor(_ref) { var isDragging = _ref.isDragging; return isDragging ? _cursors2.default.GRABBING : _cursors2.default.GRAB; }; var defaultProps = Object.assign({}, TransitionManager.defaultProps, { onViewportChange: null, scrollZoom: true, dragPan: true, dragRotate: true, doubleClickZoom: true, touchZoomRotate: true, getCursor: getDefaultCursor }); var ViewportController = function (_Component) { _inherits(ViewportController, _Component); function ViewportController(props) { _classCallCheck(this, ViewportController); var _this = _possibleConstructorReturn(this, (ViewportController.__proto__ || Object.getPrototypeOf(ViewportController)).call(this, props)); _this.state = { isDragging: false // Whether the cursor is down }; return _this; } _createClass(ViewportController, [{ key: 'componentDidMount', value: function componentDidMount() { this._eventManager = new _mjolnir.EventManager(this.eventCanvas); // If props.controls is not provided, fallback to default MapControls instance // Cannot use defaultProps here because it needs to be per map instance this._controls = this.props.controls || new ViewportControls(this.props.viewportState); this._controls.setOptions(Object.assign({}, this.props, { onStateChange: this._onInteractiveStateChange.bind(this), eventManager: this._eventManager })); this._transitionManger = new TransitionManager(this.props); } }, { key: 'shouldComponentUpdate', value: function shouldComponentUpdate(nextProps, nextState) { if (this._transitionManger) { var transitionTriggered = this._transitionManger.processViewportChange(nextProps); // Skip this render to avoid jump during viewport transitions. return !transitionTriggered; } return true; } }, { key: 'componentWillUpdate', value: function componentWillUpdate(nextProps) { if (this._controls) { this._controls.setOptions(nextProps); } } }, { key: 'componentWillUnmount', value: function componentWillUnmount() { this._eventManager.destroy(); } }, { key: '_onInteractiveStateChange', value: function _onInteractiveStateChange(_ref2) { var _ref2$isDragging = _ref2.isDragging, isDragging = _ref2$isDragging === undefined ? false : _ref2$isDragging; if (isDragging !== this.state.isDragging) { this.setState({ isDragging: isDragging }); } } }, { key: 'render', value: function render() { var _this2 = this; var _props = this.props, width = _props.width, height = _props.height, getCursor = _props.getCursor; var eventCanvasStyle = { width: width, height: height, position: 'relative', cursor: getCursor(this.state) }; return (0, _react.createElement)('div', { key: 'map-controls', ref: function ref(c) { return _this2.eventCanvas = c; }, style: eventCanvasStyle }, this.props.children); } }]); return ViewportController; }(_react.Component); exports.default = ViewportController; ViewportController.displayName = 'ViewportController'; ViewportController.propTypes = propTypes; ViewportController.defaultProps = defaultProps; /***/ }), /* 366 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/** * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * https://raw.github.com/facebook/regenerator/master/LICENSE file. An * additional grant of patent rights can be found in the PATENTS file in * the same directory. */ !(function(global) { "use strict"; var Op = Object.prototype; var hasOwn = Op.hasOwnProperty; var undefined; // More compressible than void 0. var $Symbol = typeof Symbol === "function" ? Symbol : {}; var iteratorSymbol = $Symbol.iterator || "@@iterator"; var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator"; var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; var inModule = typeof module === "object"; var runtime = global.regeneratorRuntime; if (runtime) { if (inModule) { // If regeneratorRuntime is defined globally and we're in a module, // make the exports object identical to regeneratorRuntime. module.exports = runtime; } // Don't bother evaluating the rest of this file if the runtime was // already defined globally. return; } // Define the runtime globally (as expected by generated code) as either // module.exports (if we're in a module) or a new, empty object. runtime = global.regeneratorRuntime = inModule ? module.exports : {}; function wrap(innerFn, outerFn, self, tryLocsList) { // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator. var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator; var generator = Object.create(protoGenerator.prototype); var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next, // .throw, and .return methods. generator._invoke = makeInvokeMethod(innerFn, self, context); return generator; } runtime.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion // record like context.tryEntries[i].completion. This interface could // have been (and was previously) designed to take a closure to be // invoked without arguments, but in all the cases we care about we // already have an existing method we want to call, so there's no need // to create a new function object. We can even get away with assuming // the method takes exactly one argument, since that happens to be true // in every case, so we don't have to touch the arguments object. The // only additional allocation required is the completion record, which // has a stable shape and so hopefully should be cheap to allocate. function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } var GenStateSuspendedStart = "suspendedStart"; var GenStateSuspendedYield = "suspendedYield"; var GenStateExecuting = "executing"; var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as // breaking out of the dispatch switch statement. var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and // .constructor.prototype properties for functions that return Generator // objects. For full spec compliance, you may wish to configure your // minifier not to mangle the names of these two functions. function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that // don't natively support it. var IteratorPrototype = {}; IteratorPrototype[iteratorSymbol] = function () { return this; }; var getProto = Object.getPrototypeOf; var NativeIteratorPrototype = getProto && getProto(getProto(values([]))); if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) { // This environment has a native %IteratorPrototype%; use it instead // of the polyfill. IteratorPrototype = NativeIteratorPrototype; } var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype; GeneratorFunctionPrototype.constructor = GeneratorFunction; GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction"; // Helper for defining the .next, .throw, and .return methods of the // Iterator interface in terms of a single ._invoke method. function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function(method) { prototype[method] = function(arg) { return this._invoke(method, arg); }; }); } runtime.isGeneratorFunction = function(genFun) { var ctor = typeof genFun === "function" && genFun.constructor; return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can // do is to check its .name property. (ctor.displayName || ctor.name) === "GeneratorFunction" : false; }; runtime.mark = function(genFun) { if (Object.setPrototypeOf) { Object.setPrototypeOf(genFun, GeneratorFunctionPrototype); } else { genFun.__proto__ = GeneratorFunctionPrototype; if (!(toStringTagSymbol in genFun)) { genFun[toStringTagSymbol] = "GeneratorFunction"; } } genFun.prototype = Object.create(Gp); return genFun; }; // Within the body of any async function, `await x` is transformed to // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test // `hasOwn.call(value, "__await")` to determine if the yielded value is // meant to be awaited. runtime.awrap = function(arg) { return { __await: arg }; }; function AsyncIterator(generator) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (record.type === "throw") { reject(record.arg); } else { var result = record.arg; var value = result.value; if (value && typeof value === "object" && hasOwn.call(value, "__await")) { return Promise.resolve(value.__await).then(function(value) { invoke("next", value, resolve, reject); }, function(err) { invoke("throw", err, resolve, reject); }); } return Promise.resolve(value).then(function(unwrapped) { // When a yielded Promise is resolved, its final value becomes // the .value of the Promise<{value,done}> result for the // current iteration. If the Promise is rejected, however, the // result for this iteration will be rejected with the same // reason. Note that rejections of yielded Promises are not // thrown back into the generator function, as is the case // when an awaited Promise is rejected. This difference in // behavior between yield and await is important, because it // allows the consumer to decide what to do with the yielded // rejection (swallow it and continue, manually .throw it back // into the generator, abandon iteration, whatever). With // await, by contrast, there is no opportunity to examine the // rejection reason outside the generator function, so the // only option is to throw it from the await expression, and // let the generator function handle the exception. result.value = unwrapped; resolve(result); }, reject); } } if (typeof global.process === "object" && global.process.domain) { invoke = global.process.domain.bind(invoke); } var previousPromise; function enqueue(method, arg) { function callInvokeWithMethodAndArg() { return new Promise(function(resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = // If enqueue has been called before, then we want to wait until // all previous Promises have been resolved before calling invoke, // so that results are always delivered in the correct order. If // enqueue has not been called before, then it is important to // call invoke immediately, without waiting on a callback to fire, // so that the async generator function has the opportunity to do // any necessary setup in a predictable way. This predictability // is why the Promise constructor synchronously invokes its // executor callback, and why async functions synchronously // execute code before the first await. Since we implement simple // async functions in terms of async generators, it is especially // important to get this right, even though it requires care. previousPromise ? previousPromise.then( callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later // invocations of the iterator. callInvokeWithMethodAndArg ) : callInvokeWithMethodAndArg(); } // Define the unified helper method that is used to implement .next, // .throw, and .return (see defineIteratorMethods). this._invoke = enqueue; } defineIteratorMethods(AsyncIterator.prototype); AsyncIterator.prototype[asyncIteratorSymbol] = function () { return this; }; runtime.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of // AsyncIterator objects; they just return a Promise for the value of // the final result produced by the iterator. runtime.async = function(innerFn, outerFn, self, tryLocsList) { var iter = new AsyncIterator( wrap(innerFn, outerFn, self, tryLocsList) ); return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator. : iter.next().then(function(result) { return result.done ? result.value : iter.next(); }); }; function makeInvokeMethod(innerFn, self, context) { var state = GenStateSuspendedStart; return function invoke(method, arg) { if (state === GenStateExecuting) { throw new Error("Generator is already running"); } if (state === GenStateCompleted) { if (method === "throw") { throw arg; } // Be forgiving, per 25.3.3.3.3 of the spec: // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume return doneResult(); } context.method = method; context.arg = arg; while (true) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (context.method === "next") { // Setting context._sent for legacy support of Babel's // function.sent implementation. context.sent = context._sent = context.arg; } else if (context.method === "throw") { if (state === GenStateSuspendedStart) { state = GenStateCompleted; throw context.arg; } context.dispatchException(context.arg); } else if (context.method === "return") { context.abrupt("return", context.arg); } state = GenStateExecuting; var record = tryCatch(innerFn, self, context); if (record.type === "normal") { // If an exception is thrown from innerFn, we leave state === // GenStateExecuting and loop back for another invocation. state = context.done ? GenStateCompleted : GenStateSuspendedYield; if (record.arg === ContinueSentinel) { continue; } return { value: record.arg, done: context.done }; } else if (record.type === "throw") { state = GenStateCompleted; // Dispatch the exception by looping back around to the // context.dispatchException(context.arg) call above. context.method = "throw"; context.arg = record.arg; } } }; } // Call delegate.iterator[context.method](context.arg) and handle the // result, either by returning a { value, done } result from the // delegate iterator, or by modifying context.method and context.arg, // setting context.delegate to null, and returning the ContinueSentinel. function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (method === undefined) { // A .throw or .return when the delegate iterator has no .throw // method always terminates the yield* loop. context.delegate = null; if (context.method === "throw") { if (delegate.iterator.return) { // If the delegate iterator has a return method, give it a // chance to clean up. context.method = "return"; context.arg = undefined; maybeInvokeDelegate(delegate, context); if (context.method === "throw") { // If maybeInvokeDelegate(context) changed context.method from // "return" to "throw", let that override the TypeError below. return ContinueSentinel; } } context.method = "throw"; context.arg = new TypeError( "The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (record.type === "throw") { context.method = "throw"; context.arg = record.arg; context.delegate = null; return ContinueSentinel; } var info = record.arg; if (! info) { context.method = "throw"; context.arg = new TypeError("iterator result is not an object"); context.delegate = null; return ContinueSentinel; } if (info.done) { // Assign the result of the finished delegate to the temporary // variable specified by delegate.resultName (see delegateYield). context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield). context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the // exception, let the outer generator proceed normally. If // context.method was "next", forget context.arg since it has been // "consumed" by the delegate iterator. If context.method was // "return", allow the original .return call to continue in the // outer generator. if (context.method !== "return") { context.method = "next"; context.arg = undefined; } } else { // Re-yield the result returned by the delegate method. return info; } // The delegate iterator is finished, so forget it and continue with // the outer generator. context.delegate = null; return ContinueSentinel; } // Define Generator.prototype.{next,throw,return} in terms of the // unified ._invoke helper method. defineIteratorMethods(Gp); Gp[toStringTagSymbol] = "Generator"; // A Generator should always return itself as the iterator object when the // @@iterator function is called on it. Some browsers' implementations of the // iterator prototype chain incorrectly implement this, causing the Generator // object to not be returned from this call. This ensures that doesn't happen. // See https://github.com/facebook/regenerator/issues/274 for more details. Gp[iteratorSymbol] = function() { return this; }; Gp.toString = function() { return "[object Generator]"; }; function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; if (1 in locs) { entry.catchLoc = locs[1]; } if (2 in locs) { entry.finallyLoc = locs[2]; entry.afterLoc = locs[3]; } this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal"; delete record.arg; entry.completion = record; } function Context(tryLocsList) { // The root entry object (effectively a try statement without a catch // or a finally block) gives us a place to store values thrown from // locations where there is no enclosing try statement. this.tryEntries = [{ tryLoc: "root" }]; tryLocsList.forEach(pushTryEntry, this); this.reset(true); } runtime.keys = function(object) { var keys = []; for (var key in object) { keys.push(key); } keys.reverse(); // Rather than returning an object with a next method, we keep // things simple and return the next function itself. return function next() { while (keys.length) { var key = keys.pop(); if (key in object) { next.value = key; next.done = false; return next; } } // To avoid creating an additional object, we just hang the .value // and .done properties off the next function object itself. This // also ensures that the minifier will not anonymize the function. next.done = true; return next; }; }; function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) { return iteratorMethod.call(iterable); } if (typeof iterable.next === "function") { return iterable; } if (!isNaN(iterable.length)) { var i = -1, next = function next() { while (++i < iterable.length) { if (hasOwn.call(iterable, i)) { next.value = iterable[i]; next.done = false; return next; } } next.value = undefined; next.done = true; return next; }; return next.next = next; } } // Return an iterator with no values. return { next: doneResult }; } runtime.values = values; function doneResult() { return { value: undefined, done: true }; } Context.prototype = { constructor: Context, reset: function(skipTempReset) { this.prev = 0; this.next = 0; // Resetting context._sent for legacy support of Babel's // function.sent implementation. this.sent = this._sent = undefined; this.done = false; this.delegate = null; this.method = "next"; this.arg = undefined; this.tryEntries.forEach(resetTryEntry); if (!skipTempReset) { for (var name in this) { // Not sure about the optimal order of these conditions: if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) { this[name] = undefined; } } } }, stop: function() { this.done = true; var rootEntry = this.tryEntries[0]; var rootRecord = rootEntry.completion; if (rootRecord.type === "throw") { throw rootRecord.arg; } return this.rval; }, dispatchException: function(exception) { if (this.done) { throw exception; } var context = this; function handle(loc, caught) { record.type = "throw"; record.arg = exception; context.next = loc; if (caught) { // If the dispatched exception was caught by a catch block, // then let that catch block handle the exception normally. context.method = "next"; context.arg = undefined; } return !! caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; var record = entry.completion; if (entry.tryLoc === "root") { // Exception thrown outside of any try block that could handle // it, so set the completion value of the entire function to // throw the exception. return handle("end"); } if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"); var hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } else if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else if (hasCatch) { if (this.prev < entry.catchLoc) { return handle(entry.catchLoc, true); } } else if (hasFinally) { if (this.prev < entry.finallyLoc) { return handle(entry.finallyLoc); } } else { throw new Error("try statement without catch or finally"); } } } }, abrupt: function(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) { // Ignore the finally entry if control is not jumping to a // location outside the try/catch block. finallyEntry = null; } var record = finallyEntry ? finallyEntry.completion : {}; record.type = type; record.arg = arg; if (finallyEntry) { this.method = "next"; this.next = finallyEntry.finallyLoc; return ContinueSentinel; } return this.complete(record); }, complete: function(record, afterLoc) { if (record.type === "throw") { throw record.arg; } if (record.type === "break" || record.type === "continue") { this.next = record.arg; } else if (record.type === "return") { this.rval = this.arg = record.arg; this.method = "return"; this.next = "end"; } else if (record.type === "normal" && afterLoc) { this.next = afterLoc; } return ContinueSentinel; }, finish: function(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) { this.complete(entry.completion, entry.afterLoc); resetTryEntry(entry); return ContinueSentinel; } } }, "catch": function(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (record.type === "throw") { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } // The context.catch method must only be called with a location // argument that corresponds to a known catch block. throw new Error("illegal catch attempt"); }, delegateYield: function(iterable, resultName, nextLoc) { this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }; if (this.method === "next") { // Deliberately forget the last sent value so that we don't // accidentally pass it on to the delegate. this.arg = undefined; } return ContinueSentinel; } }; })( // Among the various tricks for obtaining a reference to the global // object, this seems to be the most reliable technique that does not // use indirect eval (which violates Content Security Policy). typeof global === "object" ? global : typeof window === "object" ? window : typeof self === "object" ? self : this ); /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(47))) /***/ }), /* 367 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(374); module.exports = __webpack_require__(33).RegExp.escape; /***/ }), /* 368 */ /***/ (function(module, exports, __webpack_require__) { var isObject = __webpack_require__(5); var isArray = __webpack_require__(91); var SPECIES = __webpack_require__(6)('species'); module.exports = function (original) { var C; if (isArray(original)) { C = original.constructor; // cross-realm fallback if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined; if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } } return C === undefined ? Array : C; }; /***/ }), /* 369 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() var fails = __webpack_require__(4); var getTime = Date.prototype.getTime; var $toISOString = Date.prototype.toISOString; var lz = function (num) { return num > 9 ? num : '0' + num; }; // PhantomJS / old WebKit has a broken implementations module.exports = (fails(function () { return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; }) || !fails(function () { $toISOString.call(new Date(NaN)); })) ? function toISOString() { if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); var d = this; var y = d.getUTCFullYear(); var m = d.getUTCMilliseconds(); var s = y < 0 ? '-' : y > 9999 ? '+' : ''; return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z'; } : $toISOString; /***/ }), /* 370 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var anObject = __webpack_require__(2); var toPrimitive = __webpack_require__(37); var NUMBER = 'number'; module.exports = function (hint) { if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint'); return toPrimitive(anObject(this), hint != NUMBER); }; /***/ }), /* 371 */ /***/ (function(module, exports, __webpack_require__) { // all enumerable object keys, includes symbols var getKeys = __webpack_require__(53); var gOPS = __webpack_require__(95); var pIE = __webpack_require__(73); module.exports = function (it) { var result = getKeys(it); var getSymbols = gOPS.f; if (getSymbols) { var symbols = getSymbols(it); var isEnum = pIE.f; var i = 0; var key; while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key); } return result; }; /***/ }), /* 372 */ /***/ (function(module, exports) { module.exports = function (regExp, replace) { var replacer = replace === Object(replace) ? function (part) { return replace[part]; } : replace; return function (it) { return String(it).replace(regExp, replacer); }; }; /***/ }), /* 373 */ /***/ (function(module, exports) { // 7.2.9 SameValue(x, y) module.exports = Object.is || function is(x, y) { // eslint-disable-next-line no-self-compare return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y; }; /***/ }), /* 374 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/benjamingr/RexExp.escape var $export = __webpack_require__(0); var $re = __webpack_require__(372)(/[\\^$*+?.()|[\]{}]/g, '\\$&'); $export($export.S, 'RegExp', { escape: function escape(it) { return $re(it); } }); /***/ }), /* 375 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length) var $export = __webpack_require__(0); $export($export.P, 'Array', { copyWithin: __webpack_require__(199) }); __webpack_require__(43)('copyWithin'); /***/ }), /* 376 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $every = __webpack_require__(32)(4); $export($export.P + $export.F * !__webpack_require__(29)([].every, true), 'Array', { // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg]) every: function every(callbackfn /* , thisArg */) { return $every(this, callbackfn, arguments[1]); } }); /***/ }), /* 377 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length) var $export = __webpack_require__(0); $export($export.P, 'Array', { fill: __webpack_require__(128) }); __webpack_require__(43)('fill'); /***/ }), /* 378 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $filter = __webpack_require__(32)(2); $export($export.P + $export.F * !__webpack_require__(29)([].filter, true), 'Array', { // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg]) filter: function filter(callbackfn /* , thisArg */) { return $filter(this, callbackfn, arguments[1]); } }); /***/ }), /* 379 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined) var $export = __webpack_require__(0); var $find = __webpack_require__(32)(6); var KEY = 'findIndex'; var forced = true; // Shouldn't skip holes if (KEY in []) Array(1)[KEY](function () { forced = false; }); $export($export.P + $export.F * forced, 'Array', { findIndex: function findIndex(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(43)(KEY); /***/ }), /* 380 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined) var $export = __webpack_require__(0); var $find = __webpack_require__(32)(5); var KEY = 'find'; var forced = true; // Shouldn't skip holes if (KEY in []) Array(1)[KEY](function () { forced = false; }); $export($export.P + $export.F * forced, 'Array', { find: function find(callbackfn /* , that = undefined */) { return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(43)(KEY); /***/ }), /* 381 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $forEach = __webpack_require__(32)(0); var STRICT = __webpack_require__(29)([].forEach, true); $export($export.P + $export.F * !STRICT, 'Array', { // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg]) forEach: function forEach(callbackfn /* , thisArg */) { return $forEach(this, callbackfn, arguments[1]); } }); /***/ }), /* 382 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var ctx = __webpack_require__(28); var $export = __webpack_require__(0); var toObject = __webpack_require__(14); var call = __webpack_require__(210); var isArrayIter = __webpack_require__(136); var toLength = __webpack_require__(11); var createProperty = __webpack_require__(130); var getIterFn = __webpack_require__(153); $export($export.S + $export.F * !__webpack_require__(93)(function (iter) { Array.from(iter); }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) { var O = toObject(arrayLike); var C = typeof this == 'function' ? this : Array; var aLen = arguments.length; var mapfn = aLen > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; var index = 0; var iterFn = getIterFn(O); var length, result, step, iterator; if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2); // if object isn't iterable or it's array with default iterator - use simple case if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) { for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) { createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value); } } else { length = toLength(O.length); for (result = new C(length); length > index; index++) { createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]); } } result.length = index; return result; } }); /***/ }), /* 383 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $indexOf = __webpack_require__(87)(false); var $native = [].indexOf; var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0; $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(29)($native)), 'Array', { // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO // convert -0 to +0 ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]); } }); /***/ }), /* 384 */ /***/ (function(module, exports, __webpack_require__) { // 22.1.2.2 / 15.4.3.2 Array.isArray(arg) var $export = __webpack_require__(0); $export($export.S, 'Array', { isArray: __webpack_require__(91) }); /***/ }), /* 385 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 22.1.3.13 Array.prototype.join(separator) var $export = __webpack_require__(0); var toIObject = __webpack_require__(24); var arrayJoin = [].join; // fallback for not array-like strings $export($export.P + $export.F * (__webpack_require__(72) != Object || !__webpack_require__(29)(arrayJoin)), 'Array', { join: function join(separator) { return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator); } }); /***/ }), /* 386 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toIObject = __webpack_require__(24); var toInteger = __webpack_require__(36); var toLength = __webpack_require__(11); var $native = [].lastIndexOf; var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0; $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(29)($native)), 'Array', { // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex]) lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) { // convert -0 to +0 if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0; var O = toIObject(this); var length = toLength(O.length); var index = length - 1; if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1])); if (index < 0) index = length + index; for (;index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0; return -1; } }); /***/ }), /* 387 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $map = __webpack_require__(32)(1); $export($export.P + $export.F * !__webpack_require__(29)([].map, true), 'Array', { // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg]) map: function map(callbackfn /* , thisArg */) { return $map(this, callbackfn, arguments[1]); } }); /***/ }), /* 388 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var createProperty = __webpack_require__(130); // WebKit Array.of isn't generic $export($export.S + $export.F * __webpack_require__(4)(function () { function F() { /* empty */ } return !(Array.of.call(F) instanceof F); }), 'Array', { // 22.1.2.3 Array.of( ...items) of: function of(/* ...args */) { var index = 0; var aLen = arguments.length; var result = new (typeof this == 'function' ? this : Array)(aLen); while (aLen > index) createProperty(result, index, arguments[index++]); result.length = aLen; return result; } }); /***/ }), /* 389 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $reduce = __webpack_require__(201); $export($export.P + $export.F * !__webpack_require__(29)([].reduceRight, true), 'Array', { // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue]) reduceRight: function reduceRight(callbackfn /* , initialValue */) { return $reduce(this, callbackfn, arguments.length, arguments[1], true); } }); /***/ }), /* 390 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $reduce = __webpack_require__(201); $export($export.P + $export.F * !__webpack_require__(29)([].reduce, true), 'Array', { // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue]) reduce: function reduce(callbackfn /* , initialValue */) { return $reduce(this, callbackfn, arguments.length, arguments[1], false); } }); /***/ }), /* 391 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var html = __webpack_require__(134); var cof = __webpack_require__(27); var toAbsoluteIndex = __webpack_require__(57); var toLength = __webpack_require__(11); var arraySlice = [].slice; // fallback for not array-like ES3 strings and DOM objects $export($export.P + $export.F * __webpack_require__(4)(function () { if (html) arraySlice.call(html); }), 'Array', { slice: function slice(begin, end) { var len = toLength(this.length); var klass = cof(this); end = end === undefined ? len : end; if (klass == 'Array') return arraySlice.call(this, begin, end); var start = toAbsoluteIndex(begin, len); var upTo = toAbsoluteIndex(end, len); var size = toLength(upTo - start); var cloned = new Array(size); var i = 0; for (; i < size; i++) cloned[i] = klass == 'String' ? this.charAt(start + i) : this[start + i]; return cloned; } }); /***/ }), /* 392 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $some = __webpack_require__(32)(3); $export($export.P + $export.F * !__webpack_require__(29)([].some, true), 'Array', { // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg]) some: function some(callbackfn /* , thisArg */) { return $some(this, callbackfn, arguments[1]); } }); /***/ }), /* 393 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var aFunction = __webpack_require__(15); var toObject = __webpack_require__(14); var fails = __webpack_require__(4); var $sort = [].sort; var test = [1, 2, 3]; $export($export.P + $export.F * (fails(function () { // IE8- test.sort(undefined); }) || !fails(function () { // V8 bug test.sort(null); // Old WebKit }) || !__webpack_require__(29)($sort)), 'Array', { // 22.1.3.25 Array.prototype.sort(comparefn) sort: function sort(comparefn) { return comparefn === undefined ? $sort.call(toObject(this)) : $sort.call(toObject(this), aFunction(comparefn)); } }); /***/ }), /* 394 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(56)('Array'); /***/ }), /* 395 */ /***/ (function(module, exports, __webpack_require__) { // 20.3.3.1 / 15.9.4.4 Date.now() var $export = __webpack_require__(0); $export($export.S, 'Date', { now: function () { return new Date().getTime(); } }); /***/ }), /* 396 */ /***/ (function(module, exports, __webpack_require__) { // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString() var $export = __webpack_require__(0); var toISOString = __webpack_require__(369); // PhantomJS / old WebKit has a broken implementations $export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', { toISOString: toISOString }); /***/ }), /* 397 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toObject = __webpack_require__(14); var toPrimitive = __webpack_require__(37); $export($export.P + $export.F * __webpack_require__(4)(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ toISOString: function () { return 1; } }) !== 1; }), 'Date', { // eslint-disable-next-line no-unused-vars toJSON: function toJSON(key) { var O = toObject(this); var pv = toPrimitive(O); return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString(); } }); /***/ }), /* 398 */ /***/ (function(module, exports, __webpack_require__) { var TO_PRIMITIVE = __webpack_require__(6)('toPrimitive'); var proto = Date.prototype; if (!(TO_PRIMITIVE in proto)) __webpack_require__(19)(proto, TO_PRIMITIVE, __webpack_require__(370)); /***/ }), /* 399 */ /***/ (function(module, exports, __webpack_require__) { var DateProto = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING = 'toString'; var $toString = DateProto[TO_STRING]; var getTime = DateProto.getTime; if (new Date(NaN) + '' != INVALID_DATE) { __webpack_require__(20)(DateProto, TO_STRING, function toString() { var value = getTime.call(this); // eslint-disable-next-line no-self-compare return value === value ? $toString.call(this) : INVALID_DATE; }); } /***/ }), /* 400 */ /***/ (function(module, exports, __webpack_require__) { // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...) var $export = __webpack_require__(0); $export($export.P, 'Function', { bind: __webpack_require__(202) }); /***/ }), /* 401 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var isObject = __webpack_require__(5); var getPrototypeOf = __webpack_require__(23); var HAS_INSTANCE = __webpack_require__(6)('hasInstance'); var FunctionProto = Function.prototype; // 19.2.3.6 Function.prototype[@@hasInstance](V) if (!(HAS_INSTANCE in FunctionProto)) __webpack_require__(10).f(FunctionProto, HAS_INSTANCE, { value: function (O) { if (typeof this != 'function' || !isObject(O)) return false; if (!isObject(this.prototype)) return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: while (O = getPrototypeOf(O)) if (this.prototype === O) return true; return false; } }); /***/ }), /* 402 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(10).f; var FProto = Function.prototype; var nameRE = /^\s*function ([^ (]*)/; var NAME = 'name'; // 19.2.4.2 name NAME in FProto || __webpack_require__(9) && dP(FProto, NAME, { configurable: true, get: function () { try { return ('' + this).match(nameRE)[1]; } catch (e) { return ''; } } }); /***/ }), /* 403 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.3 Math.acosh(x) var $export = __webpack_require__(0); var log1p = __webpack_require__(213); var sqrt = Math.sqrt; var $acosh = Math.acosh; $export($export.S + $export.F * !($acosh // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509 && Math.floor($acosh(Number.MAX_VALUE)) == 710 // Tor Browser bug: Math.acosh(Infinity) -> NaN && $acosh(Infinity) == Infinity ), 'Math', { acosh: function acosh(x) { return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? Math.log(x) + Math.LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1)); } }); /***/ }), /* 404 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.5 Math.asinh(x) var $export = __webpack_require__(0); var $asinh = Math.asinh; function asinh(x) { return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1)); } // Tor Browser bug: Math.asinh(0) -> -0 $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', { asinh: asinh }); /***/ }), /* 405 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.7 Math.atanh(x) var $export = __webpack_require__(0); var $atanh = Math.atanh; // Tor Browser bug: Math.atanh(-0) -> 0 $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', { atanh: function atanh(x) { return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2; } }); /***/ }), /* 406 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.9 Math.cbrt(x) var $export = __webpack_require__(0); var sign = __webpack_require__(140); $export($export.S, 'Math', { cbrt: function cbrt(x) { return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3); } }); /***/ }), /* 407 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.11 Math.clz32(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { clz32: function clz32(x) { return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32; } }); /***/ }), /* 408 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.12 Math.cosh(x) var $export = __webpack_require__(0); var exp = Math.exp; $export($export.S, 'Math', { cosh: function cosh(x) { return (exp(x = +x) + exp(-x)) / 2; } }); /***/ }), /* 409 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.14 Math.expm1(x) var $export = __webpack_require__(0); var $expm1 = __webpack_require__(139); $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', { expm1: $expm1 }); /***/ }), /* 410 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.16 Math.fround(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { fround: __webpack_require__(212) }); /***/ }), /* 411 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.17 Math.hypot([value1[, value2[, … ]]]) var $export = __webpack_require__(0); var abs = Math.abs; $export($export.S, 'Math', { hypot: function hypot(value1, value2) { // eslint-disable-line no-unused-vars var sum = 0; var i = 0; var aLen = arguments.length; var larg = 0; var arg, div; while (i < aLen) { arg = abs(arguments[i++]); if (larg < arg) { div = larg / arg; sum = sum * div * div + 1; larg = arg; } else if (arg > 0) { div = arg / larg; sum += div * div; } else sum += arg; } return larg === Infinity ? Infinity : larg * Math.sqrt(sum); } }); /***/ }), /* 412 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.18 Math.imul(x, y) var $export = __webpack_require__(0); var $imul = Math.imul; // some WebKit versions fails with big numbers, some has wrong arity $export($export.S + $export.F * __webpack_require__(4)(function () { return $imul(0xffffffff, 5) != -5 || $imul.length != 2; }), 'Math', { imul: function imul(x, y) { var UINT16 = 0xffff; var xn = +x; var yn = +y; var xl = UINT16 & xn; var yl = UINT16 & yn; return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0); } }); /***/ }), /* 413 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.21 Math.log10(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { log10: function log10(x) { return Math.log(x) * Math.LOG10E; } }); /***/ }), /* 414 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.20 Math.log1p(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { log1p: __webpack_require__(213) }); /***/ }), /* 415 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.22 Math.log2(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { log2: function log2(x) { return Math.log(x) / Math.LN2; } }); /***/ }), /* 416 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.28 Math.sign(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { sign: __webpack_require__(140) }); /***/ }), /* 417 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.30 Math.sinh(x) var $export = __webpack_require__(0); var expm1 = __webpack_require__(139); var exp = Math.exp; // V8 near Chromium 38 has a problem with very small numbers $export($export.S + $export.F * __webpack_require__(4)(function () { return !Math.sinh(-2e-17) != -2e-17; }), 'Math', { sinh: function sinh(x) { return Math.abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2); } }); /***/ }), /* 418 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.33 Math.tanh(x) var $export = __webpack_require__(0); var expm1 = __webpack_require__(139); var exp = Math.exp; $export($export.S, 'Math', { tanh: function tanh(x) { var a = expm1(x = +x); var b = expm1(-x); return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x)); } }); /***/ }), /* 419 */ /***/ (function(module, exports, __webpack_require__) { // 20.2.2.34 Math.trunc(x) var $export = __webpack_require__(0); $export($export.S, 'Math', { trunc: function trunc(it) { return (it > 0 ? Math.floor : Math.ceil)(it); } }); /***/ }), /* 420 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var global = __webpack_require__(3); var has = __webpack_require__(18); var cof = __webpack_require__(27); var inheritIfRequired = __webpack_require__(135); var toPrimitive = __webpack_require__(37); var fails = __webpack_require__(4); var gOPN = __webpack_require__(52).f; var gOPD = __webpack_require__(22).f; var dP = __webpack_require__(10).f; var $trim = __webpack_require__(65).trim; var NUMBER = 'Number'; var $Number = global[NUMBER]; var Base = $Number; var proto = $Number.prototype; // Opera ~12 has broken Object#toString var BROKEN_COF = cof(__webpack_require__(51)(proto)) == NUMBER; var TRIM = 'trim' in String.prototype; // 7.1.3 ToNumber(argument) var toNumber = function (argument) { var it = toPrimitive(argument, false); if (typeof it == 'string' && it.length > 2) { it = TRIM ? it.trim() : $trim(it, 3); var first = it.charCodeAt(0); var third, radix, maxCode; if (first === 43 || first === 45) { third = it.charCodeAt(2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { switch (it.charCodeAt(1)) { case 66: case 98: radix = 2; maxCode = 49; break; // fast equal /^0b[01]+$/i case 79: case 111: radix = 8; maxCode = 55; break; // fast equal /^0o[0-7]+$/i default: return +it; } for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) { code = digits.charCodeAt(i); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; } return parseInt(digits, radix); } } return +it; }; if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) { $Number = function Number(value) { var it = arguments.length < 1 ? 0 : value; var that = this; return that instanceof $Number // check on 1..constructor(foo) case && (BROKEN_COF ? fails(function () { proto.valueOf.call(that); }) : cof(that) != NUMBER) ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it); }; for (var keys = __webpack_require__(9) ? gOPN(Base) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES6 (in case, if modules with ES6 Number statics required before): 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger' ).split(','), j = 0, key; keys.length > j; j++) { if (has(Base, key = keys[j]) && !has($Number, key)) { dP($Number, key, gOPD(Base, key)); } } $Number.prototype = proto; proto.constructor = $Number; __webpack_require__(20)(global, NUMBER, $Number); } /***/ }), /* 421 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.1 Number.EPSILON var $export = __webpack_require__(0); $export($export.S, 'Number', { EPSILON: Math.pow(2, -52) }); /***/ }), /* 422 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.2 Number.isFinite(number) var $export = __webpack_require__(0); var _isFinite = __webpack_require__(3).isFinite; $export($export.S, 'Number', { isFinite: function isFinite(it) { return typeof it == 'number' && _isFinite(it); } }); /***/ }), /* 423 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.3 Number.isInteger(number) var $export = __webpack_require__(0); $export($export.S, 'Number', { isInteger: __webpack_require__(209) }); /***/ }), /* 424 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.4 Number.isNaN(number) var $export = __webpack_require__(0); $export($export.S, 'Number', { isNaN: function isNaN(number) { // eslint-disable-next-line no-self-compare return number != number; } }); /***/ }), /* 425 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.5 Number.isSafeInteger(number) var $export = __webpack_require__(0); var isInteger = __webpack_require__(209); var abs = Math.abs; $export($export.S, 'Number', { isSafeInteger: function isSafeInteger(number) { return isInteger(number) && abs(number) <= 0x1fffffffffffff; } }); /***/ }), /* 426 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.6 Number.MAX_SAFE_INTEGER var $export = __webpack_require__(0); $export($export.S, 'Number', { MAX_SAFE_INTEGER: 0x1fffffffffffff }); /***/ }), /* 427 */ /***/ (function(module, exports, __webpack_require__) { // 20.1.2.10 Number.MIN_SAFE_INTEGER var $export = __webpack_require__(0); $export($export.S, 'Number', { MIN_SAFE_INTEGER: -0x1fffffffffffff }); /***/ }), /* 428 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var $parseFloat = __webpack_require__(221); // 20.1.2.12 Number.parseFloat(string) $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', { parseFloat: $parseFloat }); /***/ }), /* 429 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var $parseInt = __webpack_require__(222); // 20.1.2.13 Number.parseInt(string, radix) $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', { parseInt: $parseInt }); /***/ }), /* 430 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toInteger = __webpack_require__(36); var aNumberValue = __webpack_require__(198); var repeat = __webpack_require__(147); var $toFixed = 1.0.toFixed; var floor = Math.floor; var data = [0, 0, 0, 0, 0, 0]; var ERROR = 'Number.toFixed: incorrect invocation!'; var ZERO = '0'; var multiply = function (n, c) { var i = -1; var c2 = c; while (++i < 6) { c2 += n * data[i]; data[i] = c2 % 1e7; c2 = floor(c2 / 1e7); } }; var divide = function (n) { var i = 6; var c = 0; while (--i >= 0) { c += data[i]; data[i] = floor(c / n); c = (c % n) * 1e7; } }; var numToString = function () { var i = 6; var s = ''; while (--i >= 0) { if (s !== '' || i === 0 || data[i] !== 0) { var t = String(data[i]); s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t; } } return s; }; var pow = function (x, n, acc) { return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); }; var log = function (x) { var n = 0; var x2 = x; while (x2 >= 4096) { n += 12; x2 /= 4096; } while (x2 >= 2) { n += 1; x2 /= 2; } return n; }; $export($export.P + $export.F * (!!$toFixed && ( 0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128.0.toFixed(0) !== '1000000000000000128' ) || !__webpack_require__(4)(function () { // V8 ~ Android 4.3- $toFixed.call({}); })), 'Number', { toFixed: function toFixed(fractionDigits) { var x = aNumberValue(this, ERROR); var f = toInteger(fractionDigits); var s = ''; var m = ZERO; var e, z, j, k; if (f < 0 || f > 20) throw RangeError(ERROR); // eslint-disable-next-line no-self-compare if (x != x) return 'NaN'; if (x <= -1e21 || x >= 1e21) return String(x); if (x < 0) { s = '-'; x = -x; } if (x > 1e-21) { e = log(x * pow(2, 69, 1)) - 69; z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1); z *= 0x10000000000000; e = 52 - e; if (e > 0) { multiply(0, z); j = f; while (j >= 7) { multiply(1e7, 0); j -= 7; } multiply(pow(10, j, 1), 0); j = e - 1; while (j >= 23) { divide(1 << 23); j -= 23; } divide(1 << j); multiply(1, 1); divide(2); m = numToString(); } else { multiply(0, z); multiply(1 << -e, 0); m = numToString() + repeat.call(ZERO, f); } } if (f > 0) { k = m.length; m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f)); } else { m = s + m; } return m; } }); /***/ }), /* 431 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $fails = __webpack_require__(4); var aNumberValue = __webpack_require__(198); var $toPrecision = 1.0.toPrecision; $export($export.P + $export.F * ($fails(function () { // IE7- return $toPrecision.call(1, undefined) !== '1'; }) || !$fails(function () { // V8 ~ Android 4.3- $toPrecision.call({}); })), 'Number', { toPrecision: function toPrecision(precision) { var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!'); return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision); } }); /***/ }), /* 432 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) var $export = __webpack_require__(0); $export($export.S + $export.F, 'Object', { assign: __webpack_require__(215) }); /***/ }), /* 433 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) $export($export.S, 'Object', { create: __webpack_require__(51) }); /***/ }), /* 434 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties) $export($export.S + $export.F * !__webpack_require__(9), 'Object', { defineProperties: __webpack_require__(216) }); /***/ }), /* 435 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes) $export($export.S + $export.F * !__webpack_require__(9), 'Object', { defineProperty: __webpack_require__(10).f }); /***/ }), /* 436 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.5 Object.freeze(O) var isObject = __webpack_require__(5); var meta = __webpack_require__(44).onFreeze; __webpack_require__(35)('freeze', function ($freeze) { return function freeze(it) { return $freeze && isObject(it) ? $freeze(meta(it)) : it; }; }); /***/ }), /* 437 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) var toIObject = __webpack_require__(24); var $getOwnPropertyDescriptor = __webpack_require__(22).f; __webpack_require__(35)('getOwnPropertyDescriptor', function () { return function getOwnPropertyDescriptor(it, key) { return $getOwnPropertyDescriptor(toIObject(it), key); }; }); /***/ }), /* 438 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.7 Object.getOwnPropertyNames(O) __webpack_require__(35)('getOwnPropertyNames', function () { return __webpack_require__(217).f; }); /***/ }), /* 439 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 Object.getPrototypeOf(O) var toObject = __webpack_require__(14); var $getPrototypeOf = __webpack_require__(23); __webpack_require__(35)('getPrototypeOf', function () { return function getPrototypeOf(it) { return $getPrototypeOf(toObject(it)); }; }); /***/ }), /* 440 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.11 Object.isExtensible(O) var isObject = __webpack_require__(5); __webpack_require__(35)('isExtensible', function ($isExtensible) { return function isExtensible(it) { return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; }; }); /***/ }), /* 441 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.12 Object.isFrozen(O) var isObject = __webpack_require__(5); __webpack_require__(35)('isFrozen', function ($isFrozen) { return function isFrozen(it) { return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; }; }); /***/ }), /* 442 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.13 Object.isSealed(O) var isObject = __webpack_require__(5); __webpack_require__(35)('isSealed', function ($isSealed) { return function isSealed(it) { return isObject(it) ? $isSealed ? $isSealed(it) : false : true; }; }); /***/ }), /* 443 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.10 Object.is(value1, value2) var $export = __webpack_require__(0); $export($export.S, 'Object', { is: __webpack_require__(373) }); /***/ }), /* 444 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 Object.keys(O) var toObject = __webpack_require__(14); var $keys = __webpack_require__(53); __webpack_require__(35)('keys', function () { return function keys(it) { return $keys(toObject(it)); }; }); /***/ }), /* 445 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.15 Object.preventExtensions(O) var isObject = __webpack_require__(5); var meta = __webpack_require__(44).onFreeze; __webpack_require__(35)('preventExtensions', function ($preventExtensions) { return function preventExtensions(it) { return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it; }; }); /***/ }), /* 446 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.17 Object.seal(O) var isObject = __webpack_require__(5); var meta = __webpack_require__(44).onFreeze; __webpack_require__(35)('seal', function ($seal) { return function seal(it) { return $seal && isObject(it) ? $seal(meta(it)) : it; }; }); /***/ }), /* 447 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.19 Object.setPrototypeOf(O, proto) var $export = __webpack_require__(0); $export($export.S, 'Object', { setPrototypeOf: __webpack_require__(143).set }); /***/ }), /* 448 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.3.6 Object.prototype.toString() var classof = __webpack_require__(71); var test = {}; test[__webpack_require__(6)('toStringTag')] = 'z'; if (test + '' != '[object z]') { __webpack_require__(20)(Object.prototype, 'toString', function toString() { return '[object ' + classof(this) + ']'; }, true); } /***/ }), /* 449 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var $parseFloat = __webpack_require__(221); // 18.2.4 parseFloat(string) $export($export.G + $export.F * (parseFloat != $parseFloat), { parseFloat: $parseFloat }); /***/ }), /* 450 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var $parseInt = __webpack_require__(222); // 18.2.5 parseInt(string, radix) $export($export.G + $export.F * (parseInt != $parseInt), { parseInt: $parseInt }); /***/ }), /* 451 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var LIBRARY = __webpack_require__(50); var global = __webpack_require__(3); var ctx = __webpack_require__(28); var classof = __webpack_require__(71); var $export = __webpack_require__(0); var isObject = __webpack_require__(5); var aFunction = __webpack_require__(15); var anInstance = __webpack_require__(48); var forOf = __webpack_require__(49); var speciesConstructor = __webpack_require__(99); var task = __webpack_require__(149).set; var microtask = __webpack_require__(141)(); var newPromiseCapabilityModule = __webpack_require__(142); var perform = __webpack_require__(223); var promiseResolve = __webpack_require__(224); var PROMISE = 'Promise'; var TypeError = global.TypeError; var process = global.process; var $Promise = global[PROMISE]; var isNode = classof(process) == 'process'; var empty = function () { /* empty */ }; var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper; var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f; var USE_NATIVE = !!function () { try { // correct subclassing with @@species support var promise = $Promise.resolve(1); var FakePromise = (promise.constructor = {})[__webpack_require__(6)('species')] = function (exec) { exec(empty, empty); }; // unhandled rejections tracking support, NodeJS Promise without it fails @@species test return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise; } catch (e) { /* empty */ } }(); // helpers var isThenable = function (it) { var then; return isObject(it) && typeof (then = it.then) == 'function' ? then : false; }; var notify = function (promise, isReject) { if (promise._n) return; promise._n = true; var chain = promise._c; microtask(function () { var value = promise._v; var ok = promise._s == 1; var i = 0; var run = function (reaction) { var handler = ok ? reaction.ok : reaction.fail; var resolve = reaction.resolve; var reject = reaction.reject; var domain = reaction.domain; var result, then; try { if (handler) { if (!ok) { if (promise._h == 2) onHandleUnhandled(promise); promise._h = 1; } if (handler === true) result = value; else { if (domain) domain.enter(); result = handler(value); if (domain) domain.exit(); } if (result === reaction.promise) { reject(TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { then.call(result, resolve, reject); } else resolve(result); } else reject(value); } catch (e) { reject(e); } }; while (chain.length > i) run(chain[i++]); // variable length - can't use forEach promise._c = []; promise._n = false; if (isReject && !promise._h) onUnhandled(promise); }); }; var onUnhandled = function (promise) { task.call(global, function () { var value = promise._v; var unhandled = isUnhandled(promise); var result, handler, console; if (unhandled) { result = perform(function () { if (isNode) { process.emit('unhandledRejection', value, promise); } else if (handler = global.onunhandledrejection) { handler({ promise: promise, reason: value }); } else if ((console = global.console) && console.error) { console.error('Unhandled promise rejection', value); } }); // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should promise._h = isNode || isUnhandled(promise) ? 2 : 1; } promise._a = undefined; if (unhandled && result.e) throw result.v; }); }; var isUnhandled = function (promise) { return promise._h !== 1 && (promise._a || promise._c).length === 0; }; var onHandleUnhandled = function (promise) { task.call(global, function () { var handler; if (isNode) { process.emit('rejectionHandled', promise); } else if (handler = global.onrejectionhandled) { handler({ promise: promise, reason: promise._v }); } }); }; var $reject = function (value) { var promise = this; if (promise._d) return; promise._d = true; promise = promise._w || promise; // unwrap promise._v = value; promise._s = 2; if (!promise._a) promise._a = promise._c.slice(); notify(promise, true); }; var $resolve = function (value) { var promise = this; var then; if (promise._d) return; promise._d = true; promise = promise._w || promise; // unwrap try { if (promise === value) throw TypeError("Promise can't be resolved itself"); if (then = isThenable(value)) { microtask(function () { var wrapper = { _w: promise, _d: false }; // wrap try { then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1)); } catch (e) { $reject.call(wrapper, e); } }); } else { promise._v = value; promise._s = 1; notify(promise, false); } } catch (e) { $reject.call({ _w: promise, _d: false }, e); // wrap } }; // constructor polyfill if (!USE_NATIVE) { // 25.4.3.1 Promise(executor) $Promise = function Promise(executor) { anInstance(this, $Promise, PROMISE, '_h'); aFunction(executor); Internal.call(this); try { executor(ctx($resolve, this, 1), ctx($reject, this, 1)); } catch (err) { $reject.call(this, err); } }; // eslint-disable-next-line no-unused-vars Internal = function Promise(executor) { this._c = []; // <- awaiting reactions this._a = undefined; // <- checked in isUnhandled reactions this._s = 0; // <- state this._d = false; // <- done this._v = undefined; // <- value this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; Internal.prototype = __webpack_require__(55)($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected) { var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; reaction.fail = typeof onRejected == 'function' && onRejected; reaction.domain = isNode ? process.domain : undefined; this._c.push(reaction); if (this._a) this._a.push(reaction); if (this._s) notify(this, false); return reaction.promise; }, // 25.4.5.1 Promise.prototype.catch(onRejected) 'catch': function (onRejected) { return this.then(undefined, onRejected); } }); OwnPromiseCapability = function () { var promise = new Internal(); this.promise = promise; this.resolve = ctx($resolve, promise, 1); this.reject = ctx($reject, promise, 1); }; newPromiseCapabilityModule.f = newPromiseCapability = function (C) { return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); __webpack_require__(64)($Promise, PROMISE); __webpack_require__(56)(PROMISE); Wrapper = __webpack_require__(33)[PROMISE]; // statics $export($export.S + $export.F * !USE_NATIVE, PROMISE, { // 25.4.4.5 Promise.reject(r) reject: function reject(r) { var capability = newPromiseCapability(this); var $$reject = capability.reject; $$reject(r); return capability.promise; } }); $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { // 25.4.4.6 Promise.resolve(x) resolve: function resolve(x) { return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); } }); $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(93)(function (iter) { $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) all: function all(iterable) { var C = this; var capability = newPromiseCapability(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { var values = []; var index = 0; var remaining = 1; forOf(iterable, false, function (promise) { var $index = index++; var alreadyCalled = false; values.push(undefined); remaining++; C.resolve(promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[$index] = value; --remaining || resolve(values); }, reject); }); --remaining || resolve(values); }); if (result.e) reject(result.v); return capability.promise; }, // 25.4.4.4 Promise.race(iterable) race: function race(iterable) { var C = this; var capability = newPromiseCapability(C); var reject = capability.reject; var result = perform(function () { forOf(iterable, false, function (promise) { C.resolve(promise).then(capability.resolve, reject); }); }); if (result.e) reject(result.v); return capability.promise; } }); /***/ }), /* 452 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.1 Reflect.apply(target, thisArgument, argumentsList) var $export = __webpack_require__(0); var aFunction = __webpack_require__(15); var anObject = __webpack_require__(2); var rApply = (__webpack_require__(3).Reflect || {}).apply; var fApply = Function.apply; // MS Edge argumentsList argument is optional $export($export.S + $export.F * !__webpack_require__(4)(function () { rApply(function () { /* empty */ }); }), 'Reflect', { apply: function apply(target, thisArgument, argumentsList) { var T = aFunction(target); var L = anObject(argumentsList); return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L); } }); /***/ }), /* 453 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.2 Reflect.construct(target, argumentsList [, newTarget]) var $export = __webpack_require__(0); var create = __webpack_require__(51); var aFunction = __webpack_require__(15); var anObject = __webpack_require__(2); var isObject = __webpack_require__(5); var fails = __webpack_require__(4); var bind = __webpack_require__(202); var rConstruct = (__webpack_require__(3).Reflect || {}).construct; // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it var NEW_TARGET_BUG = fails(function () { function F() { /* empty */ } return !(rConstruct(function () { /* empty */ }, [], F) instanceof F); }); var ARGS_BUG = !fails(function () { rConstruct(function () { /* empty */ }); }); $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', { construct: function construct(Target, args /* , newTarget */) { aFunction(Target); anObject(args); var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget); if (Target == newTarget) { // w/o altered newTarget, optimization for 0-4 arguments switch (args.length) { case 0: return new Target(); case 1: return new Target(args[0]); case 2: return new Target(args[0], args[1]); case 3: return new Target(args[0], args[1], args[2]); case 4: return new Target(args[0], args[1], args[2], args[3]); } // w/o altered newTarget, lot of arguments case var $args = [null]; $args.push.apply($args, args); return new (bind.apply(Target, $args))(); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype; var instance = create(isObject(proto) ? proto : Object.prototype); var result = Function.apply.call(Target, instance, args); return isObject(result) ? result : instance; } }); /***/ }), /* 454 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes) var dP = __webpack_require__(10); var $export = __webpack_require__(0); var anObject = __webpack_require__(2); var toPrimitive = __webpack_require__(37); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false $export($export.S + $export.F * __webpack_require__(4)(function () { // eslint-disable-next-line no-undef Reflect.defineProperty(dP.f({}, 1, { value: 1 }), 1, { value: 2 }); }), 'Reflect', { defineProperty: function defineProperty(target, propertyKey, attributes) { anObject(target); propertyKey = toPrimitive(propertyKey, true); anObject(attributes); try { dP.f(target, propertyKey, attributes); return true; } catch (e) { return false; } } }); /***/ }), /* 455 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.4 Reflect.deleteProperty(target, propertyKey) var $export = __webpack_require__(0); var gOPD = __webpack_require__(22).f; var anObject = __webpack_require__(2); $export($export.S, 'Reflect', { deleteProperty: function deleteProperty(target, propertyKey) { var desc = gOPD(anObject(target), propertyKey); return desc && !desc.configurable ? false : delete target[propertyKey]; } }); /***/ }), /* 456 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 26.1.5 Reflect.enumerate(target) var $export = __webpack_require__(0); var anObject = __webpack_require__(2); var Enumerate = function (iterated) { this._t = anObject(iterated); // target this._i = 0; // next index var keys = this._k = []; // keys var key; for (key in iterated) keys.push(key); }; __webpack_require__(137)(Enumerate, 'Object', function () { var that = this; var keys = that._k; var key; do { if (that._i >= keys.length) return { value: undefined, done: true }; } while (!((key = keys[that._i++]) in that._t)); return { value: key, done: false }; }); $export($export.S, 'Reflect', { enumerate: function enumerate(target) { return new Enumerate(target); } }); /***/ }), /* 457 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey) var gOPD = __webpack_require__(22); var $export = __webpack_require__(0); var anObject = __webpack_require__(2); $export($export.S, 'Reflect', { getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) { return gOPD.f(anObject(target), propertyKey); } }); /***/ }), /* 458 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.8 Reflect.getPrototypeOf(target) var $export = __webpack_require__(0); var getProto = __webpack_require__(23); var anObject = __webpack_require__(2); $export($export.S, 'Reflect', { getPrototypeOf: function getPrototypeOf(target) { return getProto(anObject(target)); } }); /***/ }), /* 459 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.6 Reflect.get(target, propertyKey [, receiver]) var gOPD = __webpack_require__(22); var getPrototypeOf = __webpack_require__(23); var has = __webpack_require__(18); var $export = __webpack_require__(0); var isObject = __webpack_require__(5); var anObject = __webpack_require__(2); function get(target, propertyKey /* , receiver */) { var receiver = arguments.length < 3 ? target : arguments[2]; var desc, proto; if (anObject(target) === receiver) return target[propertyKey]; if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') ? desc.value : desc.get !== undefined ? desc.get.call(receiver) : undefined; if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver); } $export($export.S, 'Reflect', { get: get }); /***/ }), /* 460 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.9 Reflect.has(target, propertyKey) var $export = __webpack_require__(0); $export($export.S, 'Reflect', { has: function has(target, propertyKey) { return propertyKey in target; } }); /***/ }), /* 461 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.10 Reflect.isExtensible(target) var $export = __webpack_require__(0); var anObject = __webpack_require__(2); var $isExtensible = Object.isExtensible; $export($export.S, 'Reflect', { isExtensible: function isExtensible(target) { anObject(target); return $isExtensible ? $isExtensible(target) : true; } }); /***/ }), /* 462 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.11 Reflect.ownKeys(target) var $export = __webpack_require__(0); $export($export.S, 'Reflect', { ownKeys: __webpack_require__(220) }); /***/ }), /* 463 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.12 Reflect.preventExtensions(target) var $export = __webpack_require__(0); var anObject = __webpack_require__(2); var $preventExtensions = Object.preventExtensions; $export($export.S, 'Reflect', { preventExtensions: function preventExtensions(target) { anObject(target); try { if ($preventExtensions) $preventExtensions(target); return true; } catch (e) { return false; } } }); /***/ }), /* 464 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.14 Reflect.setPrototypeOf(target, proto) var $export = __webpack_require__(0); var setProto = __webpack_require__(143); if (setProto) $export($export.S, 'Reflect', { setPrototypeOf: function setPrototypeOf(target, proto) { setProto.check(target, proto); try { setProto.set(target, proto); return true; } catch (e) { return false; } } }); /***/ }), /* 465 */ /***/ (function(module, exports, __webpack_require__) { // 26.1.13 Reflect.set(target, propertyKey, V [, receiver]) var dP = __webpack_require__(10); var gOPD = __webpack_require__(22); var getPrototypeOf = __webpack_require__(23); var has = __webpack_require__(18); var $export = __webpack_require__(0); var createDesc = __webpack_require__(54); var anObject = __webpack_require__(2); var isObject = __webpack_require__(5); function set(target, propertyKey, V /* , receiver */) { var receiver = arguments.length < 4 ? target : arguments[3]; var ownDesc = gOPD.f(anObject(target), propertyKey); var existingDescriptor, proto; if (!ownDesc) { if (isObject(proto = getPrototypeOf(target))) { return set(proto, propertyKey, V, receiver); } ownDesc = createDesc(0); } if (has(ownDesc, 'value')) { if (ownDesc.writable === false || !isObject(receiver)) return false; existingDescriptor = gOPD.f(receiver, propertyKey) || createDesc(0); existingDescriptor.value = V; dP.f(receiver, propertyKey, existingDescriptor); return true; } return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true); } $export($export.S, 'Reflect', { set: set }); /***/ }), /* 466 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(3); var inheritIfRequired = __webpack_require__(135); var dP = __webpack_require__(10).f; var gOPN = __webpack_require__(52).f; var isRegExp = __webpack_require__(92); var $flags = __webpack_require__(90); var $RegExp = global.RegExp; var Base = $RegExp; var proto = $RegExp.prototype; var re1 = /a/g; var re2 = /a/g; // "new" creates a new object, old webkit buggy here var CORRECT_NEW = new $RegExp(re1) !== re1; if (__webpack_require__(9) && (!CORRECT_NEW || __webpack_require__(4)(function () { re2[__webpack_require__(6)('match')] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i'; }))) { $RegExp = function RegExp(p, f) { var tiRE = this instanceof $RegExp; var piRE = isRegExp(p); var fiU = f === undefined; return !tiRE && piRE && p.constructor === $RegExp && fiU ? p : inheritIfRequired(CORRECT_NEW ? new Base(piRE && !fiU ? p.source : p, f) : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f) , tiRE ? this : proto, $RegExp); }; var proxy = function (key) { key in $RegExp || dP($RegExp, key, { configurable: true, get: function () { return Base[key]; }, set: function (it) { Base[key] = it; } }); }; for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]); proto.constructor = $RegExp; $RegExp.prototype = proto; __webpack_require__(20)(global, 'RegExp', $RegExp); } __webpack_require__(56)('RegExp'); /***/ }), /* 467 */ /***/ (function(module, exports, __webpack_require__) { // @@match logic __webpack_require__(89)('match', 1, function (defined, MATCH, $match) { // 21.1.3.11 String.prototype.match(regexp) return [function match(regexp) { 'use strict'; var O = defined(this); var fn = regexp == undefined ? undefined : regexp[MATCH]; return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O)); }, $match]; }); /***/ }), /* 468 */ /***/ (function(module, exports, __webpack_require__) { // @@replace logic __webpack_require__(89)('replace', 2, function (defined, REPLACE, $replace) { // 21.1.3.14 String.prototype.replace(searchValue, replaceValue) return [function replace(searchValue, replaceValue) { 'use strict'; var O = defined(this); var fn = searchValue == undefined ? undefined : searchValue[REPLACE]; return fn !== undefined ? fn.call(searchValue, O, replaceValue) : $replace.call(String(O), searchValue, replaceValue); }, $replace]; }); /***/ }), /* 469 */ /***/ (function(module, exports, __webpack_require__) { // @@search logic __webpack_require__(89)('search', 1, function (defined, SEARCH, $search) { // 21.1.3.15 String.prototype.search(regexp) return [function search(regexp) { 'use strict'; var O = defined(this); var fn = regexp == undefined ? undefined : regexp[SEARCH]; return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O)); }, $search]; }); /***/ }), /* 470 */ /***/ (function(module, exports, __webpack_require__) { // @@split logic __webpack_require__(89)('split', 2, function (defined, SPLIT, $split) { 'use strict'; var isRegExp = __webpack_require__(92); var _split = $split; var $push = [].push; var $SPLIT = 'split'; var LENGTH = 'length'; var LAST_INDEX = 'lastIndex'; if ( 'abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH] ) { var NPCG = /()??/.exec('')[1] === undefined; // nonparticipating capturing group // based on es5-shim implementation, need to rework it $split = function (separator, limit) { var string = String(this); if (separator === undefined && limit === 0) return []; // If `separator` is not a regex, use native split if (!isRegExp(separator)) return _split.call(string, separator, limit); var output = []; var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : ''); var lastLastIndex = 0; var splitLimit = limit === undefined ? 4294967295 : limit >>> 0; // Make `global` and avoid `lastIndex` issues by working with a copy var separatorCopy = new RegExp(separator.source, flags + 'g'); var separator2, match, lastIndex, lastLength, i; // Doesn't need flags gy, but they don't hurt if (!NPCG) separator2 = new RegExp('^' + separatorCopy.source + '$(?!\\s)', flags); while (match = separatorCopy.exec(string)) { // `separatorCopy.lastIndex` is not reliable cross-browser lastIndex = match.index + match[0][LENGTH]; if (lastIndex > lastLastIndex) { output.push(string.slice(lastLastIndex, match.index)); // Fix browsers whose `exec` methods don't consistently return `undefined` for NPCG // eslint-disable-next-line no-loop-func if (!NPCG && match[LENGTH] > 1) match[0].replace(separator2, function () { for (i = 1; i < arguments[LENGTH] - 2; i++) if (arguments[i] === undefined) match[i] = undefined; }); if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1)); lastLength = match[0][LENGTH]; lastLastIndex = lastIndex; if (output[LENGTH] >= splitLimit) break; } if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop } if (lastLastIndex === string[LENGTH]) { if (lastLength || !separatorCopy.test('')) output.push(''); } else output.push(string.slice(lastLastIndex)); return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output; }; // Chakra, V8 } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) { $split = function (separator, limit) { return separator === undefined && limit === 0 ? [] : _split.call(this, separator, limit); }; } // 21.1.3.17 String.prototype.split(separator, limit) return [function split(separator, limit) { var O = defined(this); var fn = separator == undefined ? undefined : separator[SPLIT]; return fn !== undefined ? fn.call(separator, O, limit) : $split.call(String(O), separator, limit); }, $split]; }); /***/ }), /* 471 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; __webpack_require__(229); var anObject = __webpack_require__(2); var $flags = __webpack_require__(90); var DESCRIPTORS = __webpack_require__(9); var TO_STRING = 'toString'; var $toString = /./[TO_STRING]; var define = function (fn) { __webpack_require__(20)(RegExp.prototype, TO_STRING, fn, true); }; // 21.2.5.14 RegExp.prototype.toString() if (__webpack_require__(4)(function () { return $toString.call({ source: 'a', flags: 'b' }) != '/a/b'; })) { define(function toString() { var R = anObject(this); return '/'.concat(R.source, '/', 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined); }); // FF44- RegExp#toString has a wrong name } else if ($toString.name != TO_STRING) { define(function toString() { return $toString.call(this); }); } /***/ }), /* 472 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.2 String.prototype.anchor(name) __webpack_require__(21)('anchor', function (createHTML) { return function anchor(name) { return createHTML(this, 'a', 'name', name); }; }); /***/ }), /* 473 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.3 String.prototype.big() __webpack_require__(21)('big', function (createHTML) { return function big() { return createHTML(this, 'big', '', ''); }; }); /***/ }), /* 474 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.4 String.prototype.blink() __webpack_require__(21)('blink', function (createHTML) { return function blink() { return createHTML(this, 'blink', '', ''); }; }); /***/ }), /* 475 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.5 String.prototype.bold() __webpack_require__(21)('bold', function (createHTML) { return function bold() { return createHTML(this, 'b', '', ''); }; }); /***/ }), /* 476 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $at = __webpack_require__(145)(false); $export($export.P, 'String', { // 21.1.3.3 String.prototype.codePointAt(pos) codePointAt: function codePointAt(pos) { return $at(this, pos); } }); /***/ }), /* 477 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition]) var $export = __webpack_require__(0); var toLength = __webpack_require__(11); var context = __webpack_require__(146); var ENDS_WITH = 'endsWith'; var $endsWith = ''[ENDS_WITH]; $export($export.P + $export.F * __webpack_require__(133)(ENDS_WITH), 'String', { endsWith: function endsWith(searchString /* , endPosition = @length */) { var that = context(this, searchString, ENDS_WITH); var endPosition = arguments.length > 1 ? arguments[1] : undefined; var len = toLength(that.length); var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len); var search = String(searchString); return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; } }); /***/ }), /* 478 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.6 String.prototype.fixed() __webpack_require__(21)('fixed', function (createHTML) { return function fixed() { return createHTML(this, 'tt', '', ''); }; }); /***/ }), /* 479 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.7 String.prototype.fontcolor(color) __webpack_require__(21)('fontcolor', function (createHTML) { return function fontcolor(color) { return createHTML(this, 'font', 'color', color); }; }); /***/ }), /* 480 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.8 String.prototype.fontsize(size) __webpack_require__(21)('fontsize', function (createHTML) { return function fontsize(size) { return createHTML(this, 'font', 'size', size); }; }); /***/ }), /* 481 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var toAbsoluteIndex = __webpack_require__(57); var fromCharCode = String.fromCharCode; var $fromCodePoint = String.fromCodePoint; // length should be 1, old FF problem $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', { // 21.1.2.2 String.fromCodePoint(...codePoints) fromCodePoint: function fromCodePoint(x) { // eslint-disable-line no-unused-vars var res = []; var aLen = arguments.length; var i = 0; var code; while (aLen > i) { code = +arguments[i++]; if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point'); res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00) ); } return res.join(''); } }); /***/ }), /* 482 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.7 String.prototype.includes(searchString, position = 0) var $export = __webpack_require__(0); var context = __webpack_require__(146); var INCLUDES = 'includes'; $export($export.P + $export.F * __webpack_require__(133)(INCLUDES), 'String', { includes: function includes(searchString /* , position = 0 */) { return !!~context(this, searchString, INCLUDES) .indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), /* 483 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.9 String.prototype.italics() __webpack_require__(21)('italics', function (createHTML) { return function italics() { return createHTML(this, 'i', '', ''); }; }); /***/ }), /* 484 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $at = __webpack_require__(145)(true); // 21.1.3.27 String.prototype[@@iterator]() __webpack_require__(138)(String, 'String', function (iterated) { this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() }, function () { var O = this._t; var index = this._i; var point; if (index >= O.length) return { value: undefined, done: true }; point = $at(O, index); this._i += point.length; return { value: point, done: false }; }); /***/ }), /* 485 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.10 String.prototype.link(url) __webpack_require__(21)('link', function (createHTML) { return function link(url) { return createHTML(this, 'a', 'href', url); }; }); /***/ }), /* 486 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var toIObject = __webpack_require__(24); var toLength = __webpack_require__(11); $export($export.S, 'String', { // 21.1.2.4 String.raw(callSite, ...substitutions) raw: function raw(callSite) { var tpl = toIObject(callSite.raw); var len = toLength(tpl.length); var aLen = arguments.length; var res = []; var i = 0; while (len > i) { res.push(String(tpl[i++])); if (i < aLen) res.push(String(arguments[i])); } return res.join(''); } }); /***/ }), /* 487 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); $export($export.P, 'String', { // 21.1.3.13 String.prototype.repeat(count) repeat: __webpack_require__(147) }); /***/ }), /* 488 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.11 String.prototype.small() __webpack_require__(21)('small', function (createHTML) { return function small() { return createHTML(this, 'small', '', ''); }; }); /***/ }), /* 489 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.18 String.prototype.startsWith(searchString [, position ]) var $export = __webpack_require__(0); var toLength = __webpack_require__(11); var context = __webpack_require__(146); var STARTS_WITH = 'startsWith'; var $startsWith = ''[STARTS_WITH]; $export($export.P + $export.F * __webpack_require__(133)(STARTS_WITH), 'String', { startsWith: function startsWith(searchString /* , position = 0 */) { var that = context(this, searchString, STARTS_WITH); var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = String(searchString); return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; } }); /***/ }), /* 490 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.12 String.prototype.strike() __webpack_require__(21)('strike', function (createHTML) { return function strike() { return createHTML(this, 'strike', '', ''); }; }); /***/ }), /* 491 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.13 String.prototype.sub() __webpack_require__(21)('sub', function (createHTML) { return function sub() { return createHTML(this, 'sub', '', ''); }; }); /***/ }), /* 492 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // B.2.3.14 String.prototype.sup() __webpack_require__(21)('sup', function (createHTML) { return function sup() { return createHTML(this, 'sup', '', ''); }; }); /***/ }), /* 493 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 21.1.3.25 String.prototype.trim() __webpack_require__(65)('trim', function ($trim) { return function trim() { return $trim(this, 3); }; }); /***/ }), /* 494 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // ECMAScript 6 symbols shim var global = __webpack_require__(3); var has = __webpack_require__(18); var DESCRIPTORS = __webpack_require__(9); var $export = __webpack_require__(0); var redefine = __webpack_require__(20); var META = __webpack_require__(44).KEY; var $fails = __webpack_require__(4); var shared = __webpack_require__(98); var setToStringTag = __webpack_require__(64); var uid = __webpack_require__(58); var wks = __webpack_require__(6); var wksExt = __webpack_require__(227); var wksDefine = __webpack_require__(152); var enumKeys = __webpack_require__(371); var isArray = __webpack_require__(91); var anObject = __webpack_require__(2); var isObject = __webpack_require__(5); var toIObject = __webpack_require__(24); var toPrimitive = __webpack_require__(37); var createDesc = __webpack_require__(54); var _create = __webpack_require__(51); var gOPNExt = __webpack_require__(217); var $GOPD = __webpack_require__(22); var $DP = __webpack_require__(10); var $keys = __webpack_require__(53); var gOPD = $GOPD.f; var dP = $DP.f; var gOPN = gOPNExt.f; var $Symbol = global.Symbol; var $JSON = global.JSON; var _stringify = $JSON && $JSON.stringify; var PROTOTYPE = 'prototype'; var HIDDEN = wks('_hidden'); var TO_PRIMITIVE = wks('toPrimitive'); var isEnum = {}.propertyIsEnumerable; var SymbolRegistry = shared('symbol-registry'); var AllSymbols = shared('symbols'); var OPSymbols = shared('op-symbols'); var ObjectProto = Object[PROTOTYPE]; var USE_NATIVE = typeof $Symbol == 'function'; var QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 var setSymbolDesc = DESCRIPTORS && $fails(function () { return _create(dP({}, 'a', { get: function () { return dP(this, 'a', { value: 7 }).a; } })).a != 7; }) ? function (it, key, D) { var protoDesc = gOPD(ObjectProto, key); if (protoDesc) delete ObjectProto[key]; dP(it, key, D); if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc); } : dP; var wrap = function (tag) { var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]); sym._k = tag; return sym; }; var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) { return typeof it == 'symbol'; } : function (it) { return it instanceof $Symbol; }; var $defineProperty = function defineProperty(it, key, D) { if (it === ObjectProto) $defineProperty(OPSymbols, key, D); anObject(it); key = toPrimitive(key, true); anObject(D); if (has(AllSymbols, key)) { if (!D.enumerable) { if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {})); it[HIDDEN][key] = true; } else { if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false; D = _create(D, { enumerable: createDesc(0, false) }); } return setSymbolDesc(it, key, D); } return dP(it, key, D); }; var $defineProperties = function defineProperties(it, P) { anObject(it); var keys = enumKeys(P = toIObject(P)); var i = 0; var l = keys.length; var key; while (l > i) $defineProperty(it, key = keys[i++], P[key]); return it; }; var $create = function create(it, P) { return P === undefined ? _create(it) : $defineProperties(_create(it), P); }; var $propertyIsEnumerable = function propertyIsEnumerable(key) { var E = isEnum.call(this, key = toPrimitive(key, true)); if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false; return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) { it = toIObject(it); key = toPrimitive(key, true); if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return; var D = gOPD(it, key); if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true; return D; }; var $getOwnPropertyNames = function getOwnPropertyNames(it) { var names = gOPN(toIObject(it)); var result = []; var i = 0; var key; while (names.length > i) { if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key); } return result; }; var $getOwnPropertySymbols = function getOwnPropertySymbols(it) { var IS_OP = it === ObjectProto; var names = gOPN(IS_OP ? OPSymbols : toIObject(it)); var result = []; var i = 0; var key; while (names.length > i) { if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]); } return result; }; // 19.4.1.1 Symbol([description]) if (!USE_NATIVE) { $Symbol = function Symbol() { if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!'); var tag = uid(arguments.length > 0 ? arguments[0] : undefined); var $set = function (value) { if (this === ObjectProto) $set.call(OPSymbols, value); if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDesc(this, tag, createDesc(1, value)); }; if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set }); return wrap(tag); }; redefine($Symbol[PROTOTYPE], 'toString', function toString() { return this._k; }); $GOPD.f = $getOwnPropertyDescriptor; $DP.f = $defineProperty; __webpack_require__(52).f = gOPNExt.f = $getOwnPropertyNames; __webpack_require__(73).f = $propertyIsEnumerable; __webpack_require__(95).f = $getOwnPropertySymbols; if (DESCRIPTORS && !__webpack_require__(50)) { redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true); } wksExt.f = function (name) { return wrap(wks(name)); }; } $export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol }); for (var es6Symbols = ( // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables' ).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]); for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]); $export($export.S + $export.F * !USE_NATIVE, 'Symbol', { // 19.4.2.1 Symbol.for(key) 'for': function (key) { return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key); }, // 19.4.2.5 Symbol.keyFor(sym) keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!'); for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key; }, useSetter: function () { setter = true; }, useSimple: function () { setter = false; } }); $export($export.S + $export.F * !USE_NATIVE, 'Object', { // 19.1.2.2 Object.create(O [, Properties]) create: $create, // 19.1.2.4 Object.defineProperty(O, P, Attributes) defineProperty: $defineProperty, // 19.1.2.3 Object.defineProperties(O, Properties) defineProperties: $defineProperties, // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P) getOwnPropertyDescriptor: $getOwnPropertyDescriptor, // 19.1.2.7 Object.getOwnPropertyNames(O) getOwnPropertyNames: $getOwnPropertyNames, // 19.1.2.8 Object.getOwnPropertySymbols(O) getOwnPropertySymbols: $getOwnPropertySymbols }); // 24.3.2 JSON.stringify(value [, replacer [, space]]) $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () { var S = $Symbol(); // MS Edge converts symbol values to JSON as {} // WebKit converts symbol values to JSON as null // V8 throws on boxed symbols return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}'; })), 'JSON', { stringify: function stringify(it) { var args = [it]; var i = 1; var replacer, $replacer; while (arguments.length > i) args.push(arguments[i++]); $replacer = replacer = args[1]; if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { if (typeof $replacer == 'function') value = $replacer.call(this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; return _stringify.apply($JSON, args); } }); // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint) $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(19)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); // 19.4.3.5 Symbol.prototype[@@toStringTag] setToStringTag($Symbol, 'Symbol'); // 20.2.1.9 Math[@@toStringTag] setToStringTag(Math, 'Math', true); // 24.3.3 JSON[@@toStringTag] setToStringTag(global.JSON, 'JSON', true); /***/ }), /* 495 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var $typed = __webpack_require__(100); var buffer = __webpack_require__(150); var anObject = __webpack_require__(2); var toAbsoluteIndex = __webpack_require__(57); var toLength = __webpack_require__(11); var isObject = __webpack_require__(5); var ArrayBuffer = __webpack_require__(3).ArrayBuffer; var speciesConstructor = __webpack_require__(99); var $ArrayBuffer = buffer.ArrayBuffer; var $DataView = buffer.DataView; var $isView = $typed.ABV && ArrayBuffer.isView; var $slice = $ArrayBuffer.prototype.slice; var VIEW = $typed.VIEW; var ARRAY_BUFFER = 'ArrayBuffer'; $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), { ArrayBuffer: $ArrayBuffer }); $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, { // 24.1.3.1 ArrayBuffer.isView(arg) isView: function isView(it) { return $isView && $isView(it) || isObject(it) && VIEW in it; } }); $export($export.P + $export.U + $export.F * __webpack_require__(4)(function () { return !new $ArrayBuffer(2).slice(1, undefined).byteLength; }), ARRAY_BUFFER, { // 24.1.4.3 ArrayBuffer.prototype.slice(start, end) slice: function slice(start, end) { if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix var len = anObject(this).byteLength; var first = toAbsoluteIndex(start, len); var final = toAbsoluteIndex(end === undefined ? len : end, len); var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(final - first)); var viewS = new $DataView(this); var viewT = new $DataView(result); var index = 0; while (first < final) { viewT.setUint8(index++, viewS.getUint8(first++)); } return result; } }); __webpack_require__(56)(ARRAY_BUFFER); /***/ }), /* 496 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); $export($export.G + $export.W + $export.F * !__webpack_require__(100).ABV, { DataView: __webpack_require__(150).DataView }); /***/ }), /* 497 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Float32', 4, function (init) { return function Float32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 498 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Float64', 8, function (init) { return function Float64Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 499 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Int16', 2, function (init) { return function Int16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 500 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Int32', 4, function (init) { return function Int32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 501 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Int8', 1, function (init) { return function Int8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 502 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Uint16', 2, function (init) { return function Uint16Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 503 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Uint32', 4, function (init) { return function Uint32Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 504 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Uint8', 1, function (init) { return function Uint8Array(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }); /***/ }), /* 505 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(40)('Uint8', 1, function (init) { return function Uint8ClampedArray(data, byteOffset, length) { return init(this, data, byteOffset, length); }; }, true); /***/ }), /* 506 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var weak = __webpack_require__(205); var validate = __webpack_require__(66); var WEAK_SET = 'WeakSet'; // 23.4 WeakSet Objects __webpack_require__(88)(WEAK_SET, function (get) { return function WeakSet() { return get(this, arguments.length > 0 ? arguments[0] : undefined); }; }, { // 23.4.3.1 WeakSet.prototype.add(value) add: function add(value) { return weak.def(validate(this, WEAK_SET), value, true); } }, weak, false, true); /***/ }), /* 507 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap var $export = __webpack_require__(0); var flattenIntoArray = __webpack_require__(206); var toObject = __webpack_require__(14); var toLength = __webpack_require__(11); var aFunction = __webpack_require__(15); var arraySpeciesCreate = __webpack_require__(129); $export($export.P, 'Array', { flatMap: function flatMap(callbackfn /* , thisArg */) { var O = toObject(this); var sourceLen, A; aFunction(callbackfn); sourceLen = toLength(O.length); A = arraySpeciesCreate(O, 0); flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]); return A; } }); __webpack_require__(43)('flatMap'); /***/ }), /* 508 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten var $export = __webpack_require__(0); var flattenIntoArray = __webpack_require__(206); var toObject = __webpack_require__(14); var toLength = __webpack_require__(11); var toInteger = __webpack_require__(36); var arraySpeciesCreate = __webpack_require__(129); $export($export.P, 'Array', { flatten: function flatten(/* depthArg = 1 */) { var depthArg = arguments[0]; var O = toObject(this); var sourceLen = toLength(O.length); var A = arraySpeciesCreate(O, 0); flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); return A; } }); __webpack_require__(43)('flatten'); /***/ }), /* 509 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/Array.prototype.includes var $export = __webpack_require__(0); var $includes = __webpack_require__(87)(true); $export($export.P, 'Array', { includes: function includes(el /* , fromIndex = 0 */) { return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined); } }); __webpack_require__(43)('includes'); /***/ }), /* 510 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask var $export = __webpack_require__(0); var microtask = __webpack_require__(141)(); var process = __webpack_require__(3).process; var isNode = __webpack_require__(27)(process) == 'process'; $export($export.G, { asap: function asap(fn) { var domain = isNode && process.domain; microtask(domain ? domain.bind(fn) : fn); } }); /***/ }), /* 511 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/ljharb/proposal-is-error var $export = __webpack_require__(0); var cof = __webpack_require__(27); $export($export.S, 'Error', { isError: function isError(it) { return cof(it) === 'Error'; } }); /***/ }), /* 512 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-global var $export = __webpack_require__(0); $export($export.G, { global: __webpack_require__(3) }); /***/ }), /* 513 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from __webpack_require__(96)('Map'); /***/ }), /* 514 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of __webpack_require__(97)('Map'); /***/ }), /* 515 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var $export = __webpack_require__(0); $export($export.P + $export.R, 'Map', { toJSON: __webpack_require__(204)('Map') }); /***/ }), /* 516 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); $export($export.S, 'Math', { clamp: function clamp(x, lower, upper) { return Math.min(upper, Math.max(lower, x)); } }); /***/ }), /* 517 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); $export($export.S, 'Math', { DEG_PER_RAD: Math.PI / 180 }); /***/ }), /* 518 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); var RAD_PER_DEG = 180 / Math.PI; $export($export.S, 'Math', { degrees: function degrees(radians) { return radians * RAD_PER_DEG; } }); /***/ }), /* 519 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); var scale = __webpack_require__(214); var fround = __webpack_require__(212); $export($export.S, 'Math', { fscale: function fscale(x, inLow, inHigh, outLow, outHigh) { return fround(scale(x, inLow, inHigh, outLow, outHigh)); } }); /***/ }), /* 520 */ /***/ (function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(0); $export($export.S, 'Math', { iaddh: function iaddh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; var $y0 = y0 >>> 0; return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0; } }); /***/ }), /* 521 */ /***/ (function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(0); $export($export.S, 'Math', { imulh: function imulh(u, v) { var UINT16 = 0xffff; var $u = +u; var $v = +v; var u0 = $u & UINT16; var v0 = $v & UINT16; var u1 = $u >> 16; var v1 = $v >> 16; var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16); } }); /***/ }), /* 522 */ /***/ (function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(0); $export($export.S, 'Math', { isubh: function isubh(x0, x1, y0, y1) { var $x0 = x0 >>> 0; var $x1 = x1 >>> 0; var $y0 = y0 >>> 0; return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0; } }); /***/ }), /* 523 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); $export($export.S, 'Math', { RAD_PER_DEG: 180 / Math.PI }); /***/ }), /* 524 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); var DEG_PER_RAD = Math.PI / 180; $export($export.S, 'Math', { radians: function radians(degrees) { return degrees * DEG_PER_RAD; } }); /***/ }), /* 525 */ /***/ (function(module, exports, __webpack_require__) { // https://rwaldron.github.io/proposal-math-extensions/ var $export = __webpack_require__(0); $export($export.S, 'Math', { scale: __webpack_require__(214) }); /***/ }), /* 526 */ /***/ (function(module, exports, __webpack_require__) { // http://jfbastien.github.io/papers/Math.signbit.html var $export = __webpack_require__(0); $export($export.S, 'Math', { signbit: function signbit(x) { // eslint-disable-next-line no-self-compare return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0; } }); /***/ }), /* 527 */ /***/ (function(module, exports, __webpack_require__) { // https://gist.github.com/BrendanEich/4294d5c212a6d2254703 var $export = __webpack_require__(0); $export($export.S, 'Math', { umulh: function umulh(u, v) { var UINT16 = 0xffff; var $u = +u; var $v = +v; var u0 = $u & UINT16; var v0 = $v & UINT16; var u1 = $u >>> 16; var v1 = $v >>> 16; var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16); return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16); } }); /***/ }), /* 528 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toObject = __webpack_require__(14); var aFunction = __webpack_require__(15); var $defineProperty = __webpack_require__(10); // B.2.2.2 Object.prototype.__defineGetter__(P, getter) __webpack_require__(9) && $export($export.P + __webpack_require__(94), 'Object', { __defineGetter__: function __defineGetter__(P, getter) { $defineProperty.f(toObject(this), P, { get: aFunction(getter), enumerable: true, configurable: true }); } }); /***/ }), /* 529 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toObject = __webpack_require__(14); var aFunction = __webpack_require__(15); var $defineProperty = __webpack_require__(10); // B.2.2.3 Object.prototype.__defineSetter__(P, setter) __webpack_require__(9) && $export($export.P + __webpack_require__(94), 'Object', { __defineSetter__: function __defineSetter__(P, setter) { $defineProperty.f(toObject(this), P, { set: aFunction(setter), enumerable: true, configurable: true }); } }); /***/ }), /* 530 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(0); var $entries = __webpack_require__(219)(true); $export($export.S, 'Object', { entries: function entries(it) { return $entries(it); } }); /***/ }), /* 531 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-getownpropertydescriptors var $export = __webpack_require__(0); var ownKeys = __webpack_require__(220); var toIObject = __webpack_require__(24); var gOPD = __webpack_require__(22); var createProperty = __webpack_require__(130); $export($export.S, 'Object', { getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) { var O = toIObject(object); var getDesc = gOPD.f; var keys = ownKeys(O); var result = {}; var i = 0; var key, desc; while (keys.length > i) { desc = getDesc(O, key = keys[i++]); if (desc !== undefined) createProperty(result, key, desc); } return result; } }); /***/ }), /* 532 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toObject = __webpack_require__(14); var toPrimitive = __webpack_require__(37); var getPrototypeOf = __webpack_require__(23); var getOwnPropertyDescriptor = __webpack_require__(22).f; // B.2.2.4 Object.prototype.__lookupGetter__(P) __webpack_require__(9) && $export($export.P + __webpack_require__(94), 'Object', { __lookupGetter__: function __lookupGetter__(P) { var O = toObject(this); var K = toPrimitive(P, true); var D; do { if (D = getOwnPropertyDescriptor(O, K)) return D.get; } while (O = getPrototypeOf(O)); } }); /***/ }), /* 533 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var $export = __webpack_require__(0); var toObject = __webpack_require__(14); var toPrimitive = __webpack_require__(37); var getPrototypeOf = __webpack_require__(23); var getOwnPropertyDescriptor = __webpack_require__(22).f; // B.2.2.5 Object.prototype.__lookupSetter__(P) __webpack_require__(9) && $export($export.P + __webpack_require__(94), 'Object', { __lookupSetter__: function __lookupSetter__(P) { var O = toObject(this); var K = toPrimitive(P, true); var D; do { if (D = getOwnPropertyDescriptor(O, K)) return D.set; } while (O = getPrototypeOf(O)); } }); /***/ }), /* 534 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-object-values-entries var $export = __webpack_require__(0); var $values = __webpack_require__(219)(false); $export($export.S, 'Object', { values: function values(it) { return $values(it); } }); /***/ }), /* 535 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/zenparsing/es-observable var $export = __webpack_require__(0); var global = __webpack_require__(3); var core = __webpack_require__(33); var microtask = __webpack_require__(141)(); var OBSERVABLE = __webpack_require__(6)('observable'); var aFunction = __webpack_require__(15); var anObject = __webpack_require__(2); var anInstance = __webpack_require__(48); var redefineAll = __webpack_require__(55); var hide = __webpack_require__(19); var forOf = __webpack_require__(49); var RETURN = forOf.RETURN; var getMethod = function (fn) { return fn == null ? undefined : aFunction(fn); }; var cleanupSubscription = function (subscription) { var cleanup = subscription._c; if (cleanup) { subscription._c = undefined; cleanup(); } }; var subscriptionClosed = function (subscription) { return subscription._o === undefined; }; var closeSubscription = function (subscription) { if (!subscriptionClosed(subscription)) { subscription._o = undefined; cleanupSubscription(subscription); } }; var Subscription = function (observer, subscriber) { anObject(observer); this._c = undefined; this._o = observer; observer = new SubscriptionObserver(this); try { var cleanup = subscriber(observer); var subscription = cleanup; if (cleanup != null) { if (typeof cleanup.unsubscribe === 'function') cleanup = function () { subscription.unsubscribe(); }; else aFunction(cleanup); this._c = cleanup; } } catch (e) { observer.error(e); return; } if (subscriptionClosed(this)) cleanupSubscription(this); }; Subscription.prototype = redefineAll({}, { unsubscribe: function unsubscribe() { closeSubscription(this); } }); var SubscriptionObserver = function (subscription) { this._s = subscription; }; SubscriptionObserver.prototype = redefineAll({}, { next: function next(value) { var subscription = this._s; if (!subscriptionClosed(subscription)) { var observer = subscription._o; try { var m = getMethod(observer.next); if (m) return m.call(observer, value); } catch (e) { try { closeSubscription(subscription); } finally { throw e; } } } }, error: function error(value) { var subscription = this._s; if (subscriptionClosed(subscription)) throw value; var observer = subscription._o; subscription._o = undefined; try { var m = getMethod(observer.error); if (!m) throw value; value = m.call(observer, value); } catch (e) { try { cleanupSubscription(subscription); } finally { throw e; } } cleanupSubscription(subscription); return value; }, complete: function complete(value) { var subscription = this._s; if (!subscriptionClosed(subscription)) { var observer = subscription._o; subscription._o = undefined; try { var m = getMethod(observer.complete); value = m ? m.call(observer, value) : undefined; } catch (e) { try { cleanupSubscription(subscription); } finally { throw e; } } cleanupSubscription(subscription); return value; } } }); var $Observable = function Observable(subscriber) { anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber); }; redefineAll($Observable.prototype, { subscribe: function subscribe(observer) { return new Subscription(observer, this._f); }, forEach: function forEach(fn) { var that = this; return new (core.Promise || global.Promise)(function (resolve, reject) { aFunction(fn); var subscription = that.subscribe({ next: function (value) { try { return fn(value); } catch (e) { reject(e); subscription.unsubscribe(); } }, error: reject, complete: resolve }); }); } }); redefineAll($Observable, { from: function from(x) { var C = typeof this === 'function' ? this : $Observable; var method = getMethod(anObject(x)[OBSERVABLE]); if (method) { var observable = anObject(method.call(x)); return observable.constructor === C ? observable : new C(function (observer) { return observable.subscribe(observer); }); } return new C(function (observer) { var done = false; microtask(function () { if (!done) { try { if (forOf(x, false, function (it) { observer.next(it); if (done) return RETURN; }) === RETURN) return; } catch (e) { if (done) throw e; observer.error(e); return; } observer.complete(); } }); return function () { done = true; }; }); }, of: function of() { for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++]; return new (typeof this === 'function' ? this : $Observable)(function (observer) { var done = false; microtask(function () { if (!done) { for (var j = 0; j < items.length; ++j) { observer.next(items[j]); if (done) return; } observer.complete(); } }); return function () { done = true; }; }); } }); hide($Observable.prototype, OBSERVABLE, function () { return this; }); $export($export.G, { Observable: $Observable }); __webpack_require__(56)('Observable'); /***/ }), /* 536 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-promise-finally var $export = __webpack_require__(0); var core = __webpack_require__(33); var global = __webpack_require__(3); var speciesConstructor = __webpack_require__(99); var promiseResolve = __webpack_require__(224); $export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) { var C = speciesConstructor(this, core.Promise || global.Promise); var isFunction = typeof onFinally == 'function'; return this.then( isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; }); } : onFinally, isFunction ? function (e) { return promiseResolve(C, onFinally()).then(function () { throw e; }); } : onFinally ); } }); /***/ }), /* 537 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-promise-try var $export = __webpack_require__(0); var newPromiseCapability = __webpack_require__(142); var perform = __webpack_require__(223); $export($export.S, 'Promise', { 'try': function (callbackfn) { var promiseCapability = newPromiseCapability.f(this); var result = perform(callbackfn); (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v); return promiseCapability.promise; } }); /***/ }), /* 538 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var toMetaKey = metadata.key; var ordinaryDefineOwnMetadata = metadata.set; metadata.exp({ defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) { ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey)); } }); /***/ }), /* 539 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var toMetaKey = metadata.key; var getOrCreateMetadataMap = metadata.map; var store = metadata.store; metadata.exp({ deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) { var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]); var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false); if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false; if (metadataMap.size) return true; var targetMetadata = store.get(target); targetMetadata['delete'](targetKey); return !!targetMetadata.size || store['delete'](target); } }); /***/ }), /* 540 */ /***/ (function(module, exports, __webpack_require__) { var Set = __webpack_require__(230); var from = __webpack_require__(200); var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var getPrototypeOf = __webpack_require__(23); var ordinaryOwnMetadataKeys = metadata.keys; var toMetaKey = metadata.key; var ordinaryMetadataKeys = function (O, P) { var oKeys = ordinaryOwnMetadataKeys(O, P); var parent = getPrototypeOf(O); if (parent === null) return oKeys; var pKeys = ordinaryMetadataKeys(parent, P); return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys; }; metadata.exp({ getMetadataKeys: function getMetadataKeys(target /* , targetKey */) { return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); } }); /***/ }), /* 541 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var getPrototypeOf = __webpack_require__(23); var ordinaryHasOwnMetadata = metadata.has; var ordinaryGetOwnMetadata = metadata.get; var toMetaKey = metadata.key; var ordinaryGetMetadata = function (MetadataKey, O, P) { var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P); var parent = getPrototypeOf(O); return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined; }; metadata.exp({ getMetadata: function getMetadata(metadataKey, target /* , targetKey */) { return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); } }); /***/ }), /* 542 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var ordinaryOwnMetadataKeys = metadata.keys; var toMetaKey = metadata.key; metadata.exp({ getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) { return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1])); } }); /***/ }), /* 543 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var ordinaryGetOwnMetadata = metadata.get; var toMetaKey = metadata.key; metadata.exp({ getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) { return ordinaryGetOwnMetadata(metadataKey, anObject(target) , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); } }); /***/ }), /* 544 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var getPrototypeOf = __webpack_require__(23); var ordinaryHasOwnMetadata = metadata.has; var toMetaKey = metadata.key; var ordinaryHasMetadata = function (MetadataKey, O, P) { var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P); if (hasOwn) return true; var parent = getPrototypeOf(O); return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false; }; metadata.exp({ hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) { return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2])); } }); /***/ }), /* 545 */ /***/ (function(module, exports, __webpack_require__) { var metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var ordinaryHasOwnMetadata = metadata.has; var toMetaKey = metadata.key; metadata.exp({ hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) { return ordinaryHasOwnMetadata(metadataKey, anObject(target) , arguments.length < 3 ? undefined : toMetaKey(arguments[2])); } }); /***/ }), /* 546 */ /***/ (function(module, exports, __webpack_require__) { var $metadata = __webpack_require__(39); var anObject = __webpack_require__(2); var aFunction = __webpack_require__(15); var toMetaKey = $metadata.key; var ordinaryDefineOwnMetadata = $metadata.set; $metadata.exp({ metadata: function metadata(metadataKey, metadataValue) { return function decorator(target, targetKey) { ordinaryDefineOwnMetadata( metadataKey, metadataValue, (targetKey !== undefined ? anObject : aFunction)(target), toMetaKey(targetKey) ); }; } }); /***/ }), /* 547 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from __webpack_require__(96)('Set'); /***/ }), /* 548 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of __webpack_require__(97)('Set'); /***/ }), /* 549 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/DavidBruant/Map-Set.prototype.toJSON var $export = __webpack_require__(0); $export($export.P + $export.R, 'Set', { toJSON: __webpack_require__(204)('Set') }); /***/ }), /* 550 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/mathiasbynens/String.prototype.at var $export = __webpack_require__(0); var $at = __webpack_require__(145)(true); $export($export.P, 'String', { at: function at(pos) { return $at(this, pos); } }); /***/ }), /* 551 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://tc39.github.io/String.prototype.matchAll/ var $export = __webpack_require__(0); var defined = __webpack_require__(34); var toLength = __webpack_require__(11); var isRegExp = __webpack_require__(92); var getFlags = __webpack_require__(90); var RegExpProto = RegExp.prototype; var $RegExpStringIterator = function (regexp, string) { this._r = regexp; this._s = string; }; __webpack_require__(137)($RegExpStringIterator, 'RegExp String', function next() { var match = this._r.exec(this._s); return { value: match, done: match === null }; }); $export($export.P, 'String', { matchAll: function matchAll(regexp) { defined(this); if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!'); var S = String(this); var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp); var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags); rx.lastIndex = toLength(regexp.lastIndex); return new $RegExpStringIterator(rx, S); } }); /***/ }), /* 552 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(0); var $pad = __webpack_require__(225); var userAgent = __webpack_require__(151); // https://github.com/zloirock/core-js/issues/280 $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { padEnd: function padEnd(maxLength /* , fillString = ' ' */) { return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false); } }); /***/ }), /* 553 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/tc39/proposal-string-pad-start-end var $export = __webpack_require__(0); var $pad = __webpack_require__(225); var userAgent = __webpack_require__(151); // https://github.com/zloirock/core-js/issues/280 $export($export.P + $export.F * /Version\/10\.\d+(\.\d+)? Safari\//.test(userAgent), 'String', { padStart: function padStart(maxLength /* , fillString = ' ' */) { return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true); } }); /***/ }), /* 554 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim __webpack_require__(65)('trimLeft', function ($trim) { return function trimLeft() { return $trim(this, 1); }; }, 'trimStart'); /***/ }), /* 555 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // https://github.com/sebmarkbage/ecmascript-string-left-right-trim __webpack_require__(65)('trimRight', function ($trim) { return function trimRight() { return $trim(this, 2); }; }, 'trimEnd'); /***/ }), /* 556 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(152)('asyncIterator'); /***/ }), /* 557 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(152)('observable'); /***/ }), /* 558 */ /***/ (function(module, exports, __webpack_require__) { // https://github.com/tc39/proposal-global var $export = __webpack_require__(0); $export($export.S, 'System', { global: __webpack_require__(3) }); /***/ }), /* 559 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from __webpack_require__(96)('WeakMap'); /***/ }), /* 560 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of __webpack_require__(97)('WeakMap'); /***/ }), /* 561 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from __webpack_require__(96)('WeakSet'); /***/ }), /* 562 */ /***/ (function(module, exports, __webpack_require__) { // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of __webpack_require__(97)('WeakSet'); /***/ }), /* 563 */ /***/ (function(module, exports, __webpack_require__) { var $iterators = __webpack_require__(154); var getKeys = __webpack_require__(53); var redefine = __webpack_require__(20); var global = __webpack_require__(3); var hide = __webpack_require__(19); var Iterators = __webpack_require__(63); var wks = __webpack_require__(6); var ITERATOR = wks('iterator'); var TO_STRING_TAG = wks('toStringTag'); var ArrayValues = Iterators.Array; var DOMIterables = { CSSRuleList: true, // TODO: Not spec compliant, should be false. CSSStyleDeclaration: false, CSSValueList: false, ClientRectList: false, DOMRectList: false, DOMStringList: false, DOMTokenList: true, DataTransferItemList: false, FileList: false, HTMLAllCollection: false, HTMLCollection: false, HTMLFormElement: false, HTMLSelectElement: false, MediaList: true, // TODO: Not spec compliant, should be false. MimeTypeArray: false, NamedNodeMap: false, NodeList: true, PaintRequestList: false, Plugin: false, PluginArray: false, SVGLengthList: false, SVGNumberList: false, SVGPathSegList: false, SVGPointList: false, SVGStringList: false, SVGTransformList: false, SourceBufferList: false, StyleSheetList: true, // TODO: Not spec compliant, should be false. TextTrackCueList: false, TextTrackList: false, TouchList: false }; for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) { var NAME = collections[i]; var explicit = DOMIterables[NAME]; var Collection = global[NAME]; var proto = Collection && Collection.prototype; var key; if (proto) { if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues); if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME); Iterators[NAME] = ArrayValues; if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true); } } /***/ }), /* 564 */ /***/ (function(module, exports, __webpack_require__) { var $export = __webpack_require__(0); var $task = __webpack_require__(149); $export($export.G + $export.B, { setImmediate: $task.set, clearImmediate: $task.clear }); /***/ }), /* 565 */ /***/ (function(module, exports, __webpack_require__) { // ie9- setTimeout & setInterval additional parameters fix var global = __webpack_require__(3); var $export = __webpack_require__(0); var userAgent = __webpack_require__(151); var slice = [].slice; var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check var wrap = function (set) { return function (fn, time /* , ...args */) { var boundArgs = arguments.length > 2; var args = boundArgs ? slice.call(arguments, 2) : false; return set(boundArgs ? function () { // eslint-disable-next-line no-new-func (typeof fn == 'function' ? fn : Function(fn)).apply(this, args); } : fn, time); }; }; $export($export.G + $export.B + $export.F * MSIE, { setTimeout: wrap(global.setTimeout), setInterval: wrap(global.setInterval) }); /***/ }), /* 566 */ /***/ (function(module, exports, __webpack_require__) { __webpack_require__(494); __webpack_require__(433); __webpack_require__(435); __webpack_require__(434); __webpack_require__(437); __webpack_require__(439); __webpack_require__(444); __webpack_require__(438); __webpack_require__(436); __webpack_require__(446); __webpack_require__(445); __webpack_require__(441); __webpack_require__(442); __webpack_require__(440); __webpack_require__(432); __webpack_require__(443); __webpack_require__(447); __webpack_require__(448); __webpack_require__(400); __webpack_require__(402); __webpack_require__(401); __webpack_require__(450); __webpack_require__(449); __webpack_require__(420); __webpack_require__(430); __webpack_require__(431); __webpack_require__(421); __webpack_require__(422); __webpack_require__(423); __webpack_require__(424); __webpack_require__(425); __webpack_require__(426); __webpack_require__(427); __webpack_require__(428); __webpack_require__(429); __webpack_require__(403); __webpack_require__(404); __webpack_require__(405); __webpack_require__(406); __webpack_require__(407); __webpack_require__(408); __webpack_require__(409); __webpack_require__(410); __webpack_require__(411); __webpack_require__(412); __webpack_require__(413); __webpack_require__(414); __webpack_require__(415); __webpack_require__(416); __webpack_require__(417); __webpack_require__(418); __webpack_require__(419); __webpack_require__(481); __webpack_require__(486); __webpack_require__(493); __webpack_require__(484); __webpack_require__(476); __webpack_require__(477); __webpack_require__(482); __webpack_require__(487); __webpack_require__(489); __webpack_require__(472); __webpack_require__(473); __webpack_require__(474); __webpack_require__(475); __webpack_require__(478); __webpack_require__(479); __webpack_require__(480); __webpack_require__(483); __webpack_require__(485); __webpack_require__(488); __webpack_require__(490); __webpack_require__(491); __webpack_require__(492); __webpack_require__(395); __webpack_require__(397); __webpack_require__(396); __webpack_require__(399); __webpack_require__(398); __webpack_require__(384); __webpack_require__(382); __webpack_require__(388); __webpack_require__(385); __webpack_require__(391); __webpack_require__(393); __webpack_require__(381); __webpack_require__(387); __webpack_require__(378); __webpack_require__(392); __webpack_require__(376); __webpack_require__(390); __webpack_require__(389); __webpack_require__(383); __webpack_require__(386); __webpack_require__(375); __webpack_require__(377); __webpack_require__(380); __webpack_require__(379); __webpack_require__(394); __webpack_require__(154); __webpack_require__(466); __webpack_require__(471); __webpack_require__(229); __webpack_require__(467); __webpack_require__(468); __webpack_require__(469); __webpack_require__(470); __webpack_require__(451); __webpack_require__(228); __webpack_require__(230); __webpack_require__(231); __webpack_require__(506); __webpack_require__(495); __webpack_require__(496); __webpack_require__(501); __webpack_require__(504); __webpack_require__(505); __webpack_require__(499); __webpack_require__(502); __webpack_require__(500); __webpack_require__(503); __webpack_require__(497); __webpack_require__(498); __webpack_require__(452); __webpack_require__(453); __webpack_require__(454); __webpack_require__(455); __webpack_require__(456); __webpack_require__(459); __webpack_require__(457); __webpack_require__(458); __webpack_require__(460); __webpack_require__(461); __webpack_require__(462); __webpack_require__(463); __webpack_require__(465); __webpack_require__(464); __webpack_require__(509); __webpack_require__(507); __webpack_require__(508); __webpack_require__(550); __webpack_require__(553); __webpack_require__(552); __webpack_require__(554); __webpack_require__(555); __webpack_require__(551); __webpack_require__(556); __webpack_require__(557); __webpack_require__(531); __webpack_require__(534); __webpack_require__(530); __webpack_require__(528); __webpack_require__(529); __webpack_require__(532); __webpack_require__(533); __webpack_require__(515); __webpack_require__(549); __webpack_require__(514); __webpack_require__(548); __webpack_require__(560); __webpack_require__(562); __webpack_require__(513); __webpack_require__(547); __webpack_require__(559); __webpack_require__(561); __webpack_require__(512); __webpack_require__(558); __webpack_require__(511); __webpack_require__(516); __webpack_require__(517); __webpack_require__(518); __webpack_require__(519); __webpack_require__(520); __webpack_require__(522); __webpack_require__(521); __webpack_require__(523); __webpack_require__(524); __webpack_require__(525); __webpack_require__(527); __webpack_require__(526); __webpack_require__(536); __webpack_require__(537); __webpack_require__(538); __webpack_require__(539); __webpack_require__(541); __webpack_require__(540); __webpack_require__(543); __webpack_require__(542); __webpack_require__(544); __webpack_require__(545); __webpack_require__(546); __webpack_require__(510); __webpack_require__(535); __webpack_require__(565); __webpack_require__(564); __webpack_require__(563); module.exports = __webpack_require__(33); /***/ }), /* 567 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_hexbin__ = __webpack_require__(568); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "hexbin", function() { return __WEBPACK_IMPORTED_MODULE_0__src_hexbin__["a"]; }); /***/ }), /* 568 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var thirdPi = Math.PI / 3, angles = [0, thirdPi, 2 * thirdPi, 3 * thirdPi, 4 * thirdPi, 5 * thirdPi]; function pointX(d) { return d[0]; } function pointY(d) { return d[1]; } /* harmony default export */ __webpack_exports__["a"] = (function() { var x0 = 0, y0 = 0, x1 = 1, y1 = 1, x = pointX, y = pointY, r, dx, dy; function hexbin(points) { var binsById = {}, bins = [], i, n = points.length; for (i = 0; i < n; ++i) { if (isNaN(px = +x.call(null, point = points[i], i, points)) || isNaN(py = +y.call(null, point, i, points))) continue; var point, px, py, pj = Math.round(py = py / dy), pi = Math.round(px = px / dx - (pj & 1) / 2), py1 = py - pj; if (Math.abs(py1) * 3 > 1) { var px1 = px - pi, pi2 = pi + (px < pi ? -1 : 1) / 2, pj2 = pj + (py < pj ? -1 : 1), px2 = px - pi2, py2 = py - pj2; if (px1 * px1 + py1 * py1 > px2 * px2 + py2 * py2) pi = pi2 + (pj & 1 ? 1 : -1) / 2, pj = pj2; } var id = pi + "-" + pj, bin = binsById[id]; if (bin) bin.push(point); else { bins.push(bin = binsById[id] = [point]); bin.x = (pi + (pj & 1) / 2) * dx; bin.y = pj * dy; } } return bins; } function hexagon(radius) { var x0 = 0, y0 = 0; return angles.map(function(angle) { var x1 = Math.sin(angle) * radius, y1 = -Math.cos(angle) * radius, dx = x1 - x0, dy = y1 - y0; x0 = x1, y0 = y1; return [dx, dy]; }); } hexbin.hexagon = function(radius) { return "m" + hexagon(radius == null ? r : +radius).join("l") + "z"; }; hexbin.centers = function() { var centers = [], j = Math.round(y0 / dy), i = Math.round(x0 / dx); for (var y = j * dy; y < y1 + r; y += dy, ++j) { for (var x = i * dx + (j & 1) * dx / 2; x < x1 + dx / 2; x += dx) { centers.push([x, y]); } } return centers; }; hexbin.mesh = function() { var fragment = hexagon(r).slice(0, 4).join("l"); return hexbin.centers().map(function(p) { return "M" + p + "m" + fragment; }).join(""); }; hexbin.x = function(_) { return arguments.length ? (x = _, hexbin) : x; }; hexbin.y = function(_) { return arguments.length ? (y = _, hexbin) : y; }; hexbin.radius = function(_) { return arguments.length ? (r = +_, dx = r * 2 * Math.sin(thirdPi), dy = r * 1.5, hexbin) : r; }; hexbin.size = function(_) { return arguments.length ? (x0 = y0 = 0, x1 = +_[0], y1 = +_[1], hexbin) : [x1 - x0, y1 - y0]; }; hexbin.extent = function(_) { return arguments.length ? (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1], hexbin) : [[x0, y0], [x1, y1]]; }; return hexbin.radius(1); }); /***/ }), /* 569 */ /***/ (function(module, exports) { module.exports = determinant; /** * Calculates the determinant of a mat4 * * @param {mat4} a the source matrix * @returns {Number} determinant of a */ function determinant(a) { var a00 = a[0], a01 = a[1], a02 = a[2], a03 = a[3], a10 = a[4], a11 = a[5], a12 = a[6], a13 = a[7], a20 = a[8], a21 = a[9], a22 = a[10], a23 = a[11], a30 = a[12], a31 = a[13], a32 = a[14], a33 = a[15], b00 = a00 * a11 - a01 * a10, b01 = a00 * a12 - a02 * a10, b02 = a00 * a13 - a03 * a10, b03 = a01 * a12 - a02 * a11, b04 = a01 * a13 - a03 * a11, b05 = a02 * a13 - a03 * a12, b06 = a20 * a31 - a21 * a30, b07 = a20 * a32 - a22 * a30, b08 = a20 * a33 - a23 * a30, b09 = a21 * a32 - a22 * a31, b10 = a21 * a33 - a23 * a31, b11 = a22 * a33 - a23 * a32; // Calculate the determinant return b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06; }; /***/ }), /* 570 */ /***/ (function(module, exports) { module.exports = fromQuat; /** * Creates a matrix from a quaternion rotation. * * @param {mat4} out mat4 receiving operation result * @param {quat4} q Rotation quaternion * @returns {mat4} out */ function fromQuat(out, q) { var x = q[0], y = q[1], z = q[2], w = q[3], x2 = x + x, y2 = y + y, z2 = z + z, xx = x * x2, yx = y * x2, yy = y * y2, zx = z * x2, zy = z * y2, zz = z * z2, wx = w * x2, wy = w * y2, wz = w * z2; out[0] = 1 - yy - zz; out[1] = yx + wz; out[2] = zx - wy; out[3] = 0; out[4] = yx - wz; out[5] = 1 - xx - zz; out[6] = zy + wx; out[7] = 0; out[8] = zx + wy; out[9] = zy - wx; out[10] = 1 - xx - yy; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; }; /***/ }), /* 571 */ /***/ (function(module, exports) { module.exports = frustum; /** * Generates a frustum matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {Number} left Left bound of the frustum * @param {Number} right Right bound of the frustum * @param {Number} bottom Bottom bound of the frustum * @param {Number} top Top bound of the frustum * @param {Number} near Near bound of the frustum * @param {Number} far Far bound of the frustum * @returns {mat4} out */ function frustum(out, left, right, bottom, top, near, far) { var rl = 1 / (right - left), tb = 1 / (top - bottom), nf = 1 / (near - far); out[0] = (near * 2) * rl; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = (near * 2) * tb; out[6] = 0; out[7] = 0; out[8] = (right + left) * rl; out[9] = (top + bottom) * tb; out[10] = (far + near) * nf; out[11] = -1; out[12] = 0; out[13] = 0; out[14] = (far * near * 2) * nf; out[15] = 0; return out; }; /***/ }), /* 572 */ /***/ (function(module, exports) { module.exports = identity; /** * Set a mat4 to the identity matrix * * @param {mat4} out the receiving matrix * @returns {mat4} out */ function identity(out) { out[0] = 1; out[1] = 0; out[2] = 0; out[3] = 0; out[4] = 0; out[5] = 1; out[6] = 0; out[7] = 0; out[8] = 0; out[9] = 0; out[10] = 1; out[11] = 0; out[12] = 0; out[13] = 0; out[14] = 0; out[15] = 1; return out; }; /***/ }), /* 573 */ /***/ (function(module, exports) { module.exports = rotate; /** * Rotates a mat4 by the given angle * * @param {mat4} out the receiving matrix * @param {mat4} a the matrix to rotate * @param {Number} rad the angle to rotate the matrix by * @param {vec3} axis the axis to rotate around * @returns {mat4} out */ function rotate(out, a, rad, axis) { var x = axis[0], y = axis[1], z = axis[2], len = Math.sqrt(x * x + y * y + z * z), s, c, t, a00, a01, a02, a03, a10, a11, a12, a13, a20, a21, a22, a23, b00, b01, b02, b10, b11, b12, b20, b21, b22; if (Math.abs(len) < 0.000001) { return null; } len = 1 / len; x *= len; y *= len; z *= len; s = Math.sin(rad); c = Math.cos(rad); t = 1 - c; a00 = a[0]; a01 = a[1]; a02 = a[2]; a03 = a[3]; a10 = a[4]; a11 = a[5]; a12 = a[6]; a13 = a[7]; a20 = a[8]; a21 = a[9]; a22 = a[10]; a23 = a[11]; // Construct the elements of the rotation matrix b00 = x * x * t + c; b01 = y * x * t + z * s; b02 = z * x * t - y * s; b10 = x * y * t - z * s; b11 = y * y * t + c; b12 = z * y * t + x * s; b20 = x * z * t + y * s; b21 = y * z * t - x * s; b22 = z * z * t + c; // Perform rotation-specific matrix multiplication out[0] = a00 * b00 + a10 * b01 + a20 * b02; out[1] = a01 * b00 + a11 * b01 + a21 * b02; out[2] = a02 * b00 + a12 * b01 + a22 * b02; out[3] = a03 * b00 + a13 * b01 + a23 * b02; out[4] = a00 * b10 + a10 * b11 + a20 * b12; out[5] = a01 * b10 + a11 * b11 + a21 * b12; out[6] = a02 * b10 + a12 * b11 + a22 * b12; out[7] = a03 * b10 + a13 * b11 + a23 * b12; out[8] = a00 * b20 + a10 * b21 + a20 * b22; out[9] = a01 * b20 + a11 * b21 + a21 * b22; out[10] = a02 * b20 + a12 * b21 + a22 * b22; out[11] = a03 * b20 + a13 * b21 + a23 * b22; if (a !== out) { // If the source and destination differ, copy the unchanged last row out[12] = a[12]; out[13] = a[13]; out[14] = a[14]; out[15] = a[15]; } return out; }; /***/ }), /* 574 */ /***/ (function(module, exports) { module.exports = transpose; /** * Transpose the values of a mat4 * * @param {mat4} out the receiving matrix * @param {mat4} a the source matrix * @returns {mat4} out */ function transpose(out, a) { // If we are transposing ourselves we can skip a few steps but have to cache some values if (out === a) { var a01 = a[1], a02 = a[2], a03 = a[3], a12 = a[6], a13 = a[7], a23 = a[11]; out[1] = a[4]; out[2] = a[8]; out[3] = a[12]; out[4] = a01; out[6] = a[9]; out[7] = a[13]; out[8] = a02; out[9] = a12; out[11] = a[14]; out[12] = a03; out[13] = a13; out[14] = a23; } else { out[0] = a[0]; out[1] = a[4]; out[2] = a[8]; out[3] = a[12]; out[4] = a[1]; out[5] = a[5]; out[6] = a[9]; out[7] = a[13]; out[8] = a[2]; out[9] = a[6]; out[10] = a[10]; out[11] = a[14]; out[12] = a[3]; out[13] = a[7]; out[14] = a[11]; out[15] = a[15]; } return out; }; /***/ }), /* 575 */ /***/ (function(module, exports, __webpack_require__) { /** * Adds two quat's * * @param {quat} out the receiving quaternion * @param {quat} a the first operand * @param {quat} b the second operand * @returns {quat} out * @function */ module.exports = __webpack_require__(243) /***/ }), /* 576 */ /***/ (function(module, exports) { module.exports = calculateW /** * Calculates the W component of a quat from the X, Y, and Z components. * Assumes that quaternion is 1 unit in length. * Any existing W component will be ignored. * * @param {quat} out the receiving quaternion * @param {quat} a quat to calculate W component of * @returns {quat} out */ function calculateW (out, a) { var x = a[0], y = a[1], z = a[2] out[0] = x out[1] = y out[2] = z out[3] = Math.sqrt(Math.abs(1.0 - x * x - y * y - z * z)) return out } /***/ }), /* 577 */ /***/ (function(module, exports) { module.exports = conjugate /** * Calculates the conjugate of a quat * If the quaternion is normalized, this function is faster than quat.inverse and produces the same result. * * @param {quat} out the receiving quaternion * @param {quat} a quat to calculate conjugate of * @returns {quat} out */ function conjugate (out, a) { out[0] = -a[0] out[1] = -a[1] out[2] = -a[2] out[3] = a[3] return out } /***/ }), /* 578 */ /***/ (function(module, exports, __webpack_require__) { /** * Calculates the dot product of two quat's * * @param {quat} a the first operand * @param {quat} b the second operand * @returns {Number} dot product of a and b * @function */ module.exports = __webpack_require__(244) /***/ }), /* 579 */ /***/ (function(module, exports) { module.exports = fromMat3 /** * Creates a quaternion from the given 3x3 rotation matrix. * * NOTE: The resultant quaternion is not normalized, so you should be sure * to renormalize the quaternion yourself where necessary. * * @param {quat} out the receiving quaternion * @param {mat3} m rotation matrix * @returns {quat} out * @function */ function fromMat3 (out, m) { // Algorithm in Ken Shoemake's article in 1987 SIGGRAPH course notes // article "Quaternion Calculus and Fast Animation". var fTrace = m[0] + m[4] + m[8] var fRoot if (fTrace > 0.0) { // |w| > 1/2, may as well choose w > 1/2 fRoot = Math.sqrt(fTrace + 1.0) // 2w out[3] = 0.5 * fRoot fRoot = 0.5 / fRoot // 1/(4w) out[0] = (m[5] - m[7]) * fRoot out[1] = (m[6] - m[2]) * fRoot out[2] = (m[1] - m[3]) * fRoot } else { // |w| <= 1/2 var i = 0 if (m[4] > m[0]) { i = 1 } if (m[8] > m[i * 3 + i]) { i = 2 } var j = (i + 1) % 3 var k = (i + 2) % 3 fRoot = Math.sqrt(m[i * 3 + i] - m[j * 3 + j] - m[k * 3 + k] + 1.0) out[i] = 0.5 * fRoot fRoot = 0.5 / fRoot out[3] = (m[j * 3 + k] - m[k * 3 + j]) * fRoot out[j] = (m[j * 3 + i] + m[i * 3 + j]) * fRoot out[k] = (m[k * 3 + i] + m[i * 3 + k]) * fRoot } return out } /***/ }), /* 580 */ /***/ (function(module, exports) { module.exports = identity /** * Set a quat to the identity quaternion * * @param {quat} out the receiving quaternion * @returns {quat} out */ function identity (out) { out[0] = 0 out[1] = 0 out[2] = 0 out[3] = 1 return out } /***/ }), /* 581 */ /***/ (function(module, exports) { module.exports = invert /** * Calculates the inverse of a quat * * @param {quat} out the receiving quaternion * @param {quat} a quat to calculate inverse of * @returns {quat} out */ function invert (out, a) { var a0 = a[0], a1 = a[1], a2 = a[2], a3 = a[3], dot = a0 * a0 + a1 * a1 + a2 * a2 + a3 * a3, invDot = dot ? 1.0 / dot : 0 // TODO: Would be faster to return [0,0,0,0] immediately if dot == 0 out[0] = -a0 * invDot out[1] = -a1 * invDot out[2] = -a2 * invDot out[3] = a3 * invDot return out } /***/ }), /* 582 */ /***/ (function(module, exports, __webpack_require__) { /** * Calculates the length of a quat * * @param {quat} a vector to calculate length of * @returns {Number} length of a * @function */ module.exports = __webpack_require__(619) /***/ }), /* 583 */ /***/ (function(module, exports, __webpack_require__) { /** * Performs a linear interpolation between two quat's * * @param {quat} out the receiving quaternion * @param {quat} a the first operand * @param {quat} b the second operand * @param {Number} t interpolation amount between the two inputs * @returns {quat} out * @function */ module.exports = __webpack_require__(245) /***/ }), /* 584 */ /***/ (function(module, exports) { module.exports = multiply /** * Multiplies two quat's * * @param {quat} out the receiving quaternion * @param {quat} a the first operand * @param {quat} b the second operand * @returns {quat} out */ function multiply (out, a, b) { var ax = a[0], ay = a[1], az = a[2], aw = a[3], bx = b[0], by = b[1], bz = b[2], bw = b[3] out[0] = ax * bw + aw * bx + ay * bz - az * by out[1] = ay * bw + aw * by + az * bx - ax * bz out[2] = az * bw + aw * bz + ax * by - ay * bx out[3] = aw * bw - ax * bx - ay * by - az * bz return out } /***/ }), /* 585 */ /***/ (function(module, exports) { module.exports = rotateX /** * Rotates a quaternion by the given angle about the X axis * * @param {quat} out quat receiving operation result * @param {quat} a quat to rotate * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ function rotateX (out, a, rad) { rad *= 0.5 var ax = a[0], ay = a[1], az = a[2], aw = a[3], bx = Math.sin(rad), bw = Math.cos(rad) out[0] = ax * bw + aw * bx out[1] = ay * bw + az * bx out[2] = az * bw - ay * bx out[3] = aw * bw - ax * bx return out } /***/ }), /* 586 */ /***/ (function(module, exports) { module.exports = rotateY /** * Rotates a quaternion by the given angle about the Y axis * * @param {quat} out quat receiving operation result * @param {quat} a quat to rotate * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ function rotateY (out, a, rad) { rad *= 0.5 var ax = a[0], ay = a[1], az = a[2], aw = a[3], by = Math.sin(rad), bw = Math.cos(rad) out[0] = ax * bw - az * by out[1] = ay * bw + aw * by out[2] = az * bw + ax * by out[3] = aw * bw - ay * by return out } /***/ }), /* 587 */ /***/ (function(module, exports) { module.exports = rotateZ /** * Rotates a quaternion by the given angle about the Z axis * * @param {quat} out quat receiving operation result * @param {quat} a quat to rotate * @param {number} rad angle (in radians) to rotate * @returns {quat} out */ function rotateZ (out, a, rad) { rad *= 0.5 var ax = a[0], ay = a[1], az = a[2], aw = a[3], bz = Math.sin(rad), bw = Math.cos(rad) out[0] = ax * bw + ay * bz out[1] = ay * bw - ax * bz out[2] = az * bw + aw * bz out[3] = aw * bw - az * bz return out } /***/ }), /* 588 */ /***/ (function(module, exports, __webpack_require__) { var vecDot = __webpack_require__(240) var vecCross = __webpack_require__(239) var vecLength = __webpack_require__(241) var vecNormalize = __webpack_require__(242) var quatNormalize = __webpack_require__(236) var quatAxisAngle = __webpack_require__(237) module.exports = rotationTo var tmpvec3 = [0, 0, 0] var xUnitVec3 = [1, 0, 0] var yUnitVec3 = [0, 1, 0] /** * Sets a quaternion to represent the shortest rotation from one * vector to another. * * Both vectors are assumed to be unit length. * * @param {quat} out the receiving quaternion. * @param {vec3} a the initial vector * @param {vec3} b the destination vector * @returns {quat} out */ function rotationTo (out, a, b) { var dot = vecDot(a, b) if (dot < -0.999999) { vecCross(tmpvec3, xUnitVec3, a) if (vecLength(tmpvec3) < 0.000001) { vecCross(tmpvec3, yUnitVec3, a) } vecNormalize(tmpvec3, tmpvec3) quatAxisAngle(out, tmpvec3, Math.PI) return out } else if (dot > 0.999999) { out[0] = 0 out[1] = 0 out[2] = 0 out[3] = 1 return out } else { vecCross(tmpvec3, a, b) out[0] = tmpvec3[0] out[1] = tmpvec3[1] out[2] = tmpvec3[2] out[3] = 1 + dot return quatNormalize(out, out) } } /***/ }), /* 589 */ /***/ (function(module, exports, __webpack_require__) { /** * Scales a quat by a scalar number * * @param {quat} out the receiving vector * @param {quat} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {quat} out * @function */ module.exports = __webpack_require__(161) /***/ }), /* 590 */ /***/ (function(module, exports, __webpack_require__) { /** * Set the components of a quat to the given values * * @param {quat} out the receiving quaternion * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @param {Number} w W component * @returns {quat} out * @function */ module.exports = __webpack_require__(248) /***/ }), /* 591 */ /***/ (function(module, exports) { module.exports = slerp /** * Performs a spherical linear interpolation between two quat * * @param {quat} out the receiving quaternion * @param {quat} a the first operand * @param {quat} b the second operand * @param {Number} t interpolation amount between the two inputs * @returns {quat} out */ function slerp (out, a, b, t) { // benchmarks: // http://jsperf.com/quaternion-slerp-implementations var ax = a[0], ay = a[1], az = a[2], aw = a[3], bx = b[0], by = b[1], bz = b[2], bw = b[3] var omega, cosom, sinom, scale0, scale1 // calc cosine cosom = ax * bx + ay * by + az * bz + aw * bw // adjust signs (if necessary) if (cosom < 0.0) { cosom = -cosom bx = -bx by = -by bz = -bz bw = -bw } // calculate coefficients if ((1.0 - cosom) > 0.000001) { // standard case (slerp) omega = Math.acos(cosom) sinom = Math.sin(omega) scale0 = Math.sin((1.0 - t) * omega) / sinom scale1 = Math.sin(t * omega) / sinom } else { // "from" and "to" quaternions are very close // ... so we can do a linear interpolation scale0 = 1.0 - t scale1 = t } // calculate final values out[0] = scale0 * ax + scale1 * bx out[1] = scale0 * ay + scale1 * by out[2] = scale0 * az + scale1 * bz out[3] = scale0 * aw + scale1 * bw return out } /***/ }), /* 592 */ /***/ (function(module, exports, __webpack_require__) { /** * Calculates the squared length of a quat * * @param {quat} a vector to calculate squared length of * @returns {Number} squared length of a * @function */ module.exports = __webpack_require__(622) /***/ }), /* 593 */ /***/ (function(module, exports) { module.exports = cross /** * Computes the cross product of two vec2's * Note that the cross product must by definition produce a 3D vector * * @param {vec3} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @returns {vec3} out */ function cross(out, a, b) { var z = a[0] * b[1] - a[1] * b[0] out[0] = out[1] = 0 out[2] = z return out } /***/ }), /* 594 */ /***/ (function(module, exports) { module.exports = divide /** * Divides two vec2's * * @param {vec2} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @returns {vec2} out */ function divide(out, a, b) { out[0] = a[0] / b[0] out[1] = a[1] / b[1] return out } /***/ }), /* 595 */ /***/ (function(module, exports) { module.exports = dot /** * Calculates the dot product of two vec2's * * @param {vec2} a the first operand * @param {vec2} b the second operand * @returns {Number} dot product of a and b */ function dot(a, b) { return a[0] * b[0] + a[1] * b[1] } /***/ }), /* 596 */ /***/ (function(module, exports) { module.exports = multiply /** * Multiplies two vec2's * * @param {vec2} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @returns {vec2} out */ function multiply(out, a, b) { out[0] = a[0] * b[0] out[1] = a[1] * b[1] return out } /***/ }), /* 597 */ /***/ (function(module, exports) { module.exports = normalize /** * Normalize a vec2 * * @param {vec2} out the receiving vector * @param {vec2} a vector to normalize * @returns {vec2} out */ function normalize(out, a) { var x = a[0], y = a[1] var len = x*x + y*y if (len > 0) { //TODO: evaluate use of glm_invsqrt here? len = 1 / Math.sqrt(len) out[0] = a[0] * len out[1] = a[1] * len } return out } /***/ }), /* 598 */ /***/ (function(module, exports) { module.exports = scale /** * Scales a vec2 by a scalar number * * @param {vec2} out the receiving vector * @param {vec2} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec2} out */ function scale(out, a, b) { out[0] = a[0] * b out[1] = a[1] * b return out } /***/ }), /* 599 */ /***/ (function(module, exports) { module.exports = scaleAndAdd /** * Adds two vec2's after scaling the second operand by a scalar value * * @param {vec2} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec2} out */ function scaleAndAdd(out, a, b, scale) { out[0] = a[0] + (b[0] * scale) out[1] = a[1] + (b[1] * scale) return out } /***/ }), /* 600 */ /***/ (function(module, exports) { module.exports = set /** * Set the components of a vec2 to the given values * * @param {vec2} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @returns {vec2} out */ function set(out, x, y) { out[0] = x out[1] = y return out } /***/ }), /* 601 */ /***/ (function(module, exports) { module.exports = subtract /** * Subtracts vector b from vector a * * @param {vec2} out the receiving vector * @param {vec2} a the first operand * @param {vec2} b the second operand * @returns {vec2} out */ function subtract(out, a, b) { out[0] = a[0] - b[0] out[1] = a[1] - b[1] return out } /***/ }), /* 602 */ /***/ (function(module, exports) { module.exports = transformMat4 /** * Transforms the vec2 with a mat4 * 3rd vector component is implicitly '0' * 4th vector component is implicitly '1' * * @param {vec2} out the receiving vector * @param {vec2} a the vector to transform * @param {mat4} m matrix to transform with * @returns {vec2} out */ function transformMat4(out, a, m) { var x = a[0], y = a[1] out[0] = m[0] * x + m[4] * y + m[12] out[1] = m[1] * x + m[5] * y + m[13] return out } /***/ }), /* 603 */ /***/ (function(module, exports) { module.exports = add; /** * Adds two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ function add(out, a, b) { out[0] = a[0] + b[0] out[1] = a[1] + b[1] out[2] = a[2] + b[2] return out } /***/ }), /* 604 */ /***/ (function(module, exports, __webpack_require__) { module.exports = angle var fromValues = __webpack_require__(606) var normalize = __webpack_require__(242) var dot = __webpack_require__(240) /** * Get the angle between two 3D vectors * @param {vec3} a The first operand * @param {vec3} b The second operand * @returns {Number} The angle in radians */ function angle(a, b) { var tempA = fromValues(a[0], a[1], a[2]) var tempB = fromValues(b[0], b[1], b[2]) normalize(tempA, tempA) normalize(tempB, tempB) var cosine = dot(tempA, tempB) if(cosine > 1.0){ return 0 } else { return Math.acos(cosine) } } /***/ }), /* 605 */ /***/ (function(module, exports) { module.exports = divide; /** * Divides two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ function divide(out, a, b) { out[0] = a[0] / b[0] out[1] = a[1] / b[1] out[2] = a[2] / b[2] return out } /***/ }), /* 606 */ /***/ (function(module, exports) { module.exports = fromValues; /** * Creates a new vec3 initialized with the given values * * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @returns {vec3} a new 3D vector */ function fromValues(x, y, z) { var out = new Float32Array(3) out[0] = x out[1] = y out[2] = z return out } /***/ }), /* 607 */ /***/ (function(module, exports) { module.exports = multiply; /** * Multiplies two vec3's * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ function multiply(out, a, b) { out[0] = a[0] * b[0] out[1] = a[1] * b[1] out[2] = a[2] * b[2] return out } /***/ }), /* 608 */ /***/ (function(module, exports) { module.exports = rotateX; /** * Rotate a 3D vector around the x-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ function rotateX(out, a, b, c){ var p = [], r=[] //Translate point to the origin p[0] = a[0] - b[0] p[1] = a[1] - b[1] p[2] = a[2] - b[2] //perform rotation r[0] = p[0] r[1] = p[1]*Math.cos(c) - p[2]*Math.sin(c) r[2] = p[1]*Math.sin(c) + p[2]*Math.cos(c) //translate to correct position out[0] = r[0] + b[0] out[1] = r[1] + b[1] out[2] = r[2] + b[2] return out } /***/ }), /* 609 */ /***/ (function(module, exports) { module.exports = rotateY; /** * Rotate a 3D vector around the y-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ function rotateY(out, a, b, c){ var p = [], r=[] //Translate point to the origin p[0] = a[0] - b[0] p[1] = a[1] - b[1] p[2] = a[2] - b[2] //perform rotation r[0] = p[2]*Math.sin(c) + p[0]*Math.cos(c) r[1] = p[1] r[2] = p[2]*Math.cos(c) - p[0]*Math.sin(c) //translate to correct position out[0] = r[0] + b[0] out[1] = r[1] + b[1] out[2] = r[2] + b[2] return out } /***/ }), /* 610 */ /***/ (function(module, exports) { module.exports = rotateZ; /** * Rotate a 3D vector around the z-axis * @param {vec3} out The receiving vec3 * @param {vec3} a The vec3 point to rotate * @param {vec3} b The origin of the rotation * @param {Number} c The angle of rotation * @returns {vec3} out */ function rotateZ(out, a, b, c){ var p = [], r=[] //Translate point to the origin p[0] = a[0] - b[0] p[1] = a[1] - b[1] p[2] = a[2] - b[2] //perform rotation r[0] = p[0]*Math.cos(c) - p[1]*Math.sin(c) r[1] = p[0]*Math.sin(c) + p[1]*Math.cos(c) r[2] = p[2] //translate to correct position out[0] = r[0] + b[0] out[1] = r[1] + b[1] out[2] = r[2] + b[2] return out } /***/ }), /* 611 */ /***/ (function(module, exports) { module.exports = scale; /** * Scales a vec3 by a scalar number * * @param {vec3} out the receiving vector * @param {vec3} a the vector to scale * @param {Number} b amount to scale the vector by * @returns {vec3} out */ function scale(out, a, b) { out[0] = a[0] * b out[1] = a[1] * b out[2] = a[2] * b return out } /***/ }), /* 612 */ /***/ (function(module, exports) { module.exports = scaleAndAdd; /** * Adds two vec3's after scaling the second operand by a scalar value * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec3} out */ function scaleAndAdd(out, a, b, scale) { out[0] = a[0] + (b[0] * scale) out[1] = a[1] + (b[1] * scale) out[2] = a[2] + (b[2] * scale) return out } /***/ }), /* 613 */ /***/ (function(module, exports) { module.exports = set; /** * Set the components of a vec3 to the given values * * @param {vec3} out the receiving vector * @param {Number} x X component * @param {Number} y Y component * @param {Number} z Z component * @returns {vec3} out */ function set(out, x, y, z) { out[0] = x out[1] = y out[2] = z return out } /***/ }), /* 614 */ /***/ (function(module, exports) { module.exports = subtract; /** * Subtracts vector b from vector a * * @param {vec3} out the receiving vector * @param {vec3} a the first operand * @param {vec3} b the second operand * @returns {vec3} out */ function subtract(out, a, b) { out[0] = a[0] - b[0] out[1] = a[1] - b[1] out[2] = a[2] - b[2] return out } /***/ }), /* 615 */ /***/ (function(module, exports) { module.exports = transformMat4; /** * Transforms the vec3 with a mat4. * 4th vector component is implicitly '1' * * @param {vec3} out the receiving vector * @param {vec3} a the vector to transform * @param {mat4} m matrix to transform with * @returns {vec3} out */ function transformMat4(out, a, m) { var x = a[0], y = a[1], z = a[2], w = m[3] * x + m[7] * y + m[11] * z + m[15] w = w || 1.0 out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w return out } /***/ }), /* 616 */ /***/ (function(module, exports) { module.exports = distance /** * Calculates the euclidian distance between two vec4's * * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {Number} distance between a and b */ function distance (a, b) { var x = b[0] - a[0], y = b[1] - a[1], z = b[2] - a[2], w = b[3] - a[3] return Math.sqrt(x * x + y * y + z * z + w * w) } /***/ }), /* 617 */ /***/ (function(module, exports) { module.exports = divide /** * Divides two vec4's * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {vec4} out */ function divide (out, a, b) { out[0] = a[0] / b[0] out[1] = a[1] / b[1] out[2] = a[2] / b[2] out[3] = a[3] / b[3] return out } /***/ }), /* 618 */ /***/ (function(module, exports) { module.exports = inverse /** * Returns the inverse of the components of a vec4 * * @param {vec4} out the receiving vector * @param {vec4} a vector to invert * @returns {vec4} out */ function inverse (out, a) { out[0] = 1.0 / a[0] out[1] = 1.0 / a[1] out[2] = 1.0 / a[2] out[3] = 1.0 / a[3] return out } /***/ }), /* 619 */ /***/ (function(module, exports) { module.exports = length /** * Calculates the length of a vec4 * * @param {vec4} a vector to calculate length of * @returns {Number} length of a */ function length (a) { var x = a[0], y = a[1], z = a[2], w = a[3] return Math.sqrt(x * x + y * y + z * z + w * w) } /***/ }), /* 620 */ /***/ (function(module, exports) { module.exports = negate /** * Negates the components of a vec4 * * @param {vec4} out the receiving vector * @param {vec4} a vector to negate * @returns {vec4} out */ function negate (out, a) { out[0] = -a[0] out[1] = -a[1] out[2] = -a[2] out[3] = -a[3] return out } /***/ }), /* 621 */ /***/ (function(module, exports) { module.exports = scaleAndAdd /** * Adds two vec4's after scaling the second operand by a scalar value * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @param {Number} scale the amount to scale b by before adding * @returns {vec4} out */ function scaleAndAdd (out, a, b, scale) { out[0] = a[0] + (b[0] * scale) out[1] = a[1] + (b[1] * scale) out[2] = a[2] + (b[2] * scale) out[3] = a[3] + (b[3] * scale) return out } /***/ }), /* 622 */ /***/ (function(module, exports) { module.exports = squaredLength /** * Calculates the squared length of a vec4 * * @param {vec4} a vector to calculate squared length of * @returns {Number} squared length of a */ function squaredLength (a) { var x = a[0], y = a[1], z = a[2], w = a[3] return x * x + y * y + z * z + w * w } /***/ }), /* 623 */ /***/ (function(module, exports) { module.exports = subtract /** * Subtracts vector b from vector a * * @param {vec4} out the receiving vector * @param {vec4} a the first operand * @param {vec4} b the second operand * @returns {vec4} out */ function subtract (out, a, b) { out[0] = a[0] - b[0] out[1] = a[1] - b[1] out[2] = a[2] - b[2] out[3] = a[3] - b[3] return out } /***/ }), /* 624 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_RESULT__;/*! Hammer.JS - v2.0.7 - 2016-04-22 * http://hammerjs.github.io/ * * Copyright (c) 2016 Jorik Tangelder; * Licensed under the MIT license */ (function(window, document, exportName, undefined) { 'use strict'; var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o']; var TEST_ELEMENT = document.createElement('div'); var TYPE_FUNCTION = 'function'; var round = Math.round; var abs = Math.abs; var now = Date.now; /** * set a timeout with a given scope * @param {Function} fn * @param {Number} timeout * @param {Object} context * @returns {number} */ function setTimeoutContext(fn, timeout, context) { return setTimeout(bindFn(fn, context), timeout); } /** * if the argument is an array, we want to execute the fn on each entry * if it aint an array we don't want to do a thing. * this is used by all the methods that accept a single and array argument. * @param {*|Array} arg * @param {String} fn * @param {Object} [context] * @returns {Boolean} */ function invokeArrayArg(arg, fn, context) { if (Array.isArray(arg)) { each(arg, context[fn], context); return true; } return false; } /** * walk objects and arrays * @param {Object} obj * @param {Function} iterator * @param {Object} context */ function each(obj, iterator, context) { var i; if (!obj) { return; } if (obj.forEach) { obj.forEach(iterator, context); } else if (obj.length !== undefined) { i = 0; while (i < obj.length) { iterator.call(context, obj[i], i, obj); i++; } } else { for (i in obj) { obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj); } } } /** * wrap a method with a deprecation warning and stack trace * @param {Function} method * @param {String} name * @param {String} message * @returns {Function} A new function wrapping the supplied method. */ function deprecate(method, name, message) { var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\n' + message + ' AT \n'; return function() { var e = new Error('get-stack-trace'); var stack = e && e.stack ? e.stack.replace(/^[^\(]+?[\n$]/gm, '') .replace(/^\s+at\s+/gm, '') .replace(/^Object.\s*\(/gm, '{anonymous}()@') : 'Unknown Stack Trace'; var log = window.console && (window.console.warn || window.console.log); if (log) { log.call(window.console, deprecationMessage, stack); } return method.apply(this, arguments); }; } /** * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} target * @param {...Object} objects_to_assign * @returns {Object} target */ var assign; if (typeof Object.assign !== 'function') { assign = function assign(target) { if (target === undefined || target === null) { throw new TypeError('Cannot convert undefined or null to object'); } var output = Object(target); for (var index = 1; index < arguments.length; index++) { var source = arguments[index]; if (source !== undefined && source !== null) { for (var nextKey in source) { if (source.hasOwnProperty(nextKey)) { output[nextKey] = source[nextKey]; } } } } return output; }; } else { assign = Object.assign; } /** * extend object. * means that properties in dest will be overwritten by the ones in src. * @param {Object} dest * @param {Object} src * @param {Boolean} [merge=false] * @returns {Object} dest */ var extend = deprecate(function extend(dest, src, merge) { var keys = Object.keys(src); var i = 0; while (i < keys.length) { if (!merge || (merge && dest[keys[i]] === undefined)) { dest[keys[i]] = src[keys[i]]; } i++; } return dest; }, 'extend', 'Use `assign`.'); /** * merge the values from src in the dest. * means that properties that exist in dest will not be overwritten by src * @param {Object} dest * @param {Object} src * @returns {Object} dest */ var merge = deprecate(function merge(dest, src) { return extend(dest, src, true); }, 'merge', 'Use `assign`.'); /** * simple class inheritance * @param {Function} child * @param {Function} base * @param {Object} [properties] */ function inherit(child, base, properties) { var baseP = base.prototype, childP; childP = child.prototype = Object.create(baseP); childP.constructor = child; childP._super = baseP; if (properties) { assign(childP, properties); } } /** * simple function bind * @param {Function} fn * @param {Object} context * @returns {Function} */ function bindFn(fn, context) { return function boundFn() { return fn.apply(context, arguments); }; } /** * let a boolean value also be a function that must return a boolean * this first item in args will be used as the context * @param {Boolean|Function} val * @param {Array} [args] * @returns {Boolean} */ function boolOrFn(val, args) { if (typeof val == TYPE_FUNCTION) { return val.apply(args ? args[0] || undefined : undefined, args); } return val; } /** * use the val2 when val1 is undefined * @param {*} val1 * @param {*} val2 * @returns {*} */ function ifUndefined(val1, val2) { return (val1 === undefined) ? val2 : val1; } /** * addEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function addEventListeners(target, types, handler) { each(splitStr(types), function(type) { target.addEventListener(type, handler, false); }); } /** * removeEventListener with multiple events at once * @param {EventTarget} target * @param {String} types * @param {Function} handler */ function removeEventListeners(target, types, handler) { each(splitStr(types), function(type) { target.removeEventListener(type, handler, false); }); } /** * find if a node is in the given parent * @method hasParent * @param {HTMLElement} node * @param {HTMLElement} parent * @return {Boolean} found */ function hasParent(node, parent) { while (node) { if (node == parent) { return true; } node = node.parentNode; } return false; } /** * small indexOf wrapper * @param {String} str * @param {String} find * @returns {Boolean} found */ function inStr(str, find) { return str.indexOf(find) > -1; } /** * split string on whitespace * @param {String} str * @returns {Array} words */ function splitStr(str) { return str.trim().split(/\s+/g); } /** * find if a array contains the object using indexOf or a simple polyFill * @param {Array} src * @param {String} find * @param {String} [findByKey] * @return {Boolean|Number} false when not found, or the index */ function inArray(src, find, findByKey) { if (src.indexOf && !findByKey) { return src.indexOf(find); } else { var i = 0; while (i < src.length) { if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) { return i; } i++; } return -1; } } /** * convert array-like objects to real arrays * @param {Object} obj * @returns {Array} */ function toArray(obj) { return Array.prototype.slice.call(obj, 0); } /** * unique array with objects based on a key (like 'id') or just by the array's value * @param {Array} src [{id:1},{id:2},{id:1}] * @param {String} [key] * @param {Boolean} [sort=False] * @returns {Array} [{id:1},{id:2}] */ function uniqueArray(src, key, sort) { var results = []; var values = []; var i = 0; while (i < src.length) { var val = key ? src[i][key] : src[i]; if (inArray(values, val) < 0) { results.push(src[i]); } values[i] = val; i++; } if (sort) { if (!key) { results = results.sort(); } else { results = results.sort(function sortUniqueArray(a, b) { return a[key] > b[key]; }); } } return results; } /** * get the prefixed property * @param {Object} obj * @param {String} property * @returns {String|Undefined} prefixed */ function prefixed(obj, property) { var prefix, prop; var camelProp = property[0].toUpperCase() + property.slice(1); var i = 0; while (i < VENDOR_PREFIXES.length) { prefix = VENDOR_PREFIXES[i]; prop = (prefix) ? prefix + camelProp : property; if (prop in obj) { return prop; } i++; } return undefined; } /** * get a unique id * @returns {number} uniqueId */ var _uniqueId = 1; function uniqueId() { return _uniqueId++; } /** * get the window object of an element * @param {HTMLElement} element * @returns {DocumentView|Window} */ function getWindowForElement(element) { var doc = element.ownerDocument || element; return (doc.defaultView || doc.parentWindow || window); } var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i; var SUPPORT_TOUCH = ('ontouchstart' in window); var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined; var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent); var INPUT_TYPE_TOUCH = 'touch'; var INPUT_TYPE_PEN = 'pen'; var INPUT_TYPE_MOUSE = 'mouse'; var INPUT_TYPE_KINECT = 'kinect'; var COMPUTE_INTERVAL = 25; var INPUT_START = 1; var INPUT_MOVE = 2; var INPUT_END = 4; var INPUT_CANCEL = 8; var DIRECTION_NONE = 1; var DIRECTION_LEFT = 2; var DIRECTION_RIGHT = 4; var DIRECTION_UP = 8; var DIRECTION_DOWN = 16; var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT; var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN; var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL; var PROPS_XY = ['x', 'y']; var PROPS_CLIENT_XY = ['clientX', 'clientY']; /** * create new input type manager * @param {Manager} manager * @param {Function} callback * @returns {Input} * @constructor */ function Input(manager, callback) { var self = this; this.manager = manager; this.callback = callback; this.element = manager.element; this.target = manager.options.inputTarget; // smaller wrapper around the handler, for the scope and the enabled state of the manager, // so when disabled the input events are completely bypassed. this.domHandler = function(ev) { if (boolOrFn(manager.options.enable, [manager])) { self.handler(ev); } }; this.init(); } Input.prototype = { /** * should handle the inputEvent data and trigger the callback * @virtual */ handler: function() { }, /** * bind the events */ init: function() { this.evEl && addEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); }, /** * unbind the events */ destroy: function() { this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler); this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler); this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler); } }; /** * create new input type manager * called by the Manager constructor * @param {Hammer} manager * @returns {Input} */ function createInputInstance(manager) { var Type; var inputClass = manager.options.inputClass; if (inputClass) { Type = inputClass; } else if (SUPPORT_POINTER_EVENTS) { Type = PointerEventInput; } else if (SUPPORT_ONLY_TOUCH) { Type = TouchInput; } else if (!SUPPORT_TOUCH) { Type = MouseInput; } else { Type = TouchMouseInput; } return new (Type)(manager, inputHandler); } /** * handle input events * @param {Manager} manager * @param {String} eventType * @param {Object} input */ function inputHandler(manager, eventType, input) { var pointersLen = input.pointers.length; var changedPointersLen = input.changedPointers.length; var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0)); var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0)); input.isFirst = !!isFirst; input.isFinal = !!isFinal; if (isFirst) { manager.session = {}; } // source event is the normalized value of the domEvents // like 'touchstart, mouseup, pointerdown' input.eventType = eventType; // compute scale, rotation etc computeInputData(manager, input); // emit secret event manager.emit('hammer.input', input); manager.recognize(input); manager.session.prevInput = input; } /** * extend the data with some usable properties like scale, rotate, velocity etc * @param {Object} manager * @param {Object} input */ function computeInputData(manager, input) { var session = manager.session; var pointers = input.pointers; var pointersLength = pointers.length; // store the first input to calculate the distance and direction if (!session.firstInput) { session.firstInput = simpleCloneInputData(input); } // to compute scale and rotation we need to store the multiple touches if (pointersLength > 1 && !session.firstMultiple) { session.firstMultiple = simpleCloneInputData(input); } else if (pointersLength === 1) { session.firstMultiple = false; } var firstInput = session.firstInput; var firstMultiple = session.firstMultiple; var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center; var center = input.center = getCenter(pointers); input.timeStamp = now(); input.deltaTime = input.timeStamp - firstInput.timeStamp; input.angle = getAngle(offsetCenter, center); input.distance = getDistance(offsetCenter, center); computeDeltaXY(session, input); input.offsetDirection = getDirection(input.deltaX, input.deltaY); var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY); input.overallVelocityX = overallVelocity.x; input.overallVelocityY = overallVelocity.y; input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y; input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1; input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0; input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length > session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers); computeIntervalInputData(session, input); // find the correct target var target = manager.element; if (hasParent(input.srcEvent.target, target)) { target = input.srcEvent.target; } input.target = target; } function computeDeltaXY(session, input) { var center = input.center; var offset = session.offsetDelta || {}; var prevDelta = session.prevDelta || {}; var prevInput = session.prevInput || {}; if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) { prevDelta = session.prevDelta = { x: prevInput.deltaX || 0, y: prevInput.deltaY || 0 }; offset = session.offsetDelta = { x: center.x, y: center.y }; } input.deltaX = prevDelta.x + (center.x - offset.x); input.deltaY = prevDelta.y + (center.y - offset.y); } /** * velocity is calculated every x ms * @param {Object} session * @param {Object} input */ function computeIntervalInputData(session, input) { var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction; if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) { var deltaX = input.deltaX - last.deltaX; var deltaY = input.deltaY - last.deltaY; var v = getVelocity(deltaTime, deltaX, deltaY); velocityX = v.x; velocityY = v.y; velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y; direction = getDirection(deltaX, deltaY); session.lastInterval = input; } else { // use latest velocity info if it doesn't overtake a minimum period velocity = last.velocity; velocityX = last.velocityX; velocityY = last.velocityY; direction = last.direction; } input.velocity = velocity; input.velocityX = velocityX; input.velocityY = velocityY; input.direction = direction; } /** * create a simple clone from the input used for storage of firstInput and firstMultiple * @param {Object} input * @returns {Object} clonedInputData */ function simpleCloneInputData(input) { // make a simple copy of the pointers because we will get a reference if we don't // we only need clientXY for the calculations var pointers = []; var i = 0; while (i < input.pointers.length) { pointers[i] = { clientX: round(input.pointers[i].clientX), clientY: round(input.pointers[i].clientY) }; i++; } return { timeStamp: now(), pointers: pointers, center: getCenter(pointers), deltaX: input.deltaX, deltaY: input.deltaY }; } /** * get the center of all the pointers * @param {Array} pointers * @return {Object} center contains `x` and `y` properties */ function getCenter(pointers) { var pointersLength = pointers.length; // no need to loop when only one touch if (pointersLength === 1) { return { x: round(pointers[0].clientX), y: round(pointers[0].clientY) }; } var x = 0, y = 0, i = 0; while (i < pointersLength) { x += pointers[i].clientX; y += pointers[i].clientY; i++; } return { x: round(x / pointersLength), y: round(y / pointersLength) }; } /** * calculate the velocity between two points. unit is in px per ms. * @param {Number} deltaTime * @param {Number} x * @param {Number} y * @return {Object} velocity `x` and `y` */ function getVelocity(deltaTime, x, y) { return { x: x / deltaTime || 0, y: y / deltaTime || 0 }; } /** * get the direction between two points * @param {Number} x * @param {Number} y * @return {Number} direction */ function getDirection(x, y) { if (x === y) { return DIRECTION_NONE; } if (abs(x) >= abs(y)) { return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT; } return y < 0 ? DIRECTION_UP : DIRECTION_DOWN; } /** * calculate the absolute distance between two points * @param {Object} p1 {x, y} * @param {Object} p2 {x, y} * @param {Array} [props] containing x and y keys * @return {Number} distance */ function getDistance(p1, p2, props) { if (!props) { props = PROPS_XY; } var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]]; return Math.sqrt((x * x) + (y * y)); } /** * calculate the angle between two coordinates * @param {Object} p1 * @param {Object} p2 * @param {Array} [props] containing x and y keys * @return {Number} angle */ function getAngle(p1, p2, props) { if (!props) { props = PROPS_XY; } var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]]; return Math.atan2(y, x) * 180 / Math.PI; } /** * calculate the rotation degrees between two pointersets * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} rotation */ function getRotation(start, end) { return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY); } /** * calculate the scale factor between two pointersets * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out * @param {Array} start array of pointers * @param {Array} end array of pointers * @return {Number} scale */ function getScale(start, end) { return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY); } var MOUSE_INPUT_MAP = { mousedown: INPUT_START, mousemove: INPUT_MOVE, mouseup: INPUT_END }; var MOUSE_ELEMENT_EVENTS = 'mousedown'; var MOUSE_WINDOW_EVENTS = 'mousemove mouseup'; /** * Mouse events input * @constructor * @extends Input */ function MouseInput() { this.evEl = MOUSE_ELEMENT_EVENTS; this.evWin = MOUSE_WINDOW_EVENTS; this.pressed = false; // mousedown state Input.apply(this, arguments); } inherit(MouseInput, Input, { /** * handle mouse events * @param {Object} ev */ handler: function MEhandler(ev) { var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the left mouse button down if (eventType & INPUT_START && ev.button === 0) { this.pressed = true; } if (eventType & INPUT_MOVE && ev.which !== 1) { eventType = INPUT_END; } // mouse must be down if (!this.pressed) { return; } if (eventType & INPUT_END) { this.pressed = false; } this.callback(this.manager, eventType, { pointers: [ev], changedPointers: [ev], pointerType: INPUT_TYPE_MOUSE, srcEvent: ev }); } }); var POINTER_INPUT_MAP = { pointerdown: INPUT_START, pointermove: INPUT_MOVE, pointerup: INPUT_END, pointercancel: INPUT_CANCEL, pointerout: INPUT_CANCEL }; // in IE10 the pointer types is defined as an enum var IE10_POINTER_TYPE_ENUM = { 2: INPUT_TYPE_TOUCH, 3: INPUT_TYPE_PEN, 4: INPUT_TYPE_MOUSE, 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816 }; var POINTER_ELEMENT_EVENTS = 'pointerdown'; var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel'; // IE10 has prefixed support, and case-sensitive if (window.MSPointerEvent && !window.PointerEvent) { POINTER_ELEMENT_EVENTS = 'MSPointerDown'; POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel'; } /** * Pointer events input * @constructor * @extends Input */ function PointerEventInput() { this.evEl = POINTER_ELEMENT_EVENTS; this.evWin = POINTER_WINDOW_EVENTS; Input.apply(this, arguments); this.store = (this.manager.session.pointerEvents = []); } inherit(PointerEventInput, Input, { /** * handle mouse events * @param {Object} ev */ handler: function PEhandler(ev) { var store = this.store; var removePointer = false; var eventTypeNormalized = ev.type.toLowerCase().replace('ms', ''); var eventType = POINTER_INPUT_MAP[eventTypeNormalized]; var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType; var isTouch = (pointerType == INPUT_TYPE_TOUCH); // get index of the event in the store var storeIndex = inArray(store, ev.pointerId, 'pointerId'); // start and mouse must be down if (eventType & INPUT_START && (ev.button === 0 || isTouch)) { if (storeIndex < 0) { store.push(ev); storeIndex = store.length - 1; } } else if (eventType & (INPUT_END | INPUT_CANCEL)) { removePointer = true; } // it not found, so the pointer hasn't been down (so it's probably a hover) if (storeIndex < 0) { return; } // update the event in the store store[storeIndex] = ev; this.callback(this.manager, eventType, { pointers: store, changedPointers: [ev], pointerType: pointerType, srcEvent: ev }); if (removePointer) { // remove from the store store.splice(storeIndex, 1); } } }); var SINGLE_TOUCH_INPUT_MAP = { touchstart: INPUT_START, touchmove: INPUT_MOVE, touchend: INPUT_END, touchcancel: INPUT_CANCEL }; var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart'; var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel'; /** * Touch events input * @constructor * @extends Input */ function SingleTouchInput() { this.evTarget = SINGLE_TOUCH_TARGET_EVENTS; this.evWin = SINGLE_TOUCH_WINDOW_EVENTS; this.started = false; Input.apply(this, arguments); } inherit(SingleTouchInput, Input, { handler: function TEhandler(ev) { var type = SINGLE_TOUCH_INPUT_MAP[ev.type]; // should we handle the touch events? if (type === INPUT_START) { this.started = true; } if (!this.started) { return; } var touches = normalizeSingleTouches.call(this, ev, type); // when done, reset the started state if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) { this.started = false; } this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH, srcEvent: ev }); } }); /** * @this {TouchInput} * @param {Object} ev * @param {Number} type flag * @returns {undefined|Array} [all, changed] */ function normalizeSingleTouches(ev, type) { var all = toArray(ev.touches); var changed = toArray(ev.changedTouches); if (type & (INPUT_END | INPUT_CANCEL)) { all = uniqueArray(all.concat(changed), 'identifier', true); } return [all, changed]; } var TOUCH_INPUT_MAP = { touchstart: INPUT_START, touchmove: INPUT_MOVE, touchend: INPUT_END, touchcancel: INPUT_CANCEL }; var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel'; /** * Multi-user touch events input * @constructor * @extends Input */ function TouchInput() { this.evTarget = TOUCH_TARGET_EVENTS; this.targetIds = {}; Input.apply(this, arguments); } inherit(TouchInput, Input, { handler: function MTEhandler(ev) { var type = TOUCH_INPUT_MAP[ev.type]; var touches = getTouches.call(this, ev, type); if (!touches) { return; } this.callback(this.manager, type, { pointers: touches[0], changedPointers: touches[1], pointerType: INPUT_TYPE_TOUCH, srcEvent: ev }); } }); /** * @this {TouchInput} * @param {Object} ev * @param {Number} type flag * @returns {undefined|Array} [all, changed] */ function getTouches(ev, type) { var allTouches = toArray(ev.touches); var targetIds = this.targetIds; // when there is only one touch, the process can be simplified if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) { targetIds[allTouches[0].identifier] = true; return [allTouches, allTouches]; } var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target; // get target touches from touches targetTouches = allTouches.filter(function(touch) { return hasParent(touch.target, target); }); // collect touches if (type === INPUT_START) { i = 0; while (i < targetTouches.length) { targetIds[targetTouches[i].identifier] = true; i++; } } // filter changed touches to only contain touches that exist in the collected target ids i = 0; while (i < changedTouches.length) { if (targetIds[changedTouches[i].identifier]) { changedTargetTouches.push(changedTouches[i]); } // cleanup removed touches if (type & (INPUT_END | INPUT_CANCEL)) { delete targetIds[changedTouches[i].identifier]; } i++; } if (!changedTargetTouches.length) { return; } return [ // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel' uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true), changedTargetTouches ]; } /** * Combined touch and mouse input * * Touch has a higher priority then mouse, and while touching no mouse events are allowed. * This because touch devices also emit mouse events while doing a touch. * * @constructor * @extends Input */ var DEDUP_TIMEOUT = 2500; var DEDUP_DISTANCE = 25; function TouchMouseInput() { Input.apply(this, arguments); var handler = bindFn(this.handler, this); this.touch = new TouchInput(this.manager, handler); this.mouse = new MouseInput(this.manager, handler); this.primaryTouch = null; this.lastTouches = []; } inherit(TouchMouseInput, Input, { /** * handle mouse and touch events * @param {Hammer} manager * @param {String} inputEvent * @param {Object} inputData */ handler: function TMEhandler(manager, inputEvent, inputData) { var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE); if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) { return; } // when we're in a touch event, record touches to de-dupe synthetic mouse event if (isTouch) { recordTouches.call(this, inputEvent, inputData); } else if (isMouse && isSyntheticEvent.call(this, inputData)) { return; } this.callback(manager, inputEvent, inputData); }, /** * remove the event listeners */ destroy: function destroy() { this.touch.destroy(); this.mouse.destroy(); } }); function recordTouches(eventType, eventData) { if (eventType & INPUT_START) { this.primaryTouch = eventData.changedPointers[0].identifier; setLastTouch.call(this, eventData); } else if (eventType & (INPUT_END | INPUT_CANCEL)) { setLastTouch.call(this, eventData); } } function setLastTouch(eventData) { var touch = eventData.changedPointers[0]; if (touch.identifier === this.primaryTouch) { var lastTouch = {x: touch.clientX, y: touch.clientY}; this.lastTouches.push(lastTouch); var lts = this.lastTouches; var removeLastTouch = function() { var i = lts.indexOf(lastTouch); if (i > -1) { lts.splice(i, 1); } }; setTimeout(removeLastTouch, DEDUP_TIMEOUT); } } function isSyntheticEvent(eventData) { var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY; for (var i = 0; i < this.lastTouches.length; i++) { var t = this.lastTouches[i]; var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y); if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) { return true; } } return false; } var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction'); var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined; // magical touchAction value var TOUCH_ACTION_COMPUTE = 'compute'; var TOUCH_ACTION_AUTO = 'auto'; var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented var TOUCH_ACTION_NONE = 'none'; var TOUCH_ACTION_PAN_X = 'pan-x'; var TOUCH_ACTION_PAN_Y = 'pan-y'; var TOUCH_ACTION_MAP = getTouchActionProps(); /** * Touch Action * sets the touchAction property or uses the js alternative * @param {Manager} manager * @param {String} value * @constructor */ function TouchAction(manager, value) { this.manager = manager; this.set(value); } TouchAction.prototype = { /** * set the touchAction value on the element or enable the polyfill * @param {String} value */ set: function(value) { // find out the touch-action by the event handlers if (value == TOUCH_ACTION_COMPUTE) { value = this.compute(); } if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) { this.manager.element.style[PREFIXED_TOUCH_ACTION] = value; } this.actions = value.toLowerCase().trim(); }, /** * just re-set the touchAction value */ update: function() { this.set(this.manager.options.touchAction); }, /** * compute the value for the touchAction property based on the recognizer's settings * @returns {String} value */ compute: function() { var actions = []; each(this.manager.recognizers, function(recognizer) { if (boolOrFn(recognizer.options.enable, [recognizer])) { actions = actions.concat(recognizer.getTouchAction()); } }); return cleanTouchActions(actions.join(' ')); }, /** * this method is called on each input cycle and provides the preventing of the browser behavior * @param {Object} input */ preventDefaults: function(input) { var srcEvent = input.srcEvent; var direction = input.offsetDirection; // if the touch action did prevented once this session if (this.manager.session.prevented) { srcEvent.preventDefault(); return; } var actions = this.actions; var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE]; var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y]; var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X]; if (hasNone) { //do not prevent defaults if this is a tap gesture var isTapPointer = input.pointers.length === 1; var isTapMovement = input.distance < 2; var isTapTouchTime = input.deltaTime < 250; if (isTapPointer && isTapMovement && isTapTouchTime) { return; } } if (hasPanX && hasPanY) { // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent return; } if (hasNone || (hasPanY && direction & DIRECTION_HORIZONTAL) || (hasPanX && direction & DIRECTION_VERTICAL)) { return this.preventSrc(srcEvent); } }, /** * call preventDefault to prevent the browser's default behavior (scrolling in most cases) * @param {Object} srcEvent */ preventSrc: function(srcEvent) { this.manager.session.prevented = true; srcEvent.preventDefault(); } }; /** * when the touchActions are collected they are not a valid value, so we need to clean things up. * * @param {String} actions * @returns {*} */ function cleanTouchActions(actions) { // none if (inStr(actions, TOUCH_ACTION_NONE)) { return TOUCH_ACTION_NONE; } var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X); var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y); // if both pan-x and pan-y are set (different recognizers // for different directions, e.g. horizontal pan but vertical swipe?) // we need none (as otherwise with pan-x pan-y combined none of these // recognizers will work, since the browser would handle all panning if (hasPanX && hasPanY) { return TOUCH_ACTION_NONE; } // pan-x OR pan-y if (hasPanX || hasPanY) { return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y; } // manipulation if (inStr(actions, TOUCH_ACTION_MANIPULATION)) { return TOUCH_ACTION_MANIPULATION; } return TOUCH_ACTION_AUTO; } function getTouchActionProps() { if (!NATIVE_TOUCH_ACTION) { return false; } var touchMap = {}; var cssSupports = window.CSS && window.CSS.supports; ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function(val) { // If css.supports is not supported but there is native touch-action assume it supports // all values. This is the case for IE 10 and 11. touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true; }); return touchMap; } /** * Recognizer flow explained; * * All recognizers have the initial state of POSSIBLE when a input session starts. * The definition of a input session is from the first input until the last input, with all it's movement in it. * * Example session for mouse-input: mousedown -> mousemove -> mouseup * * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed * which determines with state it should be. * * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to * POSSIBLE to give it another change on the next cycle. * * Possible * | * +-----+---------------+ * | | * +-----+-----+ | * | | | * Failed Cancelled | * +-------+------+ * | | * Recognized Began * | * Changed * | * Ended/Recognized */ var STATE_POSSIBLE = 1; var STATE_BEGAN = 2; var STATE_CHANGED = 4; var STATE_ENDED = 8; var STATE_RECOGNIZED = STATE_ENDED; var STATE_CANCELLED = 16; var STATE_FAILED = 32; /** * Recognizer * Every recognizer needs to extend from this class. * @constructor * @param {Object} options */ function Recognizer(options) { this.options = assign({}, this.defaults, options || {}); this.id = uniqueId(); this.manager = null; // default is enable true this.options.enable = ifUndefined(this.options.enable, true); this.state = STATE_POSSIBLE; this.simultaneous = {}; this.requireFail = []; } Recognizer.prototype = { /** * @virtual * @type {Object} */ defaults: {}, /** * set options * @param {Object} options * @return {Recognizer} */ set: function(options) { assign(this.options, options); // also update the touchAction, in case something changed about the directions/enabled state this.manager && this.manager.touchAction.update(); return this; }, /** * recognize simultaneous with an other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ recognizeWith: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) { return this; } var simultaneous = this.simultaneous; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); if (!simultaneous[otherRecognizer.id]) { simultaneous[otherRecognizer.id] = otherRecognizer; otherRecognizer.recognizeWith(this); } return this; }, /** * drop the simultaneous link. it doesnt remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ dropRecognizeWith: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) { return this; } otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); delete this.simultaneous[otherRecognizer.id]; return this; }, /** * recognizer can only run when an other is failing * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ requireFailure: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) { return this; } var requireFail = this.requireFail; otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); if (inArray(requireFail, otherRecognizer) === -1) { requireFail.push(otherRecognizer); otherRecognizer.requireFailure(this); } return this; }, /** * drop the requireFailure link. it does not remove the link on the other recognizer. * @param {Recognizer} otherRecognizer * @returns {Recognizer} this */ dropRequireFailure: function(otherRecognizer) { if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) { return this; } otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this); var index = inArray(this.requireFail, otherRecognizer); if (index > -1) { this.requireFail.splice(index, 1); } return this; }, /** * has require failures boolean * @returns {boolean} */ hasRequireFailures: function() { return this.requireFail.length > 0; }, /** * if the recognizer can recognize simultaneous with an other recognizer * @param {Recognizer} otherRecognizer * @returns {Boolean} */ canRecognizeWith: function(otherRecognizer) { return !!this.simultaneous[otherRecognizer.id]; }, /** * You should use `tryEmit` instead of `emit` directly to check * that all the needed recognizers has failed before emitting. * @param {Object} input */ emit: function(input) { var self = this; var state = this.state; function emit(event) { self.manager.emit(event, input); } // 'panstart' and 'panmove' if (state < STATE_ENDED) { emit(self.options.event + stateStr(state)); } emit(self.options.event); // simple 'eventName' events if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...) emit(input.additionalEvent); } // panend and pancancel if (state >= STATE_ENDED) { emit(self.options.event + stateStr(state)); } }, /** * Check that all the require failure recognizers has failed, * if true, it emits a gesture event, * otherwise, setup the state to FAILED. * @param {Object} input */ tryEmit: function(input) { if (this.canEmit()) { return this.emit(input); } // it's failing anyway this.state = STATE_FAILED; }, /** * can we emit? * @returns {boolean} */ canEmit: function() { var i = 0; while (i < this.requireFail.length) { if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) { return false; } i++; } return true; }, /** * update the recognizer * @param {Object} inputData */ recognize: function(inputData) { // make a new copy of the inputData // so we can change the inputData without messing up the other recognizers var inputDataClone = assign({}, inputData); // is is enabled and allow recognizing? if (!boolOrFn(this.options.enable, [this, inputDataClone])) { this.reset(); this.state = STATE_FAILED; return; } // reset when we've reached the end if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) { this.state = STATE_POSSIBLE; } this.state = this.process(inputDataClone); // the recognizer has recognized a gesture // so trigger an event if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) { this.tryEmit(inputDataClone); } }, /** * return the state of the recognizer * the actual recognizing happens in this method * @virtual * @param {Object} inputData * @returns {Const} STATE */ process: function(inputData) { }, // jshint ignore:line /** * return the preferred touch-action * @virtual * @returns {Array} */ getTouchAction: function() { }, /** * called when the gesture isn't allowed to recognize * like when another is being recognized or it is disabled * @virtual */ reset: function() { } }; /** * get a usable string, used as event postfix * @param {Const} state * @returns {String} state */ function stateStr(state) { if (state & STATE_CANCELLED) { return 'cancel'; } else if (state & STATE_ENDED) { return 'end'; } else if (state & STATE_CHANGED) { return 'move'; } else if (state & STATE_BEGAN) { return 'start'; } return ''; } /** * direction cons to string * @param {Const} direction * @returns {String} */ function directionStr(direction) { if (direction == DIRECTION_DOWN) { return 'down'; } else if (direction == DIRECTION_UP) { return 'up'; } else if (direction == DIRECTION_LEFT) { return 'left'; } else if (direction == DIRECTION_RIGHT) { return 'right'; } return ''; } /** * get a recognizer by name if it is bound to a manager * @param {Recognizer|String} otherRecognizer * @param {Recognizer} recognizer * @returns {Recognizer} */ function getRecognizerByNameIfManager(otherRecognizer, recognizer) { var manager = recognizer.manager; if (manager) { return manager.get(otherRecognizer); } return otherRecognizer; } /** * This recognizer is just used as a base for the simple attribute recognizers. * @constructor * @extends Recognizer */ function AttrRecognizer() { Recognizer.apply(this, arguments); } inherit(AttrRecognizer, Recognizer, { /** * @namespace * @memberof AttrRecognizer */ defaults: { /** * @type {Number} * @default 1 */ pointers: 1 }, /** * Used to check if it the recognizer receives valid input, like input.distance > 10. * @memberof AttrRecognizer * @param {Object} input * @returns {Boolean} recognized */ attrTest: function(input) { var optionPointers = this.options.pointers; return optionPointers === 0 || input.pointers.length === optionPointers; }, /** * Process the input and return the state for the recognizer * @memberof AttrRecognizer * @param {Object} input * @returns {*} State */ process: function(input) { var state = this.state; var eventType = input.eventType; var isRecognized = state & (STATE_BEGAN | STATE_CHANGED); var isValid = this.attrTest(input); // on cancel input and we've recognized before, return STATE_CANCELLED if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) { return state | STATE_CANCELLED; } else if (isRecognized || isValid) { if (eventType & INPUT_END) { return state | STATE_ENDED; } else if (!(state & STATE_BEGAN)) { return STATE_BEGAN; } return state | STATE_CHANGED; } return STATE_FAILED; } }); /** * Pan * Recognized when the pointer is down and moved in the allowed direction. * @constructor * @extends AttrRecognizer */ function PanRecognizer() { AttrRecognizer.apply(this, arguments); this.pX = null; this.pY = null; } inherit(PanRecognizer, AttrRecognizer, { /** * @namespace * @memberof PanRecognizer */ defaults: { event: 'pan', threshold: 10, pointers: 1, direction: DIRECTION_ALL }, getTouchAction: function() { var direction = this.options.direction; var actions = []; if (direction & DIRECTION_HORIZONTAL) { actions.push(TOUCH_ACTION_PAN_Y); } if (direction & DIRECTION_VERTICAL) { actions.push(TOUCH_ACTION_PAN_X); } return actions; }, directionTest: function(input) { var options = this.options; var hasMoved = true; var distance = input.distance; var direction = input.direction; var x = input.deltaX; var y = input.deltaY; // lock to axis? if (!(direction & options.direction)) { if (options.direction & DIRECTION_HORIZONTAL) { direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT; hasMoved = x != this.pX; distance = Math.abs(input.deltaX); } else { direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN; hasMoved = y != this.pY; distance = Math.abs(input.deltaY); } } input.direction = direction; return hasMoved && distance > options.threshold && direction & options.direction; }, attrTest: function(input) { return AttrRecognizer.prototype.attrTest.call(this, input) && (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input))); }, emit: function(input) { this.pX = input.deltaX; this.pY = input.deltaY; var direction = directionStr(input.direction); if (direction) { input.additionalEvent = this.options.event + direction; } this._super.emit.call(this, input); } }); /** * Pinch * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out). * @constructor * @extends AttrRecognizer */ function PinchRecognizer() { AttrRecognizer.apply(this, arguments); } inherit(PinchRecognizer, AttrRecognizer, { /** * @namespace * @memberof PinchRecognizer */ defaults: { event: 'pinch', threshold: 0, pointers: 2 }, getTouchAction: function() { return [TOUCH_ACTION_NONE]; }, attrTest: function(input) { return this._super.attrTest.call(this, input) && (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN); }, emit: function(input) { if (input.scale !== 1) { var inOut = input.scale < 1 ? 'in' : 'out'; input.additionalEvent = this.options.event + inOut; } this._super.emit.call(this, input); } }); /** * Press * Recognized when the pointer is down for x ms without any movement. * @constructor * @extends Recognizer */ function PressRecognizer() { Recognizer.apply(this, arguments); this._timer = null; this._input = null; } inherit(PressRecognizer, Recognizer, { /** * @namespace * @memberof PressRecognizer */ defaults: { event: 'press', pointers: 1, time: 251, // minimal time of the pointer to be pressed threshold: 9 // a minimal movement is ok, but keep it low }, getTouchAction: function() { return [TOUCH_ACTION_AUTO]; }, process: function(input) { var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTime = input.deltaTime > options.time; this._input = input; // we only allow little movement // and we've reached an end event, so a tap is possible if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) { this.reset(); } else if (input.eventType & INPUT_START) { this.reset(); this._timer = setTimeoutContext(function() { this.state = STATE_RECOGNIZED; this.tryEmit(); }, options.time, this); } else if (input.eventType & INPUT_END) { return STATE_RECOGNIZED; } return STATE_FAILED; }, reset: function() { clearTimeout(this._timer); }, emit: function(input) { if (this.state !== STATE_RECOGNIZED) { return; } if (input && (input.eventType & INPUT_END)) { this.manager.emit(this.options.event + 'up', input); } else { this._input.timeStamp = now(); this.manager.emit(this.options.event, this._input); } } }); /** * Rotate * Recognized when two or more pointer are moving in a circular motion. * @constructor * @extends AttrRecognizer */ function RotateRecognizer() { AttrRecognizer.apply(this, arguments); } inherit(RotateRecognizer, AttrRecognizer, { /** * @namespace * @memberof RotateRecognizer */ defaults: { event: 'rotate', threshold: 0, pointers: 2 }, getTouchAction: function() { return [TOUCH_ACTION_NONE]; }, attrTest: function(input) { return this._super.attrTest.call(this, input) && (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN); } }); /** * Swipe * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction. * @constructor * @extends AttrRecognizer */ function SwipeRecognizer() { AttrRecognizer.apply(this, arguments); } inherit(SwipeRecognizer, AttrRecognizer, { /** * @namespace * @memberof SwipeRecognizer */ defaults: { event: 'swipe', threshold: 10, velocity: 0.3, direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL, pointers: 1 }, getTouchAction: function() { return PanRecognizer.prototype.getTouchAction.call(this); }, attrTest: function(input) { var direction = this.options.direction; var velocity; if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) { velocity = input.overallVelocity; } else if (direction & DIRECTION_HORIZONTAL) { velocity = input.overallVelocityX; } else if (direction & DIRECTION_VERTICAL) { velocity = input.overallVelocityY; } return this._super.attrTest.call(this, input) && direction & input.offsetDirection && input.distance > this.options.threshold && input.maxPointers == this.options.pointers && abs(velocity) > this.options.velocity && input.eventType & INPUT_END; }, emit: function(input) { var direction = directionStr(input.offsetDirection); if (direction) { this.manager.emit(this.options.event + direction, input); } this.manager.emit(this.options.event, input); } }); /** * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur * between the given interval and position. The delay option can be used to recognize multi-taps without firing * a single tap. * * The eventData from the emitted event contains the property `tapCount`, which contains the amount of * multi-taps being recognized. * @constructor * @extends Recognizer */ function TapRecognizer() { Recognizer.apply(this, arguments); // previous time and center, // used for tap counting this.pTime = false; this.pCenter = false; this._timer = null; this._input = null; this.count = 0; } inherit(TapRecognizer, Recognizer, { /** * @namespace * @memberof PinchRecognizer */ defaults: { event: 'tap', pointers: 1, taps: 1, interval: 300, // max time between the multi-tap taps time: 250, // max time of the pointer to be down (like finger on the screen) threshold: 9, // a minimal movement is ok, but keep it low posThreshold: 10 // a multi-tap can be a bit off the initial position }, getTouchAction: function() { return [TOUCH_ACTION_MANIPULATION]; }, process: function(input) { var options = this.options; var validPointers = input.pointers.length === options.pointers; var validMovement = input.distance < options.threshold; var validTouchTime = input.deltaTime < options.time; this.reset(); if ((input.eventType & INPUT_START) && (this.count === 0)) { return this.failTimeout(); } // we only allow little movement // and we've reached an end event, so a tap is possible if (validMovement && validTouchTime && validPointers) { if (input.eventType != INPUT_END) { return this.failTimeout(); } var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true; var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold; this.pTime = input.timeStamp; this.pCenter = input.center; if (!validMultiTap || !validInterval) { this.count = 1; } else { this.count += 1; } this._input = input; // if tap count matches we have recognized it, // else it has began recognizing... var tapCount = this.count % options.taps; if (tapCount === 0) { // no failing requirements, immediately trigger the tap event // or wait as long as the multitap interval to trigger if (!this.hasRequireFailures()) { return STATE_RECOGNIZED; } else { this._timer = setTimeoutContext(function() { this.state = STATE_RECOGNIZED; this.tryEmit(); }, options.interval, this); return STATE_BEGAN; } } } return STATE_FAILED; }, failTimeout: function() { this._timer = setTimeoutContext(function() { this.state = STATE_FAILED; }, this.options.interval, this); return STATE_FAILED; }, reset: function() { clearTimeout(this._timer); }, emit: function() { if (this.state == STATE_RECOGNIZED) { this._input.tapCount = this.count; this.manager.emit(this.options.event, this._input); } } }); /** * Simple way to create a manager with a default set of recognizers. * @param {HTMLElement} element * @param {Object} [options] * @constructor */ function Hammer(element, options) { options = options || {}; options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset); return new Manager(element, options); } /** * @const {string} */ Hammer.VERSION = '2.0.7'; /** * default settings * @namespace */ Hammer.defaults = { /** * set if DOM events are being triggered. * But this is slower and unused by simple implementations, so disabled by default. * @type {Boolean} * @default false */ domEvents: false, /** * The value for the touchAction property/fallback. * When set to `compute` it will magically set the correct value based on the added recognizers. * @type {String} * @default compute */ touchAction: TOUCH_ACTION_COMPUTE, /** * @type {Boolean} * @default true */ enable: true, /** * EXPERIMENTAL FEATURE -- can be removed/changed * Change the parent input target element. * If Null, then it is being set the to main element. * @type {Null|EventTarget} * @default null */ inputTarget: null, /** * force an input class * @type {Null|Function} * @default null */ inputClass: null, /** * Default recognizer setup when calling `Hammer()` * When creating a new Manager these will be skipped. * @type {Array} */ preset: [ // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...] [RotateRecognizer, {enable: false}], [PinchRecognizer, {enable: false}, ['rotate']], [SwipeRecognizer, {direction: DIRECTION_HORIZONTAL}], [PanRecognizer, {direction: DIRECTION_HORIZONTAL}, ['swipe']], [TapRecognizer], [TapRecognizer, {event: 'doubletap', taps: 2}, ['tap']], [PressRecognizer] ], /** * Some CSS properties can be used to improve the working of Hammer. * Add them to this method and they will be set when creating a new Manager. * @namespace */ cssProps: { /** * Disables text selection to improve the dragging gesture. Mainly for desktop browsers. * @type {String} * @default 'none' */ userSelect: 'none', /** * Disable the Windows Phone grippers when pressing an element. * @type {String} * @default 'none' */ touchSelect: 'none', /** * Disables the default callout shown when you touch and hold a touch target. * On iOS, when you touch and hold a touch target such as a link, Safari displays * a callout containing information about the link. This property allows you to disable that callout. * @type {String} * @default 'none' */ touchCallout: 'none', /** * Specifies whether zooming is enabled. Used by IE10> * @type {String} * @default 'none' */ contentZooming: 'none', /** * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers. * @type {String} * @default 'none' */ userDrag: 'none', /** * Overrides the highlight color shown when the user taps a link or a JavaScript * clickable element in iOS. This property obeys the alpha value, if specified. * @type {String} * @default 'rgba(0,0,0,0)' */ tapHighlightColor: 'rgba(0,0,0,0)' } }; var STOP = 1; var FORCED_STOP = 2; /** * Manager * @param {HTMLElement} element * @param {Object} [options] * @constructor */ function Manager(element, options) { this.options = assign({}, Hammer.defaults, options || {}); this.options.inputTarget = this.options.inputTarget || element; this.handlers = {}; this.session = {}; this.recognizers = []; this.oldCssProps = {}; this.element = element; this.input = createInputInstance(this); this.touchAction = new TouchAction(this, this.options.touchAction); toggleCssProps(this, true); each(this.options.recognizers, function(item) { var recognizer = this.add(new (item[0])(item[1])); item[2] && recognizer.recognizeWith(item[2]); item[3] && recognizer.requireFailure(item[3]); }, this); } Manager.prototype = { /** * set options * @param {Object} options * @returns {Manager} */ set: function(options) { assign(this.options, options); // Options that need a little more setup if (options.touchAction) { this.touchAction.update(); } if (options.inputTarget) { // Clean up existing event listeners and reinitialize this.input.destroy(); this.input.target = options.inputTarget; this.input.init(); } return this; }, /** * stop recognizing for this session. * This session will be discarded, when a new [input]start event is fired. * When forced, the recognizer cycle is stopped immediately. * @param {Boolean} [force] */ stop: function(force) { this.session.stopped = force ? FORCED_STOP : STOP; }, /** * run the recognizers! * called by the inputHandler function on every movement of the pointers (touches) * it walks through all the recognizers and tries to detect the gesture that is being made * @param {Object} inputData */ recognize: function(inputData) { var session = this.session; if (session.stopped) { return; } // run the touch-action polyfill this.touchAction.preventDefaults(inputData); var recognizer; var recognizers = this.recognizers; // this holds the recognizer that is being recognized. // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED // if no recognizer is detecting a thing, it is set to `null` var curRecognizer = session.curRecognizer; // reset when the last recognizer is recognized // or when we're in a new session if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) { curRecognizer = session.curRecognizer = null; } var i = 0; while (i < recognizers.length) { recognizer = recognizers[i]; // find out if we are allowed try to recognize the input for this one. // 1. allow if the session is NOT forced stopped (see the .stop() method) // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one // that is being recognized. // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer. // this can be setup with the `recognizeWith()` method on the recognizer. if (session.stopped !== FORCED_STOP && ( // 1 !curRecognizer || recognizer == curRecognizer || // 2 recognizer.canRecognizeWith(curRecognizer))) { // 3 recognizer.recognize(inputData); } else { recognizer.reset(); } // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the // current active recognizer. but only if we don't already have an active recognizer if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) { curRecognizer = session.curRecognizer = recognizer; } i++; } }, /** * get a recognizer by its event name. * @param {Recognizer|String} recognizer * @returns {Recognizer|Null} */ get: function(recognizer) { if (recognizer instanceof Recognizer) { return recognizer; } var recognizers = this.recognizers; for (var i = 0; i < recognizers.length; i++) { if (recognizers[i].options.event == recognizer) { return recognizers[i]; } } return null; }, /** * add a recognizer to the manager * existing recognizers with the same event name will be removed * @param {Recognizer} recognizer * @returns {Recognizer|Manager} */ add: function(recognizer) { if (invokeArrayArg(recognizer, 'add', this)) { return this; } // remove existing var existing = this.get(recognizer.options.event); if (existing) { this.remove(existing); } this.recognizers.push(recognizer); recognizer.manager = this; this.touchAction.update(); return recognizer; }, /** * remove a recognizer by name or instance * @param {Recognizer|String} recognizer * @returns {Manager} */ remove: function(recognizer) { if (invokeArrayArg(recognizer, 'remove', this)) { return this; } recognizer = this.get(recognizer); // let's make sure this recognizer exists if (recognizer) { var recognizers = this.recognizers; var index = inArray(recognizers, recognizer); if (index !== -1) { recognizers.splice(index, 1); this.touchAction.update(); } } return this; }, /** * bind event * @param {String} events * @param {Function} handler * @returns {EventEmitter} this */ on: function(events, handler) { if (events === undefined) { return; } if (handler === undefined) { return; } var handlers = this.handlers; each(splitStr(events), function(event) { handlers[event] = handlers[event] || []; handlers[event].push(handler); }); return this; }, /** * unbind event, leave emit blank to remove all handlers * @param {String} events * @param {Function} [handler] * @returns {EventEmitter} this */ off: function(events, handler) { if (events === undefined) { return; } var handlers = this.handlers; each(splitStr(events), function(event) { if (!handler) { delete handlers[event]; } else { handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1); } }); return this; }, /** * emit event to the listeners * @param {String} event * @param {Object} data */ emit: function(event, data) { // we also want to trigger dom events if (this.options.domEvents) { triggerDomEvent(event, data); } // no handlers, so skip it all var handlers = this.handlers[event] && this.handlers[event].slice(); if (!handlers || !handlers.length) { return; } data.type = event; data.preventDefault = function() { data.srcEvent.preventDefault(); }; var i = 0; while (i < handlers.length) { handlers[i](data); i++; } }, /** * destroy the manager and unbinds all events * it doesn't unbind dom events, that is the user own responsibility */ destroy: function() { this.element && toggleCssProps(this, false); this.handlers = {}; this.session = {}; this.input.destroy(); this.element = null; } }; /** * add/remove the css properties as defined in manager.options.cssProps * @param {Manager} manager * @param {Boolean} add */ function toggleCssProps(manager, add) { var element = manager.element; if (!element.style) { return; } var prop; each(manager.options.cssProps, function(value, name) { prop = prefixed(element.style, name); if (add) { manager.oldCssProps[prop] = element.style[prop]; element.style[prop] = value; } else { element.style[prop] = manager.oldCssProps[prop] || ''; } }); if (!add) { manager.oldCssProps = {}; } } /** * trigger dom event * @param {String} event * @param {Object} data */ function triggerDomEvent(event, data) { var gestureEvent = document.createEvent('Event'); gestureEvent.initEvent(event, true, true); gestureEvent.gesture = data; data.target.dispatchEvent(gestureEvent); } assign(Hammer, { INPUT_START: INPUT_START, INPUT_MOVE: INPUT_MOVE, INPUT_END: INPUT_END, INPUT_CANCEL: INPUT_CANCEL, STATE_POSSIBLE: STATE_POSSIBLE, STATE_BEGAN: STATE_BEGAN, STATE_CHANGED: STATE_CHANGED, STATE_ENDED: STATE_ENDED, STATE_RECOGNIZED: STATE_RECOGNIZED, STATE_CANCELLED: STATE_CANCELLED, STATE_FAILED: STATE_FAILED, DIRECTION_NONE: DIRECTION_NONE, DIRECTION_LEFT: DIRECTION_LEFT, DIRECTION_RIGHT: DIRECTION_RIGHT, DIRECTION_UP: DIRECTION_UP, DIRECTION_DOWN: DIRECTION_DOWN, DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL, DIRECTION_VERTICAL: DIRECTION_VERTICAL, DIRECTION_ALL: DIRECTION_ALL, Manager: Manager, Input: Input, TouchAction: TouchAction, TouchInput: TouchInput, MouseInput: MouseInput, PointerEventInput: PointerEventInput, TouchMouseInput: TouchMouseInput, SingleTouchInput: SingleTouchInput, Recognizer: Recognizer, AttrRecognizer: AttrRecognizer, Tap: TapRecognizer, Pan: PanRecognizer, Swipe: SwipeRecognizer, Pinch: PinchRecognizer, Rotate: RotateRecognizer, Press: PressRecognizer, on: addEventListeners, off: removeEventListeners, each: each, merge: merge, extend: extend, assign: assign, inherit: inherit, bindFn: bindFn, prefixed: prefixed }); // this prevents errors when Hammer is loaded in the presence of an AMD // style loader but by script tag, not by the loader. var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line freeGlobal.Hammer = Hammer; if (true) { !(__WEBPACK_AMD_DEFINE_RESULT__ = function() { return Hammer; }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else if (typeof module != 'undefined' && module.exports) { module.exports = Hammer; } else { window[exportName] = Hammer; } })(window, document, 'Hammer'); /***/ }), /* 625 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__object_3d__ = __webpack_require__(250); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_math_gl__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_assert__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Group = /*#__PURE__*/function (_Object3D) { _inherits(Group, _Object3D); function Group() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _classCallCheck(this, Group); var _opts$children = opts.children, children = _opts$children === undefined ? [] : _opts$children; children.every(function (child) { return __WEBPACK_IMPORTED_MODULE_2_assert___default()(child instanceof __WEBPACK_IMPORTED_MODULE_0__object_3d__["a" /* default */]); }); var _this = _possibleConstructorReturn(this, (Group.__proto__ || Object.getPrototypeOf(Group)).call(this, opts)); _this.children = children; return _this; } // Unpacks arrays and nested arrays of children _createClass(Group, [{ key: 'add', value: function add() { for (var _len = arguments.length, children = Array(_len), _key = 0; _key < _len; _key++) { children[_key] = arguments[_key]; } var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = children[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var child = _step.value; if (Array.isArray(child)) { this.add.apply(this, _toConsumableArray(child)); } else { this.children.push(child); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return this; } }, { key: 'remove', value: function remove(child) { var children = this.children; var indexOf = children.indexOf(child); if (indexOf > -1) { children.splice(indexOf, 1); } return this; } }, { key: 'removeAll', value: function removeAll() { this.children = []; return this; } // If visitor returns a truthy value, traversal will be aborted and that value // will be returned from `traverse`. Otherwise `traverse` will return null. }, { key: 'traverse', value: function traverse(visitor) { var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref$modelMatrix = _ref.modelMatrix, modelMatrix = _ref$modelMatrix === undefined ? new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Matrix4"]() : _ref$modelMatrix; var _iteratorNormalCompletion2 = true; var _didIteratorError2 = false; var _iteratorError2 = undefined; try { for (var _iterator2 = this.children[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { var child = _step2.value; var matrix = child.matrix; modelMatrix = modelMatrix.multiplyRight(matrix); var result = void 0; if (child instanceof Group) { result = child.traverse(visitor, { modelMatrix: modelMatrix }); } else { // child.setUniforms({modelMatrix}); result = visitor(child, {}); } // Abort if a result was returned if (result) { return result; } } } catch (err) { _didIteratorError2 = true; _iteratorError2 = err; } finally { try { if (!_iteratorNormalCompletion2 && _iterator2.return) { _iterator2.return(); } } finally { if (_didIteratorError2) { throw _iteratorError2; } } } return null; } // If visitor returns a truthy value, traversal will be aborted and that value // will be returned from `traverseReverse`. Otherwise `traverseReverse` will return null. }, { key: 'traverseReverse', value: function traverseReverse(visitor) { var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$modelMatrix = _ref2.modelMatrix, modelMatrix = _ref2$modelMatrix === undefined ? new __WEBPACK_IMPORTED_MODULE_1_math_gl__["Matrix4"]() : _ref2$modelMatrix; for (var i = this.children.length - 1; i >= 0; --i) { var child = this.children[i]; var matrix = child.matrix; modelMatrix = modelMatrix.multiplyRight(matrix); var result = void 0; if (child instanceof Group) { result = child.traverseReverse(visitor, { modelMatrix: modelMatrix }); } else { // child.setUniforms({modelMatrix}); result = visitor(child, {}); } // Abort if a result was returned if (result) { return result; } } return null; } }]); return Group; }(__WEBPACK_IMPORTED_MODULE_0__object_3d__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Group); //# sourceMappingURL=group.js.map /***/ }), /* 626 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = pickModels; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl__ = __webpack_require__(61); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils__ = __webpack_require__(8); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__group__ = __webpack_require__(625); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_assert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* global window */ var ILLEGAL_ARG = 'Illegal argument to pick'; function getDevicePixelRatio() { return typeof window !== 'undefined' ? window.devicePixelRatio : 1; } function pickModels(gl, _ref) { var models = _ref.models, position = _ref.position, _ref$uniforms = _ref.uniforms, uniforms = _ref$uniforms === undefined ? {} : _ref$uniforms, _ref$parameters = _ref.parameters, parameters = _ref$parameters === undefined ? {} : _ref$parameters, settings = _ref.settings, _ref$useDevicePixelRa = _ref.useDevicePixelRatio, useDevicePixelRatio = _ref$useDevicePixelRa === undefined ? null : _ref$useDevicePixelRa, _ref$useDevicePixels = _ref.useDevicePixels, useDevicePixels = _ref$useDevicePixels === undefined ? true : _ref$useDevicePixels, framebuffer = _ref.framebuffer; __WEBPACK_IMPORTED_MODULE_3_assert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl__["isWebGL"])(gl), ILLEGAL_ARG); __WEBPACK_IMPORTED_MODULE_3_assert___default()(framebuffer, ILLEGAL_ARG); __WEBPACK_IMPORTED_MODULE_3_assert___default()(position, ILLEGAL_ARG); if (useDevicePixelRatio !== null) { __WEBPACK_IMPORTED_MODULE_1__utils__["b" /* log */].deprecated('useDevicePixelRatio', 'useDevicePixels'); useDevicePixels = useDevicePixelRatio; } var _position = _slicedToArray(position, 2), x = _position[0], y = _position[1]; // Match our picking framebuffer with the size of the canvas drawing buffer framebuffer.resize({ width: gl.canvas.width, height: gl.canvas.height }); // Compensate for devicePixelRatio // Note: this assumes the canvas framebuffer has been matched var dpr = useDevicePixels ? getDevicePixelRatio() : 1; // Reverse the y coordinate var deviceX = x * dpr; var deviceY = gl.canvas.height - y * dpr; // return withParameters(gl, { // // framebuffer, // // // We are only interested in one pixel, no need to render anything else // // scissorTest: {x: deviceX, y: deviceY, w: 1, h: 1} // }, () => { var group = new __WEBPACK_IMPORTED_MODULE_2__group__["a" /* default */]({ children: models }); return group.traverseReverse(function (model) { if (model.isPickable()) { // Clear the frame buffer __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl__["clear"])(gl, { framebuffer: framebuffer, color: true, depth: true }); // Render picking colors /* eslint-disable camelcase */ model.setUniforms({ picking_uActive: 1 }); model.draw({ uniforms: uniforms, parameters: parameters, settings: settings, framebuffer: framebuffer }); model.setUniforms({ picking_uActive: 0 }); // Sample Read color in the central pixel, to be mapped as a picking color var color = framebuffer.readPixels({ x: deviceX, y: deviceY, width: 1, height: 1, format: gl.RGBA, type: gl.UNSIGNED_BYTE }); var isPicked = color[0] !== 0 || color[1] !== 0 || color[2] !== 0; // Add the information to the stack if (isPicked) { return { model: model, color: color, x: x, y: y, deviceX: deviceX, deviceY: deviceY }; } } return null; }); // }); } //# sourceMappingURL=pick-models.js.map /***/ }), /* 627 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = encodePickingColor; /* harmony export (immutable) */ __webpack_exports__["b"] = decodePickingColor; /* harmony export (immutable) */ __webpack_exports__["c"] = getNullPickingColor; var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var NULL_PICKING_COLOR = new Uint8Array([0, 0, 0]); // Encodes an index as a Uint8Array([r, g, b]) format picking color function encodePickingColor(i) { return [i + 1 & 255, i + 1 >> 8 & 255, i + 1 >> 16 & 255]; } // Decodes a picking color in [r, g, b] format to an index function decodePickingColor(color) { // assert(color instanceof Uint8Array); var _color = _slicedToArray(color, 3), i1 = _color[0], i2 = _color[1], i3 = _color[2]; // 1 was added to seperate from no selection var index = i1 + i2 * 256 + i3 * 65536 - 1; return index; } // Return picking color representing no item at that pixel function getNullPickingColor() { return NULL_PICKING_COLOR; } //# sourceMappingURL=picking-colors.js.map /***/ }), /* 628 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return addModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return logModel; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return removeModel; }); /* unused harmony export setOverride */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getOverrides; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_seer__ = __webpack_require__(173); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_seer___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_seer__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_globals__ = __webpack_require__(261); var models = {}; /** * Add a model to our cache indexed by id */ var addModel = function addModel(model) { if (models[model.id]) { return; } models[model.id] = model; __WEBPACK_IMPORTED_MODULE_0_seer___default.a.listItem('luma.gl', model.id); }; /** * Log a model uniforms and attributes. */ var logModel = function logModel(model, uniforms) { if (!__WEBPACK_IMPORTED_MODULE_0_seer___default.a.isReady() || __WEBPACK_IMPORTED_MODULE_0_seer___default.a.throttle('luma.gl:' + model.id, 1E3)) { return; } var attributesObject = Object.assign({}, model.geometry.attributes, model.attributes); var uniformsObject = Object.assign({}, model.uniforms, uniforms); __WEBPACK_IMPORTED_MODULE_0_seer___default.a.multiUpdate('luma.gl', model.id, [{ path: 'objects.uniforms', data: uniformsObject }, { path: 'objects.attributes', data: attributesObject }]); }; /** * Remove a previously set model from the cache */ var removeModel = function removeModel(id) { delete models[id]; __WEBPACK_IMPORTED_MODULE_0_seer___default.a.deleteItem('luma.gl', id); }; /** * Recursively traverse an object given a path of properties and set the given value */ var recursiveSet = function recursiveSet(obj, path, value) { if (!obj) { return; } if (path.length > 1) { recursiveSet(obj[path[0]], path.slice(1), value); } else { obj[path[0]] = value; } }; var overrides = new Map(); /** * Create an override on the specify layer, indexed by a valuePath array. * Do nothing in case Seer as not been initialized to prevent any preformance drawback. */ var setOverride = function setOverride(id, valuePath, value) { if (!__WEBPACK_IMPORTED_MODULE_1__utils_globals__["a" /* window */].__SEER_INITIALIZED__) { return; } if (!overrides.has(id)) { overrides.set(id, new Map()); } var uniforms = overrides.get(id); uniforms.set(valuePath, value); }; /** * Apply overrides to a specific model's uniforms */ var getOverrides = function getOverrides(id, uniforms) { if (!__WEBPACK_IMPORTED_MODULE_1__utils_globals__["a" /* window */].__SEER_INITIALIZED__ || !id) { return; } var overs = overrides.get(id); if (!overs) { return; } overs.forEach(function (value, valuePath) { recursiveSet(uniforms, valuePath, value); }); }; /** * Listen for luma.gl edit events */ __WEBPACK_IMPORTED_MODULE_0_seer___default.a.listenFor('luma.gl', function (payload) { var model = models[payload.itemKey]; if (!model || payload.type !== 'edit' || payload.valuePath[0] !== 'uniforms') { return; } var valuePath = payload.valuePath.slice(1); setOverride(payload.itemKey, valuePath, payload.value); var uniforms = model.getUniforms(); recursiveSet(uniforms, valuePath, payload.value); model.setUniforms(uniforms); }); //# sourceMappingURL=seer-integration.js.map /***/ }), /* 629 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); exports.requestFile = requestFile; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Supports loading (requesting) assets with XHR (XmlHttpRequest) /* eslint-disable guard-for-in, complexity, no-try-catch */ /* global XMLHttpRequest */ function noop() {} var XHR_STATES = { UNINITIALIZED: 0, LOADING: 1, LOADED: 2, INTERACTIVE: 3, COMPLETED: 4 }; var XHR = function () { function XHR(_ref) { var url = _ref.url, _ref$path = _ref.path, path = _ref$path === undefined ? null : _ref$path, _ref$method = _ref.method, method = _ref$method === undefined ? 'GET' : _ref$method, _ref$asynchronous = _ref.asynchronous, asynchronous = _ref$asynchronous === undefined ? true : _ref$asynchronous, _ref$noCache = _ref.noCache, noCache = _ref$noCache === undefined ? false : _ref$noCache, _ref$sendAsBinary = _ref.sendAsBinary, sendAsBinary = _ref$sendAsBinary === undefined ? false : _ref$sendAsBinary, _ref$responseType = _ref.responseType, responseType = _ref$responseType === undefined ? false : _ref$responseType, _ref$onProgress = _ref.onProgress, onProgress = _ref$onProgress === undefined ? noop : _ref$onProgress, _ref$onError = _ref.onError, onError = _ref$onError === undefined ? noop : _ref$onError, _ref$onAbort = _ref.onAbort, onAbort = _ref$onAbort === undefined ? noop : _ref$onAbort, _ref$onComplete = _ref.onComplete, onComplete = _ref$onComplete === undefined ? noop : _ref$onComplete; _classCallCheck(this, XHR); this.url = path ? path.join(path, url) : url; this.method = method; this.async = asynchronous; this.noCache = noCache; this.sendAsBinary = sendAsBinary; this.responseType = responseType; this.req = new XMLHttpRequest(); this.req.onload = function (e) { return onComplete(e); }; this.req.onerror = function (e) { return onError(e); }; this.req.onabort = function (e) { return onAbort(e); }; this.req.onprogress = function (e) { if (e.lengthComputable) { onProgress(e, Math.round(e.loaded / e.total * 100)); } else { onProgress(e, -1); } }; } _createClass(XHR, [{ key: 'setRequestHeader', value: function setRequestHeader(header, value) { this.req.setRequestHeader(header, value); return this; } // /* eslint-disable max-statements */ }, { key: 'sendAsync', value: function sendAsync() { var _this = this; var body = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.body || null; return new Promise(function (resolve, reject) { try { var req = _this.req, method = _this.method, noCache = _this.noCache, sendAsBinary = _this.sendAsBinary, responseType = _this.responseType; var url = noCache ? _this.url + (_this.url.indexOf('?') >= 0 ? '&' : '?') + Date.now() : _this.url; req.open(method, url, _this.async); if (responseType) { req.responseType = responseType; } if (_this.async) { req.onreadystatechange = function (e) { if (req.readyState === XHR_STATES.COMPLETED) { if (req.status === 200) { resolve(req.responseType ? req.response : req.responseText); } else { reject(new Error(req.status + ': ' + url)); } } }; } if (sendAsBinary) { req.sendAsBinary(body); } else { req.send(body); } if (!_this.async) { if (req.status === 200) { resolve(req.responseType ? req.response : req.responseText); } else { reject(new Error(req.status + ': ' + url)); } } } catch (error) { reject(error); } }); } /* eslint-enable max-statements */ }]); return XHR; }(); function requestFile(opts) { var xhr = new XHR(opts); return xhr.sendAsync(); } //# sourceMappingURL=browser-request-file.js.map /***/ }), /* 630 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _browserLoad = __webpack_require__(257); Object.defineProperty(exports, 'setPathPrefix', { enumerable: true, get: function get() { return _browserLoad.setPathPrefix; } }); Object.defineProperty(exports, 'loadFile', { enumerable: true, get: function get() { return _browserLoad.loadFile; } }); Object.defineProperty(exports, 'loadImage', { enumerable: true, get: function get() { return _browserLoad.loadImage; } }); var _loadFiles = __webpack_require__(631); Object.defineProperty(exports, 'loadFiles', { enumerable: true, get: function get() { return _loadFiles.loadFiles; } }); Object.defineProperty(exports, 'loadImages', { enumerable: true, get: function get() { return _loadFiles.loadImages; } }); Object.defineProperty(exports, 'loadTextures', { enumerable: true, get: function get() { return _loadFiles.loadTextures; } }); Object.defineProperty(exports, 'loadProgram', { enumerable: true, get: function get() { return _loadFiles.loadProgram; } }); Object.defineProperty(exports, 'loadModel', { enumerable: true, get: function get() { return _loadFiles.loadModel; } }); Object.defineProperty(exports, 'parseModel', { enumerable: true, get: function get() { return _loadFiles.parseModel; } }); //# sourceMappingURL=index.js.map /***/ }), /* 631 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); /* eslint-disable guard-for-in, complexity, no-try-catch */ exports.loadTexture = loadTexture; exports.loadFiles = loadFiles; exports.loadImages = loadImages; exports.loadTextures = loadTextures; exports.loadProgram = loadProgram; exports.loadModel = loadModel; exports.parseModel = parseModel; var _assert = __webpack_require__(1); var _assert2 = _interopRequireDefault(_assert); var _browserLoad = __webpack_require__(257); var _webgl = __webpack_require__(61); var _core = __webpack_require__(59); var _geometry = __webpack_require__(41); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function noop() {} function loadTexture(gl, url) { var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var urls = opts.urls, _opts$onProgress = opts.onProgress, onProgress = _opts$onProgress === undefined ? noop : _opts$onProgress; (0, _assert2.default)(typeof url === 'string', 'loadTexture: url must be string'); return loadImages(Object.assign({ urls: urls, onProgress: onProgress }, opts)).then(function (images) { return images.map(function (img, i) { return new _webgl.Texture2D(gl, Object.assign({ id: urls[i] }, opts, { data: img })); }); }); } /* * Loads (Requests) multiple files asynchronously */ function loadFiles() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var urls = opts.urls, _opts$onProgress2 = opts.onProgress, onProgress = _opts$onProgress2 === undefined ? noop : _opts$onProgress2; (0, _assert2.default)(urls.every(function (url) { return typeof url === 'string'; }), 'loadImages: {urls} must be array of strings'); var count = 0; return Promise.all(urls.map(function (url) { var promise = (0, _browserLoad.loadFile)(Object.assign({ url: url }, opts)); promise.then(function (file) { return onProgress({ progress: ++count / urls.length, count: count, total: urls.length, url: url }); }); return promise; })); } /* * Loads (requests) multiple images asynchronously */ function loadImages() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; var urls = opts.urls, _opts$onProgress3 = opts.onProgress, onProgress = _opts$onProgress3 === undefined ? noop : _opts$onProgress3; (0, _assert2.default)(urls.every(function (url) { return typeof url === 'string'; }), 'loadImages: {urls} must be array of strings'); var count = 0; return Promise.all(urls.map(function (url) { var promise = (0, _browserLoad.loadImage)(url, opts); promise.then(function (file) { return onProgress({ progress: ++count / urls.length, count: count, total: urls.length, url: url }); }); return promise; })); } function loadTextures(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var urls = opts.urls, _opts$onProgress4 = opts.onProgress, onProgress = _opts$onProgress4 === undefined ? noop : _opts$onProgress4; (0, _assert2.default)(urls.every(function (url) { return typeof url === 'string'; }), 'loadTextures: {urls} must be array of strings'); return loadImages(Object.assign({ urls: urls, onProgress: onProgress }, opts)).then(function (images) { return images.map(function (img, i) { var params = Array.isArray(opts.parameters) ? opts.parameters[i] : opts.parameters; params = params === undefined ? {} : params; return new _webgl.Texture2D(gl, Object.assign({ id: urls[i] }, params, { data: img })); }); }); } function loadProgram(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var vs = opts.vs, fs = opts.fs, _opts$onProgress5 = opts.onProgress, onProgress = _opts$onProgress5 === undefined ? noop : _opts$onProgress5; return loadFiles(Object.assign({ urls: [vs, fs], onProgress: onProgress }, opts)).then(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), vsText = _ref2[0], fsText = _ref2[1]; return new _webgl.Program(gl, Object.assign({ vs: vsText, fs: fsText }, opts)); }); } // Loads a simple JSON format function loadModel(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var url = opts.url, _opts$onProgress6 = opts.onProgress, onProgress = _opts$onProgress6 === undefined ? noop : _opts$onProgress6; return loadFiles(Object.assign({ urls: [url], onProgress: onProgress }, opts)).then(function (_ref3) { var _ref4 = _slicedToArray(_ref3, 1), file = _ref4[0]; return parseModel(gl, Object.assign({ file: file }, opts)); }); } function parseModel(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var file = opts.file, _opts$program = opts.program, program = _opts$program === undefined ? new _webgl.Program(gl) : _opts$program; var json = typeof file === 'string' ? parseJSON(file) : file; // Remove any attributes so that we can create a geometry // TODO - change format to put these in geometry sub object? var attributes = {}; var modelOptions = {}; for (var key in json) { var value = json[key]; if (Array.isArray(value)) { attributes[key] = key === 'indices' ? new Uint16Array(value) : new Float32Array(value); } else { modelOptions[key] = value; } } return new _core.Model(gl, Object.assign({ program: program, geometry: new _geometry.Geometry({ attributes: attributes }) }, modelOptions, opts)); } function parseJSON(file) { try { return JSON.parse(file); } catch (error) { throw new Error('Failed to parse JSON: ' + error); } } //# sourceMappingURL=load-files.js.map /***/ }), /* 632 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core__ = __webpack_require__(59); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__webgl__ = __webpack_require__(61); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // ClipSpaceQuad var CLIPSPACE_QUAD_VERTEX_SHADER = 'attribute vec2 aClipSpacePosition;\nattribute vec2 aTexCoord;\nattribute vec2 aCoordinate;\n\nvarying vec2 position;\nvarying vec2 coordinate;\nvarying vec2 uv;\n\nvoid main(void) {\n gl_Position = vec4(aClipSpacePosition, 0., 1.);\n position = aClipSpacePosition;\n coordinate = aCoordinate;\n uv = aTexCoord;\n}\n'; /* eslint-disable indent, no-multi-spaces */ var POSITIONS = [-1, -1, 1, -1, -1, 1, 1, 1]; var ClipSpaceQuad = /*#__PURE__*/function (_Model) { _inherits(ClipSpaceQuad, _Model); function ClipSpaceQuad(gl, opts) { _classCallCheck(this, ClipSpaceQuad); var TEX_COORDS = POSITIONS.map(function (coord) { return coord === -1 ? 0 : coord; }); var _this = _possibleConstructorReturn(this, (ClipSpaceQuad.__proto__ || Object.getPrototypeOf(ClipSpaceQuad)).call(this, gl, Object.assign({}, opts, { vs: CLIPSPACE_QUAD_VERTEX_SHADER, geometry: new __WEBPACK_IMPORTED_MODULE_1__geometry__["Geometry"]({ drawMode: __WEBPACK_IMPORTED_MODULE_2__webgl__["GL"].TRIANGLE_STRIP, vertexCount: 4, attributes: { aClipSpacePosition: { size: 2, value: new Float32Array(POSITIONS) }, aTexCoord: { size: 2, value: new Float32Array(TEX_COORDS) }, aCoordinate: { size: 2, value: new Float32Array(TEX_COORDS) } } }) }))); _this.setVertexCount(4); return _this; } return ClipSpaceQuad; }(__WEBPACK_IMPORTED_MODULE_0__core__["Model"]); /* harmony default export */ __webpack_exports__["a"] = (ClipSpaceQuad); //# sourceMappingURL=clip-space-quad.js.map /***/ }), /* 633 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core__ = __webpack_require__(59); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Cone = /*#__PURE__*/function (_Model) { _inherits(Cone, _Model); function Cone(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Cone); return _possibleConstructorReturn(this, (Cone.__proto__ || Object.getPrototypeOf(Cone)).call(this, gl, Object.assign({}, opts, { geometry: new __WEBPACK_IMPORTED_MODULE_0__geometry__["ConeGeometry"](opts) }))); } return Cone; }(__WEBPACK_IMPORTED_MODULE_1__core__["Model"]); /* harmony default export */ __webpack_exports__["a"] = (Cone); //# sourceMappingURL=cone.js.map /***/ }), /* 634 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core__ = __webpack_require__(59); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Cube = /*#__PURE__*/function (_Model) { _inherits(Cube, _Model); function Cube(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Cube); var _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["d" /* uid */])('cube') : _opts$id; return _possibleConstructorReturn(this, (Cube.__proto__ || Object.getPrototypeOf(Cube)).call(this, gl, Object.assign({}, opts, { id: id, geometry: new __WEBPACK_IMPORTED_MODULE_0__geometry__["CubeGeometry"](opts) }))); } return Cube; }(__WEBPACK_IMPORTED_MODULE_1__core__["Model"]); /* harmony default export */ __webpack_exports__["a"] = (Cube); //# sourceMappingURL=cube.js.map /***/ }), /* 635 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_model__ = __webpack_require__(104); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Cylinder = /*#__PURE__*/function (_Model) { _inherits(Cylinder, _Model); function Cylinder(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Cylinder); return _possibleConstructorReturn(this, (Cylinder.__proto__ || Object.getPrototypeOf(Cylinder)).call(this, gl, Object.assign({}, opts, { geometry: new __WEBPACK_IMPORTED_MODULE_0__geometry__["CylinderGeometry"](opts) }))); } return Cylinder; }(__WEBPACK_IMPORTED_MODULE_1__core_model__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Cylinder); //# sourceMappingURL=cylinder.js.map /***/ }), /* 636 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core__ = __webpack_require__(59); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__geometry__ = __webpack_require__(41); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var IcoSphere = /*#__PURE__*/function (_Model) { _inherits(IcoSphere, _Model); function IcoSphere(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, IcoSphere); return _possibleConstructorReturn(this, (IcoSphere.__proto__ || Object.getPrototypeOf(IcoSphere)).call(this, gl, Object.assign({}, opts, { geometry: new __WEBPACK_IMPORTED_MODULE_1__geometry__["IcoSphereGeometry"](opts) }))); } return IcoSphere; }(__WEBPACK_IMPORTED_MODULE_0__core__["Model"]); /* harmony default export */ __webpack_exports__["a"] = (IcoSphere); //# sourceMappingURL=ico-sphere.js.map /***/ }), /* 637 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core_model__ = __webpack_require__(104); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Plane = /*#__PURE__*/function (_Model) { _inherits(Plane, _Model); function Plane(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Plane); var _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["d" /* uid */])('plane') : _opts$id; return _possibleConstructorReturn(this, (Plane.__proto__ || Object.getPrototypeOf(Plane)).call(this, gl, Object.assign({}, opts, { id: id, geometry: new __WEBPACK_IMPORTED_MODULE_0__geometry__["PlaneGeometry"](opts) }))); } return Plane; }(__WEBPACK_IMPORTED_MODULE_1__core_model__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Plane); //# sourceMappingURL=plane.js.map /***/ }), /* 638 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__core__ = __webpack_require__(59); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__utils__ = __webpack_require__(8); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Sphere = /*#__PURE__*/function (_Model) { _inherits(Sphere, _Model); function Sphere(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Sphere); var _opts$id = opts.id, id = _opts$id === undefined ? __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__utils__["d" /* uid */])('sphere') : _opts$id; return _possibleConstructorReturn(this, (Sphere.__proto__ || Object.getPrototypeOf(Sphere)).call(this, gl, Object.assign({}, opts, { id: id, geometry: new __WEBPACK_IMPORTED_MODULE_1__geometry__["SphereGeometry"](opts) }))); } return Sphere; }(__WEBPACK_IMPORTED_MODULE_0__core__["Model"]); /* harmony default export */ __webpack_exports__["a"] = (Sphere); //# sourceMappingURL=sphere.js.map /***/ }), /* 639 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__geometry__ = __webpack_require__(41); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__core__ = __webpack_require__(59); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var TruncatedCone = /*#__PURE__*/function (_Model) { _inherits(TruncatedCone, _Model); function TruncatedCone(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, TruncatedCone); return _possibleConstructorReturn(this, (TruncatedCone.__proto__ || Object.getPrototypeOf(TruncatedCone)).call(this, gl, Object.assign({}, opts, { geometry: new __WEBPACK_IMPORTED_MODULE_0__geometry__["TruncatedConeGeometry"](opts) }))); } return TruncatedCone; }(__WEBPACK_IMPORTED_MODULE_1__core__["Model"]); /* harmony default export */ __webpack_exports__["a"] = (TruncatedCone); //# sourceMappingURL=truncated-cone.js.map /***/ }), /* 640 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export stop */ /* unused harmony export get */ /* unused harmony export getWheel */ /* unused harmony export getKey */ /* unused harmony export isRightClick */ /* unused harmony export getPos */ /* unused harmony export EventsProxy */ /* unused harmony export Keys */ /* harmony export (immutable) */ __webpack_exports__["a"] = addEvents; /* unused harmony export removeEvents */ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // event.js // Handle keyboard/mouse/touch events in the Canvas // TODO - this will not work under node /* eslint-disable dot-notation, max-statements, no-loop-func */ /* global window, document */ function noop() {} var KEYS = { enter: 13, up: 38, down: 40, left: 37, right: 39, esc: 27, space: 32, backspace: 8, tab: 9, delete: 46 }; // returns an O3D object or false otherwise. function toO3D(n) { return n !== true ? n : false; } // Returns an element position function _getPos(elem) { var bbox = elem.getBoundingClientRect(); return { x: bbox.left, y: bbox.top, bbox: bbox }; } // event object wrapper function get(e, win) { win = win || window; return e || win.event; } function getWheel(e) { return e.wheelDelta ? e.wheelDelta / 120 : -(e.detail || 0) / 3; } function getKey(e) { var code = e.which || e.keyCode; var key = keyOf(code); // onkeydown var fKey = code - 111; if (fKey > 0 && fKey < 13) { key = 'f' + fKey; } key = key || String.fromCharCode(code).toLowerCase(); return { code: code, key: key, shift: e.shiftKey, control: e.ctrlKey, alt: e.altKey, meta: e.metaKey }; } function isRightClick(e) { return e.which === 3 || e.button === 2; } function getPos(e, win) { // get mouse position win = win || window; e = e || win.event; var doc = win.document; doc = doc.documentElement || doc.body; // TODO(nico): make touch event handling better if (e.touches && e.touches.length) { var touchesPos = []; var l = e.touches.length; var evt = void 0; for (var i = 0; i < l; ++i) { evt = e.touches[i]; touchesPos.push({ x: evt.pageX || evt.clientX + doc.scrollLeft, y: evt.pageY || evt.clientY + doc.scrollTop }); } return touchesPos; } var page = { x: e.pageX || e.clientX + doc.scrollLeft, y: e.pageY || e.clientY + doc.scrollTop }; return [page]; } function _stop(e) { if (e.stopPropagation) { e.stopPropagation(); } e.cancelBubble = true; if (e.preventDefault) { e.preventDefault(); } else { e.returnValue = false; } } var EventsProxy = /*#__PURE__*/function () { function EventsProxy(domElem, opt) { _classCallCheck(this, EventsProxy); this.scene = opt.scene; this.domElem = domElem; this.pos = _getPos(domElem); this.opt = this.callbacks = opt; this.size = { width: domElem.width || domElem.offsetWidth, height: domElem.height || domElem.offsetHeight }; this.attachEvents(); } _createClass(EventsProxy, [{ key: 'attachEvents', value: function attachEvents() { var _this = this; var domElem = this.domElem; var opt = this.opt; if (opt.disableContextMenu) { domElem.oncontextmenu = function () { return false; }; } if (opt.enableMouse) { ['mouseup', 'mousedown', 'mousemove', 'mouseover', 'mouseout'].forEach(function (action) { domElem.addEventListener(action, function (e, win) { _this[action](_this.eventInfo(action, e, win)); }, false); }); // "well, this is embarrassing..." var type = ''; if (!document.getBoxObjectFor && window.mozInnerScreenX === null) { type = 'mousewheel'; } else { type = 'DOMMouseScroll'; } domElem.addEventListener(type, function (e, win) { _this['mousewheel'](_this.eventInfo('mousewheel', e, win)); }, false); } if (opt.enableTouch) { ['touchstart', 'touchmove', 'touchend'].forEach(function (action) { domElem.addEventListener(action, function (e, win) { _this[action](_this.eventInfo(action, e, win)); }, false); }); } if (opt.enableKeyboard) { ['keydown', 'keyup'].forEach(function (action) { document.addEventListener(action, function (e, win) { _this[action](_this.eventInfo(action, e, win)); }, false); }); } } }, { key: 'eventInfo', value: function eventInfo(type, e, win) { var domElem = this.domElem; var scene = this.scene; var opt = this.opt; var size = this.getSize(); var relative = opt.relative; var centerOrigin = opt.centerOrigin; var pos = opt.cachePosition && this.pos || _getPos(domElem); var ge = get(e, win); var epos = getPos(e, win); var origPos = { x: epos[0].x, y: epos[0].y }; var evt = {}; var x = void 0; var y = void 0; // get Position for (var i = 0, l = epos.length; i < l; ++i) { x = epos[i].x; y = epos[i].y; if (relative) { x -= pos.x;y -= pos.y; if (centerOrigin) { x -= size.width / 2; y -= size.height / 2; // y axis now points to the top of the screen y *= -1; } } epos[i].x = x; epos[i].y = y; } switch (type) { case 'mousewheel': evt.wheel = getWheel(ge); break; case 'keydown': case 'keyup': Object.assign(evt, getKey(ge)); break; case 'mouseup': evt.isRightClick = isRightClick(ge); break; default: break; } var cacheTarget = void 0; Object.assign(evt, { x: epos[0].x, y: epos[0].y, posArray: epos, cache: false, // stop event propagation stop: function stop() { _stop(ge); }, // get the target element of the event getTarget: function getTarget() { if (cacheTarget) { return cacheTarget; } return cacheTarget = opt.picking && scene.pick(origPos.x - pos.x, origPos.y - pos.y) || true; } }); // wrap native event evt.event = ge; return evt; } }, { key: 'getSize', value: function getSize() { if (this.cacheSize) { return this.size; } var domElem = this.domElem; return { width: domElem.width || domElem.offsetWidth, height: domElem.height || domElem.offsetHeight }; } }, { key: 'mouseup', value: function mouseup(e) { if (!this.moved) { if (e.isRightClick) { this.callbacks.onRightClick(e, this.hovered); } else { this.callbacks.onClick(e, toO3D(this.pressed)); } } if (this.pressed) { if (this.moved) { this.callbacks.onDragEnd(e, toO3D(this.pressed)); } else { this.callbacks.onDragCancel(e, toO3D(this.pressed)); } this.pressed = this.moved = false; } } }, { key: 'mouseout', value: function mouseout(e) { // mouseout canvas var rt = e.relatedTarget; var domElem = this.domElem; while (rt && rt.parentNode) { if (domElem === rt.parentNode) { return; } rt = rt.parentNode; } if (this.hovered) { this.callbacks.onMouseLeave(e, this.hovered); this.hovered = false; } if (this.pressed && this.moved) { this.callbacks.onDragEnd(e); this.pressed = this.moved = false; } } }, { key: 'mouseover', value: function mouseover(e) {} }, { key: 'mousemove', value: function mousemove(e) { if (this.pressed) { this.moved = true; this.callbacks.onDragMove(e, toO3D(this.pressed)); return; } if (this.hovered) { var target = toO3D(e.getTarget()); if (!target || target.hash !== this.hash) { this.callbacks.onMouseLeave(e, this.hovered); this.hovered = target; this.hash = target; if (target) { this.hash = target.hash; this.callbacks.onMouseEnter(e, this.hovered); } } else { this.callbacks.onMouseMove(e, this.hovered); } } else { this.hovered = toO3D(e.getTarget()); this.hash = this.hovered; if (this.hovered) { this.hash = this.hovered.hash; this.callbacks.onMouseEnter(e, this.hovered); } } if (!this.opt.picking) { this.callbacks.onMouseMove(e); } } }, { key: 'mousewheel', value: function mousewheel(e) { this.callbacks.onMouseWheel(e); } }, { key: 'mousedown', value: function mousedown(e) { this.pressed = e.getTarget(); this.callbacks.onDragStart(e, toO3D(this.pressed)); } }, { key: 'touchstart', value: function touchstart(e) { this.touched = e.getTarget(); this.touchedLastPosition = { x: e.x, y: e.y }; this.callbacks.onTouchStart(e, toO3D(this.touched)); } }, { key: 'touchmove', value: function touchmove(e) { if (this.touched) { this.touchMoved = true; this.callbacks.onTouchMove(e, toO3D(this.touched)); } } }, { key: 'touchend', value: function touchend(e) { if (this.touched) { if (this.touchMoved) { this.callbacks.onTouchEnd(e, toO3D(this.touched)); } else { e.x = isNaN(e.x) ? this.touchedLastPosition.x : e.x; e.y = isNaN(e.y) ? this.touchedLastPosition.y : e.y; this.callbacks.onTap(e, toO3D(this.touched)); this.callbacks.onTouchCancel(e, toO3D(this.touched)); } this.touched = this.touchMoved = false; } } }, { key: 'keydown', value: function keydown(e) { this.callbacks.onKeyDown(e); } }, { key: 'keyup', value: function keyup(e) { this.callbacks.onKeyUp(e); } }]); return EventsProxy; }(); Object.assign(EventsProxy.prototype, { hovered: false, pressed: false, touched: false, touchedLastPosition: { x: 0, y: 0 }, touchMoved: false, moved: false }); var DEFAULT_OPTS = { cachePosition: true, cacheSize: true, relative: true, centerOrigin: true, disableContextMenu: true, bind: false, picking: false, enableTouch: true, enableMouse: true, enableKeyboard: true, onClick: noop, onRightClick: noop, onDragStart: noop, onDragMove: noop, onDragEnd: noop, onDragCancel: noop, onTouchStart: noop, onTouchMove: noop, onTouchEnd: noop, onTouchCancel: noop, onTap: noop, onMouseMove: noop, onMouseEnter: noop, onMouseLeave: noop, onMouseWheel: noop, onKeyDown: noop, onKeyUp: noop }; var Keys = KEYS; function keyOf(code) { var keyMap = Keys; for (var name in keyMap) { if (keyMap[name] === code) { return name; } } return null; } function addEvents(domElement) { var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; opt = Object.assign({}, DEFAULT_OPTS, opt); var bind = opt.bind; if (bind) { for (var name in opt) { if (name.match(/^on[a-zA-Z0-9]+$/)) { (function (fname, fn) { opt[fname] = function f() { fn.apply(bind, Array.prototype.slice.call(arguments)); }; })(name, opt[name]); } } } return new EventsProxy(domElement, opt); } function removeEvents(domElement) { var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; opt = Object.assign({}, DEFAULT_OPTS, opt); var bind = opt.bind; if (bind) { for (var name in opt) { if (name.match(/^on[a-zA-Z0-9]+$/)) { (function (fname, fn) { opt[fname] = function f() { fn.apply(bind, Array.prototype.slice.call(arguments)); }; })(name, opt[name]); } } } return new EventsProxy(domElement, opt); } //# sourceMappingURL=add-events.js.map /***/ }), /* 641 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__add_events__ = __webpack_require__(640); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__add_events__["a"]; }); //# sourceMappingURL=index.js.map /***/ }), /* 642 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__lib_shader_modules__ = __webpack_require__(162); /* unused harmony reexport registerShaderModules */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lib_assemble_shaders__ = __webpack_require__(258); /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_1__lib_assemble_shaders__["a"]; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lib_shader_cache__ = __webpack_require__(259); /* unused harmony reexport ShaderCache */ //# sourceMappingURL=index.js.map /***/ }), /* 643 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export checkRendererVendor */ /* harmony export (immutable) */ __webpack_exports__["a"] = getPlatformShaderDefines; /* harmony export (immutable) */ __webpack_exports__["b"] = getVersionDefines; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__webgl__ = __webpack_require__(61); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_context_features__ = __webpack_require__(108); function checkRendererVendor(debugInfo, gpuVendor) { var vendor = debugInfo.vendor, renderer = debugInfo.renderer; var result = void 0; switch (gpuVendor) { case 'nvidia': result = vendor.match(/NVIDIA/i) || renderer.match(/NVIDIA/i); break; case 'intel': result = vendor.match(/INTEL/i) || renderer.match(/INTEL/i); break; case 'amd': result = vendor.match(/AMD/i) || renderer.match(/AMD/i) || vendor.match(/ATI/i) || renderer.match(/ATI/i); break; default: result = false; } return result; } function getPlatformShaderDefines(gl) { /* eslint-disable */ var platformDefines = ''; var debugInfo = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__webgl__["getContextInfo"])(gl); if (checkRendererVendor(debugInfo, 'nvidia')) { platformDefines += '#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n'; } else if (checkRendererVendor(debugInfo, 'intel')) { platformDefines += '#define INTEL_GPU\n// Intel optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel\'s built-in \'tan\' function doesn\'t have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn\'t have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n'; } else if (checkRendererVendor(debugInfo, 'amd')) { // AMD Does not eliminate fp64 code platformDefines += '#define AMD_GPU\n'; } else { // We don't know what GPU it is, could be that the GPU driver or // browser is not implementing UNMASKED_RENDERER constant and not // reporting a correct name platformDefines += '#define DEFAULT_GPU\n// Prevent driver from optimizing away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n// Intel\'s built-in \'tan\' function doesn\'t have acceptable precision\n#define LUMA_FP32_TAN_PRECISION_WORKAROUND 1\n// Intel GPU doesn\'t have full 32 bits precision in same cases, causes overflow\n#define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1\n'; } return platformDefines; } function getVersionDefines(gl) { var versionDefines = '// Defines for shader portability\n#if (__VERSION__ > 120)\n# define attribute in\n# define varying out\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n#else\n// # define in attribute\n// # define out varying\n#endif // __VERSION\n'; if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["b" /* hasFeature */])(gl, __WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["a" /* FEATURES */].GLSL_FRAG_DEPTH)) { versionDefines += '// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n'; } if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["b" /* hasFeature */])(gl, __WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["a" /* FEATURES */].GLSL_DERIVATIVES)) { versionDefines += '// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define DERIVATIVES\n#endif\n'; } if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["b" /* hasFeature */])(gl, __WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["a" /* FEATURES */].GLSL_FRAG_DATA)) { versionDefines += '// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define DRAW_BUFFERS\n#endif\n'; } if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["b" /* hasFeature */])(gl, __WEBPACK_IMPORTED_MODULE_1__webgl_context_features__["a" /* FEATURES */].GLSL_TEXTURE_LOD)) { versionDefines += '// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n# define TEXTURE_LOD\n#define texture2DLod texture2DLodEXT\n#define texture2DProjLod texture2DProjLodEXT\n#define texture2DProjLod texture2DProjLodEXT\n#define textureCubeLod textureCubeLodEXT\n#define texture2DGrad texture2DGradEXT\n#define texture2DProjGrad texture2DProjGradEXT\n#define texture2DProjGrad texture2DProjGradEXT\n#define textureCubeGrad textureCubeGradEXT\n#endif\n'; } return versionDefines; } //# sourceMappingURL=platform-defines.js.map /***/ }), /* 644 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // Minimal texture (diffuse map) support /* eslint-disable camelcase */ var DEFAULT_MODULE_OPTIONS = { diffuseTexture: null, diffuseColor: [0.5, 0.5, 0.5, 1] }; function getUniforms() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS; var uniforms = {}; if (opts.diffuseTexture !== undefined) { uniforms.diffuse_uHasTexture = Boolean(opts.diffuseTexture); uniforms.diffuse_uTexture = opts.diffuseTexture; } if (opts.diffuseColor !== undefined) { uniforms.diffuse_uColor = opts.diffuseColor; } return uniforms; } var vs = 'varying vec2 diffuse_vTexCoord;\n\n/* Set the UV coordinate from attributes */\nvoid diffuse_setTextureCoordinate(vec2 uv) {\n diffuse_vTexCoord = uv;\n}\n'; var fs = 'uniform vec4 diffuse_uColor;\nuniform bool diffuse_uHasTexture;\nuniform sampler2D diffuse_uTexture;\n\nvarying vec2 diffuse_vTexCoord;\n\n// Gets diffuse color of material from uniform\n// If we have a standard (diffuse) texture, set color to texture\n// return (vec4) - rgba\n//\nvec4 diffuse_getColor() {\n vec2 texCoord = diffuse_vTexCoord;\n return diffuse_uHasTexture ?\n texture2D(diffuse_uTexture, vec2(texCoord.s, texCoord.t)) :\n diffuse_uColor;\n}\n\nvec4 diffuse_filterColor(vec4 color) {\n return diffuse_getColor();\n}\n'; /* harmony default export */ __webpack_exports__["a"] = ({ name: 'diffuse', getUniforms: getUniforms, vs: vs, fs: fs }); //# sourceMappingURL=diffuse.js.map /***/ }), /* 645 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__project_project__ = __webpack_require__(260); // Cheap lighting - single directional light, single dot product, one uniform /* eslint-disable camelcase */ var DEFAULT_LIGHT_DIRECTION = new Float32Array([1, 1, 2]); var DEFAULT_MODULE_OPTIONS = { lightDirection: DEFAULT_LIGHT_DIRECTION }; function getUniforms() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS; var uniforms = {}; if (opts.lightDirection) { uniforms.dirlight_uLightDirection = opts.lightDirection; } return uniforms; } // TODO - reuse normal from geometry module var vs = null; var fs = 'uniform vec3 dirlight_uLightDirection;\n\n/*\n * Returns color attenuated by angle from light source\n */\nvec4 dirlight_filterColor(vec4 color) {\n vec3 normal = project_getNormal_World();\n float d = abs(dot(normalize(normal), normalize(dirlight_uLightDirection)));\n return vec4(color.rgb * d, color.a);\n}\n'; /* harmony default export */ __webpack_exports__["a"] = ({ name: 'dirlight', vs: vs, fs: fs, getUniforms: getUniforms, dependencies: [__WEBPACK_IMPORTED_MODULE_0__project_project__["a" /* default */]] }); //# sourceMappingURL=dirlight.js.map /***/ }), /* 646 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var fp32shader = '#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n\n// All these functions are for substituting tan() function from Intel GPU only\nconst float TWO_PI = 6.2831854820251465;\nconst float PI_2 = 1.5707963705062866;\nconst float PI_16 = 0.1963495463132858;\n\nconst float SIN_TABLE_0 = 0.19509032368659973;\nconst float SIN_TABLE_1 = 0.3826834261417389;\nconst float SIN_TABLE_2 = 0.5555702447891235;\nconst float SIN_TABLE_3 = 0.7071067690849304;\n\nconst float COS_TABLE_0 = 0.9807852506637573;\nconst float COS_TABLE_1 = 0.9238795042037964;\nconst float COS_TABLE_2 = 0.8314695954322815;\nconst float COS_TABLE_3 = 0.7071067690849304;\n\nconst float INVERSE_FACTORIAL_3 = 1.666666716337204e-01; // 1/3!\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03; // 1/5!\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04; // 1/7!\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06; // 1/9!\n\nfloat sin_taylor_fp32(float a) {\n float r, s, t, x;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n x = -a * a;\n s = a;\n r = a;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_3;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_5;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_7;\n s = s + t;\n\n r = r * x;\n t = r * INVERSE_FACTORIAL_9;\n s = s + t;\n\n return s;\n}\n\nvoid sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {\n if (a == 0.0) {\n sin_t = 0.0;\n cos_t = 1.0;\n }\n sin_t = sin_taylor_fp32(a);\n cos_t = sqrt(1.0 - sin_t * sin_t);\n}\n\nfloat tan_taylor_fp32(float a) {\n float sin_a;\n float cos_a;\n\n if (a == 0.0) {\n return 0.0;\n }\n\n // 2pi range reduction\n float z = floor(a / TWO_PI);\n float r = a - TWO_PI * z;\n\n float t;\n float q = floor(r / PI_2 + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return 0.0 / 0.0;\n }\n\n t = r - PI_2 * q;\n\n q = floor(t / PI_16 + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return 0.0 / 0.0;\n } else {\n t = t - PI_16 * q;\n }\n\n float u = 0.0;\n float v = 0.0;\n\n float sin_t, cos_t;\n float s, c;\n sincos_taylor_fp32(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0;\n v = SIN_TABLE_0;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1;\n v = SIN_TABLE_1;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2;\n v = SIN_TABLE_2;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3;\n v = SIN_TABLE_3;\n }\n if (k > 0) {\n s = u * sin_t + v * cos_t;\n c = u * cos_t - v * sin_t;\n } else {\n s = u * sin_t - v * cos_t;\n c = u * cos_t + v * sin_t;\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return sin_a / cos_a;\n}\n#endif\n\nfloat tan_fp32(float a) {\n#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\n return tan_taylor_fp32(a);\n#else\n return tan(a);\n#endif\n}\n'; /* harmony default export */ __webpack_exports__["a"] = ({ name: 'fp32', vs: fp32shader, fs: null }); //# sourceMappingURL=fp32.js.map /***/ }), /* 647 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* harmony default export */ __webpack_exports__["a"] = ("uniform float ONE;\n\n/*\nAbout LUMA_FP64_CODE_ELIMINATION_WORKAROUND\n\nThe purpose of this workaround is to prevent shader compilers from\noptimizing away necessary arithmetic operations by swapping their sequences\nor transform the equation to some 'equivalent' from.\n\nThe method is to multiply an artifical variable, ONE, which will be known to\nthe compiler to be 1 only at runtime. The whole expression is then represented\nas a polynomial with respective to ONE. In the coefficients of all terms, only one a\nand one b should appear\n\nerr = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE\n*/\n\n// Divide float number to high and low floats to extend fraction bits\nvec2 split(float a) {\n const float SPLIT = 4097.0;\n float t = a * SPLIT;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float a_hi = t * ONE - (t - a);\n float a_lo = a * ONE - a_hi;\n#else\n float a_hi = t - (t - a);\n float a_lo = a - a_hi;\n#endif\n return vec2(a_hi, a_lo);\n}\n\n// Divide float number again when high float uses too many fraction bits\nvec2 split2(vec2 a) {\n vec2 b = split(a.x);\n b.y += a.y;\n return b;\n}\n\n// Special sum operation when a > b\nvec2 quickTwoSum(float a, float b) {\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float sum = (a + b) * ONE;\n float err = b - (sum - a) * ONE;\n#else\n float sum = a + b;\n float err = b - (sum - a);\n#endif\n return vec2(sum, err);\n}\n\n// General sum operation\nvec2 twoSum(float a, float b) {\n float s = (a + b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float v = (s * ONE - a) * ONE;\n float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);\n#else\n float v = s - a;\n float err = (a - (s - v)) + (b - v);\n#endif\n return vec2(s, err);\n}\n\nvec2 twoSub(float a, float b) {\n float s = (a - b);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float v = (s * ONE - a) * ONE;\n float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);\n#else\n float v = s - a;\n float err = (a - (s - v)) - (b + v);\n#endif\n return vec2(s, err);\n}\n\nvec2 twoSqr(float a) {\n float prod = a * a;\n vec2 a_fp64 = split(a);\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *\n a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;\n#else\n float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;\n#endif\n return vec2(prod, err);\n}\n\nvec2 twoProd(float a, float b) {\n float prod = a * b;\n vec2 a_fp64 = split(a);\n vec2 b_fp64 = split(b);\n float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +\n a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;\n return vec2(prod, err);\n}\n\nvec2 sum_fp64(vec2 a, vec2 b) {\n vec2 s, t;\n s = twoSum(a.x, b.x);\n t = twoSum(a.y, b.y);\n s.y += t.x;\n s = quickTwoSum(s.x, s.y);\n s.y += t.y;\n s = quickTwoSum(s.x, s.y);\n return s;\n}\n\nvec2 sub_fp64(vec2 a, vec2 b) {\n vec2 s, t;\n s = twoSub(a.x, b.x);\n t = twoSub(a.y, b.y);\n s.y += t.x;\n s = quickTwoSum(s.x, s.y);\n s.y += t.y;\n s = quickTwoSum(s.x, s.y);\n return s;\n}\n\nvec2 mul_fp64(vec2 a, vec2 b) {\n vec2 prod = twoProd(a.x, b.x);\n // y component is for the error\n prod.y += a.x * b.y;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n prod = split2(prod);\n#endif\n prod = quickTwoSum(prod.x, prod.y);\n prod.y += a.y * b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n prod = split2(prod);\n#endif\n prod = quickTwoSum(prod.x, prod.y);\n return prod;\n}\n\nvec2 div_fp64(vec2 a, vec2 b) {\n float xn = 1.0 / b.x;\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n vec2 yn = mul_fp64(a, vec2(xn, 0));\n#else\n vec2 yn = a * xn;\n#endif\n float diff = (sub_fp64(a, mul_fp64(b, yn))).x;\n vec2 prod = twoProd(xn, diff);\n return sum_fp64(yn, prod);\n}\n\nvec2 sqrt_fp64(vec2 a) {\n if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);\n if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n\n float x = 1.0 / sqrt(a.x);\n float yn = a.x * x;\n#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)\n vec2 yn_sqr = twoSqr(yn) * ONE;\n#else\n vec2 yn_sqr = twoSqr(yn);\n#endif\n float diff = sub_fp64(a, yn_sqr).x;\n vec2 prod = twoProd(x * 0.5, diff);\n#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)\n return sum_fp64(split(yn), prod);\n#else\n return sum_fp64(vec2(yn, 0.0), prod);\n#endif\n}\n"); //# sourceMappingURL=fp64-arithmetic.glsl.js.map /***/ }), /* 648 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. /* harmony default export */ __webpack_exports__["a"] = ("const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);\nconst vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);\nconst vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);\nconst vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);\nconst vec2 PI_2_FP64 = vec2(1.5707963705062866, -4.371139006309477e-8);\nconst vec2 PI_4_FP64 = vec2(0.7853981852531433, -2.1855695031547384e-8);\nconst vec2 PI_16_FP64 = vec2(0.19634954631328583, -5.463923757886846e-9);\nconst vec2 PI_16_2_FP64 = vec2(0.39269909262657166, -1.0927847515773692e-8);\nconst vec2 PI_16_3_FP64 = vec2(0.5890486240386963, -1.4906100798128818e-9);\nconst vec2 PI_180_FP64 = vec2(0.01745329238474369, 1.3519960498364902e-10);\n\nconst vec2 SIN_TABLE_0_FP64 = vec2(0.19509032368659973, -1.6704714833615242e-9);\nconst vec2 SIN_TABLE_1_FP64 = vec2(0.3826834261417389, 6.22335089017767e-9);\nconst vec2 SIN_TABLE_2_FP64 = vec2(0.5555702447891235, -1.1769521357507529e-8);\nconst vec2 SIN_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617041793133e-8);\n\nconst vec2 COS_TABLE_0_FP64 = vec2(0.9807852506637573, 2.9739473106360492e-8);\nconst vec2 COS_TABLE_1_FP64 = vec2(0.9238795042037964, 2.8307490351764386e-8);\nconst vec2 COS_TABLE_2_FP64 = vec2(0.8314695954322815, 1.6870263741530778e-8);\nconst vec2 COS_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617152815436e-8);\n\nconst vec2 INVERSE_FACTORIAL_3_FP64 = vec2(1.666666716337204e-01, -4.967053879312289e-09); // 1/3!\nconst vec2 INVERSE_FACTORIAL_4_FP64 = vec2(4.16666679084301e-02, -1.2417634698280722e-09); // 1/4!\nconst vec2 INVERSE_FACTORIAL_5_FP64 = vec2(8.333333767950535e-03, -4.34617203337595e-10); // 1/5!\nconst vec2 INVERSE_FACTORIAL_6_FP64 = vec2(1.3888889225199819e-03, -3.3631094437103215e-11); // 1/6!\nconst vec2 INVERSE_FACTORIAL_7_FP64 = vec2(1.9841270113829523e-04, -2.725596874933456e-12); // 1/7!\nconst vec2 INVERSE_FACTORIAL_8_FP64 = vec2(2.4801587642286904e-05, -3.406996025904184e-13); // 1/8!\nconst vec2 INVERSE_FACTORIAL_9_FP64 = vec2(2.75573188446287533e-06, 3.7935713937038186e-14); // 1/9!\nconst vec2 INVERSE_FACTORIAL_10_FP64 = vec2(2.755731998149713e-07, -7.575112367869873e-15); // 1/10!\n\nfloat nint(float d) {\n if (d == floor(d)) return d;\n return floor(d + 0.5);\n}\n\nvec2 nint_fp64(vec2 a) {\n float hi = nint(a.x);\n float lo;\n vec2 tmp;\n if (hi == a.x) {\n lo = nint(a.y);\n tmp = quickTwoSum(hi, lo);\n } else {\n lo = 0.0;\n if (abs(hi - a.x) == 0.5 && a.y < 0.0) {\n hi -= 1.0;\n }\n tmp = vec2(hi, lo);\n }\n return tmp;\n}\n\n/* k_power controls how much range reduction we would like to have\nRange reduction uses the following method:\nassume a = k_power * r + m * log(2), k and m being integers.\nSet k_power = 4 (we can choose other k to trade accuracy with performance.\nwe only need to calculate exp(r) and using exp(a) = 2^m * exp(r)^k_power;\n*/\n\nvec2 exp_fp64(vec2 a) {\n // We need to make sure these two numbers match\n // as bit-wise shift is not available in GLSL 1.0\n const int k_power = 4;\n const float k = 16.0;\n\n const float inv_k = 1.0 / k;\n\n if (a.x <= -88.0) return vec2(0.0, 0.0);\n if (a.x >= 88.0) return vec2(1.0 / 0.0, 1.0 / 0.0);\n if (a.x == 0.0 && a.y == 0.0) return vec2(1.0, 0.0);\n if (a.x == 1.0 && a.y == 0.0) return E_FP64;\n\n float m = floor(a.x / LOG2_FP64.x + 0.5);\n vec2 r = sub_fp64(a, mul_fp64(LOG2_FP64, vec2(m, 0.0))) * inv_k;\n vec2 s, t, p;\n\n p = mul_fp64(r, r);\n s = sum_fp64(r, p * 0.5);\n p = mul_fp64(p, r);\n t = mul_fp64(p, INVERSE_FACTORIAL_3_FP64);\n\n s = sum_fp64(s, t);\n p = mul_fp64(p, r);\n t = mul_fp64(p, INVERSE_FACTORIAL_4_FP64);\n\n s = sum_fp64(s, t);\n p = mul_fp64(p, r);\n t = mul_fp64(p, INVERSE_FACTORIAL_5_FP64);\n\n // s = sum_fp64(s, t);\n // p = mul_fp64(p, r);\n // t = mul_fp64(p, INVERSE_FACTORIAL_6_FP64);\n\n // s = sum_fp64(s, t);\n // p = mul_fp64(p, r);\n // t = mul_fp64(p, INVERSE_FACTORIAL_7_FP64);\n\n s = sum_fp64(s, t);\n\n\n // At this point, s = exp(r) - 1; but after following 4 recursions, we will get exp(r) ^ 512 - 1.\n for (int i = 0; i < k_power; i++) {\n s = sum_fp64(s * 2.0, mul_fp64(s, s));\n }\n\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n s = sum_fp64(s, vec2(ONE, 0.0));\n#else\n s = sum_fp64(s, vec2(1.0, 0.0));\n#endif\n\n return s * pow(2.0, m);\n// return r;\n}\n\nvec2 log_fp64(vec2 a)\n{\n if (a.x == 1.0 && a.y == 0.0) return vec2(0.0, 0.0);\n if (a.x <= 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);\n vec2 x = vec2(log(a.x), 0.0);\n vec2 s;\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n s = vec2(ONE, 0.0);\n#else\n s = vec2(1.0, 0.0);\n#endif\n\n x = sub_fp64(sum_fp64(x, mul_fp64(a, exp_fp64(-x))), s);\n return x;\n}\n\nvec2 sin_taylor_fp64(vec2 a) {\n vec2 r, s, t, x;\n\n if (a.x == 0.0 && a.y == 0.0) {\n return vec2(0.0, 0.0);\n }\n\n x = -mul_fp64(a, a);\n s = a;\n r = a;\n\n r = mul_fp64(r, x);\n t = mul_fp64(r, INVERSE_FACTORIAL_3_FP64);\n s = sum_fp64(s, t);\n\n r = mul_fp64(r, x);\n t = mul_fp64(r, INVERSE_FACTORIAL_5_FP64);\n s = sum_fp64(s, t);\n\n /* keep the following commented code in case we need them\n for extra accuracy from the Taylor expansion*/\n\n // r = mul_fp64(r, x);\n // t = mul_fp64(r, INVERSE_FACTORIAL_7_FP64);\n // s = sum_fp64(s, t);\n\n // r = mul_fp64(r, x);\n // t = mul_fp64(r, INVERSE_FACTORIAL_9_FP64);\n // s = sum_fp64(s, t);\n\n return s;\n}\n\nvec2 cos_taylor_fp64(vec2 a) {\n vec2 r, s, t, x;\n\n if (a.x == 0.0 && a.y == 0.0) {\n return vec2(1.0, 0.0);\n }\n\n x = -mul_fp64(a, a);\n r = x;\n s = sum_fp64(vec2(1.0, 0.0), r * 0.5);\n\n r = mul_fp64(r, x);\n t = mul_fp64(r, INVERSE_FACTORIAL_4_FP64);\n s = sum_fp64(s, t);\n\n r = mul_fp64(r, x);\n t = mul_fp64(r, INVERSE_FACTORIAL_6_FP64);\n s = sum_fp64(s, t);\n\n /* keep the following commented code in case we need them\n for extra accuracy from the Taylor expansion*/\n\n // r = mul_fp64(r, x);\n // t = mul_fp64(r, INVERSE_FACTORIAL_8_FP64);\n // s = sum_fp64(s, t);\n\n // r = mul_fp64(r, x);\n // t = mul_fp64(r, INVERSE_FACTORIAL_10_FP64);\n // s = sum_fp64(s, t);\n\n return s;\n}\n\nvoid sincos_taylor_fp64(vec2 a, out vec2 sin_t, out vec2 cos_t) {\n if (a.x == 0.0 && a.y == 0.0) {\n sin_t = vec2(0.0, 0.0);\n cos_t = vec2(1.0, 0.0);\n }\n\n sin_t = sin_taylor_fp64(a);\n cos_t = sqrt_fp64(sub_fp64(vec2(1.0, 0.0), mul_fp64(sin_t, sin_t)));\n}\n\nvec2 sin_fp64(vec2 a) {\n if (a.x == 0.0 && a.y == 0.0) {\n return vec2(0.0, 0.0);\n }\n\n // 2pi range reduction\n vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\n vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\n\n vec2 t;\n float q = floor(r.x / PI_2_FP64.x + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return vec2(0.0 / 0.0, 0.0 / 0.0);\n }\n\n t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\n\n q = floor(t.x / PI_16_FP64.x + 0.5);\n int k = int(q);\n\n if (k == 0) {\n if (j == 0) {\n return sin_taylor_fp64(t);\n } else if (j == 1) {\n return cos_taylor_fp64(t);\n } else if (j == -1) {\n return -cos_taylor_fp64(t);\n } else {\n return -sin_taylor_fp64(t);\n }\n }\n\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return vec2(0.0 / 0.0, 0.0 / 0.0);\n } else {\n t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n }\n\n vec2 u = vec2(0.0, 0.0);\n vec2 v = vec2(0.0, 0.0);\n\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0_FP64;\n v = SIN_TABLE_0_FP64;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1_FP64;\n v = SIN_TABLE_1_FP64;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2_FP64;\n v = SIN_TABLE_2_FP64;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3_FP64;\n v = SIN_TABLE_3_FP64;\n }\n#else\n if (abs_k == 1) {\n u = COS_TABLE_0_FP64;\n v = SIN_TABLE_0_FP64;\n } else if (abs_k == 2) {\n u = COS_TABLE_1_FP64;\n v = SIN_TABLE_1_FP64;\n } else if (abs_k == 3) {\n u = COS_TABLE_2_FP64;\n v = SIN_TABLE_2_FP64;\n } else if (abs_k == 4) {\n u = COS_TABLE_3_FP64;\n v = SIN_TABLE_3_FP64;\n }\n#endif\n\n vec2 sin_t, cos_t;\n sincos_taylor_fp64(t, sin_t, cos_t);\n\n\n\n vec2 result = vec2(0.0, 0.0);\n if (j == 0) {\n if (k > 0) {\n result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n } else {\n result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n }\n } else if (j == 1) {\n if (k > 0) {\n result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n } else {\n result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n }\n } else if (j == -1) {\n if (k > 0) {\n result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n } else {\n result = -sum_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n }\n } else {\n if (k > 0) {\n result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n } else {\n result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));\n }\n }\n\n return result;\n}\n\nvec2 cos_fp64(vec2 a) {\n if (a.x == 0.0 && a.y == 0.0) {\n return vec2(1.0, 0.0);\n }\n\n // 2pi range reduction\n vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\n vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\n\n vec2 t;\n float q = floor(r.x / PI_2_FP64.x + 0.5);\n int j = int(q);\n\n if (j < -2 || j > 2) {\n return vec2(0.0 / 0.0, 0.0 / 0.0);\n }\n\n t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\n\n q = floor(t.x / PI_16_FP64.x + 0.5);\n int k = int(q);\n\n if (k == 0) {\n if (j == 0) {\n return cos_taylor_fp64(t);\n } else if (j == 1) {\n return -sin_taylor_fp64(t);\n } else if (j == -1) {\n return sin_taylor_fp64(t);\n } else {\n return -cos_taylor_fp64(t);\n }\n }\n\n int abs_k = int(abs(float(k)));\n\n if (abs_k > 4) {\n return vec2(0.0 / 0.0, 0.0 / 0.0);\n } else {\n t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n }\n\n vec2 u = vec2(0.0, 0.0);\n vec2 v = vec2(0.0, 0.0);\n\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0_FP64;\n v = SIN_TABLE_0_FP64;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1_FP64;\n v = SIN_TABLE_1_FP64;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2_FP64;\n v = SIN_TABLE_2_FP64;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3_FP64;\n v = SIN_TABLE_3_FP64;\n }\n#else\n if (abs_k == 1) {\n u = COS_TABLE_0_FP64;\n v = SIN_TABLE_0_FP64;\n } else if (abs_k == 2) {\n u = COS_TABLE_1_FP64;\n v = SIN_TABLE_1_FP64;\n } else if (abs_k == 3) {\n u = COS_TABLE_2_FP64;\n v = SIN_TABLE_2_FP64;\n } else if (abs_k == 4) {\n u = COS_TABLE_3_FP64;\n v = SIN_TABLE_3_FP64;\n }\n#endif\n\n vec2 sin_t, cos_t;\n sincos_taylor_fp64(t, sin_t, cos_t);\n\n vec2 result = vec2(0.0, 0.0);\n if (j == 0) {\n if (k > 0) {\n result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n } else {\n result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n }\n } else if (j == 1) {\n if (k > 0) {\n result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n } else {\n result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));\n }\n } else if (j == -1) {\n if (k > 0) {\n result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n } else {\n result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n }\n } else {\n if (k > 0) {\n result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));\n } else {\n result = -sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n }\n }\n\n return result;\n}\n\nvec2 tan_fp64(vec2 a) {\n vec2 sin_a;\n vec2 cos_a;\n\n if (a.x == 0.0 && a.y == 0.0) {\n return vec2(0.0, 0.0);\n }\n\n // 2pi range reduction\n vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));\n vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));\n\n vec2 t;\n float q = floor(r.x / PI_2_FP64.x + 0.5);\n int j = int(q);\n\n\n if (j < -2 || j > 2) {\n return vec2(0.0 / 0.0, 0.0 / 0.0);\n }\n\n t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));\n\n q = floor(t.x / PI_16_FP64.x + 0.5);\n int k = int(q);\n int abs_k = int(abs(float(k)));\n\n // We just can't get PI/16 * 3.0 very accurately.\n // so let's just store it\n if (abs_k > 4) {\n return vec2(0.0 / 0.0, 0.0 / 0.0);\n } else {\n t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));\n }\n\n\n vec2 u = vec2(0.0, 0.0);\n vec2 v = vec2(0.0, 0.0);\n\n vec2 sin_t, cos_t;\n vec2 s, c;\n sincos_taylor_fp64(t, sin_t, cos_t);\n\n if (k == 0) {\n s = sin_t;\n c = cos_t;\n } else {\n#if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)\n if (abs(float(abs_k) - 1.0) < 0.5) {\n u = COS_TABLE_0_FP64;\n v = SIN_TABLE_0_FP64;\n } else if (abs(float(abs_k) - 2.0) < 0.5) {\n u = COS_TABLE_1_FP64;\n v = SIN_TABLE_1_FP64;\n } else if (abs(float(abs_k) - 3.0) < 0.5) {\n u = COS_TABLE_2_FP64;\n v = SIN_TABLE_2_FP64;\n } else if (abs(float(abs_k) - 4.0) < 0.5) {\n u = COS_TABLE_3_FP64;\n v = SIN_TABLE_3_FP64;\n }\n#else\n if (abs_k == 1) {\n u = COS_TABLE_0_FP64;\n v = SIN_TABLE_0_FP64;\n } else if (abs_k == 2) {\n u = COS_TABLE_1_FP64;\n v = SIN_TABLE_1_FP64;\n } else if (abs_k == 3) {\n u = COS_TABLE_2_FP64;\n v = SIN_TABLE_2_FP64;\n } else if (abs_k == 4) {\n u = COS_TABLE_3_FP64;\n v = SIN_TABLE_3_FP64;\n }\n#endif\n if (k > 0) {\n s = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n c = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n } else {\n s = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));\n c = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));\n }\n }\n\n if (j == 0) {\n sin_a = s;\n cos_a = c;\n } else if (j == 1) {\n sin_a = c;\n cos_a = -s;\n } else if (j == -1) {\n sin_a = -c;\n cos_a = s;\n } else {\n sin_a = -s;\n cos_a = -c;\n }\n return div_fp64(sin_a, cos_a);\n}\n\nvec2 radians_fp64(vec2 degree) {\n return mul_fp64(degree, PI_180_FP64);\n}\n\nvec2 mix_fp64(vec2 a, vec2 b, float x) {\n vec2 range = sub_fp64(b, a);\n return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));\n}\n\n// Vector functions\n// vec2 functions\nvoid vec2_sum_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n out_val[0] = sum_fp64(a[0], b[0]);\n out_val[1] = sum_fp64(a[1], b[1]);\n}\n\nvoid vec2_sub_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n out_val[0] = sub_fp64(a[0], b[0]);\n out_val[1] = sub_fp64(a[1], b[1]);\n}\n\nvoid vec2_mul_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n out_val[0] = mul_fp64(a[0], b[0]);\n out_val[1] = mul_fp64(a[1], b[1]);\n}\n\nvoid vec2_div_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {\n out_val[0] = div_fp64(a[0], b[0]);\n out_val[1] = div_fp64(a[1], b[1]);\n}\n\nvoid vec2_mix_fp64(vec2 x[2], vec2 y[2], float a, out vec2 out_val[2]) {\n vec2 range[2];\n vec2_sub_fp64(y, x, range);\n vec2 portion[2];\n portion[0] = range[0] * a;\n portion[1] = range[1] * a;\n vec2_sum_fp64(x, portion, out_val);\n}\n\nvec2 vec2_length_fp64(vec2 x[2]) {\n return sqrt_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])));\n}\n\nvoid vec2_normalize_fp64(vec2 x[2], out vec2 out_val[2]) {\n vec2 length = vec2_length_fp64(x);\n vec2 length_vec2[2];\n length_vec2[0] = length;\n length_vec2[1] = length;\n\n vec2_div_fp64(x, length_vec2, out_val);\n}\n\nvec2 vec2_distance_fp64(vec2 x[2], vec2 y[2]) {\n vec2 diff[2];\n vec2_sub_fp64(x, y, diff);\n return vec2_length_fp64(diff);\n}\n\nvec2 vec2_dot_fp64(vec2 a[2], vec2 b[2]) {\n vec2 v[2];\n\n v[0] = mul_fp64(a[0], b[0]);\n v[1] = mul_fp64(a[1], b[1]);\n\n return sum_fp64(v[0], v[1]);\n}\n\n// vec3 functions\nvoid vec3_sub_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {\n for (int i = 0; i < 3; i++) {\n out_val[i] = sum_fp64(a[i], b[i]);\n }\n}\n\nvoid vec3_sum_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {\n for (int i = 0; i < 3; i++) {\n out_val[i] = sum_fp64(a[i], b[i]);\n }\n}\n\nvec2 vec3_length_fp64(vec2 x[3]) {\n return sqrt_fp64(sum_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])),\n mul_fp64(x[2], x[2])));\n}\n\nvec2 vec3_distance_fp64(vec2 x[3], vec2 y[3]) {\n vec2 diff[3];\n vec3_sub_fp64(x, y, diff);\n return vec3_length_fp64(diff);\n}\n\n// vec4 functions\nvoid vec4_fp64(vec4 a, out vec2 out_val[4]) {\n out_val[0].x = a[0];\n out_val[0].y = 0.0;\n\n out_val[1].x = a[1];\n out_val[1].y = 0.0;\n\n out_val[2].x = a[2];\n out_val[2].y = 0.0;\n\n out_val[3].x = a[3];\n out_val[3].y = 0.0;\n}\n\nvoid vec4_scalar_mul_fp64(vec2 a[4], vec2 b, out vec2 out_val[4]) {\n out_val[0] = mul_fp64(a[0], b);\n out_val[1] = mul_fp64(a[1], b);\n out_val[2] = mul_fp64(a[2], b);\n out_val[3] = mul_fp64(a[3], b);\n}\n\nvoid vec4_sum_fp64(vec2 a[4], vec2 b[4], out vec2 out_val[4]) {\n for (int i = 0; i < 4; i++) {\n out_val[i] = sum_fp64(a[i], b[i]);\n }\n}\n\nvoid vec4_dot_fp64(vec2 a[4], vec2 b[4], out vec2 out_val) {\n vec2 v[4];\n\n v[0] = mul_fp64(a[0], b[0]);\n v[1] = mul_fp64(a[1], b[1]);\n v[2] = mul_fp64(a[2], b[2]);\n v[3] = mul_fp64(a[3], b[3]);\n\n out_val = sum_fp64(sum_fp64(v[0], v[1]), sum_fp64(v[2], v[3]));\n}\n\nvoid mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {\n vec2 tmp[4];\n\n for (int i = 0; i < 4; i++)\n {\n for (int j = 0; j < 4; j++)\n {\n tmp[j] = b[j + i * 4];\n }\n vec4_dot_fp64(a, tmp, out_val[i]);\n }\n}\n"); //# sourceMappingURL=fp64-functions.glsl.js.map /***/ }), /* 649 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export fp64ify */ function fp64ify(a) { var hiPart = Math.fround(a); var loPart = a - hiPart; return [hiPart, loPart]; } //# sourceMappingURL=fp64-utils.js.map /***/ }), /* 650 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export fp64arithmetic */ /* unused harmony export fp64fs */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__fp64_utils__ = __webpack_require__(649); /* unused harmony reexport fp64ify */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__fp64_arithmetic_glsl__ = __webpack_require__(647); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__fp64_functions_glsl__ = __webpack_require__(648); // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var fp64shader = __WEBPACK_IMPORTED_MODULE_1__fp64_arithmetic_glsl__["a" /* default */] + '\n' + __WEBPACK_IMPORTED_MODULE_2__fp64_functions_glsl__["a" /* default */]; /* harmony default export */ __webpack_exports__["a"] = ({ name: 'fp64', vs: fp64shader, fs: null }); // Arithmetic only var fp64arithmetic = { name: 'fp64-arithmetic', vs: '' + __WEBPACK_IMPORTED_MODULE_1__fp64_arithmetic_glsl__["a" /* default */], fs: null }; // Fragment shader fp64 var fp64fs = { name: 'fp64-fs', vs: null, fs: fp64shader }; //# sourceMappingURL=fp64.js.map /***/ }), /* 651 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (" // empty\n"); //# sourceMappingURL=lighting-common.glsl.js.map /***/ }), /* 652 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("#ifdef GL_ES\nprecision highp float;\n#endif\n\n#define LIGHT_MAX 4\n\nvarying vec3 lighting_vLightWeighting;\n\nvec4 lighting_apply(vec4 color) {\n // set color from texture\n return vec4(color.rgb * lighting_vLightWeighting, color.a);\n}\n\n// spec-map.fs\n\nuniform mat4 viewMatrix;\n\n\nvarying vec4 lighting_vColor;\nvarying vec4 lighting_vTransformedNormal;\nvarying vec4 lighting_vPosition;\n\nuniform float shininess;\nuniform bool enableSpecularMap;\nuniform bool enableLights;\n\nuniform vec3 ambientColor;\nuniform vec3 directionalColor;\nuniform vec3 lightingDirection;\n\nuniform vec3 lighting_uPointLocation[LIGHT_MAX];\nuniform vec3 lighting_uPointColor[LIGHT_MAX];\nuniform float lighting_uPointSpecularEnable[LIGHT_MAX];\nuniform vec3 lighting_uPointSpecularColor[LIGHT_MAX];\nuniform int numberPoints;\n\n\nvec3 lighting__calculate_light_weighting() {\n\treturn lighting__calculate_light_weighting(shininess);\n}\n\nvec3 lighting__calculate_light_weighting(shininess) {\n vec3 normal = vTransformedNormal.xyz;\n vec3 eyeDirection = normalize(-vPosition.xyz);\n\n vec3 specularLight = vec3(0., 0., 0.);\n vec3 diffuseLight = vec3(0., 0., 0.);\n\n for (int i = 0; i < LIGHT_MAX; i++) {\n if (i < numberPoints) {\n vec3 transformedPointLocation = (viewMatrix * vec4(lighting_uPointLocation[i], 1.0)).xyz;\n vec3 lightDirection = normalize(transformedPointLocation - vPosition.xyz);\n\n if (lighting_uPointSpecularEnable > 0.) {\n vec3 reflectionDirection = reflect(-lightDirection, normal);\n float specularLightWeighting =\n pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininessVal);\n specularLight += specularLightWeighting * lighting_uPointSpecularColor[i];\n }\n\n float diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);\n diffuseLight += diffuseLightWeighting * lighting_uPointColor[i];\n } else {\n break;\n }\n }\n\n return ambientColor + diffuseLight + specularLight;\n}\n\nvoid lighting_filterColor(fragmentColor) {\n if (!lighting_enable) {\n \treturn fragmentColor;\n } else {\n \tvec3 lightWeighting = lighting__calculate_light_weighting();\n \treturn vec4(fragmentColor.rgb * lightWeighting, fragmentColor.a);\n }\n}\n\n// render-tex.fs\n\nuniform vec3 material_uAmbientColor;\nuniform vec3 material_uDiffuseColor;\nuniform vec3 material_uSpecularColor;\nuniform vec3 material_uEmissiveColor;\n\nuniform bool hasTexture1;\nuniform sampler2D sampler1;\n\nuniform mat4 viewMatrix;\n\nvoid apply_lighting(color) {\n vec3 ambientLightWeighting = ambientColor;\n\n vec3 normal = vTransformedNormal.xyz;\n vec3 eyeDirection = normalize(-vPosition.xyz);\n\n vec3 specularLight = vec3(0.0, 0.0, 0.0);\n vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n\n for (int i = 0; i < LIGHT_MAX; i++) {\n if (i < numberPoints) {\n vec3 transformedPointLocation = (viewMatrix * vec4(pointLocation[i], 1.0)).xyz;\n vec3 lightDirection = normalize(transformedPointLocation - vPosition.xyz);\n\n if (enableSpecularHighlights) {\n vec3 reflectionDirection = reflect(-lightDirection, normal);\n float specularLightWeighting =\n pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n specularLight += specularLightWeighting * pointSpecularColor[i];\n }\n\n float diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);\n diffuseLight += diffuseLightWeighting * pointColor[i];\n } else {\n break;\n }\n }\n\n vec3 matAmbientColor = material_uAmbientColor * color.rgb;\n vec3 matDiffuseColor = material_uDiffuseColor * color.rgb;\n vec3 matSpecularColor = material_uSpecularColor * color.rgb;\n vec3 matEmissiveColor = material_uEmissiveColor * color.rgb;\n gl_FragColor = vec4(\n matAmbientColor * ambientLightWeighting\n + matDiffuseColor * diffuseLightWeighting\n + matSpecularColor * specularLightWeighting\n + matEmissiveColor,\n color.a\n );\n}\n\n/// frag-lighting\n\n vec3 lightWeighting;\n if (!enableLights) {\n lightWeighting = vec3(1.0, 1.0, 1.0);\n } else {\n vec3 lightDirection;\n float specularLightWeighting = 0.0;\n float diffuseLightWeighting = 0.0;\n vec3 specularLight = vec3(0.0, 0.0, 0.0);\n vec3 diffuseLight = vec3(0.0, 0.0, 0.0);\n\n vec3 transformedPointLocation;\n vec3 normal = vTransformedNormal.xyz;\n\n vec3 eyeDirection = normalize(-vPosition.xyz);\n vec3 reflectionDirection;\n\n vec3 pointWeight = vec3(0.0, 0.0, 0.0);\n\n for (int i = 0; i < LIGHT_MAX; i++) {\n if (i < numberPoints) {\n transformedPointLocation = (viewMatrix * vec4(pointLocation[i], 1.0)).xyz;\n lightDirection = normalize(transformedPointLocation - vPosition.xyz);\n\n if (enableSpecular[i] > 0.0) {\n reflectionDirection = reflect(-lightDirection, normal);\n specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n specularLight += specularLightWeighting * pointSpecularColor[i];\n }\n\n diffuseLightWeighting = max(dot(normal, lightDirection), 0.0);\n diffuseLight += diffuseLightWeighting * pointColor[i];\n } else {\n break;\n }\n }\n\n lightWeighting = ambientColor + diffuseLight + specularLight;\n }\n\n// reflection / refraction configs\nuniform float reflection;\nuniform float refraction;\n\n///\n // has cube texture then apply reflection\n // if (hasTextureCube1) {\n // vec3 nReflection = normalize(vReflection);\n // vec3 reflectionValue;\n // if (refraction > 0.0) {\n // reflectionValue = refract(nReflection, vNormal.xyz, refraction);\n // } else {\n // reflectionValue = -reflect(nReflection, vNormal.xyz);\n // }\n\n // // TODO(nico): check whether this is right.\n // vec4 cubeColor = textureCube(samplerCube1,\n // vec3(-reflectionValue.x, -reflectionValue.y, reflectionValue.z));\n // gl_FragColor = vec4(mix(gl_FragColor.xyz, cubeColor.xyz, reflection), 1.0);\n // }\n"); //# sourceMappingURL=lighting-fragment.glsl.js.map /***/ }), /* 653 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("#define LIGHT_MAX 4\n\n/*\n// lighting configuration\nuniform bool enableLights;\nuniform vec3 ambientColor;\nuniform vec3 directionalColor;\nuniform vec3 lightingDirection;\n\n// point lights configuration\nuniform vec3 pointLocation[LIGHT_MAX];\nuniform vec3 pointColor[LIGHT_MAX];\nuniform int numberPoints;\n\n// reflection / refraction configuration\nuniform bool useReflection;\n*/\n\nuniform bool lighting_uEnableLights;\nuniform vec3 lighting_uAmbientColor;\nuniform vec3 lighting_uDirection;\nuniform vec3 lighting_uDirectionalColor;\n\n// point lights configuration\nuniform int lighting_uPointCount;\nuniform vec3 lighting_uPointLocation[LIGHT_MAX];\nuniform vec3 lighting_uPointColor[LIGHT_MAX];\n\n// reflection / refraction configuration\nuniform bool lighting_uEnableReflections;\n\n// varyings\nvarying vec4 lighting_vPosition;\nvarying vec4 lighting_vNormal;\nvarying vec3 lighting_vColor;\nvarying vec3 lighting_vLightWeighting;\nvarying vec3 lighting_vReflection;\n\nvoid lighting_setPositionAndNormal(vec3 position, vec3 normal) {\n lighting_vPosition = worldMatrix * vec4(position, 1.);\n lighting_vNormal = worldInverseTransposeMatrix * vec4(normal, 1.);;\n}\n\nvoid lighting__getLightWeigting() {\n float directionalLightWeighting = max(dot(lighting_vNormal.xyz, lighting_uDirection), 0.);\n vec3 pointWeight = vec3(0., 0., 0.);\n for (int i = 0; i < LIGHT_MAX; i++) {\n if (i < numberPoints) {\n vec4 mvLightPosition = viewMatrix * vec4(lighting_uPointLocation[i], 1.);\n vec3 pointLightDirection = normalize(mvLightPosition.xyz - lighting_vPosition.xyz);\n pointWeight += max(dot(lighting_vNormal.xyz, pointLightDirection), 0.) * pointColor[i];\n } else {\n break;\n }\n }\n return ambientColor + (directionalColor * directionalLightWeighting) + pointWeight;\n}\n\nvoid lighting_apply(vec3 position, vec3 normal) {\n lighting_setPositionAndNormal(position, normal);\n\n // lighting code\n if(!lighting_uEnableLights) {\n lighting_vLightWeighting = vec3(1., 1., 1.);\n } else {\n lighting_vLightWeighting = lighting__getLightWeighting();\n }\n}\n\nvoid lighting_set_reflection(vec3 position) {\n // refraction / reflection code\n if (lighting_uEnableReflections) {\n lighting_vReflection = (viewInverseMatrix[3] - (worldMatrix * vec4(position, 1.))).xyz;\n } else {\n lighting_vReflection = vec3(1., 1., 1.);\n }\n}\n"); //# sourceMappingURL=lighting-vertex.glsl.js.map /***/ }), /* 654 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export vertexShader */ /* unused harmony export fragmentShader */ /* unused harmony export name */ /* unused harmony export config */ /* unused harmony export getUniforms */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_math_gl__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__lighting_common_glsl__ = __webpack_require__(651); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__lighting_vertex_glsl__ = __webpack_require__(653); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__lighting_fragment_glsl__ = __webpack_require__(652); var vertexShader = __WEBPACK_IMPORTED_MODULE_1__lighting_common_glsl__["a" /* default */] + '\n' + __WEBPACK_IMPORTED_MODULE_2__lighting_vertex_glsl__["a" /* default */] + '\n'; var fragmentShader = __WEBPACK_IMPORTED_MODULE_1__lighting_common_glsl__["a" /* default */] + '\n' + __WEBPACK_IMPORTED_MODULE_3__lighting_fragment_glsl__["a" /* default */] + '\n'; var name = 'lighting'; var config = { MAX_POINT_LIGHTS: 4 }; // Setup the lighting system: ambient, directional, point lights. function getUniforms(_ref) { var _ref$lightingEnable = _ref.lightingEnable, lightingEnable = _ref$lightingEnable === undefined ? false : _ref$lightingEnable, _ref$lightingAmbientC = _ref.lightingAmbientColor, lightingAmbientColor = _ref$lightingAmbientC === undefined ? [0.2, 0.2, 0.2] : _ref$lightingAmbientC, _ref$lightingDirectio = _ref.lightingDirection, lightingDirection = _ref$lightingDirectio === undefined ? [1, 1, 1] : _ref$lightingDirectio, _ref$lightingDirectio2 = _ref.lightingDirectionalColor, lightingDirectionalColor = _ref$lightingDirectio2 === undefined ? [0, 0, 0] : _ref$lightingDirectio2, _ref$lightingPointLig = _ref.lightingPointLights, lightingPointLights = _ref$lightingPointLig === undefined ? [] : _ref$lightingPointLig; // Set light uniforms. Ambient, directional and point lights. return Object.assign({ lightingEnable: lightingEnable, // Ambient lightingAmbientColor: lightingAmbientColor }, getDirectionalUniforms(lightingDirection), getPointUniforms(lightingPointLights)); } function getDirectionalUniforms(_ref2) { var color = _ref2.color, direction = _ref2.direction; // Normalize lighting direction vector var dir = new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Vector3"](direction.x, direction.y, direction.z).normalize().scale(-1, -1, -1); return { directionalColor: [color.r, color.g, color.b], lightingDirection: [dir.x, dir.y, dir.z] }; } function getPointUniforms(points) { points = points instanceof Array ? points : [points]; var numberPoints = points.length; var pointLocations = []; var pointColors = []; var enableSpecular = []; var pointSpecularColors = []; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = points[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var point = _step.value; var position = point.position, color = point.color, diffuse = point.diffuse, specular = point.specular; var pointColor = color || diffuse; pointLocations.push(position.x, position.y, position.z); pointColors.push(pointColor.r, pointColor.g, pointColor.b); // Add specular color enableSpecular.push(Number(Boolean(specular))); if (specular) { pointSpecularColors.push(specular.r, specular.g, specular.b); } else { pointSpecularColors.push(0, 0, 0); } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return { numberPoints: numberPoints, pointLocation: pointLocations, pointColor: pointColors, enableSpecular: enableSpecular, pointSpecularColor: pointSpecularColors }; } /* harmony default export */ __webpack_exports__["a"] = ({ name: name, vs: vertexShader, fs: fragmentShader, getUniforms: getUniforms }); //# sourceMappingURL=lighting.js.map /***/ }), /* 655 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MODULE_INJECTORS_VS; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return MODULE_INJECTORS_FS; }); var MODULE_INJECTORS_VS = "#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n"; var MODULE_INJECTORS_FS = "#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth();\n#endif\n"; //# sourceMappingURL=module-injectors.js.map /***/ }), /* 656 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var DEFAULT_HIGHLIGHT_COLOR = new Uint8Array([0, 255, 255, 255]); var DEFAULT_MODULE_OPTIONS = { pickingSelectedColor: null, // Set to a picking color to visually highlight that item pickingHighlightColor: DEFAULT_HIGHLIGHT_COLOR, // Color of visual highlight of "selected" item pickingThreshold: 1.0, pickingActive: false // Set to true when rendering to off-screen "picking" buffer }; /* eslint-disable camelcase */ function getUniforms() { var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS; var uniforms = {}; if (opts.pickingSelectedColor !== undefined) { if (opts.pickingSelectedColor === null) { uniforms.picking_uSelectedColorValid = 0; } else { var selectedColor = [opts.pickingSelectedColor[0], opts.pickingSelectedColor[1], opts.pickingSelectedColor[2]]; uniforms.picking_uSelectedColorValid = 1; uniforms.picking_uSelectedColor = selectedColor; } } if (opts.pickingHighlightColor !== undefined) { uniforms.picking_uHighlightColor = opts.pickingHighlightColor; } // TODO - major hack - decide on normalization and remove if (opts.pickingThreshold !== undefined) { uniforms.picking_uThreshold = opts.pickingThreshold; } if (opts.pickingActive !== undefined) { uniforms.picking_uActive = opts.pickingActive ? 1 : 0; } return uniforms; } var vs = 'uniform vec3 picking_uSelectedColor;\nuniform float picking_uThreshold;\nuniform bool picking_uSelectedColorValid;\n\nvarying vec4 picking_vRGBcolor_Aselected;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n picking_uSelectedColorValid &&\n abs(vertexColor.r - picking_uSelectedColor.r) < picking_uThreshold &&\n abs(vertexColor.g - picking_uSelectedColor.g) < picking_uThreshold &&\n abs(vertexColor.b - picking_uSelectedColor.b) < picking_uThreshold;\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n // Do the comparison with selected item color in vertex shader as it should mean fewer compares\n picking_vRGBcolor_Aselected.a =\n float(isVertexPicked(pickingColor));\n\n // Stores the picking color so that the fragment shader can render it during picking\n picking_vRGBcolor_Aselected.rgb = pickingColor * COLOR_SCALE;\n}\n'; var fs = 'uniform bool picking_uActive; // true during rendering to offscreen picking buffer\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nvarying vec4 picking_vRGBcolor_Aselected;\n\nconst float COLOR_SCALE = 1. / 255.;\n\n/*\n * Returns highlight color if this item is selected.\n */\nvec4 picking_filterHighlightColor(vec4 color) {\n bool selected = bool(picking_vRGBcolor_Aselected.a);\n return selected ? (picking_uHighlightColor * COLOR_SCALE) : color;\n}\n\n/*\n * Returns picking color if picking enabled else unmodified argument.\n */\nvec4 picking_filterPickingColor(vec4 color) {\n vec3 pickingColor = picking_vRGBcolor_Aselected.rgb;\n return picking_uActive ? vec4(pickingColor, 1.0) : color;\n}\n'; /* harmony default export */ __webpack_exports__["a"] = ({ name: 'picking', vs: vs, fs: fs, getUniforms: getUniforms }); //# sourceMappingURL=picking.js.map /***/ }), /* 657 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return MODULAR_SHADERS; }); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__modular_vertex_glsl__ = __webpack_require__(659); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__modular_fragment_glsl__ = __webpack_require__(658); // Default Shaders // A set of base shaders that leverage the shader module system, // dynamically enabling features depending on which modules are included var MODULAR_SHADERS = { vs: __WEBPACK_IMPORTED_MODULE_0__modular_vertex_glsl__["a" /* default */], fs: __WEBPACK_IMPORTED_MODULE_1__modular_fragment_glsl__["a" /* default */], defaultUniforms: {} }; //# sourceMappingURL=index.js.map /***/ }), /* 658 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("#define SHADER_NAME luma-modular-fragment\n\n#ifdef GL_ES\nprecision highp float;\n#endif\n\n// varyings\nvarying vec4 vColor;\n\nvoid main(){\n gl_FragColor = vec4(1., 0., 1., 1.);\n\n#ifdef MODULE_DIFFUSE\n gl_FragColor = diffuse_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_MATERIAL\n gl_FragColor = material_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LIGHTING\n gl_FragColor = lighting_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_FOG\n gl_FragColor = fog_filterColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_PICKING\n gl_FragColor = picking_filterHighlightColor(gl_FragColor);\n gl_FragColor = picking_filterPickingColor(gl_FragColor);\n#endif\n\n#ifdef MODULE_LOGDEPTH\n logdepth_setFragDepth(gl_Position);\n#endif\n}\n"); //# sourceMappingURL=modular-fragment.glsl.js.map /***/ }), /* 659 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = ("#define SHADER_NAME luma_modular_vertex\n\n// object attributes\nattribute vec3 positions;\nattribute vec3 normals;\nattribute vec4 colors;\nattribute vec2 texCoords;\nattribute vec3 pickingColors;\n\nvoid main(void) {\n\n // Set up position\n#ifdef MODULE_GEOMETRY\n geometry_setPosition(positions);\n geometry_setNormal(normals);\n#endif\n\n#ifdef MODULE_PROJECT\n project_setPositionAndNormal_Model(positions, normals);\n gl_Position = project_model_to_clipspace(positions);\n#endif\n\n // Set up depth\n#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n\n#ifdef MODULE_DIFFUSE\n diffuse_setTextureCoordinate(texCoords);\n#endif\n\n // Set up color calculations\n#ifdef MODULE_MATERIAL\n material_setDiffuseColor(colors);\n material_setDiffuseTextureCoordinates(texCoords);\n#endif\n\n#ifdef MODULE_LIGHTING\n lighting_setPositionAndNormal(positions, normals);\n lighting_apply_light(positions);\n lighting_apply_reflection(positions);\n#endif\n\n#ifdef MODULE_PICKING\n picking_setPickingColor(pickingColors);\n#endif\n\n}\n"); //# sourceMappingURL=modular-vertex.glsl.js.map /***/ }), /* 660 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* unused harmony export promisify */ /** * Converts a function that accepts a node style (err, result) callback * as the last argument into a function that takes the same arguments * and returns a promise that resolves or rejects with the values provided * by the original callback * @param {Function} func - function to wrap * @return {Function} promisified function */ /* eslint-disable no-try-catch */ function promisify(func) { return function promisifiedFunction() { for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return new Promise(function (resolve, reject) { function callback(error, data) { try { if (error) { reject(error); } else { resolve(data); } } catch (e) { reject(e); } } func.apply(undefined, args.concat([callback])); }); }; } /* eslint-enable no-try-catch */ //# sourceMappingURL=promise-utils.js.map /***/ }), /* 661 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = uid; /* harmony export (immutable) */ __webpack_exports__["b"] = isPowerOfTwo; /* harmony export (immutable) */ __webpack_exports__["c"] = isObjectEmpty; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); var uidCounters = {}; /** * Returns a UID. * @param {String} id= - Identifier base name * @return {number} uid **/ function uid() { var id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'id'; uidCounters[id] = uidCounters[id] || 1; var count = uidCounters[id]++; return id + '-' + count; } /** * Verifies if a given number is power of two or not. * @param {object} n - The number to check. * @return {Array} Returns true if the given number is power of 2, false otherwise. **/ function isPowerOfTwo(n) { __WEBPACK_IMPORTED_MODULE_0_assert___default()(typeof n === 'number', 'Input must be a number'); return n && (n & n - 1) === 0; } // Returns true if given object is empty, false otherwise. function isObjectEmpty(obj) { var isEmpty = true; /* eslint-disable no-unused-vars */ for (var key in obj) { isEmpty = false; break; } /* eslint-enable no-unused-vars */ return isEmpty; } //# sourceMappingURL=utils.js.map /***/ }), /* 662 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = getKeyValue; /* harmony export (immutable) */ __webpack_exports__["b"] = getKey; /* harmony export (immutable) */ __webpack_exports__["c"] = getKeyType; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); // Resolve a WebGL enumeration name (returns itself if already a number) function getKeyValue(gl, name) { // If not a string, return (assume number) if (typeof name !== 'string') { return name; } // If string converts to number, return number var number = Number(name); if (!isNaN(number)) { return number; } // Look up string, after removing any 'GL.' or 'gl.' prefix name = name.replace(/^.*\./, ''); var value = gl[name]; __WEBPACK_IMPORTED_MODULE_0_assert___default()(value !== undefined, 'Accessing undefined constant GL.' + name); return value; } function getKey(gl, value) { value = Number(value); for (var key in gl) { if (gl[key] === value) { return 'gl.' + key; } } return String(value); } function getKeyType(gl, value) { __WEBPACK_IMPORTED_MODULE_0_assert___default()(value !== undefined, 'undefined key'); value = Number(value); for (var key in gl) { if (gl[key] === value) { return 'gl.' + key; } } return String(value); } //# sourceMappingURL=constants-to-keys.js.map /***/ }), /* 663 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["c"] = getPageLoadPromise; /* harmony export (immutable) */ __webpack_exports__["a"] = createCanvas; /* harmony export (immutable) */ __webpack_exports__["b"] = getCanvas; /* unused harmony export getCSSSize */ /* unused harmony export getDrawingBufferSize */ /* unused harmony export calculateDrawingBufferSize */ /* unused harmony export resizeCanvas */ /* harmony export (immutable) */ __webpack_exports__["d"] = resizeDrawingBuffer; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__utils__ = __webpack_require__(8); // Resizing a webgl canvas /* global window, document */ var isPageLoaded = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* isBrowser */] && document.readyState === 'complete'; var pageLoadPromise = __WEBPACK_IMPORTED_MODULE_0__utils__["a" /* isBrowser */] ? new Promise(function (resolve, reject) { if (isPageLoaded) { resolve(document); return; } window.onload = function () { isPageLoaded = true; resolve(document); }; }) : Promise.resolve({}); /** * Returns a promise that resolves when the page is loaded * at this point the DOM can be manipulated, and e.g. a new canvas can be inserted * @return {Promise} - resolves when the page is loaded */ function getPageLoadPromise() { return pageLoadPromise; } /** * Create a canvas * @param {Number} width - set to 100% * @param {Number} height - set to 100% */ function createCanvas(_ref) { var _ref$width = _ref.width, width = _ref$width === undefined ? 800 : _ref$width, _ref$height = _ref.height, height = _ref$height === undefined ? 600 : _ref$height, _ref$id = _ref.id, id = _ref$id === undefined ? 'gl-canvas' : _ref$id, _ref$insert = _ref.insert, insert = _ref$insert === undefined ? true : _ref$insert; var canvas = document.createElement('canvas'); canvas.id = id; canvas.style.width = Number.isFinite(width) ? width + 'px' : '100%'; canvas.style.height = Number.isFinite(height) ? height + 'px' : '100%'; // add the canvas to the body element once the page has loaded if (insert) { getPageLoadPromise().then(function (document) { var body = document.body; body.insertBefore(canvas, body.firstChild); }); } return canvas; } /** * Gets an already created canvas from the DOM * @param {Number} id - DOM element id */ function getCanvas(_ref2) { var id = _ref2.id; if (!isPageLoaded) { throw new Error('createGLContext called on canvas \'' + id + '\' before page was loaded'); } return document.getElementById(id); } // Gets current size of canvas in css (logical/window) coordinates function getCSSSize(canvas) { return { width: canvas.clientWidth, height: canvas.clientHeight }; } // Gets current size of canvas drawing buffer in actual pixels // This is needed for the gl.viewport call function getDrawingBufferSize(canvas) { return { width: canvas.width, height: canvas.height }; } // Calculate the drawing buffer size that would cover current canvas size and device pixel ratio // Intention is that every pixel in the drawing buffer will have a 1-to-1 mapping with // actual device pixels in the hardware framebuffer, allowing us to render at the full // resolution of the device. function calculateDrawingBufferSize(canvas, options) { var _options$useDevicePix = options.useDevicePixels, useDevicePixels = _options$useDevicePix === undefined ? true : _options$useDevicePix; if ('useDevicePixelRatio' in options) { __WEBPACK_IMPORTED_MODULE_0__utils__["b" /* log */].deprecated('useDevicePixelRatio', 'useDevicePixels'); useDevicePixels = options.useDevicePixels || options.useDevicePixelRatio; } var cssToDevicePixels = useDevicePixels ? window.devicePixelRatio || 1 : 1; // Lookup the size the browser is displaying the canvas in CSS pixels // and compute a size needed to make our drawingbuffer match it in // device pixels. var cssSize = getCSSSize(canvas); return { width: Math.floor(cssSize.width * cssToDevicePixels), height: Math.floor(cssSize.height * cssToDevicePixels), devicePixelRatio: cssToDevicePixels }; } /** * Resizes canvas in "CSS coordinates" (note these can be very different from device coords, * depending on devicePixelRatio/retina screens and size of drawing buffer) * and can be changed separately from drawing buffer size. * Therefore, normally `resizeDrawingBuffer` should be called after calling `resizeCanvas`. * * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html * * @param {Number} width, height - new width and height of canvas in CSS coordinates */ function resizeCanvas(canvas, _ref3) { var width = _ref3.width, height = _ref3.height; canvas.style.width = width + 'px'; canvas.style.height = height + 'px'; } /** * Resize the canvas' drawing buffer to match the canvas CSS size, * and by default to also consider devicePixelRatio * detects if anything has changed, can be called every frame * for best visual results, usually set to either: * canvas CSS width x canvas CSS height * canvas CSS width * devicePixelRatio x canvas CSS height * devicePixelRatio * * NOTE: Regardless of size, the drawing buffer will always be scaled to the viewport * See http://webgl2fundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html * * @param {Number} width - new width of canvas in CSS coordinates * @param {Number} height - new height of canvas in CSS coordinates */ function resizeDrawingBuffer(canvas, _ref4) { var _ref4$useDevicePixelR = _ref4.useDevicePixelRatio, useDevicePixelRatio = _ref4$useDevicePixelR === undefined ? null : _ref4$useDevicePixelR, _ref4$useDevicePixels = _ref4.useDevicePixels, useDevicePixels = _ref4$useDevicePixels === undefined ? true : _ref4$useDevicePixels; // Resize the render buffer of the canvas to match canvas client size if (useDevicePixelRatio !== null) { __WEBPACK_IMPORTED_MODULE_0__utils__["b" /* log */].deprecated('useDevicePixelRatio', 'useDevicePixels'); useDevicePixels = useDevicePixelRatio; } // multiplying with dpr (Optionally can be turned off) var newBufferSize = calculateDrawingBufferSize(canvas, { useDevicePixels: useDevicePixels }); // Only update if the canvas size has not changed if (newBufferSize.width !== canvas.width || newBufferSize.height !== canvas.height) { // Make the canvas render buffer the same size as canvas.width = newBufferSize.width; canvas.height = newBufferSize.height; // Always reset CSS size after setting drawing buffer size // canvas.style.width = `${cssSize.width}px`; // canvas.style.height = `${cssSize.height}px`; } } //# sourceMappingURL=create-canvas.js.map /***/ }), /* 664 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["b"] = createContext; /* harmony export (immutable) */ __webpack_exports__["a"] = trackContextCreation; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); // Create a WebGL context /* global HTMLCanvasElement, WebGLRenderingContext */ /** * Create a WebGL context for a canvas * Note calling this multiple time on the same canvas does return the same context */ function createContext(_ref) { var canvas = _ref.canvas, _ref$opts = _ref.opts, opts = _ref$opts === undefined ? {} : _ref$opts, _ref$onError = _ref.onError, onError = _ref$onError === undefined ? function (message) { return null; } : _ref$onError; // See if we can extract any extra information about why context creation failed function onContextCreationError(error) { onError('WebGL context: ' + (error.statusMessage || 'Unknown error')); } canvas.addEventListener('webglcontextcreationerror', onContextCreationError, false); var _opts$webgl = opts.webgl1, webgl1 = _opts$webgl === undefined ? true : _opts$webgl, _opts$webgl2 = opts.webgl2, webgl2 = _opts$webgl2 === undefined ? true : _opts$webgl2; var gl = null; // Prefer webgl2 over webgl1, prefer conformant over experimental if (webgl2) { gl = gl || canvas.getContext('webgl2', opts); gl = gl || canvas.getContext('experimental-webgl2', opts); } if (webgl1) { gl = gl || canvas.getContext('webgl', opts); gl = gl || canvas.getContext('experimental-webgl', opts); } canvas.removeEventListener('webglcontextcreationerror', onContextCreationError, false); if (!gl) { return onError('Failed to create ' + (webgl2 && !webgl1 ? 'WebGL2' : 'WebGL') + ' context'); } return gl; } /** * Installs a spy on Canvas.getContext * calls the provided callback with the {context} */ function trackContextCreation(_ref2) { var _ref2$onContextCreate = _ref2.onContextCreate, onContextCreate = _ref2$onContextCreate === undefined ? function () { return null; } : _ref2$onContextCreate, _ref2$onContextCreate2 = _ref2.onContextCreated, onContextCreated = _ref2$onContextCreate2 === undefined ? function () {} : _ref2$onContextCreate2; __WEBPACK_IMPORTED_MODULE_0_assert___default()(onContextCreate || onContextCreated); if (typeof HTMLCanvasElement !== 'undefined') { var getContext = HTMLCanvasElement.prototype.getContext; HTMLCanvasElement.prototype.getContext = function getContextSpy(type, opts) { // Let intercepter create context var context = void 0; if (type === 'webgl') { context = onContextCreate({ canvas: this, type: type, opts: opts, getContext: getContext.bind(this) }); } // If not, create context context = context || getContext.call(this, type, opts); // Report it created if (context instanceof WebGLRenderingContext) { onContextCreated({ canvas: this, context: context, type: type, opts: opts }); } return context; }; } } //# sourceMappingURL=create-context.js.map /***/ }), /* 665 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = parseGLSLCompilerError; /* unused harmony export default */ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__get_shader_name__ = __webpack_require__(264); // TODO - formatGLSLCompilerError should not depend on this /** * Parse a GLSL compiler error log into a string showing the source code around each error. * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain) */ /* eslint-disable no-continue, max-statements */ function parseGLSLCompilerError(errLog, src, shaderType) { var errorStrings = errLog.split(/\r?\n/); var errors = {}; var warnings = {}; var name = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__get_shader_name__["a" /* default */])(src) || '(unnamed)'; var shaderName = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__get_shader_name__["b" /* getShaderTypeName */])(shaderType) + ' shader ' + name; // Parse the error - note: browser and driver dependent for (var i = 0; i < errorStrings.length; i++) { var errorString = errorStrings[i]; if (errorString.length <= 1) { continue; } var segments = errorString.split(':'); var type = segments[0]; var line = parseInt(segments[2], 10); if (isNaN(line)) { throw new Error('GLSL compilation error in ' + shaderName + ': ' + errLog); } if (type !== 'WARNING') { errors[line] = errorString; } else { warnings[line] = errorString; } } // Format the error inline with the code var lines = addLineNumbers(src); return { shaderName: shaderName, errors: formatErrors(errors, lines), warnings: formatErrors(warnings, lines) }; } // Formats GLSL compiler error log into single string function formatGLSLCompilerError(errLog, src, shaderType) { var _parseGLSLCompilerErr = parseGLSLCompilerError(errLog, src, shaderType), shaderName = _parseGLSLCompilerErr.shaderName, errors = _parseGLSLCompilerErr.errors, warnings = _parseGLSLCompilerErr.warnings; return 'GLSL compilation error in ' + shaderName + '\n\n' + errors + '\n' + warnings; } // helper function, outputs annotated errors or warnings function formatErrors(errors, lines) { var message = ''; for (var i = 0; i < lines.length; i++) { var line = lines[i]; if (!errors[i + 3] && !errors[i + 2] && !errors[i + 1]) { continue; } message += line + '\n'; if (errors[i + 1]) { var error = errors[i + 1]; var segments = error.split(':', 3); var type = segments[0]; var column = parseInt(segments[1], 10) || 0; var err = error.substring(segments.join(':').length + 1).trim(); message += padLeft('^^^ ' + type + ': ' + err + '\n\n', column); } } return message; } /** * Prepends line numbers to each line of a string. * The line numbers will be left-padded with spaces to ensure an * aligned layout when rendered using monospace fonts. * @param {String} string - multi-line string to add line numbers to * @param {Number} start=1 - number of spaces to add * @param {String} delim =': ' - injected between line number and original line * @return {String[]} strings - array of string, one per line, with line numbers added */ function addLineNumbers(string) { var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; var delim = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ': '; var lines = string.split(/\r?\n/); var maxDigits = String(lines.length + start - 1).length; return lines.map(function (line, i) { var lineNumber = i + start; var digits = String(lineNumber).length; var prefix = padLeft(lineNumber, maxDigits - digits); return prefix + delim + line; }); } /** * Pads a string with a number of spaces (space characters) to the left * @param {String} string - string to pad * @param {Number} digits - number of spaces to add * @return {String} string - The padded string */ function padLeft(string, digits) { var result = ''; for (var i = 0; i < digits; ++i) { result += ' '; } return '' + result + string; } //# sourceMappingURL=format-glsl-error.js.map /***/ }), /* 666 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = getParameterPolyfill; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(46); var _WEBGL_PARAMETERS; function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint-disable no-inline-comments, max-len, camelcase */ var OES_element_index = 'OES_element_index'; var WEBGL_draw_buffers = 'WEBGL_draw_buffers'; var EXT_disjoint_timer_query = 'EXT_disjoint_timer_query'; var EXT_disjoint_timer_query_webgl2 = 'EXT_disjoint_timer_query_webgl2'; var EXT_texture_filter_anisotropic = 'EXT_texture_filter_anisotropic'; var WEBGL_debug_renderer_info = 'WEBGL_debug_renderer_info'; var GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; var GL_DONT_CARE = 0x1100; var GL_GPU_DISJOINT_EXT = 0x8FBB; var GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF; var GL_UNMASKED_VENDOR_WEBGL = 0x9245; // vendor string of the graphics driver. var GL_UNMASKED_RENDERER_WEBGL = 0x9246; // renderer string of the graphics driver. var getWebGL2ValueOrZero = function getWebGL2ValueOrZero(gl) { return !isWebGL2(gl) ? 0 : undefined; }; // if a function returns undefined in this table, // the original getParameter will be called, defeating the override var WEBGL_PARAMETERS = (_WEBGL_PARAMETERS = {}, _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].READ_BUFFER, function (gl) { return !isWebGL2(gl) ? __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].COLOR_ATTACHMENT0 : undefined; }), _defineProperty(_WEBGL_PARAMETERS, GL_FRAGMENT_SHADER_DERIVATIVE_HINT, function (gl) { return !isWebGL2(gl) ? GL_DONT_CARE : undefined; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].RASTERIZER_DISCARD, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].SAMPLES, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, GL_GPU_DISJOINT_EXT, function (gl, getParameter) { var ext = isWebGL2(gl) ? gl.getExtension(EXT_disjoint_timer_query_webgl2) : gl.getExtension(EXT_disjoint_timer_query); return ext && ext.GPU_DISJOINT_EXT ? getParameter(ext.GPU_DISJOINT_EXT) : 0; }), _defineProperty(_WEBGL_PARAMETERS, GL_UNMASKED_VENDOR_WEBGL, function (gl, getParameter) { var ext = gl.getExtension(WEBGL_debug_renderer_info); return getParameter(ext && ext.UNMASKED_VENDOR_WEBGL || __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].VENDOR); }), _defineProperty(_WEBGL_PARAMETERS, GL_UNMASKED_RENDERER_WEBGL, function (gl, getParameter) { var ext = gl.getExtension(WEBGL_debug_renderer_info); return getParameter(ext && ext.UNMASKED_RENDERER_WEBGL || __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].RENDERER); }), _defineProperty(_WEBGL_PARAMETERS, GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, function (gl, getParameter) { var ext = gl.luma.extensions[EXT_texture_filter_anisotropic]; return ext ? getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 1.0; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_3D_TEXTURE_SIZE, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_ARRAY_TEXTURE_LAYERS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_CLIENT_WAIT_TIMEOUT_WEBGL, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_COLOR_ATTACHMENTS, function (gl, getParameter) { if (!isWebGL2(gl)) { var ext = gl.getExtension(WEBGL_draw_buffers); return ext ? getParameter(ext.MAX_COLOR_ATTACHMENTS_WEBGL) : 0; } return undefined; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_COMBINED_UNIFORM_BLOCKS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_DRAW_BUFFERS, function (gl) { if (!isWebGL2(gl)) { var ext = gl.getExtension(WEBGL_draw_buffers); return ext ? ext.MAX_DRAW_BUFFERS_WEBGL : 0; } return undefined; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_ELEMENT_INDEX, // Guess: per webglstats.com 99.6% of webgl2 supports 2147483647 function (gl) { return gl.getExtension(OES_element_index) ? 2147483647 : 65535; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_ELEMENTS_INDICES, // Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices) function (gl) { return gl.getExtension(OES_element_index) ? 16777216 : 65535; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_ELEMENTS_VERTICES, // Guess: "Reasonably safe" per webglstats.com - could be higher/lower (on some mobile devices) function (gl) { return 16777216; }), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_FRAGMENT_INPUT_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_FRAGMENT_UNIFORM_BLOCKS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_FRAGMENT_UNIFORM_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_SAMPLES, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_SERVER_WAIT_TIMEOUT, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_TEXTURE_LOD_BIAS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_UNIFORM_BLOCK_SIZE, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_UNIFORM_BUFFER_BINDINGS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_VARYING_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_VERTEX_OUTPUT_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_VERTEX_UNIFORM_BLOCKS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_VERTEX_UNIFORM_COMPONENTS, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MIN_PROGRAM_TEXEL_OFFSET, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].MAX_PROGRAM_TEXEL_OFFSET, getWebGL2ValueOrZero), _defineProperty(_WEBGL_PARAMETERS, __WEBPACK_IMPORTED_MODULE_0__constants__["a" /* default */].UNIFORM_BUFFER_OFFSET_ALIGNMENT, getWebGL2ValueOrZero), _WEBGL_PARAMETERS); // Return true if WebGL2 context function isWebGL2(gl) { var GL_TEXTURE_BINDING_3D = 0x806A; return gl && gl.TEXTURE_BINDING_3D === GL_TEXTURE_BINDING_3D; } // A "replacement" gl.getParameter that accepts "enums" from extensions and WebGL2 // and returns reasonably safe defaults function getParameterPolyfill(gl, originalGetParameter, pname) { // Return mock limits (usually 0) for WebGL2 constants to ensure these // can be queries without error var limit = WEBGL_PARAMETERS[pname]; var value = typeof limit === 'function' ? limit(gl, originalGetParameter, pname) : limit; var result = value !== undefined ? value : originalGetParameter(pname); return result; } //# sourceMappingURL=polyfill-get-parameter.js.map /***/ }), /* 667 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__webgl_texture__ = __webpack_require__(62); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } // import GL from './api'; // import {isWebGl2Context, assertWebGL2Context, withParameters} from './context'; // import Buffer from './buffer'; var Texture2DArray = /*#__PURE__*/function (_Texture) { _inherits(Texture2DArray, _Texture); _createClass(Texture2DArray, null, [{ key: 'isSupported', value: function isSupported(gl) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__context__["b" /* isWebGL2 */])(gl); } }]); function Texture2DArray(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Texture2DArray); var _this = _possibleConstructorReturn(this, (Texture2DArray.__proto__ || Object.getPrototypeOf(Texture2DArray)).call(this, gl, opts)); throw new Error('Texture2DArray not yet implemented'); return _this; } return Texture2DArray; }(__WEBPACK_IMPORTED_MODULE_1__webgl_texture__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Texture2DArray); //# sourceMappingURL=texture-2d-array.js.map /***/ }), /* 668 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__api__ = __webpack_require__(38); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__context__ = __webpack_require__(7); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__context_state__ = __webpack_require__(68); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__webgl_texture__ = __webpack_require__(62); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__buffer__ = __webpack_require__(67); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var Texture3D = /*#__PURE__*/function (_Texture) { _inherits(Texture3D, _Texture); _createClass(Texture3D, null, [{ key: 'isSupported', value: function isSupported(gl) { return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["b" /* isWebGL2 */])(gl); } /** * @classdesc * 3D WebGL Texture * Note: Constructor will initialize your texture. * * @class * @param {WebGLRenderingContext} gl - gl context * @param {Image|ArrayBuffer|null} opts= - named options * @param {Image|ArrayBuffer|null} opts.data= - buffer * @param {GLint} width - width of texture * @param {GLint} height - height of texture */ }]); function Texture3D(gl) { var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Texture3D); __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__context__["g" /* assertWebGL2Context */])(gl); var _this = _possibleConstructorReturn(this, (Texture3D.__proto__ || Object.getPrototypeOf(Texture3D)).call(this, gl, Object.assign({}, opts, { target: opts.target || __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].TEXTURE_3D }))); _this.width = null; _this.height = null; _this.depth = null; Object.seal(_this); _this.setImageData(opts); if (opts.generateMipmap) { _this.generateMipmap(); } return _this; } _createClass(Texture3D, [{ key: 'initialize', value: function initialize() { var _this2 = this; var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this.opts = Object.assign({}, this.opts, opts); var _opts = this.opts, pixels = _opts.pixels, settings = _opts.settings; if (settings) { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__context_state__["f" /* withParameters */])(settings, function () { if (pixels) { _this2.setImage3D(_this2.opts); } }); this.setParameters(opts); } } // WebGL2 // Image 3D copies from Typed Array or WebGLBuffer }, { key: 'setImage3D', value: function setImage3D(_ref) { var _ref$level = _ref.level, level = _ref$level === undefined ? 0 : _ref$level, _ref$internalformat = _ref.internalformat, internalformat = _ref$internalformat === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].RGBA : _ref$internalformat, width = _ref.width, height = _ref.height, _ref$depth = _ref.depth, depth = _ref$depth === undefined ? 1 : _ref$depth, _ref$border = _ref.border, border = _ref$border === undefined ? 0 : _ref$border, format = _ref.format, _ref$type = _ref.type, type = _ref$type === undefined ? __WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].UNSIGNED_BYTE : _ref$type, _ref$offset = _ref.offset, offset = _ref$offset === undefined ? 0 : _ref$offset, pixels = _ref.pixels; if (ArrayBuffer.isView(pixels)) { this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, pixels); return; } if (pixels instanceof __WEBPACK_IMPORTED_MODULE_4__buffer__["a" /* default */]) { this.gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].PIXEL_UNPACK_BUFFER, pixels.handle); this.gl.texImage3D(this.target, level, internalformat, width, height, depth, border, format, type, offset); this.gl.bindBuffer(__WEBPACK_IMPORTED_MODULE_0__api__["a" /* default */].PIXEL_UNPACK_BUFFER, pixels.handle); } } }]); return Texture3D; }(__WEBPACK_IMPORTED_MODULE_3__webgl_texture__["a" /* default */]); /* harmony default export */ __webpack_exports__["a"] = (Texture3D); //# sourceMappingURL=texture-3d.js.map /***/ }), /* 669 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert__ = __webpack_require__(1); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_assert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_assert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _UNIFORM_TYPES; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint-disable camelcase */ var ERR_ARGUMENT = 'UniformBufferLayout illegal argument'; // Local constants - these will "collapse" during minification var GL_INT = 0x1404; var GL_INT_VEC2 = 0x8B53; var GL_INT_VEC3 = 0x8B54; var GL_INT_VEC4 = 0x8B55; var GL_FLOAT = 0x1406; var GL_FLOAT_VEC2 = 0x8B50; var GL_FLOAT_VEC3 = 0x8B51; var GL_FLOAT_VEC4 = 0x8B52; var GL_BOOL = 0x8B56; var GL_BOOL_VEC2 = 0x8B57; var GL_BOOL_VEC3 = 0x8B58; var GL_BOOL_VEC4 = 0x8B59; var GL_UNSIGNED_INT = 0x1405; var GL_UNSIGNED_INT_VEC2 = 0x8DC6; var GL_UNSIGNED_INT_VEC3 = 0x8DC7; var GL_UNSIGNED_INT_VEC4 = 0x8DC8; var GL_FLOAT_MAT2 = 0x8B5A; var GL_FLOAT_MAT3 = 0x8B5B; var GL_FLOAT_MAT4 = 0x8B5C; var GL_FLOAT_MAT2x3 = 0x8B65; var GL_FLOAT_MAT2x4 = 0x8B66; var GL_FLOAT_MAT3x2 = 0x8B67; var GL_FLOAT_MAT3x4 = 0x8B68; var GL_FLOAT_MAT4x2 = 0x8B69; var GL_FLOAT_MAT4x3 = 0x8B6A; // Uniform table for std140 var UNIFORM_TYPES = (_UNIFORM_TYPES = {}, _defineProperty(_UNIFORM_TYPES, GL_FLOAT, [GL_FLOAT, 1]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_VEC2, [GL_FLOAT, 2]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_VEC3, [GL_FLOAT, 3]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_VEC4, [GL_FLOAT, 4]), _defineProperty(_UNIFORM_TYPES, GL_INT, [GL_INT, 1]), _defineProperty(_UNIFORM_TYPES, GL_INT_VEC2, [GL_INT, 2]), _defineProperty(_UNIFORM_TYPES, GL_INT_VEC3, [GL_INT, 3]), _defineProperty(_UNIFORM_TYPES, GL_INT_VEC4, [GL_INT, 4]), _defineProperty(_UNIFORM_TYPES, GL_UNSIGNED_INT, [GL_UNSIGNED_INT, 1]), _defineProperty(_UNIFORM_TYPES, GL_UNSIGNED_INT_VEC2, [GL_UNSIGNED_INT, 2]), _defineProperty(_UNIFORM_TYPES, GL_UNSIGNED_INT_VEC3, [GL_UNSIGNED_INT, 3]), _defineProperty(_UNIFORM_TYPES, GL_UNSIGNED_INT_VEC4, [GL_UNSIGNED_INT, 4]), _defineProperty(_UNIFORM_TYPES, GL_BOOL, [GL_FLOAT, 1]), _defineProperty(_UNIFORM_TYPES, GL_BOOL_VEC2, [GL_FLOAT, 2]), _defineProperty(_UNIFORM_TYPES, GL_BOOL_VEC3, [GL_FLOAT, 3]), _defineProperty(_UNIFORM_TYPES, GL_BOOL_VEC4, [GL_FLOAT, 4]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT2, [GL_FLOAT, 8]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT2x3, [GL_FLOAT, 8]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT2x4, [GL_FLOAT, 8]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT3, [GL_FLOAT, 12]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT3x2, [GL_FLOAT, 12]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT3x4, [GL_FLOAT, 12]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT4, [GL_FLOAT, 16]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT4x2, [GL_FLOAT, 16]), _defineProperty(_UNIFORM_TYPES, GL_FLOAT_MAT4x3, [GL_FLOAT, 16]), _UNIFORM_TYPES); // Std140 layout for uniforms var UniformBufferLayout = /*#__PURE__*/function () { function UniformBufferLayout(layout) { var _typedArray; _classCallCheck(this, UniformBufferLayout); this.layout = {}; this.size = 0; // Add layout (type, size and offset) definitions for each uniform in the layout for (var key in layout) { this._addUniform(key, layout[key]); } // Allocate three typed arrays pointing at same memory var data = new Float32Array(this.size); this.typedArray = (_typedArray = {}, _defineProperty(_typedArray, GL_FLOAT, data), _defineProperty(_typedArray, GL_INT, new Int32Array(data.buffer)), _defineProperty(_typedArray, GL_UNSIGNED_INT, new Uint32Array(data.buffer)), _typedArray); } // Get number of bytes needed for buffer allocation _createClass(UniformBufferLayout, [{ key: 'getBytes', value: function getBytes() { return this.size * 4; } // Get the current data as Float32Array, for bufferSubData }, { key: 'getData', value: function getData() { return this.typedArray[GL_FLOAT]; } // Get offset and data for one object (for bufferSubData) }, { key: 'getSubData', value: function getSubData(index) { var data = void 0; var offset = void 0; if (index === undefined) { data = this.data; offset = 0; } else { var begin = this.offsets[index]; var end = begin + this.sizes[index]; data = this.data.subarray(begin, end); offset = begin * 4; } return { data: data, offset: offset }; } // Set a map of values }, { key: 'setUniforms', value: function setUniforms(values) { for (var key in values) { this._setValue(key, values[key]); } return this; } }, { key: '_setValue', value: function _setValue(key, value) { var layout = this.layout[key]; __WEBPACK_IMPORTED_MODULE_0_assert___default()(layout, 'UniformLayoutStd140 illegal argument'); var typedArray = this.typedArray[layout.type]; if (layout.size === 1) { // single value -> just set it typedArray[layout.offset] = value; } else { // vector/matrix -> copy the supplied (typed) array, starting from offset typedArray.set(value, layout.offset); } } }, { key: '_addUniform', value: function _addUniform(key, uniformType) { var definition = UNIFORM_TYPES[uniformType]; __WEBPACK_IMPORTED_MODULE_0_assert___default()(definition, ERR_ARGUMENT); var _definition = _slicedToArray(definition, 2), type = _definition[0], count = _definition[1]; // Get the current offset and calculate the next offset based on aligned size of this element var offset = this.size; // First, align (bump) current offset to an even multiple of current object (1, 2, 4) this.size = this._alignTo(this.size, count); // Then, add our object's padded size ((1, 2, multiple of 4) to the current offset this.size += count; this.layout[key] = { type: type, size: count, offset: offset }; } // Align offset to 1, 2 or 4 elements (4, 8 or 16 bytes) }, { key: '_alignTo', value: function _alignTo(size, count) { switch (count) { case 1: return size; // Pad upwards to even multiple of 2 case 2: return size + size % 2; // Pad upwards to even multiple of 2 default: return size + (4 - size % 4) % 4; // Pad upwards to even multiple of 4 } } }]); return UniformBufferLayout; }(); /* harmony default export */ __webpack_exports__["a"] = (UniformBufferLayout); //# sourceMappingURL=uniform-buffer-layout.js.map /***/ }), /* 670 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__math_array__ = __webpack_require__(112); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__common__ = __webpack_require__(31); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__matrix4__ = __webpack_require__(278); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__quaternion__ = __webpack_require__(279); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__vector3__ = __webpack_require__(113); var _createClass=function(){function defineProperties(target,props){for(var descriptor,i=0;ivalue}function checkOrder(value){if(0>value&&6<=value)throw new Error(ERR_UNKNOWN_ORDER);return value}var Euler=function(_MathArray){function Euler(){var x=0i;++i)this[i]=array[i];return this[3]=_NumberisFinite(array[3])||this.order,this.check(),this}},{key:'set',value:function set(){var x=0 0 && arguments[0] !== undefined ? arguments[0] : null; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, EventManager); this.options = options; this.eventHandlers = []; this._onBasicInput = this._onBasicInput.bind(this); this._onOtherEvent = this._onOtherEvent.bind(this); this.setElement(element); // Register all passed events. var events = options.events; if (events) { this.on(events); } } _createClass(EventManager, [{ key: 'setElement', value: function setElement(element) { var _this = this; if (this.element) { // unregister all events this.destroy(); } this.element = element; if (!element) { return; } var options = this.options; var ManagerClass = options.Manager || __WEBPACK_IMPORTED_MODULE_0__utils_hammer__["a" /* Manager */]; this.manager = new ManagerClass(element, { recognizers: options.recognizers || __WEBPACK_IMPORTED_MODULE_4__constants__["a" /* RECOGNIZERS */] }).on('hammer.input', this._onBasicInput); if (!options.recognizers) { // Set default recognize withs // http://hammerjs.github.io/recognize-with/ Object.keys(__WEBPACK_IMPORTED_MODULE_4__constants__["b" /* RECOGNIZER_COMPATIBLE_MAP */]).forEach(function (name) { var recognizer = _this.manager.get(name); if (recognizer) { __WEBPACK_IMPORTED_MODULE_4__constants__["b" /* RECOGNIZER_COMPATIBLE_MAP */][name].forEach(function (otherName) { recognizer.recognizeWith(otherName); }); } }); } // Handle events not handled by Hammer.js: // - mouse wheel // - pointer/touch/mouse move this.wheelInput = new __WEBPACK_IMPORTED_MODULE_1__inputs_wheel_input__["a" /* default */](element, this._onOtherEvent, { enable: false }); this.moveInput = new __WEBPACK_IMPORTED_MODULE_2__inputs_move_input__["a" /* default */](element, this._onOtherEvent, { enable: false }); this.keyInput = new __WEBPACK_IMPORTED_MODULE_3__inputs_key_input__["a" /* default */](element, this._onOtherEvent, { enable: false }); if (options.rightButton) { // Block right click element.addEventListener('contextmenu', preventDefault); } // Register all existing events this.eventHandlers.forEach(function (_ref) { var recognizerName = _ref.recognizerName, eventAlias = _ref.eventAlias, wrappedHandler = _ref.wrappedHandler; // Enable recognizer for this event. _this._toggleRecognizer(recognizerName, true); _this.manager.on(eventAlias, wrappedHandler); }); } // Tear down internal event management implementations. }, { key: 'destroy', value: function destroy() { if (this.element) { this.element.removeEventListener('contextmenu', preventDefault); // wheelInput etc. are created in setElement() and therefore // cannot exist if there is no element this.wheelInput.destroy(); this.moveInput.destroy(); this.keyInput.destroy(); this.manager.destroy(); this.wheelInput = null; this.moveInput = null; this.keyInput = null; this.manager = null; this.element = null; } } // Register an event handler function to be called on `event`. }, { key: 'on', value: function on(event, handler, srcElement) { if (typeof event === 'string') { this._addEventHandler(event, handler, srcElement); } else { srcElement = handler; // If `event` is a map, call `on()` for each entry. for (var eventName in event) { this._addEventHandler(eventName, event[eventName], srcElement); } } } /** * Deregister a previously-registered event handler. * @param {string|Object} event An event name (String) or map of event names to handlers * @param {Function} [handler] The function to be called on `event`. */ }, { key: 'off', value: function off(event, handler) { if (typeof event === 'string') { this._removeEventHandler(event, handler); } else { // If `event` is a map, call `off()` for each entry. for (var eventName in event) { this._removeEventHandler(eventName, event[eventName]); } } } /* * Enable/disable recognizer for the given event */ }, { key: '_toggleRecognizer', value: function _toggleRecognizer(name, enabled) { var manager = this.manager; if (!manager) { return; } var recognizer = manager.get(name); if (recognizer) { recognizer.set({ enable: enabled }); var fallbackRecognizers = __WEBPACK_IMPORTED_MODULE_4__constants__["c" /* RECOGNIZER_FALLBACK_MAP */][name]; if (fallbackRecognizers && !this.options.recognizers) { // Set default require failures // http://hammerjs.github.io/require-failure/ fallbackRecognizers.forEach(function (otherName) { var otherRecognizer = manager.get(otherName); if (enabled) { // Wait for this recognizer to fail otherRecognizer.requireFailure(name); } else { // Do not wait for this recognizer to fail otherRecognizer.dropRequireFailure(name); } }); } } this.wheelInput.enableEventType(name, enabled); this.moveInput.enableEventType(name, enabled); this.keyInput.enableEventType(name, enabled); } /** * Process the event registration for a single event + handler. */ }, { key: '_addEventHandler', value: function _addEventHandler(event, handler) { var srcElement = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; var manager = this.manager, eventHandlers = this.eventHandlers; var wrappedHandler = this._wrapEventHandler(event, handler, srcElement); // Alias to a recognized gesture as necessary. var eventAlias = __WEBPACK_IMPORTED_MODULE_4__constants__["d" /* GESTURE_EVENT_ALIASES */][event] || event; // Get recognizer for this event var recognizerName = __WEBPACK_IMPORTED_MODULE_4__constants__["e" /* EVENT_RECOGNIZER_MAP */][eventAlias] || eventAlias; // Enable recognizer for this event. this._toggleRecognizer(recognizerName, true); // Find ancestors var ancestorEventHandlers = eventHandlers.filter(function (entry) { return entry.eventAlias === eventAlias && entry.srcElement !== srcElement && (!entry.srcElement || entry.srcElement.contains(srcElement)); }); // Save wrapped handler eventHandlers.push({ event: event, eventAlias: eventAlias, recognizerName: recognizerName, srcElement: srcElement, handler: handler, wrappedHandler: wrappedHandler }); // Sort handlers by DOM hierarchy // So the event will always fire first on child nodes ancestorEventHandlers.forEach(function (entry) { return manager.off(eventAlias, entry.wrappedHandler); }); if (manager) { manager.on(eventAlias, wrappedHandler); } ancestorEventHandlers.forEach(function (entry) { return manager.on(eventAlias, entry.wrappedHandler); }); } /** * Process the event deregistration for a single event + handler. */ }, { key: '_removeEventHandler', value: function _removeEventHandler(event, handler) { var manager = this.manager, eventHandlers = this.eventHandlers; var eventHandlerRemoved = false; // Find saved handler if any. for (var i = eventHandlers.length; i--;) { var entry = eventHandlers[i]; if (entry.event === event && entry.handler === handler) { // Deregister event handler. if (manager) { manager.off(entry.eventAlias, entry.wrappedHandler); } // Delete saved handler eventHandlers.splice(i, 1); eventHandlerRemoved = true; } } if (eventHandlerRemoved) { // Alias to a recognized gesture as necessary. var eventAlias = __WEBPACK_IMPORTED_MODULE_4__constants__["d" /* GESTURE_EVENT_ALIASES */][event] || event; // Get recognizer for this event var recognizerName = __WEBPACK_IMPORTED_MODULE_4__constants__["e" /* EVENT_RECOGNIZER_MAP */][eventAlias] || eventAlias; // Disable recognizer if no more handlers are attached to its events var isRecognizerUsed = eventHandlers.find(function (entry) { return entry.recognizerName === recognizerName; }); if (!isRecognizerUsed) { this._toggleRecognizer(recognizerName, false); } } } /** * Returns an event handler that aliases events and add props before passing * to the real handler. */ }, { key: '_wrapEventHandler', value: function _wrapEventHandler(type, handler, srcElement) { var _this2 = this; return function (event) { var mjolnirEvent = event.mjolnirEvent; if (!mjolnirEvent) { mjolnirEvent = _this2._normalizeEvent(event); event.mjolnirEvent = mjolnirEvent; } var isStopped = mjolnirEvent.handled && mjolnirEvent.handled !== srcElement; if (!isStopped) { var isFromDecendant = !srcElement || srcElement.contains(event.srcEvent.target); if (isFromDecendant) { handler(Object.assign({}, mjolnirEvent, { type: type, stopPropagation: function stopPropagation() { if (!mjolnirEvent.handled) { mjolnirEvent.handled = srcElement; } } })); } } }; } /** * Normalizes hammerjs and custom events to have predictable fields. */ }, { key: '_normalizeEvent', value: function _normalizeEvent(event) { var element = this.element; return Object.assign({}, event, __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__utils_event_utils__["a" /* whichButtons */])(event), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_5__utils_event_utils__["b" /* getOffsetPosition */])(event, element), { handled: false, rootElement: element }); } /** * Handle basic events using the 'hammer.input' Hammer.js API: * Before running Recognizers, Hammer emits a 'hammer.input' event * with the basic event info. This function emits all basic events * aliased to the "class" of event received. * See constants.BASIC_EVENT_CLASSES basic event class definitions. */ }, { key: '_onBasicInput', value: function _onBasicInput(event) { var srcEvent = event.srcEvent; var alias = __WEBPACK_IMPORTED_MODULE_4__constants__["f" /* BASIC_EVENT_ALIASES */][srcEvent.type]; if (alias) { // fire all events aliased to srcEvent.type this.manager.emit(alias, event); } } /** * Handle events not supported by Hammer.js, * and pipe back out through same (Hammer) channel used by other events. */ }, { key: '_onOtherEvent', value: function _onOtherEvent(event) { this.manager.emit(event.type, event); } }]); return EventManager; }(); /* harmony default export */ __webpack_exports__["a"] = (EventManager); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ldmVudC1tYW5hZ2VyLmpzIl0sIm5hbWVzIjpbIk1hbmFnZXIiLCJXaGVlbElucHV0IiwiTW92ZUlucHV0IiwiS2V5SW5wdXQiLCJCQVNJQ19FVkVOVF9BTElBU0VTIiwiRVZFTlRfUkVDT0dOSVpFUl9NQVAiLCJHRVNUVVJFX0VWRU5UX0FMSUFTRVMiLCJSRUNPR05JWkVSUyIsIlJFQ09HTklaRVJfQ09NUEFUSUJMRV9NQVAiLCJSRUNPR05JWkV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GFsaWFzZWQgdG8gdGhlIFwiY2xhc3NcIiBvZiBldmVudCByZWNlaXZlZC5cbiAgICogU2VlIGNvbnN0YW50cy5CQVNJQ19FVkVOVF9DTEFTU0VTIGJhc2ljIGV2ZW50IGNsYXNzIGRlZmluaXRpb25zLlxuICAgKi9cbiAgX29uQmFzaWNJbnB1dChldmVudCkge1xuICAgIGNvbnN0IHtzcmNFdmVudH0gPSBldmVudDtcbiAgICBjb25zdCBhbGlhcyA9IEJBU0lDX0VWRU5UX0FMSUFTRVNbc3JjRXZlbnQudHlwZV07XG4gICAgaWYgKGFsaWFzKSB7XG4gICAgICAvLyBmaXJlIGFsbCBldmVudHMgYWxpYXNlZCB0byBzcmNFdmVudC50eXBlXG4gICAgICB0aGlzLm1hbmFnZXIuZW1pdChhbGlhcywgZXZlbnQpO1xuICAgIH1cbiAgfVxuXG4gIC8qKlxuICAgKiBIYW5kbGUgZXZlbnRzIG5vdCBzdXBwb3J0ZWQgYnkgSGFtbWVyLmpzLFxuICAgKiBhbmQgcGlwZSBiYWNrIG91dCB0aHJvdWdoIHNhbWUgKEhhbW1lcikgY2hhbm5lbCB1c2VkIGJ5IG90aGVyIGV2ZW50cy5cbiAgICovXG4gIF9vbk90aGVyRXZlbnQoZXZlbnQpIHtcbiAgICB0aGlzLm1hbmFnZXIuZW1pdChldmVudC50eXBlLCBldmVudCk7XG4gIH1cbn1cbiJdfQ== /***/ }), /* 673 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(114); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Copyright (c) 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var KEY_EVENTS = __WEBPACK_IMPORTED_MODULE_0__constants__["g" /* INPUT_EVENT_TYPES */].KEY_EVENTS; var DOWN_EVENT_TYPE = 'keydown'; var UP_EVENT_TYPE = 'keyup'; var KeyInput = function () { function KeyInput(element, callback) { var _this = this; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; _classCallCheck(this, KeyInput); this.element = element; this.callback = callback; this.options = Object.assign({ enable: true }, options); this.enableDownEvent = this.options.enable; this.enableUpEvent = this.options.enable; this.events = KEY_EVENTS.concat(options.events || []); this.handleEvent = this.handleEvent.bind(this); element.tabIndex = 1; element.style.outline = 'none'; this.events.forEach(function (event) { return element.addEventListener(event, _this.handleEvent); }); } _createClass(KeyInput, [{ key: 'destroy', value: function destroy() { var _this2 = this; this.events.forEach(function (event) { return _this2.element.removeEventListener(event, _this2.handleEvent); }); } /** * Enable this input (begin processing events) * if the specified event type is among those handled by this input. */ }, { key: 'enableEventType', value: function enableEventType(eventType, enabled) { if (eventType === DOWN_EVENT_TYPE) { this.enableDownEvent = enabled; } if (eventType === UP_EVENT_TYPE) { this.enableUpEvent = enabled; } } }, { key: 'handleEvent', value: function handleEvent(event) { // Ignore if focused on text input var targetElement = event.target || event.srcElement; if (targetElement.tagName === 'INPUT' && targetElement.type === 'text' || targetElement.tagName === 'TEXTAREA') { return; } if (this.enableDownEvent && event.type === 'keydown') { this.callback({ type: DOWN_EVENT_TYPE, srcEvent: event, key: event.key, target: event.target }); } if (this.enableUpEvent && event.type === 'keyup') { this.callback({ type: UP_EVENT_TYPE, srcEvent: event, key: event.key, target: event.target }); } } }]); return KeyInput; }(); /* harmony default export */ __webpack_exports__["a"] = (KeyInput); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbnB1dHMva2V5LWlucHV0LmpzIl0sIm5hbWVzIjpbIklOUFVUX0VWRU5UX1RZUEVTIiwiS0VZX0VWRU5UUyIsIkRPV05fRVZFTlRfVFlQRSIsIlVQX0VWRU5UX1RZUEUiLCJLZXlJbnB1dCIsImVsZW1lbnQiLCJjYWxsYmFjayIsIm9wdGlvbnMiLCJPYmplY3QiLCJhc3NpZ24iLCJlbmFibGUiLCJlbmFibGVEb3duRXZlbnQiLCJlbmFibGVVcEV2ZW50IiwiZXZlbnRzIiwiY29uY2F0IiwiaGFuZGxlRXZlbnQiLCJiaW5kIiwidGFiSW5kZXgiLCJzdHlsZSIsIm91dGxpbmUiLCJmb3JFYWNoIiwiYWRkRXZlbnRMaXN0ZW5lciIsImV2ZW50IiwicmVtb3ZlRXZlbnRMaXN0ZW5lciIsImV2ZW50VHlwZSIsImVuYWJsZWQiLCJ0YXJnZXRFbGVtZW50IiwidGFyZ2V0Iiwic3JjRWxlbWVudCIsInRhZ05hbWUiLCJ0eXBlIiwic3JjRXZlbnQiLCJrZXk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ZXZlbnQudGFyZ2V0XG4gICAgICB9KTtcbiAgICB9XG4gIH1cbn1cbiJdfQ== /***/ }), /* 674 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(114); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Copyright (c) 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var MOUSE_EVENTS = __WEBPACK_IMPORTED_MODULE_0__constants__["g" /* INPUT_EVENT_TYPES */].MOUSE_EVENTS; var MOVE_EVENT_TYPE = 'pointermove'; var LEAVE_EVENT_TYPE = 'pointerleave'; /** * Hammer.js swallows 'move' events (for pointer/touch/mouse) * when the pointer is not down. This class sets up a handler * specifically for these events to work around this limitation. * Note that this could be extended to more intelligently handle * move events across input types, e.g. storing multiple simultaneous * pointer/touch events, calculating speed/direction, etc. */ var MoveInput = function () { function MoveInput(element, callback) { var _this = this; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; _classCallCheck(this, MoveInput); this.element = element; this.callback = callback; this.pressed = false; this.options = Object.assign({ enable: true }, options); this.enableMoveEvent = this.options.enable; this.enableLeaveEvent = this.options.enable; this.events = MOUSE_EVENTS.concat(options.events || []); this.handleEvent = this.handleEvent.bind(this); this.events.forEach(function (event) { return element.addEventListener(event, _this.handleEvent); }); } _createClass(MoveInput, [{ key: 'destroy', value: function destroy() { var _this2 = this; this.events.forEach(function (event) { return _this2.element.removeEventListener(event, _this2.handleEvent); }); } /** * Enable this input (begin processing events) * if the specified event type is among those handled by this input. */ }, { key: 'enableEventType', value: function enableEventType(eventType, enabled) { if (eventType === MOVE_EVENT_TYPE) { this.enableMoveEvent = enabled; } if (eventType === LEAVE_EVENT_TYPE) { this.enableLeaveEvent = enabled; } } }, { key: 'handleEvent', value: function handleEvent(event) { if (this.enableLeaveEvent) { if (event.type === 'mouseleave') { this.callback({ type: LEAVE_EVENT_TYPE, srcEvent: event, pointerType: 'mouse', target: event.target }); } } if (this.enableMoveEvent) { switch (event.type) { case 'mousedown': if (event.button >= 0) { // Button is down this.pressed = true; } break; case 'mousemove': // Move events use `which` to track the button being pressed if (event.which === 0) { // Button is not down this.pressed = false; } if (!this.pressed) { // Drag events are emitted by hammer already // we just need to emit the move event on hover this.callback({ type: MOVE_EVENT_TYPE, srcEvent: event, pointerType: 'mouse', target: event.target }); } break; case 'mouseup': this.pressed = false; break; default: } } } }]); return MoveInput; }(); /* harmony default export */ __webpack_exports__["a"] = (MoveInput); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozL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XZlbnRzIHVzZSBgd2hpY2hgIHRvIHRyYWNrIHRoZSBidXR0b24gYmVpbmcgcHJlc3NlZFxuICAgICAgICBpZiAoZXZlbnQud2hpY2ggPT09IDApIHtcbiAgICAgICAgICAvLyBCdXR0b24gaXMgbm90IGRvd25cbiAgICAgICAgICB0aGlzLnByZXNzZWQgPSBmYWxzZTtcbiAgICAgICAgfVxuICAgICAgICBpZiAoIXRoaXMucHJlc3NlZCkge1xuICAgICAgICAgIC8vIERyYWcgZXZlbnRzIGFyZSBlbWl0dGVkIGJ5IGhhbW1lciBhbHJlYWR5XG4gICAgICAgICAgLy8gd2UganVzdCBuZWVkIHRvIGVtaXQgdGhlIG1vdmUgZXZlbnQgb24gaG92ZXJcbiAgICAgICAgICB0aGlzLmNhbGxiYWNrKHtcbiAgICAgICAgICAgIHR5cGU6IE1PVkVfRVZFTlRfVFlQRSxcbiAgICAgICAgICAgIHNyY0V2ZW50OiBldmVudCxcbiAgICAgICAgICAgIHBvaW50ZXJUeXBlOiAnbW91c2UnLFxuICAgICAgICAgICAgdGFyZ2V0OiBldmVudC50YXJnZXRcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBicmVhaztcbiAgICAgIGNhc2UgJ21vdXNldXAnOlxuICAgICAgICB0aGlzLnByZXNzZWQgPSBmYWxzZTtcbiAgICAgICAgYnJlYWs7XG4gICAgICBkZWZhdWx0OlxuICAgICAgfVxuICAgIH1cblxuICB9XG59XG4iXX0= /***/ }), /* 675 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__constants__ = __webpack_require__(114); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_globals__ = __webpack_require__(282); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__utils_globals___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1__utils_globals__); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // Copyright (c) 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var firefox = __WEBPACK_IMPORTED_MODULE_1__utils_globals__["userAgent"].indexOf('firefox') !== -1; var WHEEL_EVENTS = __WEBPACK_IMPORTED_MODULE_0__constants__["g" /* INPUT_EVENT_TYPES */].WHEEL_EVENTS; var EVENT_TYPE = 'wheel'; // Constants for normalizing input delta var WHEEL_DELTA_MAGIC_SCALER = 4.000244140625; var WHEEL_DELTA_PER_LINE = 40; var TRACKPAD_MAX_DELTA = 4; var TRACKPAD_MAX_DELTA_PER_TIME = 200; // Slow down zoom if shift key is held for more precise zooming var SHIFT_MULTIPLIER = 0.25; var WheelInput = function () { function WheelInput(element, callback) { var _this = this; var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; _classCallCheck(this, WheelInput); this.element = element; this.callback = callback; this.options = Object.assign({ enable: true }, options); this.time = 0; this.wheelPosition = null; this.type = null; this.timeout = null; this.lastValue = 0; this.events = WHEEL_EVENTS.concat(options.events || []); this.handleEvent = this.handleEvent.bind(this); this.events.forEach(function (event) { return element.addEventListener(event, _this.handleEvent); }); } _createClass(WheelInput, [{ key: 'destroy', value: function destroy() { var _this2 = this; this.events.forEach(function (event) { return _this2.element.removeEventListener(event, _this2.handleEvent); }); } /** * Enable this input (begin processing events) * if the specified event type is among those handled by this input. */ }, { key: 'enableEventType', value: function enableEventType(eventType, enabled) { if (eventType === EVENT_TYPE) { this.options.enable = enabled; } } /* eslint-disable complexity, max-statements */ }, { key: 'handleEvent', value: function handleEvent(event) { if (!this.options.enable) { return; } event.preventDefault(); var value = event.deltaY; if (__WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].WheelEvent) { // Firefox doubles the values on retina screens... if (firefox && event.deltaMode === __WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].WheelEvent.DOM_DELTA_PIXEL) { value /= __WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].devicePixelRatio; } if (event.deltaMode === __WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].WheelEvent.DOM_DELTA_LINE) { value *= WHEEL_DELTA_PER_LINE; } } var type = this.type, timeout = this.timeout, lastValue = this.lastValue, time = this.time; var now = (__WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"] && __WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].performance || Date).now(); var timeDelta = now - (time || 0); this.wheelPosition = { x: event.clientX, y: event.clientY }; time = now; if (value !== 0 && value % WHEEL_DELTA_MAGIC_SCALER === 0) { // This one is definitely a mouse wheel event. type = 'wheel'; // Normalize this value to match trackpad. value = Math.floor(value / WHEEL_DELTA_MAGIC_SCALER); } else if (value !== 0 && Math.abs(value) < TRACKPAD_MAX_DELTA) { // This one is definitely a trackpad event because it is so small. type = 'trackpad'; } else if (timeDelta > 400) { // This is likely a new scroll action. type = null; lastValue = value; // Start a timeout in case this was a singular event, // and delay it by up to 40ms. timeout = __WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].setTimeout(function setTimeout() { this._onWheel(event, -lastValue, this.wheelPosition); type = 'wheel'; }.bind(this), 40); } else if (!type) { // This is a repeating event, but we don't know the type of event just yet. // If the delta per time is small, we assume it's a fast trackpad; // otherwise we switch into wheel mode. type = Math.abs(timeDelta * value) < TRACKPAD_MAX_DELTA_PER_TIME ? 'trackpad' : 'wheel'; // Make sure our delayed event isn't fired again, because we accumulate // the previous event (which was less than 40ms ago) into this event. if (timeout) { __WEBPACK_IMPORTED_MODULE_1__utils_globals__["window"].clearTimeout(timeout); timeout = null; value += lastValue; } } if (event.shiftKey && value) { value = value * SHIFT_MULTIPLIER; } // Only fire the callback if we actually know // what type of scrolling device the user uses. if (type) { this._onWheel(event, -value, this.wheelPosition); } } }, { key: '_onWheel', value: function _onWheel(srcEvent, delta, position) { this.callback({ type: EVENT_TYPE, center: position, delta: delta, srcEvent: srcEvent, pointerType: 'mouse', target: srcEvent.target }); } }]); return WheelInput; }(); /* harmony default export */ __webpack_exports__["a"] = (WheelInput); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9pbnB1dHMvd2hlZWwtaW5wdXQuanMiXSwibmFtZXMiOlsiSU5QVVRfRVZFTlRfVFlQRVMiLCJ3aW5kb3ciLCJ1c2VyQWdlbnQiLCJmaXJlZm94IiwiaW5kZXhPZiIsIldIRUVMX0VWRU5UUyIsIkVWRU5UX1RZUEUiLCJXSEVFTF9ERUxUQV9NQUdJQ19TQ0FMRVIiLCJXSEVFTF9ERUxUQV9QRVJfTElORSIsIlRSQUNLUEFEX01BWF9ERUxUQSIsIlRSQUNLUEFEX01BW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VhbGx5IGtub3dcbiAgICAvLyB3aGF0IHR5cGUgb2Ygc2Nyb2xsaW5nIGRldmljZSB0aGUgdXNlciB1c2VzLlxuICAgIGlmICh0eXBlKSB7XG4gICAgICB0aGlzLl9vbldoZWVsKGV2ZW50LCAtdmFsdWUsIHRoaXMud2hlZWxQb3NpdGlvbik7XG4gICAgfVxuICB9XG5cbiAgX29uV2hlZWwoc3JjRXZlbnQsIGRlbHRhLCBwb3NpdGlvbikge1xuICAgIHRoaXMuY2FsbGJhY2soe1xuICAgICAgdHlwZTogRVZFTlRfVFlQRSxcbiAgICAgIGNlbnRlcjogcG9zaXRpb24sXG4gICAgICBkZWx0YSxcbiAgICAgIHNyY0V2ZW50LFxuICAgICAgcG9pbnRlclR5cGU6ICdtb3VzZScsXG4gICAgICB0YXJnZXQ6IHNyY0V2ZW50LnRhcmdldFxuICAgIH0pO1xuICB9XG59XG4iXX0= /***/ }), /* 676 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = whichButtons; /* harmony export (immutable) */ __webpack_exports__["b"] = getOffsetPosition; /* Constants */ var DOWN_EVENT = 1; var MOVE_EVENT = 2; var UP_EVENT = 4; var MOUSE_EVENTS = { pointerdown: DOWN_EVENT, pointermove: MOVE_EVENT, pointerup: UP_EVENT, mousedown: DOWN_EVENT, mousemove: MOVE_EVENT, mouseup: UP_EVENT }; // MouseEvent.which https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which var MOUSE_EVENT_WHICH_LEFT = 1; var MOUSE_EVENT_WHICH_MIDDLE = 2; var MOUSE_EVENT_WHICH_RIGHT = 3; // MouseEvent.button https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button var MOUSE_EVENT_BUTTON_LEFT = 0; var MOUSE_EVENT_BUTTON_MIDDLE = 1; var MOUSE_EVENT_BUTTON_RIGHT = 2; // MouseEvent.buttons https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons var MOUSE_EVENT_BUTTONS_LEFT_MASK = 1; var MOUSE_EVENT_BUTTONS_RIGHT_MASK = 2; var MOUSE_EVENT_BUTTONS_MIDDLE_MASK = 4; /** * Extract the involved mouse button */ function whichButtons(event) { var eventType = MOUSE_EVENTS[event.srcEvent.type]; if (!eventType) { // Not a mouse evet return null; } var _event$srcEvent = event.srcEvent, buttons = _event$srcEvent.buttons, button = _event$srcEvent.button, which = _event$srcEvent.which; var leftButton = false; var middleButton = false; var rightButton = false; if ( // button is up, need to find out which one was pressed before eventType === UP_EVENT || // moving but does not support `buttons` API eventType === MOVE_EVENT && !Number.isFinite(buttons)) { leftButton = which === MOUSE_EVENT_WHICH_LEFT; middleButton = which === MOUSE_EVENT_WHICH_MIDDLE; rightButton = which === MOUSE_EVENT_WHICH_RIGHT; } else if (eventType === MOVE_EVENT) { leftButton = Boolean(buttons & MOUSE_EVENT_BUTTONS_LEFT_MASK); middleButton = Boolean(buttons & MOUSE_EVENT_BUTTONS_MIDDLE_MASK); rightButton = Boolean(buttons & MOUSE_EVENT_BUTTONS_RIGHT_MASK); } else if (eventType === DOWN_EVENT) { leftButton = button === MOUSE_EVENT_BUTTON_LEFT; middleButton = button === MOUSE_EVENT_BUTTON_MIDDLE; rightButton = button === MOUSE_EVENT_BUTTON_RIGHT; } return { leftButton: leftButton, middleButton: middleButton, rightButton: rightButton }; } /** * Calculate event position relative to the root element */ function getOffsetPosition(event, rootElement) { var srcEvent = event.srcEvent; // `center` is a hammer.js event property if (!event.center && !Number.isFinite(srcEvent.clientX)) { // Not a gestural event return null; } var center = event.center || { x: srcEvent.clientX, y: srcEvent.clientY }; var rect = rootElement.getBoundingClientRect(); // Fix scale for map affected by a CSS transform. // See https://stackoverflow.com/a/26893663/3528533 var scaleX = rect.width / rootElement.offsetWidth; var scaleY = rect.height / rootElement.offsetHeight; // Calculate center relative to the root element var offsetCenter = { x: (center.x - rect.left - rootElement.clientLeft) / scaleX, y: (center.y - rect.top - rootElement.clientTop) / scaleY }; return { center: center, off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ZXJmbG93LmNvbS9hLzI2ODkzNjYzLzM1Mjg1MzNcbiAgY29uc3Qgc2NhbGVYID0gcmVjdC53aWR0aCAvIHJvb3RFbGVtZW50Lm9mZnNldFdpZHRoO1xuICBjb25zdCBzY2FsZVkgPSByZWN0LmhlaWdodCAvIHJvb3RFbGVtZW50Lm9mZnNldEhlaWdodDtcblxuICAvLyBDYWxjdWxhdGUgY2VudGVyIHJlbGF0aXZlIHRvIHRoZSByb290IGVsZW1lbnRcbiAgY29uc3Qgb2Zmc2V0Q2VudGVyID0ge1xuICAgIHg6IChjZW50ZXIueCAtIHJlY3QubGVmdCAtIHJvb3RFbGVtZW50LmNsaWVudExlZnQpIC8gc2NhbGVYLFxuICAgIHk6IChjZW50ZXIueSAtIHJlY3QudG9wIC0gcm9vdEVsZW1lbnQuY2xpZW50VG9wKSAvIHNjYWxlWVxuICB9O1xuXG4gIHJldHVybiB7Y2VudGVyLCBvZmZzZXRDZW50ZXJ9O1xufVxuIl19 /***/ }), /* 677 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = enhancePointerEventInput; /* harmony export (immutable) */ __webpack_exports__["b"] = enhanceMouseInput; /** * This file contains overrides the default * hammer.js functions to add our own utility */ /* Hammer.js constants */ var INPUT_START = 1; var INPUT_MOVE = 2; var INPUT_END = 4; var MOUSE_INPUT_MAP = { mousedown: INPUT_START, mousemove: INPUT_MOVE, mouseup: INPUT_END }; /** * Helper function that returns true if any element in an array meets given criteria. * Because older browsers do not support `Array.prototype.some` * @params array {Array} * @params predict {Function} */ function some(array, predict) { for (var i = 0; i < array.length; i++) { if (predict(array[i])) { return true; } } return false; } /* eslint-disable no-invalid-this */ function enhancePointerEventInput(PointerEventInput) { var oldHandler = PointerEventInput.prototype.handler; // overrides PointerEventInput.handler to accept right mouse button PointerEventInput.prototype.handler = function handler(ev) { var store = this.store; // Allow non-left mouse buttons through if (ev.button > 0) { if (!some(store, function (e) { return e.pointerId === ev.pointerId; })) { store.push(ev); } } oldHandler.call(this, ev); }; } // overrides MouseInput.handler to accept right mouse button function enhanceMouseInput(MouseInput) { MouseInput.prototype.handler = function handler(ev) { var eventType = MOUSE_INPUT_MAP[ev.type]; // on start we want to have the mouse button down if (eventType & INPUT_START && ev.button >= 0) { this.pressed = true; } if (eventType & INPUT_MOVE && ev.which === 0) { eventType = INPUT_END; } // mouse must be down if (!this.pressed) { return; } if (eventType & INPUT_END) { this.pressed = false; } this.callback(this.manager, eventType, { pointers: [ev], changedPointers: [ev], pointerType: 'mouse', srcEvent: ev }); }; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlscy9oYW1tZXItb3ZlcnJpZGVzLmpzIl0sIm5hbWVzIjpbIklOUFVUX1NUQVJUIiwiSU5QVVRfTU9WRSIsIklOUFVUX0VORCIsIk1PVVNFX0lOUFVUX01BUCIsIm1vdXNlZG93biIsIm1vdXNlbW92ZSIsIm1vdXNldXAiLCJzb21lIiwiYXJyYXkiLCJwcmVkaWN0IiwiaSIsImxlbmd0aCIsImVuaGFuY2VQb2ludGVyRXZlbnRJbnB1dCIsIlBvaW50ZXJFdmVudElucHV0Iiwib2xkSGFuZGxlciIsInByb3RvdHlwZSIsImhhbmRsZXIiLCJldiIsInN0b3JlIiwiYnV0dG9uIiwiZSIsInBvaW50ZXJJZCIsInB1c2giLCJjYWxsIiwiZW5oYW5jZU1vdXNlSW5wdXQiLCJNb3VzZUlucHV0IiwiZXZlbnRUeXBlIiwidHlwZSIsInByZXNzZWQiLCJ3aGljaCIsImNhbGxiYWNrIiwibWFuYWdlciIsInBvaW50ZXJzIiwiY2hhbmdlZFBvaW50ZXJzIiwicG9pbnRlclR5cGUiLCJzcmNFdmVudCJdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7O0FBS0E7QUFDQSxJQUFNQSxjQUFjLENBQXBCO0FBQ0EsSUFBTUMsYUFBY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RUeXBlICYgSU5QVVRfRU5EKSB7XG4gICAgICB0aGlzLnByZXNzZWQgPSBmYWxzZTtcbiAgICB9XG5cbiAgICB0aGlzLmNhbGxiYWNrKHRoaXMubWFuYWdlciwgZXZlbnRUeXBlLCB7XG4gICAgICBwb2ludGVyczogW2V2XSxcbiAgICAgIGNoYW5nZWRQb2ludGVyczogW2V2XSxcbiAgICAgIHBvaW50ZXJUeXBlOiAnbW91c2UnLFxuICAgICAgc3JjRXZlbnQ6IGV2XG4gICAgfSk7XG4gIH07XG59XG4iXX0= /***/ }), /* 678 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var emptyFunction = __webpack_require__(74); var invariant = __webpack_require__(101); var ReactPropTypesSecret = __webpack_require__(172); module.exports = function() { function shim(props, propName, componentName, location, propFullName, secret) { if (secret === ReactPropTypesSecret) { // It is still safe when called from React. return; } invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use PropTypes.checkPropTypes() to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); }; shim.isRequired = shim; function getShim() { return shim; }; // Important! // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. var ReactPropTypes = { array: shim, bool: shim, func: shim, number: shim, object: shim, string: shim, symbol: shim, any: shim, arrayOf: getShim, element: shim, instanceOf: getShim, node: shim, objectOf: getShim, oneOf: getShim, oneOfType: getShim, shape: getShim, exact: getShim }; ReactPropTypes.checkPropTypes = emptyFunction; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /***/ }), /* 679 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var emptyFunction = __webpack_require__(74); var invariant = __webpack_require__(101); var warning = __webpack_require__(155); var assign = __webpack_require__(171); var ReactPropTypesSecret = __webpack_require__(172); var checkPropTypes = __webpack_require__(284); module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. /** * Returns the iterator method function contained on the iterable object. * * Be sure to invoke the function with the iterable as context: * * var iteratorFn = getIteratorFn(myIterable); * if (iteratorFn) { * var iterator = iteratorFn.call(myIterable); * ... * } * * @param {?object} maybeIterable * @return {?function} */ function getIteratorFn(maybeIterable) { var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); if (typeof iteratorFn === 'function') { return iteratorFn; } } /** * Collection of methods that allow declaration and validation of props that are * supplied to React components. Example usage: * * var Props = require('ReactPropTypes'); * var MyArticle = React.createClass({ * propTypes: { * // An optional string prop named "description". * description: Props.string, * * // A required enum prop named "category". * category: Props.oneOf(['News','Photos']).isRequired, * * // A prop named "dialog" that requires an instance of Dialog. * dialog: Props.instanceOf(Dialog).isRequired * }, * render: function() { ... } * }); * * A more formal specification of how these methods are used: * * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) * decl := ReactPropTypes.{type}(.isRequired)? * * Each and every declaration produces a function with the same signature. This * allows the creation of custom validation functions. For example: * * var MyLink = React.createClass({ * propTypes: { * // An optional string or URI prop named "href". * href: function(props, propName, componentName) { * var propValue = props[propName]; * if (propValue != null && typeof propValue !== 'string' && * !(propValue instanceof URI)) { * return new Error( * 'Expected a string or an URI for ' + propName + ' in ' + * componentName * ); * } * } * }, * render: function() {...} * }); * * @internal */ var ANONYMOUS = '<>'; // Important! // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. var ReactPropTypes = { array: createPrimitiveTypeChecker('array'), bool: createPrimitiveTypeChecker('boolean'), func: createPrimitiveTypeChecker('function'), number: createPrimitiveTypeChecker('number'), object: createPrimitiveTypeChecker('object'), string: createPrimitiveTypeChecker('string'), symbol: createPrimitiveTypeChecker('symbol'), any: createAnyTypeChecker(), arrayOf: createArrayOfTypeChecker, element: createElementTypeChecker(), instanceOf: createInstanceTypeChecker, node: createNodeChecker(), objectOf: createObjectOfTypeChecker, oneOf: createEnumTypeChecker, oneOfType: createUnionTypeChecker, shape: createShapeTypeChecker, exact: createStrictShapeTypeChecker, }; /** * inlined Object.is polyfill to avoid requiring consumers ship their own * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is */ /*eslint-disable no-self-compare*/ function is(x, y) { // SameValue algorithm if (x === y) { // Steps 1-5, 7-10 // Steps 6.b-6.e: +0 != -0 return x !== 0 || 1 / x === 1 / y; } else { // Step 6.a: NaN == NaN return x !== x && y !== y; } } /*eslint-enable no-self-compare*/ /** * We use an Error-like object for backward compatibility as people may call * PropTypes directly and inspect their output. However, we don't use real * Errors anymore. We don't inspect their stack anyway, and creating them * is prohibitively expensive if they are created too often, such as what * happens in oneOfType() for any type before the one that matched. */ function PropTypeError(message) { this.message = message; this.stack = ''; } // Make `instanceof Error` still work for returned errors. PropTypeError.prototype = Error.prototype; function createChainableTypeChecker(validate) { if (process.env.NODE_ENV !== 'production') { var manualPropTypeCallCache = {}; var manualPropTypeWarningCount = 0; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; propFullName = propFullName || propName; if (secret !== ReactPropTypesSecret) { if (throwOnDirectAccess) { // New behavior only for users of `prop-types` package invariant( false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types' ); } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; if ( !manualPropTypeCallCache[cacheKey] && // Avoid spamming the console because they are often not actionable except for lib authors manualPropTypeWarningCount < 3 ) { warning( false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName ); manualPropTypeCallCache[cacheKey] = true; manualPropTypeWarningCount++; } } } if (props[propName] == null) { if (isRequired) { if (props[propName] === null) { return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); } return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); } return null; } else { return validate(props, propName, componentName, location, propFullName); } } var chainedCheckType = checkType.bind(null, false); chainedCheckType.isRequired = checkType.bind(null, true); return chainedCheckType; } function createPrimitiveTypeChecker(expectedType) { function validate(props, propName, componentName, location, propFullName, secret) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== expectedType) { // `propValue` being instance of, say, date/regexp, pass the 'object' // check, but we can offer a more precise error message here rather than // 'of type `object`'. var preciseType = getPreciseType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); } return null; } return createChainableTypeChecker(validate); } function createAnyTypeChecker() { return createChainableTypeChecker(emptyFunction.thatReturnsNull); } function createArrayOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); } var propValue = props[propName]; if (!Array.isArray(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); } for (var i = 0; i < propValue.length; i++) { var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); if (error instanceof Error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createElementTypeChecker() { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; if (!isValidElement(propValue)) { var propType = getPropType(propValue); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); } return null; } return createChainableTypeChecker(validate); } function createInstanceTypeChecker(expectedClass) { function validate(props, propName, componentName, location, propFullName) { if (!(props[propName] instanceof expectedClass)) { var expectedClassName = expectedClass.name || ANONYMOUS; var actualClassName = getClassName(props[propName]); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); } return null; } return createChainableTypeChecker(validate); } function createEnumTypeChecker(expectedValues) { if (!Array.isArray(expectedValues)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; for (var i = 0; i < expectedValues.length; i++) { if (is(propValue, expectedValues[i])) { return null; } } var valuesString = JSON.stringify(expectedValues); return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); } return createChainableTypeChecker(validate); } function createObjectOfTypeChecker(typeChecker) { function validate(props, propName, componentName, location, propFullName) { if (typeof typeChecker !== 'function') { return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); } var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); } for (var key in propValue) { if (propValue.hasOwnProperty(key)) { var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error instanceof Error) { return error; } } } return null; } return createChainableTypeChecker(validate); } function createUnionTypeChecker(arrayOfTypeCheckers) { if (!Array.isArray(arrayOfTypeCheckers)) { process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; return emptyFunction.thatReturnsNull; } for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (typeof checker !== 'function') { warning( false, 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i ); return emptyFunction.thatReturnsNull; } } function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { return null; } } return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); } return createChainableTypeChecker(validate); } function createNodeChecker() { function validate(props, propName, componentName, location, propFullName) { if (!isNode(props[propName])) { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); } return null; } return createChainableTypeChecker(validate); } function createShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); } for (var key in shapeTypes) { var checker = shapeTypes[key]; if (!checker) { continue; } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function createStrictShapeTypeChecker(shapeTypes) { function validate(props, propName, componentName, location, propFullName) { var propValue = props[propName]; var propType = getPropType(propValue); if (propType !== 'object') { return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); } // We need to check all keys in case some are required but missing from // props. var allKeys = assign({}, props[propName], shapeTypes); for (var key in allKeys) { var checker = shapeTypes[key]; if (!checker) { return new PropTypeError( 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') ); } var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); if (error) { return error; } } return null; } return createChainableTypeChecker(validate); } function isNode(propValue) { switch (typeof propValue) { case 'number': case 'string': case 'undefined': return true; case 'boolean': return !propValue; case 'object': if (Array.isArray(propValue)) { return propValue.every(isNode); } if (propValue === null || isValidElement(propValue)) { return true; } var iteratorFn = getIteratorFn(propValue); if (iteratorFn) { var iterator = iteratorFn.call(propValue); var step; if (iteratorFn !== propValue.entries) { while (!(step = iterator.next()).done) { if (!isNode(step.value)) { return false; } } } else { // Iterator will provide entry [k,v] tuples rather than values. while (!(step = iterator.next()).done) { var entry = step.value; if (entry) { if (!isNode(entry[1])) { return false; } } } } } else { return false; } return true; default: return false; } } function isSymbol(propType, propValue) { // Native Symbol. if (propType === 'symbol') { return true; } // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' if (propValue['@@toStringTag'] === 'Symbol') { return true; } // Fallback for non-spec compliant Symbols which are polyfilled. if (typeof Symbol === 'function' && propValue instanceof Symbol) { return true; } return false; } // Equivalent of `typeof` but with special handling for array and regexp. function getPropType(propValue) { var propType = typeof propValue; if (Array.isArray(propValue)) { return 'array'; } if (propValue instanceof RegExp) { // Old webkits (at least until Android 4.0) return 'function' rather than // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ // passes PropTypes.object. return 'object'; } if (isSymbol(propType, propValue)) { return 'symbol'; } return propType; } // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { if (typeof propValue === 'undefined' || propValue === null) { return '' + propValue; } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { return 'date'; } else if (propValue instanceof RegExp) { return 'regexp'; } } return propType; } // Returns a string that is postfixed to a warning about an invalid type. // For example, "undefined" or "of type array" function getPostfixForTypeWarning(value) { var type = getPreciseType(value); switch (type) { case 'array': case 'object': return 'an ' + type; case 'boolean': case 'date': case 'regexp': return 'a ' + type; default: return type; } } // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { return ANONYMOUS; } return propValue.constructor.name; } ReactPropTypes.checkPropTypes = checkPropTypes; ReactPropTypes.PropTypes = ReactPropTypes; return ReactPropTypes; }; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26))) /***/ }), /* 680 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.2.0 * react.development.js * * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ if (process.env.NODE_ENV !== "production") { (function() { 'use strict'; var _assign = __webpack_require__(171); var emptyObject = __webpack_require__(233); var invariant = __webpack_require__(101); var warning = __webpack_require__(155); var emptyFunction = __webpack_require__(74); var checkPropTypes = __webpack_require__(284); // TODO: this is special because it gets imported during build. var ReactVersion = '16.2.0'; // The Symbol used to tag the ReactElement-like types. If there is no native Symbol // nor polyfill, then a plain number is used for performance. var hasSymbol = typeof Symbol === 'function' && Symbol['for']; var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7; var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8; var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9; var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca; var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb; var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; var FAUX_ITERATOR_SYMBOL = '@@iterator'; function getIteratorFn(maybeIterable) { if (maybeIterable === null || typeof maybeIterable === 'undefined') { return null; } var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; if (typeof maybeIterator === 'function') { return maybeIterator; } return null; } /** * WARNING: DO NOT manually require this module. * This is a replacement for `invariant(...)` used by the error code system * and will _only_ be required by the corresponding babel pass. * It always throws. */ /** * Forked from fbjs/warning: * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js * * Only change is we use console.warn instead of console.error, * and do nothing when 'console' is not supported. * This really simplifies the code. * --- * Similar to invariant but only logs a warning if the condition is not met. * This can be used to log issues in development environments in critical * paths. Removing the logging code for production environments will keep the * same logic and follow the same code paths. */ var lowPriorityWarning = function () {}; { var printWarning = function (format) { for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } var argIndex = 0; var message = 'Warning: ' + format.replace(/%s/g, function () { return args[argIndex++]; }); if (typeof console !== 'undefined') { console.warn(message); } try { // --- Welcome to debugging React --- // This error was thrown as a convenience so that you can use this stack // to find the callsite that caused this warning to fire. throw new Error(message); } catch (x) {} }; lowPriorityWarning = function (condition, format) { if (format === undefined) { throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); } if (!condition) { for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { args[_key2 - 2] = arguments[_key2]; } printWarning.apply(undefined, [format].concat(args)); } }; } var lowPriorityWarning$1 = lowPriorityWarning; var didWarnStateUpdateForUnmountedComponent = {}; function warnNoop(publicInstance, callerName) { { var constructor = publicInstance.constructor; var componentName = constructor && (constructor.displayName || constructor.name) || 'ReactClass'; var warningKey = componentName + '.' + callerName; if (didWarnStateUpdateForUnmountedComponent[warningKey]) { return; } warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName); didWarnStateUpdateForUnmountedComponent[warningKey] = true; } } /** * This is the abstract API for an update queue. */ var ReactNoopUpdateQueue = { /** * Checks whether or not this composite component is mounted. * @param {ReactClass} publicInstance The instance we want to test. * @return {boolean} True if mounted, false otherwise. * @protected * @final */ isMounted: function (publicInstance) { return false; }, /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {?function} callback Called after component is updated. * @param {?string} callerName name of the calling function in the public API. * @internal */ enqueueForceUpdate: function (publicInstance, callback, callerName) { warnNoop(publicInstance, 'forceUpdate'); }, /** * Replaces all of the state. Always use this or `setState` to mutate state. * You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} completeState Next state. * @param {?function} callback Called after component is updated. * @param {?string} callerName name of the calling function in the public API. * @internal */ enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { warnNoop(publicInstance, 'replaceState'); }, /** * Sets a subset of the state. This only exists because _pendingState is * internal. This provides a merging strategy that is not available to deep * properties which is confusing. TODO: Expose pendingState or don't use it * during the merge. * * @param {ReactClass} publicInstance The instance that should rerender. * @param {object} partialState Next partial state to be merged with state. * @param {?function} callback Called after component is updated. * @param {?string} Name of the calling function in the public API. * @internal */ enqueueSetState: function (publicInstance, partialState, callback, callerName) { warnNoop(publicInstance, 'setState'); } }; /** * Base class helpers for the updating state of a component. */ function Component(props, context, updater) { this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; } Component.prototype.isReactComponent = {}; /** * Sets a subset of the state. Always use this to mutate * state. You should treat `this.state` as immutable. * * There is no guarantee that `this.state` will be immediately updated, so * accessing `this.state` after calling this method may return the old value. * * There is no guarantee that calls to `setState` will run synchronously, * as they may eventually be batched together. You can provide an optional * callback that will be executed when the call to setState is actually * completed. * * When a function is provided to setState, it will be called at some point in * the future (not synchronously). It will be called with the up to date * component arguments (state, props, context). These values can be different * from this.* because your function may be called after receiveProps but before * shouldComponentUpdate, and this new state, props, and context will not yet be * assigned to this. * * @param {object|function} partialState Next partial state or function to * produce next partial state to be merged with current state. * @param {?function} callback Called after state is updated. * @final * @protected */ Component.prototype.setState = function (partialState, callback) { !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0; this.updater.enqueueSetState(this, partialState, callback, 'setState'); }; /** * Forces an update. This should only be invoked when it is known with * certainty that we are **not** in a DOM transaction. * * You may want to call this when you know that some deeper aspect of the * component's state has changed but `setState` was not called. * * This will not invoke `shouldComponentUpdate`, but it will invoke * `componentWillUpdate` and `componentDidUpdate`. * * @param {?function} callback Called after update is complete. * @final * @protected */ Component.prototype.forceUpdate = function (callback) { this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); }; /** * Deprecated APIs. These APIs used to exist on classic React classes but since * we would like to deprecate them, we're not going to move them over to this * modern base class. Instead, we define a getter that warns if it's accessed. */ { var deprecatedAPIs = { isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] }; var defineDeprecationWarning = function (methodName, info) { Object.defineProperty(Component.prototype, methodName, { get: function () { lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); return undefined; } }); }; for (var fnName in deprecatedAPIs) { if (deprecatedAPIs.hasOwnProperty(fnName)) { defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); } } } /** * Base class helpers for the updating state of a component. */ function PureComponent(props, context, updater) { // Duplicated from Component. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; } function ComponentDummy() {} ComponentDummy.prototype = Component.prototype; var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. _assign(pureComponentPrototype, Component.prototype); pureComponentPrototype.isPureReactComponent = true; function AsyncComponent(props, context, updater) { // Duplicated from Component. this.props = props; this.context = context; this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the // renderer. this.updater = updater || ReactNoopUpdateQueue; } var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy(); asyncComponentPrototype.constructor = AsyncComponent; // Avoid an extra prototype jump for these methods. _assign(asyncComponentPrototype, Component.prototype); asyncComponentPrototype.unstable_isAsyncReactComponent = true; asyncComponentPrototype.render = function () { return this.props.children; }; /** * Keeps track of the current owner. * * The current owner is the component who should own any components that are * currently being constructed. */ var ReactCurrentOwner = { /** * @internal * @type {ReactComponent} */ current: null }; var hasOwnProperty = Object.prototype.hasOwnProperty; var RESERVED_PROPS = { key: true, ref: true, __self: true, __source: true }; var specialPropKeyWarningShown; var specialPropRefWarningShown; function hasValidRef(config) { { if (hasOwnProperty.call(config, 'ref')) { var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; if (getter && getter.isReactWarning) { return false; } } } return config.ref !== undefined; } function hasValidKey(config) { { if (hasOwnProperty.call(config, 'key')) { var getter = Object.getOwnPropertyDescriptor(config, 'key').get; if (getter && getter.isReactWarning) { return false; } } } return config.key !== undefined; } function defineKeyPropWarningGetter(props, displayName) { var warnAboutAccessingKey = function () { if (!specialPropKeyWarningShown) { specialPropKeyWarningShown = true; warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); } }; warnAboutAccessingKey.isReactWarning = true; Object.defineProperty(props, 'key', { get: warnAboutAccessingKey, configurable: true }); } function defineRefPropWarningGetter(props, displayName) { var warnAboutAccessingRef = function () { if (!specialPropRefWarningShown) { specialPropRefWarningShown = true; warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName); } }; warnAboutAccessingRef.isReactWarning = true; Object.defineProperty(props, 'ref', { get: warnAboutAccessingRef, configurable: true }); } /** * Factory method to create a new React element. This no longer adheres to * the class pattern, so do not use new to call it. Also, no instanceof check * will work. Instead test $$typeof field against Symbol.for('react.element') to check * if something is a React Element. * * @param {*} type * @param {*} key * @param {string|object} ref * @param {*} self A *temporary* helper to detect places where `this` is * different from the `owner` when React.createElement is called, so that we * can warn. We want to get rid of owner and replace string `ref`s with arrow * functions, and as long as `this` and owner are the same, there will be no * change in behavior. * @param {*} source An annotation object (added by a transpiler or otherwise) * indicating filename, line number, and/or other information. * @param {*} owner * @param {*} props * @internal */ var ReactElement = function (type, key, ref, self, source, owner, props) { var element = { // This tag allow us to uniquely identify this as a React Element $$typeof: REACT_ELEMENT_TYPE, // Built-in properties that belong on the element type: type, key: key, ref: ref, props: props, // Record the component responsible for creating this element. _owner: owner }; { // The validation flag is currently mutative. We put it on // an external backing store so that we can freeze the whole object. // This can be replaced with a WeakMap once they are implemented in // commonly used development environments. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make // the validation flag non-enumerable (where possible, which should // include every environment we run tests in), so the test framework // ignores it. Object.defineProperty(element._store, 'validated', { configurable: false, enumerable: false, writable: true, value: false }); // self and source are DEV only properties. Object.defineProperty(element, '_self', { configurable: false, enumerable: false, writable: false, value: self }); // Two elements created in two different places should be considered // equal for testing purposes and therefore we hide it from enumeration. Object.defineProperty(element, '_source', { configurable: false, enumerable: false, writable: false, value: source }); if (Object.freeze) { Object.freeze(element.props); Object.freeze(element); } } return element; }; /** * Create and return a new ReactElement of the given type. * See https://reactjs.org/docs/react-api.html#createelement */ function createElement(type, config, children) { var propName; // Reserved names are extracted var props = {}; var key = null; var ref = null; var self = null; var source = null; if (config != null) { if (hasValidRef(config)) { ref = config.ref; } if (hasValidKey(config)) { key = '' + config.key; } self = config.__self === undefined ? null : config.__self; source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { props[propName] = config[propName]; } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } { if (Object.freeze) { Object.freeze(childArray); } } props.children = childArray; } // Resolve default props if (type && type.defaultProps) { var defaultProps = type.defaultProps; for (propName in defaultProps) { if (props[propName] === undefined) { props[propName] = defaultProps[propName]; } } } { if (key || ref) { if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) { var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; if (key) { defineKeyPropWarningGetter(props, displayName); } if (ref) { defineRefPropWarningGetter(props, displayName); } } } } return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); } /** * Return a function that produces ReactElements of a given type. * See https://reactjs.org/docs/react-api.html#createfactory */ function cloneAndReplaceKey(oldElement, newKey) { var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); return newElement; } /** * Clone and return a new ReactElement using element as the starting point. * See https://reactjs.org/docs/react-api.html#cloneelement */ function cloneElement(element, config, children) { var propName; // Original props are copied var props = _assign({}, element.props); // Reserved names are extracted var key = element.key; var ref = element.ref; // Self is preserved since the owner is preserved. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a // transpiler, and the original source is probably a better indicator of the // true owner. var source = element._source; // Owner will be preserved, unless ref is overridden var owner = element._owner; if (config != null) { if (hasValidRef(config)) { // Silently steal the ref from the parent. ref = config.ref; owner = ReactCurrentOwner.current; } if (hasValidKey(config)) { key = '' + config.key; } // Remaining properties override existing props var defaultProps; if (element.type && element.type.defaultProps) { defaultProps = element.type.defaultProps; } for (propName in config) { if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { if (config[propName] === undefined && defaultProps !== undefined) { // Resolve default props props[propName] = defaultProps[propName]; } else { props[propName] = config[propName]; } } } } // Children can be more than one argument, and those are transferred onto // the newly allocated props object. var childrenLength = arguments.length - 2; if (childrenLength === 1) { props.children = children; } else if (childrenLength > 1) { var childArray = Array(childrenLength); for (var i = 0; i < childrenLength; i++) { childArray[i] = arguments[i + 2]; } props.children = childArray; } return ReactElement(element.type, key, ref, self, source, owner, props); } /** * Verifies the object is a ReactElement. * See https://reactjs.org/docs/react-api.html#isvalidelement * @param {?object} object * @return {boolean} True if `object` is a valid component. * @final */ function isValidElement(object) { return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; } var ReactDebugCurrentFrame = {}; { // Component that is being worked on ReactDebugCurrentFrame.getCurrentStack = null; ReactDebugCurrentFrame.getStackAddendum = function () { var impl = ReactDebugCurrentFrame.getCurrentStack; if (impl) { return impl(); } return null; }; } var SEPARATOR = '.'; var SUBSEPARATOR = ':'; /** * Escape and wrap key so it is safe to use as a reactid * * @param {string} key to be escaped. * @return {string} the escaped key. */ function escape(key) { var escapeRegex = /[=:]/g; var escaperLookup = { '=': '=0', ':': '=2' }; var escapedString = ('' + key).replace(escapeRegex, function (match) { return escaperLookup[match]; }); return '$' + escapedString; } /** * TODO: Test that a single child and an array with one item have the same key * pattern. */ var didWarnAboutMaps = false; var userProvidedKeyEscapeRegex = /\/+/g; function escapeUserProvidedKey(text) { return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/'); } var POOL_SIZE = 10; var traverseContextPool = []; function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) { if (traverseContextPool.length) { var traverseContext = traverseContextPool.pop(); traverseContext.result = mapResult; traverseContext.keyPrefix = keyPrefix; traverseContext.func = mapFunction; traverseContext.context = mapContext; traverseContext.count = 0; return traverseContext; } else { return { result: mapResult, keyPrefix: keyPrefix, func: mapFunction, context: mapContext, count: 0 }; } } function releaseTraverseContext(traverseContext) { traverseContext.result = null; traverseContext.keyPrefix = null; traverseContext.func = null; traverseContext.context = null; traverseContext.count = 0; if (traverseContextPool.length < POOL_SIZE) { traverseContextPool.push(traverseContext); } } /** * @param {?*} children Children tree container. * @param {!string} nameSoFar Name of the key path so far. * @param {!function} callback Callback to invoke with each child found. * @param {?*} traverseContext Used to pass information throughout the traversal * process. * @return {!number} The number of children in this subtree. */ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) { var type = typeof children; if (type === 'undefined' || type === 'boolean') { // All of the above are perceived as null. children = null; } var invokeCallback = false; if (children === null) { invokeCallback = true; } else { switch (type) { case 'string': case 'number': invokeCallback = true; break; case 'object': switch (children.$$typeof) { case REACT_ELEMENT_TYPE: case REACT_CALL_TYPE: case REACT_RETURN_TYPE: case REACT_PORTAL_TYPE: invokeCallback = true; } } } if (invokeCallback) { callback(traverseContext, children, // If it's the only child, treat the name as if it was wrapped in an array // so that it's consistent if the number of children grows. nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar); return 1; } var child; var nextName; var subtreeCount = 0; // Count of children found in the current subtree. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; if (Array.isArray(children)) { for (var i = 0; i < children.length; i++) { child = children[i]; nextName = nextNamePrefix + getComponentKey(child, i); subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); } } else { var iteratorFn = getIteratorFn(children); if (typeof iteratorFn === 'function') { { // Warn about using Maps as children if (iteratorFn === children.entries) { warning(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum()); didWarnAboutMaps = true; } } var iterator = iteratorFn.call(children); var step; var ii = 0; while (!(step = iterator.next()).done) { child = step.value; nextName = nextNamePrefix + getComponentKey(child, ii++); subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext); } } else if (type === 'object') { var addendum = ''; { addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum(); } var childrenString = '' + children; invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum); } } return subtreeCount; } /** * Traverses children that are typically specified as `props.children`, but * might also be specified through attributes: * * - `traverseAllChildren(this.props.children, ...)` * - `traverseAllChildren(this.props.leftPanelChildren, ...)` * * The `traverseContext` is an optional argument that is passed through the * entire traversal. It can be used to store accumulations or anything else that * the callback might find relevant. * * @param {?*} children Children tree object. * @param {!function} callback To invoke upon traversing each child. * @param {?*} traverseContext Context for traversal. * @return {!number} The number of children in this subtree. */ function traverseAllChildren(children, callback, traverseContext) { if (children == null) { return 0; } return traverseAllChildrenImpl(children, '', callback, traverseContext); } /** * Generate a key string that identifies a component within a set. * * @param {*} component A component that could contain a manual key. * @param {number} index Index that is used if a manual key is not provided. * @return {string} */ function getComponentKey(component, index) { // Do some typechecking here since we call this blindly. We want to ensure // that we don't block potential future ES APIs. if (typeof component === 'object' && component !== null && component.key != null) { // Explicit key return escape(component.key); } // Implicit key determined by the index in the set return index.toString(36); } function forEachSingleChild(bookKeeping, child, name) { var func = bookKeeping.func, context = bookKeeping.context; func.call(context, child, bookKeeping.count++); } /** * Iterates through children that are typically specified as `props.children`. * * See https://reactjs.org/docs/react-api.html#react.children.foreach * * The provided forEachFunc(child, index) will be called for each * leaf child. * * @param {?*} children Children tree container. * @param {function(*, int)} forEachFunc * @param {*} forEachContext Context for forEachContext. */ function forEachChildren(children, forEachFunc, forEachContext) { if (children == null) { return children; } var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext); traverseAllChildren(children, forEachSingleChild, traverseContext); releaseTraverseContext(traverseContext); } function mapSingleChildIntoContext(bookKeeping, child, childKey) { var result = bookKeeping.result, keyPrefix = bookKeeping.keyPrefix, func = bookKeeping.func, context = bookKeeping.context; var mappedChild = func.call(context, child, bookKeeping.count++); if (Array.isArray(mappedChild)) { mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument); } else if (mappedChild != null) { if (isValidElement(mappedChild)) { mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as // traverseAllChildren used to do for objects as children keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey); } result.push(mappedChild); } } function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) { var escapedPrefix = ''; if (prefix != null) { escapedPrefix = escapeUserProvidedKey(prefix) + '/'; } var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context); traverseAllChildren(children, mapSingleChildIntoContext, traverseContext); releaseTraverseContext(traverseContext); } /** * Maps children that are typically specified as `props.children`. * * See https://reactjs.org/docs/react-api.html#react.children.map * * The provided mapFunction(child, key, index) will be called for each * leaf child. * * @param {?*} children Children tree container. * @param {function(*, int)} func The map function. * @param {*} context Context for mapFunction. * @return {object} Object containing the ordered map of results. */ function mapChildren(children, func, context) { if (children == null) { return children; } var result = []; mapIntoWithKeyPrefixInternal(children, result, null, func, context); return result; } /** * Count the number of children that are typically specified as * `props.children`. * * See https://reactjs.org/docs/react-api.html#react.children.count * * @param {?*} children Children tree container. * @return {number} The number of children. */ function countChildren(children, context) { return traverseAllChildren(children, emptyFunction.thatReturnsNull, null); } /** * Flatten a children object (typically specified as `props.children`) and * return an array with appropriately re-keyed children. * * See https://reactjs.org/docs/react-api.html#react.children.toarray */ function toArray(children) { var result = []; mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument); return result; } /** * Returns the first child in a collection of children and verifies that there * is only one child in the collection. * * See https://reactjs.org/docs/react-api.html#react.children.only * * The current implementation of this function assumes that a single child gets * passed without a wrapper, but the purpose of this helper function is to * abstract away the particular structure of children. * * @param {?object} children Child collection structure. * @return {ReactElement} The first and only `ReactElement` contained in the * structure. */ function onlyChild(children) { !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0; return children; } var describeComponentFrame = function (name, source, ownerName) { return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : ''); }; function getComponentName(fiber) { var type = fiber.type; if (typeof type === 'string') { return type; } if (typeof type === 'function') { return type.displayName || type.name; } return null; } /** * ReactElementValidator provides a wrapper around a element factory * which validates the props passed to the element. This is intended to be * used only in DEV and could be replaced by a static type checker for languages * that support it. */ { var currentlyValidatingElement = null; var propTypesMisspellWarningShown = false; var getDisplayName = function (element) { if (element == null) { return '#empty'; } else if (typeof element === 'string' || typeof element === 'number') { return '#text'; } else if (typeof element.type === 'string') { return element.type; } else if (element.type === REACT_FRAGMENT_TYPE) { return 'React.Fragment'; } else { return element.type.displayName || element.type.name || 'Unknown'; } }; var getStackAddendum = function () { var stack = ''; if (currentlyValidatingElement) { var name = getDisplayName(currentlyValidatingElement); var owner = currentlyValidatingElement._owner; stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner)); } stack += ReactDebugCurrentFrame.getStackAddendum() || ''; return stack; }; var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]); } function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { var name = getComponentName(ReactCurrentOwner.current); if (name) { return '\n\nCheck the render method of `' + name + '`.'; } } return ''; } function getSourceInfoErrorAddendum(elementProps) { if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) { var source = elementProps.__source; var fileName = source.fileName.replace(/^.*[\\\/]/, ''); var lineNumber = source.lineNumber; return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; } return ''; } /** * Warn if there's no key explicitly set on dynamic arrays of children or * object keys are not valid. This allows us to keep track of children between * updates. */ var ownerHasKeyUseWarning = {}; function getCurrentComponentErrorInfo(parentType) { var info = getDeclarationErrorAddendum(); if (!info) { var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; if (parentName) { info = '\n\nCheck the top-level render call using <' + parentName + '>.'; } } return info; } /** * Warn if the element doesn't have an explicit key assigned to it. * This element is in an array. The array could grow and shrink or be * reordered. All children that haven't already been validated are required to * have a "key" property assigned to it. Error statuses are cached so a warning * will only be shown once. * * @internal * @param {ReactElement} element Element that requires a key. * @param {*} parentType element's parent's type. */ function validateExplicitKey(element, parentType) { if (!element._store || element._store.validated || element.key != null) { return; } element._store.validated = true; var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { return; } ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a // property, it may be the creator of the child that's responsible for // assigning it a key. var childOwner = ''; if (element && element._owner && element._owner !== ReactCurrentOwner.current) { // Give the component that originally created this child. childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.'; } currentlyValidatingElement = element; { warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum()); } currentlyValidatingElement = null; } /** * Ensure that every element either is passed in a static location, in an * array with an explicit keys property defined, or in an object literal * with valid key property. * * @internal * @param {ReactNode} node Statically passed child of any type. * @param {*} parentType node's parent's type. */ function validateChildKeys(node, parentType) { if (typeof node !== 'object') { return; } if (Array.isArray(node)) { for (var i = 0; i < node.length; i++) { var child = node[i]; if (isValidElement(child)) { validateExplicitKey(child, parentType); } } } else if (isValidElement(node)) { // This element was passed in a valid location. if (node._store) { node._store.validated = true; } } else if (node) { var iteratorFn = getIteratorFn(node); if (typeof iteratorFn === 'function') { // Entry iterators used to provide implicit keys, // but now we print a separate warning for them later. if (iteratorFn !== node.entries) { var iterator = iteratorFn.call(node); var step; while (!(step = iterator.next()).done) { if (isValidElement(step.value)) { validateExplicitKey(step.value, parentType); } } } } } } /** * Given an element, validate that its props follow the propTypes definition, * provided by the type. * * @param {ReactElement} element */ function validatePropTypes(element) { var componentClass = element.type; if (typeof componentClass !== 'function') { return; } var name = componentClass.displayName || componentClass.name; var propTypes = componentClass.propTypes; if (propTypes) { currentlyValidatingElement = element; checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum); currentlyValidatingElement = null; } else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) { propTypesMisspellWarningShown = true; warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown'); } if (typeof componentClass.getDefaultProps === 'function') { warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); } } /** * Given a fragment, validate that it can only be provided with fragment props * @param {ReactElement} fragment */ function validateFragmentProps(fragment) { currentlyValidatingElement = fragment; var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = Object.keys(fragment.props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; if (!VALID_FRAGMENT_PROPS.has(key)) { warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum()); break; } } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator['return']) { _iterator['return'](); } } finally { if (_didIteratorError) { throw _iteratorError; } } } if (fragment.ref !== null) { warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum()); } currentlyValidatingElement = null; } function createElementWithValidation(type, props, children) { var validType = typeof type === 'string' || typeof type === 'function' || typeof type === 'symbol' || typeof type === 'number'; // We warn in this case but don't throw. We expect the element creation to // succeed and there will likely be errors in render. if (!validType) { var info = ''; if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; } var sourceInfo = getSourceInfoErrorAddendum(props); if (sourceInfo) { info += sourceInfo; } else { info += getDeclarationErrorAddendum(); } info += getStackAddendum() || ''; warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info); } var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. // TODO: Drop this when these are no longer allowed as the type argument. if (element == null) { return element; } // Skip key warning if the type isn't valid since our key validation logic // doesn't expect a non-string/function type and can throw confusing errors. // We don't want exception behavior to differ between dev and prod. // (Rendering will throw with a helpful message and as soon as the type is // fixed, the key warnings will appear.) if (validType) { for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], type); } } if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) { validateFragmentProps(element); } else { validatePropTypes(element); } return element; } function createFactoryWithValidation(type) { var validatedFactory = createElementWithValidation.bind(null, type); // Legacy hook TODO: Warn if this is accessed validatedFactory.type = type; { Object.defineProperty(validatedFactory, 'type', { enumerable: false, get: function () { lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); Object.defineProperty(this, 'type', { value: type }); return type; } }); } return validatedFactory; } function cloneElementWithValidation(element, props, children) { var newElement = cloneElement.apply(this, arguments); for (var i = 2; i < arguments.length; i++) { validateChildKeys(arguments[i], newElement.type); } validatePropTypes(newElement); return newElement; } var React = { Children: { map: mapChildren, forEach: forEachChildren, count: countChildren, toArray: toArray, only: onlyChild }, Component: Component, PureComponent: PureComponent, unstable_AsyncComponent: AsyncComponent, Fragment: REACT_FRAGMENT_TYPE, createElement: createElementWithValidation, cloneElement: cloneElementWithValidation, createFactory: createFactoryWithValidation, isValidElement: isValidElement, version: ReactVersion, __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { ReactCurrentOwner: ReactCurrentOwner, // Used by renderers to avoid bundling object-assign twice in UMD bundles: assign: _assign } }; { _assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { // These should not be included in production. ReactDebugCurrentFrame: ReactDebugCurrentFrame, // Shim for React DOM 16.0.0 which still destructured (but not used) this. // TODO: remove in React 17.0. ReactComponentTreeHook: {} }); } var React$2 = Object.freeze({ default: React }); var React$3 = ( React$2 && React ) || React$2; // TODO: decide on the top-level export form. // This is hacky but makes it work with both Rollup and Jest. var react = React$3['default'] ? React$3['default'] : React$3; module.exports = react; })(); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(26))) /***/ }), /* 681 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /** @license React v16.2.0 * react.production.min.js * * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var m=__webpack_require__(171),n=__webpack_require__(233),p=__webpack_require__(74),q="function"===typeof Symbol&&Symbol["for"],r=q?Symbol["for"]("react.element"):60103,t=q?Symbol["for"]("react.call"):60104,u=q?Symbol["for"]("react.return"):60105,v=q?Symbol["for"]("react.portal"):60106,w=q?Symbol["for"]("react.fragment"):60107,x="function"===typeof Symbol&&Symbol.iterator; function y(a){for(var b=arguments.length-1,e="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,c=0;cM.length&&M.push(a)} function P(a,b,e,c){var d=typeof a;if("undefined"===d||"boolean"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case r:case t:case u:case v:g=!0}}if(g)return e(c,a,""===b?"."+Q(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var k=0;k= len) return x; switch (x) { case '%s': return String(args[i++]); case '%d': return Number(args[i++]); case '%j': try { return JSON.stringify(args[i++]); } catch (_) { return '[Circular]'; } default: return x; } }); for (var x = args[i]; i < len; x = args[++i]) { if (isNull(x) || !isObject(x)) { str += ' ' + x; } else { str += ' ' + inspect(x); } } return str; }; // Mark that a method should not be used. // Returns a modified function which warns once by default. // If --no-deprecation is set, then it is a no-op. exports.deprecate = function(fn, msg) { // Allow for deprecating things in the process of starting up. if (isUndefined(global.process)) { return function() { return exports.deprecate(fn, msg).apply(this, arguments); }; } if (process.noDeprecation === true) { return fn; } var warned = false; function deprecated() { if (!warned) { if (process.throwDeprecation) { throw new Error(msg); } else if (process.traceDeprecation) { console.trace(msg); } else { console.error(msg); } warned = true; } return fn.apply(this, arguments); } return deprecated; }; var debugs = {}; var debugEnviron; exports.debuglog = function(set) { if (isUndefined(debugEnviron)) debugEnviron = process.env.NODE_DEBUG || ''; set = set.toUpperCase(); if (!debugs[set]) { if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { var pid = process.pid; debugs[set] = function() { var msg = exports.format.apply(exports, arguments); console.error('%s %d: %s', set, pid, msg); }; } else { debugs[set] = function() {}; } } return debugs[set]; }; /** * Echos the value of a value. Trys to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. * @param {Object} opts Optional options object that alters the output. */ /* legacy: obj, showHidden, depth, colors*/ function inspect(obj, opts) { // default options var ctx = { seen: [], stylize: stylizeNoColor }; // legacy... if (arguments.length >= 3) ctx.depth = arguments[2]; if (arguments.length >= 4) ctx.colors = arguments[3]; if (isBoolean(opts)) { // legacy... ctx.showHidden = opts; } else if (opts) { // got an "options" object exports._extend(ctx, opts); } // set default options if (isUndefined(ctx.showHidden)) ctx.showHidden = false; if (isUndefined(ctx.depth)) ctx.depth = 2; if (isUndefined(ctx.colors)) ctx.colors = false; if (isUndefined(ctx.customInspect)) ctx.customInspect = true; if (ctx.colors) ctx.stylize = stylizeWithColor; return formatValue(ctx, obj, ctx.depth); } exports.inspect = inspect; // http://en.wikipedia.org/wiki/ANSI_escape_code#graphics inspect.colors = { 'bold' : [1, 22], 'italic' : [3, 23], 'underline' : [4, 24], 'inverse' : [7, 27], 'white' : [37, 39], 'grey' : [90, 39], 'black' : [30, 39], 'blue' : [34, 39], 'cyan' : [36, 39], 'green' : [32, 39], 'magenta' : [35, 39], 'red' : [31, 39], 'yellow' : [33, 39] }; // Don't use 'blue' not visible on cmd.exe inspect.styles = { 'special': 'cyan', 'number': 'yellow', 'boolean': 'yellow', 'undefined': 'grey', 'null': 'bold', 'string': 'green', 'date': 'magenta', // "name": intentionally not styling 'regexp': 'red' }; function stylizeWithColor(str, styleType) { var style = inspect.styles[styleType]; if (style) { return '\u001b[' + inspect.colors[style][0] + 'm' + str + '\u001b[' + inspect.colors[style][1] + 'm'; } else { return str; } } function stylizeNoColor(str, styleType) { return str; } function arrayToHash(array) { var hash = {}; array.forEach(function(val, idx) { hash[val] = true; }); return hash; } function formatValue(ctx, value, recurseTimes) { // Provide a hook for user-specified inspect functions. // Check that value is an object with an inspect function on it if (ctx.customInspect && value && isFunction(value.inspect) && // Filter out the util module, it's inspect function is special value.inspect !== exports.inspect && // Also filter out any prototype objects using the circular check. !(value.constructor && value.constructor.prototype === value)) { var ret = value.inspect(recurseTimes, ctx); if (!isString(ret)) { ret = formatValue(ctx, ret, recurseTimes); } return ret; } // Primitive types cannot have properties var primitive = formatPrimitive(ctx, value); if (primitive) { return primitive; } // Look up the keys of the object. var keys = Object.keys(value); var visibleKeys = arrayToHash(keys); if (ctx.showHidden) { keys = Object.getOwnPropertyNames(value); } // IE doesn't make error fields non-enumerable // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx if (isError(value) && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { return formatError(value); } // Some type of object without properties can be shortcutted. if (keys.length === 0) { if (isFunction(value)) { var name = value.name ? ': ' + value.name : ''; return ctx.stylize('[Function' + name + ']', 'special'); } if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } if (isDate(value)) { return ctx.stylize(Date.prototype.toString.call(value), 'date'); } if (isError(value)) { return formatError(value); } } var base = '', array = false, braces = ['{', '}']; // Make Array say that they are Array if (isArray(value)) { array = true; braces = ['[', ']']; } // Make functions say that they are functions if (isFunction(value)) { var n = value.name ? ': ' + value.name : ''; base = ' [Function' + n + ']'; } // Make RegExps say that they are RegExps if (isRegExp(value)) { base = ' ' + RegExp.prototype.toString.call(value); } // Make dates with properties first say the date if (isDate(value)) { base = ' ' + Date.prototype.toUTCString.call(value); } // Make error with message first say the error if (isError(value)) { base = ' ' + formatError(value); } if (keys.length === 0 && (!array || value.length == 0)) { return braces[0] + base + braces[1]; } if (recurseTimes < 0) { if (isRegExp(value)) { return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); } else { return ctx.stylize('[Object]', 'special'); } } ctx.seen.push(value); var output; if (array) { output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); } else { output = keys.map(function(key) { return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); }); } ctx.seen.pop(); return reduceToSingleString(output, base, braces); } function formatPrimitive(ctx, value) { if (isUndefined(value)) return ctx.stylize('undefined', 'undefined'); if (isString(value)) { var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') .replace(/'/g, "\\'") .replace(/\\"/g, '"') + '\''; return ctx.stylize(simple, 'string'); } if (isNumber(value)) return ctx.stylize('' + value, 'number'); if (isBoolean(value)) return ctx.stylize('' + value, 'boolean'); // For some reason typeof null is "object", so special case here. if (isNull(value)) return ctx.stylize('null', 'null'); } function formatError(value) { return '[' + Error.prototype.toString.call(value) + ']'; } function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { var output = []; for (var i = 0, l = value.length; i < l; ++i) { if (hasOwnProperty(value, String(i))) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true)); } else { output.push(''); } } keys.forEach(function(key) { if (!key.match(/^\d+$/)) { output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true)); } }); return output; } function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { var name, str, desc; desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; if (desc.get) { if (desc.set) { str = ctx.stylize('[Getter/Setter]', 'special'); } else { str = ctx.stylize('[Getter]', 'special'); } } else { if (desc.set) { str = ctx.stylize('[Setter]', 'special'); } } if (!hasOwnProperty(visibleKeys, key)) { name = '[' + key + ']'; } if (!str) { if (ctx.seen.indexOf(desc.value) < 0) { if (isNull(recurseTimes)) { str = formatValue(ctx, desc.value, null); } else { str = formatValue(ctx, desc.value, recurseTimes - 1); } if (str.indexOf('\n') > -1) { if (array) { str = str.split('\n').map(function(line) { return ' ' + line; }).join('\n').substr(2); } else { str = '\n' + str.split('\n').map(function(line) { return ' ' + line; }).join('\n'); } } } else { str = ctx.stylize('[Circular]', 'special'); } } if (isUndefined(name)) { if (array && key.match(/^\d+$/)) { return str; } name = JSON.stringify('' + key); if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { name = name.substr(1, name.length - 2); name = ctx.stylize(name, 'name'); } else { name = name.replace(/'/g, "\\'") .replace(/\\"/g, '"') .replace(/(^"|"$)/g, "'"); name = ctx.stylize(name, 'string'); } } return name + ': ' + str; } function reduceToSingleString(output, base, braces) { var numLinesEst = 0; var length = output.reduce(function(prev, cur) { numLinesEst++; if (cur.indexOf('\n') >= 0) numLinesEst++; return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; }, 0); if (length > 60) { return braces[0] + (base === '' ? '' : base + '\n ') + ' ' + output.join(',\n ') + ' ' + braces[1]; } return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; } // NOTE: These type checking functions intentionally don't use `instanceof` // because it is fragile and can be easily faked with `Object.create()`. function isArray(ar) { return Array.isArray(ar); } exports.isArray = isArray; function isBoolean(arg) { return typeof arg === 'boolean'; } exports.isBoolean = isBoolean; function isNull(arg) { return arg === null; } exports.isNull = isNull; function isNullOrUndefined(arg) { return arg == null; } exports.isNullOrUndefined = isNullOrUndefined; function isNumber(arg) { return typeof arg === 'number'; } exports.isNumber = isNumber; function isString(arg) { return typeof arg === 'string'; } exports.isString = isString; function isSymbol(arg) { return typeof arg === 'symbol'; } exports.isSymbol = isSymbol; function isUndefined(arg) { return arg === void 0; } exports.isUndefined = isUndefined; function isRegExp(re) { return isObject(re) && objectToString(re) === '[object RegExp]'; } exports.isRegExp = isRegExp; function isObject(arg) { return typeof arg === 'object' && arg !== null; } exports.isObject = isObject; function isDate(d) { return isObject(d) && objectToString(d) === '[object Date]'; } exports.isDate = isDate; function isError(e) { return isObject(e) && (objectToString(e) === '[object Error]' || e instanceof Error); } exports.isError = isError; function isFunction(arg) { return typeof arg === 'function'; } exports.isFunction = isFunction; function isPrimitive(arg) { return arg === null || typeof arg === 'boolean' || typeof arg === 'number' || typeof arg === 'string' || typeof arg === 'symbol' || // ES6 symbol typeof arg === 'undefined'; } exports.isPrimitive = isPrimitive; exports.isBuffer = __webpack_require__(683); function objectToString(o) { return Object.prototype.toString.call(o); } function pad(n) { return n < 10 ? '0' + n.toString(10) : n.toString(10); } var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; // 26 Feb 16:19:34 function timestamp() { var d = new Date(); var time = [pad(d.getHours()), pad(d.getMinutes()), pad(d.getSeconds())].join(':'); return [d.getDate(), months[d.getMonth()], time].join(' '); } // log is just a thin wrapper to console.log that prepends a timestamp exports.log = function() { console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); }; /** * Inherit the prototype methods from one constructor into another. * * The Function.prototype.inherits from lang.js rewritten as a standalone * function (not on Function.prototype). NOTE: If this file is to be loaded * during bootstrapping this function needs to be rewritten using some native * functions as prototype setup using normal JavaScript does not work as * expected during bootstrapping (see mirror.js in r114903). * * @param {function} ctor Constructor function which needs to inherit the * prototype. * @param {function} superCtor Constructor function to inherit prototype from. */ exports.inherits = __webpack_require__(682); exports._extend = function(origin, add) { // Don't do anything if add isn't an object if (!add || !isObject(add)) return origin; var keys = Object.keys(add); var i = keys.length; while (i--) { origin[keys[i]] = add[keys[i]]; } return origin; }; function hasOwnProperty(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(47), __webpack_require__(26))) /***/ }), /* 685 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = flyToViewport; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_math_gl__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_utils__ = __webpack_require__(118); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__ = __webpack_require__(80); var EPSILON = 0.01; var VIEWPORT_TRANSITION_PROPS = ['longitude', 'latitude', 'zoom']; /** * mapbox-gl-js flyTo : https://www.mapbox.com/mapbox-gl-js/api/#map#flyto. * It implements “Smooth and efficient zooming and panning.” algorithm by * "Jarke J. van Wijk and Wim A.A. Nuij" */ /* eslint-disable max-statements */ function flyToViewport(startProps, endProps, t) { // Equations from above paper are referred where needed. var viewport = {}; // TODO: add this as an option for applications. var rho = 1.414; var startZoom = startProps.zoom; var startCenter = [startProps.longitude, startProps.latitude]; var startScale = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["j" /* zoomToScale */])(startZoom); var endZoom = endProps.zoom; var endCenter = [endProps.longitude, endProps.latitude]; var scale = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["j" /* zoomToScale */])(endZoom - startZoom); var startCenterXY = new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Vector2"](__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["a" /* lngLatToWorld */])(startCenter, startScale)); var endCenterXY = new __WEBPACK_IMPORTED_MODULE_0_math_gl__["Vector2"](__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["a" /* lngLatToWorld */])(endCenter, startScale)); var uDelta = endCenterXY.subtract(startCenterXY); var w0 = Math.max(startProps.width, startProps.height); var w1 = w0 / scale; var u1 = Math.sqrt(uDelta.x * uDelta.x + uDelta.y * uDelta.y); // u0 is treated as '0' in Eq (9). // If change in center is too small, do linear interpolaiton. if (Math.abs(u1) < EPSILON) { var _iteratorNormalCompletion = true; var _didIteratorError = false; var _iteratorError = undefined; try { for (var _iterator = VIEWPORT_TRANSITION_PROPS[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { var key = _step.value; var startValue = startProps[key]; var endValue = endProps[key]; viewport[key] = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["c" /* lerp */])(startValue, endValue, t); } } catch (err) { _didIteratorError = true; _iteratorError = err; } finally { try { if (!_iteratorNormalCompletion && _iterator.return) { _iterator.return(); } } finally { if (_didIteratorError) { throw _iteratorError; } } } return viewport; } // Implement Equation (9) from above algorithm. var rho2 = rho * rho; var b0 = (w1 * w1 - w0 * w0 + rho2 * rho2 * u1 * u1) / (2 * w0 * rho2 * u1); var b1 = (w1 * w1 - w0 * w0 - rho2 * rho2 * u1 * u1) / (2 * w1 * rho2 * u1); var r0 = Math.log(Math.sqrt(b0 * b0 + 1) - b0); var r1 = Math.log(Math.sqrt(b1 * b1 + 1) - b1); var S = (r1 - r0) / rho; var s = t * S; var w = Math.cosh(r0) / Math.cosh(r0 + rho * s); var u = w0 * ((Math.cosh(r0) * Math.tanh(r0 + rho * s) - Math.sinh(r0)) / rho2) / u1; var scaleIncrement = 1 / w; // Using w method for scaling. var newZoom = startZoom + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["k" /* scaleToZoom */])(scaleIncrement); var newCenter = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["b" /* worldToLngLat */])(startCenterXY.add(uDelta.scale(u)).scale(scaleIncrement), __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["j" /* zoomToScale */])(newZoom)); viewport.longitude = newCenter[0]; viewport.latitude = newCenter[1]; viewport.zoom = newZoom; return viewport; } /* eslint-enable max-statements */ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9mbHktdG8tdmlld3BvcnQuanMiXSwibmFtZXMiOlsiVmVjdG9yMiIsImxlcnAiLCJzY2FsZVRvWm9vbSIsInpvb21Ub1NjYWxlIiwibG5nTGF0VG9Xb3JsZCIsIndvcmxkVG9MbmdMYXQiLCJFUFNJTE9OIiwiVklFV1BPUlRfVFJBTlNJVElPTl9QUk9QUyIsImZseVRvVmlld3BvcnQiLCJzdGFydFByb3BzIiwiZW5kUHJvcHMiLCJ0Iiwidmlld3BvcnQiLCJyaG8iLCJzdGFydFpvb20iLCJ6b29tIiwic3RhcnRDZW50ZXIiLCJsb25naXR1ZGUiLCJsYXRpdHVkZSIsInN0YXJ0U2NhbGUiLCJlbmRab29tIiwiZW5kQ2VudGVyIiwic2NhbGUiLCJzdGFydENlbnRlclhZIiwiZW5kQ2VudGVyWFkiLCJ1RGVsdGEiLCJzdWJ0cmFjdCIsIncwIiwiTWF0aCIsIm1heCIsIndpZHRoIiwiaGVpZ2h0IiwidzEiLCJ1MSIsInNxcnQiLCJ4IiwieSIsImFicyIsImtleSIsInN0YXJ0VmFsdWUiLCJlbmRWYWx1ZSIsInJobzIiLCJiMCIsImIxIiwicjAiLCJsb2ciLCJyMSIsIlMiLCJzIiwidyIsImNvc2giLCJ1IiwidGFuaCIsInNpbmgiLCJzY2FsZUluY3JlbWVudCIsIm5ld1pvb20iLCJuZXdDZW50ZXIiLCJhZGQiXSwibWFwcGluZ3MiOiJBQUFBLFNBQVFBLE9BQVIsUUFBc0IsU0FBdEI7QUFDQSxTQUFRQyxJQUFSLFFBQW1CLGNBQW5CO0FBQ0EsU0FDRUMsV0FERixFQUVFQyxXQUZGLEVBR0VDLGFBSEYsRU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LmNvc2gocjApICogTWF0aC50YW5oKHIwICsgcmhvICogcykgLSBNYXRoLnNpbmgocjApKSAvIHJobzIpIC8gdTE7XG5cbiAgY29uc3Qgc2NhbGVJbmNyZW1lbnQgPSAxIC8gdzsgLy8gVXNpbmcgdyBtZXRob2QgZm9yIHNjYWxpbmcuXG4gIGNvbnN0IG5ld1pvb20gPSBzdGFydFpvb20gKyBzY2FsZVRvWm9vbShzY2FsZUluY3JlbWVudCk7XG5cbiAgY29uc3QgbmV3Q2VudGVyID0gd29ybGRUb0xuZ0xhdChcbiAgICAoc3RhcnRDZW50ZXJYWS5hZGQodURlbHRhLnNjYWxlKHUpKSkuc2NhbGUoc2NhbGVJbmNyZW1lbnQpLFxuICAgIHpvb21Ub1NjYWxlKG5ld1pvb20pKTtcbiAgdmlld3BvcnQubG9uZ2l0dWRlID0gbmV3Q2VudGVyWzBdO1xuICB2aWV3cG9ydC5sYXRpdHVkZSA9IG5ld0NlbnRlclsxXTtcbiAgdmlld3BvcnQuem9vbSA9IG5ld1pvb207XG4gIHJldHVybiB2aWV3cG9ydDtcbn1cbi8qIGVzbGludC1lbmFibGUgbWF4LXN0YXRlbWVudHMgKi9cbiJdfQ== /***/ }), /* 686 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (immutable) */ __webpack_exports__["a"] = normalizeViewportProps; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__ = __webpack_require__(81); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_utils__ = __webpack_require__(118); // defined by mapbox-gl var MAX_LATITUDE = 85.05113; var MIN_LATITUDE = -85.05113; // Apply mathematical constraints to viewport props /* eslint-disable complexity */ function normalizeViewportProps(_ref) { var width = _ref.width, height = _ref.height, longitude = _ref.longitude, latitude = _ref.latitude, zoom = _ref.zoom, _ref$pitch = _ref.pitch, pitch = _ref$pitch === undefined ? 0 : _ref$pitch, _ref$bearing = _ref.bearing, bearing = _ref$bearing === undefined ? 0 : _ref$bearing; // Normalize degrees if (longitude < -180 || longitude > 180) { longitude = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["d" /* mod */])(longitude + 180, 360) - 180; } if (bearing < -180 || bearing > 180) { bearing = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["d" /* mod */])(bearing + 180, 360) - 180; } // Constrain zoom and shift center at low zoom levels var flatViewport = new __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__["a" /* default */]({ width: width, height: height, longitude: longitude, latitude: latitude, zoom: zoom }); var topY = flatViewport.project([longitude, MAX_LATITUDE])[1]; var bottomY = flatViewport.project([longitude, MIN_LATITUDE])[1]; var shiftY = 0; if (bottomY - topY < height) { // Map height must not be smaller than viewport height // Zoom out map to fit map height into viewport zoom += Math.log2(height / (bottomY - topY)); // Calculate top and bottom using new zoom flatViewport = new __WEBPACK_IMPORTED_MODULE_0__web_mercator_viewport__["a" /* default */]({ width: width, height: height, longitude: longitude, latitude: latitude, zoom: zoom }); topY = flatViewport.project([longitude, MAX_LATITUDE])[1]; bottomY = flatViewport.project([longitude, MIN_LATITUDE])[1]; } if (topY > 0) { // Compensate for white gap on top shiftY = topY; } else if (bottomY < height) { // Compensate for white gap on bottom shiftY = bottomY - height; } if (shiftY) { latitude = flatViewport.unproject([width / 2, height / 2 + shiftY])[1]; } return { width: width, height: height, longitude: longitude, latitude: latitude, zoom: zoom, pitch: pitch, bearing: bearing }; } //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9ub3JtYWxpemUtdmlld3BvcnQtcHJvcHMuanMiXSwibmFtZXMiOlsiV2ViTWVyY2F0b3JWaWV3cG9ydCIsIm1vZCIsIk1BWF9MQVRJVFVERSIsIk1JTl9MQVRJVFVERSIsIm5vcm1hbGl6ZVZpZXdwb3J0UHJvcHMiLCJ3aWR0aCIsImhlaWdodCIsImxvbmdpdHVkZSIsImxhdGl0dWRl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lbMV07XG4gIH1cbiAgaWYgKHRvcFkgPiAwKSB7XG4gICAgLy8gQ29tcGVuc2F0ZSBmb3Igd2hpdGUgZ2FwIG9uIHRvcFxuICAgIHNoaWZ0WSA9IHRvcFk7XG4gIH0gZWxzZSBpZiAoYm90dG9tWSA8IGhlaWdodCkge1xuICAgIC8vIENvbXBlbnNhdGUgZm9yIHdoaXRlIGdhcCBvbiBib3R0b21cbiAgICBzaGlmdFkgPSBib3R0b21ZIC0gaGVpZ2h0O1xuICB9XG4gIGlmIChzaGlmdFkpIHtcbiAgICBsYXRpdHVkZSA9IGZsYXRWaWV3cG9ydC51bnByb2plY3QoW3dpZHRoIC8gMiwgaGVpZ2h0IC8gMiArIHNoaWZ0WV0pWzFdO1xuICB9XG5cbiAgcmV0dXJuIHt3aWR0aCwgaGVpZ2h0LCBsb25naXR1ZGUsIGxhdGl0dWRlLCB6b29tLCBwaXRjaCwgYmVhcmluZ307XG59XG4iXX0= /***/ }), /* 687 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_math_gl__ = __webpack_require__(16); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__math_utils__ = __webpack_require__(118); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__ = __webpack_require__(80); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale__ = __webpack_require__(77); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate__ = __webpack_require__(78); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_gl_mat4_multiply__ = __webpack_require__(75); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_5_gl_mat4_multiply___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_5_gl_mat4_multiply__); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_gl_mat4_invert__ = __webpack_require__(156); /* harmony import */ var __WEBPACK_IMPORTED_MODULE_6_gl_mat4_invert___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_6_gl_mat4_invert__); var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }(); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } // View and Projection Matrix management /* eslint-disable camelcase */ var IDENTITY = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["a" /* createMat4 */])(); var Viewport = function () { /** * @classdesc * Manages coordinate system transformations for deck.gl. * * Note: The Viewport is immutable in the sense that it only has accessors. * A new viewport instance should be created if any parameters have changed. * * @class * @param {Object} opt - options * @param {Boolean} mercator=true - Whether to use mercator projection * * @param {Number} opt.width=1 - Width of "viewport" or window * @param {Number} opt.height=1 - Height of "viewport" or window * @param {Array} opt.center=[0, 0] - Center of viewport * [longitude, latitude] or [x, y] * @param {Number} opt.scale=1 - Either use scale or zoom * @param {Number} opt.pitch=0 - Camera angle in degrees (0 is straight down) * @param {Number} opt.bearing=0 - Map rotation in degrees (0 means north is up) * @param {Number} opt.altitude= - Altitude of camera in screen units * * Web mercator projection short-hand parameters * @param {Number} opt.latitude - Center of viewport on map (alternative to opt.center) * @param {Number} opt.longitude - Center of viewport on map (alternative to opt.center) * @param {Number} opt.zoom - Scale = Math.pow(2,zoom) on map (alternative to opt.scale) */ /* eslint-disable complexity */ function Viewport() { var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, width = _ref.width, height = _ref.height, _ref$viewMatrix = _ref.viewMatrix, viewMatrix = _ref$viewMatrix === undefined ? IDENTITY : _ref$viewMatrix, _ref$projectionMatrix = _ref.projectionMatrix, //iclient isGeographicCoordinateSystem=_ref.isGeographicCoordinateSystem, projectionMatrix = _ref$projectionMatrix === undefined ? IDENTITY : _ref$projectionMatrix; _classCallCheck(this, Viewport); // Silently allow apps to send in 0,0 this.width = width || 1; this.height = height || 1; this.scale = 1; this.viewMatrix = viewMatrix; this.projectionMatrix = projectionMatrix; this.isGeographicCoordinateSystem = isGeographicCoordinateSystem; // Note: As usual, matrix operations should be applied in "reverse" order // since vectors will be multiplied in from the right during transformation var vpm = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["a" /* createMat4 */])(); __WEBPACK_IMPORTED_MODULE_5_gl_mat4_multiply___default()(vpm, vpm, this.projectionMatrix); __WEBPACK_IMPORTED_MODULE_5_gl_mat4_multiply___default()(vpm, vpm, this.viewMatrix); this.viewProjectionMatrix = vpm; // Calculate matrices and scales needed for projection /** * Builds matrices that converts preprojected lngLats to screen pixels * and vice versa. * Note: Currently returns bottom-left coordinates! * Note: Starts with the GL projection matrix and adds steps to the * scale and translate that matrix onto the window. * Note: WebGL controls clip space to screen projection with gl.viewport * and does not need this step. */ var m = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["a" /* createMat4 */])(); // matrix for conversion from location to screen coordinates __WEBPACK_IMPORTED_MODULE_3_gl_mat4_scale___default()(m, m, [this.width / 2, -this.height / 2, 1]); __WEBPACK_IMPORTED_MODULE_4_gl_mat4_translate___default()(m, m, [1, -1, 0]); __WEBPACK_IMPORTED_MODULE_5_gl_mat4_multiply___default()(m, m, this.viewProjectionMatrix); var mInverse = __WEBPACK_IMPORTED_MODULE_6_gl_mat4_invert___default()(__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__math_utils__["a" /* createMat4 */])(), m); if (!mInverse) { throw new Error('Pixel project matrix not invertible'); } this.pixelProjectionMatrix = m; this.pixelUnprojectionMatrix = mInverse; // Bind methods for easy access this.equals = this.equals.bind(this); this.project = this.project.bind(this); this.unproject = this.unproject.bind(this); this.projectFlat = this.projectFlat.bind(this); this.unprojectFlat = this.unprojectFlat.bind(this); } /* eslint-enable complexity */ // Two viewports are equal if width and height are identical, and if // their view and projection matrices are (approximately) equal. _createClass(Viewport, [{ key: 'equals', value: function equals(viewport) { if (!(viewport instanceof Viewport)) { return false; } return viewport.width === this.width && viewport.height === this.height && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_math_gl__["equals"])(viewport.projectionMatrix, this.projectionMatrix) && __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0_math_gl__["equals"])(viewport.viewMatrix, this.viewMatrix); } /** * Projects xyz (possibly latitude and longitude) to pixel coordinates in window * using viewport projection parameters * - [longitude, latitude] to [x, y] * - [longitude, latitude, Z] => [x, y, z] * Note: By default, returns top-left coordinates for canvas/SVG type render * * @param {Array} lngLatZ - [lng, lat] or [lng, lat, Z] * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether projected coords are top left * @return {Array} - screen coordinates [x, y] or [x, y, z], z as pixel depth */ }, { key: 'project', value: function project(xyz) { debugger var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref2$topLeft = _ref2.topLeft, topLeft = _ref2$topLeft === undefined ? true : _ref2$topLeft; var _xyz = _slicedToArray(xyz, 3), x0 = _xyz[0], y0 = _xyz[1], z0 = _xyz[2]; var _projectFlat = this.projectFlat([x0, y0]), _projectFlat2 = _slicedToArray(_projectFlat, 2), X = _projectFlat2[0], Y = _projectFlat2[1]; var coord = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["c" /* worldToPixels */])([X, Y, z0], this.pixelProjectionMatrix); var _coord = _slicedToArray(coord, 2), x = _coord[0], y = _coord[1]; var y2 = topLeft ? y : this.height - y; return xyz.length === 2 ? [x, y2] : [x, y2, coord[2]]; } /** * Unproject pixel coordinates on screen onto world coordinates, * (possibly [lon, lat]) on map. * - [x, y] => [lng, lat] * - [x, y, z] => [lng, lat, Z] * @param {Array} xyz - screen coordinates, z as pixel depth * @param {Object} opts - options * @param {Object} opts.topLeft=true - Whether projected coords are top left * @param {Object} opts.targetZ=0 - If pixel depth is unknown, targetZ is used as * the elevation plane to unproject onto * @return {Array} - [lng, lat, Z] or [X, Y, Z] */ }, { key: 'unproject', value: function unproject(xyz) { debugger var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref3$topLeft = _ref3.topLeft, topLeft = _ref3$topLeft === undefined ? true : _ref3$topLeft, targetZ = _ref3.targetZ; var _xyz2 = _slicedToArray(xyz, 3), x = _xyz2[0], y = _xyz2[1], z = _xyz2[2]; var y2 = topLeft ? y : this.height - y; var coord = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_2__web_mercator_utils__["d" /* pixelsToWorld */])([x, y2, z], this.pixelUnprojectionMatrix, targetZ); var _unprojectFlat = this.unprojectFlat(coord), _unprojectFlat2 = _slicedToArray(_unprojectFlat, 2), X = _unprojectFlat2[0], Y = _unprojectFlat2[1]; if (Number.isFinite(z)) { // Has depth component return [X, Y, coord[2]]; } return Number.isFinite(targetZ) ? [X, Y, targetZ] : [X, Y]; } // NON_LINEAR PROJECTION HOOKS // Used for web meractor projection /** * Project map coordinates to world coordinates. * This should be overridden by each viewport that implements a specific * geographic projection. * @param {Array} xyz - map coordinates * @return {Array} [x,y,z] world coordinates. */ }, { key: 'projectFlat', value: function projectFlat(xyz) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return xyz; } /** * Project world coordinates to map coordinates. * This should be overridden by each viewport that implements a specific * geographic projection. * @param {Array} xyz - world coordinates * @return {Array} [x,y,z] map coordinates. */ }, { key: 'unprojectFlat', value: function unprojectFlat(xyz) { var scale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.scale; return xyz; } }]); return Viewport; }(); /* harmony default export */ __webpack_exports__["a"] = (Viewport); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy92aWV3cG9ydC5qcyJdLCJuYW1lcyI6WyJlcXVhbHMiLCJjcmVhdGVNYXQ0Iiwid29ybGRUb1BpeGVscyIsInBpeGVsc1RvV29ybGQiLCJtYXQ0X3NjYWxlIiwibWF0NF90cmFuc2xhdGUiLCJtYXQ0X211bHRpcGx5IiwibWF0NF9pbnZlcnQiLCJJREVOVElUWSIsIlZpZXdwb3J0Iiwid2lkdGgiLCJoZWlnaHQiLCJ2aWV3TWF0cml4IiwicHJvamVjdGlvbk1hdHJpeCIsInNjYWxlIiwidnBtIiwidmlld1Byb2plY3Rpb25NYXRyaXgiLCJtIiwibUludmVyc2UiLCJFcnJvciIsInBpeGVsUHJvamVjdGlvbk1hdHJpeCIsInBpeGVsVW5wcm9qZWN0aW9uTWF0cml4IiwiYmluZCIsInByb2plY3QiLCJ1bnByb2plY3QiLCJwcm9qZWN0RmxhdCIsInVucHJvamVjdEZsYXQiLCJ2aWV3cG9ydCIsInh5eiIsInRvcExlZnQiLCJ4MCIsInkwIiwiejAiLCJYIiwiWSIsImNvb3JkIiwieCIsInkiLCJ5MiIsImxlbmd0aCIsInRhcmdldFoiL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5cbiAgLy8gTk9OX0xJTkVBUiBQUk9KRUNUSU9OIEhPT0tTXG4gIC8vIFVzZWQgZm9yIHdlYiBtZXJhY3RvciBwcm9qZWN0aW9uXG5cbiAgLyoqXG4gICAqIFByb2plY3QgbWFwIGNvb3JkaW5hdGVzIHRvIHdvcmxkIGNvb3JkaW5hdGVzLlxuICAgKiBUaGlzIHNob3VsZCBiZSBvdmVycmlkZGVuIGJ5IGVhY2ggdmlld3BvcnQgdGhhdCBpbXBsZW1lbnRzIGEgc3BlY2lmaWNcbiAgICogZ2VvZ3JhcGhpYyBwcm9qZWN0aW9uLlxuICAgKiBAcGFyYW0ge0FycmF5fSB4eXogLSBtYXAgY29vcmRpbmF0ZXNcbiAgICogQHJldHVybiB7QXJyYXl9IFt4LHksel0gd29ybGQgY29vcmRpbmF0ZXMuXG4gICAqL1xuICBwcm9qZWN0RmxhdCh4eXosIHNjYWxlID0gdGhpcy5zY2FsZSkge1xuICAgIHJldHVybiB4eXo7XG4gIH1cblxuICAvKipcbiAgICogUHJvamVjdCB3b3JsZCBjb29yZGluYXRlcyB0byBtYXAgY29vcmRpbmF0ZXMuXG4gICAqIFRoaXMgc2hvdWxkIGJlIG92ZXJyaWRkZW4gYnkgZWFjaCB2aWV3cG9ydCB0aGF0IGltcGxlbWVudHMgYSBzcGVjaWZpY1xuICAgKiBnZW9ncmFwaGljIHByb2plY3Rpb24uXG4gICAqIEBwYXJhbSB7QXJyYXl9IHh5eiAtIHdvcmxkIGNvb3JkaW5hdGVzXG4gICAqIEByZXR1cm4ge0FycmF5fSBbeCx5LHpdIG1hcCBjb29yZGluYXRlcy5cbiAgICovXG4gIHVucHJvamVjdEZsYXQoeHl6LCBzY2FsZSA9IHRoaXMuc2NhbGUpIHtcbiAgICByZXR1cm4geHl6O1xuICB9XG5cbn1cbiJdfQ== /***/ }), /* 688 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global) {/* ** Copyright (c) 2012 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including ** without limitation the rights to use, copy, modify, merge, publish, ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: ** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. ** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ //Ported to node by Marcin Ignac on 2016-05-20 // Various functions for helping debug WebGL apps. WebGLDebugUtils = function() { var window //polyfill window in node if (typeof(window) == 'undefined') { window = global; } /** * Wrapped logging function. * @param {string} msg Message to log. */ var log = function(msg) { if (window.console && window.console.log) { window.console.log(msg); } }; /** * Wrapped error logging function. * @param {string} msg Message to log. */ var error = function(msg) { if (window.console && window.console.error) { window.console.error(msg); } else { log(msg); } }; /** * Which arguments are enums based on the number of arguments to the function. * So * 'texImage2D': { * 9: { 0:true, 2:true, 6:true, 7:true }, * 6: { 0:true, 2:true, 3:true, 4:true }, * }, * * means if there are 9 arguments then 6 and 7 are enums, if there are 6 * arguments 3 and 4 are enums * * @type {!Object.} */ var glValidEnumContexts = { // Generic setters and getters 'enable': {1: { 0:true }}, 'disable': {1: { 0:true }}, 'getParameter': {1: { 0:true }}, // Rendering 'drawArrays': {3:{ 0:true }}, 'drawElements': {4:{ 0:true, 2:true }}, // Shaders 'createShader': {1: { 0:true }}, 'getShaderParameter': {2: { 1:true }}, 'getProgramParameter': {2: { 1:true }}, 'getShaderPrecisionFormat': {2: { 0: true, 1:true }}, // Vertex attributes 'getVertexAttrib': {2: { 1:true }}, 'vertexAttribPointer': {6: { 2:true }}, // Textures 'bindTexture': {2: { 0:true }}, 'activeTexture': {1: { 0:true }}, 'getTexParameter': {2: { 0:true, 1:true }}, 'texParameterf': {3: { 0:true, 1:true }}, 'texParameteri': {3: { 0:true, 1:true, 2:true }}, // texImage2D and texSubImage2D are defined below with WebGL 2 entrypoints 'copyTexImage2D': {8: { 0:true, 2:true }}, 'copyTexSubImage2D': {8: { 0:true }}, 'generateMipmap': {1: { 0:true }}, // compressedTexImage2D and compressedTexSubImage2D are defined below with WebGL 2 entrypoints // Buffer objects 'bindBuffer': {2: { 0:true }}, // bufferData and bufferSubData are defined below with WebGL 2 entrypoints 'getBufferParameter': {2: { 0:true, 1:true }}, // Renderbuffers and framebuffers 'pixelStorei': {2: { 0:true, 1:true }}, // readPixels is defined below with WebGL 2 entrypoints 'bindRenderbuffer': {2: { 0:true }}, 'bindFramebuffer': {2: { 0:true }}, 'checkFramebufferStatus': {1: { 0:true }}, 'framebufferRenderbuffer': {4: { 0:true, 1:true, 2:true }}, 'framebufferTexture2D': {5: { 0:true, 1:true, 2:true }}, 'getFramebufferAttachmentParameter': {3: { 0:true, 1:true, 2:true }}, 'getRenderbufferParameter': {2: { 0:true, 1:true }}, 'renderbufferStorage': {4: { 0:true, 1:true }}, // Frame buffer operations (clear, blend, depth test, stencil) 'clear': {1: { 0: { 'enumBitwiseOr': ['COLOR_BUFFER_BIT', 'DEPTH_BUFFER_BIT', 'STENCIL_BUFFER_BIT'] }}}, 'depthFunc': {1: { 0:true }}, 'blendFunc': {2: { 0:true, 1:true }}, 'blendFuncSeparate': {4: { 0:true, 1:true, 2:true, 3:true }}, 'blendEquation': {1: { 0:true }}, 'blendEquationSeparate': {2: { 0:true, 1:true }}, 'stencilFunc': {3: { 0:true }}, 'stencilFuncSeparate': {4: { 0:true, 1:true }}, 'stencilMaskSeparate': {2: { 0:true }}, 'stencilOp': {3: { 0:true, 1:true, 2:true }}, 'stencilOpSeparate': {4: { 0:true, 1:true, 2:true, 3:true }}, // Culling 'cullFace': {1: { 0:true }}, 'frontFace': {1: { 0:true }}, // ANGLE_instanced_arrays extension 'drawArraysInstancedANGLE': {4: { 0:true }}, 'drawElementsInstancedANGLE': {5: { 0:true, 2:true }}, // EXT_blend_minmax extension 'blendEquationEXT': {1: { 0:true }}, // WebGL 2 Buffer objects 'bufferData': { 3: { 0:true, 2:true }, // WebGL 1 4: { 0:true, 2:true }, // WebGL 2 5: { 0:true, 2:true } // WebGL 2 }, 'bufferSubData': { 3: { 0:true }, // WebGL 1 4: { 0:true }, // WebGL 2 5: { 0:true } // WebGL 2 }, 'copyBufferSubData': {5: { 0:true, 1:true }}, 'getBufferSubData': {3: { 0:true }, 4: { 0:true }, 5: { 0:true }}, // WebGL 2 Framebuffer objects 'blitFramebuffer': {10: { 8: { 'enumBitwiseOr': ['COLOR_BUFFER_BIT', 'DEPTH_BUFFER_BIT', 'STENCIL_BUFFER_BIT'] }, 9:true }}, 'framebufferTextureLayer': {5: { 0:true, 1:true }}, 'invalidateFramebuffer': {2: { 0:true }}, 'invalidateSubFramebuffer': {6: { 0:true }}, 'readBuffer': {1: { 0:true }}, // WebGL 2 Renderbuffer objects 'getInternalformatParameter': {3: { 0:true, 1:true, 2:true }}, 'renderbufferStorageMultisample': {5: { 0:true, 2:true }}, // WebGL 2 Texture objects 'texStorage2D': {5: { 0:true, 2:true }}, 'texStorage3D': {6: { 0:true, 2:true }}, 'texImage2D': { 9: { 0:true, 2:true, 6:true, 7:true }, // WebGL 1 & 2 6: { 0:true, 2:true, 3:true, 4:true }, // WebGL 1 10: { 0:true, 2:true, 6:true, 7:true } // WebGL 2 }, 'texImage3D': { 10: { 0:true, 2:true, 7:true, 8:true }, 11: { 0:true, 2:true, 7:true, 8:true } }, 'texSubImage2D': { 9: { 0:true, 6:true, 7:true }, // WebGL 1 & 2 7: { 0:true, 4:true, 5:true }, // WebGL 1 10: { 0:true, 6:true, 7:true } // WebGL 2 }, 'texSubImage3D': { 11: { 0:true, 8:true, 9:true }, 12: { 0:true, 8:true, 9:true } }, 'copyTexSubImage3D': {9: { 0:true }}, 'compressedTexImage2D': { 7: { 0: true, 2:true }, // WebGL 1 & 2 8: { 0: true, 2:true }, // WebGL 2 9: { 0: true, 2:true } // WebGL 2 }, 'compressedTexImage3D': { 8: { 0: true, 2:true }, 9: { 0: true, 2:true }, 10: { 0: true, 2:true } }, 'compressedTexSubImage2D': { 8: { 0: true, 6:true }, // WebGL 1 & 2 9: { 0: true, 6:true }, // WebGL 2 10: { 0: true, 6:true } // WebGL 2 }, 'compressedTexSubImage3D': { 10: { 0: true, 8:true }, 11: { 0: true, 8:true }, 12: { 0: true, 8:true } }, // WebGL 2 Vertex attribs 'vertexAttribIPointer': {5: { 2:true }}, // WebGL 2 Writing to the drawing buffer 'drawArraysInstanced': {4: { 0:true }}, 'drawElementsInstanced': {5: { 0:true, 2:true }}, 'drawRangeElements': {6: { 0:true, 4:true }}, // WebGL 2 Reading back pixels 'readPixels': { 7: { 4:true, 5:true }, // WebGL 1 & 2 8: { 4:true, 5:true } // WebGL 2 }, // WebGL 2 Multiple Render Targets 'clearBufferfv': {3: { 0:true }, 4: { 0:true }}, 'clearBufferiv': {3: { 0:true }, 4: { 0:true }}, 'clearBufferuiv': {3: { 0:true }, 4: { 0:true }}, 'clearBufferfi': {4: { 0:true }}, // WebGL 2 Query objects 'beginQuery': {2: { 0:true }}, 'endQuery': {1: { 0:true }}, 'getQuery': {2: { 0:true, 1:true }}, 'getQueryParameter': {2: { 1:true }}, // WebGL 2 Sampler objects 'samplerParameteri': {3: { 1:true, 2:true }}, 'samplerParameterf': {3: { 1:true }}, 'getSamplerParameter': {2: { 1:true }}, // WebGL 2 Sync objects 'fenceSync': {2: { 0:true, 1: { 'enumBitwiseOr': [] } }}, 'clientWaitSync': {3: { 1: { 'enumBitwiseOr': ['SYNC_FLUSH_COMMANDS_BIT'] } }}, 'waitSync': {3: { 1: { 'enumBitwiseOr': [] } }}, 'getSyncParameter': {2: { 1:true }}, // WebGL 2 Transform Feedback 'bindTransformFeedback': {2: { 0:true }}, 'beginTransformFeedback': {1: { 0:true }}, 'transformFeedbackVaryings': {3: { 2:true }}, // WebGL2 Uniform Buffer Objects and Transform Feedback Buffers 'bindBufferBase': {3: { 0:true }}, 'bindBufferRange': {5: { 0:true }}, 'getIndexedParameter': {2: { 0:true }}, 'getActiveUniforms': {3: { 2:true }}, 'getActiveUniformBlockParameter': {3: { 2:true }} }; /** * Map of numbers to names. * @type {Object} */ var glEnums = null; /** * Map of names to numbers. * @type {Object} */ var enumStringToValue = null; /** * Initializes this module. Safe to call more than once. * @param {!WebGLRenderingContext} ctx A WebGL context. If * you have more than one context it doesn't matter which one * you pass in, it is only used to pull out constants. */ function init(ctx) { if (glEnums == null) { glEnums = { }; enumStringToValue = { }; for (var propertyName in ctx) { if (typeof ctx[propertyName] == 'number') { glEnums[ctx[propertyName]] = propertyName; enumStringToValue[propertyName] = ctx[propertyName]; } } } } /** * Checks the utils have been initialized. */ function checkInit() { if (glEnums == null) { throw 'WebGLDebugUtils.init(ctx) not called'; } } /** * Returns true or false if value matches any WebGL enum * @param {*} value Value to check if it might be an enum. * @return {boolean} True if value matches one of the WebGL defined enums */ function mightBeEnum(value) { checkInit(); return (glEnums[value] !== undefined); } /** * Gets an string version of an WebGL enum. * * Example: * var str = WebGLDebugUtil.glEnumToString(ctx.getError()); * * @param {number} value Value to return an enum for * @return {string} The string version of the enum. */ function glEnumToString(value) { checkInit(); var name = glEnums[value]; return (name !== undefined) ? ("gl." + name) : ("/*UNKNOWN WebGL ENUM*/ 0x" + value.toString(16) + ""); } /** * Returns the string version of a WebGL argument. * Attempts to convert enum arguments to strings. * @param {string} functionName the name of the WebGL function. * @param {number} numArgs the number of arguments passed to the function. * @param {number} argumentIndx the index of the argument. * @param {*} value The value of the argument. * @return {string} The value as a string. */ function glFunctionArgToString(functionName, numArgs, argumentIndex, value) { var funcInfo = glValidEnumContexts[functionName]; if (funcInfo !== undefined) { var funcInfo = funcInfo[numArgs]; if (funcInfo !== undefined) { if (funcInfo[argumentIndex]) { if (typeof funcInfo[argumentIndex] === 'object' && funcInfo[argumentIndex]['enumBitwiseOr'] !== undefined) { var enums = funcInfo[argumentIndex]['enumBitwiseOr']; var orResult = 0; var orEnums = []; for (var i = 0; i < enums.length; ++i) { var enumValue = enumStringToValue[enums[i]]; if ((value & enumValue) !== 0) { orResult |= enumValue; orEnums.push(glEnumToString(enumValue)); } } if (orResult === value) { return orEnums.join(' | '); } else { return glEnumToString(value); } } else { return glEnumToString(value); } } } } if (value === null) { return "null"; } else if (value === undefined) { return "undefined"; } else { return value.toString(); } } /** * Converts the arguments of a WebGL function to a string. * Attempts to convert enum arguments to strings. * * @param {string} functionName the name of the WebGL function. * @param {number} args The arguments. * @return {string} The arguments as a string. */ function glFunctionArgsToString(functionName, args) { // apparently we can't do args.join(","); var argStr = ""; var numArgs = args.length; for (var ii = 0; ii < numArgs; ++ii) { argStr += ((ii == 0) ? '' : ', ') + glFunctionArgToString(functionName, numArgs, ii, args[ii]); } return argStr; }; function makePropertyWrapper(wrapper, original, propertyName) { //log("wrap prop: " + propertyName); wrapper.__defineGetter__(propertyName, function() { return original[propertyName]; }); // TODO(gmane): this needs to handle properties that take more than // one value? wrapper.__defineSetter__(propertyName, function(value) { //log("set: " + propertyName); original[propertyName] = value; }); } // Makes a function that calls a function on another object. function makeFunctionWrapper(original, functionName) { //log("wrap fn: " + functionName); var f = original[functionName]; return function() { //log("call: " + functionName); var result = f.apply(original, arguments); return result; }; } /** * Given a WebGL context returns a wrapped context that calls * gl.getError after every command and calls a function if the * result is not gl.NO_ERROR. * * @param {!WebGLRenderingContext} ctx The webgl context to * wrap. * @param {!function(err, funcName, args): void} opt_onErrorFunc * The function to call when gl.getError returns an * error. If not specified the default function calls * console.log with a message. * @param {!function(funcName, args): void} opt_onFunc The * function to call when each webgl function is called. * You can use this to log all calls for example. * @param {!WebGLRenderingContext} opt_err_ctx The webgl context * to call getError on if different than ctx. */ function makeDebugContext(ctx, opt_onErrorFunc, opt_onFunc, opt_err_ctx) { opt_err_ctx = opt_err_ctx || ctx; init(ctx); opt_onErrorFunc = opt_onErrorFunc || function(err, functionName, args) { // apparently we can't do args.join(","); var argStr = ""; var numArgs = args.length; for (var ii = 0; ii < numArgs; ++ii) { argStr += ((ii == 0) ? '' : ', ') + glFunctionArgToString(functionName, numArgs, ii, args[ii]); } error("WebGL error "+ glEnumToString(err) + " in "+ functionName + "(" + argStr + ")"); }; // Holds booleans for each GL error so after we get the error ourselves // we can still return it to the client app. var glErrorShadow = { }; // Makes a function that calls a WebGL function and then calls getError. function makeErrorWrapper(ctx, functionName) { return function() { if (opt_onFunc) { opt_onFunc(functionName, arguments); } var result = ctx[functionName].apply(ctx, arguments); var err = opt_err_ctx.getError(); if (err != 0) { glErrorShadow[err] = true; opt_onErrorFunc(err, functionName, arguments); } return result; }; } // Make a an object that has a copy of every property of the WebGL context // but wraps all functions. var wrapper = {}; for (var propertyName in ctx) { if (typeof ctx[propertyName] == 'function') { if (propertyName != 'getExtension') { wrapper[propertyName] = makeErrorWrapper(ctx, propertyName); } else { var wrapped = makeErrorWrapper(ctx, propertyName); wrapper[propertyName] = function () { var result = wrapped.apply(ctx, arguments); if (!result) { return null; } return makeDebugContext(result, opt_onErrorFunc, opt_onFunc, opt_err_ctx); }; } } else { makePropertyWrapper(wrapper, ctx, propertyName); } } // Override the getError function with one that returns our saved results. wrapper.getError = function() { for (var err in glErrorShadow) { if (glErrorShadow.hasOwnProperty(err)) { if (glErrorShadow[err]) { glErrorShadow[err] = false; return err; } } } return ctx.NO_ERROR; }; return wrapper; } function resetToInitialState(ctx) { var isWebGL2RenderingContext = !!ctx.createTransformFeedback; if (isWebGL2RenderingContext) { ctx.bindVertexArray(null); } var numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS); var tmp = ctx.createBuffer(); ctx.bindBuffer(ctx.ARRAY_BUFFER, tmp); for (var ii = 0; ii < numAttribs; ++ii) { ctx.disableVertexAttribArray(ii); ctx.vertexAttribPointer(ii, 4, ctx.FLOAT, false, 0, 0); ctx.vertexAttrib1f(ii, 0); if (isWebGL2RenderingContext) { ctx.vertexAttribDivisor(ii, 0); } } ctx.deleteBuffer(tmp); var numTextureUnits = ctx.getParameter(ctx.MAX_TEXTURE_IMAGE_UNITS); for (var ii = 0; ii < numTextureUnits; ++ii) { ctx.activeTexture(ctx.TEXTURE0 + ii); ctx.bindTexture(ctx.TEXTURE_CUBE_MAP, null); ctx.bindTexture(ctx.TEXTURE_2D, null); if (isWebGL2RenderingContext) { ctx.bindTexture(ctx.TEXTURE_2D_ARRAY, null); ctx.bindTexture(ctx.TEXTURE_3D, null); ctx.bindSampler(ii, null); } } ctx.activeTexture(ctx.TEXTURE0); ctx.useProgram(null); ctx.bindBuffer(ctx.ARRAY_BUFFER, null); ctx.bindBuffer(ctx.ELEMENT_ARRAY_BUFFER, null); ctx.bindFramebuffer(ctx.FRAMEBUFFER, null); ctx.bindRenderbuffer(ctx.RENDERBUFFER, null); ctx.disable(ctx.BLEND); ctx.disable(ctx.CULL_FACE); ctx.disable(ctx.DEPTH_TEST); ctx.disable(ctx.DITHER); ctx.disable(ctx.SCISSOR_TEST); ctx.blendColor(0, 0, 0, 0); ctx.blendEquation(ctx.FUNC_ADD); ctx.blendFunc(ctx.ONE, ctx.ZERO); ctx.clearColor(0, 0, 0, 0); ctx.clearDepth(1); ctx.clearStencil(-1); ctx.colorMask(true, true, true, true); ctx.cullFace(ctx.BACK); ctx.depthFunc(ctx.LESS); ctx.depthMask(true); ctx.depthRange(0, 1); ctx.frontFace(ctx.CCW); ctx.hint(ctx.GENERATE_MIPMAP_HINT, ctx.DONT_CARE); ctx.lineWidth(1); ctx.pixelStorei(ctx.PACK_ALIGNMENT, 4); ctx.pixelStorei(ctx.UNPACK_ALIGNMENT, 4); ctx.pixelStorei(ctx.UNPACK_FLIP_Y_WEBGL, false); ctx.pixelStorei(ctx.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false); // TODO: Delete this IF. if (ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL) { ctx.pixelStorei(ctx.UNPACK_COLORSPACE_CONVERSION_WEBGL, ctx.BROWSER_DEFAULT_WEBGL); } ctx.polygonOffset(0, 0); ctx.sampleCoverage(1, false); ctx.scissor(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.stencilFunc(ctx.ALWAYS, 0, 0xFFFFFFFF); ctx.stencilMask(0xFFFFFFFF); ctx.stencilOp(ctx.KEEP, ctx.KEEP, ctx.KEEP); ctx.viewport(0, 0, ctx.canvas.width, ctx.canvas.height); ctx.clear(ctx.COLOR_BUFFER_BIT | ctx.DEPTH_BUFFER_BIT | ctx.STENCIL_BUFFER_BIT); if (isWebGL2RenderingContext) { ctx.drawBuffers([ctx.BACK]); ctx.readBuffer(ctx.BACK); ctx.bindBuffer(ctx.COPY_READ_BUFFER, null); ctx.bindBuffer(ctx.COPY_WRITE_BUFFER, null); ctx.bindBuffer(ctx.PIXEL_PACK_BUFFER, null); ctx.bindBuffer(ctx.PIXEL_UNPACK_BUFFER, null); var numTransformFeedbacks = ctx.getParameter(ctx.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS); for (var ii = 0; ii < numTransformFeedbacks; ++ii) { ctx.bindBufferBase(ctx.TRANSFORM_FEEDBACK_BUFFER, ii, null); } var numUBOs = ctx.getParameter(ctx.MAX_UNIFORM_BUFFER_BINDINGS); for (var ii = 0; ii < numUBOs; ++ii) { ctx.bindBufferBase(ctx.UNIFORM_BUFFER, ii, null); } ctx.disable(ctx.RASTERIZER_DISCARD); ctx.pixelStorei(ctx.UNPACK_IMAGE_HEIGHT, 0); ctx.pixelStorei(ctx.UNPACK_SKIP_IMAGES, 0); ctx.pixelStorei(ctx.UNPACK_ROW_LENGTH, 0); ctx.pixelStorei(ctx.UNPACK_SKIP_ROWS, 0); ctx.pixelStorei(ctx.UNPACK_SKIP_PIXELS, 0); ctx.pixelStorei(ctx.PACK_ROW_LENGTH, 0); ctx.pixelStorei(ctx.PACK_SKIP_ROWS, 0); ctx.pixelStorei(ctx.PACK_SKIP_PIXELS, 0); ctx.hint(ctx.FRAGMENT_SHADER_DERIVATIVE_HINT, ctx.DONT_CARE); } // TODO: This should NOT be needed but Firefox fails with 'hint' while(ctx.getError()); } function makeLostContextSimulatingCanvas(canvas) { var unwrappedContext_; var wrappedContext_; var onLost_ = []; var onRestored_ = []; var wrappedContext_ = {}; var contextId_ = 1; var contextLost_ = false; var resourceId_ = 0; var resourceDb_ = []; var numCallsToLoseContext_ = 0; var numCalls_ = 0; var canRestore_ = false; var restoreTimeout_ = 0; var isWebGL2RenderingContext; // Holds booleans for each GL error so can simulate errors. var glErrorShadow_ = { }; canvas.getContext = function(f) { return function() { var ctx = f.apply(canvas, arguments); // Did we get a context and is it a WebGL context? if ((ctx instanceof WebGLRenderingContext) || (window.WebGL2RenderingContext && (ctx instanceof WebGL2RenderingContext))) { if (ctx != unwrappedContext_) { if (unwrappedContext_) { throw "got different context" } isWebGL2RenderingContext = window.WebGL2RenderingContext && (ctx instanceof WebGL2RenderingContext); unwrappedContext_ = ctx; wrappedContext_ = makeLostContextSimulatingContext(unwrappedContext_); } return wrappedContext_; } return ctx; } }(canvas.getContext); function wrapEvent(listener) { if (typeof(listener) == "function") { return listener; } else { return function(info) { listener.handleEvent(info); } } } var addOnContextLostListener = function(listener) { onLost_.push(wrapEvent(listener)); }; var addOnContextRestoredListener = function(listener) { onRestored_.push(wrapEvent(listener)); }; function wrapAddEventListener(canvas) { var f = canvas.addEventListener; canvas.addEventListener = function(type, listener, bubble) { switch (type) { case 'webglcontextlost': addOnContextLostListener(listener); break; case 'webglcontextrestored': addOnContextRestoredListener(listener); break; default: f.apply(canvas, arguments); } }; } wrapAddEventListener(canvas); canvas.loseContext = function() { if (!contextLost_) { contextLost_ = true; numCallsToLoseContext_ = 0; ++contextId_; while (unwrappedContext_.getError()); clearErrors(); glErrorShadow_[unwrappedContext_.CONTEXT_LOST_WEBGL] = true; var event = makeWebGLContextEvent("context lost"); var callbacks = onLost_.slice(); setTimeout(function() { //log("numCallbacks:" + callbacks.length); for (var ii = 0; ii < callbacks.length; ++ii) { //log("calling callback:" + ii); callbacks[ii](event); } if (restoreTimeout_ >= 0) { setTimeout(function() { canvas.restoreContext(); }, restoreTimeout_); } }, 0); } }; canvas.restoreContext = function() { if (contextLost_) { if (onRestored_.length) { setTimeout(function() { if (!canRestore_) { throw "can not restore. webglcontestlost listener did not call event.preventDefault"; } freeResources(); resetToInitialState(unwrappedContext_); contextLost_ = false; numCalls_ = 0; canRestore_ = false; var callbacks = onRestored_.slice(); var event = makeWebGLContextEvent("context restored"); for (var ii = 0; ii < callbacks.length; ++ii) { callbacks[ii](event); } }, 0); } } }; canvas.loseContextInNCalls = function(numCalls) { if (contextLost_) { throw "You can not ask a lost contet to be lost"; } numCallsToLoseContext_ = numCalls_ + numCalls; }; canvas.getNumCalls = function() { return numCalls_; }; canvas.setRestoreTimeout = function(timeout) { restoreTimeout_ = timeout; }; function isWebGLObject(obj) { //return false; return (obj instanceof WebGLBuffer || obj instanceof WebGLFramebuffer || obj instanceof WebGLProgram || obj instanceof WebGLRenderbuffer || obj instanceof WebGLShader || obj instanceof WebGLTexture); } function checkResources(args) { for (var ii = 0; ii < args.length; ++ii) { var arg = args[ii]; if (isWebGLObject(arg)) { return arg.__webglDebugContextLostId__ == contextId_; } } return true; } function clearErrors() { var k = Object.keys(glErrorShadow_); for (var ii = 0; ii < k.length; ++ii) { delete glErrorShadow_[k[ii]]; } } function loseContextIfTime() { ++numCalls_; if (!contextLost_) { if (numCallsToLoseContext_ == numCalls_) { canvas.loseContext(); } } } // Makes a function that simulates WebGL when out of context. function makeLostContextFunctionWrapper(ctx, functionName) { var f = ctx[functionName]; return function() { // log("calling:" + functionName); // Only call the functions if the context is not lost. loseContextIfTime(); if (!contextLost_) { //if (!checkResources(arguments)) { // glErrorShadow_[wrappedContext_.INVALID_OPERATION] = true; // return; //} var result = f.apply(ctx, arguments); return result; } }; } function freeResources() { for (var ii = 0; ii < resourceDb_.length; ++ii) { var resource = resourceDb_[ii]; if (resource instanceof WebGLBuffer) { unwrappedContext_.deleteBuffer(resource); } else if (resource instanceof WebGLFramebuffer) { unwrappedContext_.deleteFramebuffer(resource); } else if (resource instanceof WebGLProgram) { unwrappedContext_.deleteProgram(resource); } else if (resource instanceof WebGLRenderbuffer) { unwrappedContext_.deleteRenderbuffer(resource); } else if (resource instanceof WebGLShader) { unwrappedContext_.deleteShader(resource); } else if (resource instanceof WebGLTexture) { unwrappedContext_.deleteTexture(resource); } else if (isWebGL2RenderingContext) { if (resource instanceof WebGLQuery) { unwrappedContext_.deleteQuery(resource); } else if (resource instanceof WebGLSampler) { unwrappedContext_.deleteSampler(resource); } else if (resource instanceof WebGLSync) { unwrappedContext_.deleteSync(resource); } else if (resource instanceof WebGLTransformFeedback) { unwrappedContext_.deleteTransformFeedback(resource); } else if (resource instanceof WebGLVertexArrayObject) { unwrappedContext_.deleteVertexArray(resource); } } } } function makeWebGLContextEvent(statusMessage) { return { statusMessage: statusMessage, preventDefault: function() { canRestore_ = true; } }; } return canvas; function makeLostContextSimulatingContext(ctx) { // copy all functions and properties to wrapper for (var propertyName in ctx) { if (typeof ctx[propertyName] == 'function') { wrappedContext_[propertyName] = makeLostContextFunctionWrapper( ctx, propertyName); } else { makePropertyWrapper(wrappedContext_, ctx, propertyName); } } // Wrap a few functions specially. wrappedContext_.getError = function() { loseContextIfTime(); if (!contextLost_) { var err; while (err = unwrappedContext_.getError()) { glErrorShadow_[err] = true; } } for (var err in glErrorShadow_) { if (glErrorShadow_[err]) { delete glErrorShadow_[err]; return err; } } return wrappedContext_.NO_ERROR; }; var creationFunctions = [ "createBuffer", "createFramebuffer", "createProgram", "createRenderbuffer", "createShader", "createTexture" ]; if (isWebGL2RenderingContext) { creationFunctions.push( "createQuery", "createSampler", "fenceSync", "createTransformFeedback", "createVertexArray" ); } for (var ii = 0; ii < creationFunctions.length; ++ii) { var functionName = creationFunctions[ii]; wrappedContext_[functionName] = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return null; } var obj = f.apply(ctx, arguments); obj.__webglDebugContextLostId__ = contextId_; resourceDb_.push(obj); return obj; }; }(ctx[functionName]); } var functionsThatShouldReturnNull = [ "getActiveAttrib", "getActiveUniform", "getBufferParameter", "getContextAttributes", "getAttachedShaders", "getFramebufferAttachmentParameter", "getParameter", "getProgramParameter", "getProgramInfoLog", "getRenderbufferParameter", "getShaderParameter", "getShaderInfoLog", "getShaderSource", "getTexParameter", "getUniform", "getUniformLocation", "getVertexAttrib" ]; if (isWebGL2RenderingContext) { functionsThatShouldReturnNull.push( "getInternalformatParameter", "getQuery", "getQueryParameter", "getSamplerParameter", "getSyncParameter", "getTransformFeedbackVarying", "getIndexedParameter", "getUniformIndices", "getActiveUniforms", "getActiveUniformBlockParameter", "getActiveUniformBlockName" ); } for (var ii = 0; ii < functionsThatShouldReturnNull.length; ++ii) { var functionName = functionsThatShouldReturnNull[ii]; wrappedContext_[functionName] = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return null; } return f.apply(ctx, arguments); } }(wrappedContext_[functionName]); } var isFunctions = [ "isBuffer", "isEnabled", "isFramebuffer", "isProgram", "isRenderbuffer", "isShader", "isTexture" ]; if (isWebGL2RenderingContext) { isFunctions.push( "isQuery", "isSampler", "isSync", "isTransformFeedback", "isVertexArray" ); } for (var ii = 0; ii < isFunctions.length; ++ii) { var functionName = isFunctions[ii]; wrappedContext_[functionName] = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return false; } return f.apply(ctx, arguments); } }(wrappedContext_[functionName]); } wrappedContext_.checkFramebufferStatus = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return wrappedContext_.FRAMEBUFFER_UNSUPPORTED; } return f.apply(ctx, arguments); }; }(wrappedContext_.checkFramebufferStatus); wrappedContext_.getAttribLocation = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return -1; } return f.apply(ctx, arguments); }; }(wrappedContext_.getAttribLocation); wrappedContext_.getVertexAttribOffset = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return 0; } return f.apply(ctx, arguments); }; }(wrappedContext_.getVertexAttribOffset); wrappedContext_.isContextLost = function() { return contextLost_; }; if (isWebGL2RenderingContext) { wrappedContext_.getFragDataLocation = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return -1; } return f.apply(ctx, arguments); }; }(wrappedContext_.getFragDataLocation); wrappedContext_.clientWaitSync = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return wrappedContext_.WAIT_FAILED; } return f.apply(ctx, arguments); }; }(wrappedContext_.clientWaitSync); wrappedContext_.getUniformBlockIndex = function(f) { return function() { loseContextIfTime(); if (contextLost_) { return wrappedContext_.INVALID_INDEX; } return f.apply(ctx, arguments); }; }(wrappedContext_.getUniformBlockIndex); } return wrappedContext_; } } return { /** * Initializes this module. Safe to call more than once. * @param {!WebGLRenderingContext} ctx A WebGL context. If * you have more than one context it doesn't matter which one * you pass in, it is only used to pull out constants. */ 'init': init, /** * Returns true or false if value matches any WebGL enum * @param {*} value Value to check if it might be an enum. * @return {boolean} True if value matches one of the WebGL defined enums */ 'mightBeEnum': mightBeEnum, /** * Gets an string version of an WebGL enum. * * Example: * WebGLDebugUtil.init(ctx); * var str = WebGLDebugUtil.glEnumToString(ctx.getError()); * * @param {number} value Value to return an enum for * @return {string} The string version of the enum. */ 'glEnumToString': glEnumToString, /** * Converts the argument of a WebGL function to a string. * Attempts to convert enum arguments to strings. * * Example: * WebGLDebugUtil.init(ctx); * var str = WebGLDebugUtil.glFunctionArgToString('bindTexture', 2, 0, gl.TEXTURE_2D); * * would return 'TEXTURE_2D' * * @param {string} functionName the name of the WebGL function. * @param {number} numArgs The number of arguments * @param {number} argumentIndx the index of the argument. * @param {*} value The value of the argument. * @return {string} The value as a string. */ 'glFunctionArgToString': glFunctionArgToString, /** * Converts the arguments of a WebGL function to a string. * Attempts to convert enum arguments to strings. * * @param {string} functionName the name of the WebGL function. * @param {number} args The arguments. * @return {string} The arguments as a string. */ 'glFunctionArgsToString': glFunctionArgsToString, /** * Given a WebGL context returns a wrapped context that calls * gl.getError after every command and calls a function if the * result is not NO_ERROR. * * You can supply your own function if you want. For example, if you'd like * an exception thrown on any GL error you could do this * * function throwOnGLError(err, funcName, args) { * throw WebGLDebugUtils.glEnumToString(err) + * " was caused by call to " + funcName; * }; * * ctx = WebGLDebugUtils.makeDebugContext( * canvas.getContext("webgl"), throwOnGLError); * * @param {!WebGLRenderingContext} ctx The webgl context to wrap. * @param {!function(err, funcName, args): void} opt_onErrorFunc The function * to call when gl.getError returns an error. If not specified the default * function calls console.log with a message. * @param {!function(funcName, args): void} opt_onFunc The * function to call when each webgl function is called. You * can use this to log all calls for example. */ 'makeDebugContext': makeDebugContext, /** * Given a canvas element returns a wrapped canvas element that will * simulate lost context. The canvas returned adds the following functions. * * loseContext: * simulates a lost context event. * * restoreContext: * simulates the context being restored. * * lostContextInNCalls: * loses the context after N gl calls. * * getNumCalls: * tells you how many gl calls there have been so far. * * setRestoreTimeout: * sets the number of milliseconds until the context is restored * after it has been lost. Defaults to 0. Pass -1 to prevent * automatic restoring. * * @param {!Canvas} canvas The canvas element to wrap. */ 'makeLostContextSimulatingCanvas': makeLostContextSimulatingCanvas, /** * Resets a context to the initial state. * @param {!WebGLRenderingContext} ctx The webgl context to * reset. */ 'resetToInitialState': resetToInitialState }; }(); module.exports = WebGLDebugUtils; /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(47))) /***/ }) /******/ ]); });