Make fogColor in the fog tutorial a parameter (#5672)

* uniform fogColor

fogColor is now a parameter

* use new fog color parameter

* convert ambient to Vector4
This commit is contained in:
devel
2026-03-19 18:17:27 -04:00
committed by GitHub
parent da9e881092
commit 7fef65a3fe
2 changed files with 7 additions and 5 deletions

View File

@ -37,6 +37,7 @@ struct Light {
uniform Light lights[MAX_LIGHTS];
uniform vec4 ambient;
uniform vec3 viewPos;
uniform vec4 fogColor;
uniform float fogDensity;
void main()
@ -77,10 +78,6 @@ void main()
// Fog calculation
float dist = length(viewPos - fragPosition);
// these could be parameters...
const vec4 fogColor = vec4(0.5, 0.5, 0.5, 1.0);
//const float fogDensity = 0.16;
// Exponential fog
float fogFactor = 1.0/exp((dist*fogDensity)*(dist*fogDensity));