/*
  Named constants for Zayko Shaders
  Replaces magic numbers scattered across the codebase.
  Included from settings.glsl after user-configurable defines.
*/

// Shadow constants
#define SHADOW_Z_DISTORTION       0.2
#define SHADOW_COMPARISON_SCALE   16384.0
#define SHADOW_MAX_CLAMP          16.0
#define SHADOW_CAUSTICS_MULT      4.0
#define SHADOW_BIAS_VL            0.0512
#define SHADOW_SSS_SAMPLE_COUNT   12
#define SHADOW_SSS_OFFSET_Z_BASE  0.025

// Shadow bias constants
#define SHADOW_NORMAL_BIAS_SCALE  5.0
#define SHADOW_NORMAL_BIAS_REF    2048.0
#define SHADOW_DIST_BIAS_MULT     8.0
#define SHADOW_DIST_BIAS_LINEAR   0.005
#define SHADOW_DIST_BIAS_BASE     0.05
#define SHADOW_HALF_LAMBERT_BIAS  0.125
#define SHADOW_SSS_BLUR_OFFSET    0.0007
#define SHADOW_SSS_BLUR_BIAS      0.0002

// Shadow filter constants (quality-adaptive)
#if SHADOW_QUALITY == 0
#define SHADOW_FILTER_TAP_COUNT   5
#elif SHADOW_QUALITY == 1
#define SHADOW_FILTER_TAP_COUNT   9
#elif SHADOW_QUALITY == 2
#define SHADOW_FILTER_TAP_COUNT   9
#else
#define SHADOW_FILTER_TAP_COUNT   9
#endif
#define SHADOW_FILTER_THRESHOLD   0.999

// Raytrace constants (quality-adaptive)
#if SHADOW_QUALITY == 0
#define RT_MAX_ITERATIONS         15
#elif SHADOW_QUALITY == 1
#define RT_MAX_ITERATIONS         20
#elif SHADOW_QUALITY == 2
#define RT_MAX_ITERATIONS         30
#else
#define RT_MAX_ITERATIONS         40
#endif
#define RT_START_OFFSET           0.075
#define RT_SCREEN_EDGE_MIN       -0.05
#define RT_SCREEN_EDGE_MAX        1.05
#define RT_CDIST_SCALE            1.85

// Ambient Occlusion constants
#define AO_STEP_INCREMENT         0.198
#define AO_STEP_INITIAL           0.01
#define AO_RADIUS                 0.5
#define AO_RADIUS_DH              4.0
#define AO_FOV_REFERENCE          1.37
#define AO_STRENGTH_MULT          0.7
#define AO_SAMPLE_COUNT           5
#define AO_DIR_COUNT              2
#define AO_NORMALIZE              0.2
#define AO_HAND_DEPTH_THRESHOLD   0.56
#define AO_HAND_SCALE             1024.0
#define AO_MIN_DIST               5.0

// Volumetric Light constants (quality-adaptive)
#if SHADOW_QUALITY == 0
#define VL_SAMPLE_COUNT           4
#define VL_STEP_SIZE              24.0
#define VL_MAX_DISTANCE           96.0
#elif SHADOW_QUALITY == 1
#define VL_SAMPLE_COUNT           7
#define VL_STEP_SIZE              14.0
#define VL_MAX_DISTANCE           196.0
#elif SHADOW_QUALITY == 2
#define VL_SAMPLE_COUNT           12
#define VL_STEP_SIZE              10.0
#define VL_MAX_DISTANCE           120.0
#else
#define VL_SAMPLE_COUNT           16
#define VL_STEP_SIZE              8.0
#define VL_MAX_DISTANCE           128.0
#endif
#define VL_VISIBILITY_SCALE       0.14285
#define VL_DITHER_SCALE           128.0

// Cloud constants (quality-adaptive sample counts)
#define CLOUD_BASE_HEIGHT_OFFSET  70.0
#if SHADOW_QUALITY == 0
#define CLOUD_SAMPLES_DEFAULT     12
#define CLOUD_SAMPLES_BLOCKY      32
#elif SHADOW_QUALITY == 1
#define CLOUD_SAMPLES_DEFAULT     24
#define CLOUD_SAMPLES_BLOCKY      64
#elif SHADOW_QUALITY == 2
#define CLOUD_SAMPLES_DEFAULT     36
#define CLOUD_SAMPLES_BLOCKY      64
#else
#define CLOUD_SAMPLES_DEFAULT     48
#define CLOUD_SAMPLES_BLOCKY      96
#endif
#define CLOUD_NOISE_RES           512.0
#define CLOUD_DENSITY_SCALE       0.125
#define CLOUD_RAIN_DAMPEN         0.75
#define CLOUD_SHADOW_OPACITY      0.85
#define CLOUD_WIND_SPEED_X        0.0005
#define CLOUD_WIND_SPEED_Y        0.001
#define CLOUD_WIND_AMPLITUDE      0.005
#define CLOUD_WIND_HEIGHT_SCALE   15.0

// Interleaved Gradient Noise constants
#define IGN_FACTOR                52.9829189
#define IGN_COEFF_X               0.06711056
#define IGN_COEFF_Y               0.00583715
#define IGN_GOLDEN_RATIO          1.618

// TAA temporal dither constants
#define TAA_DITHER_MODE0          0.618
#define TAA_DITHER_MODE1          0.5

// Underground sky visibility constants
#define UNDERGROUND_SKY_START     48.0
#define UNDERGROUND_SKY_RANGE     16.0

// Deep underground visibility
#define DEEP_UNDERGROUND_Y_NEW    70.0
#define DEEP_UNDERGROUND_RANGE    8.0
