#====================================================================================================#
#                                                                                                    #
#   Copyright (C) 2025 Pyvtron VX Shaders - Pyvton                                                  #
#                                                                                                    #
#    All Rights Reserved unless otherwise explicitly stated.                                         #
#                                                                                                    #
#    Before You Do Something With Pyvtron VX Shaders, You MUST Read The License                      #
#                                                                                                    #
#    License Here: https://pyvton.pages.dev/licenses/pcll                                           #
#                                                                                                    #
#====================================================================================================#

#include "/Include/GI.glsl"

float CalculateDitherPattern1(){const int[16] ditherPattern=int[16](0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5);vec2 b=vec2(.0);b.x=floor(mod(texcoord.s*viewWidth,4.));b.y=floor(mod(texcoord.t*viewHeight,4.));int e=ditherPattern[int(fma(int(b.y),4,int(b.x)))];return float(e)/16.;}
vec4 textureSmooth(in sampler2D b,in vec2 c){vec2 d=vec2(64.,64.);vec2 h=((c*d)+vec2(-.5,-.5));vec2 j=floor(h);vec2 m=fract(h);vec4 n=texture2D(b,((j+vec2(.0,.0))+vec2(.5,.5))/d);vec4 s=texture2D(b,((j+vec2(1.,.0))+vec2(.5,.5))/d);vec4 t=texture2D(b,((j+vec2(.0,1.))+vec2(.5,.5))/d);vec4 C=texture2D(b,((j+vec2(1.,1.))+vec2(.5,.5))/d);vec4 G=mix(n,s,(m.x*1.));vec4 H=mix(t,C,(m.x*1.));vec4 I=mix(G,H,(m.y*1.));return(I);}float AlmostIdentity(in float J,in float K,in float L){if(J>K)return J;float N=(2.*L)-K;float O=(2.*K)-(3.*L);float P=J/K;return((N*P)+O)*P*P+L;}