Sha256: 2376bbb91be094e03a51e295008b61d0457c52226f171898446bc09a63250b1d
Contents?: true
Size: 742 Bytes
Versions: 18
Compression:
Stored size: 742 Bytes
Contents
const float LOG2 = 1.442695; void main(inout vec4 ambient, inout vec4 diffuse, inout vec4 specular) { float fog; float error = 0.0; float distance = length(gl_FragCoord.z / gl_FragCoord.w); if (Algorithm == <%=Jax.LINEAR%>) { fog = (End - distance) * Scale; } else if (Algorithm == <%=Jax.EXPONENTIAL%>) { fog = exp(-Density * distance); } else if (Algorithm == <%=Jax.EXP2%>) { fog = exp2(-Density * Density * distance * distance * LOG2); } else { /* error condition, output red */ ambient = diffuse = specular = vec4(1,0,0,1); error = 1.0; } if (error != 1.0) { fog = clamp(fog, 0.0, 1.0); ambient = mix(FogColor, ambient, fog); diffuse = mix(FogColor, diffuse, fog); } }
Version data entries
18 entries across 18 versions & 1 rubygems