/**
 * Copyright (C) 2013 Stellar Jockeys.
 * All Rights Reserved.
 *
 * NOTICE: All information contained herein is, and remains the property of
 * Stellar Jockeys and its suppliers, if any.  The intellectual and technical
 * concepts contained herein are proprietary to Stellar Jockeys and its suppliers.
 * Dissemination of this information or reproduction of this material is
 * strictly forbidden unless prior written permission is obtained from
 * Stellar Jockeys.
 *
 * @file constants.glsl
 * @author Harry Hsiao
 * @date 07/25/13
 */
#ifndef CONSTANTS_GLSL
#define CONSTANTS_GLSL

/*
 * !!!!! IMPORTANT !!!!!: floats should always have a decimal point.
 */

/**
 * @brief The max change in depth values used for deriving normals.
 *
 * Used to treat large changes as discontinuities.
 * Probably shouldn't use values much smaller than 3.0 / 65535.0
 *
 * Value range: (0, 1]
 */
const float MAX_DELTA_DEPTH = 8.0 / 65535.0;

/*
 * @brief The min change in the delta depths to detect as a bent edge.
 *
 * Used to find drastic changes in slope.
 *
 * Value range: (0, 1]
 */
const float MAX_CHANGE_DELTA_DEPTH = 2.0 / 65535.0;

/**
 * @brief These values are used to determine the specular energy factor.
 *
 * The energy factor is used to diminish the specular strength as the
 * specular exponent decreases and simulate enerey conservation.
 *
 * <energyFactor> = <specularExponent> * FACTOR + CONSTANT
 *
 * <energyFactor> should generally avoid being much greater than 1.
 * Note that <specularExponent> is a power of two on the range [2, 2048].
 */
const float SPEC_ENERGY_FACTOR = 0.0004;
const float SPEC_ENERGY_CONSTANT = 0.18;

/**
 * @brief Scale of the ground depth offsetting.
 *
 * Should be non-negative and kept small.
 */
const float PERTURBATION_SCALE = 0.05;

/**
 * @brief EXPERIMENTAL. Automatically dims the directional light as it approaches the horizon.
 *
 * 0: off
 * 1: on
 * (0, 1): blends between on and off.
 */
const float AUTO_DIM = 0.0;

/**
 * @brief Vector used to desaturate RGB colors (based on YIQ wieghts).
 * const vec3 DESATURATE = vec3(0.299, 0.587, 0.114);
 */
const vec3 DESATURATE = vec3(0.299, 0.587, 0.114);

/**
 * @brief Controls the power of the rim shading.
 *
 * The value should be greater than 0.
 *
 * A larger value creates a larger rim.
 */
const float OCCLUDED_RIM_SHADING_POWER = 1.0;

/**
 * @brief Controls the minimum intensity for the rim shading.
 *
 * The value should be in the interval [0.0, 1.0).
 */
const float OCCLUDED_RIM_SHADING_MIN = 0.125;

/**
 * @brief Makes the rim shaded falloff more opaque.
 *
 * The value should be in the interval [0.0, 1.0].
 */
const float OCCLUDED_RIM_SHADING_FALLOFF_OPACITY = 0.5;

/**
 * @brief Depth values below the threshold will not be rim shaded.
 *
 * The value should be in the interval (0.0, 1.0).
 *
 * This is used to determine a mask for what is rim shaded based on the depth map.
 */
const float OCCLUDED_DEPTH_THRESHOLD = 135.0 / 255.0;

#endif // CONSTANTS_GLSL
