@luma.gl/shadertools 9.0.0-alpha.20 → 9.0.0-alpha.23
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 +178 -74
- package/dist/index.cjs +180 -76
- package/dist/index.d.ts +7 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/shader-assembler/assemble-shaders.js +2 -2
- package/dist/lib/shader-assembler/assemble-shaders.js.map +1 -1
- package/dist/lib/shader-assembler/inject-shader.d.ts +1 -1
- package/dist/lib/shader-assembler/inject-shader.d.ts.map +1 -1
- package/dist/lib/shader-assembler/inject-shader.js +1 -1
- package/dist/lib/shader-assembler/inject-shader.js.map +1 -1
- package/dist/lib/shader-assembler/resolve-modules.d.ts +4 -4
- package/dist/lib/shader-assembler/resolve-modules.d.ts.map +1 -1
- package/dist/lib/shader-assembler/resolve-modules.js +3 -15
- package/dist/lib/shader-assembler/resolve-modules.js.map +1 -1
- package/dist/lib/shader-generator/generate-shader.d.ts +8 -0
- package/dist/lib/shader-generator/generate-shader.d.ts.map +1 -0
- package/dist/lib/shader-generator/generate-shader.js +11 -0
- package/dist/lib/shader-generator/generate-shader.js.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts +7 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js +66 -0
- package/dist/lib/shader-generator/glsl/generate-glsl.js.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts +7 -0
- package/dist/lib/shader-generator/utils/capitalize.d.ts.map +1 -0
- package/dist/lib/shader-generator/utils/capitalize.js +4 -0
- package/dist/lib/shader-generator/utils/capitalize.js.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts +7 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.d.ts.map +1 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js +16 -0
- package/dist/lib/shader-generator/wgsl/generate-wgsl.js.map +1 -0
- package/dist/lib/shader-module/shader-module-instance.d.ts +4 -2
- package/dist/lib/shader-module/shader-module-instance.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-module-instance.js +14 -1
- package/dist/lib/shader-module/shader-module-instance.js.map +1 -1
- package/dist/lib/shader-module/shader-module.d.ts +7 -6
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-module.js.map +1 -1
- package/dist/lib/shader-module/shader-pass.d.ts +9 -3
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-pass.js.map +1 -1
- package/dist/lib/transpiler/transpile-shader.d.ts +1 -1
- package/dist/lib/transpiler/transpile-shader.d.ts.map +1 -1
- package/dist/lib/transpiler/transpile-shader.js +1 -1
- package/dist/lib/transpiler/transpile-shader.js.map +1 -1
- package/dist/modules/image-blur-filters/tiltshift.js.map +1 -1
- package/dist/modules/lights/lights.glsl.d.ts +1 -2
- package/dist/modules/lights/lights.glsl.d.ts.map +1 -1
- package/dist/modules/lights/lights.glsl.js +1 -1
- package/dist/modules/lights/lights.glsl.js.map +1 -1
- package/dist/modules/lights/lights.js +1 -1
- package/dist/modules/lights/lights.js.map +1 -1
- package/dist/modules/pbr/pbr-fragment.glsl.d.ts +1 -2
- package/dist/modules/pbr/pbr-fragment.glsl.d.ts.map +1 -1
- package/dist/modules/pbr/pbr-fragment.glsl.js +1 -1
- package/dist/modules/pbr/pbr-fragment.glsl.js.map +1 -1
- package/dist/modules/pbr/pbr-vertex.glsl.d.ts +1 -2
- package/dist/modules/pbr/pbr-vertex.glsl.d.ts.map +1 -1
- package/dist/modules/pbr/pbr-vertex.glsl.js +1 -1
- package/dist/modules/pbr/pbr-vertex.glsl.js.map +1 -1
- package/dist/modules/pbr/pbr.js +2 -2
- package/dist/modules/pbr/pbr.js.map +1 -1
- package/dist/modules/phong-lighting/phong-lighting.glsl.d.ts +1 -2
- package/dist/modules/phong-lighting/phong-lighting.glsl.d.ts.map +1 -1
- package/dist/modules/phong-lighting/phong-lighting.glsl.js +1 -1
- package/dist/modules/phong-lighting/phong-lighting.glsl.js.map +1 -1
- package/dist/modules/phong-lighting/phong-lighting.js +1 -1
- package/dist/modules/phong-lighting/phong-lighting.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist.min.js +82 -80
- package/package.json +3 -3
- package/src/index.ts +10 -5
- package/src/lib/shader-assembler/assemble-shaders.ts +2 -2
- package/src/lib/shader-assembler/inject-shader.ts +1 -1
- package/src/lib/shader-assembler/resolve-modules.ts +6 -25
- package/src/lib/shader-generator/generate-shader.ts +22 -0
- package/src/lib/shader-generator/glsl/generate-glsl.ts +92 -0
- package/src/lib/shader-generator/utils/capitalize.ts +9 -0
- package/src/lib/shader-generator/wgsl/generate-wgsl.ts +29 -0
- package/src/lib/shader-module/shader-module-instance.ts +24 -3
- package/src/lib/shader-module/shader-module.ts +8 -6
- package/src/lib/shader-module/shader-pass.ts +9 -3
- package/src/lib/transpiler/transpile-shader.ts +1 -1
- package/src/modules/.DS_Store +0 -0
- package/src/modules/image-blur-filters/tiltshift.ts +1 -1
- package/src/modules/lights/lights.glsl.ts +1 -1
- package/src/modules/lights/lights.ts +1 -1
- package/src/modules/pbr/pbr-fragment.glsl.ts +1 -1
- package/src/modules/pbr/pbr-vertex.glsl.ts +1 -1
- package/src/modules/pbr/pbr.ts +2 -2
- package/src/modules/phong-lighting/phong-lighting.glsl.ts +1 -1
- package/src/modules/phong-lighting/phong-lighting.ts +1 -1
- package/src/types.ts +36 -0
package/dist/dist.dev.js
CHANGED
|
@@ -27,11 +27,15 @@ var __exports__ = (() => {
|
|
|
27
27
|
// src/index.ts
|
|
28
28
|
var src_exports = {};
|
|
29
29
|
__export(src_exports, {
|
|
30
|
+
_ShaderModuleInstance: () => ShaderModuleInstance,
|
|
31
|
+
_getDependencyGraph: () => getDependencyGraph,
|
|
32
|
+
_resolveModules: () => resolveModules,
|
|
30
33
|
_transform: () => transform,
|
|
31
34
|
_warp: () => warp,
|
|
32
35
|
assembleShaders: () => assembleShaders,
|
|
33
36
|
brightnessContrast: () => brightnessContrast,
|
|
34
37
|
bulgePinch: () => bulgePinch,
|
|
38
|
+
capitalize: () => capitalize,
|
|
35
39
|
colorHalftone: () => colorHalftone,
|
|
36
40
|
combineInjects: () => combineInjects,
|
|
37
41
|
convertToVec4: () => convertToVec4,
|
|
@@ -43,6 +47,7 @@ var __exports__ = (() => {
|
|
|
43
47
|
fp64: () => fp64,
|
|
44
48
|
fp64arithmetic: () => fp64arithmetic,
|
|
45
49
|
fxaa: () => fxaa,
|
|
50
|
+
generateShaderForModule: () => generateShaderForModule,
|
|
46
51
|
getPassthroughFS: () => getPassthroughFS,
|
|
47
52
|
getQualifierDetails: () => getQualifierDetails,
|
|
48
53
|
getShaderInfo: () => getShaderInfo,
|
|
@@ -165,11 +170,24 @@ var __exports__ = (() => {
|
|
|
165
170
|
// src/lib/shader-module/shader-module-instance.ts
|
|
166
171
|
var ShaderModuleInstance = class {
|
|
167
172
|
uniforms = {};
|
|
173
|
+
uniformFormats = {};
|
|
174
|
+
static instantiateModules(modules) {
|
|
175
|
+
return modules.map((module) => {
|
|
176
|
+
if (module instanceof ShaderModuleInstance) {
|
|
177
|
+
return module;
|
|
178
|
+
}
|
|
179
|
+
assert(typeof module !== "string", `Shader module use by name is deprecated. Import shader module '${module}' and use it directly.`);
|
|
180
|
+
assert(module.name, "shader module has no name");
|
|
181
|
+
const moduleObject = new ShaderModuleInstance(module);
|
|
182
|
+
moduleObject.dependencies = ShaderModuleInstance.instantiateModules(module.dependencies || []);
|
|
183
|
+
return moduleObject;
|
|
184
|
+
});
|
|
185
|
+
}
|
|
168
186
|
constructor(props) {
|
|
169
187
|
const {
|
|
170
188
|
name,
|
|
171
|
-
vs:
|
|
172
|
-
fs:
|
|
189
|
+
vs: vs5,
|
|
190
|
+
fs: fs26,
|
|
173
191
|
dependencies = [],
|
|
174
192
|
uniforms: uniforms18 = {},
|
|
175
193
|
getUniforms: getUniforms7,
|
|
@@ -179,10 +197,10 @@ var __exports__ = (() => {
|
|
|
179
197
|
} = props;
|
|
180
198
|
assert(typeof name === "string");
|
|
181
199
|
this.name = name;
|
|
182
|
-
this.vs =
|
|
183
|
-
this.fs =
|
|
200
|
+
this.vs = vs5;
|
|
201
|
+
this.fs = fs26;
|
|
184
202
|
this.getModuleUniforms = getUniforms7;
|
|
185
|
-
this.dependencies = dependencies;
|
|
203
|
+
this.dependencies = ShaderModuleInstance.instantiateModules(dependencies);
|
|
186
204
|
this.deprecations = this._parseDeprecationDefinitions(deprecations);
|
|
187
205
|
this.defines = defines;
|
|
188
206
|
this.injections = normalizeInjections(inject);
|
|
@@ -282,19 +300,8 @@ ${moduleSource}// END MODULE_${this.name}
|
|
|
282
300
|
|
|
283
301
|
// src/lib/shader-assembler/resolve-modules.ts
|
|
284
302
|
function resolveModules(modules) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
function instantiateModules(modules) {
|
|
288
|
-
return modules.map((module) => {
|
|
289
|
-
if (module instanceof ShaderModuleInstance) {
|
|
290
|
-
return module;
|
|
291
|
-
}
|
|
292
|
-
assert(typeof module !== "string", `Shader module use by name is deprecated. Import shader module '${module}' and use it directly.`);
|
|
293
|
-
assert(module.name, "shader module has no name");
|
|
294
|
-
const moduleObject = new ShaderModuleInstance(module);
|
|
295
|
-
moduleObject.dependencies = instantiateModules(module.dependencies || []);
|
|
296
|
-
return moduleObject;
|
|
297
|
-
});
|
|
303
|
+
const instances = ShaderModuleInstance.instantiateModules(modules);
|
|
304
|
+
return getShaderDependencies(instances);
|
|
298
305
|
}
|
|
299
306
|
function getShaderDependencies(modules) {
|
|
300
307
|
const moduleMap = {};
|
|
@@ -639,20 +646,20 @@ precision highp float;
|
|
|
639
646
|
`;
|
|
640
647
|
function assembleShaders(platformInfo, options) {
|
|
641
648
|
const {
|
|
642
|
-
vs:
|
|
643
|
-
fs:
|
|
649
|
+
vs: vs5,
|
|
650
|
+
fs: fs26
|
|
644
651
|
} = options;
|
|
645
652
|
const modules = resolveModules(options.modules || []);
|
|
646
653
|
return {
|
|
647
654
|
vs: assembleShader(platformInfo, {
|
|
648
655
|
...options,
|
|
649
|
-
source:
|
|
656
|
+
source: vs5,
|
|
650
657
|
type: "vs",
|
|
651
658
|
modules
|
|
652
659
|
}),
|
|
653
660
|
fs: assembleShader(platformInfo, {
|
|
654
661
|
...options,
|
|
655
|
-
source:
|
|
662
|
+
source: fs26,
|
|
656
663
|
type: "fs",
|
|
657
664
|
modules
|
|
658
665
|
}),
|
|
@@ -991,6 +998,103 @@ void main() {
|
|
|
991
998
|
}
|
|
992
999
|
}
|
|
993
1000
|
|
|
1001
|
+
// src/lib/shader-generator/utils/capitalize.ts
|
|
1002
|
+
function capitalize(str) {
|
|
1003
|
+
return typeof str === "string" ? str.charAt(0).toUpperCase() + str.slice(1) : str;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
// src/lib/shader-generator/glsl/generate-glsl.ts
|
|
1007
|
+
function generateGLSLForModule(module, options) {
|
|
1008
|
+
return generateGLSLUniformDeclarations(module, options);
|
|
1009
|
+
}
|
|
1010
|
+
function generateGLSLUniformDeclarations(module, options) {
|
|
1011
|
+
const glsl2 = [];
|
|
1012
|
+
switch (options.uniforms) {
|
|
1013
|
+
case "scoped-interface-blocks":
|
|
1014
|
+
case "unscoped-interface-blocks":
|
|
1015
|
+
glsl2.push(`uniform ${capitalize(module.name)} {`);
|
|
1016
|
+
break;
|
|
1017
|
+
case "uniforms":
|
|
1018
|
+
}
|
|
1019
|
+
for (const [uniformName, uniformFormat] of Object.entries(module.uniformFormats || module.uniforms || {})) {
|
|
1020
|
+
const glslUniformType = getGLSLUniformType(uniformFormat.format);
|
|
1021
|
+
switch (options.uniforms) {
|
|
1022
|
+
case "scoped-interface-blocks":
|
|
1023
|
+
glsl2.push(` ${glslUniformType} ${uniformName};`);
|
|
1024
|
+
break;
|
|
1025
|
+
case "unscoped-interface-blocks":
|
|
1026
|
+
glsl2.push(` ${glslUniformType} ${module.name}_${uniformName};`);
|
|
1027
|
+
break;
|
|
1028
|
+
case "uniforms":
|
|
1029
|
+
glsl2.push(`uniform ${glslUniformType} ${module.name}_${uniformName};`);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
switch (options.uniforms) {
|
|
1033
|
+
case "scoped-interface-blocks":
|
|
1034
|
+
glsl2.push(`} ${module.name};`);
|
|
1035
|
+
break;
|
|
1036
|
+
case "unscoped-interface-blocks":
|
|
1037
|
+
glsl2.push("};");
|
|
1038
|
+
break;
|
|
1039
|
+
case "uniforms":
|
|
1040
|
+
}
|
|
1041
|
+
glsl2.push("");
|
|
1042
|
+
return glsl2.join("\n");
|
|
1043
|
+
}
|
|
1044
|
+
function getGLSLUniformType(uniformFormat) {
|
|
1045
|
+
const UNIFORM_TYPE_TO_GLSL = {
|
|
1046
|
+
"f32": "float",
|
|
1047
|
+
"i32": "int",
|
|
1048
|
+
"u32": "uint",
|
|
1049
|
+
"vec2<f32>": "vec2",
|
|
1050
|
+
"vec3<f32>": "vec3",
|
|
1051
|
+
"vec4<f32>": "vec4",
|
|
1052
|
+
"vec2<i32>": "ivec2",
|
|
1053
|
+
"vec3<i32>": "ivec3",
|
|
1054
|
+
"vec4<i32>": "ivec4",
|
|
1055
|
+
"vec2<u32>": "uvec2",
|
|
1056
|
+
"vec3<u32>": "uvec3",
|
|
1057
|
+
"vec4<u32>": "uvec4",
|
|
1058
|
+
"mat2x2<f32>": "mat2",
|
|
1059
|
+
"mat2x3<f32>": "mat2x3",
|
|
1060
|
+
"mat2x4<f32>": "mat2x4",
|
|
1061
|
+
"mat3x2<f32>": "mat3x2",
|
|
1062
|
+
"mat3x3<f32>": "mat3",
|
|
1063
|
+
"mat3x4<f32>": "mat3x4",
|
|
1064
|
+
"mat4x2<f32>": "mat4x2",
|
|
1065
|
+
"mat4x3<f32>": "mat4x3",
|
|
1066
|
+
"mat4x4<f32>": "mat4"
|
|
1067
|
+
};
|
|
1068
|
+
const glsl2 = UNIFORM_TYPE_TO_GLSL[uniformFormat];
|
|
1069
|
+
return glsl2;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/lib/shader-generator/wgsl/generate-wgsl.ts
|
|
1073
|
+
function generateWGSLForModule(module, options) {
|
|
1074
|
+
return generateWGSLUniformDeclarations(module, options);
|
|
1075
|
+
}
|
|
1076
|
+
function generateWGSLUniformDeclarations(module, options) {
|
|
1077
|
+
const wgsl = [];
|
|
1078
|
+
wgsl.push(`struct ${capitalize(module.name)} {`);
|
|
1079
|
+
for (const [uniformName, uniformFormat] of Object.entries(module?.uniformFormats || {})) {
|
|
1080
|
+
const wgslUniformType = uniformFormat;
|
|
1081
|
+
wgsl.push(` ${uniformName} : ${wgslUniformType};`);
|
|
1082
|
+
}
|
|
1083
|
+
wgsl.push("};");
|
|
1084
|
+
wgsl.push(`var<uniform> ${module.name} : ${capitalize(module.name)};`);
|
|
1085
|
+
return wgsl.join("\n");
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
// src/lib/shader-generator/generate-shader.ts
|
|
1089
|
+
function generateShaderForModule(module, options) {
|
|
1090
|
+
switch (options.shaderLanguage) {
|
|
1091
|
+
case "glsl":
|
|
1092
|
+
return generateGLSLForModule(module, options);
|
|
1093
|
+
case "wgsl":
|
|
1094
|
+
return generateWGSLForModule(module, options);
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
994
1098
|
// src/modules/utils/random.ts
|
|
995
1099
|
var fs = glsl`\
|
|
996
1100
|
float random(vec3 scale, float seed) {
|
|
@@ -3702,7 +3806,7 @@ ${common}`;
|
|
|
3702
3806
|
};
|
|
3703
3807
|
|
|
3704
3808
|
// src/modules/lights/lights.glsl.ts
|
|
3705
|
-
var
|
|
3809
|
+
var lightingShader = glsl`\
|
|
3706
3810
|
#if (defined(SHADER_TYPE_FRAGMENT) && defined(LIGHTING_FRAGMENT)) || (defined(SHADER_TYPE_VERTEX) && defined(LIGHTING_VERTEX))
|
|
3707
3811
|
|
|
3708
3812
|
struct AmbientLight {
|
|
@@ -3822,8 +3926,8 @@ float getPointLightAttenuation(PointLight pointLight, float distance) {
|
|
|
3822
3926
|
}
|
|
3823
3927
|
var lights = {
|
|
3824
3928
|
name: "lights",
|
|
3825
|
-
vs:
|
|
3826
|
-
fs:
|
|
3929
|
+
vs: lightingShader,
|
|
3930
|
+
fs: lightingShader,
|
|
3827
3931
|
getUniforms: getUniforms3,
|
|
3828
3932
|
defines: {
|
|
3829
3933
|
MAX_LIGHTS: 3
|
|
@@ -4007,7 +4111,7 @@ vec4 picking_filterColor(vec4 color) {
|
|
|
4007
4111
|
};
|
|
4008
4112
|
|
|
4009
4113
|
// src/modules/phong-lighting/phong-lighting.glsl.ts
|
|
4010
|
-
var
|
|
4114
|
+
var lightingShader2 = glsl`\
|
|
4011
4115
|
|
|
4012
4116
|
uniform float lighting_uAmbient;
|
|
4013
4117
|
uniform float lighting_uDiffuse;
|
|
@@ -4116,7 +4220,7 @@ vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspac
|
|
|
4116
4220
|
var gouraudLighting = {
|
|
4117
4221
|
name: "gouraud-lighting",
|
|
4118
4222
|
dependencies: [lights],
|
|
4119
|
-
vs:
|
|
4223
|
+
vs: lightingShader2,
|
|
4120
4224
|
defines: {
|
|
4121
4225
|
LIGHTING_VERTEX: 1
|
|
4122
4226
|
},
|
|
@@ -4125,7 +4229,7 @@ vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspac
|
|
|
4125
4229
|
var phongLighting = {
|
|
4126
4230
|
name: "phong-lighting",
|
|
4127
4231
|
dependencies: [lights],
|
|
4128
|
-
fs:
|
|
4232
|
+
fs: lightingShader2,
|
|
4129
4233
|
defines: {
|
|
4130
4234
|
LIGHTING_FRAGMENT: 1
|
|
4131
4235
|
},
|
|
@@ -4133,7 +4237,7 @@ vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspac
|
|
|
4133
4237
|
};
|
|
4134
4238
|
|
|
4135
4239
|
// src/modules/pbr/pbr-vertex.glsl.ts
|
|
4136
|
-
var
|
|
4240
|
+
var vs3 = glsl`\
|
|
4137
4241
|
uniform mat4 u_MVPMatrix;
|
|
4138
4242
|
uniform mat4 u_ModelMatrix;
|
|
4139
4243
|
uniform mat4 u_NormalMatrix;
|
|
@@ -4174,7 +4278,7 @@ void pbr_setPositionNormalTangentUV(vec4 position, vec4 normal, vec4 tangent, ve
|
|
|
4174
4278
|
`;
|
|
4175
4279
|
|
|
4176
4280
|
// src/modules/pbr/pbr-fragment.glsl.ts
|
|
4177
|
-
var
|
|
4281
|
+
var fs5 = glsl`\
|
|
4178
4282
|
#if defined(USE_TEX_LOD) && !defined(FEATURE_GLSL_TEXTURE_LOD)
|
|
4179
4283
|
# error PBR fragment shader: Texture LOD is not available
|
|
4180
4284
|
#endif
|
|
@@ -4578,8 +4682,8 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
4578
4682
|
// src/modules/pbr/pbr.ts
|
|
4579
4683
|
var pbr = {
|
|
4580
4684
|
name: "pbr",
|
|
4581
|
-
vs:
|
|
4582
|
-
fs:
|
|
4685
|
+
vs: vs3,
|
|
4686
|
+
fs: fs5,
|
|
4583
4687
|
defines: {
|
|
4584
4688
|
LIGHTING_FRAGMENT: 1
|
|
4585
4689
|
},
|
|
@@ -4587,7 +4691,7 @@ vec4 pbr_filterColor(vec4 colorUnused)
|
|
|
4587
4691
|
};
|
|
4588
4692
|
|
|
4589
4693
|
// src/modules/image-blur-filters/tiltshift.ts
|
|
4590
|
-
var
|
|
4694
|
+
var fs6 = `uniform float blurRadius;
|
|
4591
4695
|
uniform float gradientRadius;
|
|
4592
4696
|
uniform vec2 start;
|
|
4593
4697
|
uniform vec2 end;
|
|
@@ -4650,7 +4754,7 @@ vec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4650
4754
|
var tiltShift = {
|
|
4651
4755
|
name: "tiltShift",
|
|
4652
4756
|
uniforms,
|
|
4653
|
-
fs:
|
|
4757
|
+
fs: fs6,
|
|
4654
4758
|
dependencies: [random],
|
|
4655
4759
|
passes: [{
|
|
4656
4760
|
sampler: true,
|
|
@@ -4666,7 +4770,7 @@ vec4 tiltShift_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4666
4770
|
};
|
|
4667
4771
|
|
|
4668
4772
|
// src/modules/image-blur-filters/triangleblur.ts
|
|
4669
|
-
var
|
|
4773
|
+
var fs7 = glsl`\
|
|
4670
4774
|
uniform float radius;
|
|
4671
4775
|
uniform vec2 delta;
|
|
4672
4776
|
|
|
@@ -4713,7 +4817,7 @@ vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4713
4817
|
var triangleBlur = {
|
|
4714
4818
|
name: "triangleBlur",
|
|
4715
4819
|
uniforms: uniforms2,
|
|
4716
|
-
fs:
|
|
4820
|
+
fs: fs7,
|
|
4717
4821
|
dependencies: [random],
|
|
4718
4822
|
passes: [{
|
|
4719
4823
|
sampler: true,
|
|
@@ -4729,7 +4833,7 @@ vec4 triangleBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4729
4833
|
};
|
|
4730
4834
|
|
|
4731
4835
|
// src/modules/image-blur-filters/zoomblur.ts
|
|
4732
|
-
var
|
|
4836
|
+
var fs8 = `
|
|
4733
4837
|
uniform vec2 center;
|
|
4734
4838
|
uniform float strength;
|
|
4735
4839
|
|
|
@@ -4772,7 +4876,7 @@ vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4772
4876
|
var zoomBlur = {
|
|
4773
4877
|
name: "zoomBlur",
|
|
4774
4878
|
uniforms: uniforms3,
|
|
4775
|
-
fs:
|
|
4879
|
+
fs: fs8,
|
|
4776
4880
|
dependencies: [random],
|
|
4777
4881
|
passes: [{
|
|
4778
4882
|
sampler: true
|
|
@@ -4792,7 +4896,7 @@ vec4 zoomBlur_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4792
4896
|
max: 1
|
|
4793
4897
|
}
|
|
4794
4898
|
};
|
|
4795
|
-
var
|
|
4899
|
+
var fs9 = glsl`\
|
|
4796
4900
|
uniform float brightness;
|
|
4797
4901
|
uniform float contrast;
|
|
4798
4902
|
|
|
@@ -4813,14 +4917,14 @@ vec4 brightnessContrast_filterColor(vec4 color, vec2 texSize, vec2 texCoords) {
|
|
|
4813
4917
|
var brightnessContrast = {
|
|
4814
4918
|
name: "brightnessContrast",
|
|
4815
4919
|
uniforms: uniforms4,
|
|
4816
|
-
fs:
|
|
4920
|
+
fs: fs9,
|
|
4817
4921
|
passes: [{
|
|
4818
4922
|
filter: true
|
|
4819
4923
|
}]
|
|
4820
4924
|
};
|
|
4821
4925
|
|
|
4822
4926
|
// src/modules/image-adjust-filters/denoise.ts
|
|
4823
|
-
var
|
|
4927
|
+
var fs10 = glsl`\
|
|
4824
4928
|
uniform float strength;
|
|
4825
4929
|
|
|
4826
4930
|
vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
@@ -4854,7 +4958,7 @@ vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4854
4958
|
var denoise = {
|
|
4855
4959
|
name: "denoise",
|
|
4856
4960
|
uniforms: uniforms5,
|
|
4857
|
-
fs:
|
|
4961
|
+
fs: fs10,
|
|
4858
4962
|
passes: [{
|
|
4859
4963
|
sampler: true
|
|
4860
4964
|
}, {
|
|
@@ -4863,7 +4967,7 @@ vec4 denoise_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
4863
4967
|
};
|
|
4864
4968
|
|
|
4865
4969
|
// src/modules/image-adjust-filters/huesaturation.ts
|
|
4866
|
-
var
|
|
4970
|
+
var fs11 = glsl`\
|
|
4867
4971
|
uniform float hue;
|
|
4868
4972
|
uniform float saturation;
|
|
4869
4973
|
|
|
@@ -4909,14 +5013,14 @@ vec4 hueSaturation_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
4909
5013
|
var hueSaturation = {
|
|
4910
5014
|
name: "hueSaturation",
|
|
4911
5015
|
uniforms: uniforms6,
|
|
4912
|
-
fs:
|
|
5016
|
+
fs: fs11,
|
|
4913
5017
|
passes: [{
|
|
4914
5018
|
filter: true
|
|
4915
5019
|
}]
|
|
4916
5020
|
};
|
|
4917
5021
|
|
|
4918
5022
|
// src/modules/image-adjust-filters/noise.ts
|
|
4919
|
-
var
|
|
5023
|
+
var fs12 = glsl`\
|
|
4920
5024
|
uniform float amount;
|
|
4921
5025
|
|
|
4922
5026
|
float rand(vec2 co) {
|
|
@@ -4944,14 +5048,14 @@ vec4 noise_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
4944
5048
|
max: 1
|
|
4945
5049
|
}
|
|
4946
5050
|
},
|
|
4947
|
-
fs:
|
|
5051
|
+
fs: fs12,
|
|
4948
5052
|
passes: [{
|
|
4949
5053
|
filter: true
|
|
4950
5054
|
}]
|
|
4951
5055
|
};
|
|
4952
5056
|
|
|
4953
5057
|
// src/modules/image-adjust-filters/sepia.ts
|
|
4954
|
-
var
|
|
5058
|
+
var fs13 = glsl`\
|
|
4955
5059
|
uniform float amount;
|
|
4956
5060
|
|
|
4957
5061
|
vec4 sepia_filterColor(vec4 color) {
|
|
@@ -4981,14 +5085,14 @@ vec4 sepia_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
4981
5085
|
var sepia = {
|
|
4982
5086
|
name: "sepia",
|
|
4983
5087
|
uniforms: uniforms7,
|
|
4984
|
-
fs:
|
|
5088
|
+
fs: fs13,
|
|
4985
5089
|
passes: [{
|
|
4986
5090
|
filter: true
|
|
4987
5091
|
}]
|
|
4988
5092
|
};
|
|
4989
5093
|
|
|
4990
5094
|
// src/modules/image-adjust-filters/vibrance.ts
|
|
4991
|
-
var
|
|
5095
|
+
var fs14 = glsl`\
|
|
4992
5096
|
uniform float amount;
|
|
4993
5097
|
|
|
4994
5098
|
vec4 vibrance_filterColor(vec4 color) {
|
|
@@ -5013,14 +5117,14 @@ vec4 vibrance_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5013
5117
|
var vibrance = {
|
|
5014
5118
|
name: "vibrance",
|
|
5015
5119
|
uniforms: uniforms8,
|
|
5016
|
-
fs:
|
|
5120
|
+
fs: fs14,
|
|
5017
5121
|
passes: [{
|
|
5018
5122
|
filter: true
|
|
5019
5123
|
}]
|
|
5020
5124
|
};
|
|
5021
5125
|
|
|
5022
5126
|
// src/modules/image-adjust-filters/vignette.ts
|
|
5023
|
-
var
|
|
5127
|
+
var fs15 = glsl`\
|
|
5024
5128
|
uniform float radius;
|
|
5025
5129
|
uniform float amount;
|
|
5026
5130
|
|
|
@@ -5048,7 +5152,7 @@ vec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5048
5152
|
};
|
|
5049
5153
|
var vignette = {
|
|
5050
5154
|
name: "vignette",
|
|
5051
|
-
fs:
|
|
5155
|
+
fs: fs15,
|
|
5052
5156
|
uniforms: uniforms9,
|
|
5053
5157
|
passes: [{
|
|
5054
5158
|
filter: true
|
|
@@ -5056,7 +5160,7 @@ vec4 vignette_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5056
5160
|
};
|
|
5057
5161
|
|
|
5058
5162
|
// src/modules/image-fun-filters/colorhalftone.ts
|
|
5059
|
-
var
|
|
5163
|
+
var fs16 = glsl`\
|
|
5060
5164
|
uniform vec2 center;
|
|
5061
5165
|
uniform float angle;
|
|
5062
5166
|
uniform float size;
|
|
@@ -5107,14 +5211,14 @@ vec4 colorHalftone_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5107
5211
|
var colorHalftone = {
|
|
5108
5212
|
name: "colorHalftone",
|
|
5109
5213
|
uniforms: uniforms10,
|
|
5110
|
-
fs:
|
|
5214
|
+
fs: fs16,
|
|
5111
5215
|
passes: [{
|
|
5112
5216
|
filter: true
|
|
5113
5217
|
}]
|
|
5114
5218
|
};
|
|
5115
5219
|
|
|
5116
5220
|
// src/modules/image-fun-filters/dotscreen.ts
|
|
5117
|
-
var
|
|
5221
|
+
var fs17 = glsl`\
|
|
5118
5222
|
uniform vec2 center;
|
|
5119
5223
|
uniform float angle;
|
|
5120
5224
|
uniform float size;
|
|
@@ -5153,14 +5257,14 @@ vec4 dotScreen_filterColor(vec4 color, vec2 texSize, vec2 texCoord) {
|
|
|
5153
5257
|
var dotScreen = {
|
|
5154
5258
|
name: "dotScreen",
|
|
5155
5259
|
uniforms: uniforms11,
|
|
5156
|
-
fs:
|
|
5260
|
+
fs: fs17,
|
|
5157
5261
|
passes: [{
|
|
5158
5262
|
filter: true
|
|
5159
5263
|
}]
|
|
5160
5264
|
};
|
|
5161
5265
|
|
|
5162
5266
|
// src/modules/image-fun-filters/edgework.ts
|
|
5163
|
-
var
|
|
5267
|
+
var fs18 = glsl`\
|
|
5164
5268
|
uniform float radius;
|
|
5165
5269
|
uniform vec2 delta;
|
|
5166
5270
|
|
|
@@ -5228,7 +5332,7 @@ vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
5228
5332
|
var edgeWork = {
|
|
5229
5333
|
name: "edgeWork",
|
|
5230
5334
|
uniforms: uniforms12,
|
|
5231
|
-
fs:
|
|
5335
|
+
fs: fs18,
|
|
5232
5336
|
dependencies: [random],
|
|
5233
5337
|
passes: [{
|
|
5234
5338
|
sampler: "edgeWork_sampleColor1",
|
|
@@ -5244,7 +5348,7 @@ vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
|
|
|
5244
5348
|
};
|
|
5245
5349
|
|
|
5246
5350
|
// src/modules/image-fun-filters/hexagonalpixelate.ts
|
|
5247
|
-
var
|
|
5351
|
+
var fs19 = glsl`\
|
|
5248
5352
|
uniform vec2 center;
|
|
5249
5353
|
uniform float scale;
|
|
5250
5354
|
|
|
@@ -5301,14 +5405,14 @@ vec4 hexagonalPixelate_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoor
|
|
|
5301
5405
|
var hexagonalPixelate = {
|
|
5302
5406
|
name: "hexagonalPixelate",
|
|
5303
5407
|
uniforms: uniforms13,
|
|
5304
|
-
fs:
|
|
5408
|
+
fs: fs19,
|
|
5305
5409
|
passes: [{
|
|
5306
5410
|
sampler: true
|
|
5307
5411
|
}]
|
|
5308
5412
|
};
|
|
5309
5413
|
|
|
5310
5414
|
// src/modules/image-fun-filters/ink.ts
|
|
5311
|
-
var
|
|
5415
|
+
var fs20 = glsl`\
|
|
5312
5416
|
uniform float strength;
|
|
5313
5417
|
|
|
5314
5418
|
vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
@@ -5345,14 +5449,14 @@ vec4 ink_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5345
5449
|
var ink = {
|
|
5346
5450
|
name: "ink",
|
|
5347
5451
|
uniforms: uniforms14,
|
|
5348
|
-
fs:
|
|
5452
|
+
fs: fs20,
|
|
5349
5453
|
passes: [{
|
|
5350
5454
|
sampler: true
|
|
5351
5455
|
}]
|
|
5352
5456
|
};
|
|
5353
5457
|
|
|
5354
5458
|
// src/modules/image-fun-filters/magnify.ts
|
|
5355
|
-
var
|
|
5459
|
+
var fs21 = `uniform vec2 screenXY;
|
|
5356
5460
|
uniform float radiusPixels;
|
|
5357
5461
|
uniform float zoom;
|
|
5358
5462
|
uniform float borderWidthPixels;
|
|
@@ -5382,14 +5486,14 @@ vec4 magnify_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5382
5486
|
var magnify = {
|
|
5383
5487
|
name: "magnify",
|
|
5384
5488
|
uniforms: uniforms15,
|
|
5385
|
-
fs:
|
|
5489
|
+
fs: fs21,
|
|
5386
5490
|
passes: [{
|
|
5387
5491
|
sampler: true
|
|
5388
5492
|
}]
|
|
5389
5493
|
};
|
|
5390
5494
|
|
|
5391
5495
|
// src/modules/image-warp-filters/warp.ts
|
|
5392
|
-
var
|
|
5496
|
+
var fs22 = glsl`\
|
|
5393
5497
|
vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {
|
|
5394
5498
|
vec4 color = texture2D(texture, coord / texSize);
|
|
5395
5499
|
vec2 clampedCoord = clamp(coord, vec2(0.0), texSize);
|
|
@@ -5403,11 +5507,11 @@ vec4 warp_sampleColor(sampler2D texture, vec2 texSize, vec2 coord) {
|
|
|
5403
5507
|
`;
|
|
5404
5508
|
var warp = {
|
|
5405
5509
|
name: "warp",
|
|
5406
|
-
fs:
|
|
5510
|
+
fs: fs22
|
|
5407
5511
|
};
|
|
5408
5512
|
|
|
5409
5513
|
// src/modules/image-warp-filters/bulgepinch.ts
|
|
5410
|
-
var
|
|
5514
|
+
var fs23 = glsl`\
|
|
5411
5515
|
uniform float radius;
|
|
5412
5516
|
uniform float strength;
|
|
5413
5517
|
uniform vec2 center;
|
|
@@ -5449,7 +5553,7 @@ vec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5449
5553
|
};
|
|
5450
5554
|
var bulgePinch = {
|
|
5451
5555
|
name: "bulgePinch",
|
|
5452
|
-
fs:
|
|
5556
|
+
fs: fs23,
|
|
5453
5557
|
uniforms: uniforms16,
|
|
5454
5558
|
dependencies: [warp],
|
|
5455
5559
|
passes: [{
|
|
@@ -5458,7 +5562,7 @@ vec4 bulgePinch_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5458
5562
|
};
|
|
5459
5563
|
|
|
5460
5564
|
// src/modules/image-warp-filters/swirl.ts
|
|
5461
|
-
var
|
|
5565
|
+
var fs24 = glsl`\
|
|
5462
5566
|
uniform float radius;
|
|
5463
5567
|
uniform float angle;
|
|
5464
5568
|
uniform vec2 center;
|
|
@@ -5502,7 +5606,7 @@ vec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5502
5606
|
};
|
|
5503
5607
|
var swirl = {
|
|
5504
5608
|
name: "swirl",
|
|
5505
|
-
fs:
|
|
5609
|
+
fs: fs24,
|
|
5506
5610
|
uniforms: uniforms17,
|
|
5507
5611
|
dependencies: [warp],
|
|
5508
5612
|
passes: [{
|
|
@@ -5511,7 +5615,7 @@ vec4 swirl_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
5511
5615
|
};
|
|
5512
5616
|
|
|
5513
5617
|
// src/modules/fxaa/fxaa.ts
|
|
5514
|
-
var
|
|
5618
|
+
var fs25 = `
|
|
5515
5619
|
#define FXAA_QUALITY_PRESET 29
|
|
5516
5620
|
|
|
5517
5621
|
#if (FXAA_QUALITY_PRESET == 10)
|
|
@@ -6095,14 +6199,14 @@ vec4 fxaa_sampleColor(sampler2D texture, vec2 texSize, vec2 texCoord) {
|
|
|
6095
6199
|
var fxaa = {
|
|
6096
6200
|
name: "fxaa",
|
|
6097
6201
|
uniforms: {},
|
|
6098
|
-
fs:
|
|
6202
|
+
fs: fs25,
|
|
6099
6203
|
passes: [{
|
|
6100
6204
|
sampler: true
|
|
6101
6205
|
}]
|
|
6102
6206
|
};
|
|
6103
6207
|
|
|
6104
6208
|
// src/modules/transform/transform.ts
|
|
6105
|
-
var
|
|
6209
|
+
var vs4 = glsl`\
|
|
6106
6210
|
attribute float transform_elementID;
|
|
6107
6211
|
|
|
6108
6212
|
// returns half of pixel size, used to move the pixel position to center of the pixel.
|
|
@@ -6144,7 +6248,7 @@ vec4 transform_getInput(sampler2D texSampler, vec2 size) {
|
|
|
6144
6248
|
`;
|
|
6145
6249
|
var transform = {
|
|
6146
6250
|
name: "transform",
|
|
6147
|
-
vs:
|
|
6251
|
+
vs: vs4
|
|
6148
6252
|
};
|
|
6149
6253
|
return __toCommonJS(src_exports);
|
|
6150
6254
|
})();
|