mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Initial commit: wowee native WoW 3.3.5a client
This commit is contained in:
commit
ce6cb8f38e
147 changed files with 32347 additions and 0 deletions
38
assets/shaders/basic.frag
Normal file
38
assets/shaders/basic.frag
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#version 330 core
|
||||
|
||||
in vec3 FragPos;
|
||||
in vec3 Normal;
|
||||
in vec2 TexCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
uniform vec3 uLightPos;
|
||||
uniform vec3 uViewPos;
|
||||
uniform vec4 uColor;
|
||||
uniform sampler2D uTexture;
|
||||
uniform bool uUseTexture;
|
||||
|
||||
void main() {
|
||||
// Ambient
|
||||
vec3 ambient = 0.3 * vec3(1.0);
|
||||
|
||||
// Diffuse
|
||||
vec3 norm = normalize(Normal);
|
||||
vec3 lightDir = normalize(uLightPos - FragPos);
|
||||
float diff = max(dot(norm, lightDir), 0.0);
|
||||
vec3 diffuse = diff * vec3(1.0);
|
||||
|
||||
// Specular
|
||||
vec3 viewDir = normalize(uViewPos - FragPos);
|
||||
vec3 reflectDir = reflect(-lightDir, norm);
|
||||
float spec = pow(max(dot(viewDir, reflectDir), 0.0), 32.0);
|
||||
vec3 specular = 0.5 * spec * vec3(1.0);
|
||||
|
||||
vec3 result = (ambient + diffuse + specular);
|
||||
|
||||
if (uUseTexture) {
|
||||
FragColor = texture(uTexture, TexCoord) * vec4(result, 1.0);
|
||||
} else {
|
||||
FragColor = uColor * vec4(result, 1.0);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue