@luma.gl/shadertools 9.1.0-alpha.14 → 9.1.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +97 -76
- package/dist/dist.min.js +49 -33
- package/dist/index.cjs +95 -74
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +39 -39
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -21
- package/dist/lib/shader-module/shader-pass.d.ts +13 -6
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +40 -0
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -0
- package/dist/{modules → passes}/postprocessing/image-adjust-filters/brightnesscontrast.js +22 -3
- package/dist/passes/postprocessing/image-adjust-filters/denoise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/noise.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/sepia.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-adjust-filters/vignette.d.ts.map +1 -0
- package/dist/{modules → passes}/postprocessing/image-blur-filters/tiltshift.d.ts +3 -3
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -0
- package/dist/{modules → passes}/postprocessing/image-blur-filters/tiltshift.js +4 -4
- package/dist/{modules → passes}/postprocessing/image-blur-filters/triangleblur.d.ts +2 -2
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -0
- package/dist/{modules → passes}/postprocessing/image-blur-filters/triangleblur.js +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -0
- package/dist/{modules → passes}/postprocessing/image-blur-filters/zoomblur.js +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -0
- package/dist/{modules → passes}/postprocessing/image-fun-filters/edgework.js +1 -1
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/ink.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/swirl.d.ts.map +1 -0
- package/dist/passes/postprocessing/image-warp-filters/warp.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/index.ts +40 -40
- package/src/lib/shader-module/shader-pass.ts +17 -5
- package/src/{modules → passes}/postprocessing/image-adjust-filters/brightnesscontrast.ts +24 -3
- package/src/{modules → passes}/postprocessing/image-blur-filters/tiltshift.ts +4 -4
- package/src/{modules → passes}/postprocessing/image-blur-filters/triangleblur.ts +1 -1
- package/src/{modules → passes}/postprocessing/image-blur-filters/zoomblur.ts +1 -1
- package/src/{modules → passes}/postprocessing/image-fun-filters/edgework.ts +1 -1
- package/dist/modules/postprocessing/fxaa/fxaa.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +0 -39
- package/dist/modules/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/denoise.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/huesaturation.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/noise.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/sepia.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/vibrance.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-adjust-filters/vignette.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-blur-filters/tiltshift.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-blur-filters/triangleblur.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-blur-filters/zoomblur.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-fun-filters/colorhalftone.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-fun-filters/dotscreen.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-fun-filters/edgework.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-fun-filters/ink.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-fun-filters/magnify.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-warp-filters/bulgepinch.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-warp-filters/swirl.d.ts.map +0 -1
- package/dist/modules/postprocessing/image-warp-filters/warp.d.ts.map +0 -1
- /package/dist/{modules → passes}/postprocessing/fxaa/fxaa.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/fxaa/fxaa.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/denoise.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/denoise.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/huesaturation.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/huesaturation.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/noise.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/noise.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/sepia.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/sepia.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/vibrance.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/vibrance.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/vignette.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-adjust-filters/vignette.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-blur-filters/zoomblur.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/colorhalftone.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/colorhalftone.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/dotscreen.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/dotscreen.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/edgework.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/hexagonalpixelate.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/ink.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/ink.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/magnify.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-fun-filters/magnify.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-warp-filters/bulgepinch.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-warp-filters/bulgepinch.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-warp-filters/swirl.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-warp-filters/swirl.js +0 -0
- /package/dist/{modules → passes}/postprocessing/image-warp-filters/warp.d.ts +0 -0
- /package/dist/{modules → passes}/postprocessing/image-warp-filters/warp.js +0 -0
- /package/src/{modules → passes}/postprocessing/fxaa/fxaa.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-adjust-filters/denoise.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-adjust-filters/huesaturation.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-adjust-filters/noise.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-adjust-filters/sepia.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-adjust-filters/vibrance.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-adjust-filters/vignette.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-fun-filters/colorhalftone.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-fun-filters/dotscreen.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-fun-filters/hexagonalpixelate.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-fun-filters/ink.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-fun-filters/magnify.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-warp-filters/bulgepinch.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-warp-filters/swirl.ts +0 -0
- /package/src/{modules → passes}/postprocessing/image-warp-filters/warp.ts +0 -0
package/dist/index.cjs
CHANGED
|
@@ -229,7 +229,7 @@ function getHookStage(hook) {
|
|
|
229
229
|
throw new Error(type);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
|
-
function injectShader(
|
|
232
|
+
function injectShader(source2, stage, inject, injectStandardStubs = false) {
|
|
233
233
|
const isVertex = stage === "vertex";
|
|
234
234
|
for (const key in inject) {
|
|
235
235
|
const fragmentData = inject[key];
|
|
@@ -243,43 +243,43 @@ function injectShader(source, stage, inject, injectStandardStubs = false) {
|
|
|
243
243
|
switch (key) {
|
|
244
244
|
case "vs:#decl":
|
|
245
245
|
if (isVertex) {
|
|
246
|
-
|
|
246
|
+
source2 = source2.replace(DECLARATION_INJECT_MARKER, fragmentString);
|
|
247
247
|
}
|
|
248
248
|
break;
|
|
249
249
|
case "vs:#main-start":
|
|
250
250
|
if (isVertex) {
|
|
251
|
-
|
|
251
|
+
source2 = source2.replace(REGEX_START_OF_MAIN, (match) => match + fragmentString);
|
|
252
252
|
}
|
|
253
253
|
break;
|
|
254
254
|
case "vs:#main-end":
|
|
255
255
|
if (isVertex) {
|
|
256
|
-
|
|
256
|
+
source2 = source2.replace(REGEX_END_OF_MAIN, (match) => fragmentString + match);
|
|
257
257
|
}
|
|
258
258
|
break;
|
|
259
259
|
case "fs:#decl":
|
|
260
260
|
if (!isVertex) {
|
|
261
|
-
|
|
261
|
+
source2 = source2.replace(DECLARATION_INJECT_MARKER, fragmentString);
|
|
262
262
|
}
|
|
263
263
|
break;
|
|
264
264
|
case "fs:#main-start":
|
|
265
265
|
if (!isVertex) {
|
|
266
|
-
|
|
266
|
+
source2 = source2.replace(REGEX_START_OF_MAIN, (match) => match + fragmentString);
|
|
267
267
|
}
|
|
268
268
|
break;
|
|
269
269
|
case "fs:#main-end":
|
|
270
270
|
if (!isVertex) {
|
|
271
|
-
|
|
271
|
+
source2 = source2.replace(REGEX_END_OF_MAIN, (match) => fragmentString + match);
|
|
272
272
|
}
|
|
273
273
|
break;
|
|
274
274
|
default:
|
|
275
|
-
|
|
275
|
+
source2 = source2.replace(key, (match) => match + fragmentString);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
source2 = source2.replace(DECLARATION_INJECT_MARKER, "");
|
|
279
279
|
if (injectStandardStubs) {
|
|
280
|
-
|
|
280
|
+
source2 = source2.replace(/\}\s*$/, (match) => match + MODULE_INJECTORS[stage]);
|
|
281
281
|
}
|
|
282
|
-
return
|
|
282
|
+
return source2;
|
|
283
283
|
}
|
|
284
284
|
function combineInjects(injects) {
|
|
285
285
|
const result = {};
|
|
@@ -448,19 +448,19 @@ function getPlatformShaderDefines(platformInfo) {
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
// dist/lib/shader-transpiler/transpile-glsl-shader.js
|
|
451
|
-
function transpileGLSLShader(
|
|
451
|
+
function transpileGLSLShader(source2, stage) {
|
|
452
452
|
var _a;
|
|
453
|
-
const sourceGLSLVersion = Number(((_a =
|
|
453
|
+
const sourceGLSLVersion = Number(((_a = source2.match(/^#version[ \t]+(\d+)/m)) == null ? void 0 : _a[1]) || 100);
|
|
454
454
|
if (sourceGLSLVersion !== 300) {
|
|
455
455
|
throw new Error("luma.gl v9 only supports GLSL 3.00 shader sources");
|
|
456
456
|
}
|
|
457
457
|
switch (stage) {
|
|
458
458
|
case "vertex":
|
|
459
|
-
|
|
460
|
-
return
|
|
459
|
+
source2 = convertShader(source2, ES300_VERTEX_REPLACEMENTS);
|
|
460
|
+
return source2;
|
|
461
461
|
case "fragment":
|
|
462
|
-
|
|
463
|
-
return
|
|
462
|
+
source2 = convertShader(source2, ES300_FRAGMENT_REPLACEMENTS);
|
|
463
|
+
return source2;
|
|
464
464
|
default:
|
|
465
465
|
throw new Error(stage);
|
|
466
466
|
}
|
|
@@ -484,11 +484,11 @@ var ES300_FRAGMENT_REPLACEMENTS = [
|
|
|
484
484
|
// `varying` keyword replaced with `in`
|
|
485
485
|
[makeVariableTextRegExp("varying"), "in $1"]
|
|
486
486
|
];
|
|
487
|
-
function convertShader(
|
|
487
|
+
function convertShader(source2, replacements) {
|
|
488
488
|
for (const [pattern, replacement] of replacements) {
|
|
489
|
-
|
|
489
|
+
source2 = source2.replace(pattern, replacement);
|
|
490
490
|
}
|
|
491
|
-
return
|
|
491
|
+
return source2;
|
|
492
492
|
}
|
|
493
493
|
function makeVariableTextRegExp(qualifier) {
|
|
494
494
|
return new RegExp(`\\b${qualifier}[ \\t]+(\\w+[ \\t]+\\w+(\\[\\w+\\])?;)`, "g");
|
|
@@ -550,11 +550,11 @@ function normalizeShaderHooks(hookFunctions) {
|
|
|
550
550
|
}
|
|
551
551
|
|
|
552
552
|
// dist/lib/glsl-utils/get-shader-info.js
|
|
553
|
-
function getShaderInfo(
|
|
553
|
+
function getShaderInfo(source2, defaultName) {
|
|
554
554
|
return {
|
|
555
|
-
name: getShaderName(
|
|
555
|
+
name: getShaderName(source2, defaultName),
|
|
556
556
|
language: "glsl",
|
|
557
|
-
version: getShaderVersion(
|
|
557
|
+
version: getShaderVersion(source2)
|
|
558
558
|
};
|
|
559
559
|
}
|
|
560
560
|
function getShaderName(shader, defaultName = "unnamed") {
|
|
@@ -562,9 +562,9 @@ function getShaderName(shader, defaultName = "unnamed") {
|
|
|
562
562
|
const match = SHADER_NAME_REGEXP.exec(shader);
|
|
563
563
|
return match ? match[1] : defaultName;
|
|
564
564
|
}
|
|
565
|
-
function getShaderVersion(
|
|
565
|
+
function getShaderVersion(source2) {
|
|
566
566
|
let version = 100;
|
|
567
|
-
const words =
|
|
567
|
+
const words = source2.match(/[^\s]+/g);
|
|
568
568
|
if (words && words.length >= 2 && words[0] === "#version") {
|
|
569
569
|
const parsedVersion = parseInt(words[1], 10);
|
|
570
570
|
if (Number.isFinite(parsedVersion)) {
|
|
@@ -623,7 +623,7 @@ function assembleShaderWGSL(platformInfo, options) {
|
|
|
623
623
|
var _a;
|
|
624
624
|
const {
|
|
625
625
|
// id,
|
|
626
|
-
source,
|
|
626
|
+
source: source2,
|
|
627
627
|
stage,
|
|
628
628
|
modules,
|
|
629
629
|
// defines = {},
|
|
@@ -631,8 +631,8 @@ function assembleShaderWGSL(platformInfo, options) {
|
|
|
631
631
|
inject = {},
|
|
632
632
|
log: log2
|
|
633
633
|
} = options;
|
|
634
|
-
assert(typeof
|
|
635
|
-
const coreSource =
|
|
634
|
+
assert(typeof source2 === "string", "shader source must be a string");
|
|
635
|
+
const coreSource = source2;
|
|
636
636
|
let assembledSource = "";
|
|
637
637
|
const hookFunctionMap = normalizeShaderHooks(hookFunctions);
|
|
638
638
|
const hookInjections = {};
|
|
@@ -687,12 +687,12 @@ function assembleShaderWGSL(platformInfo, options) {
|
|
|
687
687
|
}
|
|
688
688
|
function assembleShaderGLSL(platformInfo, options) {
|
|
689
689
|
var _a;
|
|
690
|
-
const { id, source, stage, language = "glsl", modules, defines = {}, hookFunctions = [], inject = {}, prologue = true, log: log2 } = options;
|
|
691
|
-
assert(typeof
|
|
692
|
-
const sourceVersion = language === "glsl" ? getShaderInfo(
|
|
690
|
+
const { id, source: source2, stage, language = "glsl", modules, defines = {}, hookFunctions = [], inject = {}, prologue = true, log: log2 } = options;
|
|
691
|
+
assert(typeof source2 === "string", "shader source must be a string");
|
|
692
|
+
const sourceVersion = language === "glsl" ? getShaderInfo(source2).version : -1;
|
|
693
693
|
const targetVersion = platformInfo.shaderLanguageVersion;
|
|
694
694
|
const sourceVersionDirective = sourceVersion === 100 ? "#version 100" : "#version 300 es";
|
|
695
|
-
const sourceLines =
|
|
695
|
+
const sourceLines = source2.split("\n");
|
|
696
696
|
const coreSource = sourceLines.slice(1).join("\n");
|
|
697
697
|
const allDefines = {};
|
|
698
698
|
modules.forEach((module2) => {
|
|
@@ -707,7 +707,7 @@ function assembleShaderGLSL(platformInfo, options) {
|
|
|
707
707
|
assembledSource = prologue ? `${sourceVersionDirective}
|
|
708
708
|
|
|
709
709
|
// ----- PROLOGUE -------------------------
|
|
710
|
-
${getShaderNameDefine({ id, source, stage })}
|
|
710
|
+
${getShaderNameDefine({ id, source: source2, stage })}
|
|
711
711
|
${`#define SHADER_TYPE_${stage.toUpperCase()}`}
|
|
712
712
|
|
|
713
713
|
${getPlatformShaderDefines(platformInfo)}
|
|
@@ -787,8 +787,8 @@ function assembleGetUniforms(modules) {
|
|
|
787
787
|
};
|
|
788
788
|
}
|
|
789
789
|
function getShaderNameDefine(options) {
|
|
790
|
-
const { id, source, stage } = options;
|
|
791
|
-
const injectShaderName = id &&
|
|
790
|
+
const { id, source: source2, stage } = options;
|
|
791
|
+
const injectShaderName = id && source2.indexOf("SHADER_NAME") === -1;
|
|
792
792
|
return injectShaderName ? `
|
|
793
793
|
#define SHADER_NAME ${id}_${stage}` : "";
|
|
794
794
|
}
|
|
@@ -822,24 +822,24 @@ function getShaderModuleSource(module2, stage) {
|
|
|
822
822
|
throw new Error("Shader module must have a name");
|
|
823
823
|
}
|
|
824
824
|
const moduleName = module2.name.toUpperCase().replace(/[^0-9a-z]/gi, "_");
|
|
825
|
-
let
|
|
825
|
+
let source2 = `// ----- MODULE ${module2.name} ---------------
|
|
826
826
|
|
|
827
827
|
`;
|
|
828
828
|
if (stage !== "wgsl") {
|
|
829
|
-
|
|
829
|
+
source2 += `#define MODULE_${moduleName}
|
|
830
830
|
`;
|
|
831
831
|
}
|
|
832
|
-
|
|
832
|
+
source2 += `${moduleSource}
|
|
833
833
|
`;
|
|
834
|
-
return
|
|
834
|
+
return source2;
|
|
835
835
|
}
|
|
836
836
|
|
|
837
837
|
// dist/lib/preprocessor/preprocessor.js
|
|
838
838
|
var IFDEF_REGEXP = /^\s*\#\s*ifdef\s*([a-zA-Z_]+)\s*$/;
|
|
839
839
|
var ENDIF_REGEXP = /^\s*\#\s*endif\s*$/;
|
|
840
|
-
function preprocess(
|
|
840
|
+
function preprocess(source2, options) {
|
|
841
841
|
var _a;
|
|
842
|
-
const lines =
|
|
842
|
+
const lines = source2.split("\n");
|
|
843
843
|
const output = [];
|
|
844
844
|
let conditional = true;
|
|
845
845
|
let currentDefine = null;
|
|
@@ -907,14 +907,14 @@ var _ShaderAssembler = class {
|
|
|
907
907
|
assembleWGSLShader(props) {
|
|
908
908
|
const modules = this._getModuleList(props.modules);
|
|
909
909
|
const hookFunctions = this._hookFunctions;
|
|
910
|
-
const { source, getUniforms: getUniforms9 } = assembleWGSLShader({
|
|
910
|
+
const { source: source2, getUniforms: getUniforms9 } = assembleWGSLShader({
|
|
911
911
|
...props,
|
|
912
912
|
// @ts-expect-error
|
|
913
913
|
source: props.source,
|
|
914
914
|
modules,
|
|
915
915
|
hookFunctions
|
|
916
916
|
});
|
|
917
|
-
const preprocessedSource = props.platformInfo.shaderLanguage === "wgsl" ? preprocess(
|
|
917
|
+
const preprocessedSource = props.platformInfo.shaderLanguage === "wgsl" ? preprocess(source2) : source2;
|
|
918
918
|
return { source: preprocessedSource, getUniforms: getUniforms9, modules };
|
|
919
919
|
}
|
|
920
920
|
/**
|
|
@@ -1161,12 +1161,12 @@ function generateShaderForModule(module2, options) {
|
|
|
1161
1161
|
// dist/lib/wgsl/get-shader-layout-wgsl.js
|
|
1162
1162
|
var import_core = require("@luma.gl/core");
|
|
1163
1163
|
var import_wgsl_reflect = require("wgsl_reflect");
|
|
1164
|
-
function getShaderLayoutFromWGSL(
|
|
1164
|
+
function getShaderLayoutFromWGSL(source2) {
|
|
1165
1165
|
var _a;
|
|
1166
1166
|
const shaderLayout = { attributes: [], bindings: [] };
|
|
1167
1167
|
let parsedWGSL;
|
|
1168
1168
|
try {
|
|
1169
|
-
parsedWGSL = parseWGSL(
|
|
1169
|
+
parsedWGSL = parseWGSL(source2);
|
|
1170
1170
|
} catch (error) {
|
|
1171
1171
|
import_core.log.error(error.message)();
|
|
1172
1172
|
return shaderLayout;
|
|
@@ -1206,9 +1206,9 @@ function getShaderLayoutFromWGSL(source) {
|
|
|
1206
1206
|
function getType(type) {
|
|
1207
1207
|
return type.format ? `${type.name}<${type.format.name}>` : type.name;
|
|
1208
1208
|
}
|
|
1209
|
-
function parseWGSL(
|
|
1209
|
+
function parseWGSL(source2) {
|
|
1210
1210
|
try {
|
|
1211
|
-
return new import_wgsl_reflect.WgslReflect(
|
|
1211
|
+
return new import_wgsl_reflect.WgslReflect(source2);
|
|
1212
1212
|
} catch (error) {
|
|
1213
1213
|
if (error instanceof Error) {
|
|
1214
1214
|
throw error;
|
|
@@ -2889,11 +2889,31 @@ var pbrMaterial = {
|
|
|
2889
2889
|
}
|
|
2890
2890
|
};
|
|
2891
2891
|
|
|
2892
|
-
// dist/
|
|
2892
|
+
// dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js
|
|
2893
|
+
var source = (
|
|
2894
|
+
/* wgsl */
|
|
2895
|
+
`struct brightnessContrastUniforms {
|
|
2896
|
+
float brightness;
|
|
2897
|
+
float contrast;
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
// Binding 0:1 is reserved for shader passes
|
|
2901
|
+
@binding(1) @group(0) var<uniform> brightnessContrast : brightnessContrastUniforms;
|
|
2902
|
+
|
|
2903
|
+
fn brightnessContrast_filterColor(color: vec4<f32>, texSize: vec2<f32>, texCoords: vec2<f32>) -> vec4<f32> {
|
|
2904
|
+
color.rgb += brightnessContrast.brightness;
|
|
2905
|
+
if (brightnessContrast.contrast > 0.0) {
|
|
2906
|
+
color.rgb = (color.rgb - 0.5) / (1.0 - brightnessContrast.contrast) + 0.5;
|
|
2907
|
+
} else {
|
|
2908
|
+
color.rgb = (color.rgb - 0.5) * (1.0 + brightnessContrast.contrast) + 0.5;
|
|
2909
|
+
}
|
|
2910
|
+
return color;
|
|
2911
|
+
}
|
|
2912
|
+
`
|
|
2913
|
+
);
|
|
2893
2914
|
var fs4 = (
|
|
2894
2915
|
/* glsl */
|
|
2895
|
-
`
|
|
2896
|
-
uniform brightnessContrastUniforms {
|
|
2916
|
+
`uniform brightnessContrastUniforms {
|
|
2897
2917
|
float brightness;
|
|
2898
2918
|
float contrast;
|
|
2899
2919
|
} brightnessContrast;
|
|
@@ -2925,11 +2945,12 @@ var brightnessContrast = {
|
|
|
2925
2945
|
brightness: { format: "f32", value: 0, min: -1, max: 1 },
|
|
2926
2946
|
contrast: { format: "f32", value: 0, min: -1, max: 1 }
|
|
2927
2947
|
},
|
|
2928
|
-
|
|
2929
|
-
|
|
2948
|
+
passes: [{ filter: true }],
|
|
2949
|
+
source,
|
|
2950
|
+
fs: fs4
|
|
2930
2951
|
};
|
|
2931
2952
|
|
|
2932
|
-
// dist/
|
|
2953
|
+
// dist/passes/postprocessing/image-adjust-filters/denoise.js
|
|
2933
2954
|
var fs5 = (
|
|
2934
2955
|
/* glsl */
|
|
2935
2956
|
`uniform denoiseUniforms {
|
|
@@ -2971,7 +2992,7 @@ var denoise = {
|
|
|
2971
2992
|
passes: [{ sampler: true }, { sampler: true }]
|
|
2972
2993
|
};
|
|
2973
2994
|
|
|
2974
|
-
// dist/
|
|
2995
|
+
// dist/passes/postprocessing/image-adjust-filters/huesaturation.js
|
|
2975
2996
|
var fs6 = (
|
|
2976
2997
|
/* glsl */
|
|
2977
2998
|
`uniform hueSaturationUniforms {
|
|
@@ -3023,7 +3044,7 @@ var hueSaturation = {
|
|
|
3023
3044
|
passes: [{ filter: true }]
|
|
3024
3045
|
};
|
|
3025
3046
|
|
|
3026
|
-
// dist/
|
|
3047
|
+
// dist/passes/postprocessing/image-adjust-filters/noise.js
|
|
3027
3048
|
var fs7 = (
|
|
3028
3049
|
/* glsl */
|
|
3029
3050
|
`uniform noiseUniforms {
|
|
@@ -3061,7 +3082,7 @@ var noise = {
|
|
|
3061
3082
|
passes: [{ filter: true }]
|
|
3062
3083
|
};
|
|
3063
3084
|
|
|
3064
|
-
// dist/
|
|
3085
|
+
// dist/passes/postprocessing/image-adjust-filters/sepia.js
|
|
3065
3086
|
var fs8 = (
|
|
3066
3087
|
/* glsl */
|
|
3067
3088
|
`uniform sepiaUniforms {
|
|
@@ -3100,7 +3121,7 @@ var sepia = {
|
|
|
3100
3121
|
passes: [{ filter: true }]
|
|
3101
3122
|
};
|
|
3102
3123
|
|
|
3103
|
-
// dist/
|
|
3124
|
+
// dist/passes/postprocessing/image-adjust-filters/vibrance.js
|
|
3104
3125
|
var fs9 = (
|
|
3105
3126
|
/* glsl */
|
|
3106
3127
|
`uniform vibranceUniforms {
|
|
@@ -3131,7 +3152,7 @@ var vibrance = {
|
|
|
3131
3152
|
passes: [{ filter: true }]
|
|
3132
3153
|
};
|
|
3133
3154
|
|
|
3134
|
-
// dist/
|
|
3155
|
+
// dist/passes/postprocessing/image-adjust-filters/vignette.js
|
|
3135
3156
|
var fs10 = (
|
|
3136
3157
|
/* glsl */
|
|
3137
3158
|
`uniform vignetteUniforms {
|
|
@@ -3166,7 +3187,7 @@ var vignette = {
|
|
|
3166
3187
|
fs: fs10
|
|
3167
3188
|
};
|
|
3168
3189
|
|
|
3169
|
-
// dist/
|
|
3190
|
+
// dist/passes/postprocessing/image-blur-filters/tiltshift.js
|
|
3170
3191
|
var fs11 = (
|
|
3171
3192
|
/* glsl */
|
|
3172
3193
|
`uniform tiltShiftUniforms {
|
|
@@ -3231,16 +3252,16 @@ var tiltShift = {
|
|
|
3231
3252
|
gradientRadius: { value: 200, min: 0, max: 400 },
|
|
3232
3253
|
start: { value: [0, 0] },
|
|
3233
3254
|
end: { value: [1, 1] },
|
|
3234
|
-
invert: { value:
|
|
3255
|
+
invert: { value: 0, private: true }
|
|
3235
3256
|
},
|
|
3236
3257
|
passes: [
|
|
3237
|
-
{ sampler: true, uniforms: { invert:
|
|
3238
|
-
{ sampler: true, uniforms: { invert:
|
|
3258
|
+
{ sampler: true, uniforms: { invert: 0 } },
|
|
3259
|
+
{ sampler: true, uniforms: { invert: 1 } }
|
|
3239
3260
|
],
|
|
3240
3261
|
fs: fs11
|
|
3241
3262
|
};
|
|
3242
3263
|
|
|
3243
|
-
// dist/
|
|
3264
|
+
// dist/passes/postprocessing/image-blur-filters/triangleblur.js
|
|
3244
3265
|
var fs12 = (
|
|
3245
3266
|
/* glsl */
|
|
3246
3267
|
`uniform triangleBlurUniforms {
|
|
@@ -3298,7 +3319,7 @@ var triangleBlur = {
|
|
|
3298
3319
|
]
|
|
3299
3320
|
};
|
|
3300
3321
|
|
|
3301
|
-
// dist/
|
|
3322
|
+
// dist/passes/postprocessing/image-blur-filters/zoomblur.js
|
|
3302
3323
|
var fs13 = `
|
|
3303
3324
|
uniform zoomBlurUniforms {
|
|
3304
3325
|
vec2 center;
|
|
@@ -3350,7 +3371,7 @@ var zoomBlur = {
|
|
|
3350
3371
|
passes: [{ sampler: true }]
|
|
3351
3372
|
};
|
|
3352
3373
|
|
|
3353
|
-
// dist/
|
|
3374
|
+
// dist/passes/postprocessing/image-fun-filters/colorhalftone.js
|
|
3354
3375
|
var fs14 = (
|
|
3355
3376
|
/* glsl */
|
|
3356
3377
|
`uniform colorHalftoneUniforms {
|
|
@@ -3407,7 +3428,7 @@ var colorHalftone = {
|
|
|
3407
3428
|
passes: [{ filter: true }]
|
|
3408
3429
|
};
|
|
3409
3430
|
|
|
3410
|
-
// dist/
|
|
3431
|
+
// dist/passes/postprocessing/image-fun-filters/dotscreen.js
|
|
3411
3432
|
var fs15 = (
|
|
3412
3433
|
/* glsl */
|
|
3413
3434
|
`uniform dotScreenUniforms {
|
|
@@ -3452,7 +3473,7 @@ var dotScreen = {
|
|
|
3452
3473
|
passes: [{ filter: true }]
|
|
3453
3474
|
};
|
|
3454
3475
|
|
|
3455
|
-
// dist/
|
|
3476
|
+
// dist/passes/postprocessing/image-fun-filters/edgework.js
|
|
3456
3477
|
var fs16 = (
|
|
3457
3478
|
/* glsl */
|
|
3458
3479
|
`uniform edgeWorkUniforms {
|
|
@@ -3535,7 +3556,7 @@ var edgeWork = {
|
|
|
3535
3556
|
]
|
|
3536
3557
|
};
|
|
3537
3558
|
|
|
3538
|
-
// dist/
|
|
3559
|
+
// dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.js
|
|
3539
3560
|
var fs17 = (
|
|
3540
3561
|
/* glsl */
|
|
3541
3562
|
`uniform hexagonalPixelateUniforms {
|
|
@@ -3598,7 +3619,7 @@ var hexagonalPixelate = {
|
|
|
3598
3619
|
passes: [{ sampler: true }]
|
|
3599
3620
|
};
|
|
3600
3621
|
|
|
3601
|
-
// dist/
|
|
3622
|
+
// dist/passes/postprocessing/image-fun-filters/ink.js
|
|
3602
3623
|
var fs18 = (
|
|
3603
3624
|
/* glsl */
|
|
3604
3625
|
`uniform inkUniforms {
|
|
@@ -3644,7 +3665,7 @@ var ink = {
|
|
|
3644
3665
|
passes: [{ sampler: true }]
|
|
3645
3666
|
};
|
|
3646
3667
|
|
|
3647
|
-
// dist/
|
|
3668
|
+
// dist/passes/postprocessing/image-fun-filters/magnify.js
|
|
3648
3669
|
var fs19 = (
|
|
3649
3670
|
/* glsl */
|
|
3650
3671
|
`uniform magnifyUniforms {
|
|
@@ -3690,7 +3711,7 @@ var magnify = {
|
|
|
3690
3711
|
passes: [{ sampler: true }]
|
|
3691
3712
|
};
|
|
3692
3713
|
|
|
3693
|
-
// dist/
|
|
3714
|
+
// dist/passes/postprocessing/image-warp-filters/warp.js
|
|
3694
3715
|
var fs20 = (
|
|
3695
3716
|
/* glsl */
|
|
3696
3717
|
`vec4 warp_sampleColor(sampler2D source, vec2 texSize, vec2 coord) {
|
|
@@ -3711,7 +3732,7 @@ var warp = {
|
|
|
3711
3732
|
fs: fs20
|
|
3712
3733
|
};
|
|
3713
3734
|
|
|
3714
|
-
// dist/
|
|
3735
|
+
// dist/passes/postprocessing/image-warp-filters/bulgepinch.js
|
|
3715
3736
|
var fs21 = (
|
|
3716
3737
|
/* glsl */
|
|
3717
3738
|
`uniform bulgePinchUniforms {
|
|
@@ -3762,7 +3783,7 @@ var bulgePinch = {
|
|
|
3762
3783
|
passes: [{ sampler: true }]
|
|
3763
3784
|
};
|
|
3764
3785
|
|
|
3765
|
-
// dist/
|
|
3786
|
+
// dist/passes/postprocessing/image-warp-filters/swirl.js
|
|
3766
3787
|
var fs22 = (
|
|
3767
3788
|
/* glsl */
|
|
3768
3789
|
`uniform swirlUniforms {
|
|
@@ -3815,7 +3836,7 @@ var swirl = {
|
|
|
3815
3836
|
passes: [{ sampler: true }]
|
|
3816
3837
|
};
|
|
3817
3838
|
|
|
3818
|
-
// dist/
|
|
3839
|
+
// dist/passes/postprocessing/fxaa/fxaa.js
|
|
3819
3840
|
var fs23 = `
|
|
3820
3841
|
#define FXAA_QUALITY_PRESET 29
|
|
3821
3842
|
|