mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +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);
|
||||
}
|
||||
}
|
||||
21
assets/shaders/basic.vert
Normal file
21
assets/shaders/basic.vert
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#version 330 core
|
||||
|
||||
layout (location = 0) in vec3 aPosition;
|
||||
layout (location = 1) in vec3 aNormal;
|
||||
layout (location = 2) in vec2 aTexCoord;
|
||||
|
||||
out vec3 FragPos;
|
||||
out vec3 Normal;
|
||||
out vec2 TexCoord;
|
||||
|
||||
uniform mat4 uModel;
|
||||
uniform mat4 uView;
|
||||
uniform mat4 uProjection;
|
||||
|
||||
void main() {
|
||||
FragPos = vec3(uModel * vec4(aPosition, 1.0));
|
||||
Normal = mat3(transpose(inverse(uModel))) * aNormal;
|
||||
TexCoord = aTexCoord;
|
||||
|
||||
gl_Position = uProjection * uView * vec4(FragPos, 1.0);
|
||||
}
|
||||
93
assets/shaders/terrain.frag
Normal file
93
assets/shaders/terrain.frag
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
#version 330 core
|
||||
|
||||
in vec3 FragPos;
|
||||
in vec3 Normal;
|
||||
in vec2 TexCoord;
|
||||
in vec2 LayerUV;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
// Texture layers (up to 4)
|
||||
uniform sampler2D uBaseTexture;
|
||||
uniform sampler2D uLayer1Texture;
|
||||
uniform sampler2D uLayer2Texture;
|
||||
uniform sampler2D uLayer3Texture;
|
||||
|
||||
// Alpha maps for blending
|
||||
uniform sampler2D uLayer1Alpha;
|
||||
uniform sampler2D uLayer2Alpha;
|
||||
uniform sampler2D uLayer3Alpha;
|
||||
|
||||
// Layer control
|
||||
uniform int uLayerCount;
|
||||
uniform bool uHasLayer1;
|
||||
uniform bool uHasLayer2;
|
||||
uniform bool uHasLayer3;
|
||||
|
||||
// Lighting
|
||||
uniform vec3 uLightDir;
|
||||
uniform vec3 uLightColor;
|
||||
uniform vec3 uAmbientColor;
|
||||
|
||||
// Camera
|
||||
uniform vec3 uViewPos;
|
||||
|
||||
// Fog
|
||||
uniform vec3 uFogColor;
|
||||
uniform float uFogStart;
|
||||
uniform float uFogEnd;
|
||||
|
||||
void main() {
|
||||
// Sample base texture
|
||||
vec4 baseColor = texture(uBaseTexture, TexCoord);
|
||||
vec4 finalColor = baseColor;
|
||||
|
||||
// Apply texture layers with alpha blending
|
||||
// TexCoord = tiling UVs for texture sampling (repeats across chunk)
|
||||
// LayerUV = 0-1 per-chunk UVs for alpha map sampling
|
||||
if (uHasLayer1) {
|
||||
vec4 layer1Color = texture(uLayer1Texture, TexCoord);
|
||||
float alpha1 = texture(uLayer1Alpha, LayerUV).r;
|
||||
finalColor = mix(finalColor, layer1Color, alpha1);
|
||||
}
|
||||
|
||||
if (uHasLayer2) {
|
||||
vec4 layer2Color = texture(uLayer2Texture, TexCoord);
|
||||
float alpha2 = texture(uLayer2Alpha, LayerUV).r;
|
||||
finalColor = mix(finalColor, layer2Color, alpha2);
|
||||
}
|
||||
|
||||
if (uHasLayer3) {
|
||||
vec4 layer3Color = texture(uLayer3Texture, TexCoord);
|
||||
float alpha3 = texture(uLayer3Alpha, LayerUV).r;
|
||||
finalColor = mix(finalColor, layer3Color, alpha3);
|
||||
}
|
||||
|
||||
// Normalize normal
|
||||
vec3 norm = normalize(Normal);
|
||||
vec3 lightDir = normalize(-uLightDir);
|
||||
|
||||
// Ambient lighting
|
||||
vec3 ambient = uAmbientColor * finalColor.rgb;
|
||||
|
||||
// Diffuse lighting (two-sided for terrain hills)
|
||||
float diff = abs(dot(norm, lightDir));
|
||||
diff = max(diff, 0.2); // Minimum light to prevent completely dark faces
|
||||
vec3 diffuse = diff * uLightColor * finalColor.rgb;
|
||||
|
||||
// Specular lighting (subtle for terrain)
|
||||
vec3 viewDir = normalize(uViewPos - FragPos);
|
||||
vec3 halfwayDir = normalize(lightDir + viewDir);
|
||||
float spec = pow(max(dot(norm, halfwayDir), 0.0), 32.0);
|
||||
vec3 specular = spec * uLightColor * 0.1;
|
||||
|
||||
// Combine lighting
|
||||
vec3 result = ambient + diffuse + specular;
|
||||
|
||||
// Apply fog
|
||||
float distance = length(uViewPos - FragPos);
|
||||
float fogFactor = clamp((uFogEnd - distance) / (uFogEnd - uFogStart), 0.0, 1.0);
|
||||
result = mix(uFogColor, result, fogFactor);
|
||||
|
||||
FragColor = vec4(result, 1.0);
|
||||
}
|
||||
28
assets/shaders/terrain.vert
Normal file
28
assets/shaders/terrain.vert
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#version 330 core
|
||||
|
||||
layout(location = 0) in vec3 aPosition;
|
||||
layout(location = 1) in vec3 aNormal;
|
||||
layout(location = 2) in vec2 aTexCoord;
|
||||
layout(location = 3) in vec2 aLayerUV;
|
||||
|
||||
out vec3 FragPos;
|
||||
out vec3 Normal;
|
||||
out vec2 TexCoord;
|
||||
out vec2 LayerUV;
|
||||
|
||||
uniform mat4 uModel;
|
||||
uniform mat4 uView;
|
||||
uniform mat4 uProjection;
|
||||
|
||||
void main() {
|
||||
vec4 worldPos = uModel * vec4(aPosition, 1.0);
|
||||
FragPos = worldPos.xyz;
|
||||
|
||||
// Transform normal to world space
|
||||
Normal = mat3(transpose(inverse(uModel))) * aNormal;
|
||||
|
||||
TexCoord = aTexCoord;
|
||||
LayerUV = aLayerUV;
|
||||
|
||||
gl_Position = uProjection * uView * worldPos;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue