feat: pbr (#20)

* feat: add pbr texture

* feat(rendering): add normal mapping support for blocks

* fix: normal map load

* feat(scripts): add batch nearest neighbor upscale script
This commit is contained in:
zhenyan121
2026-06-20 15:03:40 +08:00
committed by GitHub
parent a8d2ddbacd
commit 5385876a8a
52 changed files with 462 additions and 65 deletions

View File

@@ -5,9 +5,11 @@ layout (location = 1) in vec2 texCoord;
layout (location = 2) in float layer;
layout (location = 3) in vec3 aNormal;
layout (location = 4) in float Roughness;
layout (location = 5) in vec3 aTangent;
out vec2 tc;
out vec3 normal;
out vec3 tangent;
out vec3 bitangent;
out vec3 vert_pos;
flat out int tex_layer;
out vec4 FragPosLightSpace;
@@ -20,6 +22,7 @@ mat4 buildTranslate(float x, float y, float z);
uniform mat4 mv_matrix;
uniform mat4 proj_matrix;
uniform mat4 model_matrix;
uniform mat4 norm_matrix;
uniform mat4 lightSpaceMatrix;
@@ -32,7 +35,9 @@ void main(void) {
tex_layer = int(layer);
roughness = Roughness;
normal = mat3(norm_matrix) * aNormal;
normal = normalize(mat3(norm_matrix) * aNormal);
tangent = normalize(mat3(model_matrix) * aTangent);
bitangent = cross(normal, tangent);
FragPosLightSpace = lightSpaceMatrix * vec4(pos, 1.0);
gl_Position = proj_matrix * viewPos;
}