shaderpad 1.0.0-beta.21 → 1.0.0-beta.22
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/plugins/helpers.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
"use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var
|
|
1
|
+
"use strict";var o=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var i in e)o(t,i,{get:e[i],enumerable:!0})},f=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of c(e))!s.call(t,r)&&r!==i&&o(t,r,{get:()=>e[r],enumerable:!(n=a(e,r))||n.enumerable});return t};var l=t=>f(o({},"__esModule",{value:!0}),t);var v={};x(v,{default:()=>p});module.exports=l(v);var u=`// Apply aspect ratio correction (object-fit: contain)
|
|
2
|
+
vec2 fitContain(vec2 uv, vec2 textureSize) {
|
|
3
|
+
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
4
|
+
return (uv - 0.5) * min(scale, vec2(1.0)) + 0.5;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Apply aspect ratio correction (object-fit: cover)
|
|
8
|
+
vec2 fitCover(vec2 uv, vec2 textureSize) {
|
|
9
|
+
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
10
|
+
return (uv - 0.5) * max(scale, vec2(1.0)) + 0.5;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Get the array index for a history texture
|
|
14
|
+
float historyZ(highp sampler2DArray tex, int frameOffset, int framesAgo) {
|
|
2
15
|
int historyDepth = textureSize(tex, 0).z;
|
|
3
16
|
int z = (historyDepth + frameOffset - framesAgo) % historyDepth;
|
|
4
17
|
return float(z);
|
|
5
18
|
}
|
|
6
|
-
`;function
|
|
19
|
+
`;function h(){return function(t,e){e.injectGLSL(u)}}var p=h;
|
|
7
20
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/helpers.ts","../../src/plugins/helpers.glsl"],"sourcesContent":["import ShaderPad, { PluginContext } from '../index';\nimport helpersGLSL from './helpers.glsl';\n\nfunction helpers() {\n\treturn function (_shader: ShaderPad, context: PluginContext) {\n\t\tcontext.injectGLSL(helpersGLSL);\n\t};\n}\n\nexport default helpers;\n","
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/helpers.ts","../../src/plugins/helpers.glsl"],"sourcesContent":["import ShaderPad, { PluginContext } from '../index';\nimport helpersGLSL from './helpers.glsl';\n\nfunction helpers() {\n\treturn function (_shader: ShaderPad, context: PluginContext) {\n\t\tcontext.injectGLSL(helpersGLSL);\n\t};\n}\n\nexport default helpers;\n","// Apply aspect ratio correction (object-fit: contain)\nvec2 fitContain(vec2 uv, vec2 textureSize) {\n\tvec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);\n\treturn (uv - 0.5) * min(scale, vec2(1.0)) + 0.5;\n}\n\n// Apply aspect ratio correction (object-fit: cover)\nvec2 fitCover(vec2 uv, vec2 textureSize) {\n\tvec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);\n\treturn (uv - 0.5) * max(scale, vec2(1.0)) + 0.5;\n}\n\n// Get the array index for a history texture\nfloat historyZ(highp sampler2DArray tex, int frameOffset, int framesAgo) {\n\tint historyDepth = textureSize(tex, 0).z;\n\tint z = (historyDepth + frameOffset - framesAgo) % historyDepth;\n\treturn float(z);\n}\n"],"mappings":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GCAA,IAAAI,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EDGA,SAASC,GAAU,CAClB,OAAO,SAAUC,EAAoBC,EAAwB,CAC5DA,EAAQ,WAAWC,CAAW,CAC/B,CACD,CAEA,IAAOA,EAAQH","names":["helpers_exports","__export","helpers_default","__toCommonJS","helpers_default","helpers","_shader","context","helpers_default"]}
|
package/dist/plugins/helpers.mjs
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
-
var
|
|
1
|
+
var e=`// Apply aspect ratio correction (object-fit: contain)
|
|
2
|
+
vec2 fitContain(vec2 uv, vec2 textureSize) {
|
|
3
|
+
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
4
|
+
return (uv - 0.5) * min(scale, vec2(1.0)) + 0.5;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// Apply aspect ratio correction (object-fit: cover)
|
|
8
|
+
vec2 fitCover(vec2 uv, vec2 textureSize) {
|
|
9
|
+
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
10
|
+
return (uv - 0.5) * max(scale, vec2(1.0)) + 0.5;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Get the array index for a history texture
|
|
14
|
+
float historyZ(highp sampler2DArray tex, int frameOffset, int framesAgo) {
|
|
2
15
|
int historyDepth = textureSize(tex, 0).z;
|
|
3
16
|
int z = (historyDepth + frameOffset - framesAgo) % historyDepth;
|
|
4
17
|
return float(z);
|
|
5
18
|
}
|
|
6
|
-
`;function i(){return function(o,
|
|
19
|
+
`;function i(){return function(o,t){t.injectGLSL(e)}}var a=i;export{a as default};
|
|
7
20
|
//# sourceMappingURL=helpers.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/helpers.glsl","../../src/plugins/helpers.ts"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/helpers.glsl","../../src/plugins/helpers.ts"],"sourcesContent":["// Apply aspect ratio correction (object-fit: contain)\nvec2 fitContain(vec2 uv, vec2 textureSize) {\n\tvec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);\n\treturn (uv - 0.5) * min(scale, vec2(1.0)) + 0.5;\n}\n\n// Apply aspect ratio correction (object-fit: cover)\nvec2 fitCover(vec2 uv, vec2 textureSize) {\n\tvec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);\n\treturn (uv - 0.5) * max(scale, vec2(1.0)) + 0.5;\n}\n\n// Get the array index for a history texture\nfloat historyZ(highp sampler2DArray tex, int frameOffset, int framesAgo) {\n\tint historyDepth = textureSize(tex, 0).z;\n\tint z = (historyDepth + frameOffset - framesAgo) % historyDepth;\n\treturn float(z);\n}\n","import ShaderPad, { PluginContext } from '../index';\nimport helpersGLSL from './helpers.glsl';\n\nfunction helpers() {\n\treturn function (_shader: ShaderPad, context: PluginContext) {\n\t\tcontext.injectGLSL(helpersGLSL);\n\t};\n}\n\nexport default helpers;\n"],"mappings":"AAAA,IAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ECGA,SAASC,GAAU,CAClB,OAAO,SAAUC,EAAoBC,EAAwB,CAC5DA,EAAQ,WAAWC,CAAW,CAC/B,CACD,CAEA,IAAOA,EAAQH","names":["helpers_default","helpers","_shader","context","helpers_default"]}
|