28 lines
821 B
GLSL
28 lines
821 B
GLSL
#version 300 es
|
|
|
|
precision highp float;
|
|
|
|
layout (location = 0) out vec4 gPosition;
|
|
layout (location = 1) out vec4 gNormal;
|
|
layout (location = 2) out vec4 gAlbedoSpec;
|
|
|
|
in vec3 fragPosition;
|
|
in vec2 fragTexCoord;
|
|
in vec3 fragNormal;
|
|
in vec4 fragColor;
|
|
|
|
uniform vec4 colDiffuse;
|
|
|
|
uniform sampler2D texture0;
|
|
uniform sampler2D texture1;
|
|
|
|
void main() {
|
|
// store the fragment position vector in the first gbuffer texture
|
|
gPosition = vec4(fragPosition,1.0);
|
|
// also store the per-fragment normals into the gbuffer
|
|
gNormal = vec4(normalize(fragNormal),1.0);
|
|
// and the diffuse per-fragment color
|
|
gAlbedoSpec.rgb = texture(texture0, fragTexCoord).rgb * colDiffuse.rgb;
|
|
// store specular intensity in gAlbedoSpec's alpha component
|
|
gAlbedoSpec.a = pow(texture(texture1, fragTexCoord).r*1.6,16.0);
|
|
}
|