Files
loop/shader/floor/arrayPos.frag
T

23 lines
675 B
GLSL

#version 450 core
in vec4 vTexPosRot;
in vec2 vPos;
layout (location=0) out vec4 fCol;
layout (location=1) out vec4 fPos;
layout (location=2) out vec4 normal;
layout (binding=40) uniform sampler2DArray diffuseSampler;
layout (binding=41) uniform sampler2DArray normalSampler;
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()
{
vec3 vTexPos = vTexPosRot.xyz;
float rot = vTexPosRot.w;
fCol = vec4(texture(diffuseSampler,vTexPos));
fPos = vec4(vPos,0,1);
vec4 bn = vec4(texture(normalSampler,vTexPos) - 0.5);
vec3 nmap1 = vec3(rotateV2(rot,bn.xy), bn.z);
normal = vec4(-nmap1 ,0);
}