Files
loop/shader/wall/basic.frag
T
2023-03-20 15:09:43 +00:00

25 lines
667 B
GLSL

#version 450 core
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
layout (location=2) out vec4 fNorm;
in vec2 tPos;
in vec3 gTexCoords;
in vec4 gPos;
in vec4 gNorm;
in vec4 gColor;
in float gAng;
layout (binding=1) uniform sampler2DArray normalSampler;
layout (binding=2) uniform sampler2DArray diffuseSampler;
vec2 rotateV2 (float a, vec2 v)
{
return vec2(v.x*cos(a) - v.y*sin(a), v.x*sin(a) + v.y*cos(a));
}
void main()
{
fCol = texture(diffuseSampler,gTexCoords);
fPos = gPos;
vec4 basenorm = texture(normalSampler,gTexCoords) - 0.5;
vec2 n1 = rotateV2(gAng,vec2(basenorm.x,basenorm.z));
fNorm = vec4(-vec3(n1,basenorm.y),0);
}