@deck.gl/extensions 8.6.0-alpha.3 → 8.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/dist.dev.js +2953 -218
  2. package/package.json +3 -3
package/dist/dist.dev.js CHANGED
@@ -850,12 +850,15 @@ __webpack_require__.r(__webpack_exports__);
850
850
 
851
851
 
852
852
 
853
- const INJECT_SHADER_DECLARATIONS = "\n\n".concat(_inject_shader__WEBPACK_IMPORTED_MODULE_3__["DECLARATION_INJECT_MARKER"], "\n\n");
853
+ const INJECT_SHADER_DECLARATIONS = `\n\n${_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 = "precision highp float;\n\n";
858
+ const FRAGMENT_SHADER_PROLOGUE = `\
859
+ precision highp float;
860
+
861
+ `;
859
862
  function assembleShaders(gl, opts) {
860
863
  const {
861
864
  vs,
@@ -902,7 +905,7 @@ function assembleShader(gl, {
902
905
  versionLine = sourceLines[0];
903
906
  coreSource = sourceLines.slice(1).join('\n');
904
907
  } else {
905
- versionLine = "#version ".concat(glslVersion);
908
+ versionLine = `#version ${glslVersion}`;
906
909
  }
907
910
 
908
911
  const allDefines = {};
@@ -910,13 +913,22 @@ function assembleShader(gl, {
910
913
  Object.assign(allDefines, module.getDefines());
911
914
  });
912
915
  Object.assign(allDefines, defines);
913
- let assembledSource = prologue ? "".concat(versionLine, "\n").concat(getShaderName({
916
+ let assembledSource = prologue ? `\
917
+ ${versionLine}
918
+ ${getShaderName({
914
919
  id,
915
920
  source,
916
921
  type
917
- }), "\n").concat(getShaderType({
922
+ })}
923
+ ${getShaderType({
918
924
  type
919
- }), "\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");
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
932
  const hookFunctionMap = normalizeHookFunctions(hookFunctions);
921
933
  const hookInjections = {};
922
934
  const declInjections = {};
@@ -996,7 +1008,9 @@ function assembleGetUniforms(modules) {
996
1008
  function getShaderType({
997
1009
  type
998
1010
  }) {
999
- return "\n#define SHADER_TYPE_".concat(SHADER_TYPE[type].toUpperCase(), "\n");
1011
+ return `
1012
+ #define SHADER_TYPE_${SHADER_TYPE[type].toUpperCase()}
1013
+ `;
1000
1014
  }
1001
1015
 
1002
1016
  function getShaderName({
@@ -1005,7 +1019,10 @@ function getShaderName({
1005
1019
  type
1006
1020
  }) {
1007
1021
  const injectShaderName = id && typeof id === 'string' && source.indexOf('SHADER_NAME') === -1;
1008
- return injectShaderName ? "\n#define SHADER_NAME ".concat(id, "_").concat(SHADER_TYPE[type], "\n\n") : '';
1022
+ return injectShaderName ? `
1023
+ #define SHADER_NAME ${id}_${SHADER_TYPE[type]}
1024
+
1025
+ ` : '';
1009
1026
  }
1010
1027
 
1011
1028
  function getApplicationDefines(defines = {}) {
@@ -1021,7 +1038,7 @@ function getApplicationDefines(defines = {}) {
1021
1038
  const value = defines[define];
1022
1039
 
1023
1040
  if (value || Number.isFinite(value)) {
1024
- sourceText += "#define ".concat(define.toUpperCase(), " ").concat(defines[define], "\n");
1041
+ sourceText += `#define ${define.toUpperCase()} ${defines[define]}\n`;
1025
1042
  }
1026
1043
  }
1027
1044
 
@@ -1037,10 +1054,10 @@ function getHookFunctions(hookFunctions, hookInjections) {
1037
1054
 
1038
1055
  for (const hookName in hookFunctions) {
1039
1056
  const hookFunction = hookFunctions[hookName];
1040
- result += "void ".concat(hookFunction.signature, " {\n");
1057
+ result += `void ${hookFunction.signature} {\n`;
1041
1058
 
1042
1059
  if (hookFunction.header) {
1043
- result += " ".concat(hookFunction.header);
1060
+ result += ` ${hookFunction.header}`;
1044
1061
  }
1045
1062
 
1046
1063
  if (hookInjections[hookName]) {
@@ -1048,12 +1065,12 @@ function getHookFunctions(hookFunctions, hookInjections) {
1048
1065
  injections.sort((a, b) => a.order - b.order);
1049
1066
 
1050
1067
  for (const injection of injections) {
1051
- result += " ".concat(injection.injection, "\n");
1068
+ result += ` ${injection.injection}\n`;
1052
1069
  }
1053
1070
  }
1054
1071
 
1055
1072
  if (hookFunction.footer) {
1056
- result += " ".concat(hookFunction.footer);
1073
+ result += ` ${hookFunction.footer}`;
1057
1074
  }
1058
1075
 
1059
1076
  result += '}\n';
@@ -1226,7 +1243,7 @@ function injectShader(source, type, inject, injectStandardStubs = false) {
1226
1243
  fragments[i] = fragmentData[i].injection;
1227
1244
  }
1228
1245
 
1229
- const fragmentString = "".concat(fragments.join('\n'), "\n");
1246
+ const fragmentString = `${fragments.join('\n')}\n`;
1230
1247
 
1231
1248
  switch (key) {
1232
1249
  case 'vs:#decl':
@@ -1289,7 +1306,7 @@ function combineInjects(injects) {
1289
1306
  Object(_utils__WEBPACK_IMPORTED_MODULE_2__["assert"])(Array.isArray(injects) && injects.length > 1);
1290
1307
  injects.forEach(inject => {
1291
1308
  for (const key in inject) {
1292
- result[key] = result[key] ? "".concat(result[key], "\n").concat(inject[key]) : inject[key];
1309
+ result[key] = result[key] ? `${result[key]}\n${inject[key]}` : inject[key];
1293
1310
  }
1294
1311
  });
1295
1312
  return result;
@@ -1316,37 +1333,108 @@ function getPlatformShaderDefines(gl) {
1316
1333
 
1317
1334
  switch (debugInfo.gpuVendor.toLowerCase()) {
1318
1335
  case 'nvidia':
1319
- return "#define NVIDIA_GPU\n// Nvidia optimizes away the calculation necessary for emulated fp64\n#define LUMA_FP64_CODE_ELIMINATION_WORKAROUND 1\n";
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
+ `;
1320
1341
 
1321
1342
  case 'intel':
1322
- 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";
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
+ `;
1323
1352
 
1324
1353
  case 'amd':
1325
- return "#define AMD_GPU\n";
1354
+ return `\
1355
+ #define AMD_GPU
1356
+ `;
1326
1357
 
1327
1358
  default:
1328
- 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";
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
+ `;
1329
1368
  }
1330
1369
  }
1331
1370
  function getVersionDefines(gl, glslVersion, isFragment) {
1332
- 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";
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
+ `;
1333
1387
 
1334
1388
  if (Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["hasFeatures"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_FRAG_DEPTH)) {
1335
- 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";
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
+ `;
1336
1399
  }
1337
1400
 
1338
1401
  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)) {
1339
- 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";
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
+ `;
1340
1411
  }
1341
1412
 
1342
1413
  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, {
1343
1414
  behavior: 'require'
1344
1415
  })) {
1345
- 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";
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
+ `;
1346
1425
  }
1347
1426
 
1348
1427
  if (Object(_utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["hasFeatures"])(gl, _utils_webgl_info__WEBPACK_IMPORTED_MODULE_0__["FEATURES"].GLSL_TEXTURE_LOD)) {
1349
- 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";
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
+ `;
1350
1438
  }
1351
1439
 
1352
1440
  return versionDefines;
@@ -1422,7 +1510,7 @@ function instantiateModules(modules, seen) {
1422
1510
  return module;
1423
1511
  }
1424
1512
 
1425
- 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."));
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.`);
1426
1514
  Object(_utils__WEBPACK_IMPORTED_MODULE_1__["assert"])(module.name, 'shader module has no name');
1427
1515
  module = new _shader_module__WEBPACK_IMPORTED_MODULE_0__["default"](module);
1428
1516
  module.dependencies = instantiateModules(module.dependencies);
@@ -1500,7 +1588,12 @@ class ShaderModule {
1500
1588
  Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(false);
1501
1589
  }
1502
1590
 
1503
- return "#define MODULE_".concat(this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_'), "\n").concat(moduleSource, "// END MODULE_").concat(this.name, "\n\n");
1591
+ return `\
1592
+ #define MODULE_${this.name.toUpperCase().replace(/[^0-9a-z]/gi, '_')}
1593
+ ${moduleSource}\
1594
+ // END MODULE_${this.name}
1595
+
1596
+ `;
1504
1597
  }
1505
1598
 
1506
1599
  getUniforms(opts, uniforms) {
@@ -1535,11 +1628,11 @@ class ShaderModule {
1535
1628
  deprecations.forEach(def => {
1536
1629
  switch (def.type) {
1537
1630
  case 'function':
1538
- def.regex = new RegExp("\\b".concat(def.old, "\\("));
1631
+ def.regex = new RegExp(`\\b${def.old}\\(`);
1539
1632
  break;
1540
1633
 
1541
1634
  default:
1542
- def.regex = new RegExp("".concat(def.type, " ").concat(def.old, ";"));
1635
+ def.regex = new RegExp(`${def.type} ${def.old};`);
1543
1636
  }
1544
1637
  });
1545
1638
  return deprecations;
@@ -1554,7 +1647,7 @@ class ShaderModule {
1554
1647
 
1555
1648
  if (key in opts && !propDef.private) {
1556
1649
  if (propDef.validate) {
1557
- Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(propDef.validate(opts[key], propDef), "".concat(this.name, ": invalid ").concat(key));
1650
+ Object(_utils__WEBPACK_IMPORTED_MODULE_0__["assert"])(propDef.validate(opts[key], propDef), `${this.name}: invalid ${key}`);
1558
1651
  }
1559
1652
 
1560
1653
  uniforms[key] = opts[key];
@@ -1617,7 +1710,7 @@ function normalizeInjections(injections) {
1617
1710
  __webpack_require__.r(__webpack_exports__);
1618
1711
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return transpileShader; });
1619
1712
  function testVariable(qualifier) {
1620
- return new RegExp("\\b".concat(qualifier, "[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)"), 'g');
1713
+ return new RegExp(`\\b${qualifier}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`, 'g');
1621
1714
  }
1622
1715
 
1623
1716
  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(']];
@@ -1638,7 +1731,7 @@ function transpileShader(source, targetGLSLVersion, isVertex) {
1638
1731
  return isVertex ? convertShader(source, ES100_VERTEX_REPLACEMENTS) : convertFragmentShaderTo100(source);
1639
1732
 
1640
1733
  default:
1641
- throw new Error("unknown GLSL version ".concat(targetGLSLVersion));
1734
+ throw new Error(`unknown GLSL version ${targetGLSLVersion}`);
1642
1735
  }
1643
1736
  }
1644
1737
 
@@ -1656,10 +1749,10 @@ function convertFragmentShaderTo300(source) {
1656
1749
 
1657
1750
  if (outputMatch) {
1658
1751
  const outputName = outputMatch[1];
1659
- source = source.replace(new RegExp("\\b".concat(ES100_FRAGMENT_OUTPUT_NAME, "\\b"), 'g'), outputName);
1752
+ source = source.replace(new RegExp(`\\b${ES100_FRAGMENT_OUTPUT_NAME}\\b`, 'g'), outputName);
1660
1753
  } else {
1661
1754
  const outputName = 'fragmentColor';
1662
- 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);
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);
1663
1756
  }
1664
1757
 
1665
1758
  return source;
@@ -1671,7 +1764,7 @@ function convertFragmentShaderTo100(source) {
1671
1764
 
1672
1765
  if (outputMatch) {
1673
1766
  const outputName = outputMatch[1];
1674
- source = source.replace(ES300_FRAGMENT_OUTPUT_REGEX, '').replace(new RegExp("\\b".concat(outputName, "\\b"), 'g'), ES100_FRAGMENT_OUTPUT_NAME);
1767
+ source = source.replace(ES300_FRAGMENT_OUTPUT_REGEX, '').replace(new RegExp(`\\b${outputName}\\b`, 'g'), ES100_FRAGMENT_OUTPUT_NAME);
1675
1768
  }
1676
1769
 
1677
1770
  return source;
@@ -1708,7 +1801,14 @@ function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
1708
1801
  }
1709
1802
 
1710
1803
  const vs = null;
1711
- 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";
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
+ `;
1712
1812
  const dirlight = {
1713
1813
  name: 'dirlight',
1714
1814
  vs,
@@ -1730,7 +1830,154 @@ const dirlight = {
1730
1830
  "use strict";
1731
1831
  __webpack_require__.r(__webpack_exports__);
1732
1832
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp32", function() { return fp32; });
1733
- 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";
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
+ `;
1734
1981
  const fp32 = {
1735
1982
  name: 'fp32',
1736
1983
  vs: fp32shader,
@@ -1749,7 +1996,149 @@ const fp32 = {
1749
1996
 
1750
1997
  "use strict";
1751
1998
  __webpack_require__.r(__webpack_exports__);
1752
- /* 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");
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
+ `);
1753
2142
  //# sourceMappingURL=fp64-arithmetic.glsl.js.map
1754
2143
 
1755
2144
  /***/ }),
@@ -1763,157 +2152,1320 @@ __webpack_require__.r(__webpack_exports__);
1763
2152
 
1764
2153
  "use strict";
1765
2154
  __webpack_require__.r(__webpack_exports__);
1766
- /* 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");
1767
- //# sourceMappingURL=fp64-functions.glsl.js.map
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
+ }
1768
2207
 
1769
- /***/ }),
2208
+ vec2 exp_fp64(vec2 a) {
1770
2209
 
1771
- /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-utils.js":
1772
- /*!********************************************************************************************************!*\
1773
- !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-utils.js ***!
1774
- \********************************************************************************************************/
1775
- /*! exports provided: fp64ify, fp64LowPart, fp64ifyMatrix4 */
1776
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2210
+ const int k_power = 4;
2211
+ const float k = 16.0;
1777
2212
 
1778
- "use strict";
1779
- __webpack_require__.r(__webpack_exports__);
1780
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64ify", function() { return fp64ify; });
1781
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64LowPart", function() { return fp64LowPart; });
1782
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64ifyMatrix4", function() { return fp64ifyMatrix4; });
1783
- function fp64ify(a, out = [], startIndex = 0) {
1784
- const hiPart = Math.fround(a);
1785
- const loPart = a - hiPart;
1786
- out[startIndex] = hiPart;
1787
- out[startIndex + 1] = loPart;
1788
- return out;
1789
- }
1790
- function fp64LowPart(a) {
1791
- return a - Math.fround(a);
1792
- }
1793
- function fp64ifyMatrix4(matrix) {
1794
- const matrixFP64 = new Float32Array(32);
2213
+ const float inv_k = 1.0 / k;
1795
2214
 
1796
- for (let i = 0; i < 4; ++i) {
1797
- for (let j = 0; j < 4; ++j) {
1798
- const index = i * 4 + j;
1799
- fp64ify(matrix[j * 4 + i], matrixFP64, index * 2);
1800
- }
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));
1801
2245
  }
1802
2246
 
1803
- return matrixFP64;
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);
1804
2254
  }
1805
- //# sourceMappingURL=fp64-utils.js.map
1806
2255
 
1807
- /***/ }),
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
1808
2267
 
1809
- /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64.js":
1810
- /*!**************************************************************************************************!*\
1811
- !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64.js ***!
1812
- \**************************************************************************************************/
1813
- /*! exports provided: fp64ify, fp64LowPart, fp64ifyMatrix4, fp64arithmetic, fp64 */
1814
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2268
+ x = sub_fp64(sum_fp64(x, mul_fp64(a, exp_fp64(-x))), s);
2269
+ return x;
2270
+ }
1815
2271
 
1816
- "use strict";
1817
- __webpack_require__.r(__webpack_exports__);
1818
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64arithmetic", function() { return fp64arithmetic; });
1819
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64", function() { return fp64; });
1820
- /* harmony import */ var _fp64_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fp64-utils */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-utils.js");
1821
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fp64ify", function() { return _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ify"]; });
2272
+ vec2 sin_taylor_fp64(vec2 a) {
2273
+ vec2 r, s, t, x;
1822
2274
 
1823
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fp64LowPart", function() { return _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64LowPart"]; });
2275
+ if (a.x == 0.0 && a.y == 0.0) {
2276
+ return vec2(0.0, 0.0);
2277
+ }
1824
2278
 
1825
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fp64ifyMatrix4", function() { return _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ifyMatrix4"]; });
2279
+ x = -mul_fp64(a, a);
2280
+ s = a;
2281
+ r = a;
1826
2282
 
1827
- /* harmony import */ var _fp64_arithmetic_glsl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fp64-arithmetic.glsl */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-arithmetic.glsl.js");
1828
- /* harmony import */ var _fp64_functions_glsl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fp64-functions.glsl */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-functions.glsl.js");
2283
+ r = mul_fp64(r, x);
2284
+ t = mul_fp64(r, INVERSE_FACTORIAL_3_FP64);
2285
+ s = sum_fp64(s, t);
1829
2286
 
2287
+ r = mul_fp64(r, x);
2288
+ t = mul_fp64(r, INVERSE_FACTORIAL_5_FP64);
2289
+ s = sum_fp64(s, t);
1830
2290
 
1831
2291
 
1832
- const CONST_UNIFORMS = {
1833
- ONE: 1.0
1834
- };
1835
2292
 
1836
2293
 
1837
- function getUniforms() {
1838
- return CONST_UNIFORMS;
2294
+
2295
+
2296
+ return s;
1839
2297
  }
1840
2298
 
1841
- const fp64arithmetic = {
1842
- name: 'fp64-arithmetic',
1843
- vs: _fp64_arithmetic_glsl__WEBPACK_IMPORTED_MODULE_1__["default"],
1844
- fs: null,
1845
- getUniforms,
1846
- fp64ify: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ify"],
1847
- fp64LowPart: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64LowPart"],
1848
- fp64ifyMatrix4: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ifyMatrix4"]
1849
- };
1850
- const fp64 = {
1851
- name: 'fp64',
1852
- vs: _fp64_functions_glsl__WEBPACK_IMPORTED_MODULE_2__["default"],
1853
- fs: null,
1854
- dependencies: [fp64arithmetic],
1855
- fp64ify: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ify"],
1856
- fp64LowPart: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64LowPart"],
1857
- fp64ifyMatrix4: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ifyMatrix4"]
1858
- };
1859
- //# sourceMappingURL=fp64.js.map
2299
+ vec2 cos_taylor_fp64(vec2 a) {
2300
+ vec2 r, s, t, x;
1860
2301
 
1861
- /***/ }),
2302
+ if (a.x == 0.0 && a.y == 0.0) {
2303
+ return vec2(1.0, 0.0);
2304
+ }
1862
2305
 
1863
- /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fxaa/fxaa.js":
1864
- /*!**************************************************************************************************!*\
1865
- !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/fxaa/fxaa.js ***!
1866
- \**************************************************************************************************/
1867
- /*! exports provided: fxaa */
1868
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
2306
+ x = -mul_fp64(a, a);
2307
+ r = x;
2308
+ s = sum_fp64(vec2(1.0, 0.0), r * 0.5);
1869
2309
 
1870
- "use strict";
1871
- __webpack_require__.r(__webpack_exports__);
1872
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fxaa", function() { return fxaa; });
1873
- /**
1874
- * ORIGINAL LICENCE
1875
- * @license
1876
- * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
1877
- *
1878
- * Redistribution and use in source and binary forms, with or without
1879
- * modification, are permitted provided that the following conditions
1880
- * are met:
1881
- * * Redistributions of source code must retain the above copyright
1882
- * notice, this list of conditions and the following disclaimer.
1883
- * * Redistributions in binary form must reproduce the above copyright
1884
- * notice, this list of conditions and the following disclaimer in the
1885
- * documentation and/or other materials provided with the distribution.
1886
- * * Neither the name of NVIDIA CORPORATION nor the names of its
1887
- * contributors may be used to endorse or promote products derived
1888
- * from this software without specific prior written permission.
1889
- *
1890
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
1891
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1892
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
1893
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
1894
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
1895
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
1896
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
1897
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
1898
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1899
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1900
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1901
- */
1902
- 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";
1903
- const fxaa = {
1904
- name: 'fxaa',
1905
- uniforms: {},
1906
- fs,
1907
- passes: [{
1908
- sampler: true
1909
- }]
1910
- };
1911
- //# sourceMappingURL=fxaa.js.map
2310
+ r = mul_fp64(r, x);
2311
+ t = mul_fp64(r, INVERSE_FACTORIAL_4_FP64);
2312
+ s = sum_fp64(s, t);
1912
2313
 
1913
- /***/ }),
2314
+ r = mul_fp64(r, x);
2315
+ t = mul_fp64(r, INVERSE_FACTORIAL_6_FP64);
2316
+ s = sum_fp64(s, t);
1914
2317
 
1915
- /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/image-adjust-filters/brightnesscontrast.js":
1916
- /*!********************************************************************************************************************************!*\
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
+ `);
2785
+ //# sourceMappingURL=fp64-functions.glsl.js.map
2786
+
2787
+ /***/ }),
2788
+
2789
+ /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-utils.js":
2790
+ /*!********************************************************************************************************!*\
2791
+ !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-utils.js ***!
2792
+ \********************************************************************************************************/
2793
+ /*! exports provided: fp64ify, fp64LowPart, fp64ifyMatrix4 */
2794
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2795
+
2796
+ "use strict";
2797
+ __webpack_require__.r(__webpack_exports__);
2798
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64ify", function() { return fp64ify; });
2799
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64LowPart", function() { return fp64LowPart; });
2800
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64ifyMatrix4", function() { return fp64ifyMatrix4; });
2801
+ function fp64ify(a, out = [], startIndex = 0) {
2802
+ const hiPart = Math.fround(a);
2803
+ const loPart = a - hiPart;
2804
+ out[startIndex] = hiPart;
2805
+ out[startIndex + 1] = loPart;
2806
+ return out;
2807
+ }
2808
+ function fp64LowPart(a) {
2809
+ return a - Math.fround(a);
2810
+ }
2811
+ function fp64ifyMatrix4(matrix) {
2812
+ const matrixFP64 = new Float32Array(32);
2813
+
2814
+ for (let i = 0; i < 4; ++i) {
2815
+ for (let j = 0; j < 4; ++j) {
2816
+ const index = i * 4 + j;
2817
+ fp64ify(matrix[j * 4 + i], matrixFP64, index * 2);
2818
+ }
2819
+ }
2820
+
2821
+ return matrixFP64;
2822
+ }
2823
+ //# sourceMappingURL=fp64-utils.js.map
2824
+
2825
+ /***/ }),
2826
+
2827
+ /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64.js":
2828
+ /*!**************************************************************************************************!*\
2829
+ !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64.js ***!
2830
+ \**************************************************************************************************/
2831
+ /*! exports provided: fp64ify, fp64LowPart, fp64ifyMatrix4, fp64arithmetic, fp64 */
2832
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2833
+
2834
+ "use strict";
2835
+ __webpack_require__.r(__webpack_exports__);
2836
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64arithmetic", function() { return fp64arithmetic; });
2837
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fp64", function() { return fp64; });
2838
+ /* harmony import */ var _fp64_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./fp64-utils */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-utils.js");
2839
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fp64ify", function() { return _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ify"]; });
2840
+
2841
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fp64LowPart", function() { return _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64LowPart"]; });
2842
+
2843
+ /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fp64ifyMatrix4", function() { return _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ifyMatrix4"]; });
2844
+
2845
+ /* harmony import */ var _fp64_arithmetic_glsl__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fp64-arithmetic.glsl */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-arithmetic.glsl.js");
2846
+ /* harmony import */ var _fp64_functions_glsl__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fp64-functions.glsl */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fp64/fp64-functions.glsl.js");
2847
+
2848
+
2849
+
2850
+ const CONST_UNIFORMS = {
2851
+ ONE: 1.0
2852
+ };
2853
+
2854
+
2855
+ function getUniforms() {
2856
+ return CONST_UNIFORMS;
2857
+ }
2858
+
2859
+ const fp64arithmetic = {
2860
+ name: 'fp64-arithmetic',
2861
+ vs: _fp64_arithmetic_glsl__WEBPACK_IMPORTED_MODULE_1__["default"],
2862
+ fs: null,
2863
+ getUniforms,
2864
+ fp64ify: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ify"],
2865
+ fp64LowPart: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64LowPart"],
2866
+ fp64ifyMatrix4: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ifyMatrix4"]
2867
+ };
2868
+ const fp64 = {
2869
+ name: 'fp64',
2870
+ vs: _fp64_functions_glsl__WEBPACK_IMPORTED_MODULE_2__["default"],
2871
+ fs: null,
2872
+ dependencies: [fp64arithmetic],
2873
+ fp64ify: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ify"],
2874
+ fp64LowPart: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64LowPart"],
2875
+ fp64ifyMatrix4: _fp64_utils__WEBPACK_IMPORTED_MODULE_0__["fp64ifyMatrix4"]
2876
+ };
2877
+ //# sourceMappingURL=fp64.js.map
2878
+
2879
+ /***/ }),
2880
+
2881
+ /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/fxaa/fxaa.js":
2882
+ /*!**************************************************************************************************!*\
2883
+ !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/fxaa/fxaa.js ***!
2884
+ \**************************************************************************************************/
2885
+ /*! exports provided: fxaa */
2886
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
2887
+
2888
+ "use strict";
2889
+ __webpack_require__.r(__webpack_exports__);
2890
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fxaa", function() { return fxaa; });
2891
+ /**
2892
+ * ORIGINAL LICENCE
2893
+ * @license
2894
+ * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
2895
+ *
2896
+ * Redistribution and use in source and binary forms, with or without
2897
+ * modification, are permitted provided that the following conditions
2898
+ * are met:
2899
+ * * Redistributions of source code must retain the above copyright
2900
+ * notice, this list of conditions and the following disclaimer.
2901
+ * * Redistributions in binary form must reproduce the above copyright
2902
+ * notice, this list of conditions and the following disclaimer in the
2903
+ * documentation and/or other materials provided with the distribution.
2904
+ * * Neither the name of NVIDIA CORPORATION nor the names of its
2905
+ * contributors may be used to endorse or promote products derived
2906
+ * from this software without specific prior written permission.
2907
+ *
2908
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
2909
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2910
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2911
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
2912
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
2913
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2914
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
2915
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
2916
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2917
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2918
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2919
+ */
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
+ `;
3455
+ const fxaa = {
3456
+ name: 'fxaa',
3457
+ uniforms: {},
3458
+ fs,
3459
+ passes: [{
3460
+ sampler: true
3461
+ }]
3462
+ };
3463
+ //# sourceMappingURL=fxaa.js.map
3464
+
3465
+ /***/ }),
3466
+
3467
+ /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/image-adjust-filters/brightnesscontrast.js":
3468
+ /*!********************************************************************************************************************************!*\
1917
3469
  !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/image-adjust-filters/brightnesscontrast.js ***!
1918
3470
  \********************************************************************************************************************************/
1919
3471
  /*! exports provided: brightnessContrast */
@@ -1922,7 +3474,24 @@ const fxaa = {
1922
3474
  "use strict";
1923
3475
  __webpack_require__.r(__webpack_exports__);
1924
3476
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "brightnessContrast", function() { return brightnessContrast; });
1925
- 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";
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
+ `;
1926
3495
  const uniforms = {
1927
3496
  brightness: {
1928
3497
  value: 0,
@@ -1957,7 +3526,28 @@ const brightnessContrast = {
1957
3526
  "use strict";
1958
3527
  __webpack_require__.r(__webpack_exports__);
1959
3528
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "denoise", function() { return denoise; });
1960
- 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";
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
+ `;
1961
3551
  const uniforms = {
1962
3552
  strength: {
1963
3553
  value: 0.5,
@@ -1990,7 +3580,34 @@ const denoise = {
1990
3580
  "use strict";
1991
3581
  __webpack_require__.r(__webpack_exports__);
1992
3582
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hueSaturation", function() { return hueSaturation; });
1993
- 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";
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
+ `;
1994
3611
  const uniforms = {
1995
3612
  hue: {
1996
3613
  value: 0,
@@ -2025,7 +3642,25 @@ const hueSaturation = {
2025
3642
  "use strict";
2026
3643
  __webpack_require__.r(__webpack_exports__);
2027
3644
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noise", function() { return noise; });
2028
- 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";
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
+ `;
2029
3664
  const uniforms = {
2030
3665
  amount: {
2031
3666
  value: 0.5,
@@ -2055,7 +3690,26 @@ const noise = {
2055
3690
  "use strict";
2056
3691
  __webpack_require__.r(__webpack_exports__);
2057
3692
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sepia", function() { return sepia; });
2058
- 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";
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
+ `;
2059
3713
  const uniforms = {
2060
3714
  amount: {
2061
3715
  value: 0.5,
@@ -2085,7 +3739,21 @@ const sepia = {
2085
3739
  "use strict";
2086
3740
  __webpack_require__.r(__webpack_exports__);
2087
3741
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vibrance", function() { return vibrance; });
2088
- 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";
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
+ `;
2089
3757
  const uniforms = {
2090
3758
  amount: {
2091
3759
  value: 0,
@@ -2115,7 +3783,20 @@ const vibrance = {
2115
3783
  "use strict";
2116
3784
  __webpack_require__.r(__webpack_exports__);
2117
3785
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vignette", function() { return vignette; });
2118
- 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";
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
+ `;
2119
3800
  const uniforms = {
2120
3801
  radius: {
2121
3802
  value: 0.5,
@@ -2152,7 +3833,43 @@ __webpack_require__.r(__webpack_exports__);
2152
3833
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tiltShift", function() { return tiltShift; });
2153
3834
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
2154
3835
 
2155
- 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";
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
+ `;
2156
3873
  const uniforms = {
2157
3874
  blurRadius: {
2158
3875
  value: 15,
@@ -2204,7 +3921,33 @@ __webpack_require__.r(__webpack_exports__);
2204
3921
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "triangleBlur", function() { return triangleBlur; });
2205
3922
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
2206
3923
 
2207
- 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";
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
+ `;
2208
3951
  const uniforms = {
2209
3952
  radius: {
2210
3953
  value: 20,
@@ -2249,7 +3992,32 @@ __webpack_require__.r(__webpack_exports__);
2249
3992
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zoomBlur", function() { return zoomBlur; });
2250
3993
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
2251
3994
 
2252
- 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";
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
+ `;
2253
4021
  const uniforms = {
2254
4022
  center: [0.5, 0.5],
2255
4023
  strength: {
@@ -2281,7 +4049,40 @@ const zoomBlur = {
2281
4049
  "use strict";
2282
4050
  __webpack_require__.r(__webpack_exports__);
2283
4051
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "colorHalftone", function() { return colorHalftone; });
2284
- 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";
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
+ `;
2285
4086
  const uniforms = {
2286
4087
  center: [0.5, 0.5],
2287
4088
  angle: {
@@ -2318,7 +4119,28 @@ const colorHalftone = {
2318
4119
  "use strict";
2319
4120
  __webpack_require__.r(__webpack_exports__);
2320
4121
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dotScreen", function() { return dotScreen; });
2321
- 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";
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
+ `;
2322
4144
  const uniforms = {
2323
4145
  center: [0.5, 0.5],
2324
4146
  angle: {
@@ -2357,7 +4179,56 @@ __webpack_require__.r(__webpack_exports__);
2357
4179
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "edgeWork", function() { return edgeWork; });
2358
4180
  /* harmony import */ var _utils_random__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/random */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/utils/random.js");
2359
4181
 
2360
- 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";
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
+ `;
2361
4232
  const uniforms = {
2362
4233
  radius: {
2363
4234
  value: 2,
@@ -2400,7 +4271,48 @@ const edgeWork = {
2400
4271
  "use strict";
2401
4272
  __webpack_require__.r(__webpack_exports__);
2402
4273
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hexagonalPixelate", function() { return hexagonalPixelate; });
2403
- 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";
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
+ `;
2404
4316
  const uniforms = {
2405
4317
  center: {
2406
4318
  value: [0.5, 0.5],
@@ -2435,7 +4347,33 @@ const hexagonalPixelate = {
2435
4347
  "use strict";
2436
4348
  __webpack_require__.r(__webpack_exports__);
2437
4349
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ink", function() { return ink; });
2438
- 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";
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
+ `;
2439
4377
  const uniforms = {
2440
4378
  strength: {
2441
4379
  value: 0.25,
@@ -2465,7 +4403,26 @@ const ink = {
2465
4403
  "use strict";
2466
4404
  __webpack_require__.r(__webpack_exports__);
2467
4405
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "magnify", function() { return magnify; });
2468
- 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";
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
+ `;
2469
4426
  const uniforms = {
2470
4427
  screenXY: [0, 0],
2471
4428
  radiusPixels: 200,
@@ -2497,7 +4454,33 @@ __webpack_require__.r(__webpack_exports__);
2497
4454
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bulgePinch", function() { return bulgePinch; });
2498
4455
  /* harmony import */ var _warp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warp */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/image-warp-filters/warp.js");
2499
4456
 
2500
- 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";
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
+ `;
2501
4484
  const uniforms = {
2502
4485
  center: [0.5, 0.5],
2503
4486
  radius: {
@@ -2536,7 +4519,35 @@ __webpack_require__.r(__webpack_exports__);
2536
4519
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "swirl", function() { return swirl; });
2537
4520
  /* harmony import */ var _warp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./warp */ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/image-warp-filters/warp.js");
2538
4521
 
2539
- 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";
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
+ `;
2540
4551
  const uniforms = {
2541
4552
  center: [0.5, 0.5],
2542
4553
  radius: {
@@ -2573,7 +4584,17 @@ const swirl = {
2573
4584
  "use strict";
2574
4585
  __webpack_require__.r(__webpack_exports__);
2575
4586
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "warp", function() { return warp; });
2576
- 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";
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
+ `;
2577
4598
  const warp = {
2578
4599
  name: 'warp',
2579
4600
  fs
@@ -2719,16 +4740,49 @@ __webpack_require__.r(__webpack_exports__);
2719
4740
 
2720
4741
  /***/ }),
2721
4742
 
2722
- /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/lights/lights.glsl.js":
2723
- /*!***********************************************************************************************************!*\
2724
- !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/lights/lights.glsl.js ***!
2725
- \***********************************************************************************************************/
2726
- /*! exports provided: default */
2727
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
4743
+ /***/ "../../node_modules/@luma.gl/shadertools/dist/esm/modules/lights/lights.glsl.js":
4744
+ /*!***********************************************************************************************************!*\
4745
+ !*** /Users/alasarr/dev/deck.gl/node_modules/@luma.gl/shadertools/dist/esm/modules/lights/lights.glsl.js ***!
4746
+ \***********************************************************************************************************/
4747
+ /*! exports provided: default */
4748
+ /***/ (function(module, __webpack_exports__, __webpack_require__) {
4749
+
4750
+ "use strict";
4751
+ __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
+ }
2728
4783
 
2729
- "use strict";
2730
- __webpack_require__.r(__webpack_exports__);
2731
- /* 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");
4784
+ #endif
4785
+ `);
2732
4786
  //# sourceMappingURL=lights.glsl.js.map
2733
4787
 
2734
4788
  /***/ }),
@@ -2770,14 +4824,14 @@ function getLightSourceUniforms({
2770
4824
  }
2771
4825
 
2772
4826
  pointLights.forEach((pointLight, index) => {
2773
- lightSourceUniforms["lighting_uPointLight[".concat(index, "].color")] = convertColor(pointLight);
2774
- lightSourceUniforms["lighting_uPointLight[".concat(index, "].position")] = pointLight.position;
2775
- lightSourceUniforms["lighting_uPointLight[".concat(index, "].attenuation")] = pointLight.attenuation || [1, 0, 0];
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];
2776
4830
  });
2777
4831
  lightSourceUniforms.lighting_uPointLightCount = pointLights.length;
2778
4832
  directionalLights.forEach((directionalLight, index) => {
2779
- lightSourceUniforms["lighting_uDirectionalLight[".concat(index, "].color")] = convertColor(directionalLight);
2780
- lightSourceUniforms["lighting_uDirectionalLight[".concat(index, "].direction")] = directionalLight.direction;
4833
+ lightSourceUniforms[`lighting_uDirectionalLight[${index}].color`] = convertColor(directionalLight);
4834
+ lightSourceUniforms[`lighting_uDirectionalLight[${index}].direction`] = directionalLight.direction;
2781
4835
  });
2782
4836
  lightSourceUniforms.lighting_uDirectionalLightCount = directionalLights.length;
2783
4837
  return lightSourceUniforms;
@@ -2863,8 +4917,33 @@ const lights = {
2863
4917
  __webpack_require__.r(__webpack_exports__);
2864
4918
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MODULE_INJECTORS_VS", function() { return MODULE_INJECTORS_VS; });
2865
4919
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MODULE_INJECTORS_FS", function() { return MODULE_INJECTORS_FS; });
2866
- const MODULE_INJECTORS_VS = "#ifdef MODULE_LOGDEPTH\n logdepth_adjustPosition(gl_Position);\n#endif\n";
2867
- 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";
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
+ `;
2868
4947
  //# sourceMappingURL=module-injectors.js.map
2869
4948
 
2870
4949
  /***/ }),
@@ -2878,7 +4957,357 @@ const MODULE_INJECTORS_FS = "#ifdef MODULE_MATERIAL\n gl_FragColor = material_f
2878
4957
 
2879
4958
  "use strict";
2880
4959
  __webpack_require__.r(__webpack_exports__);
2881
- /* 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");
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
+ `);
2882
5311
  //# sourceMappingURL=pbr-fragment.glsl.js.map
2883
5312
 
2884
5313
  /***/ }),
@@ -2892,7 +5321,45 @@ __webpack_require__.r(__webpack_exports__);
2892
5321
 
2893
5322
  "use strict";
2894
5323
  __webpack_require__.r(__webpack_exports__);
2895
- /* 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");
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
+ `);
2896
5363
  //# sourceMappingURL=pbr-vertex.glsl.js.map
2897
5364
 
2898
5365
  /***/ }),
@@ -2935,7 +5402,81 @@ const pbr = {
2935
5402
 
2936
5403
  "use strict";
2937
5404
  __webpack_require__.r(__webpack_exports__);
2938
- /* 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");
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
+ `);
2939
5480
  //# sourceMappingURL=phong-lighting.glsl.js.map
2940
5481
 
2941
5482
  /***/ }),
@@ -3061,8 +5602,92 @@ function getUniforms(opts = DEFAULT_MODULE_OPTIONS) {
3061
5602
  return uniforms;
3062
5603
  }
3063
5604
 
3064
- 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";
3065
- 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";
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
+ `;
3066
5691
  const picking = {
3067
5692
  name: 'picking',
3068
5693
  vs,
@@ -3119,9 +5744,74 @@ function getUniforms(opts = DEFAULT_MODULE_OPTIONS, prevUniforms = {}) {
3119
5744
  return uniforms;
3120
5745
  }
3121
5746
 
3122
- 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";
3123
- 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");
3124
- const fs = "\n".concat(common);
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
+ `;
3125
5815
  const project = {
3126
5816
  name: 'project',
3127
5817
  getUniforms,
@@ -3142,7 +5832,34 @@ const project = {
3142
5832
  "use strict";
3143
5833
  __webpack_require__.r(__webpack_exports__);
3144
5834
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transform", function() { return transform; });
3145
- 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";
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
+ `;
3146
5863
  const transform = {
3147
5864
  name: 'transform',
3148
5865
  vs,
@@ -3162,7 +5879,11 @@ const transform = {
3162
5879
  "use strict";
3163
5880
  __webpack_require__.r(__webpack_exports__);
3164
5881
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "random", function() { return random; });
3165
- const fs = "float random(vec3 scale, float seed) {\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n";
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
+ `;
3166
5887
  const random = {
3167
5888
  name: 'random',
3168
5889
  fs
@@ -3244,9 +5965,13 @@ __webpack_require__.r(__webpack_exports__);
3244
5965
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToVec4", function() { return convertToVec4; });
3245
5966
  /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils */ "../../node_modules/@luma.gl/shadertools/dist/esm/utils/index.js");
3246
5967
 
3247
- const FS100 = "void main() {gl_FragColor = vec4(0);}";
3248
- const FS_GLES = "out vec4 transform_output;\nvoid main() {\n transform_output = vec4(0);\n}";
3249
- const FS300 = "#version 300 es\n".concat(FS_GLES);
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}`;
3250
5975
  function getQualifierDetails(line, qualifiers) {
3251
5976
  qualifiers = Array.isArray(qualifiers) ? qualifiers : [qualifiers];
3252
5977
  const words = line.replace(/^\s+/, '').split(/\s+/);
@@ -3275,7 +6000,7 @@ function getPassthroughFS(options = {}) {
3275
6000
  if (version === 300) {
3276
6001
  return FS300;
3277
6002
  } else if (version > 300) {
3278
- return "#version ".concat(version, "\n").concat(FS_GLES);
6003
+ return `#version ${version}\n${FS_GLES}`;
3279
6004
  }
3280
6005
 
3281
6006
  return FS100;
@@ -3284,10 +6009,20 @@ function getPassthroughFS(options = {}) {
3284
6009
  const outputValue = convertToVec4(input, inputType);
3285
6010
 
3286
6011
  if (version >= 300) {
3287
- 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}");
6012
+ return `\
6013
+ #version ${version} ${version === 300 ? 'es' : ''}
6014
+ in ${inputType} ${input};
6015
+ out vec4 ${output};
6016
+ void main() {
6017
+ ${output} = ${outputValue};
6018
+ }`;
3288
6019
  }
3289
6020
 
3290
- return "varying ".concat(inputType, " ").concat(input, ";\nvoid main() {\n gl_FragColor = ").concat(outputValue, ";\n}");
6021
+ return `\
6022
+ varying ${inputType} ${input};
6023
+ void main() {
6024
+ gl_FragColor = ${outputValue};
6025
+ }`;
3291
6026
  }
3292
6027
  function typeToChannelSuffix(type) {
3293
6028
  switch (type) {
@@ -3330,13 +6065,13 @@ function typeToChannelCount(type) {
3330
6065
  function convertToVec4(variable, type) {
3331
6066
  switch (type) {
3332
6067
  case 'float':
3333
- return "vec4(".concat(variable, ", 0.0, 0.0, 1.0)");
6068
+ return `vec4(${variable}, 0.0, 0.0, 1.0)`;
3334
6069
 
3335
6070
  case 'vec2':
3336
- return "vec4(".concat(variable, ", 0.0, 1.0)");
6071
+ return `vec4(${variable}, 0.0, 1.0)`;
3337
6072
 
3338
6073
  case 'vec3':
3339
- return "vec4(".concat(variable, ", 1.0)");
6074
+ return `vec4(${variable}, 1.0)`;
3340
6075
 
3341
6076
  case 'vec4':
3342
6077
  return variable;
@@ -3437,7 +6172,7 @@ function canCompileGLGSExtension(gl, cap, opts = {}) {
3437
6172
 
3438
6173
  const extensionName = feature[0];
3439
6174
  const behavior = opts.behavior || 'enable';
3440
- const source = "#extension GL_".concat(extensionName, " : ").concat(behavior, "\nvoid main(void) {}");
6175
+ const source = `#extension GL_${extensionName} : ${behavior}\nvoid main(void) {}`;
3441
6176
  const shader = gl.createShader(35633);
3442
6177
  gl.shaderSource(shader, source);
3443
6178
  gl.compileShader(shader);