This commit is contained in:
2026-10-26 01:59:48 -04:00
commit a6103e453d
1020 changed files with 255623 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
#version 330 core
in vec2 TexCoords;
out vec4 color;
uniform sampler2D text;
uniform vec4 textColor;
void main()
{
vec4 sampled = vec4(1.0, 1.0, 1.0, texture(text, TexCoords).r);
color = textColor * sampled;
}
+14
View File
@@ -0,0 +1,14 @@
#version 330 core
layout (location = 0) in vec4 vertex; // <vec2 pos, vec2 tex>
out vec2 TexCoords;
uniform vec2 screenSize;
void main()
{
vec2 ndc = (vertex.xy / screenSize) * 2.0 - 1.0;
ndc.y = -ndc.y;
gl_Position = vec4(ndc, 0.0, 1.0);
TexCoords = vertex.zw;
}
+36
View File
@@ -0,0 +1,36 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform float rounding = 0.0f;
uniform vec2 screenSize;
uniform vec2 normalizedCenterPos;
uniform vec2 normalizedCenterScale;
uniform vec2 pixelScale;
uniform vec2 pixelPos;
uniform vec4 Color = {0.0f,0.0f,0.0f,1.0f};
uniform vec4 BackgroundColor = {0.0f,0.0f,0.0f,1.0f};
void main()
{
FragColor = Color;
float rounding = clamp(rounding,0.0f,1.0f);
if (rounding != 0.0f) {
float roundingfactor = min(pixelScale.x,pixelScale.y)/2 * rounding;
vec2 r1 = pixelScale/2 - vec2(roundingfactor);
vec2 fragPosTopLeft = vec2(gl_FragCoord.x, screenSize.y - gl_FragCoord.y);
vec2 absrelcoord = abs(fragPosTopLeft - pixelScale/2 - pixelPos);
if (!(absrelcoord.x < r1.x || absrelcoord.y < r1.y)) {
if (pow(absrelcoord.y-r1.y,2) > pow(roundingfactor,2) - pow((absrelcoord.x-r1.x),2)) {
discard;
}
}
}
}
+24
View File
@@ -0,0 +1,24 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
uniform vec2 screenSize;
uniform vec2 pixelPos;
uniform vec2 pixelScale;
uniform float z;
uniform float rotation;
void main()
{
vec2 unitPos = aPos * 0.5 + 0.5;
vec2 pixelPosTopLeft = pixelPos + unitPos * pixelScale;
vec2 ndc = (pixelPosTopLeft / screenSize) * 2.0 - 1.0;
ndc.y = -ndc.y;
gl_Position = vec4(ndc, 0.0f, 1.0f);
TexCoords = aTexCoords;
}
+9
View File
@@ -0,0 +1,9 @@
#version 330 core
out vec4 FragColor;
uniform vec3 hitboxColor;
void main()
{
FragColor = vec4(hitboxColor, 1.0);
}
+11
View File
@@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec3 aPos;
uniform mat4 modl;
uniform mat4 view;
uniform mat4 proj;
void main()
{
gl_Position = proj * view * modl * vec4(aPos, 1.0);
}
+38
View File
@@ -0,0 +1,38 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform float rounding = 0.0f;
uniform vec2 screenSize;
uniform vec2 normalizedCenterPos;
uniform vec2 normalizedCenterScale;
uniform vec2 pixelScale;
uniform vec2 pixelPos;
uniform vec4 Color = {0.0f,0.0f,0.0f,1.0f};
uniform vec4 BackgroundColor = {0.0f,0.0f,0.0f,1.0f};
uniform sampler2D tex;
void main()
{
FragColor = Color * texture(tex,TexCoords);
float rounding = clamp(rounding,0.0f,1.0f);
if (rounding != 0.0f) {
float roundingfactor = min(pixelScale.x,pixelScale.y)/2 * rounding;
vec2 r1 = pixelScale/2 - vec2(roundingfactor);
vec2 fragPosTopLeft = vec2(gl_FragCoord.x, screenSize.y - gl_FragCoord.y);
vec2 absrelcoord = abs(fragPosTopLeft - pixelScale/2 - pixelPos);
if (!(absrelcoord.x < r1.x || absrelcoord.y < r1.y)) {
if (pow(absrelcoord.y-r1.y,2) > pow(roundingfactor,2) - pow((absrelcoord.x-r1.x),2)) {
discard;
}
}
}
}
+24
View File
@@ -0,0 +1,24 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
uniform vec2 screenSize;
uniform vec2 pixelPos;
uniform vec2 pixelScale;
uniform float z;
uniform float rotation;
void main()
{
vec2 unitPos = aPos * 0.5 + 0.5;
vec2 pixelPosTopLeft = pixelPos + unitPos * pixelScale;
vec2 ndc = (pixelPosTopLeft / screenSize) * 2.0 - 1.0;
ndc.y = -ndc.y;
gl_Position = vec4(ndc, 0.0f, 1.0f);
TexCoords = aTexCoords;
}
+18
View File
@@ -0,0 +1,18 @@
#version 330 core
out vec4 FragColor;
in vec3 normal;
in vec2 texCoord;
in vec3 FragPos;
uniform sampler2D tex;
uniform vec4 color;
void main()
{
vec4 base = texture(tex,texCoord) * color;
if (base.w == 0.0f) {
discard;
}
FragColor = base;
}
+22
View File
@@ -0,0 +1,22 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTex;
layout(location = 3) in mat4 modl;
out vec3 normal;
out vec2 texCoord;
out vec3 FragPos;
uniform mat4 view;
uniform mat4 proj;
void main()
{
FragPos = vec3(modl * vec4(aPos, 1.0));
normal = aNormal;
texCoord = aTex;
gl_Position = proj* view * modl * vec4(aPos,1.0f);
}
+41
View File
@@ -0,0 +1,41 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoords;
uniform sampler2D screenTexture;
uniform float brightness = 0.0f;
uniform float colorContrast = 0.0f;
uniform float saturation = 1.0f;
uniform float exposure = 1.0f;
vec3 ACESFilm(vec3 x)
{
const float a = 2.51;
const float b = 0.03;
const float c = 2.43;
const float d = 0.59;
const float e = 0.14;
return clamp((x * (a * x + b)) / (x * (c * x + d) + e), 0.0, 1.0);
}
void main()
{
vec3 originalcolor = texture(screenTexture, TexCoords).rgb;
vec3 finalcolor = ACESFilm(originalcolor * exposure);
const float gamma = 2.2;
finalcolor = pow(finalcolor, vec3(1.0 / gamma));
vec3 contrast = vec3(1.0f) - finalcolor;
finalcolor = mix(finalcolor,vec3(1.0f) - finalcolor,colorContrast);
float average = (finalcolor[0]+finalcolor[1]+finalcolor[2])/3.0f;
for (int i = 0; i < 3; i++) {
finalcolor[i] = average + saturation * (finalcolor[i] - average);
}
FragColor = vec4(finalcolor,1.0f);
}
+11
View File
@@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoords;
out vec2 TexCoords;
void main()
{
gl_Position = vec4(aPos.x, aPos.y, 0.0, 1.0);
TexCoords = aTexCoords;
}
+140
View File
@@ -0,0 +1,140 @@
#version 330 core
out vec4 FragColor;
in vec3 normal;
in vec2 texCoord;
in vec3 FragPos;
in vec4 fragposlightspace;
struct DirLight {
vec3 direction;
vec3 color;
float intensity;
};
uniform DirLight dirLight;
uniform vec3 viewPos;
uniform sampler2DShadow shadowMap;
uniform sampler2D tex;
uniform samplerCube environmentMap;
uniform vec4 colorOverride = vec4(0.0);
uniform int useTexture = 0;
uniform float metallic = 0.0;
uniform float roughness = 0.7;
uniform float ao = 1.0;
uniform float envIntensity = 0.8;
const float PI = 3.14159265359;
float DistributionGGX(vec3 N, vec3 H, float rough)
{
float a = rough * rough;
float a2 = a * a;
float NdotH = max(dot(N, H), 0.0);
float NdotH2 = NdotH * NdotH;
float denom = NdotH2 * (a2 - 1.0) + 1.0;
return a2 / max(PI * denom * denom, 1e-5);
}
float GeometrySchlickGGX(float NdotV, float rough)
{
float r = rough + 1.0;
float k = (r * r) / 8.0;
return NdotV / (NdotV * (1.0 - k) + k);
}
float GeometrySmith(vec3 N, vec3 V, vec3 L, float rough)
{
float NdotV = max(dot(N, V), 0.0);
float NdotL = max(dot(N, L), 0.0);
return GeometrySchlickGGX(NdotV, rough) * GeometrySchlickGGX(NdotL, rough);
}
vec3 FresnelSchlick(float cosTheta, vec3 F0)
{
return F0 + (1.0 - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
}
vec3 FresnelSchlickRoughness(float cosTheta, vec3 F0, float rough)
{
vec3 f = max(vec3(1.0 - rough), F0);
return F0 + (f - F0) * pow(clamp(1.0 - cosTheta, 0.0, 1.0), 5.0);
}
vec3 EnvironmentBRDF(vec3 F0, float rough, float NdotV)
{
const vec4 c0 = vec4(-1.0, -0.0275, -0.572, 0.022);
const vec4 c1 = vec4(1.0, 0.0425, 1.04, -0.04);
vec4 r = rough * c0 + c1;
float a004 = min(r.x * r.x, exp2(-9.28 * NdotV)) * r.x + r.y;
vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;
return F0 * AB.x + AB.y;
}
float ShadowCalculation(vec4 fragPosLightSpace, vec3 N, vec3 L)
{
vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;
projCoords = projCoords * 0.5 + 0.5;
if (projCoords.z > 1.0 || any(lessThan(projCoords, vec3(0.0))) ||
any(greaterThan(projCoords, vec3(1.0))))
return 1.0;
float bias = max(0.004 * (1.0 - dot(N, L)), 0.001);
vec2 texelSize = 1.0 / vec2(textureSize(shadowMap, 0));
float shadow = 0.0;
for (int x = -1; x <= 1; x++) {
for (int y = -1; y <= 1; y++) {
vec2 offset = vec2(x, y) * texelSize;
shadow += texture(shadowMap, vec3(projCoords.xy + offset, projCoords.z - bias));
}
}
return shadow / 9.0;
}
void main()
{
vec4 albedoSample = vec4(0.8, 0.8, 0.8, 1.0);
if (useTexture != 0) {
albedoSample = texture(tex, texCoord);
if (albedoSample.a < 0.1)
discard;
albedoSample.rgb = pow(albedoSample.rgb, vec3(2.2));
}
albedoSample.rgb = mix(albedoSample.rgb, colorOverride.rgb, colorOverride.w);
vec3 albedo = albedoSample.rgb;
float metal = clamp(metallic, 0.0, 1.0);
float rough = clamp(roughness, 0.04, 1.0);
vec3 N = normalize(normal);
vec3 V = normalize(viewPos - FragPos);
vec3 L = normalize(-dirLight.direction);
vec3 H = normalize(V + L);
float NdotV = max(dot(N, V), 1e-4);
float NdotL = max(dot(N, L), 0.0);
vec3 F0 = mix(vec3(0.04), albedo, metal);
vec3 F = FresnelSchlick(max(dot(H, V), 0.0), F0);
float NDF = DistributionGGX(N, H, rough);
float G = GeometrySmith(N, V, L, rough);
vec3 specular = (NDF * G * F) / max(4.0 * NdotV * NdotL, 1e-4);
vec3 kD = (vec3(1.0) - F) * (1.0 - metal);
vec3 radiance = dirLight.color * dirLight.intensity;
float shadow = ShadowCalculation(fragposlightspace, N, L);
vec3 direct = (kD * albedo / PI + specular) * radiance * NdotL * shadow;
vec3 ambientF = FresnelSchlickRoughness(NdotV, F0, rough);
vec3 ambientKD = (vec3(1.0) - ambientF) * (1.0 - metal);
vec3 irradiance = pow(textureLod(environmentMap, N, 7.0).rgb, vec3(2.2)) * envIntensity;
vec3 R = reflect(-V, N);
vec3 prefiltered = pow(textureLod(environmentMap, R, rough * 7.0).rgb, vec3(2.2)) * envIntensity;
vec3 specularIBL = prefiltered * EnvironmentBRDF(F0, rough, NdotV);
vec3 ambient = (ambientKD * irradiance * albedo + specularIBL) * ao;
FragColor = vec4(direct + ambient, albedoSample.a);
}
+23
View File
@@ -0,0 +1,23 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTex;
out vec3 normal;
out vec2 texCoord;
out vec3 FragPos;
out vec4 fragposlightspace;
uniform mat4 modl;
uniform mat4 view;
uniform mat4 proj;
uniform mat4 lightSpaceMatrix;
void main()
{
FragPos = vec3(modl * vec4(aPos, 1.0));
normal = transpose(inverse(mat3(modl))) * aNormal;
texCoord = aTex;
fragposlightspace = lightSpaceMatrix * vec4(FragPos, 1.0);
gl_Position = proj* view * modl * vec4(aPos,1.0f);
}
+61
View File
@@ -0,0 +1,61 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoord;
uniform sampler2D gPosition;
uniform sampler2D gNormal;
uniform sampler2D gAlbedo;
uniform sampler2D gLightSpacePos;
uniform sampler2DShadow shadowMap;
struct DirLight {
vec3 direction;
vec3 ambient;
vec3 diffuse;
vec3 specular;
};
uniform DirLight dirLight;
uniform vec3 viewPos;
float ShadowCalculation(vec4 fragPosLightSpace)
{
vec3 projCoords = fragPosLightSpace.xyz / fragPosLightSpace.w;
projCoords = projCoords * 0.5 + 0.5;
if (projCoords.z > 1.0) return 0.0;
return texture(shadowMap, vec3(projCoords.xy, projCoords.z));
}
vec3 CalcDirLight(DirLight light, vec3 normal, vec3 viewDir, vec4 fragPosLS, vec3 albedo)
{
vec3 lightDir = normalize(-light.direction);
float diff = max(dot(normal, lightDir), 0.0);
vec3 halfwayDir = normalize(lightDir + viewDir);
float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);
vec3 ambient = light.ambient * albedo;
vec3 diffuse = light.diffuse * diff * albedo;
vec3 specular = light.specular * spec;
float shadow = ShadowCalculation(fragPosLS);
return ambient + (diffuse + specular) * shadow;
}
void main()
{
vec3 fragPos = texture(gPosition, TexCoord).rgb;
vec3 normal = normalize(texture(gNormal, TexCoord).rgb);
vec4 albedaSample = texture(gAlbedo, TexCoord);
vec4 fragPosLS = texture(gLightSpacePos, TexCoord);
// Sky (no geometry written) — output clear color
if (length(normal) < 0.1) {
FragColor = vec4(0.0, 0.0, 0.0, 0.0);
return;
}
vec3 viewDir = normalize(viewPos - fragPos);
vec3 lit = CalcDirLight(dirLight, normal, viewDir, fragPosLS, albedaSample.rgb);
FragColor = vec4(lit, albedaSample.a);
}
+11
View File
@@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoord;
out vec2 TexCoord;
void main()
{
TexCoord = aTexCoord;
gl_Position = vec4(aPos, 0.0, 1.0);
}
+41
View File
@@ -0,0 +1,41 @@
#version 330 core
out vec4 FragColor;
in vec2 TexCoord;
uniform sampler2D gPosition;
uniform sampler2D gNormal;
uniform sampler2D gAlbedo;
uniform sampler2D gLightSpacePos;
uniform sampler2DShadow shadowMap;
uniform sampler2D depthTex;
uniform int debugMode; // 0 = final, 1 = position, 2 = normal, 3 = albedo, 4 = lightspace, 5 = depth
void main()
{
if (debugMode == 1) {
vec3 v = texture(gPosition, TexCoord).rgb;
FragColor = vec4(v * 0.01 + 0.5, 1.0);
return;
}
if (debugMode == 2) {
vec3 n = normalize(texture(gNormal, TexCoord).rgb);
FragColor = vec4(n * 0.5 + 0.5, 1.0);
return;
}
if (debugMode == 3) {
FragColor = texture(gAlbedo, TexCoord);
return;
}
if (debugMode == 4) {
FragColor = texture(gLightSpacePos, TexCoord);
return;
}
if (debugMode == 5) {
float d = texture(depthTex, TexCoord).r;
FragColor = vec4(vec3(d), 1.0);
return;
}
FragColor = vec4(0.0);
}
+11
View File
@@ -0,0 +1,11 @@
#version 330 core
layout (location = 0) in vec2 aPos;
layout (location = 1) in vec2 aTexCoord;
out vec2 TexCoord;
void main()
{
TexCoord = aTexCoord;
gl_Position = vec4(aPos, 0.0, 1.0);
}
+23
View File
@@ -0,0 +1,23 @@
#version 330 core
layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedo;
layout (location = 3) out vec4 gLightSpacePos;
in vec3 FragPos;
in vec3 Normal;
in vec2 TexCoord;
in vec4 FragPosLightSpace;
uniform sampler2D tex;
void main()
{
vec4 albedo = texture(tex, TexCoord);
if (albedo.a < 0.1) discard;
gPosition = FragPos;
gNormal = normalize(Normal);
gAlbedo = albedo;
gLightSpacePos = FragPosLightSpace;
}
+24
View File
@@ -0,0 +1,24 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoord;
out vec3 FragPos;
out vec3 Normal;
out vec2 TexCoord;
out vec4 FragPosLightSpace;
uniform mat4 proj;
uniform mat4 view;
uniform mat4 modl;
uniform mat4 lightSpaceMatrix;
void main()
{
vec4 worldPos = modl * vec4(aPos, 1.0);
FragPos = worldPos.xyz;
Normal = normalize(mat3(transpose(inverse(modl))) * aNormal);
TexCoord = aTexCoord;
FragPosLightSpace = lightSpaceMatrix * worldPos;
gl_Position = proj * view * worldPos;
}
+34
View File
@@ -0,0 +1,34 @@
#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoord;
layout (location = 3) in ivec4 boneIds;
layout (location = 4) in vec4 weights;
out vec3 FragPos;
out vec3 Normal;
out vec2 TexCoord;
out vec4 FragPosLightSpace;
uniform mat4 proj;
uniform mat4 view;
uniform mat4 modl;
uniform mat4 lightSpaceMatrix;
uniform mat4 finalBonesMatrices[100];
void main()
{
mat4 boneTransform = finalBonesMatrices[boneIds[0]] * weights[0];
boneTransform += finalBonesMatrices[boneIds[1]] * weights[1];
boneTransform += finalBonesMatrices[boneIds[2]] * weights[2];
boneTransform += finalBonesMatrices[boneIds[3]] * weights[3];
vec4 localPos = boneTransform * vec4(aPos, 1.0);
vec4 worldPos = modl * localPos;
FragPos = worldPos.xyz;
Normal = normalize(mat3(transpose(inverse(modl * boneTransform))) * aNormal);
TexCoord = aTexCoord;
FragPosLightSpace = lightSpaceMatrix * worldPos;
gl_Position = proj * view * worldPos;
}
+10
View File
@@ -0,0 +1,10 @@
#version 330 core
layout (location = 0) in vec3 aPos;
uniform mat4 lightSpaceMatrix;
uniform mat4 modl;
void main()
{
gl_Position = lightSpaceMatrix * modl * vec4(aPos, 1.0);
}
+48
View File
@@ -0,0 +1,48 @@
#version 430 core
layout(location = 0) in vec3 pos;
layout(location = 1) in vec3 norm;
layout(location = 2) in vec2 tex;
layout(location = 3) in ivec4 boneIds;
layout(location = 4) in vec4 weights;
uniform mat4 proj;
uniform mat4 view;
uniform mat4 modl;
uniform mat4 lightSpaceMatrix;
const int MAX_BONES = 100;
const int MAX_BONE_INFLUENCE = 4;
uniform mat4 finalBonesMatrices[MAX_BONES];
out vec3 normal;
out vec2 texCoord;
out vec3 FragPos;
out vec4 fragposlightspace;
void main()
{
vec4 totalPosition = vec4(0.0);
vec3 totalNormal = vec3(0.0);
int bonescontributed = 0;
for(int i = 0; i < MAX_BONE_INFLUENCE; i++)
{
if(boneIds[i] == -1) continue;
if(boneIds[i] >= MAX_BONES)
{
totalPosition = vec4(pos, 1.0);
totalNormal = norm;
break;
}
bonescontributed ++;
totalPosition += (finalBonesMatrices[boneIds[i]] * vec4(pos, 1.0))* weights[i];
totalNormal += mat3(finalBonesMatrices[boneIds[i]]) * norm * weights[i];
}
FragPos = vec3(modl * totalPosition);
fragposlightspace = lightSpaceMatrix * vec4(FragPos, 1.0);
gl_Position = proj * view * modl * totalPosition;
normal = normalize(mat3(transpose(inverse(modl))) * totalNormal);
texCoord = tex;
}
+27
View File
@@ -0,0 +1,27 @@
#version 430 core
layout(location = 0) in vec3 pos;
layout(location = 3) in ivec4 boneIds;
layout(location = 4) in vec4 weights;
uniform mat4 modl;
uniform mat4 lightSpaceMatrix;
const int MAX_BONES = 100;
const int MAX_BONE_INFLUENCE = 4;
uniform mat4 finalBonesMatrices[MAX_BONES];
void main()
{
vec4 totalPosition = vec4(0.0);
for (int i = 0; i < MAX_BONE_INFLUENCE; i++)
{
if (boneIds[i] == -1) continue;
if (boneIds[i] >= MAX_BONES)
{
totalPosition = vec4(pos, 1.0);
break;
}
totalPosition += finalBonesMatrices[boneIds[i]] * vec4(pos, 1.0) * weights[i];
}
gl_Position = lightSpaceMatrix * modl * totalPosition;
}
+6
View File
@@ -0,0 +1,6 @@
#version 330 core
void main()
{
//gl_FragDepth = gl_FragCoord.z;
}
+12
View File
@@ -0,0 +1,12 @@
#version 330 core
out vec4 FragColor;
in vec3 TexCoords;
uniform samplerCube skybox;
void main()
{
float gamma = 2.2;
FragColor = vec4(pow(texture(skybox, TexCoords).rgb, vec3(gamma)),1.0f);
}
+15
View File
@@ -0,0 +1,15 @@
#version 330 core
layout (location = 0) in vec3 aPos;
out vec3 TexCoords;
uniform mat4 proj;
uniform mat4 view;
void main()
{
TexCoords = aPos;
vec4 pos = proj * view * vec4(aPos, 1.0);
//gl_Position = pos.xyww
gl_Position = pos;
}