mirror of
https://github.com/SangeloDev/SangeFault.git
synced 2024-11-14 01:22:43 +00:00
a50683c84e
basically starting over... this is gonna be fun!
26 lines
875 B
GLSL
26 lines
875 B
GLSL
#version 150
|
|
|
|
vec4 linear_fog(vec4 inColor, float vertexDistance, float fogStart, float fogEnd, vec4 fogColor) {
|
|
if (vertexDistance <= fogStart) {
|
|
return inColor;
|
|
}
|
|
|
|
float fogValue = vertexDistance < fogEnd ? smoothstep(fogStart, fogEnd, vertexDistance) : 1.0;
|
|
return vec4(mix(inColor.rgb, fogColor.rgb, fogValue * fogColor.a), inColor.a);
|
|
}
|
|
|
|
float linear_fog_fade(float vertexDistance, float fogStart, float fogEnd) {
|
|
if (vertexDistance <= fogStart) {
|
|
return 1.0;
|
|
} else if (vertexDistance >= fogEnd) {
|
|
return 0.0;
|
|
}
|
|
|
|
return smoothstep(fogEnd, fogStart, vertexDistance);
|
|
}
|
|
|
|
float cylindrical_distance(mat4 modelViewMat, vec3 pos) {
|
|
float distXZ = length((modelViewMat * vec4(pos.x, 0.0, pos.z, 1.0)).xyz);
|
|
float distY = length((modelViewMat * vec4(0.0, pos.y, 0.0, 1.0)).xyz);
|
|
return max(distXZ, distY);
|
|
}
|