/*
====================================================================================================

    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 This:

    You Must Read The License: https://pyvton.pages.dev/minecraft-shaders/pyvtron-shaders-license
    And Read The Agreement: https://pyvton.pages.dev/minecraft-shaders/pyvtron-shaders-agreement

====================================================================================================
*/


#include "/Include/Settings.glsl"

uniform int heldItemId;
uniform int heldBlockLightValue;
uniform int heldItemId2;
uniform int heldBlockLightValue2;
uniform int fogMode;

uniform float fogDensity;

uniform vec3 fogColor;
uniform vec3 skyColor;

uniform int worldTime;
uniform int worldDay;
uniform int moonPhase;
uniform int frameCounter;

uniform float frameTime;
uniform float frameTimeCounter;
uniform float sunAngle;
uniform float shadowAngle;
uniform float rainStrength;
uniform float aspectRatio;
uniform float viewWidth;
uniform float viewHeight;
uniform float near;
uniform float far;
uniform float rotationAngle;

uniform vec3 sunPosition;
uniform vec3 moonPosition;
uniform vec3 shadowLightPosition;
uniform vec3 upPosition;
uniform vec3 cameraPosition;
uniform vec3 previousCameraPosition;

uniform mat4 gbufferModelView;
uniform mat4 gbufferModelViewInverse;
uniform mat4 gbufferPreviousModelView;
uniform mat4 gbufferProjection;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferPreviousProjection;
uniform mat4 shadowProjection;
uniform mat4 shadowProjectionInverse;
uniform mat4 shadowModelView;
uniform mat4 shadowModelViewInverse;

uniform float wetness;
uniform float eyeAltitude;

uniform ivec2 eyeBrightness;
uniform ivec2 eyeBrightnessSmooth;

uniform int isEyeInWater;

uniform float nightVision;
uniform float blindness;
uniform float screenBrightness;

uniform int hideGUI;

uniform float centerDepthSmooth;

uniform ivec2 atlasSize;

uniform vec4 spriteBounds;

uniform vec4 entityColor;

uniform int entityId;

uniform int blockEntityId;

uniform ivec4 blendFunc;

uniform int instanceId;

uniform float playerMood;

uniform int renderStage;

uniform vec2 taaJitter;
uniform vec2 viewDimensions;
uniform vec2 pixelSize;
uniform vec2 screenSize;

uniform float compositeOutputFactor;

uniform sampler2D colortex0;
uniform sampler2D colortex1;
uniform sampler2D colortex2;
uniform sampler2D colortex3;
uniform sampler2D colortex4;
uniform sampler2D colortex5;
uniform sampler2D colortex6;
uniform sampler2D colortex7;
uniform sampler2D gdepthtex;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
uniform sampler2D depthtex2;
uniform sampler2D noisetex;

const int 		noiseTextureResolution  = 64;

const int 		shadowMapResolution 	= 2048;		// [256 512 1024 1536 2048 3172 4096 6344 8192 16384]
const float 	shadowDistance 			= 192.0;	// [32.0 64.0 80.0 96.0 112.0 128.0 144.0 160.0 176.0 192.0 208.0 224.0 240.0 256.0 272.0 288.0 304.0 320.0 336.0 352.0 368.0 384.0 512.0 768.0 1024.0 1536.0 2048.0 4096.0 8192.0]
const float 	shadowIntervalSize 		= 4.0;
const float     shadowDistanceRenderMul = 1.0;		// [-1.0 1.0]