daily update

This commit is contained in:
2025-12-29 09:08:40 +08:00
parent b32406225f
commit 411fc48982
130 changed files with 24830 additions and 0 deletions

View File

@@ -0,0 +1,51 @@
#version 330 core
struct Material {
sampler2D diffuse;
sampler2D specular;
sampler2D creativesam;
float shininess;
};
// 光强控制
struct Light {
vec3 position;
vec3 ambient;
vec3 diffuse;
vec3 specular;
float matrix;
};
uniform Light light;
uniform Material material;
out vec4 FragColor;
in vec3 FragPos;
in vec3 Normal;
in vec2 TexCoords;
uniform float matrixOffset;
uniform vec3 viewPos;
void main() {
// ambient
vec3 ambient = light.ambient * texture(material.diffuse, TexCoords).rgb;
// diffuse
vec3 norm = normalize(Normal);
vec3 lightDir = normalize(light.position - FragPos);
float diff = max(dot(norm, lightDir), 0.0);
vec3 diffuse = light.diffuse * diff * texture(material.diffuse, TexCoords).rgb;
// specular
vec3 viewDir = normalize(viewPos - FragPos);
vec3 reflectDir = reflect(-lightDir, norm);
float spec = pow(max(dot(viewDir, reflectDir), 0.0), material.shininess);
vec3 specular = light.specular * spec * texture(material.specular, TexCoords).rgb;
float matrixClamp = clamp(light.matrix, 0.5, 1.0);
vec3 creativesam = vec3(matrixClamp) * texture(material.creativesam, vec2(TexCoords.x, TexCoords.y + matrixOffset)).rgb;
vec3 result = ambient + diffuse + specular + creativesam;
// vec3 result = ambient + diffuse + specular;
FragColor = vec4(result, 1.0);
}

View File

@@ -0,0 +1,8 @@
#version 330 core
uniform vec3 aFragColor;
out vec4 FragColor;
void main() {
FragColor = vec4(aFragColor, 1.0);
}

View File

@@ -0,0 +1,19 @@
#version 330 core
layout(location = 0) in vec3 aPos;
layout(location = 1) in vec3 aNormal;
layout(location = 2) in vec2 aTexCoords;
out vec2 TexCoords;
out vec3 FragPos;
out vec3 Normal;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main() {
TexCoords = aTexCoords;
FragPos = vec3(model * vec4(aPos, 1.0));
Normal = mat3(transpose(inverse(model))) * aNormal;
gl_Position = projection * view * model * vec4(aPos, 1.0);
}

View File

@@ -0,0 +1,10 @@
#version 330 core
layout(location = 0) in vec3 aPos;
uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;
void main() {
gl_Position = projection * view * model * vec4(aPos, 1.0);
}