@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 1.4 kB
JavaScript
var e="\nvec4 SampleTextureCatmullRom(TEXTURE_ACCEPT(tex), vec2 uv, vec2 texSize) {\n\tvec2 samplePos = uv * texSize;\n\tvec2 texPos1 = floor(samplePos - 0.5) + 0.5;\n\tvec2 f = samplePos - texPos1;\n\tvec2 w0 = f * (-0.5 + f * (1.0 - 0.5 * f));\n\tvec2 w1 = 1.0 + f * f * (-2.5 + 1.5 * f);\n\tvec2 w2 = f * (0.5 + f * (2.0 - 1.5 * f));\n\tvec2 w3 = f * f * (-0.5 + 0.5 * f);\n\tvec2 w12 = w1 + w2;\n\tvec2 offset12 = w2 / (w1 + w2);\n\tvec2 texPos0 = (texPos1 - 1.0) / texSize;\n\tvec2 texPos3 = (texPos1 + 2.0) / texSize;\n\tvec2 texPos12 = (texPos1 + offset12) / texSize;\n\tvec4 result = vec4(0.0);\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos0.y), 0.0) * w0.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos0.y), 0.0) * w12.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos0.y), 0.0) * w3.x * w0.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos12.y), 0.0) * w0.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos12.y), 0.0) * w12.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos12.y), 0.0) * w3.x * w12.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos0.x, texPos3.y), 0.0) * w0.x * w3.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos12.x, texPos3.y), 0.0) * w12.x * w3.y;\n\tresult += texture2DLodEXT(tex, vec2(texPos3.x, texPos3.y), 0.0) * w3.x * w3.y;\n\treturn result;\n}\n";export{e as default};