24 lines
510 B
GLSL
24 lines
510 B
GLSL
#version 330 core
|
|
layout(location = 0) in vec3 aPos;
|
|
layout(location = 1) in vec3 aNormal;
|
|
layout(location = 2) in vec2 aTexCoord;
|
|
|
|
out vec2 TexCoord;
|
|
out vec3 FragPos;
|
|
out vec3 Normal;
|
|
out vec2 TexCoords;
|
|
|
|
uniform mat4 trans;
|
|
uniform mat4 view;
|
|
uniform mat4 projection;
|
|
|
|
void main() {
|
|
// 计算角度
|
|
FragPos = vec3(trans * vec4(aPos, 1.0));
|
|
// 计算法向量
|
|
Normal = mat3(transpose(inverse(trans))) * aNormal;
|
|
|
|
gl_Position = projection * view * trans * vec4(aPos, 1.0);
|
|
TexCoord = aTexCoord;
|
|
}
|