@deck.gl/aggregation-layers 8.8.2 → 8.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dist.dev.js CHANGED
@@ -850,15 +850,12 @@ __webpack_require__.r(__webpack_exports__);
850
850
 
851
851
 
852
852
 
853
- const INJECT_SHADER_DECLARATIONS = `\n\n${_inject_shader__WEBPACK_IMPORTED_MODULE_3__["DECLARATION_INJECT_MARKER"]}\n\n`;
853
+ const INJECT_SHADER_DECLARATIONS = "\n\n".concat(_inject_shader__WEBPACK_IMPORTED_MODULE_3__["DECLARATION_INJECT_MARKER"], "\n\n");
854
854
  const SHADER_TYPE = {
855
855
  [_constants__WEBPACK_IMPORTED_MODULE_0__["VERTEX_SHADER"]]: 'vertex',
856
856
  [_constants__WEBPACK_IMPORTED_MODULE_0__["FRAGMENT_SHADER"]]: 'fragment'
857
857
  };
858
- const FRAGMENT_SHADER_PROLOGUE = `\
859
- precision highp float;
860
-
861
- `;
858
+ const FRAGMENT_SHADER_PROLOGUE = "precision highp float;\n\n";
862
859
  function assembleShaders(gl, opts) {
863
860
  const {
864
861
  vs,
@@ -881,18 +878,19 @@ function assembleShaders(gl, opts) {
881
878
  };
882
879
  }
883
880
 
884
- function assembleShader(gl, {
885
- id,
886
- source,
887
- type,
888
- modules,
889
- defines = {},
890
- hookFunctions = [],
891
- inject = {},
892
- transpileToGLSL100 = false,
893
- prologue = true,
894
- log
895
- }) {
881
+ function assembleShader(gl, _ref) {
882
+ let {
883
+ id,
884
+ source,
885
+ type,
886
+ modules,
887
+ defines = {},
888
+ hookFunctions = [],
889
+ inject = {},
890
+ transpileToGLSL100 = false,
891
+ prologue = true,
892
+ log
893
+ } = _ref;
896
894
  Object(_utils__WEBPACK_IMPORTED_MODULE_5__["assert"])(typeof source === 'string', 'shader source must be a string');
897
895
  const isVertex = type === _constants__WEBPACK_IMPORTED_MODULE_0__["VERTEX_SHADER"];
898
896
  const sourceLines = source.split('\n');
@@ -905,7 +903,7 @@ function assembleShader(gl, {
905
903
  versionLine = sourceLines[0];
906
904
  coreSource = sourceLines.slice(1).join('\n');
907
905
  } else {
908
- versionLine = `#version ${glslVersion}`;
906
+ versionLine = "#version ".concat(glslVersion);
909
907
  }
910
908
 
911
909
  const allDefines = {};
@@ -913,22 +911,13 @@ function assembleShader(gl, {
913
911
  Object.assign(allDefines, module.getDefines());
914
912
  });
915
913
  Object.assign(allDefines, defines);
916
- let assembledSource = prologue ? `\
917
- ${versionLine}
918
- ${getShaderName({
914
+ let assembledSource = prologue ? "".concat(versionLine, "\n").concat(getShaderName({
919
915
  id,
920
916
  source,
921
917
  type
922
- })}
923
- ${getShaderType({
918
+ }), "\n").concat(getShaderType({
924
919
  type
925
- })}
926
- ${Object(_platform_defines__WEBPACK_IMPORTED_MODULE_2__["getPlatformShaderDefines"])(gl)}
927
- ${Object(_platform_defines__WEBPACK_IMPORTED_MODULE_2__["getVersionDefines"])(gl, glslVersion, !isVertex)}
928
- ${getApplicationDefines(allDefines)}
929
- ${isVertex ? '' : FRAGMENT_SHADER_PROLOGUE}
930
- ` : `${versionLine}
931
- `;
920
+ }), "\n").concat(Object(_platform_defines__WEBPACK_IMPORTED_MODULE_2__["getPlatformShaderDefines"])(gl), "\n").concat(Object(_platform_defines__WEBPACK_IMPORTED_MODULE_2__["getVersionDefines"])(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n") : "".concat(versionLine, "\n");
932
921
  const hookFunctionMap = normalizeHookFunctions(hookFunctions);
933
922
  const hookInjections = {};
934
923
  const declInjections = {};
@@ -1005,27 +994,25 @@ function assembleGetUniforms(modules) {
1005
994
  };
1006
995
  }
1007
996
 
1008
- function getShaderType({
1009
- type
1010
- }) {
1011
- return `
1012
- #define SHADER_TYPE_${SHADER_TYPE[type].toUpperCase()}
1013
- `;
997
+ function getShaderType(_ref2) {
998
+ let {
999
+ type
1000
+ } = _ref2;
1001
+ return "\n#define SHADER_TYPE_".concat(SHADER_TYPE[type].toUpperCase(), "\n");
1014
1002
  }
1015
1003
 
1016
- function getShaderName({
1017
- id,
1018
- source,
1019
- type
1020
- }) {
1004
+ function getShaderName(_ref3) {
1005
+ let {
1006
+ id,
1007
+ source,
1008
+ type
1009
+ } = _ref3;
1021
1010
  const injectShaderName = id && typeof id === 'string' && source.indexOf('SHADER_NAME') === -1;
1022
- return injectShaderName ? `
1023
- #define SHADER_NAME ${id}_${SHADER_TYPE[type]}
1024
-
1025
- ` : '';
1011
+ return injectShaderName ? "\n#define SHADER_NAME ".concat(id, "_").concat(SHADER_TYPE[type], "\n\n") : '';
1026
1012
  }
1027
1013
 
1028
- function getApplicationDefines(defines = {}) {
1014
+ function getApplicationDefines() {
1015
+ let defines = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1029
1016
  let count = 0;
1030
1017
  let sourceText = '';
1031
1018
 
@@ -1038,7 +1025,7 @@ function getApplicationDefines(defines = {}) {
1038
1025
  const value = defines[define];
1039
1026
 
1040
1027
  if (value || Number.isFinite(value)) {
1041
- sourceText += `#define ${define.toUpperCase()} ${defines[define]}\n`;
1028
+ sourceText += "#define ".concat(define.toUpperCase(), " ").concat(defines[define], "\n");
1042
1029
  }
1043
1030
  }
1044
1031
 
@@ -1054,10 +1041,10 @@ function getHookFunctions(hookFunctions, hookInjections) {
1054
1041
 
1055
1042
  for (const hookName in hookFunctions) {
1056
1043
  const hookFunction = hookFunctions[hookName];
1057
- result += `void ${hookFunction.signature} {\n`;
1044
+ result += "void ".concat(hookFunction.signature, " {\n");
1058
1045
 
1059
1046
  if (hookFunction.header) {
1060
- result += ` ${hookFunction.header}`;
1047
+ result += " ".concat(hookFunction.header);
1061
1048
  }
1062
1049
 
1063
1050
  if (hookInjections[hookName]) {
@@ -1065,12 +1052,12 @@ function getHookFunctions(hookFunctions, hookInjections) {
1065
1052
  injections.sort((a, b) => a.order - b.order);
1066
1053
 
1067
1054
  for (const injection of injections) {
1068
- result += ` ${injection.injection}\n`;
1055
+ result += " ".concat(injection.injection, "\n");
1069
1056
  }
1070
1057
  }
1071
1058
 
1072
1059
  if (hookFunction.footer) {
1073
- result += ` ${hookFunction.footer}`;
1060
+ result += " ".concat(hookFunction.footer);
1074
1061
  }
1075
1062
 
1076
1063
  result += '}\n';
@@ -1231,7 +1218,8 @@ const DECLARATION_INJECT_MARKER = '__LUMA_INJECT_DECLARATIONS__';
1231
1218
  const REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/;
1232
1219
  const REGEX_END_OF_MAIN = /}\n?[^{}]*$/;
1233
1220
  const fragments = [];
1234
- function injectShader(source, type, inject, injectStandardStubs = false) {
1221
+ function injectShader(source, type, inject) {
1222
+ let injectStandardStubs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
1235
1223
  const isVertex = type === _constants__WEBPACK_IMPORTED_MODULE_1__["VERTEX_SHADER"];
1236
1224
 
1237
1225
  for (const key in inject) {
@@ -1243,7 +1231,7 @@ function injectShader(source, type, inject, injectStandardStubs = false) {
1243
1231
  fragments[i] = fragmentData[i].injection;
1244
1232
  }
1245
1233
 
1246
- const fragmentString = `${fragments.join('\n')}\n`;
1234
+ const fragmentString = "".concat(fragments.join('\n'), "\n");
1247
1235
 
1248
1236
  switch (key) {
1249
1237
  case 'vs:#decl':
@@ -1306,7 +1294,7 @@ function combineInjects(injects) {
1306
1294
  Object(_utils__WEBPACK_IMPORTED_MODULE_2__["assert"])(Array.isArray(injects) && injects.length > 1);
1307
1295
  injects.forEach(inject => {
1308
1296
  for (const key in inject) {
1309
- result[key] = result[key] ? `${result[key]}\n${inject[key]}` : inject[key];
1297
+ result[key] = result[key] ? "".concat(result[key], "\n").concat(inject[key]) : inject[key];
1310
1298
  }
1311
1299
  });
1312
1300
  return result;
@@ -1333,108 +1321,37 @@ function getPlatformShaderDefines(gl) {
1333
1321
 
1334
1322
  switch (debugInfo.gpuVendor.toLowerCase()) {
1335
1323
  case 'nvidia':
1336
- return `\
1337
- #define NVIDIA_GPU
1338
- // Nvidia optimizes away the calculation necessary for emulated fp64
1339
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
1340
- `;
1324
+ return "#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";
1341
1325
 
1342
1326
  case 'intel':
1343
- return `\
1344
- #define INTEL_GPU
1345
- // Intel optimizes away the calculation necessary for emulated fp64
1346
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
1347
- // Intel's built-in 'tan' function doesn't have acceptable precision
1348
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
1349
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
1350
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
1351
- `;
1327
+ return "#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";
1352
1328
 
1353
1329
  case 'amd':
1354
- return `\
1355
- #define AMD_GPU
1356
- `;
1330
+ return "#define AMD_GPU\n";
1357
1331
 
1358
1332
  default:
1359
- return `\
1360
- #define DEFAULT_GPU
1361
- // Prevent driver from optimizing away the calculation necessary for emulated fp64
1362
- #define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1
1363
- // Intel's built-in 'tan' function doesn't have acceptable precision
1364
- #define LUMA_FP32_TAN_PRECISION_WORKAROUND 1
1365
- // Intel GPU doesn't have full 32 bits precision in same cases, causes overflow
1366
- #define LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND 1
1367
- `;
1333
+ return "#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";
1368
1334
  }
1369
1335
  }
1370
1336
  function getVersionDefines(gl, glslVersion, isFragment) {
1371
- let versionDefines = `\
1372
- #if (__VERSION__ > 120)
1373
-
1374
- # define FEATURE_GLSL_DERIVATIVES
1375
- # define FEATURE_GLSL_DRAW_BUFFERS
1376
- # define FEATURE_GLSL_FRAG_DEPTH
1377
- # define FEATURE_GLSL_TEXTURE_LOD
1378
-
1379
- // DEPRECATED FLAGS, remove in v9
1380
- # define FRAG_DEPTH
1381
- # define DERIVATIVES
1382
- # define DRAW_BUFFERS
1383
- # define TEXTURE_LOD
1384
-
1385
- #endif // __VERSION
1386
- `;
1337
+ let versionDefines = "#if (__VERSION__ > 120)\n\n# define FEATURE_GLSL_DERIVATIVES\n# define FEATURE_GLSL_DRAW_BUFFERS\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FEATURE_GLSL_TEXTURE_LOD\n\n// DEPRECATED FLAGS, remove in v9\n# define FRAG_DEPTH\n# define DERIVATIVES\n# define DRAW_BUFFERS\n# define TEXTURE_LOD\n\n#endif // __VERSION\n";
1387
1338
 
1388
1339
  if (Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["hasFeatures"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_FRAG_DEPTH)) {
1389
- versionDefines += `\
1390
-
1391
- // FRAG_DEPTH => gl_FragDepth is available
1392
- #ifdef GL_EXT_frag_depth
1393
- #extension GL_EXT_frag_depth : enable
1394
- # define FEATURE_GLSL_FRAG_DEPTH
1395
- # define FRAG_DEPTH
1396
- # define gl_FragDepth gl_FragDepthEXT
1397
- #endif
1398
- `;
1340
+ versionDefines += "\n// FRAG_DEPTH => gl_FragDepth is available\n#ifdef GL_EXT_frag_depth\n#extension GL_EXT_frag_depth : enable\n# define FEATURE_GLSL_FRAG_DEPTH\n# define FRAG_DEPTH\n# define gl_FragDepth gl_FragDepthEXT\n#endif\n";
1399
1341
  }
1400
1342
 
1401
1343
  if (Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["hasFeatures"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_DERIVATIVES) && Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["canCompileGLGSExtension"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_DERIVATIVES)) {
1402
- versionDefines += `\
1403
-
1404
- // DERIVATIVES => dxdF, dxdY and fwidth are available
1405
- #ifdef GL_OES_standard_derivatives
1406
- #extension GL_OES_standard_derivatives : enable
1407
- # define FEATURE_GLSL_DERIVATIVES
1408
- # define DERIVATIVES
1409
- #endif
1410
- `;
1344
+ versionDefines += "\n// DERIVATIVES => dxdF, dxdY and fwidth are available\n#ifdef GL_OES_standard_derivatives\n#extension GL_OES_standard_derivatives : enable\n# define FEATURE_GLSL_DERIVATIVES\n# define DERIVATIVES\n#endif\n";
1411
1345
  }
1412
1346
 
1413
1347
  if (Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["hasFeatures"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_FRAG_DATA) && Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["canCompileGLGSExtension"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_FRAG_DATA, {
1414
1348
  behavior: 'require'
1415
1349
  })) {
1416
- versionDefines += `\
1417
-
1418
- // DRAW_BUFFERS => gl_FragData[] is available
1419
- #ifdef GL_EXT_draw_buffers
1420
- #extension GL_EXT_draw_buffers : require
1421
- #define FEATURE_GLSL_DRAW_BUFFERS
1422
- #define DRAW_BUFFERS
1423
- #endif
1424
- `;
1350
+ versionDefines += "\n// DRAW_BUFFERS => gl_FragData[] is available\n#ifdef GL_EXT_draw_buffers\n#extension GL_EXT_draw_buffers : require\n#define FEATURE_GLSL_DRAW_BUFFERS\n#define DRAW_BUFFERS\n#endif\n";
1425
1351
  }
1426
1352
 
1427
1353
  if (Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["hasFeatures"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_TEXTURE_LOD)) {
1428
- versionDefines += `\
1429
- // TEXTURE_LOD => texture2DLod etc are available
1430
- #ifdef GL_EXT_shader_texture_lod
1431
- #extension GL_EXT_shader_texture_lod : enable
1432
-
1433
- # define FEATURE_GLSL_TEXTURE_LOD
1434
- # define TEXTURE_LOD
1435
-
1436
- #endif
1437
- `;
1354
+ versionDefines += "// TEXTURE_LOD => texture2DLod etc are available\n#ifdef GL_EXT_shader_texture_lod\n#extension GL_EXT_shader_texture_lod : enable\n\n# define FEATURE_GLSL_TEXTURE_LOD\n# define TEXTURE_LOD\n\n#endif\n";
1438
1355
  }
1439
1356
 
1440
1357
  return versionDefines;
@@ -1474,12 +1391,14 @@ function getShaderDependencies(modules) {
1474
1391
  return Object.keys(moduleDepth).sort((a, b) => moduleDepth[b] - moduleDepth[a]).map(name => moduleMap[name]);
1475
1392
  }
1476
1393
 
1477
- function getDependencyGraph({
1478
- modules,
1479
- level,
1480
- moduleMap,
1481
- moduleDepth
1482
- }) {
1394
+ function getDependencyGraph(_ref) {
1395
+ let {
1396
+ modules,
1397
+ level,
1398
+ moduleMap,
1399
+ moduleDepth
1400
+ } = _ref;
1401
+
1483
1402
  if (level >= 5) {
1484
1403
  throw new Error('Possible loop in shader dependency graph');
1485
1404
  }
@@ -1510,7 +1429,7 @@ function instantiateModules(modules, seen) {
1510
1429
  return module;
1511
1430
  }
1512
1431
 
1513
- Object(_utils__WEBPACK_IMPORTED_MODULE_1__["assert"])(typeof module !== 'string', `Shader module use by name is deprecated. Import shader module '${module}' and use it directly.`);
1432
+ Object(_utils__WEBPACK_IMPORTED_MODULE_1__["assert"])(typeof module !== 'string', "Shader module use by name is deprecated. Import shader module '".concat(module, "' and use it directly."));
1514
1433
  Object(_utils__WEBPACK_IMPORTED_MODULE_1__["assert"])(module.name, 'shader module has no name');
1515
1434
  module = new _shader_module__WEBPACK_IMPORTED_MODULE_0__["default"](module);
1516
1435
  module.dependencies = instantiateModules(module.dependencies);
@@ -1544,19 +1463,20 @@ __webpack_require__.r(__webpack_exports__);
1544
1463
  const VERTEX_SHADER = 'vs';
1545
1464
  const FRAGMENT_SHADER = 'fs';
1546
1465
  class ShaderModule {
1547
- constructor({
1548
- name,
1549
- vs,
1550
- fs,
1551
- dependencies = [],
1552
- uniforms,
1553
- getUniforms,
1554
- deprecations = [],
1555
- defines = {},
1556
- inject = {},
1557
- vertexShader,
1558
- fragmentShader
1559
- }) {
1466
+ constructor(_ref) {
1467
+ let {
1468
+ name,
1469
+ vs,
1470
+ fs,
1471
+ dependencies = [],
1472
+ uniforms,
1473
+ getUniforms,
1474
+ deprecations = [],
1475
+ defines = {},
1476
+ inject = {},
1477
+ vertexShader,
1478
+ fragmentShader
1479
+ } = _ref;
1560
1480
  Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(typeof name === 'string');
1561
1481
  this.name = name;
1562
1482
  this.vs = vs || vertexShader;
@@ -1588,12 +1508,7 @@ class ShaderModule {
1588
1508
  Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(false);
1589
1509
  }
1590
1510
 
1591
- return `\
1592
- #define MODULE_${this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_')}
1593
- ${moduleSource}\
1594
- // END MODULE_${this.name}
1595
-
1596
- `;
1511
+ return "#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_'), "\n").concat(moduleSource, "// END MODULE_").concat(this.name, "\n\n");
1597
1512
  }
1598
1513
 
1599
1514
  getUniforms(opts, uniforms) {
@@ -1628,17 +1543,18 @@ ${moduleSource}\
1628
1543
  deprecations.forEach(def => {
1629
1544
  switch (def.type) {
1630
1545
  case 'function':
1631
- def.regex = new RegExp(`\\b${def.old}\\(`);
1546
+ def.regex = new RegExp("\\b".concat(def.old, "\\("));
1632
1547
  break;
1633
1548
 
1634
1549
  default:
1635
- def.regex = new RegExp(`${def.type} ${def.old};`);
1550
+ def.regex = new RegExp("".concat(def.type, " ").concat(def.old, ";"));
1636
1551
  }
1637
1552
  });
1638
1553
  return deprecations;
1639
1554
  }
1640
1555
 
1641
- _defaultGetUniforms(opts = {}) {
1556
+ _defaultGetUniforms() {
1557
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1642
1558
  const uniforms = {};
1643
1559
  const propTypes = this.uniforms;
1644
1560
 
@@ -1647,7 +1563,7 @@ ${moduleSource}\
1647
1563
 
1648
1564
  if (key in opts && !propDef.private) {
1649
1565
  if (propDef.validate) {
1650
- Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(propDef.validate(opts[key], propDef), `${this.name}: invalid ${key}`);
1566
+ Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(propDef.validate(opts[key], propDef), "".concat(this.name, ": invalid ").concat(key));
1651
1567
  }
1652
1568
 
1653
1569
  uniforms[key] = opts[key];
@@ -1710,7 +1626,7 @@ function normalizeInjections(injections) {
1710
1626
  __webpack_require__.r(__webpack_exports__);
1711
1627
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return transpileShader; });
1712
1628
  function testVariable(qualifier) {
1713
- return new RegExp(`\\b${qualifier}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`, 'g');
1629
+ return new RegExp("\\b".concat(qualifier, "[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"), 'g');
1714
1630
  }
1715
1631
 
1716
1632
  const ES300_REPLACEMENTS = [[/^(#version[ \t]+(100|300[ \t]+es))?[ \t]*\n/, '#version 300 es\n'], [/\btexture(2D|2DProj|Cube)Lod(EXT)?\(/g, 'textureLod('], [/\btexture(2D|2DProj|Cube)(EXT)?\(/g, 'texture(']];
@@ -1731,7 +1647,7 @@ function transpileShader(source, targetGLSLVersion, isVertex) {
1731
1647
  return isVertex ? convertShader(source, ES100_VERTEX_REPLACEMENTS) : convertFragmentShaderTo100(source);
1732
1648
 
1733
1649
  default:
1734
- throw new Error(`unknown GLSL version ${targetGLSLVersion}`);
1650
+ throw new Error("unknown GLSL version ".concat(targetGLSLVersion));
1735
1651
  }
1736
1652
  }
1737
1653
 
@@ -1749,10 +1665,10 @@ function convertFragmentShaderTo300(source) {
1749
1665
 
1750
1666
  if (outputMatch) {
1751
1667
  const outputName = outputMatch[1];
1752
- source = source.replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName);
1668
+ source = source.replace(new RegExp("\\b".concat(ES100_FRAGMENT_OUTPUT_NAME, "\\b"), 'g'), outputName);
1753
1669
  } else {
1754
1670
  const outputName = 'fragmentColor';
1755
- source = source.replace(REGEX_START_OF_MAIN, match => `out vec4 ${outputName};\n${match}`).replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName);
1671
+ source = source.replace(REGEX_START_OF_MAIN, match => "out vec4 ".concat(outputName, ";\n").concat(match)).replace(new RegExp("\\b".concat(ES100_FRAGMENT_OUTPUT_NAME, "\\b"), 'g'), outputName);
1756
1672
  }
1757
1673
 
1758
1674
  return source;
@@ -1764,7 +1680,7 @@ function convertFragmentShaderTo100(source) {
1764
1680
 
1765
1681
  if (outputMatch) {
1766
1682
  const outputName = outputMatch[1];
1767
- source = source.replace(ES300_FRAGMENT_OUTPUT_REGEX, '').replace(new RegExp(`\\b${outputName}\\b`, 'g'), ES100_FRAGMENT_OUTPUT_NAME);
1683
+ source = source.replace(ES300_FRAGMENT_OUTPUT_REGEX, '').replace(new RegExp("\\b".concat(outputName, "\\b"), 'g'), ES100_FRAGMENT_OUTPUT_NAME);
1768
1684
  }
1769
1685
 
1770
1686
  return source;
@@ -1790,7 +1706,8 @@ const DEFAULT_MODULE_OPTIONS = {
1790
1706
  lightDirection: DEFAULT_LIGHT_DIRECTION
1791
1707
  };
1792
1708
 
1793
- function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
1709
+ function getUniforms() {
1710
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
1794
1711
  const uniforms = {};
1795
1712
 
1796
1713
  if (opts.lightDirection) {
@@ -1801,14 +1718,7 @@ function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
1801
1718
  }
1802
1719
 
1803
1720
  const vs = null;
1804
- const fs = `\
1805
- uniform vec3 dirlight_uLightDirection;
1806
- vec4 dirlight_filterColor(vec4 color) {
1807
- vec3 normal = project_getNormal_World();
1808
- float d = abs(dot(normalize(normal), normalize(dirlight_uLightDirection)));
1809
- return vec4(color.rgb * d, color.a);
1810
- }
1811
- `;
1721
+ const fs = "uniform vec3 dirlight_uLightDirection;\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";
1812
1722
  const dirlight = {
1813
1723
  name: 'dirlight',
1814
1724
  vs,
@@ -1830,154 +1740,7 @@ const dirlight = {
1830
1740
  "use strict";
1831
1741
  __webpack_require__.r(__webpack_exports__);
1832
1742
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp32", function() { return fp32; });
1833
- const fp32shader = `\
1834
- #ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
1835
- const float TWO_PI = 6.2831854820251465;
1836
- const float PI_2 = 1.5707963705062866;
1837
- const float PI_16 = 0.1963495463132858;
1838
-
1839
- const float SIN_TABLE_0 = 0.19509032368659973;
1840
- const float SIN_TABLE_1 = 0.3826834261417389;
1841
- const float SIN_TABLE_2 = 0.5555702447891235;
1842
- const float SIN_TABLE_3 = 0.7071067690849304;
1843
-
1844
- const float COS_TABLE_0 = 0.9807852506637573;
1845
- const float COS_TABLE_1 = 0.9238795042037964;
1846
- const float COS_TABLE_2 = 0.8314695954322815;
1847
- const float COS_TABLE_3 = 0.7071067690849304;
1848
-
1849
- const float INVERSE_FACTORIAL_3 = 1.666666716337204e-01;
1850
- const float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;
1851
- const float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;
1852
- const float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;
1853
-
1854
- float sin_taylor_fp32(float a) {
1855
- float r, s, t, x;
1856
-
1857
- if (a == 0.0) {
1858
- return 0.0;
1859
- }
1860
-
1861
- x = -a * a;
1862
- s = a;
1863
- r = a;
1864
-
1865
- r = r * x;
1866
- t = r * INVERSE_FACTORIAL_3;
1867
- s = s + t;
1868
-
1869
- r = r * x;
1870
- t = r * INVERSE_FACTORIAL_5;
1871
- s = s + t;
1872
-
1873
- r = r * x;
1874
- t = r * INVERSE_FACTORIAL_7;
1875
- s = s + t;
1876
-
1877
- r = r * x;
1878
- t = r * INVERSE_FACTORIAL_9;
1879
- s = s + t;
1880
-
1881
- return s;
1882
- }
1883
-
1884
- void sincos_taylor_fp32(float a, out float sin_t, out float cos_t) {
1885
- if (a == 0.0) {
1886
- sin_t = 0.0;
1887
- cos_t = 1.0;
1888
- }
1889
- sin_t = sin_taylor_fp32(a);
1890
- cos_t = sqrt(1.0 - sin_t * sin_t);
1891
- }
1892
-
1893
- float tan_taylor_fp32(float a) {
1894
- float sin_a;
1895
- float cos_a;
1896
-
1897
- if (a == 0.0) {
1898
- return 0.0;
1899
- }
1900
- float z = floor(a / TWO_PI);
1901
- float r = a - TWO_PI * z;
1902
-
1903
- float t;
1904
- float q = floor(r / PI_2 + 0.5);
1905
- int j = int(q);
1906
-
1907
- if (j < -2 || j > 2) {
1908
- return 1.0 / 0.0;
1909
- }
1910
-
1911
- t = r - PI_2 * q;
1912
-
1913
- q = floor(t / PI_16 + 0.5);
1914
- int k = int(q);
1915
- int abs_k = int(abs(float(k)));
1916
-
1917
- if (abs_k > 4) {
1918
- return 1.0 / 0.0;
1919
- } else {
1920
- t = t - PI_16 * q;
1921
- }
1922
-
1923
- float u = 0.0;
1924
- float v = 0.0;
1925
-
1926
- float sin_t, cos_t;
1927
- float s, c;
1928
- sincos_taylor_fp32(t, sin_t, cos_t);
1929
-
1930
- if (k == 0) {
1931
- s = sin_t;
1932
- c = cos_t;
1933
- } else {
1934
- if (abs(float(abs_k) - 1.0) < 0.5) {
1935
- u = COS_TABLE_0;
1936
- v = SIN_TABLE_0;
1937
- } else if (abs(float(abs_k) - 2.0) < 0.5) {
1938
- u = COS_TABLE_1;
1939
- v = SIN_TABLE_1;
1940
- } else if (abs(float(abs_k) - 3.0) < 0.5) {
1941
- u = COS_TABLE_2;
1942
- v = SIN_TABLE_2;
1943
- } else if (abs(float(abs_k) - 4.0) < 0.5) {
1944
- u = COS_TABLE_3;
1945
- v = SIN_TABLE_3;
1946
- }
1947
- if (k > 0) {
1948
- s = u * sin_t + v * cos_t;
1949
- c = u * cos_t - v * sin_t;
1950
- } else {
1951
- s = u * sin_t - v * cos_t;
1952
- c = u * cos_t + v * sin_t;
1953
- }
1954
- }
1955
-
1956
- if (j == 0) {
1957
- sin_a = s;
1958
- cos_a = c;
1959
- } else if (j == 1) {
1960
- sin_a = c;
1961
- cos_a = -s;
1962
- } else if (j == -1) {
1963
- sin_a = -c;
1964
- cos_a = s;
1965
- } else {
1966
- sin_a = -s;
1967
- cos_a = -c;
1968
- }
1969
- return sin_a / cos_a;
1970
- }
1971
- #endif
1972
-
1973
- float tan_fp32(float a) {
1974
- #ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND
1975
- return tan_taylor_fp32(a);
1976
- #else
1977
- return tan(a);
1978
- #endif
1979
- }
1980
- `;
1743
+ const fp32shader = "#ifdef LUMA_FP32_TAN_PRECISION_WORKAROUND\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;\nconst float INVERSE_FACTORIAL_5 = 8.333333767950535e-03;\nconst float INVERSE_FACTORIAL_7 = 1.9841270113829523e-04;\nconst float INVERSE_FACTORIAL_9 = 2.75573188446287533e-06;\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 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 1.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 1.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";
1981
1744
  const fp32 = {
1982
1745
  name: 'fp32',
1983
1746
  vs: fp32shader,
@@ -1996,149 +1759,7 @@ const fp32 = {
1996
1759
 
1997
1760
  "use strict";
1998
1761
  __webpack_require__.r(__webpack_exports__);
1999
- /* harmony default export */ __webpack_exports__["default"] = (`\
2000
- uniform float ONE;
2001
- vec2 split(float a) {
2002
- const float SPLIT = 4097.0;
2003
- float t = a * SPLIT;
2004
- #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
2005
- float a_hi = t * ONE - (t - a);
2006
- float a_lo = a * ONE - a_hi;
2007
- #else
2008
- float a_hi = t - (t - a);
2009
- float a_lo = a - a_hi;
2010
- #endif
2011
- return vec2(a_hi, a_lo);
2012
- }
2013
- vec2 split2(vec2 a) {
2014
- vec2 b = split(a.x);
2015
- b.y += a.y;
2016
- return b;
2017
- }
2018
- vec2 quickTwoSum(float a, float b) {
2019
- #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
2020
- float sum = (a + b) * ONE;
2021
- float err = b - (sum - a) * ONE;
2022
- #else
2023
- float sum = a + b;
2024
- float err = b - (sum - a);
2025
- #endif
2026
- return vec2(sum, err);
2027
- }
2028
- vec2 twoSum(float a, float b) {
2029
- float s = (a + b);
2030
- #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
2031
- float v = (s * ONE - a) * ONE;
2032
- float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);
2033
- #else
2034
- float v = s - a;
2035
- float err = (a - (s - v)) + (b - v);
2036
- #endif
2037
- return vec2(s, err);
2038
- }
2039
-
2040
- vec2 twoSub(float a, float b) {
2041
- float s = (a - b);
2042
- #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
2043
- float v = (s * ONE - a) * ONE;
2044
- float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);
2045
- #else
2046
- float v = s - a;
2047
- float err = (a - (s - v)) - (b + v);
2048
- #endif
2049
- return vec2(s, err);
2050
- }
2051
-
2052
- vec2 twoSqr(float a) {
2053
- float prod = a * a;
2054
- vec2 a_fp64 = split(a);
2055
- #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
2056
- float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *
2057
- a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;
2058
- #else
2059
- float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
2060
- #endif
2061
- return vec2(prod, err);
2062
- }
2063
-
2064
- vec2 twoProd(float a, float b) {
2065
- float prod = a * b;
2066
- vec2 a_fp64 = split(a);
2067
- vec2 b_fp64 = split(b);
2068
- float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
2069
- a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
2070
- return vec2(prod, err);
2071
- }
2072
-
2073
- vec2 sum_fp64(vec2 a, vec2 b) {
2074
- vec2 s, t;
2075
- s = twoSum(a.x, b.x);
2076
- t = twoSum(a.y, b.y);
2077
- s.y += t.x;
2078
- s = quickTwoSum(s.x, s.y);
2079
- s.y += t.y;
2080
- s = quickTwoSum(s.x, s.y);
2081
- return s;
2082
- }
2083
-
2084
- vec2 sub_fp64(vec2 a, vec2 b) {
2085
- vec2 s, t;
2086
- s = twoSub(a.x, b.x);
2087
- t = twoSub(a.y, b.y);
2088
- s.y += t.x;
2089
- s = quickTwoSum(s.x, s.y);
2090
- s.y += t.y;
2091
- s = quickTwoSum(s.x, s.y);
2092
- return s;
2093
- }
2094
-
2095
- vec2 mul_fp64(vec2 a, vec2 b) {
2096
- vec2 prod = twoProd(a.x, b.x);
2097
- prod.y += a.x * b.y;
2098
- #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
2099
- prod = split2(prod);
2100
- #endif
2101
- prod = quickTwoSum(prod.x, prod.y);
2102
- prod.y += a.y * b.x;
2103
- #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
2104
- prod = split2(prod);
2105
- #endif
2106
- prod = quickTwoSum(prod.x, prod.y);
2107
- return prod;
2108
- }
2109
-
2110
- vec2 div_fp64(vec2 a, vec2 b) {
2111
- float xn = 1.0 / b.x;
2112
- #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
2113
- vec2 yn = mul_fp64(a, vec2(xn, 0));
2114
- #else
2115
- vec2 yn = a * xn;
2116
- #endif
2117
- float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
2118
- vec2 prod = twoProd(xn, diff);
2119
- return sum_fp64(yn, prod);
2120
- }
2121
-
2122
- vec2 sqrt_fp64(vec2 a) {
2123
- if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
2124
- if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
2125
-
2126
- float x = 1.0 / sqrt(a.x);
2127
- float yn = a.x * x;
2128
- #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
2129
- vec2 yn_sqr = twoSqr(yn) * ONE;
2130
- #else
2131
- vec2 yn_sqr = twoSqr(yn);
2132
- #endif
2133
- float diff = sub_fp64(a, yn_sqr).x;
2134
- vec2 prod = twoProd(x * 0.5, diff);
2135
- #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
2136
- return sum_fp64(split(yn), prod);
2137
- #else
2138
- return sum_fp64(vec2(yn, 0.0), prod);
2139
- #endif
2140
- }
2141
- `);
1762
+ /* harmony default export */ __webpack_exports__["default"] = ("uniform float ONE;\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}\nvec2 split2(vec2 a) {\n vec2 b = split(a.x);\n b.y += a.y;\n return b;\n}\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}\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 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");
2142
1763
  //# sourceMappingURL=fp64-arithmetic.glsl.js.map
2143
1764
 
2144
1765
  /***/ }),
@@ -2152,636 +1773,7 @@ vec2 sqrt_fp64(vec2 a) {
2152
1773
 
2153
1774
  "use strict";
2154
1775
  __webpack_require__.r(__webpack_exports__);
2155
- /* harmony default export */ __webpack_exports__["default"] = (`\
2156
- const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08);
2157
- const vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09);
2158
- const vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8);
2159
- const vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7);
2160
- const vec2 PI_2_FP64 = vec2(1.5707963705062866, -4.371139006309477e-8);
2161
- const vec2 PI_4_FP64 = vec2(0.7853981852531433, -2.1855695031547384e-8);
2162
- const vec2 PI_16_FP64 = vec2(0.19634954631328583, -5.463923757886846e-9);
2163
- const vec2 PI_16_2_FP64 = vec2(0.39269909262657166, -1.0927847515773692e-8);
2164
- const vec2 PI_16_3_FP64 = vec2(0.5890486240386963, -1.4906100798128818e-9);
2165
- const vec2 PI_180_FP64 = vec2(0.01745329238474369, 1.3519960498364902e-10);
2166
-
2167
- const vec2 SIN_TABLE_0_FP64 = vec2(0.19509032368659973, -1.6704714833615242e-9);
2168
- const vec2 SIN_TABLE_1_FP64 = vec2(0.3826834261417389, 6.22335089017767e-9);
2169
- const vec2 SIN_TABLE_2_FP64 = vec2(0.5555702447891235, -1.1769521357507529e-8);
2170
- const vec2 SIN_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617041793133e-8);
2171
-
2172
- const vec2 COS_TABLE_0_FP64 = vec2(0.9807852506637573, 2.9739473106360492e-8);
2173
- const vec2 COS_TABLE_1_FP64 = vec2(0.9238795042037964, 2.8307490351764386e-8);
2174
- const vec2 COS_TABLE_2_FP64 = vec2(0.8314695954322815, 1.6870263741530778e-8);
2175
- const vec2 COS_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617152815436e-8);
2176
-
2177
- const vec2 INVERSE_FACTORIAL_3_FP64 = vec2(1.666666716337204e-01, -4.967053879312289e-09);
2178
- const vec2 INVERSE_FACTORIAL_4_FP64 = vec2(4.16666679084301e-02, -1.2417634698280722e-09);
2179
- const vec2 INVERSE_FACTORIAL_5_FP64 = vec2(8.333333767950535e-03, -4.34617203337595e-10);
2180
- const vec2 INVERSE_FACTORIAL_6_FP64 = vec2(1.3888889225199819e-03, -3.3631094437103215e-11);
2181
- const vec2 INVERSE_FACTORIAL_7_FP64 = vec2(1.9841270113829523e-04, -2.725596874933456e-12);
2182
- const vec2 INVERSE_FACTORIAL_8_FP64 = vec2(2.4801587642286904e-05, -3.406996025904184e-13);
2183
- const vec2 INVERSE_FACTORIAL_9_FP64 = vec2(2.75573188446287533e-06, 3.7935713937038186e-14);
2184
- const vec2 INVERSE_FACTORIAL_10_FP64 = vec2(2.755731998149713e-07, -7.575112367869873e-15);
2185
-
2186
- float nint(float d) {
2187
- if (d == floor(d)) return d;
2188
- return floor(d + 0.5);
2189
- }
2190
-
2191
- vec2 nint_fp64(vec2 a) {
2192
- float hi = nint(a.x);
2193
- float lo;
2194
- vec2 tmp;
2195
- if (hi == a.x) {
2196
- lo = nint(a.y);
2197
- tmp = quickTwoSum(hi, lo);
2198
- } else {
2199
- lo = 0.0;
2200
- if (abs(hi - a.x) == 0.5 && a.y < 0.0) {
2201
- hi -= 1.0;
2202
- }
2203
- tmp = vec2(hi, lo);
2204
- }
2205
- return tmp;
2206
- }
2207
-
2208
- vec2 exp_fp64(vec2 a) {
2209
-
2210
- const int k_power = 4;
2211
- const float k = 16.0;
2212
-
2213
- const float inv_k = 1.0 / k;
2214
-
2215
- if (a.x <= -88.0) return vec2(0.0, 0.0);
2216
- if (a.x >= 88.0) return vec2(1.0 / 0.0, 1.0 / 0.0);
2217
- if (a.x == 0.0 && a.y == 0.0) return vec2(1.0, 0.0);
2218
- if (a.x == 1.0 && a.y == 0.0) return E_FP64;
2219
-
2220
- float m = floor(a.x / LOG2_FP64.x + 0.5);
2221
- vec2 r = sub_fp64(a, mul_fp64(LOG2_FP64, vec2(m, 0.0))) * inv_k;
2222
- vec2 s, t, p;
2223
-
2224
- p = mul_fp64(r, r);
2225
- s = sum_fp64(r, p * 0.5);
2226
- p = mul_fp64(p, r);
2227
- t = mul_fp64(p, INVERSE_FACTORIAL_3_FP64);
2228
-
2229
- s = sum_fp64(s, t);
2230
- p = mul_fp64(p, r);
2231
- t = mul_fp64(p, INVERSE_FACTORIAL_4_FP64);
2232
-
2233
- s = sum_fp64(s, t);
2234
- p = mul_fp64(p, r);
2235
- t = mul_fp64(p, INVERSE_FACTORIAL_5_FP64);
2236
-
2237
-
2238
-
2239
-
2240
-
2241
-
2242
- s = sum_fp64(s, t);
2243
- for (int i = 0; i < k_power; i++) {
2244
- s = sum_fp64(s * 2.0, mul_fp64(s, s));
2245
- }
2246
-
2247
- #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)
2248
- s = sum_fp64(s, vec2(ONE, 0.0));
2249
- #else
2250
- s = sum_fp64(s, vec2(1.0, 0.0));
2251
- #endif
2252
-
2253
- return s * pow(2.0, m);
2254
- }
2255
-
2256
- vec2 log_fp64(vec2 a)
2257
- {
2258
- if (a.x == 1.0 && a.y == 0.0) return vec2(0.0, 0.0);
2259
- if (a.x <= 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
2260
- vec2 x = vec2(log(a.x), 0.0);
2261
- vec2 s;
2262
- #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)
2263
- s = vec2(ONE, 0.0);
2264
- #else
2265
- s = vec2(1.0, 0.0);
2266
- #endif
2267
-
2268
- x = sub_fp64(sum_fp64(x, mul_fp64(a, exp_fp64(-x))), s);
2269
- return x;
2270
- }
2271
-
2272
- vec2 sin_taylor_fp64(vec2 a) {
2273
- vec2 r, s, t, x;
2274
-
2275
- if (a.x == 0.0 && a.y == 0.0) {
2276
- return vec2(0.0, 0.0);
2277
- }
2278
-
2279
- x = -mul_fp64(a, a);
2280
- s = a;
2281
- r = a;
2282
-
2283
- r = mul_fp64(r, x);
2284
- t = mul_fp64(r, INVERSE_FACTORIAL_3_FP64);
2285
- s = sum_fp64(s, t);
2286
-
2287
- r = mul_fp64(r, x);
2288
- t = mul_fp64(r, INVERSE_FACTORIAL_5_FP64);
2289
- s = sum_fp64(s, t);
2290
-
2291
-
2292
-
2293
-
2294
-
2295
-
2296
- return s;
2297
- }
2298
-
2299
- vec2 cos_taylor_fp64(vec2 a) {
2300
- vec2 r, s, t, x;
2301
-
2302
- if (a.x == 0.0 && a.y == 0.0) {
2303
- return vec2(1.0, 0.0);
2304
- }
2305
-
2306
- x = -mul_fp64(a, a);
2307
- r = x;
2308
- s = sum_fp64(vec2(1.0, 0.0), r * 0.5);
2309
-
2310
- r = mul_fp64(r, x);
2311
- t = mul_fp64(r, INVERSE_FACTORIAL_4_FP64);
2312
- s = sum_fp64(s, t);
2313
-
2314
- r = mul_fp64(r, x);
2315
- t = mul_fp64(r, INVERSE_FACTORIAL_6_FP64);
2316
- s = sum_fp64(s, t);
2317
-
2318
-
2319
-
2320
-
2321
-
2322
-
2323
- return s;
2324
- }
2325
-
2326
- void sincos_taylor_fp64(vec2 a, out vec2 sin_t, out vec2 cos_t) {
2327
- if (a.x == 0.0 && a.y == 0.0) {
2328
- sin_t = vec2(0.0, 0.0);
2329
- cos_t = vec2(1.0, 0.0);
2330
- }
2331
-
2332
- sin_t = sin_taylor_fp64(a);
2333
- cos_t = sqrt_fp64(sub_fp64(vec2(1.0, 0.0), mul_fp64(sin_t, sin_t)));
2334
- }
2335
-
2336
- vec2 sin_fp64(vec2 a) {
2337
- if (a.x == 0.0 && a.y == 0.0) {
2338
- return vec2(0.0, 0.0);
2339
- }
2340
- vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));
2341
- vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));
2342
-
2343
- vec2 t;
2344
- float q = floor(r.x / PI_2_FP64.x + 0.5);
2345
- int j = int(q);
2346
-
2347
- if (j < -2 || j > 2) {
2348
- return vec2(0.0 / 0.0, 0.0 / 0.0);
2349
- }
2350
-
2351
- t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));
2352
-
2353
- q = floor(t.x / PI_16_FP64.x + 0.5);
2354
- int k = int(q);
2355
-
2356
- if (k == 0) {
2357
- if (j == 0) {
2358
- return sin_taylor_fp64(t);
2359
- } else if (j == 1) {
2360
- return cos_taylor_fp64(t);
2361
- } else if (j == -1) {
2362
- return -cos_taylor_fp64(t);
2363
- } else {
2364
- return -sin_taylor_fp64(t);
2365
- }
2366
- }
2367
-
2368
- int abs_k = int(abs(float(k)));
2369
-
2370
- if (abs_k > 4) {
2371
- return vec2(0.0 / 0.0, 0.0 / 0.0);
2372
- } else {
2373
- t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));
2374
- }
2375
-
2376
- vec2 u = vec2(0.0, 0.0);
2377
- vec2 v = vec2(0.0, 0.0);
2378
-
2379
- #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)
2380
- if (abs(float(abs_k) - 1.0) < 0.5) {
2381
- u = COS_TABLE_0_FP64;
2382
- v = SIN_TABLE_0_FP64;
2383
- } else if (abs(float(abs_k) - 2.0) < 0.5) {
2384
- u = COS_TABLE_1_FP64;
2385
- v = SIN_TABLE_1_FP64;
2386
- } else if (abs(float(abs_k) - 3.0) < 0.5) {
2387
- u = COS_TABLE_2_FP64;
2388
- v = SIN_TABLE_2_FP64;
2389
- } else if (abs(float(abs_k) - 4.0) < 0.5) {
2390
- u = COS_TABLE_3_FP64;
2391
- v = SIN_TABLE_3_FP64;
2392
- }
2393
- #else
2394
- if (abs_k == 1) {
2395
- u = COS_TABLE_0_FP64;
2396
- v = SIN_TABLE_0_FP64;
2397
- } else if (abs_k == 2) {
2398
- u = COS_TABLE_1_FP64;
2399
- v = SIN_TABLE_1_FP64;
2400
- } else if (abs_k == 3) {
2401
- u = COS_TABLE_2_FP64;
2402
- v = SIN_TABLE_2_FP64;
2403
- } else if (abs_k == 4) {
2404
- u = COS_TABLE_3_FP64;
2405
- v = SIN_TABLE_3_FP64;
2406
- }
2407
- #endif
2408
-
2409
- vec2 sin_t, cos_t;
2410
- sincos_taylor_fp64(t, sin_t, cos_t);
2411
-
2412
-
2413
-
2414
- vec2 result = vec2(0.0, 0.0);
2415
- if (j == 0) {
2416
- if (k > 0) {
2417
- result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2418
- } else {
2419
- result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2420
- }
2421
- } else if (j == 1) {
2422
- if (k > 0) {
2423
- result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2424
- } else {
2425
- result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2426
- }
2427
- } else if (j == -1) {
2428
- if (k > 0) {
2429
- result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));
2430
- } else {
2431
- result = -sum_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));
2432
- }
2433
- } else {
2434
- if (k > 0) {
2435
- result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2436
- } else {
2437
- result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));
2438
- }
2439
- }
2440
-
2441
- return result;
2442
- }
2443
-
2444
- vec2 cos_fp64(vec2 a) {
2445
- if (a.x == 0.0 && a.y == 0.0) {
2446
- return vec2(1.0, 0.0);
2447
- }
2448
- vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));
2449
- vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));
2450
-
2451
- vec2 t;
2452
- float q = floor(r.x / PI_2_FP64.x + 0.5);
2453
- int j = int(q);
2454
-
2455
- if (j < -2 || j > 2) {
2456
- return vec2(0.0 / 0.0, 0.0 / 0.0);
2457
- }
2458
-
2459
- t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));
2460
-
2461
- q = floor(t.x / PI_16_FP64.x + 0.5);
2462
- int k = int(q);
2463
-
2464
- if (k == 0) {
2465
- if (j == 0) {
2466
- return cos_taylor_fp64(t);
2467
- } else if (j == 1) {
2468
- return -sin_taylor_fp64(t);
2469
- } else if (j == -1) {
2470
- return sin_taylor_fp64(t);
2471
- } else {
2472
- return -cos_taylor_fp64(t);
2473
- }
2474
- }
2475
-
2476
- int abs_k = int(abs(float(k)));
2477
-
2478
- if (abs_k > 4) {
2479
- return vec2(0.0 / 0.0, 0.0 / 0.0);
2480
- } else {
2481
- t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));
2482
- }
2483
-
2484
- vec2 u = vec2(0.0, 0.0);
2485
- vec2 v = vec2(0.0, 0.0);
2486
-
2487
- #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)
2488
- if (abs(float(abs_k) - 1.0) < 0.5) {
2489
- u = COS_TABLE_0_FP64;
2490
- v = SIN_TABLE_0_FP64;
2491
- } else if (abs(float(abs_k) - 2.0) < 0.5) {
2492
- u = COS_TABLE_1_FP64;
2493
- v = SIN_TABLE_1_FP64;
2494
- } else if (abs(float(abs_k) - 3.0) < 0.5) {
2495
- u = COS_TABLE_2_FP64;
2496
- v = SIN_TABLE_2_FP64;
2497
- } else if (abs(float(abs_k) - 4.0) < 0.5) {
2498
- u = COS_TABLE_3_FP64;
2499
- v = SIN_TABLE_3_FP64;
2500
- }
2501
- #else
2502
- if (abs_k == 1) {
2503
- u = COS_TABLE_0_FP64;
2504
- v = SIN_TABLE_0_FP64;
2505
- } else if (abs_k == 2) {
2506
- u = COS_TABLE_1_FP64;
2507
- v = SIN_TABLE_1_FP64;
2508
- } else if (abs_k == 3) {
2509
- u = COS_TABLE_2_FP64;
2510
- v = SIN_TABLE_2_FP64;
2511
- } else if (abs_k == 4) {
2512
- u = COS_TABLE_3_FP64;
2513
- v = SIN_TABLE_3_FP64;
2514
- }
2515
- #endif
2516
-
2517
- vec2 sin_t, cos_t;
2518
- sincos_taylor_fp64(t, sin_t, cos_t);
2519
-
2520
- vec2 result = vec2(0.0, 0.0);
2521
- if (j == 0) {
2522
- if (k > 0) {
2523
- result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2524
- } else {
2525
- result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2526
- }
2527
- } else if (j == 1) {
2528
- if (k > 0) {
2529
- result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2530
- } else {
2531
- result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t));
2532
- }
2533
- } else if (j == -1) {
2534
- if (k > 0) {
2535
- result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2536
- } else {
2537
- result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2538
- }
2539
- } else {
2540
- if (k > 0) {
2541
- result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t));
2542
- } else {
2543
- result = -sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2544
- }
2545
- }
2546
-
2547
- return result;
2548
- }
2549
-
2550
- vec2 tan_fp64(vec2 a) {
2551
- vec2 sin_a;
2552
- vec2 cos_a;
2553
-
2554
- if (a.x == 0.0 && a.y == 0.0) {
2555
- return vec2(0.0, 0.0);
2556
- }
2557
- vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64));
2558
- vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z));
2559
-
2560
- vec2 t;
2561
- float q = floor(r.x / PI_2_FP64.x + 0.5);
2562
- int j = int(q);
2563
-
2564
-
2565
- if (j < -2 || j > 2) {
2566
- return vec2(0.0 / 0.0, 0.0 / 0.0);
2567
- }
2568
-
2569
- t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0)));
2570
-
2571
- q = floor(t.x / PI_16_FP64.x + 0.5);
2572
- int k = int(q);
2573
- int abs_k = int(abs(float(k)));
2574
-
2575
- if (abs_k > 4) {
2576
- return vec2(0.0 / 0.0, 0.0 / 0.0);
2577
- } else {
2578
- t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0)));
2579
- }
2580
-
2581
-
2582
- vec2 u = vec2(0.0, 0.0);
2583
- vec2 v = vec2(0.0, 0.0);
2584
-
2585
- vec2 sin_t, cos_t;
2586
- vec2 s, c;
2587
- sincos_taylor_fp64(t, sin_t, cos_t);
2588
-
2589
- if (k == 0) {
2590
- s = sin_t;
2591
- c = cos_t;
2592
- } else {
2593
- #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND)
2594
- if (abs(float(abs_k) - 1.0) < 0.5) {
2595
- u = COS_TABLE_0_FP64;
2596
- v = SIN_TABLE_0_FP64;
2597
- } else if (abs(float(abs_k) - 2.0) < 0.5) {
2598
- u = COS_TABLE_1_FP64;
2599
- v = SIN_TABLE_1_FP64;
2600
- } else if (abs(float(abs_k) - 3.0) < 0.5) {
2601
- u = COS_TABLE_2_FP64;
2602
- v = SIN_TABLE_2_FP64;
2603
- } else if (abs(float(abs_k) - 4.0) < 0.5) {
2604
- u = COS_TABLE_3_FP64;
2605
- v = SIN_TABLE_3_FP64;
2606
- }
2607
- #else
2608
- if (abs_k == 1) {
2609
- u = COS_TABLE_0_FP64;
2610
- v = SIN_TABLE_0_FP64;
2611
- } else if (abs_k == 2) {
2612
- u = COS_TABLE_1_FP64;
2613
- v = SIN_TABLE_1_FP64;
2614
- } else if (abs_k == 3) {
2615
- u = COS_TABLE_2_FP64;
2616
- v = SIN_TABLE_2_FP64;
2617
- } else if (abs_k == 4) {
2618
- u = COS_TABLE_3_FP64;
2619
- v = SIN_TABLE_3_FP64;
2620
- }
2621
- #endif
2622
- if (k > 0) {
2623
- s = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2624
- c = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2625
- } else {
2626
- s = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t));
2627
- c = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t));
2628
- }
2629
- }
2630
-
2631
- if (j == 0) {
2632
- sin_a = s;
2633
- cos_a = c;
2634
- } else if (j == 1) {
2635
- sin_a = c;
2636
- cos_a = -s;
2637
- } else if (j == -1) {
2638
- sin_a = -c;
2639
- cos_a = s;
2640
- } else {
2641
- sin_a = -s;
2642
- cos_a = -c;
2643
- }
2644
- return div_fp64(sin_a, cos_a);
2645
- }
2646
-
2647
- vec2 radians_fp64(vec2 degree) {
2648
- return mul_fp64(degree, PI_180_FP64);
2649
- }
2650
-
2651
- vec2 mix_fp64(vec2 a, vec2 b, float x) {
2652
- vec2 range = sub_fp64(b, a);
2653
- return sum_fp64(a, mul_fp64(range, vec2(x, 0.0)));
2654
- }
2655
-
2656
- void vec2_sum_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {
2657
- out_val[0] = sum_fp64(a[0], b[0]);
2658
- out_val[1] = sum_fp64(a[1], b[1]);
2659
- }
2660
-
2661
- void vec2_sub_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {
2662
- out_val[0] = sub_fp64(a[0], b[0]);
2663
- out_val[1] = sub_fp64(a[1], b[1]);
2664
- }
2665
-
2666
- void vec2_mul_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {
2667
- out_val[0] = mul_fp64(a[0], b[0]);
2668
- out_val[1] = mul_fp64(a[1], b[1]);
2669
- }
2670
-
2671
- void vec2_div_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) {
2672
- out_val[0] = div_fp64(a[0], b[0]);
2673
- out_val[1] = div_fp64(a[1], b[1]);
2674
- }
2675
-
2676
- void vec2_mix_fp64(vec2 x[2], vec2 y[2], float a, out vec2 out_val[2]) {
2677
- vec2 range[2];
2678
- vec2_sub_fp64(y, x, range);
2679
- vec2 portion[2];
2680
- portion[0] = range[0] * a;
2681
- portion[1] = range[1] * a;
2682
- vec2_sum_fp64(x, portion, out_val);
2683
- }
2684
-
2685
- vec2 vec2_length_fp64(vec2 x[2]) {
2686
- return sqrt_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])));
2687
- }
2688
-
2689
- void vec2_normalize_fp64(vec2 x[2], out vec2 out_val[2]) {
2690
- vec2 length = vec2_length_fp64(x);
2691
- vec2 length_vec2[2];
2692
- length_vec2[0] = length;
2693
- length_vec2[1] = length;
2694
-
2695
- vec2_div_fp64(x, length_vec2, out_val);
2696
- }
2697
-
2698
- vec2 vec2_distance_fp64(vec2 x[2], vec2 y[2]) {
2699
- vec2 diff[2];
2700
- vec2_sub_fp64(x, y, diff);
2701
- return vec2_length_fp64(diff);
2702
- }
2703
-
2704
- vec2 vec2_dot_fp64(vec2 a[2], vec2 b[2]) {
2705
- vec2 v[2];
2706
-
2707
- v[0] = mul_fp64(a[0], b[0]);
2708
- v[1] = mul_fp64(a[1], b[1]);
2709
-
2710
- return sum_fp64(v[0], v[1]);
2711
- }
2712
- void vec3_sub_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {
2713
- for (int i = 0; i < 3; i++) {
2714
- out_val[i] = sum_fp64(a[i], b[i]);
2715
- }
2716
- }
2717
-
2718
- void vec3_sum_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) {
2719
- for (int i = 0; i < 3; i++) {
2720
- out_val[i] = sum_fp64(a[i], b[i]);
2721
- }
2722
- }
2723
-
2724
- vec2 vec3_length_fp64(vec2 x[3]) {
2725
- return sqrt_fp64(sum_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])),
2726
- mul_fp64(x[2], x[2])));
2727
- }
2728
-
2729
- vec2 vec3_distance_fp64(vec2 x[3], vec2 y[3]) {
2730
- vec2 diff[3];
2731
- vec3_sub_fp64(x, y, diff);
2732
- return vec3_length_fp64(diff);
2733
- }
2734
- void vec4_fp64(vec4 a, out vec2 out_val[4]) {
2735
- out_val[0].x = a[0];
2736
- out_val[0].y = 0.0;
2737
-
2738
- out_val[1].x = a[1];
2739
- out_val[1].y = 0.0;
2740
-
2741
- out_val[2].x = a[2];
2742
- out_val[2].y = 0.0;
2743
-
2744
- out_val[3].x = a[3];
2745
- out_val[3].y = 0.0;
2746
- }
2747
-
2748
- void vec4_scalar_mul_fp64(vec2 a[4], vec2 b, out vec2 out_val[4]) {
2749
- out_val[0] = mul_fp64(a[0], b);
2750
- out_val[1] = mul_fp64(a[1], b);
2751
- out_val[2] = mul_fp64(a[2], b);
2752
- out_val[3] = mul_fp64(a[3], b);
2753
- }
2754
-
2755
- void vec4_sum_fp64(vec2 a[4], vec2 b[4], out vec2 out_val[4]) {
2756
- for (int i = 0; i < 4; i++) {
2757
- out_val[i] = sum_fp64(a[i], b[i]);
2758
- }
2759
- }
2760
-
2761
- void vec4_dot_fp64(vec2 a[4], vec2 b[4], out vec2 out_val) {
2762
- vec2 v[4];
2763
-
2764
- v[0] = mul_fp64(a[0], b[0]);
2765
- v[1] = mul_fp64(a[1], b[1]);
2766
- v[2] = mul_fp64(a[2], b[2]);
2767
- v[3] = mul_fp64(a[3], b[3]);
2768
-
2769
- out_val = sum_fp64(sum_fp64(v[0], v[1]), sum_fp64(v[2], v[3]));
2770
- }
2771
-
2772
- void mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) {
2773
- vec2 tmp[4];
2774
-
2775
- for (int i = 0; i < 4; i++)
2776
- {
2777
- for (int j = 0; j < 4; j++)
2778
- {
2779
- tmp[j] = b[j + i * 4];
2780
- }
2781
- vec4_dot_fp64(a, tmp, out_val[i]);
2782
- }
2783
- }
2784
- `);
1776
+ /* harmony default export */ __webpack_exports__["default"] = ("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);\nconst vec2 INVERSE_FACTORIAL_4_FP64 = vec2(4.16666679084301e-02, -1.2417634698280722e-09);\nconst vec2 INVERSE_FACTORIAL_5_FP64 = vec2(8.333333767950535e-03, -4.34617203337595e-10);\nconst vec2 INVERSE_FACTORIAL_6_FP64 = vec2(1.3888889225199819e-03, -3.3631094437103215e-11);\nconst vec2 INVERSE_FACTORIAL_7_FP64 = vec2(1.9841270113829523e-04, -2.725596874933456e-12);\nconst vec2 INVERSE_FACTORIAL_8_FP64 = vec2(2.4801587642286904e-05, -3.406996025904184e-13);\nconst vec2 INVERSE_FACTORIAL_9_FP64 = vec2(2.75573188446287533e-06, 3.7935713937038186e-14);\nconst vec2 INVERSE_FACTORIAL_10_FP64 = vec2(2.755731998149713e-07, -7.575112367869873e-15);\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\nvec2 exp_fp64(vec2 a) {\n\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\n\n\n\n\n s = sum_fp64(s, t);\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}\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\n\n\n\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\n\n\n\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 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 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 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 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\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}\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}\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");
2785
1777
  //# sourceMappingURL=fp64-functions.glsl.js.map
2786
1778
 
2787
1779
  /***/ }),
@@ -2798,7 +1790,9 @@ __webpack_require__.r(__webpack_exports__);
2798
1790
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64ify", function() { return fp64ify; });
2799
1791
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64LowPart", function() { return fp64LowPart; });
2800
1792
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64ifyMatrix4", function() { return fp64ifyMatrix4; });
2801
- function fp64ify(a, out = [], startIndex = 0) {
1793
+ function fp64ify(a) {
1794
+ let out = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
1795
+ let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
2802
1796
  const hiPart = Math.fround(a);
2803
1797
  const loPart = a - hiPart;
2804
1798
  out[startIndex] = hiPart;
@@ -2917,541 +1911,7 @@ __webpack_require__.r(__webpack_exports__);
2917
1911
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2918
1912
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2919
1913
  */
2920
- const fs = `
2921
- #define FXAA_QUALITY_PRESET 29
2922
-
2923
- #if (FXAA_QUALITY_PRESET == 10)
2924
- #define FXAA_QUALITY_PS 3
2925
- #define FXAA_QUALITY_P0 1.5
2926
- #define FXAA_QUALITY_P1 3.0
2927
- #define FXAA_QUALITY_P2 12.0
2928
- #endif
2929
- #if (FXAA_QUALITY_PRESET == 11)
2930
- #define FXAA_QUALITY_PS 4
2931
- #define FXAA_QUALITY_P0 1.0
2932
- #define FXAA_QUALITY_P1 1.5
2933
- #define FXAA_QUALITY_P2 3.0
2934
- #define FXAA_QUALITY_P3 12.0
2935
- #endif
2936
- #if (FXAA_QUALITY_PRESET == 12)
2937
- #define FXAA_QUALITY_PS 5
2938
- #define FXAA_QUALITY_P0 1.0
2939
- #define FXAA_QUALITY_P1 1.5
2940
- #define FXAA_QUALITY_P2 2.0
2941
- #define FXAA_QUALITY_P3 4.0
2942
- #define FXAA_QUALITY_P4 12.0
2943
- #endif
2944
- #if (FXAA_QUALITY_PRESET == 13)
2945
- #define FXAA_QUALITY_PS 6
2946
- #define FXAA_QUALITY_P0 1.0
2947
- #define FXAA_QUALITY_P1 1.5
2948
- #define FXAA_QUALITY_P2 2.0
2949
- #define FXAA_QUALITY_P3 2.0
2950
- #define FXAA_QUALITY_P4 4.0
2951
- #define FXAA_QUALITY_P5 12.0
2952
- #endif
2953
- #if (FXAA_QUALITY_PRESET == 14)
2954
- #define FXAA_QUALITY_PS 7
2955
- #define FXAA_QUALITY_P0 1.0
2956
- #define FXAA_QUALITY_P1 1.5
2957
- #define FXAA_QUALITY_P2 2.0
2958
- #define FXAA_QUALITY_P3 2.0
2959
- #define FXAA_QUALITY_P4 2.0
2960
- #define FXAA_QUALITY_P5 4.0
2961
- #define FXAA_QUALITY_P6 12.0
2962
- #endif
2963
- #if (FXAA_QUALITY_PRESET == 15)
2964
- #define FXAA_QUALITY_PS 8
2965
- #define FXAA_QUALITY_P0 1.0
2966
- #define FXAA_QUALITY_P1 1.5
2967
- #define FXAA_QUALITY_P2 2.0
2968
- #define FXAA_QUALITY_P3 2.0
2969
- #define FXAA_QUALITY_P4 2.0
2970
- #define FXAA_QUALITY_P5 2.0
2971
- #define FXAA_QUALITY_P6 4.0
2972
- #define FXAA_QUALITY_P7 12.0
2973
- #endif
2974
- #if (FXAA_QUALITY_PRESET == 20)
2975
- #define FXAA_QUALITY_PS 3
2976
- #define FXAA_QUALITY_P0 1.5
2977
- #define FXAA_QUALITY_P1 2.0
2978
- #define FXAA_QUALITY_P2 8.0
2979
- #endif
2980
- #if (FXAA_QUALITY_PRESET == 21)
2981
- #define FXAA_QUALITY_PS 4
2982
- #define FXAA_QUALITY_P0 1.0
2983
- #define FXAA_QUALITY_P1 1.5
2984
- #define FXAA_QUALITY_P2 2.0
2985
- #define FXAA_QUALITY_P3 8.0
2986
- #endif
2987
- #if (FXAA_QUALITY_PRESET == 22)
2988
- #define FXAA_QUALITY_PS 5
2989
- #define FXAA_QUALITY_P0 1.0
2990
- #define FXAA_QUALITY_P1 1.5
2991
- #define FXAA_QUALITY_P2 2.0
2992
- #define FXAA_QUALITY_P3 2.0
2993
- #define FXAA_QUALITY_P4 8.0
2994
- #endif
2995
- #if (FXAA_QUALITY_PRESET == 23)
2996
- #define FXAA_QUALITY_PS 6
2997
- #define FXAA_QUALITY_P0 1.0
2998
- #define FXAA_QUALITY_P1 1.5
2999
- #define FXAA_QUALITY_P2 2.0
3000
- #define FXAA_QUALITY_P3 2.0
3001
- #define FXAA_QUALITY_P4 2.0
3002
- #define FXAA_QUALITY_P5 8.0
3003
- #endif
3004
- #if (FXAA_QUALITY_PRESET == 24)
3005
- #define FXAA_QUALITY_PS 7
3006
- #define FXAA_QUALITY_P0 1.0
3007
- #define FXAA_QUALITY_P1 1.5
3008
- #define FXAA_QUALITY_P2 2.0
3009
- #define FXAA_QUALITY_P3 2.0
3010
- #define FXAA_QUALITY_P4 2.0
3011
- #define FXAA_QUALITY_P5 3.0
3012
- #define FXAA_QUALITY_P6 8.0
3013
- #endif
3014
- #if (FXAA_QUALITY_PRESET == 25)
3015
- #define FXAA_QUALITY_PS 8
3016
- #define FXAA_QUALITY_P0 1.0
3017
- #define FXAA_QUALITY_P1 1.5
3018
- #define FXAA_QUALITY_P2 2.0
3019
- #define FXAA_QUALITY_P3 2.0
3020
- #define FXAA_QUALITY_P4 2.0
3021
- #define FXAA_QUALITY_P5 2.0
3022
- #define FXAA_QUALITY_P6 4.0
3023
- #define FXAA_QUALITY_P7 8.0
3024
- #endif
3025
- #if (FXAA_QUALITY_PRESET == 26)
3026
- #define FXAA_QUALITY_PS 9
3027
- #define FXAA_QUALITY_P0 1.0
3028
- #define FXAA_QUALITY_P1 1.5
3029
- #define FXAA_QUALITY_P2 2.0
3030
- #define FXAA_QUALITY_P3 2.0
3031
- #define FXAA_QUALITY_P4 2.0
3032
- #define FXAA_QUALITY_P5 2.0
3033
- #define FXAA_QUALITY_P6 2.0
3034
- #define FXAA_QUALITY_P7 4.0
3035
- #define FXAA_QUALITY_P8 8.0
3036
- #endif
3037
- #if (FXAA_QUALITY_PRESET == 27)
3038
- #define FXAA_QUALITY_PS 10
3039
- #define FXAA_QUALITY_P0 1.0
3040
- #define FXAA_QUALITY_P1 1.5
3041
- #define FXAA_QUALITY_P2 2.0
3042
- #define FXAA_QUALITY_P3 2.0
3043
- #define FXAA_QUALITY_P4 2.0
3044
- #define FXAA_QUALITY_P5 2.0
3045
- #define FXAA_QUALITY_P6 2.0
3046
- #define FXAA_QUALITY_P7 2.0
3047
- #define FXAA_QUALITY_P8 4.0
3048
- #define FXAA_QUALITY_P9 8.0
3049
- #endif
3050
- #if (FXAA_QUALITY_PRESET == 28)
3051
- #define FXAA_QUALITY_PS 11
3052
- #define FXAA_QUALITY_P0 1.0
3053
- #define FXAA_QUALITY_P1 1.5
3054
- #define FXAA_QUALITY_P2 2.0
3055
- #define FXAA_QUALITY_P3 2.0
3056
- #define FXAA_QUALITY_P4 2.0
3057
- #define FXAA_QUALITY_P5 2.0
3058
- #define FXAA_QUALITY_P6 2.0
3059
- #define FXAA_QUALITY_P7 2.0
3060
- #define FXAA_QUALITY_P8 2.0
3061
- #define FXAA_QUALITY_P9 4.0
3062
- #define FXAA_QUALITY_P10 8.0
3063
- #endif
3064
- #if (FXAA_QUALITY_PRESET == 29)
3065
- #define FXAA_QUALITY_PS 12
3066
- #define FXAA_QUALITY_P0 1.0
3067
- #define FXAA_QUALITY_P1 1.5
3068
- #define FXAA_QUALITY_P2 2.0
3069
- #define FXAA_QUALITY_P3 2.0
3070
- #define FXAA_QUALITY_P4 2.0
3071
- #define FXAA_QUALITY_P5 2.0
3072
- #define FXAA_QUALITY_P6 2.0
3073
- #define FXAA_QUALITY_P7 2.0
3074
- #define FXAA_QUALITY_P8 2.0
3075
- #define FXAA_QUALITY_P9 2.0
3076
- #define FXAA_QUALITY_P10 4.0
3077
- #define FXAA_QUALITY_P11 8.0
3078
- #endif
3079
- #if (FXAA_QUALITY_PRESET == 39)
3080
- #define FXAA_QUALITY_PS 12
3081
- #define FXAA_QUALITY_P0 1.0
3082
- #define FXAA_QUALITY_P1 1.0
3083
- #define FXAA_QUALITY_P2 1.0
3084
- #define FXAA_QUALITY_P3 1.0
3085
- #define FXAA_QUALITY_P4 1.0
3086
- #define FXAA_QUALITY_P5 1.5
3087
- #define FXAA_QUALITY_P6 2.0
3088
- #define FXAA_QUALITY_P7 2.0
3089
- #define FXAA_QUALITY_P8 2.0
3090
- #define FXAA_QUALITY_P9 2.0
3091
- #define FXAA_QUALITY_P10 4.0
3092
- #define FXAA_QUALITY_P11 8.0
3093
- #endif
3094
-
3095
- #define FxaaBool bool
3096
- #define FxaaFloat float
3097
- #define FxaaFloat2 vec2
3098
- #define FxaaFloat3 vec3
3099
- #define FxaaFloat4 vec4
3100
- #define FxaaHalf float
3101
- #define FxaaHalf2 vec2
3102
- #define FxaaHalf3 vec3
3103
- #define FxaaHalf4 vec4
3104
- #define FxaaInt2 vec2
3105
- #define FxaaTex sampler2D
3106
-
3107
- #define FxaaSat(x) clamp(x, 0.0, 1.0)
3108
- #define FxaaTexTop(t, p) texture2D(t, p)
3109
- #define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))
3110
-
3111
- FxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }
3112
-
3113
- FxaaFloat4 FxaaPixelShader_(
3114
-
3115
-
3116
- FxaaFloat2 pos,
3117
-
3118
-
3119
-
3120
-
3121
- FxaaTex tex,
3122
-
3123
-
3124
-
3125
-
3126
- FxaaFloat2 fxaaQualityRcpFrame,
3127
-
3128
-
3129
-
3130
-
3131
-
3132
-
3133
-
3134
-
3135
-
3136
-
3137
- FxaaFloat fxaaQualitySubpix,
3138
-
3139
-
3140
-
3141
-
3142
-
3143
-
3144
-
3145
-
3146
-
3147
- FxaaFloat fxaaQualityEdgeThreshold,
3148
-
3149
-
3150
-
3151
-
3152
-
3153
-
3154
-
3155
-
3156
-
3157
-
3158
-
3159
-
3160
-
3161
- FxaaFloat fxaaQualityEdgeThresholdMin
3162
- ) {
3163
- FxaaFloat2 posM;
3164
- posM.x = pos.x;
3165
- posM.y = pos.y;
3166
- FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
3167
- #define lumaM rgbyM.y
3168
- FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
3169
- FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
3170
- FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
3171
- FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
3172
- FxaaFloat maxSM = max(lumaS, lumaM);
3173
- FxaaFloat minSM = min(lumaS, lumaM);
3174
- FxaaFloat maxESM = max(lumaE, maxSM);
3175
- FxaaFloat minESM = min(lumaE, minSM);
3176
- FxaaFloat maxWN = max(lumaN, lumaW);
3177
- FxaaFloat minWN = min(lumaN, lumaW);
3178
- FxaaFloat rangeMax = max(maxWN, maxESM);
3179
- FxaaFloat rangeMin = min(minWN, minESM);
3180
- FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
3181
- FxaaFloat range = rangeMax - rangeMin;
3182
- FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
3183
- FxaaBool earlyExit = range < rangeMaxClamped;
3184
- if(earlyExit)
3185
- return rgbyM;
3186
- FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
3187
- FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
3188
- FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
3189
- FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
3190
- FxaaFloat lumaNS = lumaN + lumaS;
3191
- FxaaFloat lumaWE = lumaW + lumaE;
3192
- FxaaFloat subpixRcpRange = 1.0/range;
3193
- FxaaFloat subpixNSWE = lumaNS + lumaWE;
3194
- FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
3195
- FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
3196
- FxaaFloat lumaNESE = lumaNE + lumaSE;
3197
- FxaaFloat lumaNWNE = lumaNW + lumaNE;
3198
- FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
3199
- FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
3200
- FxaaFloat lumaNWSW = lumaNW + lumaSW;
3201
- FxaaFloat lumaSWSE = lumaSW + lumaSE;
3202
- FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
3203
- FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
3204
- FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
3205
- FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
3206
- FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
3207
- FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
3208
- FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
3209
- FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
3210
- FxaaBool horzSpan = edgeHorz >= edgeVert;
3211
- FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
3212
- if(!horzSpan) lumaN = lumaW;
3213
- if(!horzSpan) lumaS = lumaE;
3214
- if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
3215
- FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
3216
- FxaaFloat gradientN = lumaN - lumaM;
3217
- FxaaFloat gradientS = lumaS - lumaM;
3218
- FxaaFloat lumaNN = lumaN + lumaM;
3219
- FxaaFloat lumaSS = lumaS + lumaM;
3220
- FxaaBool pairN = abs(gradientN) >= abs(gradientS);
3221
- FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
3222
- if(pairN) lengthSign = -lengthSign;
3223
- FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
3224
- FxaaFloat2 posB;
3225
- posB.x = posM.x;
3226
- posB.y = posM.y;
3227
- FxaaFloat2 offNP;
3228
- offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
3229
- offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
3230
- if(!horzSpan) posB.x += lengthSign * 0.5;
3231
- if( horzSpan) posB.y += lengthSign * 0.5;
3232
- FxaaFloat2 posN;
3233
- posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;
3234
- posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;
3235
- FxaaFloat2 posP;
3236
- posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;
3237
- posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;
3238
- FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
3239
- FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));
3240
- FxaaFloat subpixE = subpixC * subpixC;
3241
- FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));
3242
- if(!pairN) lumaNN = lumaSS;
3243
- FxaaFloat gradientScaled = gradient * 1.0/4.0;
3244
- FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
3245
- FxaaFloat subpixF = subpixD * subpixE;
3246
- FxaaBool lumaMLTZero = lumaMM < 0.0;
3247
- lumaEndN -= lumaNN * 0.5;
3248
- lumaEndP -= lumaNN * 0.5;
3249
- FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
3250
- FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
3251
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;
3252
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;
3253
- FxaaBool doneNP = (!doneN) || (!doneP);
3254
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;
3255
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;
3256
- if(doneNP) {
3257
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3258
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3259
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3260
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3261
- doneN = abs(lumaEndN) >= gradientScaled;
3262
- doneP = abs(lumaEndP) >= gradientScaled;
3263
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;
3264
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;
3265
- doneNP = (!doneN) || (!doneP);
3266
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;
3267
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;
3268
- #if (FXAA_QUALITY_PS > 3)
3269
- if(doneNP) {
3270
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3271
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3272
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3273
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3274
- doneN = abs(lumaEndN) >= gradientScaled;
3275
- doneP = abs(lumaEndP) >= gradientScaled;
3276
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;
3277
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;
3278
- doneNP = (!doneN) || (!doneP);
3279
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;
3280
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;
3281
- #if (FXAA_QUALITY_PS > 4)
3282
- if(doneNP) {
3283
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3284
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3285
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3286
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3287
- doneN = abs(lumaEndN) >= gradientScaled;
3288
- doneP = abs(lumaEndP) >= gradientScaled;
3289
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;
3290
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;
3291
- doneNP = (!doneN) || (!doneP);
3292
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;
3293
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;
3294
- #if (FXAA_QUALITY_PS > 5)
3295
- if(doneNP) {
3296
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3297
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3298
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3299
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3300
- doneN = abs(lumaEndN) >= gradientScaled;
3301
- doneP = abs(lumaEndP) >= gradientScaled;
3302
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;
3303
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;
3304
- doneNP = (!doneN) || (!doneP);
3305
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;
3306
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;
3307
- #if (FXAA_QUALITY_PS > 6)
3308
- if(doneNP) {
3309
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3310
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3311
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3312
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3313
- doneN = abs(lumaEndN) >= gradientScaled;
3314
- doneP = abs(lumaEndP) >= gradientScaled;
3315
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;
3316
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;
3317
- doneNP = (!doneN) || (!doneP);
3318
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;
3319
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;
3320
- #if (FXAA_QUALITY_PS > 7)
3321
- if(doneNP) {
3322
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3323
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3324
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3325
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3326
- doneN = abs(lumaEndN) >= gradientScaled;
3327
- doneP = abs(lumaEndP) >= gradientScaled;
3328
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;
3329
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;
3330
- doneNP = (!doneN) || (!doneP);
3331
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;
3332
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;
3333
- #if (FXAA_QUALITY_PS > 8)
3334
- if(doneNP) {
3335
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3336
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3337
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3338
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3339
- doneN = abs(lumaEndN) >= gradientScaled;
3340
- doneP = abs(lumaEndP) >= gradientScaled;
3341
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;
3342
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;
3343
- doneNP = (!doneN) || (!doneP);
3344
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;
3345
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;
3346
- #if (FXAA_QUALITY_PS > 9)
3347
- if(doneNP) {
3348
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3349
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3350
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3351
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3352
- doneN = abs(lumaEndN) >= gradientScaled;
3353
- doneP = abs(lumaEndP) >= gradientScaled;
3354
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;
3355
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;
3356
- doneNP = (!doneN) || (!doneP);
3357
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;
3358
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;
3359
- #if (FXAA_QUALITY_PS > 10)
3360
- if(doneNP) {
3361
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3362
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3363
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3364
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3365
- doneN = abs(lumaEndN) >= gradientScaled;
3366
- doneP = abs(lumaEndP) >= gradientScaled;
3367
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;
3368
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;
3369
- doneNP = (!doneN) || (!doneP);
3370
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;
3371
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;
3372
- #if (FXAA_QUALITY_PS > 11)
3373
- if(doneNP) {
3374
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3375
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3376
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3377
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3378
- doneN = abs(lumaEndN) >= gradientScaled;
3379
- doneP = abs(lumaEndP) >= gradientScaled;
3380
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;
3381
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;
3382
- doneNP = (!doneN) || (!doneP);
3383
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;
3384
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;
3385
- #if (FXAA_QUALITY_PS > 12)
3386
- if(doneNP) {
3387
- if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));
3388
- if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));
3389
- if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
3390
- if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
3391
- doneN = abs(lumaEndN) >= gradientScaled;
3392
- doneP = abs(lumaEndP) >= gradientScaled;
3393
- if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;
3394
- if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;
3395
- doneNP = (!doneN) || (!doneP);
3396
- if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;
3397
- if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;
3398
- }
3399
- #endif
3400
- }
3401
- #endif
3402
- }
3403
- #endif
3404
- }
3405
- #endif
3406
- }
3407
- #endif
3408
- }
3409
- #endif
3410
- }
3411
- #endif
3412
- }
3413
- #endif
3414
- }
3415
- #endif
3416
- }
3417
- #endif
3418
- }
3419
- FxaaFloat dstN = posM.x - posN.x;
3420
- FxaaFloat dstP = posP.x - posM.x;
3421
- if(!horzSpan) dstN = posM.y - posN.y;
3422
- if(!horzSpan) dstP = posP.y - posM.y;
3423
- FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
3424
- FxaaFloat spanLength = (dstP + dstN);
3425
- FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
3426
- FxaaFloat spanLengthRcp = 1.0/spanLength;
3427
- FxaaBool directionN = dstN < dstP;
3428
- FxaaFloat dst = min(dstN, dstP);
3429
- FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
3430
- FxaaFloat subpixG = subpixF * subpixF;
3431
- FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
3432
- FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
3433
- FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
3434
- FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
3435
- if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
3436
- if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
3437
- return FxaaTexTop(tex, posM);
3438
- }
3439
-
3440
- vec4 fxaa_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3441
- const float fxaa_QualitySubpix = 0.5;
3442
- const float fxaa_QualityEdgeThreshold = 0.125;
3443
- const float fxaa_QualityEdgeThresholdMin = 0.0833;
3444
-
3445
- return FxaaPixelShader_(
3446
- texCoord,
3447
- texture,
3448
- vec2(1.0) / texSize,
3449
- fxaa_QualitySubpix,
3450
- fxaa_QualityEdgeThreshold,
3451
- fxaa_QualityEdgeThresholdMin
3452
- );
3453
- }
3454
- `;
1914
+ const fs = "\n#define FXAA_QUALITY_PRESET 29\n\n#if (FXAA_QUALITY_PRESET == 10)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 3.0\n #define FXAA_QUALITY_P2 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 11)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 3.0\n #define FXAA_QUALITY_P3 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 12)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 4.0\n #define FXAA_QUALITY_P4 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 13)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 4.0\n #define FXAA_QUALITY_P5 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 14)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 4.0\n #define FXAA_QUALITY_P6 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 15)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 12.0\n#endif\n#if (FXAA_QUALITY_PRESET == 20)\n #define FXAA_QUALITY_PS 3\n #define FXAA_QUALITY_P0 1.5\n #define FXAA_QUALITY_P1 2.0\n #define FXAA_QUALITY_P2 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 21)\n #define FXAA_QUALITY_PS 4\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 22)\n #define FXAA_QUALITY_PS 5\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 23)\n #define FXAA_QUALITY_PS 6\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 24)\n #define FXAA_QUALITY_PS 7\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 3.0\n #define FXAA_QUALITY_P6 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 25)\n #define FXAA_QUALITY_PS 8\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 4.0\n #define FXAA_QUALITY_P7 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 26)\n #define FXAA_QUALITY_PS 9\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 4.0\n #define FXAA_QUALITY_P8 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 27)\n #define FXAA_QUALITY_PS 10\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 4.0\n #define FXAA_QUALITY_P9 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 28)\n #define FXAA_QUALITY_PS 11\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 4.0\n #define FXAA_QUALITY_P10 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 29)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.5\n #define FXAA_QUALITY_P2 2.0\n #define FXAA_QUALITY_P3 2.0\n #define FXAA_QUALITY_P4 2.0\n #define FXAA_QUALITY_P5 2.0\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n#if (FXAA_QUALITY_PRESET == 39)\n #define FXAA_QUALITY_PS 12\n #define FXAA_QUALITY_P0 1.0\n #define FXAA_QUALITY_P1 1.0\n #define FXAA_QUALITY_P2 1.0\n #define FXAA_QUALITY_P3 1.0\n #define FXAA_QUALITY_P4 1.0\n #define FXAA_QUALITY_P5 1.5\n #define FXAA_QUALITY_P6 2.0\n #define FXAA_QUALITY_P7 2.0\n #define FXAA_QUALITY_P8 2.0\n #define FXAA_QUALITY_P9 2.0\n #define FXAA_QUALITY_P10 4.0\n #define FXAA_QUALITY_P11 8.0\n#endif\n\n#define FxaaBool bool\n#define FxaaFloat float\n#define FxaaFloat2 vec2\n#define FxaaFloat3 vec3\n#define FxaaFloat4 vec4\n#define FxaaHalf float\n#define FxaaHalf2 vec2\n#define FxaaHalf3 vec3\n#define FxaaHalf4 vec4\n#define FxaaInt2 vec2\n#define FxaaTex sampler2D\n\n#define FxaaSat(x) clamp(x, 0.0, 1.0)\n#define FxaaTexTop(t, p) texture2D(t, p)\n#define FxaaTexOff(t, p, o, r) texture2D(t, p + (o * r))\n\nFxaaFloat FxaaLuma_(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n\nFxaaFloat4 FxaaPixelShader_(\n\n\n FxaaFloat2 pos,\n\n\n\n\n FxaaTex tex,\n\n\n\n\n FxaaFloat2 fxaaQualityRcpFrame,\n\n\n\n\n\n\n\n\n\n\n FxaaFloat fxaaQualitySubpix,\n\n\n\n\n\n\n\n\n\n FxaaFloat fxaaQualityEdgeThreshold,\n\n\n\n\n\n\n\n\n\n\n\n\n\n FxaaFloat fxaaQualityEdgeThresholdMin\n) {\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #define lumaM rgbyM.y\n FxaaFloat lumaS = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n if(earlyExit)\n return rgbyM;\n FxaaFloat lumaNW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma_(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY_P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY_P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY_P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY_P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP));\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P1;\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P2;\n #if (FXAA_QUALITY_PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P3;\n #if (FXAA_QUALITY_PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P4;\n #if (FXAA_QUALITY_PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P5;\n #if (FXAA_QUALITY_PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P6;\n #if (FXAA_QUALITY_PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P7;\n #if (FXAA_QUALITY_PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P8;\n #if (FXAA_QUALITY_PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P9;\n #if (FXAA_QUALITY_PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P10;\n #if (FXAA_QUALITY_PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P11;\n #if (FXAA_QUALITY_PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma_(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma_(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY_P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY_P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY_P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY_P12;\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n #endif\n }\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n return FxaaTexTop(tex, posM);\n}\n\nvec4 fxaa_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n const float fxaa_QualitySubpix = 0.5;\n const float fxaa_QualityEdgeThreshold = 0.125;\n const float fxaa_QualityEdgeThresholdMin = 0.0833;\n\n return FxaaPixelShader_(\n texCoord,\n texture,\n vec2(1.0) / texSize,\n fxaa_QualitySubpix,\n fxaa_QualityEdgeThreshold,\n fxaa_QualityEdgeThresholdMin\n );\n}\n";
3455
1915
  const fxaa = {
3456
1916
  name: 'fxaa',
3457
1917
  uniforms: {},
@@ -3474,24 +1934,7 @@ const fxaa = {
3474
1934
  "use strict";
3475
1935
  __webpack_require__.r(__webpack_exports__);
3476
1936
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "brightnessContrast", function() { return brightnessContrast; });
3477
- const fs = `\
3478
- uniform float brightness;
3479
- uniform float contrast;
3480
-
3481
- vec4 brightnessContrast_filterColor(vec4 color) {
3482
- color.rgb += brightness;
3483
- if (contrast > 0.0) {
3484
- color.rgb = (color.rgb - 0.5) / (1.0 - contrast) + 0.5;
3485
- } else {
3486
- color.rgb = (color.rgb - 0.5) * (1.0 + contrast) + 0.5;
3487
- }
3488
- return color;
3489
- }
3490
-
3491
- vec4 brightnessContrast_filterColor(vec4 color, vec2 texSize, vec2 texCoords) {
3492
- return brightnessContrast_filterColor(color);
3493
- }
3494
- `;
1937
+ const fs = "uniform float brightness;\nuniform float contrast;\n\nvec4 brightnessContrast_filterColor(vec4 color) {\n color.rgb += brightness;\n if (contrast > 0.0) {\n color.rgb = (color.rgb - 0.5) / (1.0 - contrast) + 0.5;\n } else {\n color.rgb = (color.rgb - 0.5) * (1.0 + contrast) + 0.5;\n }\n return color;\n}\n\nvec4 brightnessContrast_filterColor(vec4 color, vec2 texSize, vec2 texCoords) {\n return brightnessContrast_filterColor(color);\n}\n";
3495
1938
  const uniforms = {
3496
1939
  brightness: {
3497
1940
  value: 0,
@@ -3526,28 +1969,7 @@ const brightnessContrast = {
3526
1969
  "use strict";
3527
1970
  __webpack_require__.r(__webpack_exports__);
3528
1971
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "denoise", function() { return denoise; });
3529
- const fs = `\
3530
- uniform float strength;
3531
-
3532
- vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3533
- float adjustedExponent = 3. + 200. * pow(1. - strength, 4.);
3534
-
3535
- vec4 center = texture2D(texture, texCoord);
3536
- vec4 color = vec4(0.0);
3537
- float total = 0.0;
3538
- for (float x = -4.0; x <= 4.0; x += 1.0) {
3539
- for (float y = -4.0; y <= 4.0; y += 1.0) {
3540
- vec4 sample = texture2D(texture, texCoord + vec2(x, y) / texSize);
3541
- float weight = 1.0 - abs(dot(sample.rgb - center.rgb, vec3(0.25)));
3542
- weight = pow(weight, adjustedExponent);
3543
- color += sample * weight;
3544
- total += weight;
3545
- }
3546
- }
3547
-
3548
- return color / total;
3549
- }
3550
- `;
1972
+ const fs = "uniform float strength;\n\nvec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n float adjustedExponent = 3. + 200. * pow(1. - strength, 4.);\n\n vec4 center = texture2D(texture, texCoord);\n vec4 color = vec4(0.0);\n float total = 0.0;\n for (float x = -4.0; x <= 4.0; x += 1.0) {\n for (float y = -4.0; y <= 4.0; y += 1.0) {\n vec4 sample = texture2D(texture, texCoord + vec2(x, y) / texSize);\n float weight = 1.0 - abs(dot(sample.rgb - center.rgb, vec3(0.25)));\n weight = pow(weight, adjustedExponent);\n color += sample * weight;\n total += weight;\n }\n }\n\n return color / total;\n}\n";
3551
1973
  const uniforms = {
3552
1974
  strength: {
3553
1975
  value: 0.5,
@@ -3580,34 +2002,7 @@ const denoise = {
3580
2002
  "use strict";
3581
2003
  __webpack_require__.r(__webpack_exports__);
3582
2004
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hueSaturation", function() { return hueSaturation; });
3583
- const fs = `\
3584
- uniform float hue;
3585
- uniform float saturation;
3586
-
3587
- vec4 hueSaturation_filterColor(vec4 color) {
3588
- float angle = hue * 3.14159265;
3589
- float s = sin(angle), c = cos(angle);
3590
- vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;
3591
- float len = length(color.rgb);
3592
- color.rgb = vec3(
3593
- dot(color.rgb, weights.xyz),
3594
- dot(color.rgb, weights.zxy),
3595
- dot(color.rgb, weights.yzx)
3596
- );
3597
- float average = (color.r + color.g + color.b) / 3.0;
3598
- if (saturation > 0.0) {
3599
- color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - saturation));
3600
- } else {
3601
- color.rgb += (average - color.rgb) * (-saturation);
3602
- }
3603
-
3604
- return color;
3605
- }
3606
-
3607
- vec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
3608
- return hueSaturation_filterColor(color);
3609
- }
3610
- `;
2005
+ const fs = "uniform float hue;\nuniform float saturation;\n\nvec4 hueSaturation_filterColor(vec4 color) {\n float angle = hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(color.rgb);\n color.rgb = vec3(\n dot(color.rgb, weights.xyz),\n dot(color.rgb, weights.zxy),\n dot(color.rgb, weights.yzx)\n );\n float average = (color.r + color.g + color.b) / 3.0;\n if (saturation > 0.0) {\n color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - saturation));\n } else {\n color.rgb += (average - color.rgb) * (-saturation);\n }\n\n return color;\n}\n\nvec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n return hueSaturation_filterColor(color);\n}\n";
3611
2006
  const uniforms = {
3612
2007
  hue: {
3613
2008
  value: 0,
@@ -3642,25 +2037,7 @@ const hueSaturation = {
3642
2037
  "use strict";
3643
2038
  __webpack_require__.r(__webpack_exports__);
3644
2039
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noise", function() { return noise; });
3645
- const fs = `\
3646
- uniform float amount;
3647
-
3648
- float rand(vec2 co) {
3649
- return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
3650
- }
3651
-
3652
- vec4 noise_filterColor(vec4 color, vec2 texCoord) {
3653
- float diff = (rand(texCoord) - 0.5) * amount;
3654
- color.r += diff;
3655
- color.g += diff;
3656
- color.b += diff;
3657
- return color;
3658
- }
3659
-
3660
- vec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
3661
- return noise_filterColor(color, texCoord);
3662
- }
3663
- `;
2040
+ const fs = "uniform float amount;\n\nfloat rand(vec2 co) {\n return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\n}\n\nvec4 noise_filterColor(vec4 color, vec2 texCoord) {\n float diff = (rand(texCoord) - 0.5) * amount;\n color.r += diff;\n color.g += diff;\n color.b += diff;\n return color;\n}\n\nvec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n return noise_filterColor(color, texCoord);\n}\n";
3664
2041
  const uniforms = {
3665
2042
  amount: {
3666
2043
  value: 0.5,
@@ -3690,26 +2067,7 @@ const noise = {
3690
2067
  "use strict";
3691
2068
  __webpack_require__.r(__webpack_exports__);
3692
2069
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sepia", function() { return sepia; });
3693
- const fs = `\
3694
- uniform float amount;
3695
-
3696
- vec4 sepia_filterColor(vec4 color) {
3697
- float r = color.r;
3698
- float g = color.g;
3699
- float b = color.b;
3700
-
3701
- color.r =
3702
- min(1.0, (r * (1.0 - (0.607 * amount))) + (g * (0.769 * amount)) + (b * (0.189 * amount)));
3703
- color.g = min(1.0, (r * 0.349 * amount) + (g * (1.0 - (0.314 * amount))) + (b * 0.168 * amount));
3704
- color.b = min(1.0, (r * 0.272 * amount) + (g * 0.534 * amount) + (b * (1.0 - (0.869 * amount))));
3705
-
3706
- return color;
3707
- }
3708
-
3709
- vec4 sepia_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
3710
- return sepia_filterColor(color);
3711
- }
3712
- `;
2070
+ const fs = "uniform float amount;\n\nvec4 sepia_filterColor(vec4 color) {\n float r = color.r;\n float g = color.g;\n float b = color.b;\n\n color.r =\n min(1.0, (r * (1.0 - (0.607 * amount))) + (g * (0.769 * amount)) + (b * (0.189 * amount)));\n color.g = min(1.0, (r * 0.349 * amount) + (g * (1.0 - (0.314 * amount))) + (b * 0.168 * amount));\n color.b = min(1.0, (r * 0.272 * amount) + (g * 0.534 * amount) + (b * (1.0 - (0.869 * amount))));\n\n return color;\n}\n\nvec4 sepia_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n return sepia_filterColor(color);\n}\n";
3713
2071
  const uniforms = {
3714
2072
  amount: {
3715
2073
  value: 0.5,
@@ -3739,21 +2097,7 @@ const sepia = {
3739
2097
  "use strict";
3740
2098
  __webpack_require__.r(__webpack_exports__);
3741
2099
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vibrance", function() { return vibrance; });
3742
- const fs = `\
3743
- uniform float amount;
3744
-
3745
- vec4 vibrance_filterColor(vec4 color) {
3746
- float average = (color.r + color.g + color.b) / 3.0;
3747
- float mx = max(color.r, max(color.g, color.b));
3748
- float amt = (mx - average) * (-amount * 3.0);
3749
- color.rgb = mix(color.rgb, vec3(mx), amt);
3750
- return color;
3751
- }
3752
-
3753
- vec4 vibrance_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
3754
- return vibrance_filterColor(color);
3755
- }
3756
- `;
2100
+ const fs = "uniform float amount;\n\nvec4 vibrance_filterColor(vec4 color) {\n float average = (color.r + color.g + color.b) / 3.0;\n float mx = max(color.r, max(color.g, color.b));\n float amt = (mx - average) * (-amount * 3.0);\n color.rgb = mix(color.rgb, vec3(mx), amt);\n return color;\n}\n\nvec4 vibrance_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n return vibrance_filterColor(color);\n}\n";
3757
2101
  const uniforms = {
3758
2102
  amount: {
3759
2103
  value: 0,
@@ -3783,20 +2127,7 @@ const vibrance = {
3783
2127
  "use strict";
3784
2128
  __webpack_require__.r(__webpack_exports__);
3785
2129
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vignette", function() { return vignette; });
3786
- const fs = `\
3787
- uniform float radius;
3788
- uniform float amount;
3789
-
3790
- vec4 vignette_filterColor(vec4 color, vec2 texCoord) {
3791
- float dist = distance(texCoord, vec2(0.5, 0.5));
3792
- float ratio = smoothstep(0.8, radius * 0.799, dist * (amount + radius));
3793
- return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);
3794
- }
3795
-
3796
- vec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
3797
- return vignette_filterColor(color, texCoord);
3798
- }
3799
- `;
2130
+ const fs = "uniform float radius;\nuniform float amount;\n\nvec4 vignette_filterColor(vec4 color, vec2 texCoord) {\n float dist = distance(texCoord, vec2(0.5, 0.5));\n float ratio = smoothstep(0.8, radius * 0.799, dist * (amount + radius));\n return color.rgba * ratio + (1.0 - ratio)*vec4(0.0, 0.0, 0.0, 1.0);\n}\n\nvec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n return vignette_filterColor(color, texCoord);\n}\n";
3800
2131
  const uniforms = {
3801
2132
  radius: {
3802
2133
  value: 0.5,
@@ -3833,43 +2164,7 @@ __webpack_require__.r(__webpack_exports__);
3833
2164
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tiltShift", function() { return tiltShift; });
3834
2165
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
3835
2166
 
3836
- const fs = `\
3837
- uniform float blurRadius;
3838
- uniform float gradientRadius;
3839
- uniform vec2 start;
3840
- uniform vec2 end;
3841
- uniform bool invert;
3842
-
3843
- vec2 tiltShift_getDelta(vec2 texSize) {
3844
- vec2 vector = normalize((end - start) * texSize);
3845
- return invert ? vec2(-vector.y, vector.x) : vector;
3846
- }
3847
-
3848
- vec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3849
- vec4 color = vec4(0.0);
3850
- float total = 0.0;
3851
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
3852
-
3853
- vec2 normal = normalize(vec2((start.y - end.y) * texSize.y, (end.x - start.x) * texSize.x));
3854
- float radius = smoothstep(0.0, 1.0,
3855
- abs(dot(texCoord * texSize - start * texSize, normal)) / gradientRadius) * blurRadius;
3856
-
3857
- for (float t = -30.0; t <= 30.0; t++) {
3858
- float percent = (t + offset - 0.5) / 30.0;
3859
- float weight = 1.0 - abs(percent);
3860
- vec4 sample = texture2D(texture, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);
3861
- sample.rgb *= sample.a;
3862
-
3863
- color += sample * weight;
3864
- total += weight;
3865
- }
3866
-
3867
- color = color / total;
3868
- color.rgb /= color.a + 0.00001;
3869
-
3870
- return color;
3871
- }
3872
- `;
2167
+ const fs = "uniform float blurRadius;\nuniform float gradientRadius;\nuniform vec2 start;\nuniform vec2 end;\nuniform bool invert;\n\nvec2 tiltShift_getDelta(vec2 texSize) {\n vec2 vector = normalize((end - start) * texSize);\n return invert ? vec2(-vector.y, vector.x) : vector;\n}\n\nvec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n vec2 normal = normalize(vec2((start.y - end.y) * texSize.y, (end.x - start.x) * texSize.x));\n float radius = smoothstep(0.0, 1.0,\n abs(dot(texCoord * texSize - start * texSize, normal)) / gradientRadius) * blurRadius;\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(texture, texCoord + tiltShift_getDelta(texSize) / texSize * percent * radius);\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n }\n\n color = color / total;\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n";
3873
2168
  const uniforms = {
3874
2169
  blurRadius: {
3875
2170
  value: 15,
@@ -3921,33 +2216,7 @@ __webpack_require__.r(__webpack_exports__);
3921
2216
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "triangleBlur", function() { return triangleBlur; });
3922
2217
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
3923
2218
 
3924
- const fs = `\
3925
- uniform float radius;
3926
- uniform vec2 delta;
3927
-
3928
- vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
3929
- vec2 adjustedDelta = delta * radius / texSize;
3930
-
3931
- vec4 color = vec4(0.0);
3932
- float total = 0.0;
3933
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
3934
-
3935
- for (float t = -30.0; t <= 30.0; t++) {
3936
- float percent = (t + offset - 0.5) / 30.0;
3937
- float weight = 1.0 - abs(percent);
3938
- vec4 sample = texture2D(texture, texCoord + adjustedDelta * percent);
3939
- sample.rgb *= sample.a;
3940
-
3941
- color += sample * weight;
3942
- total += weight;
3943
- }
3944
-
3945
- color = color / total;
3946
- color.rgb /= color.a + 0.00001;
3947
-
3948
- return color;
3949
- }
3950
- `;
2219
+ const fs = "uniform float radius;\nuniform vec2 delta;\n\nvec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 adjustedDelta = delta * radius / texSize;\n\n vec4 color = vec4(0.0);\n float total = 0.0;\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec4 sample = texture2D(texture, texCoord + adjustedDelta * percent);\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n }\n\n color = color / total;\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n";
3951
2220
  const uniforms = {
3952
2221
  radius: {
3953
2222
  value: 20,
@@ -3992,32 +2261,7 @@ __webpack_require__.r(__webpack_exports__);
3992
2261
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zoomBlur", function() { return zoomBlur; });
3993
2262
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
3994
2263
 
3995
- const fs = `
3996
- uniform vec2 center;
3997
- uniform float strength;
3998
-
3999
- vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
4000
- vec4 color = vec4(0.0);
4001
- float total = 0.0;
4002
- vec2 toCenter = center * texSize - texCoord * texSize;
4003
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
4004
-
4005
- for (float t = 0.0; t <= 40.0; t++) {
4006
- float percent = (t + offset) / 40.0;
4007
- float weight = 4.0 * (percent - percent * percent);
4008
- vec4 sample = texture2D(texture, texCoord + toCenter * percent * strength / texSize);
4009
- sample.rgb *= sample.a;
4010
-
4011
- color += sample * weight;
4012
- total += weight;
4013
- }
4014
-
4015
- color = color / total;
4016
- color.rgb /= color.a + 0.00001;
4017
-
4018
- return color;
4019
- }
4020
- `;
2264
+ const fs = "\nuniform vec2 center;\nuniform float strength;\n\nvec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec4 color = vec4(0.0);\n float total = 0.0;\n vec2 toCenter = center * texSize - texCoord * texSize;\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = 0.0; t <= 40.0; t++) {\n float percent = (t + offset) / 40.0;\n float weight = 4.0 * (percent - percent * percent);\n vec4 sample = texture2D(texture, texCoord + toCenter * percent * strength / texSize);\n sample.rgb *= sample.a;\n\n color += sample * weight;\n total += weight;\n }\n\n color = color / total;\n color.rgb /= color.a + 0.00001;\n\n return color;\n}\n";
4021
2265
  const uniforms = {
4022
2266
  center: [0.5, 0.5],
4023
2267
  strength: {
@@ -4049,40 +2293,7 @@ const zoomBlur = {
4049
2293
  "use strict";
4050
2294
  __webpack_require__.r(__webpack_exports__);
4051
2295
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorHalftone", function() { return colorHalftone; });
4052
- const fs = `\
4053
- uniform vec2 center;
4054
- uniform float angle;
4055
- uniform float size;
4056
-
4057
- float scale = 3.1514 / size;
4058
-
4059
- float pattern(float angle, vec2 texSize, vec2 texCoord) {
4060
- float s = sin(angle), c = cos(angle);
4061
- vec2 tex = texCoord * texSize - center * texSize;
4062
- vec2 point = vec2(
4063
- c * tex.x - s * tex.y,
4064
- s * tex.x + c * tex.y
4065
- ) * scale;
4066
- return (sin(point.x) * sin(point.y)) * 4.0;
4067
- }
4068
-
4069
- vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
4070
- vec3 cmy = 1.0 - color.rgb;
4071
- float k = min(cmy.x, min(cmy.y, cmy.z));
4072
- cmy = (cmy - k) / (1.0 - k);
4073
- cmy = clamp(
4074
- cmy * 10.0 - 3.0 + vec3(
4075
- pattern(angle + 0.26179, texSize, texCoord),
4076
- pattern(angle + 1.30899, texSize, texCoord),
4077
- pattern(angle, texSize, texCoord)
4078
- ),
4079
- 0.0,
4080
- 1.0
4081
- );
4082
- k = clamp(k * 10.0 - 5.0 + pattern(angle + 0.78539, texSize, texCoord), 0.0, 1.0);
4083
- return vec4(1.0 - cmy - k, color.a);
4084
- }
4085
- `;
2296
+ const fs = "uniform vec2 center;\nuniform float angle;\nuniform float size;\n\nfloat scale = 3.1514 / size;\n\nfloat pattern(float angle, vec2 texSize, vec2 texCoord) {\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - center * texSize;\n vec2 point = vec2(\n\tc * tex.x - s * tex.y,\n\ts * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n vec3 cmy = 1.0 - color.rgb;\n float k = min(cmy.x, min(cmy.y, cmy.z));\n cmy = (cmy - k) / (1.0 - k);\n cmy = clamp(\n\tcmy * 10.0 - 3.0 + vec3(\n pattern(angle + 0.26179, texSize, texCoord),\n\t pattern(angle + 1.30899, texSize, texCoord),\n pattern(angle, texSize, texCoord)\n ),\n\t0.0,\n\t1.0\n );\n k = clamp(k * 10.0 - 5.0 + pattern(angle + 0.78539, texSize, texCoord), 0.0, 1.0);\n return vec4(1.0 - cmy - k, color.a);\n}\n";
4086
2297
  const uniforms = {
4087
2298
  center: [0.5, 0.5],
4088
2299
  angle: {
@@ -4119,28 +2330,7 @@ const colorHalftone = {
4119
2330
  "use strict";
4120
2331
  __webpack_require__.r(__webpack_exports__);
4121
2332
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dotScreen", function() { return dotScreen; });
4122
- const fs = `\
4123
- uniform vec2 center;
4124
- uniform float angle;
4125
- uniform float size;
4126
-
4127
- float pattern(vec2 texSize, vec2 texCoord) {
4128
- float scale = 3.1415 / size;
4129
-
4130
- float s = sin(angle), c = cos(angle);
4131
- vec2 tex = texCoord * texSize - center * texSize;
4132
- vec2 point = vec2(
4133
- c * tex.x - s * tex.y,
4134
- s * tex.x + c * tex.y
4135
- ) * scale;
4136
- return (sin(point.x) * sin(point.y)) * 4.0;
4137
- }
4138
-
4139
- vec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
4140
- float average = (color.r + color.g + color.b) / 3.0;
4141
- return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);
4142
- }
4143
- `;
2333
+ const fs = "uniform vec2 center;\nuniform float angle;\nuniform float size;\n\nfloat pattern(vec2 texSize, vec2 texCoord) {\n float scale = 3.1415 / size;\n\n float s = sin(angle), c = cos(angle);\n vec2 tex = texCoord * texSize - center * texSize;\n vec2 point = vec2(\n c * tex.x - s * tex.y,\n s * tex.x + c * tex.y\n ) * scale;\n return (sin(point.x) * sin(point.y)) * 4.0;\n}\n\nvec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {\n float average = (color.r + color.g + color.b) / 3.0;\n return vec4(vec3(average * 10.0 - 5.0 + pattern(texSize, texCoord)), color.a);\n}\n";
4144
2334
  const uniforms = {
4145
2335
  center: [0.5, 0.5],
4146
2336
  angle: {
@@ -4179,56 +2369,7 @@ __webpack_require__.r(__webpack_exports__);
4179
2369
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "edgeWork", function() { return edgeWork; });
4180
2370
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
4181
2371
 
4182
- const fs = `\
4183
- uniform float radius;
4184
- uniform vec2 delta;
4185
-
4186
- vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
4187
- vec2 relativeDelta = radius * delta / texSize;
4188
-
4189
- vec2 color = vec2(0.0);
4190
- vec2 total = vec2(0.0);
4191
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
4192
-
4193
- for (float t = -30.0; t <= 30.0; t++) {
4194
- float percent = (t + offset - 0.5) / 30.0;
4195
- float weight = 1.0 - abs(percent);
4196
- vec3 sampleColor = texture2D(source, texCoord + relativeDelta * percent).rgb;
4197
- float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;
4198
- color.x += average * weight;
4199
- total.x += weight;
4200
- if (abs(t) < 15.0) {
4201
- weight = weight * 2.0 - 1.0;
4202
- color.y += average * weight;
4203
- total.y += weight;
4204
- }
4205
- }
4206
- return vec4(color / total, 0.0, 1.0);
4207
- }
4208
-
4209
- vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
4210
- vec2 relativeDelta = radius * delta / texSize;
4211
-
4212
- vec2 color = vec2(0.0);
4213
- vec2 total = vec2(0.0);
4214
- float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);
4215
-
4216
- for (float t = -30.0; t <= 30.0; t++) {
4217
- float percent = (t + offset - 0.5) / 30.0;
4218
- float weight = 1.0 - abs(percent);
4219
- vec2 sampleColor = texture2D(source, texCoord + relativeDelta * percent).xy;
4220
- color.x += sampleColor.x * weight;
4221
- total.x += weight;
4222
- if (abs(t) < 15.0) {
4223
- weight = weight * 2.0 - 1.0;
4224
- color.y += sampleColor.y * weight;
4225
- total.y += weight;
4226
- }
4227
- }
4228
- float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
4229
- return vec4(c, c, c, 1.0);
4230
- }
4231
- `;
2372
+ const fs = "uniform float radius;\nuniform vec2 delta;\n\nvec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 relativeDelta = radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture2D(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 relativeDelta = radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture2D(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n";
4232
2373
  const uniforms = {
4233
2374
  radius: {
4234
2375
  value: 2,
@@ -4271,48 +2412,7 @@ const edgeWork = {
4271
2412
  "use strict";
4272
2413
  __webpack_require__.r(__webpack_exports__);
4273
2414
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexagonalPixelate", function() { return hexagonalPixelate; });
4274
- const fs = `\
4275
- uniform vec2 center;
4276
- uniform float scale;
4277
-
4278
- vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
4279
- vec2 tex = (texCoord * texSize - center * texSize) / scale;
4280
- tex.y /= 0.866025404;
4281
- tex.x -= tex.y * 0.5;
4282
-
4283
- vec2 a;
4284
- if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {
4285
- a = vec2(floor(tex.x), floor(tex.y));
4286
- }
4287
- else a = vec2(ceil(tex.x), ceil(tex.y));
4288
- vec2 b = vec2(ceil(tex.x), floor(tex.y));
4289
- vec2 c = vec2(floor(tex.x), ceil(tex.y));
4290
-
4291
- vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);
4292
- vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);
4293
- vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);
4294
- vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);
4295
-
4296
- float alen = length(TEX - A);
4297
- float blen = length(TEX - B);
4298
- float clen = length(TEX - C);
4299
-
4300
- vec2 choice;
4301
- if (alen < blen) {
4302
- if (alen < clen) choice = a;
4303
- else choice = c;
4304
- } else {
4305
- if (blen < clen) choice = b;
4306
- else choice = c;
4307
- }
4308
-
4309
- choice.x += choice.y * 0.5;
4310
- choice.y *= 0.866025404;
4311
- choice *= scale / texSize;
4312
-
4313
- return texture2D(texture, choice + center);
4314
- }
4315
- `;
2415
+ const fs = "uniform vec2 center;\nuniform float scale;\n\nvec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 tex = (texCoord * texSize - center * texSize) / scale;\n tex.y /= 0.866025404;\n tex.x -= tex.y * 0.5;\n\n vec2 a;\n if (tex.x + tex.y - floor(tex.x) - floor(tex.y) < 1.0) {\n a = vec2(floor(tex.x), floor(tex.y));\n }\n else a = vec2(ceil(tex.x), ceil(tex.y));\n vec2 b = vec2(ceil(tex.x), floor(tex.y));\n vec2 c = vec2(floor(tex.x), ceil(tex.y));\n\n vec3 TEX = vec3(tex.x, tex.y, 1.0 - tex.x - tex.y);\n vec3 A = vec3(a.x, a.y, 1.0 - a.x - a.y);\n vec3 B = vec3(b.x, b.y, 1.0 - b.x - b.y);\n vec3 C = vec3(c.x, c.y, 1.0 - c.x - c.y);\n\n float alen = length(TEX - A);\n float blen = length(TEX - B);\n float clen = length(TEX - C);\n\n vec2 choice;\n if (alen < blen) {\n if (alen < clen) choice = a;\n else choice = c;\n } else {\n if (blen < clen) choice = b;\n else choice = c;\n }\n\n choice.x += choice.y * 0.5;\n choice.y *= 0.866025404;\n choice *= scale / texSize;\n\n return texture2D(texture, choice + center);\n}\n";
4316
2416
  const uniforms = {
4317
2417
  center: {
4318
2418
  value: [0.5, 0.5],
@@ -4347,33 +2447,7 @@ const hexagonalPixelate = {
4347
2447
  "use strict";
4348
2448
  __webpack_require__.r(__webpack_exports__);
4349
2449
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ink", function() { return ink; });
4350
- const fs = `\
4351
- uniform float strength;
4352
-
4353
- vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
4354
- vec2 dx = vec2(1.0 / texSize.x, 0.0);
4355
- vec2 dy = vec2(0.0, 1.0 / texSize.y);
4356
- vec4 color = texture2D(texture, texCoord);
4357
- float bigTotal = 0.0;
4358
- float smallTotal = 0.0;
4359
- vec3 bigAverage = vec3(0.0);
4360
- vec3 smallAverage = vec3(0.0);
4361
- for (float x = -2.0; x <= 2.0; x += 1.0) {
4362
- for (float y = -2.0; y <= 2.0; y += 1.0) {
4363
- vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb;
4364
- bigAverage += sample;
4365
- bigTotal += 1.0;
4366
- if (abs(x) + abs(y) < 2.0) {
4367
- smallAverage += sample;
4368
- smallTotal += 1.0;
4369
- }
4370
- }
4371
- }
4372
- vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);
4373
- float power = strength * strength * strength * strength * strength;
4374
- return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);
4375
- }
4376
- `;
2450
+ const fs = "uniform float strength;\n\nvec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 dx = vec2(1.0 / texSize.x, 0.0);\n vec2 dy = vec2(0.0, 1.0 / texSize.y);\n vec4 color = texture2D(texture, texCoord);\n float bigTotal = 0.0;\n float smallTotal = 0.0;\n vec3 bigAverage = vec3(0.0);\n vec3 smallAverage = vec3(0.0);\n for (float x = -2.0; x <= 2.0; x += 1.0) {\n for (float y = -2.0; y <= 2.0; y += 1.0) {\n vec3 sample = texture2D(texture, texCoord + dx * x + dy * y).rgb;\n bigAverage += sample;\n bigTotal += 1.0;\n if (abs(x) + abs(y) < 2.0) {\n smallAverage += sample;\n smallTotal += 1.0;\n }\n }\n }\n vec3 edge = max(vec3(0.0), bigAverage / bigTotal - smallAverage / smallTotal);\n float power = strength * strength * strength * strength * strength;\n return vec4(color.rgb - dot(edge, edge) * power * 100000.0, color.a);\n}\n";
4377
2451
  const uniforms = {
4378
2452
  strength: {
4379
2453
  value: 0.25,
@@ -4403,26 +2477,7 @@ const ink = {
4403
2477
  "use strict";
4404
2478
  __webpack_require__.r(__webpack_exports__);
4405
2479
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "magnify", function() { return magnify; });
4406
- const fs = `\
4407
- uniform vec2 screenXY;
4408
- uniform float radiusPixels;
4409
- uniform float zoom;
4410
- uniform float borderWidthPixels;
4411
- uniform vec4 borderColor;
4412
-
4413
- vec4 magnify_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
4414
- vec2 pos = vec2(screenXY.x, 1.0 - screenXY.y);
4415
- float dist = distance(texCoord * texSize, pos * texSize);
4416
- if (dist < radiusPixels) {
4417
- return texture2D(texture, (texCoord - pos) / zoom + pos);
4418
- }
4419
-
4420
- if (dist <= radiusPixels + borderWidthPixels) {
4421
- return borderColor;
4422
- }
4423
- return texture2D(texture, texCoord);
4424
- }
4425
- `;
2480
+ const fs = "uniform vec2 screenXY;\nuniform float radiusPixels;\nuniform float zoom;\nuniform float borderWidthPixels;\nuniform vec4 borderColor;\n\nvec4 magnify_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 pos = vec2(screenXY.x, 1.0 - screenXY.y);\n float dist = distance(texCoord * texSize, pos * texSize);\n if (dist < radiusPixels) {\n return texture2D(texture, (texCoord - pos) / zoom + pos);\n }\n\n if (dist <= radiusPixels + borderWidthPixels) {\n return borderColor;\n }\n return texture2D(texture, texCoord);\n}\n";
4426
2481
  const uniforms = {
4427
2482
  screenXY: [0, 0],
4428
2483
  radiusPixels: 200,
@@ -4454,33 +2509,7 @@ __webpack_require__.r(__webpack_exports__);
4454
2509
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bulgePinch", function() { return bulgePinch; });
4455
2510
  /* harmony import */ var _warp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warp */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/image-warp-filters/warp.js");
4456
2511
 
4457
- const fs = `\
4458
- uniform float radius;
4459
- uniform float strength;
4460
- uniform vec2 center;
4461
-
4462
- vec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {
4463
- coord -= texCenter;
4464
- float distance = length(coord);
4465
- if (distance < radius) {
4466
- float percent = distance / radius;
4467
- if (strength > 0.0) {
4468
- coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);
4469
- } else {
4470
- coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);
4471
- }
4472
- }
4473
- coord += texCenter;
4474
- return coord;
4475
- }
4476
-
4477
- vec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
4478
- vec2 coord = texCoord * texSize;
4479
- coord = bulgePinch_warp(coord, center * texSize);
4480
-
4481
- return warp_sampleColor(texture, texSize, coord);
4482
- }
4483
- `;
2512
+ const fs = "uniform float radius;\nuniform float strength;\nuniform vec2 center;\n\nvec2 bulgePinch_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < radius) {\n float percent = distance / radius;\n if (strength > 0.0) {\n coord *= mix(1.0, smoothstep(0.0, radius / distance, percent), strength * 0.75);\n } else {\n coord *= mix(1.0, pow(percent, 1.0 + strength * 0.75) * radius / distance, 1.0 - percent);\n }\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = bulgePinch_warp(coord, center * texSize);\n\n return warp_sampleColor(texture, texSize, coord);\n}\n";
4484
2513
  const uniforms = {
4485
2514
  center: [0.5, 0.5],
4486
2515
  radius: {
@@ -4519,35 +2548,7 @@ __webpack_require__.r(__webpack_exports__);
4519
2548
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swirl", function() { return swirl; });
4520
2549
  /* harmony import */ var _warp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warp */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/image-warp-filters/warp.js");
4521
2550
 
4522
- const fs = `\
4523
- uniform float radius;
4524
- uniform float angle;
4525
- uniform vec2 center;
4526
-
4527
- vec2 swirl_warp(vec2 coord, vec2 texCenter) {
4528
- coord -= texCenter;
4529
- float distance = length(coord);
4530
- if (distance < radius) {
4531
- float percent = (radius - distance) / radius;
4532
- float theta = percent * percent * angle;
4533
- float s = sin(theta);
4534
- float c = cos(theta);
4535
- coord = vec2(
4536
- coord.x * c - coord.y * s,
4537
- coord.x * s + coord.y * c
4538
- );
4539
- }
4540
- coord += texCenter;
4541
- return coord;
4542
- }
4543
-
4544
- vec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
4545
- vec2 coord = texCoord * texSize;
4546
- coord = swirl_warp(coord, center * texSize);
4547
-
4548
- return warp_sampleColor(texture, texSize, coord);
4549
- }
4550
- `;
2551
+ const fs = "uniform float radius;\nuniform float angle;\nuniform vec2 center;\n\nvec2 swirl_warp(vec2 coord, vec2 texCenter) {\n coord -= texCenter;\n float distance = length(coord);\n if (distance < radius) {\n float percent = (radius - distance) / radius;\n float theta = percent * percent * angle;\n float s = sin(theta);\n float c = cos(theta);\n coord = vec2(\n coord.x * c - coord.y * s,\n coord.x * s + coord.y * c\n );\n }\n coord += texCenter;\n return coord;\n}\n\nvec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {\n vec2 coord = texCoord * texSize;\n coord = swirl_warp(coord, center * texSize);\n\n return warp_sampleColor(texture, texSize, coord);\n}\n";
4551
2552
  const uniforms = {
4552
2553
  center: [0.5, 0.5],
4553
2554
  radius: {
@@ -4584,17 +2585,7 @@ const swirl = {
4584
2585
  "use strict";
4585
2586
  __webpack_require__.r(__webpack_exports__);
4586
2587
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warp", function() { return warp; });
4587
- const fs = `\
4588
- vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {
4589
- vec4 color = texture2D(texture, coord / texSize);
4590
- vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
4591
- if (coord != clampedCoord) {
4592
- color.a *= max(0.0, 1.0 - length(coord - clampedCoord));
4593
- }
4594
-
4595
- return color;
4596
- }
4597
- `;
2588
+ const fs = "vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {\n vec4 color = texture2D(texture, coord / texSize);\n vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);\n if (coord != clampedCoord) {\n color.a *= max(0.0, 1.0 - length(coord - clampedCoord));\n }\n\n return color;\n}\n";
4598
2589
  const warp = {
4599
2590
  name: 'warp',
4600
2591
  fs
@@ -4749,40 +2740,7 @@ __webpack_require__.r(__webpack_exports__);
4749
2740
 
4750
2741
  "use strict";
4751
2742
  __webpack_require__.r(__webpack_exports__);
4752
- /* harmony default export */ __webpack_exports__["default"] = (`\
4753
- #if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
4754
-
4755
- struct AmbientLight {
4756
- vec3 color;
4757
- };
4758
-
4759
- struct PointLight {
4760
- vec3 color;
4761
- vec3 position;
4762
- vec3 attenuation;
4763
- };
4764
-
4765
- struct DirectionalLight {
4766
- vec3 color;
4767
- vec3 direction;
4768
- };
4769
-
4770
- uniform AmbientLight lighting_uAmbientLight;
4771
- uniform PointLight lighting_uPointLight[MAX_LIGHTS];
4772
- uniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];
4773
- uniform int lighting_uPointLightCount;
4774
- uniform int lighting_uDirectionalLightCount;
4775
-
4776
- uniform bool lighting_uEnabled;
4777
-
4778
- float getPointLightAttenuation(PointLight pointLight, float distance) {
4779
- return pointLight.attenuation.x
4780
- + pointLight.attenuation.y * distance
4781
- + pointLight.attenuation.z * distance * distance;
4782
- }
4783
-
4784
- #endif
4785
- `);
2743
+ /* harmony default export */ __webpack_exports__["default"] = ("#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))\n\nstruct AmbientLight {\n vec3 color;\n};\n\nstruct PointLight {\n vec3 color;\n vec3 position;\n vec3 attenuation;\n};\n\nstruct DirectionalLight {\n vec3 color;\n vec3 direction;\n};\n\nuniform AmbientLight lighting_uAmbientLight;\nuniform PointLight lighting_uPointLight[MAX_LIGHTS];\nuniform DirectionalLight lighting_uDirectionalLight[MAX_LIGHTS];\nuniform int lighting_uPointLightCount;\nuniform int lighting_uDirectionalLightCount;\n\nuniform bool lighting_uEnabled;\n\nfloat getPointLightAttenuation(PointLight pointLight, float distance) {\n return pointLight.attenuation.x\n + pointLight.attenuation.y * distance\n + pointLight.attenuation.z * distance * distance;\n}\n\n#endif\n");
4786
2744
  //# sourceMappingURL=lights.glsl.js.map
4787
2745
 
4788
2746
  /***/ }),
@@ -4803,18 +2761,20 @@ const INITIAL_MODULE_OPTIONS = {
4803
2761
  lightSources: {}
4804
2762
  };
4805
2763
 
4806
- function convertColor({
4807
- color = [0, 0, 0],
4808
- intensity = 1.0
4809
- } = {}) {
2764
+ function convertColor() {
2765
+ let {
2766
+ color = [0, 0, 0],
2767
+ intensity = 1.0
2768
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4810
2769
  return color.map(component => component * intensity / 255.0);
4811
2770
  }
4812
2771
 
4813
- function getLightSourceUniforms({
4814
- ambientLight,
4815
- pointLights = [],
4816
- directionalLights = []
4817
- }) {
2772
+ function getLightSourceUniforms(_ref) {
2773
+ let {
2774
+ ambientLight,
2775
+ pointLights = [],
2776
+ directionalLights = []
2777
+ } = _ref;
4818
2778
  const lightSourceUniforms = {};
4819
2779
 
4820
2780
  if (ambientLight) {
@@ -4824,20 +2784,22 @@ function getLightSourceUniforms({
4824
2784
  }
4825
2785
 
4826
2786
  pointLights.forEach((pointLight, index) => {
4827
- lightSourceUniforms[`lighting_uPointLight[${index}].color`] = convertColor(pointLight);
4828
- lightSourceUniforms[`lighting_uPointLight[${index}].position`] = pointLight.position;
4829
- lightSourceUniforms[`lighting_uPointLight[${index}].attenuation`] = pointLight.attenuation || [1, 0, 0];
2787
+ lightSourceUniforms["lighting_uPointLight[".concat(index, "].color")] = convertColor(pointLight);
2788
+ lightSourceUniforms["lighting_uPointLight[".concat(index, "].position")] = pointLight.position;
2789
+ lightSourceUniforms["lighting_uPointLight[".concat(index, "].attenuation")] = pointLight.attenuation || [1, 0, 0];
4830
2790
  });
4831
2791
  lightSourceUniforms.lighting_uPointLightCount = pointLights.length;
4832
2792
  directionalLights.forEach((directionalLight, index) => {
4833
- lightSourceUniforms[`lighting_uDirectionalLight[${index}].color`] = convertColor(directionalLight);
4834
- lightSourceUniforms[`lighting_uDirectionalLight[${index}].direction`] = directionalLight.direction;
2793
+ lightSourceUniforms["lighting_uDirectionalLight[".concat(index, "].color")] = convertColor(directionalLight);
2794
+ lightSourceUniforms["lighting_uDirectionalLight[".concat(index, "].direction")] = directionalLight.direction;
4835
2795
  });
4836
2796
  lightSourceUniforms.lighting_uDirectionalLightCount = directionalLights.length;
4837
2797
  return lightSourceUniforms;
4838
2798
  }
4839
2799
 
4840
- function getUniforms(opts = INITIAL_MODULE_OPTIONS) {
2800
+ function getUniforms() {
2801
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_MODULE_OPTIONS;
2802
+
4841
2803
  if ('lightSources' in opts) {
4842
2804
  const {
4843
2805
  ambientLight,
@@ -4917,33 +2879,8 @@ const lights = {
4917
2879
  __webpack_require__.r(__webpack_exports__);
4918
2880
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MODULE_INJECTORS_VS", function() { return MODULE_INJECTORS_VS; });
4919
2881
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MODULE_INJECTORS_FS", function() { return MODULE_INJECTORS_FS; });
4920
- const MODULE_INJECTORS_VS = `\
4921
- #ifdef MODULE_LOGDEPTH
4922
- logdepth_adjustPosition(gl_Position);
4923
- #endif
4924
- `;
4925
- const MODULE_INJECTORS_FS = `\
4926
- #ifdef MODULE_MATERIAL
4927
- gl_FragColor = material_filterColor(gl_FragColor);
4928
- #endif
4929
-
4930
- #ifdef MODULE_LIGHTING
4931
- gl_FragColor = lighting_filterColor(gl_FragColor);
4932
- #endif
4933
-
4934
- #ifdef MODULE_FOG
4935
- gl_FragColor = fog_filterColor(gl_FragColor);
4936
- #endif
4937
-
4938
- #ifdef MODULE_PICKING
4939
- gl_FragColor = picking_filterHighlightColor(gl_FragColor);
4940
- gl_FragColor = picking_filterPickingColor(gl_FragColor);
4941
- #endif
4942
-
4943
- #ifdef MODULE_LOGDEPTH
4944
- logdepth_setFragDepth();
4945
- #endif
4946
- `;
2882
+ const MODULE_INJECTORS_VS = "#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n";
2883
+ const 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";
4947
2884
  //# sourceMappingURL=module-injectors.js.map
4948
2885
 
4949
2886
  /***/ }),
@@ -4957,357 +2894,7 @@ const MODULE_INJECTORS_FS = `\
4957
2894
 
4958
2895
  "use strict";
4959
2896
  __webpack_require__.r(__webpack_exports__);
4960
- /* harmony default export */ __webpack_exports__["default"] = (`\
4961
- #if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
4962
- # error PBR fragment shader: Texture LOD is not available
4963
- #endif
4964
-
4965
- #if !defined(HAS_TANGENTS) && !defined(FEATURE_GLSL_DERIVATIVES)
4966
- # error PBR fragment shader: Derivatives are not available
4967
- #endif
4968
-
4969
-
4970
- #if (__VERSION__ < 300)
4971
- #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL1COND; INCR)
4972
- #else
4973
- #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL2COND; INCR)
4974
- #endif
4975
-
4976
- precision highp float;
4977
-
4978
- uniform bool pbr_uUnlit;
4979
-
4980
- #ifdef USE_IBL
4981
- uniform samplerCube u_DiffuseEnvSampler;
4982
- uniform samplerCube u_SpecularEnvSampler;
4983
- uniform sampler2D u_brdfLUT;
4984
- uniform vec2 u_ScaleIBLAmbient;
4985
- #endif
4986
-
4987
- #ifdef HAS_BASECOLORMAP
4988
- uniform sampler2D u_BaseColorSampler;
4989
- #endif
4990
- #ifdef HAS_NORMALMAP
4991
- uniform sampler2D u_NormalSampler;
4992
- uniform float u_NormalScale;
4993
- #endif
4994
- #ifdef HAS_EMISSIVEMAP
4995
- uniform sampler2D u_EmissiveSampler;
4996
- uniform vec3 u_EmissiveFactor;
4997
- #endif
4998
- #ifdef HAS_METALROUGHNESSMAP
4999
- uniform sampler2D u_MetallicRoughnessSampler;
5000
- #endif
5001
- #ifdef HAS_OCCLUSIONMAP
5002
- uniform sampler2D u_OcclusionSampler;
5003
- uniform float u_OcclusionStrength;
5004
- #endif
5005
-
5006
- #ifdef ALPHA_CUTOFF
5007
- uniform float u_AlphaCutoff;
5008
- #endif
5009
-
5010
- uniform vec2 u_MetallicRoughnessValues;
5011
- uniform vec4 u_BaseColorFactor;
5012
-
5013
- uniform vec3 u_Camera;
5014
- #ifdef PBR_DEBUG
5015
- uniform vec4 u_ScaleDiffBaseMR;
5016
- uniform vec4 u_ScaleFGDSpec;
5017
- #endif
5018
-
5019
- varying vec3 pbr_vPosition;
5020
-
5021
- varying vec2 pbr_vUV;
5022
-
5023
- #ifdef HAS_NORMALS
5024
- #ifdef HAS_TANGENTS
5025
- varying mat3 pbr_vTBN;
5026
- #else
5027
- varying vec3 pbr_vNormal;
5028
- #endif
5029
- #endif
5030
-
5031
-
5032
- struct PBRInfo
5033
- {
5034
- float NdotL;
5035
- float NdotV;
5036
- float NdotH;
5037
- float LdotH;
5038
- float VdotH;
5039
- float perceptualRoughness;
5040
- float metalness;
5041
- vec3 reflectance0;
5042
- vec3 reflectance90;
5043
- float alphaRoughness;
5044
- vec3 diffuseColor;
5045
- vec3 specularColor;
5046
- vec3 n;
5047
- vec3 v;
5048
- };
5049
-
5050
- const float M_PI = 3.141592653589793;
5051
- const float c_MinRoughness = 0.04;
5052
-
5053
- vec4 SRGBtoLINEAR(vec4 srgbIn)
5054
- {
5055
- #ifdef MANUAL_SRGB
5056
- #ifdef SRGB_FAST_APPROXIMATION
5057
- vec3 linOut = pow(srgbIn.xyz,vec3(2.2));
5058
- #else
5059
- vec3 bLess = step(vec3(0.04045),srgbIn.xyz);
5060
- vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );
5061
- #endif
5062
- return vec4(linOut,srgbIn.w);;
5063
- #else
5064
- return srgbIn;
5065
- #endif
5066
- }
5067
-
5068
- vec3 getNormal()
5069
- {
5070
- #ifndef HAS_TANGENTS
5071
- vec3 pos_dx = dFdx(pbr_vPosition);
5072
- vec3 pos_dy = dFdy(pbr_vPosition);
5073
- vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));
5074
- vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));
5075
- vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);
5076
-
5077
- #ifdef HAS_NORMALS
5078
- vec3 ng = normalize(pbr_vNormal);
5079
- #else
5080
- vec3 ng = cross(pos_dx, pos_dy);
5081
- #endif
5082
-
5083
- t = normalize(t - ng * dot(ng, t));
5084
- vec3 b = normalize(cross(ng, t));
5085
- mat3 tbn = mat3(t, b, ng);
5086
- #else
5087
- mat3 tbn = pbr_vTBN;
5088
- #endif
5089
-
5090
- #ifdef HAS_NORMALMAP
5091
- vec3 n = texture2D(u_NormalSampler, pbr_vUV).rgb;
5092
- n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));
5093
- #else
5094
- vec3 n = normalize(tbn[2].xyz);
5095
- #endif
5096
-
5097
- return n;
5098
- }
5099
-
5100
-
5101
- #ifdef USE_IBL
5102
- vec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)
5103
- {
5104
- float mipCount = 9.0;
5105
- float lod = (pbrInputs.perceptualRoughness * mipCount);
5106
- vec3 brdf = SRGBtoLINEAR(texture2D(u_brdfLUT,
5107
- vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;
5108
- vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;
5109
-
5110
- #ifdef USE_TEX_LOD
5111
- vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;
5112
- #else
5113
- vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;
5114
- #endif
5115
-
5116
- vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;
5117
- vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);
5118
- diffuse *= u_ScaleIBLAmbient.x;
5119
- specular *= u_ScaleIBLAmbient.y;
5120
-
5121
- return diffuse + specular;
5122
- }
5123
- #endif
5124
-
5125
-
5126
- vec3 diffuse(PBRInfo pbrInputs)
5127
- {
5128
- return pbrInputs.diffuseColor / M_PI;
5129
- }
5130
-
5131
- vec3 specularReflection(PBRInfo pbrInputs)
5132
- {
5133
- return pbrInputs.reflectance0 +
5134
- (pbrInputs.reflectance90 - pbrInputs.reflectance0) *
5135
- pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);
5136
- }
5137
-
5138
-
5139
-
5140
- float geometricOcclusion(PBRInfo pbrInputs)
5141
- {
5142
- float NdotL = pbrInputs.NdotL;
5143
- float NdotV = pbrInputs.NdotV;
5144
- float r = pbrInputs.alphaRoughness;
5145
-
5146
- float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));
5147
- float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));
5148
- return attenuationL * attenuationV;
5149
- }
5150
-
5151
-
5152
-
5153
-
5154
-
5155
- float microfacetDistribution(PBRInfo pbrInputs)
5156
- {
5157
- float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;
5158
- float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;
5159
- return roughnessSq / (M_PI * f * f);
5160
- }
5161
-
5162
- void PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {
5163
- pbrInputs.NdotL = 1.0;
5164
- pbrInputs.NdotH = 0.0;
5165
- pbrInputs.LdotH = 0.0;
5166
- pbrInputs.VdotH = 1.0;
5167
- }
5168
-
5169
- void PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {
5170
- vec3 n = pbrInputs.n;
5171
- vec3 v = pbrInputs.v;
5172
- vec3 l = normalize(lightDirection);
5173
- vec3 h = normalize(l+v);
5174
-
5175
- pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);
5176
- pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);
5177
- pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);
5178
- pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);
5179
- }
5180
-
5181
- void PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {
5182
- vec3 light_direction = normalize(pointLight.position - pbr_vPosition);
5183
- PBRInfo_setDirectionalLight(pbrInputs, light_direction);
5184
- }
5185
-
5186
- vec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {
5187
- vec3 F = specularReflection(pbrInputs);
5188
- float G = geometricOcclusion(pbrInputs);
5189
- float D = microfacetDistribution(pbrInputs);
5190
- vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);
5191
- vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);
5192
- return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);
5193
- }
5194
-
5195
- vec4 pbr_filterColor(vec4 colorUnused)
5196
- {
5197
- #ifdef HAS_BASECOLORMAP
5198
- vec4 baseColor = SRGBtoLINEAR(texture2D(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;
5199
- #else
5200
- vec4 baseColor = u_BaseColorFactor;
5201
- #endif
5202
-
5203
- #ifdef ALPHA_CUTOFF
5204
- if (baseColor.a < u_AlphaCutoff) {
5205
- discard;
5206
- }
5207
- #endif
5208
-
5209
- vec3 color = vec3(0, 0, 0);
5210
-
5211
- if(pbr_uUnlit){
5212
- color.rgb = baseColor.rgb;
5213
- }
5214
- else{
5215
-
5216
-
5217
- float perceptualRoughness = u_MetallicRoughnessValues.y;
5218
- float metallic = u_MetallicRoughnessValues.x;
5219
- #ifdef HAS_METALROUGHNESSMAP
5220
-
5221
- vec4 mrSample = texture2D(u_MetallicRoughnessSampler, pbr_vUV);
5222
- perceptualRoughness = mrSample.g * perceptualRoughness;
5223
- metallic = mrSample.b * metallic;
5224
- #endif
5225
- perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);
5226
- metallic = clamp(metallic, 0.0, 1.0);
5227
-
5228
- float alphaRoughness = perceptualRoughness * perceptualRoughness;
5229
-
5230
- vec3 f0 = vec3(0.04);
5231
- vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);
5232
- diffuseColor *= 1.0 - metallic;
5233
- vec3 specularColor = mix(f0, baseColor.rgb, metallic);
5234
- float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);
5235
-
5236
-
5237
-
5238
- float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);
5239
- vec3 specularEnvironmentR0 = specularColor.rgb;
5240
- vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;
5241
-
5242
- vec3 n = getNormal();
5243
- vec3 v = normalize(u_Camera - pbr_vPosition);
5244
-
5245
- float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);
5246
- vec3 reflection = -normalize(reflect(v, n));
5247
-
5248
- PBRInfo pbrInputs = PBRInfo(
5249
- 0.0,
5250
- NdotV,
5251
- 0.0,
5252
- 0.0,
5253
- 0.0,
5254
- perceptualRoughness,
5255
- metallic,
5256
- specularEnvironmentR0,
5257
- specularEnvironmentR90,
5258
- alphaRoughness,
5259
- diffuseColor,
5260
- specularColor,
5261
- n,
5262
- v
5263
- );
5264
-
5265
- #ifdef USE_LIGHTS
5266
- PBRInfo_setAmbientLight(pbrInputs);
5267
- color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);
5268
- SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uDirectionalLightCount, i++) {
5269
- if (i < lighting_uDirectionalLightCount) {
5270
- PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);
5271
- color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);
5272
- }
5273
- }
5274
- SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uPointLightCount, i++) {
5275
- if (i < lighting_uPointLightCount) {
5276
- PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);
5277
- float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));
5278
- color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);
5279
- }
5280
- }
5281
- #endif
5282
- #ifdef USE_IBL
5283
- color += getIBLContribution(pbrInputs, n, reflection);
5284
- #endif
5285
- #ifdef HAS_OCCLUSIONMAP
5286
- float ao = texture2D(u_OcclusionSampler, pbr_vUV).r;
5287
- color = mix(color, color * ao, u_OcclusionStrength);
5288
- #endif
5289
-
5290
- #ifdef HAS_EMISSIVEMAP
5291
- vec3 emissive = SRGBtoLINEAR(texture2D(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;
5292
- color += emissive;
5293
- #endif
5294
-
5295
- #ifdef PBR_DEBUG
5296
-
5297
-
5298
-
5299
-
5300
-
5301
- color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);
5302
- color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);
5303
- color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);
5304
- #endif
5305
-
5306
- }
5307
-
5308
- return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);
5309
- }
5310
- `);
2897
+ /* harmony default export */ __webpack_exports__["default"] = ("#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)\n# error PBR fragment shader: Texture LOD is not available\n#endif\n\n#if !defined(HAS_TANGENTS) && !defined(FEATURE_GLSL_DERIVATIVES)\n# error PBR fragment shader: Derivatives are not available\n#endif\n\n\n#if (__VERSION__ < 300)\n #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL1COND; INCR)\n#else\n #define SMART_FOR(INIT, WEBGL1COND, WEBGL2COND, INCR) for (INIT; WEBGL2COND; INCR)\n#endif\n\nprecision highp float;\n\nuniform bool pbr_uUnlit;\n\n#ifdef USE_IBL\nuniform samplerCube u_DiffuseEnvSampler;\nuniform samplerCube u_SpecularEnvSampler;\nuniform sampler2D u_brdfLUT;\nuniform vec2 u_ScaleIBLAmbient;\n#endif\n\n#ifdef HAS_BASECOLORMAP\nuniform sampler2D u_BaseColorSampler;\n#endif\n#ifdef HAS_NORMALMAP\nuniform sampler2D u_NormalSampler;\nuniform float u_NormalScale;\n#endif\n#ifdef HAS_EMISSIVEMAP\nuniform sampler2D u_EmissiveSampler;\nuniform vec3 u_EmissiveFactor;\n#endif\n#ifdef HAS_METALROUGHNESSMAP\nuniform sampler2D u_MetallicRoughnessSampler;\n#endif\n#ifdef HAS_OCCLUSIONMAP\nuniform sampler2D u_OcclusionSampler;\nuniform float u_OcclusionStrength;\n#endif\n\n#ifdef ALPHA_CUTOFF\nuniform float u_AlphaCutoff;\n#endif\n\nuniform vec2 u_MetallicRoughnessValues;\nuniform vec4 u_BaseColorFactor;\n\nuniform vec3 u_Camera;\n#ifdef PBR_DEBUG\nuniform vec4 u_ScaleDiffBaseMR;\nuniform vec4 u_ScaleFGDSpec;\n#endif\n\nvarying vec3 pbr_vPosition;\n\nvarying vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n#else\nvarying vec3 pbr_vNormal;\n#endif\n#endif\n\n\nstruct PBRInfo\n{\n float NdotL;\n float NdotV;\n float NdotH;\n float LdotH;\n float VdotH;\n float perceptualRoughness;\n float metalness;\n vec3 reflectance0;\n vec3 reflectance90;\n float alphaRoughness;\n vec3 diffuseColor;\n vec3 specularColor;\n vec3 n;\n vec3 v;\n};\n\nconst float M_PI = 3.141592653589793;\nconst float c_MinRoughness = 0.04;\n\nvec4 SRGBtoLINEAR(vec4 srgbIn)\n{\n#ifdef MANUAL_SRGB\n#ifdef SRGB_FAST_APPROXIMATION\n vec3 linOut = pow(srgbIn.xyz,vec3(2.2));\n#else\n vec3 bLess = step(vec3(0.04045),srgbIn.xyz);\n vec3 linOut = mix( srgbIn.xyz/vec3(12.92), pow((srgbIn.xyz+vec3(0.055))/vec3(1.055),vec3(2.4)), bLess );\n#endif\n return vec4(linOut,srgbIn.w);;\n#else\n return srgbIn;\n#endif\n}\n\nvec3 getNormal()\n{\n#ifndef HAS_TANGENTS\n vec3 pos_dx = dFdx(pbr_vPosition);\n vec3 pos_dy = dFdy(pbr_vPosition);\n vec3 tex_dx = dFdx(vec3(pbr_vUV, 0.0));\n vec3 tex_dy = dFdy(vec3(pbr_vUV, 0.0));\n vec3 t = (tex_dy.t * pos_dx - tex_dx.t * pos_dy) / (tex_dx.s * tex_dy.t - tex_dy.s * tex_dx.t);\n\n#ifdef HAS_NORMALS\n vec3 ng = normalize(pbr_vNormal);\n#else\n vec3 ng = cross(pos_dx, pos_dy);\n#endif\n\n t = normalize(t - ng * dot(ng, t));\n vec3 b = normalize(cross(ng, t));\n mat3 tbn = mat3(t, b, ng);\n#else\n mat3 tbn = pbr_vTBN;\n#endif\n\n#ifdef HAS_NORMALMAP\n vec3 n = texture2D(u_NormalSampler, pbr_vUV).rgb;\n n = normalize(tbn * ((2.0 * n - 1.0) * vec3(u_NormalScale, u_NormalScale, 1.0)));\n#else\n vec3 n = normalize(tbn[2].xyz);\n#endif\n\n return n;\n}\n\n\n#ifdef USE_IBL\nvec3 getIBLContribution(PBRInfo pbrInputs, vec3 n, vec3 reflection)\n{\n float mipCount = 9.0;\n float lod = (pbrInputs.perceptualRoughness * mipCount);\n vec3 brdf = SRGBtoLINEAR(texture2D(u_brdfLUT,\n vec2(pbrInputs.NdotV, 1.0 - pbrInputs.perceptualRoughness))).rgb;\n vec3 diffuseLight = SRGBtoLINEAR(textureCube(u_DiffuseEnvSampler, n)).rgb;\n\n#ifdef USE_TEX_LOD\n vec3 specularLight = SRGBtoLINEAR(textureCubeLod(u_SpecularEnvSampler, reflection, lod)).rgb;\n#else\n vec3 specularLight = SRGBtoLINEAR(textureCube(u_SpecularEnvSampler, reflection)).rgb;\n#endif\n\n vec3 diffuse = diffuseLight * pbrInputs.diffuseColor;\n vec3 specular = specularLight * (pbrInputs.specularColor * brdf.x + brdf.y);\n diffuse *= u_ScaleIBLAmbient.x;\n specular *= u_ScaleIBLAmbient.y;\n\n return diffuse + specular;\n}\n#endif\n\n\nvec3 diffuse(PBRInfo pbrInputs)\n{\n return pbrInputs.diffuseColor / M_PI;\n}\n\nvec3 specularReflection(PBRInfo pbrInputs)\n{\n return pbrInputs.reflectance0 +\n (pbrInputs.reflectance90 - pbrInputs.reflectance0) *\n pow(clamp(1.0 - pbrInputs.VdotH, 0.0, 1.0), 5.0);\n}\n\n\n\nfloat geometricOcclusion(PBRInfo pbrInputs)\n{\n float NdotL = pbrInputs.NdotL;\n float NdotV = pbrInputs.NdotV;\n float r = pbrInputs.alphaRoughness;\n\n float attenuationL = 2.0 * NdotL / (NdotL + sqrt(r * r + (1.0 - r * r) * (NdotL * NdotL)));\n float attenuationV = 2.0 * NdotV / (NdotV + sqrt(r * r + (1.0 - r * r) * (NdotV * NdotV)));\n return attenuationL * attenuationV;\n}\n\n\n\n\n\nfloat microfacetDistribution(PBRInfo pbrInputs)\n{\n float roughnessSq = pbrInputs.alphaRoughness * pbrInputs.alphaRoughness;\n float f = (pbrInputs.NdotH * roughnessSq - pbrInputs.NdotH) * pbrInputs.NdotH + 1.0;\n return roughnessSq / (M_PI * f * f);\n}\n\nvoid PBRInfo_setAmbientLight(inout PBRInfo pbrInputs) {\n pbrInputs.NdotL = 1.0;\n pbrInputs.NdotH = 0.0;\n pbrInputs.LdotH = 0.0;\n pbrInputs.VdotH = 1.0;\n}\n\nvoid PBRInfo_setDirectionalLight(inout PBRInfo pbrInputs, vec3 lightDirection) {\n vec3 n = pbrInputs.n;\n vec3 v = pbrInputs.v;\n vec3 l = normalize(lightDirection);\n vec3 h = normalize(l+v);\n\n pbrInputs.NdotL = clamp(dot(n, l), 0.001, 1.0);\n pbrInputs.NdotH = clamp(dot(n, h), 0.0, 1.0);\n pbrInputs.LdotH = clamp(dot(l, h), 0.0, 1.0);\n pbrInputs.VdotH = clamp(dot(v, h), 0.0, 1.0);\n}\n\nvoid PBRInfo_setPointLight(inout PBRInfo pbrInputs, PointLight pointLight) {\n vec3 light_direction = normalize(pointLight.position - pbr_vPosition);\n PBRInfo_setDirectionalLight(pbrInputs, light_direction);\n}\n\nvec3 calculateFinalColor(PBRInfo pbrInputs, vec3 lightColor) {\n vec3 F = specularReflection(pbrInputs);\n float G = geometricOcclusion(pbrInputs);\n float D = microfacetDistribution(pbrInputs);\n vec3 diffuseContrib = (1.0 - F) * diffuse(pbrInputs);\n vec3 specContrib = F * G * D / (4.0 * pbrInputs.NdotL * pbrInputs.NdotV);\n return pbrInputs.NdotL * lightColor * (diffuseContrib + specContrib);\n}\n\nvec4 pbr_filterColor(vec4 colorUnused)\n{\n#ifdef HAS_BASECOLORMAP\n vec4 baseColor = SRGBtoLINEAR(texture2D(u_BaseColorSampler, pbr_vUV)) * u_BaseColorFactor;\n#else\n vec4 baseColor = u_BaseColorFactor;\n#endif\n\n#ifdef ALPHA_CUTOFF\n if (baseColor.a < u_AlphaCutoff) {\n discard;\n }\n#endif\n\n vec3 color = vec3(0, 0, 0);\n\n if(pbr_uUnlit){\n color.rgb = baseColor.rgb;\n }\n else{\n\n\n float perceptualRoughness = u_MetallicRoughnessValues.y;\n float metallic = u_MetallicRoughnessValues.x;\n#ifdef HAS_METALROUGHNESSMAP\n\n vec4 mrSample = texture2D(u_MetallicRoughnessSampler, pbr_vUV);\n perceptualRoughness = mrSample.g * perceptualRoughness;\n metallic = mrSample.b * metallic;\n#endif\n perceptualRoughness = clamp(perceptualRoughness, c_MinRoughness, 1.0);\n metallic = clamp(metallic, 0.0, 1.0);\n\n float alphaRoughness = perceptualRoughness * perceptualRoughness;\n\n vec3 f0 = vec3(0.04);\n vec3 diffuseColor = baseColor.rgb * (vec3(1.0) - f0);\n diffuseColor *= 1.0 - metallic;\n vec3 specularColor = mix(f0, baseColor.rgb, metallic);\n float reflectance = max(max(specularColor.r, specularColor.g), specularColor.b);\n\n\n\n float reflectance90 = clamp(reflectance * 25.0, 0.0, 1.0);\n vec3 specularEnvironmentR0 = specularColor.rgb;\n vec3 specularEnvironmentR90 = vec3(1.0, 1.0, 1.0) * reflectance90;\n\n vec3 n = getNormal();\n vec3 v = normalize(u_Camera - pbr_vPosition);\n\n float NdotV = clamp(abs(dot(n, v)), 0.001, 1.0);\n vec3 reflection = -normalize(reflect(v, n));\n\n PBRInfo pbrInputs = PBRInfo(\n 0.0,\n NdotV,\n 0.0,\n 0.0,\n 0.0,\n perceptualRoughness,\n metallic,\n specularEnvironmentR0,\n specularEnvironmentR90,\n alphaRoughness,\n diffuseColor,\n specularColor,\n n,\n v\n );\n\n#ifdef USE_LIGHTS\n PBRInfo_setAmbientLight(pbrInputs);\n color += calculateFinalColor(pbrInputs, lighting_uAmbientLight.color);\n SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uDirectionalLightCount, i++) {\n if (i < lighting_uDirectionalLightCount) {\n PBRInfo_setDirectionalLight(pbrInputs, lighting_uDirectionalLight[i].direction);\n color += calculateFinalColor(pbrInputs, lighting_uDirectionalLight[i].color);\n }\n }\n SMART_FOR(int i = 0, i < MAX_LIGHTS, i < lighting_uPointLightCount, i++) {\n if (i < lighting_uPointLightCount) {\n PBRInfo_setPointLight(pbrInputs, lighting_uPointLight[i]);\n float attenuation = getPointLightAttenuation(lighting_uPointLight[i], distance(lighting_uPointLight[i].position, pbr_vPosition));\n color += calculateFinalColor(pbrInputs, lighting_uPointLight[i].color / attenuation);\n }\n }\n#endif\n#ifdef USE_IBL\n color += getIBLContribution(pbrInputs, n, reflection);\n#endif\n#ifdef HAS_OCCLUSIONMAP\n float ao = texture2D(u_OcclusionSampler, pbr_vUV).r;\n color = mix(color, color * ao, u_OcclusionStrength);\n#endif\n\n#ifdef HAS_EMISSIVEMAP\n vec3 emissive = SRGBtoLINEAR(texture2D(u_EmissiveSampler, pbr_vUV)).rgb * u_EmissiveFactor;\n color += emissive;\n#endif\n\n#ifdef PBR_DEBUG\n\n\n\n\n\n color = mix(color, baseColor.rgb, u_ScaleDiffBaseMR.y);\n color = mix(color, vec3(metallic), u_ScaleDiffBaseMR.z);\n color = mix(color, vec3(perceptualRoughness), u_ScaleDiffBaseMR.w);\n#endif\n\n }\n\n return vec4(pow(color,vec3(1.0/2.2)), baseColor.a);\n}\n");
5311
2898
  //# sourceMappingURL=pbr-fragment.glsl.js.map
5312
2899
 
5313
2900
  /***/ }),
@@ -5321,45 +2908,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
5321
2908
 
5322
2909
  "use strict";
5323
2910
  __webpack_require__.r(__webpack_exports__);
5324
- /* harmony default export */ __webpack_exports__["default"] = (`\
5325
- uniform mat4 u_MVPMatrix;
5326
- uniform mat4 u_ModelMatrix;
5327
- uniform mat4 u_NormalMatrix;
5328
-
5329
- varying vec3 pbr_vPosition;
5330
- varying vec2 pbr_vUV;
5331
-
5332
- #ifdef HAS_NORMALS
5333
- # ifdef HAS_TANGENTS
5334
- varying mat3 pbr_vTBN;
5335
- # else
5336
- varying vec3 pbr_vNormal;
5337
- # endif
5338
- #endif
5339
-
5340
- void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)
5341
- {
5342
- vec4 pos = u_ModelMatrix * position;
5343
- pbr_vPosition = vec3(pos.xyz) / pos.w;
5344
-
5345
- #ifdef HAS_NORMALS
5346
- #ifdef HAS_TANGENTS
5347
- vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));
5348
- vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));
5349
- vec3 bitangentW = cross(normalW, tangentW) * tangent.w;
5350
- pbr_vTBN = mat3(tangentW, bitangentW, normalW);
5351
- #else
5352
- pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));
5353
- #endif
5354
- #endif
5355
-
5356
- #ifdef HAS_UV
5357
- pbr_vUV = uv;
5358
- #else
5359
- pbr_vUV = vec2(0.,0.);
5360
- #endif
5361
- }
5362
- `);
2911
+ /* harmony default export */ __webpack_exports__["default"] = ("uniform mat4 u_MVPMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_NormalMatrix;\n\nvarying vec3 pbr_vPosition;\nvarying vec2 pbr_vUV;\n\n#ifdef HAS_NORMALS\n# ifdef HAS_TANGENTS\nvarying mat3 pbr_vTBN;\n# else\nvarying vec3 pbr_vNormal;\n# endif\n#endif\n\nvoid pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, vec2 uv)\n{\n vec4 pos = u_ModelMatrix * position;\n pbr_vPosition = vec3(pos.xyz) / pos.w;\n\n#ifdef HAS_NORMALS\n#ifdef HAS_TANGENTS\n vec3 normalW = normalize(vec3(u_NormalMatrix * vec4(normal.xyz, 0.0)));\n vec3 tangentW = normalize(vec3(u_ModelMatrix * vec4(tangent.xyz, 0.0)));\n vec3 bitangentW = cross(normalW, tangentW) * tangent.w;\n pbr_vTBN = mat3(tangentW, bitangentW, normalW);\n#else\n pbr_vNormal = normalize(vec3(u_ModelMatrix * vec4(normal.xyz, 0.0)));\n#endif\n#endif\n\n#ifdef HAS_UV\n pbr_vUV = uv;\n#else\n pbr_vUV = vec2(0.,0.);\n#endif\n}\n");
5363
2912
  //# sourceMappingURL=pbr-vertex.glsl.js.map
5364
2913
 
5365
2914
  /***/ }),
@@ -5402,81 +2951,7 @@ const pbr = {
5402
2951
 
5403
2952
  "use strict";
5404
2953
  __webpack_require__.r(__webpack_exports__);
5405
- /* harmony default export */ __webpack_exports__["default"] = (`\
5406
-
5407
- uniform float lighting_uAmbient;
5408
- uniform float lighting_uDiffuse;
5409
- uniform float lighting_uShininess;
5410
- uniform vec3 lighting_uSpecularColor;
5411
-
5412
- vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
5413
- vec3 halfway_direction = normalize(light_direction + view_direction);
5414
- float lambertian = dot(light_direction, normal_worldspace);
5415
- float specular = 0.0;
5416
- if (lambertian > 0.0) {
5417
- float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
5418
- specular = pow(specular_angle, lighting_uShininess);
5419
- }
5420
- lambertian = max(lambertian, 0.0);
5421
- return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;
5422
- }
5423
-
5424
- vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
5425
- vec3 lightColor = surfaceColor;
5426
-
5427
- if (lighting_uEnabled) {
5428
- vec3 view_direction = normalize(cameraPosition - position_worldspace);
5429
- lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;
5430
-
5431
- for (int i = 0; i < MAX_LIGHTS; i++) {
5432
- if (i >= lighting_uPointLightCount) {
5433
- break;
5434
- }
5435
- PointLight pointLight = lighting_uPointLight[i];
5436
- vec3 light_position_worldspace = pointLight.position;
5437
- vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
5438
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
5439
- }
5440
-
5441
- for (int i = 0; i < MAX_LIGHTS; i++) {
5442
- if (i >= lighting_uDirectionalLightCount) {
5443
- break;
5444
- }
5445
- DirectionalLight directionalLight = lighting_uDirectionalLight[i];
5446
- lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
5447
- }
5448
- }
5449
- return lightColor;
5450
- }
5451
-
5452
- vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
5453
- vec3 lightColor = vec3(0, 0, 0);
5454
- vec3 surfaceColor = vec3(0, 0, 0);
5455
-
5456
- if (lighting_uEnabled) {
5457
- vec3 view_direction = normalize(cameraPosition - position_worldspace);
5458
-
5459
- for (int i = 0; i < MAX_LIGHTS; i++) {
5460
- if (i >= lighting_uPointLightCount) {
5461
- break;
5462
- }
5463
- PointLight pointLight = lighting_uPointLight[i];
5464
- vec3 light_position_worldspace = pointLight.position;
5465
- vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
5466
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
5467
- }
5468
-
5469
- for (int i = 0; i < MAX_LIGHTS; i++) {
5470
- if (i >= lighting_uDirectionalLightCount) {
5471
- break;
5472
- }
5473
- DirectionalLight directionalLight = lighting_uDirectionalLight[i];
5474
- lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
5475
- }
5476
- }
5477
- return lightColor;
5478
- }
5479
- `);
2954
+ /* harmony default export */ __webpack_exports__["default"] = ("\nuniform float lighting_uAmbient;\nuniform float lighting_uDiffuse;\nuniform float lighting_uShininess;\nuniform vec3 lighting_uSpecularColor;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, lighting_uShininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * lighting_uDiffuse * surfaceColor + specular * lighting_uSpecularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = lighting_uAmbient * surfaceColor * lighting_uAmbientLight.color;\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting_uEnabled) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uPointLightCount) {\n break;\n }\n PointLight pointLight = lighting_uPointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting_uDirectionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting_uDirectionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n }\n return lightColor;\n}\n");
5480
2955
  //# sourceMappingURL=phong-lighting.glsl.js.map
5481
2956
 
5482
2957
  /***/ }),
@@ -5513,7 +2988,9 @@ function getMaterialUniforms(material) {
5513
2988
  };
5514
2989
  }
5515
2990
 
5516
- function getUniforms(opts = INITIAL_MODULE_OPTIONS) {
2991
+ function getUniforms() {
2992
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : INITIAL_MODULE_OPTIONS;
2993
+
5517
2994
  if (!('material' in opts)) {
5518
2995
  return {};
5519
2996
  }
@@ -5571,7 +3048,8 @@ const DEFAULT_MODULE_OPTIONS = {
5571
3048
  pickingAttribute: false
5572
3049
  };
5573
3050
 
5574
- function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
3051
+ function getUniforms() {
3052
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
5575
3053
  const uniforms = {};
5576
3054
 
5577
3055
  if (opts.pickingSelectedColor !== undefined) {
@@ -5602,92 +3080,8 @@ function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
5602
3080
  return uniforms;
5603
3081
  }
5604
3082
 
5605
- const vs = `\
5606
- uniform bool picking_uActive;
5607
- uniform bool picking_uAttribute;
5608
- uniform vec3 picking_uSelectedColor;
5609
- uniform bool picking_uSelectedColorValid;
5610
-
5611
- out vec4 picking_vRGBcolor_Avalid;
5612
-
5613
- const float COLOR_SCALE = 1. / 255.;
5614
-
5615
- bool picking_isColorValid(vec3 color) {
5616
- return dot(color, vec3(1.0)) > 0.001;
5617
- }
5618
-
5619
- bool isVertexPicked(vec3 vertexColor) {
5620
- return
5621
- picking_uSelectedColorValid &&
5622
- !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));
5623
- }
5624
-
5625
- void picking_setPickingColor(vec3 pickingColor) {
5626
- if (picking_uActive) {
5627
- picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));
5628
-
5629
- if (!picking_uAttribute) {
5630
- picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;
5631
- }
5632
- } else {
5633
- picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));
5634
- }
5635
- }
5636
-
5637
- void picking_setPickingAttribute(float value) {
5638
- if (picking_uAttribute) {
5639
- picking_vRGBcolor_Avalid.r = value;
5640
- }
5641
- }
5642
- void picking_setPickingAttribute(vec2 value) {
5643
- if (picking_uAttribute) {
5644
- picking_vRGBcolor_Avalid.rg = value;
5645
- }
5646
- }
5647
- void picking_setPickingAttribute(vec3 value) {
5648
- if (picking_uAttribute) {
5649
- picking_vRGBcolor_Avalid.rgb = value;
5650
- }
5651
- }
5652
- `;
5653
- const fs = `\
5654
- uniform bool picking_uActive;
5655
- uniform vec3 picking_uSelectedColor;
5656
- uniform vec4 picking_uHighlightColor;
5657
-
5658
- in vec4 picking_vRGBcolor_Avalid;
5659
- vec4 picking_filterHighlightColor(vec4 color) {
5660
- if (picking_uActive) {
5661
- return color;
5662
- }
5663
- bool selected = bool(picking_vRGBcolor_Avalid.a);
5664
-
5665
- if (selected) {
5666
- float highLightAlpha = picking_uHighlightColor.a;
5667
- float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);
5668
- float highLightRatio = highLightAlpha / blendedAlpha;
5669
-
5670
- vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);
5671
- return vec4(blendedRGB, blendedAlpha);
5672
- } else {
5673
- return color;
5674
- }
5675
- }
5676
- vec4 picking_filterPickingColor(vec4 color) {
5677
- if (picking_uActive) {
5678
- if (picking_vRGBcolor_Avalid.a == 0.0) {
5679
- discard;
5680
- }
5681
- return picking_vRGBcolor_Avalid;
5682
- }
5683
- return color;
5684
- }
5685
- vec4 picking_filterColor(vec4 color) {
5686
- vec4 highightColor = picking_filterHighlightColor(color);
5687
- return picking_filterPickingColor(highightColor);
5688
- }
5689
-
5690
- `;
3083
+ const vs = "uniform bool picking_uActive;\nuniform bool picking_uAttribute;\nuniform vec3 picking_uSelectedColor;\nuniform bool picking_uSelectedColorValid;\n\nout vec4 picking_vRGBcolor_Avalid;\n\nconst float COLOR_SCALE = 1. / 255.;\n\nbool picking_isColorValid(vec3 color) {\n return dot(color, vec3(1.0)) > 0.001;\n}\n\nbool isVertexPicked(vec3 vertexColor) {\n return\n picking_uSelectedColorValid &&\n !picking_isColorValid(abs(vertexColor - picking_uSelectedColor));\n}\n\nvoid picking_setPickingColor(vec3 pickingColor) {\n if (picking_uActive) {\n picking_vRGBcolor_Avalid.a = float(picking_isColorValid(pickingColor));\n\n if (!picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = pickingColor * COLOR_SCALE;\n }\n } else {\n picking_vRGBcolor_Avalid.a = float(isVertexPicked(pickingColor));\n }\n}\n\nvoid picking_setPickingAttribute(float value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.r = value;\n }\n}\nvoid picking_setPickingAttribute(vec2 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rg = value;\n }\n}\nvoid picking_setPickingAttribute(vec3 value) {\n if (picking_uAttribute) {\n picking_vRGBcolor_Avalid.rgb = value;\n }\n}\n";
3084
+ const fs = "uniform bool picking_uActive;\nuniform vec3 picking_uSelectedColor;\nuniform vec4 picking_uHighlightColor;\n\nin vec4 picking_vRGBcolor_Avalid;\nvec4 picking_filterHighlightColor(vec4 color) {\n if (picking_uActive) {\n return color;\n }\n bool selected = bool(picking_vRGBcolor_Avalid.a);\n\n if (selected) {\n float highLightAlpha = picking_uHighlightColor.a;\n float blendedAlpha = highLightAlpha + color.a * (1.0 - highLightAlpha);\n float highLightRatio = highLightAlpha / blendedAlpha;\n\n vec3 blendedRGB = mix(color.rgb, picking_uHighlightColor.rgb, highLightRatio);\n return vec4(blendedRGB, blendedAlpha);\n } else {\n return color;\n }\n}\nvec4 picking_filterPickingColor(vec4 color) {\n if (picking_uActive) {\n if (picking_vRGBcolor_Avalid.a == 0.0) {\n discard;\n }\n return picking_vRGBcolor_Avalid;\n }\n return color;\n}\nvec4 picking_filterColor(vec4 color) {\n vec4 highightColor = picking_filterHighlightColor(color);\n return picking_filterPickingColor(highightColor);\n}\n\n";
5691
3085
  const picking = {
5692
3086
  name: 'picking',
5693
3087
  vs,
@@ -5718,7 +3112,9 @@ const DEFAULT_MODULE_OPTIONS = {
5718
3112
  cameraPositionWorld: [0, 0, 0]
5719
3113
  };
5720
3114
 
5721
- function getUniforms(opts = DEFAULT_MODULE_OPTIONS, prevUniforms = {}) {
3115
+ function getUniforms() {
3116
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : DEFAULT_MODULE_OPTIONS;
3117
+ let prevUniforms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
5722
3118
  const uniforms = {};
5723
3119
 
5724
3120
  if (opts.modelMatrix !== undefined) {
@@ -5744,74 +3140,9 @@ function getUniforms(opts = DEFAULT_MODULE_OPTIONS, prevUniforms = {}) {
5744
3140
  return uniforms;
5745
3141
  }
5746
3142
 
5747
- const common = `\
5748
- varying vec4 project_vPositionWorld;
5749
- varying vec3 project_vNormalWorld;
5750
-
5751
- vec4 project_getPosition_World() {
5752
- return project_vPositionWorld;
5753
- }
5754
-
5755
- vec3 project_getNormal_World() {
5756
- return project_vNormalWorld;
5757
- }
5758
- `;
5759
- const vs = `\
5760
- ${common}
5761
- uniform mat4 modelMatrix;
5762
- uniform mat4 viewMatrix;
5763
- uniform mat4 projectionMatrix;
5764
- uniform mat4 viewProjectionMatrix;
5765
- uniform vec3 cameraPositionWorld;
5766
-
5767
- struct World {
5768
- vec3 position;
5769
- vec3 normal;
5770
- };
5771
-
5772
- World world;
5773
-
5774
- void project_setPosition(vec4 position) {
5775
- project_vPositionWorld = position;
5776
- }
5777
-
5778
- void project_setNormal(vec3 normal) {
5779
- project_vNormalWorld = normal;
5780
- }
5781
-
5782
- void project_setPositionAndNormal_World(vec3 position, vec3 normal) {
5783
- world.position = position;
5784
- world.normal = normal;
5785
- }
5786
-
5787
- void project_setPositionAndNormal_Model(vec3 position, vec3 normal) {
5788
- world.position = (modelMatrix * vec4(position, 1.)).xyz;
5789
- world.normal = mat3(modelMatrix) * normal;
5790
- }
5791
-
5792
- vec4 project_model_to_clipspace(vec4 position) {
5793
- return viewProjectionMatrix * modelMatrix * position;
5794
- }
5795
-
5796
- vec4 project_model_to_clipspace(vec3 position) {
5797
- return viewProjectionMatrix * modelMatrix * vec4(position, 1.);
5798
- }
5799
-
5800
- vec4 project_world_to_clipspace(vec3 position) {
5801
- return viewProjectionMatrix * vec4(position, 1.);
5802
- }
5803
-
5804
- vec4 project_view_to_clipspace(vec3 position) {
5805
- return projectionMatrix * vec4(position, 1.);
5806
- }
5807
-
5808
- vec4 project_to_clipspace(vec3 position) {
5809
- return viewProjectionMatrix * vec4(position, 1.);
5810
- }
5811
- `;
5812
- const fs = `
5813
- ${common}\
5814
- `;
3143
+ const 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";
3144
+ const vs = "".concat(common, "\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");
3145
+ const fs = "\n".concat(common);
5815
3146
  const project = {
5816
3147
  name: 'project',
5817
3148
  getUniforms,
@@ -5832,34 +3163,7 @@ const project = {
5832
3163
  "use strict";
5833
3164
  __webpack_require__.r(__webpack_exports__);
5834
3165
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transform", function() { return transform; });
5835
- const vs = `\
5836
- attribute float transform_elementID;
5837
- vec2 transform_getPixelSizeHalf(vec2 size) {
5838
- return vec2(1.) / (2. * size);
5839
- }
5840
-
5841
- vec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {
5842
- float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);
5843
- float xIndex = transform_elementID - (yIndex * texSize[0]);
5844
- return vec2(xIndex, yIndex);
5845
- }
5846
- vec2 transform_getTexCoord(vec2 size) {
5847
- vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);
5848
- vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);
5849
- vec2 coord = indices / size + pixelSizeHalf;
5850
- return coord;
5851
- }
5852
- vec2 transform_getPos(vec2 size) {
5853
- vec2 texCoord = transform_getTexCoord(size);
5854
- vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);
5855
- return pos;
5856
- }
5857
- vec4 transform_getInput(sampler2D texSampler, vec2 size) {
5858
- vec2 texCoord = transform_getTexCoord(size);
5859
- vec4 textureColor = texture2D(texSampler, texCoord);
5860
- return textureColor;
5861
- }
5862
- `;
3166
+ const vs = "attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n";
5863
3167
  const transform = {
5864
3168
  name: 'transform',
5865
3169
  vs,
@@ -5879,11 +3183,7 @@ const transform = {
5879
3183
  "use strict";
5880
3184
  __webpack_require__.r(__webpack_exports__);
5881
3185
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; });
5882
- const fs = `\
5883
- float random(vec3 scale, float seed) {
5884
- return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);
5885
- }
5886
- `;
3186
+ const fs = "float random(vec3 scale, float seed) {\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n";
5887
3187
  const random = {
5888
3188
  name: 'random',
5889
3189
  fs
@@ -5938,7 +3238,8 @@ __webpack_require__.r(__webpack_exports__);
5938
3238
  "use strict";
5939
3239
  __webpack_require__.r(__webpack_exports__);
5940
3240
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return isOldIE; });
5941
- function isOldIE(opts = {}) {
3241
+ function isOldIE() {
3242
+ let opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5942
3243
  const navigator = typeof window !== 'undefined' ? window.navigator || {} : {};
5943
3244
  const userAgent = opts.userAgent || navigator.userAgent || '';
5944
3245
  const isMSIE = userAgent.indexOf('MSIE ') !== -1;
@@ -5965,13 +3266,9 @@ __webpack_require__.r(__webpack_exports__);
5965
3266
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToVec4", function() { return convertToVec4; });
5966
3267
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "../../node_modules/@luma.gl/shadertools/dist/esm/utils/index.js");
5967
3268
 
5968
- const FS100 = `void main() {gl_FragColor = vec4(0);}`;
5969
- const FS_GLES = `\
5970
- out vec4 transform_output;
5971
- void main() {
5972
- transform_output = vec4(0);
5973
- }`;
5974
- const FS300 = `#version 300 es\n${FS_GLES}`;
3269
+ const FS100 = "void main() {gl_FragColor = vec4(0);}";
3270
+ const FS_GLES = "out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}";
3271
+ const FS300 = "#version 300 es\n".concat(FS_GLES);
5975
3272
  function getQualifierDetails(line, qualifiers) {
5976
3273
  qualifiers = Array.isArray(qualifiers) ? qualifiers : [qualifiers];
5977
3274
  const words = line.replace(/^\s+/, '').split(/\s+/);
@@ -5988,7 +3285,8 @@ function getQualifierDetails(line, qualifiers) {
5988
3285
  name
5989
3286
  };
5990
3287
  }
5991
- function getPassthroughFS(options = {}) {
3288
+ function getPassthroughFS() {
3289
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
5992
3290
  const {
5993
3291
  version = 100,
5994
3292
  input,
@@ -6000,7 +3298,7 @@ function getPassthroughFS(options = {}) {
6000
3298
  if (version === 300) {
6001
3299
  return FS300;
6002
3300
  } else if (version > 300) {
6003
- return `#version ${version}\n${FS_GLES}`;
3301
+ return "#version ".concat(version, "\n").concat(FS_GLES);
6004
3302
  }
6005
3303
 
6006
3304
  return FS100;
@@ -6009,20 +3307,10 @@ function getPassthroughFS(options = {}) {
6009
3307
  const outputValue = convertToVec4(input, inputType);
6010
3308
 
6011
3309
  if (version >= 300) {
6012
- return `\
6013
- #version ${version} ${version === 300 ? 'es' : ''}
6014
- in ${inputType} ${input};
6015
- out vec4 ${output};
6016
- void main() {
6017
- ${output} = ${outputValue};
6018
- }`;
3310
+ return "#version ".concat(version, " ").concat(version === 300 ? 'es' : '', "\nin ").concat(inputType, " ").concat(input, ";\nout vec4 ").concat(output, ";\nvoid main() {\n ").concat(output, " = ").concat(outputValue, ";\n}");
6019
3311
  }
6020
3312
 
6021
- return `\
6022
- varying ${inputType} ${input};
6023
- void main() {
6024
- gl_FragColor = ${outputValue};
6025
- }`;
3313
+ return "varying ".concat(inputType, " ").concat(input, ";\nvoid main() {\n gl_FragColor = ").concat(outputValue, ";\n}");
6026
3314
  }
6027
3315
  function typeToChannelSuffix(type) {
6028
3316
  switch (type) {
@@ -6065,13 +3353,13 @@ function typeToChannelCount(type) {
6065
3353
  function convertToVec4(variable, type) {
6066
3354
  switch (type) {
6067
3355
  case 'float':
6068
- return `vec4(${variable}, 0.0, 0.0, 1.0)`;
3356
+ return "vec4(".concat(variable, ", 0.0, 0.0, 1.0)");
6069
3357
 
6070
3358
  case 'vec2':
6071
- return `vec4(${variable}, 0.0, 1.0)`;
3359
+ return "vec4(".concat(variable, ", 0.0, 1.0)");
6072
3360
 
6073
3361
  case 'vec3':
6074
- return `vec4(${variable}, 1.0)`;
3362
+ return "vec4(".concat(variable, ", 1.0)");
6075
3363
 
6076
3364
  case 'vec4':
6077
3365
  return variable;
@@ -6158,7 +3446,8 @@ function identifyGPUVendor(vendor, renderer) {
6158
3446
  }
6159
3447
 
6160
3448
  const compiledGlslExtensions = {};
6161
- function canCompileGLGSExtension(gl, cap, opts = {}) {
3449
+ function canCompileGLGSExtension(gl, cap) {
3450
+ let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
6162
3451
  const feature = WEBGL_FEATURES[cap];
6163
3452
  Object(_assert__WEBPACK_IMPORTED_MODULE_1__["default"])(feature, cap);
6164
3453
 
@@ -6172,7 +3461,7 @@ function canCompileGLGSExtension(gl, cap, opts = {}) {
6172
3461
 
6173
3462
  const extensionName = feature[0];
6174
3463
  const behavior = opts.behavior || 'enable';
6175
- const source = `#extension GL_${extensionName} : ${behavior}\nvoid main(void) {}`;
3464
+ const source = "#extension GL_".concat(extensionName, " : ").concat(behavior, "\nvoid main(void) {}");
6176
3465
  const shader = gl.createShader(35633);
6177
3466
  gl.shaderSource(shader, source);
6178
3467
  gl.compileShader(shader);