This commit renames all shader snippet files to conform to the newly introduced naming convention outlined in README.md. The new naming convention uses a `prefix_name.suffix` format to clearly indicate the purpose and target shader stage of each snippet. This improves the overall organization and readability of the shader code, making it easier to understand how each snippet contributes to the shader generation process. No functional changes were made to the shader code itself or source code. This is purely a refactoring for clarity and maintainability.
27 lines
951 B
GLSL
27 lines
951 B
GLSL
//------------------------------------------------------------------------------
|
|
// Shadowing
|
|
//------------------------------------------------------------------------------
|
|
|
|
#if defined(VARIANT_HAS_SHADOWING)
|
|
/**
|
|
* Computes the light space position of the specified world space point.
|
|
* The returned point may contain a bias to attempt to eliminate common
|
|
* shadowing artifacts such as "acne". To achieve this, the world space
|
|
* normal at the point must also be passed to this function.
|
|
* Normal bias is not used for VSM.
|
|
*/
|
|
|
|
highp vec4 computeLightSpacePosition(highp vec3 p, const highp vec3 n,
|
|
const highp vec3 dir, const float b, highp_mat4 lightFromWorldMatrix) {
|
|
|
|
#if !defined(VARIANT_HAS_VSM)
|
|
highp float cosTheta = saturate(dot(n, dir));
|
|
highp float sinTheta = sqrt(1.0 - cosTheta * cosTheta);
|
|
p += n * (sinTheta * b);
|
|
#endif
|
|
|
|
return mulMat4x4Float3(lightFromWorldMatrix, p);
|
|
}
|
|
|
|
#endif // VARIANT_HAS_SHADOWING
|