wtf
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
{ "label": "Stress Test", "action": "stress" },
|
||||
{ "label": "Spinning Monkey", "action": "monkey" },
|
||||
{ "label": "Monkey Grid", "action": "monkeygrid" },
|
||||
{ "label": "God Sandbox", "action": "god" },
|
||||
{ "label": "Grass / Pools", "action": "grass" },
|
||||
{ "label": "Sunset Forest", "action": "sunset" },
|
||||
{ "label": "Level Editor", "action": "edit" },
|
||||
{ "label": "Quit", "action": "quit" }
|
||||
]
|
||||
|
||||
@@ -5,32 +5,24 @@ in vec3 Color;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec3 uLightPos;
|
||||
uniform vec3 uSunDir;
|
||||
uniform vec3 uSunColor;
|
||||
uniform vec3 uSkyColor;
|
||||
uniform vec3 uGroundColor;
|
||||
uniform vec3 uViewPos;
|
||||
uniform vec3 uLightColor;
|
||||
uniform float uAmbientStrength;
|
||||
uniform float uSpecularStrength;
|
||||
uniform float uShininess;
|
||||
|
||||
void main() {
|
||||
// Normalize the normal vector
|
||||
vec3 norm = normalize(Normal);
|
||||
|
||||
// Ambient lighting
|
||||
vec3 ambient = uAmbientStrength * uLightColor;
|
||||
|
||||
// Diffuse lighting
|
||||
vec3 lightDir = normalize(uLightPos - FragPos);
|
||||
float diff = max(dot(norm, lightDir), 0.0);
|
||||
vec3 diffuse = diff * uLightColor;
|
||||
|
||||
// Specular lighting
|
||||
vec3 viewDir = normalize(uViewPos - FragPos);
|
||||
vec3 reflectDir = reflect(-lightDir, norm);
|
||||
float spec = pow(max(dot(viewDir, reflectDir), 0.0), uShininess);
|
||||
vec3 specular = uSpecularStrength * spec * uLightColor;
|
||||
|
||||
// Combine results
|
||||
vec3 result = (ambient + diffuse + specular) * Color;
|
||||
vec3 N = normalize(Normal);
|
||||
float up = 0.5 + 0.5 * N.y;
|
||||
vec3 ambient = mix(uGroundColor, uSkyColor, up);
|
||||
float NdotL = max(dot(N, uSunDir), 0.0);
|
||||
vec3 diffuse = NdotL * uSunColor;
|
||||
vec3 V = normalize(uViewPos - FragPos);
|
||||
vec3 H = normalize(uSunDir + V);
|
||||
float spec = pow(max(dot(N, H), 0.0), uShininess) * (NdotL > 0.0 ? 1.0 : 0.0);
|
||||
vec3 specular = uSpecularStrength * spec * uSunColor;
|
||||
vec3 result = (ambient + diffuse) * Color + specular;
|
||||
FragColor = vec4(result, 1.0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user