Compare commits
1 Commits
main
...
feature/go
Author | SHA1 | Date |
---|---|---|
Cat Flynn | 82ab3b2920 |
|
@ -7,21 +7,22 @@ out vec4 FragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec3 objectColor = vec3(1.0, 0.5, 0.2);
|
vec3 objectColor = vec3(1.0, 1.0, 1.0);
|
||||||
vec3 result;
|
vec3 result;
|
||||||
|
|
||||||
// Ambient lighting
|
// Ambient lighting
|
||||||
vec3 ambientLightColor = vec3(1.0, 1.0, 1.0);
|
vec3 ambientLightColor = vec3(1.0, 1.0, 1.0);
|
||||||
float ambientStrength = 0.1;
|
float ambientStrength = 0.0;
|
||||||
vec3 ambient = ambientStrength * ambientLightColor;
|
vec3 ambient = ambientStrength * ambientLightColor;
|
||||||
|
|
||||||
// Directional lighting
|
// Directional lighting
|
||||||
vec3 directionalLightColor = vec3(1.0, 1.0, 1.0);
|
vec3 dirColorHi = vec3(.39, .40, .21) * 2.0;
|
||||||
|
vec3 dirColorLo = vec3(.45, .22, .33) * 2.0;
|
||||||
vec3 lightPos = vec3(10.0, 7.0, -8.0);
|
vec3 lightPos = vec3(10.0, 7.0, -8.0);
|
||||||
vec3 normal = normalize(Normal);
|
vec3 normal = normalize(Normal);
|
||||||
vec3 lightDir = normalize(lightPos - FragPos);
|
vec3 lightDir = normalize(lightPos - FragPos);
|
||||||
float diff = max(dot(normal, lightDir), 0.0);
|
float diff = dot(normal, lightDir) * .5 + .5;
|
||||||
vec3 diffuse = diff * directionalLightColor;
|
vec3 diffuse = mix(dirColorLo, dirColorHi, diff);
|
||||||
|
|
||||||
result = (ambient + diffuse) * objectColor;
|
result = (ambient + diffuse) * objectColor;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue