shaderpad 1.0.0-beta.23 → 1.0.0-beta.24
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
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
// Apply aspect ratio correction (object-fit: contain)
|
|
4
4
|
vec2 fitContain(vec2 uv, vec2 textureSize) {
|
|
5
5
|
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
6
|
-
return (uv - 0.5) *
|
|
6
|
+
return (uv - 0.5) * max(scale, vec2(1.0)) + 0.5;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// Apply aspect ratio correction (object-fit: cover)
|
|
10
10
|
vec2 fitCover(vec2 uv, vec2 textureSize) {
|
|
11
11
|
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
12
|
-
return (uv - 0.5) *
|
|
12
|
+
return (uv - 0.5) * min(scale, vec2(1.0)) + 0.5;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// Get the array index for a history texture
|
|
@@ -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","uniform vec2 u_resolution;\n\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) *
|
|
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","uniform vec2 u_resolution;\n\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) * max(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) * min(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;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
|
@@ -3,13 +3,13 @@ var e=`uniform vec2 u_resolution;
|
|
|
3
3
|
// Apply aspect ratio correction (object-fit: contain)
|
|
4
4
|
vec2 fitContain(vec2 uv, vec2 textureSize) {
|
|
5
5
|
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
6
|
-
return (uv - 0.5) *
|
|
6
|
+
return (uv - 0.5) * max(scale, vec2(1.0)) + 0.5;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
// Apply aspect ratio correction (object-fit: cover)
|
|
10
10
|
vec2 fitCover(vec2 uv, vec2 textureSize) {
|
|
11
11
|
vec2 scale = u_resolution.xy * textureSize.yx / (u_resolution.yx * textureSize.xy);
|
|
12
|
-
return (uv - 0.5) *
|
|
12
|
+
return (uv - 0.5) * min(scale, vec2(1.0)) + 0.5;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// Get the array index for a history texture
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/plugins/helpers.glsl","../../src/plugins/helpers.ts"],"sourcesContent":["uniform vec2 u_resolution;\n\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) *
|
|
1
|
+
{"version":3,"sources":["../../src/plugins/helpers.glsl","../../src/plugins/helpers.ts"],"sourcesContent":["uniform vec2 u_resolution;\n\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) * max(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) * min(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;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"]}
|