27 lines
783 B
GLSL
27 lines
783 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 gRot;
|
|
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 = gColor * texture(tex,tPos);
|
|
fCol = texture(diffuseSampler,gTexCoords);
|
|
fPos = gPos;
|
|
vec4 basenorm = texture(normalSampler,gTexCoords) - 0.5;
|
|
//fNorm = fPos - vec4(rotateV2(gRot,basenorm.xz), basenorm.y,0);
|
|
vec2 n = rotateV2(gRot,vec2(-basenorm.x,-basenorm.z));
|
|
fNorm = vec4(fPos.xyz - vec3(n,basenorm.y),0);
|
|
}
|