#define HEADER 0

// Ray tracing
#define SAMPLES 1 // Number of possible paths traced per pixel, frame [1 2 3 4 6 8 12 16]
#define ROUGH_REFLECTIONS // reflections on very rough (blurry) surfaces. Disabling this is faster
#define SPECULAR_SAMPLES 1 // [1 2 3 4 5 6 7 8 9 10]
#define MAX_RAY_DIST 45 // Maximum ray steps [10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100 115 130 160]
#define MAX_ACCUM_FRAMES 50 // Maximum number of frames that samples are kept [1 2 4 8 16 20 25 30 35 40 50 60 80 100 150 200 300 999999999]
// #define ALPHA_TEST // Allows for path tracing to account for 'holes' in textures. e.g Leaves
#define ADDITIONAL_AO_APPLICATION // Adds subtle AO to compensate for filter overblurring path traced AO. Has no performance impact
#define ENABLE_SVGF
#define SHADING_CLARITY 1 // How crisp shadows from emitters will be (HIGH CLARITY MAKES IT LOOK MORE NOISY) [0 1 2 3]
#define TEMPORAL_DEPTH_TEST // Prevents GI ghosting when moving

// INTERSECTIONS
#define IntersectStairs
//#define IntersectFences
#define IntersectWalls
//#define IntersectAnvils

#define CAUSTICS_ENABLED
#define CAUSTICS_INTENSITY 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5]

const float PATH_BOUNCE_MULTIPLIER = 1.0;

//Atmosphere
const float sunPathRotation = -40; // Sun angle offset [-70 -60 -50 -40 -35 -30 -25 -20 -15 -10 -5 0 5 10 15 20 25 30 35 40 50 60 70]
#define PRIMARY_STEPS 16 // Number of steps for the primary rays (More = slower but prettier) [6 7 8 9 10 11 12 13 14 15 16 20 24 30 40]
#define SECONDARY_STEPS 4 // Number of steps for the secondary rays (More = slower but prettier) [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]

#define PRIMARY_STEPS_LOD 4
#define SECONDARY_STEPS_LOD 0

//Sunlight
#define coneAngleToSolidAngle(x) (6.28318530718*(1.0 - cos(x)))
const float sunRadius = 6.95e8;
const float sunDist = 1.49e11;
const float sunAngularRadius = sunRadius / sunDist;
#define SUN_BRIGHTNESS 10.0 // [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0 3.25 3.5 3.75 4.0 4.25 4.5 4.75 5.0 5.5 6.0 7.0 8.2 9.0 10.0 14.0 16.0 20.0 40.0 60.0 100.0 200.0 400.0]
#define SUN_COLOUR vec3(1.0, 0.949, 0.937)
#define MOON_BRIGHTNESS 0.006 // [0.0 0.002 0.004 0.006 0.008 0.01 0.012 0.014]
#define SUNLIGHT_GI_BOOST 2.0 // [0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0 3.25 3.5 3.75 4.0 4.5 5.0 5.5 6.0 7.0 8.0 9.0 10.0 12.0 14.0]
#define SUN_SIZE 1.0 // How beeg the sun is in the sky [0.06 0.12 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.5 3.0 3.5 4.0 5.0 6.0 7.5 8.2 10.0]
#define PCSS_SAMPLES 9 // Soft shadow sample count [4 5 6 7 8 9 10 12 14 16 18 20 24 28 32 38 46]

const vec3 netherSkyCol = 0.02*vec3(107, 22, 6)/255.0;


//Material options
//water
#define WATER_WAVE_SPEED 1.0 // Speed multiplier of water waves [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.25 2.5 3.0 3.5 4.0 5.0 6.0]
#define WATER_ABSORP_R 0.46 // How much water absorbs the red wavelength [0.0 0.03 0.06 0.09 0.12 0.15 0.18 0.21 0.25 0.3 0.35 0.4 0.5 0.55 0.6 0.65 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0]
#define WATER_ABSORP_G 0.265 // How much water absorbs the green wavelength [0.0 0.03 0.06 0.09 0.12 0.14 0.15 0.18 0.21 0.25 0.3 0.35 0.37 0.4 0.5 0.55 0.6 0.65 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0]
#define WATER_ABSORP_B 0.208 // How much water absorbs the blue wavelength [0.0 0.03 0.06 0.09 0.10 0.12 0.15 0.18 0.21 0.25 0.3 0.35 0.4 0.5 0.55 0.6 0.65 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 2.0]
#define WATER_TURBIDITY 1.0 // How 'dirty' the water will look [0.0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5 0.55 0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1.0 1.1 1.2 1.3 1.4 1.5 1.75 2.0 2.5 3.0 4.0 5.0]
#define WATER_DISPERSION_INTENSITY 1.0 // Strength of the colour dispersion effect on caustics [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.5]
#define WATER_STEPS 4 // Number of ray marching samples for water fog [1 2 3 4 5 6 7 8 10 12 14 16 18 20 24 32 34 36 38 42 46 48 52]
#define WATER_MIE_SCATTER vec3(WATER_TURBIDITY, WATER_TURBIDITY, WATER_TURBIDITY)*0.04
#define WATER_REFLECTION_RAY_DIST 45 // How far water reflection rays travel [5 15 25 35 45 55 65 75 80 100 125 150 200]
#define WATER_WAVE_HEIGHT 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5]
#define WATER_REFRACTION_STRENGTH 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5]
// #define VANILLA_STYLE_WATER

const vec3 WATER_ABSORP = pow(vec3(WATER_ABSORP_R, WATER_ABSORP_G, WATER_ABSORP_B), vec3(0.85))*1e-1;
const vec3 WATER_SCATTER = WATER_MIE_SCATTER;
const vec3 WATER_EXTINC = (WATER_ABSORP)*1.7;

//plants
#define WAVING_PLANTS_SPEED 1.0 // Speed multiplier of waving plants [0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0]

// #define LabPBR_ENABLED // Toggle LabPBR reconstructed normals and texture AO

//White world
//#define WHITE_WORLD // Makes everything have an albedo of 100%

//EMissive
#define EMISSIVE_BRIGHTNESS 1.0 // Brightness of light-emitting blocks [0.0 0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0 2.5 2.75 3.0 4.0 5.0 6.0 8.0 10.0 12.0 14.0 16.0]
#define EMISSIVE_CURVE 0.75 // Contrast of emitters [0.4 0.55 0.6 0.65 0.75 0.8 1.0 1.25 1.5 1.75 2.0 2.25 2.5 2.75 3.0 3.25 3.5 3.75]
#define CONCRETE_POWDER_EMISSIVES
#define TORCH_TEMP 3000 // Temperature of torches (K) [1000 2000 3000 4000 5000 6000 7000]
//#define DYNAMIC_LAVA_EMISSIVE // Whether the light emitted by lava and fire changes colour over time

#define GRADING_STYLE 1 // The "look" of apollo [0 1]

const float sunlightGIBoost = SUNLIGHT_GI_BOOST;

//ACES
#define SAT_MOD                      0.0     // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.15 -0.1 -0.05 0.0 0.05 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#define VIB_MOD                      0.0      // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 -0.05 0.0 0.05 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0]
#define GAIN_MOD                     0.0         // [-1.0 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1 -0.05 0.0 0.05 0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0]
#define LIFT_MOD                     0.0         // [-10.0 -9.0 -8.0 -7.0 -6.0 -5.0 -4.0 -3.0 -2.0 -1.0 -0.5 0.0 0.25 0.5 0.75 1.0 2.0 3.0 4.0 5.0 6.0 7.0 8.0 9.0 10.0]


#define Film_Slope                   0.90        //[0.0 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.68 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.10 1.20 1.30 1.40 1.50 1.60 1.70 1.80 1.90 2.00]
#define Film_Toe                     0.45        //[0.0 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00]
#define Film_Shoulder                0.5         //[0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.6 0.65 0.7 0.8 0.9 0.95 1.0]
#define Black_Clip                   0.0         //[0.005 0.010 0.015 0.020 0.025 0.030 0.035 0.040 0.045 0.050 0.06 0.07 0.08 0.09 0.1]
#define White_Clip                   0.035       //[0.005 0.010 0.015 0.020 0.025 0.030 0.035 0.040 0.045 0.050 0.06 0.07 0.08 0.09 1.0]
#define Blue_Correction              0.0         //[1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.0 -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 -0.7 -0.8 -0.9 -1.0]
#define Gamut_Expansion              5.0         //[0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0]      

#define in_Match                     0.14        //[0.0 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.40]
#define Out_Match                    0.10        //[0.0 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.20 0.22 0.24 0.26 0.28 0.30 0.40]

//Camera effects
#define AUTO_EXPOSURE // Automatic exposure adjustment
#define EXPOSURE_SPEED 1.0// Automatic exposure adjustment speed [0.12 0.25 0.5 0.75 1.0 1.5 2.0 2.5]
#define MANUAL_EXPOSURE_AMOUNT 1.0 // Manual exposure adjustement amount [0.01 0.05 0.1 0.15 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.5 1.7 2.0 2.5 3.0 3.5 4.0 5.0 7.5 10.0 15.0 30.0 50.0 75.0 100.0 200.0 300.0 400.0 500.0]
#define BLOOM_ENABLED
#define BLOOM_INTENSITY 1.0 // [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0 4.0 5.0 7.5 10.0]

#define POST_SHARPEN_ENABLED
#define POST_SHARPEN_WEIGHT 2.0 // Sharpen the image -2.0: Good for 1.0x render res -2.5: Good for 0.75x render res -3.0: <0.75x render res  [2.0 2.5 3.0]

//TAA
#define TAA_ENABLED // Temporal Anti-Aliasing (removes jaggy edges and noise) 
#define TAA_WEIGHT 0.05 // [0.025 0.05 0.075 0.1 0.15 0.2 0.25 0.3]

// #define HARDCORE_DARKNESS // Makes nighttime almost pitch-black when there are no lights
#ifndef HARDCORE_DARKNESS
const float moonMult = MOON_BRIGHTNESS;
#else
const float moonMult = 0.002;
#endif

//SURVIVOIR SENSE
#define SURVIVOR_SENSE_ENABLED // Hold crouch and scan the environment for hostile mobs and players
// #define SURVIVOR_SENSE_ALWAYS_ACTIVE // Whether or not you have to crouch to enable surv sense

//Flashlight
#define FLASHLIGHT_MODE 2 // [0 1 2]
#define FLASHLIGHT_TEMP 5700 // The temperature in Kelvin (K) of flashlight beam. Lower = Oranger, Higher = Bluer[3000 3500 4000 4100 4200 4300 4400 4500 4600 4700 4800 4900 5000 5100 5200 5300 5400 5500 5600 5700 5800 5900 6000 6100 6200 6300 6400 6500 6600 6700 6800 6900 7000 7100 7200 7300 7400 7500 7600 7700 7800 7900 8000] 
#define FLASHLIGHT_LAG_AMOUNT 1.0 // How much the flashlight beam lags behind the player camera movement [0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0]
#define FLASLIGHT_BRIGHTNESS 1.0 // The intensity of the night flashlight beam [0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0]
#define FLASHLIGHT_WIDTH 1.0 // The width of the flashlight beam [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.5 3.0]

#define USE_HALF

#if (defined(USE_HALF) && defined(MC_GL_EXT_shader_explicit_arithmetic_types))

#extension GL_EXT_shader_explicit_arithmetic_types : enable
#define SUPPORT_HALF

#elif (defined(USE_HALF) && defined(MC_GL_NV_gpu_shader5))

#extension GL_NV_gpu_shader5 : enable
#define SUPPORT_HALF

#elif (defined(USE_HALF) && defined(MC_GL_AMD_gpu_shader_half_float))

#extension GL_AMD_gpu_shader_half_float : enable
#define SUPPORT_HALF

#define int8_t int
#define int16_t int
#define int32_t int

#else

#define float32_t float
#define f32vec2 vec2
#define f32vec3 vec3
#define f32vec4 vec4
#define float16_t float
#define f16vec2 vec2
#define f16vec3 vec3
#define f16vec4 vec4
#define int8_t int
#define int16_t int
#define int32_t int

#endif