const int R11F_G11F_B10F = 0;
const int RGBA8 = 0;
const int RGBA16 = 0;
const int RG16F = 0;
const int RGBA16F = 0;
const int RGBA32 = 0;
const int RG32F = 0;
const int R32F = 0;

const int colortex0Format = RGBA16F;
const int colortex1Format = RGBA16F;
const int colortex2Format = RGBA16F;
const int colortex3Format = RGBA16F;
const int colortex4Format = RGBA16;
const int colortex5Format = RGBA16F;
const int colortex6Format = RG32F;
const int colortex7Format = RGBA16F;
const int colortex8Format = RGBA16F;
const int colortex9Format = RGBA16F;
const int colortex10Format = RGBA16F;
const int colortex11Format = RGBA16F;
const int colortex12Format = R32F;
const int colortex13Format = RGBA16;
const int colortex15Format = RGBA8;

const int colortex16Format = RGBA8;
const int colortex17Format = RGBA16;
const int colortex18Format = RGBA16F;

const int shadowcolor0Format = RGBA16F;
const int shadowcolor1Format = RGBA8;

const bool colortex2Clear = false;
const bool colortex3Clear = false;
const bool colortex6Clear = false;
const bool colortex7Clear = false;
const bool colortex10Clear = false;
const bool colortex12Clear = false;

/*
0: rgb:color
1: hrr data
2: rgb:TAA          		a:temporal data
3: rgba:hrr temporal data(rsm/ao/cloud/ssr/fog)
4: r:parallax shadow/ao		g:blockID/gbufferID		ba:specular		(df10)rg:albedo/ao	(df15)rgba:color
5: rg:normal				ba:lmcoord													(df15)rgba:TAA pre color									
6: hrr normal/depth (pre/cur)
7: sky box/T1/MS/sunColor/skyColor/handColor
8: custom texture(MS/noise3d low)														
9: rg:velocity				ba:N
10:rgba:path tracing temporal
11:rgba:path tracing filter

ci0:rgb:voxel color			a:voxel bri
ci1-3:SDF
*/

#define CPS

varying vec2 texcoord;



#include "/lib/uniform.glsl"
#include "/lib/settings.glsl"
#include "/lib/common/utils.glsl"
#include "/lib/common/noise.glsl"
#include "/lib/common/normal.glsl"
#include "/lib/camera/colorToolkit.glsl"
#include "/lib/camera/filter.glsl"
#include "/lib/common/position.glsl"
// #include "/lib/atmosphere/atmosphericScattering.glsl"


#ifdef FSH

const bool shadowtex0Mipmap = false;
const bool shadowtex1Mipmap = false;
const bool shadowcolor0Mipmap = false;
const bool shadowcolor1Mipmap = false;
void main() {
	vec4 CT6 = texelFetch(colortex6, ivec2(gl_FragCoord.xy), 0);
	vec2 uv = texcoord * 2.0 - vec2(0.0, 1.0);
	float curZ = 0.0;
	vec3 curNormalW = vec3(0.0);
	if(!outScreen(uv)){
		curZ = texelFetch(depthtex0, ivec2(uv * viewSize), 0).r;
		vec3 curNormalV = normalDecode(texelFetch(colortex5, ivec2(uv * viewSize), 0).rg);
		curNormalW = mat3(gbufferModelViewInverse) * curNormalV;

		#if defined DISTANT_HORIZONS && !defined NETHER && !defined END
			float dhCurZ = texelFetch(dhDepthTex0, ivec2(uv * viewSize), 0).r;
			vec4 dhViewPos = screenPosToViewPosDH(vec4(uv, dhCurZ, 1.0));
			dhCurZ = viewPosToScreenPos(dhViewPos).z;

			float dhTerrain = texture(dhDepthTex0, uv).r < 1.0 && curZ == 1.0 ? 1.0 : 0.0;

			if(dhTerrain > 0.5){
				curZ = dhCurZ;
			}
			
		#endif

		CT6 = vec4(packNormal(curNormalW), curZ, 0.0, 0.0);
	}

	

/* DRAWBUFFERS:6 */
	gl_FragData[0] = CT6;
}

#endif
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////BY ZYPanDa/////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#ifdef VSH

void main() {
	gl_Position = ftransform();
	texcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}

#endif

#ifdef SHADOWMAP_EXCLUDE_ENTITIES
#endif
#ifdef HELD_BLOCK_DYNAMIC_LIGHT
#endif
#ifdef TRANSLUCENT_USE_RESOURCESPACK_PBR
#endif
