Commit f91f95f0 authored by Dario Seyb's avatar Dario Seyb

enabled backface culling

parent fc153377
Pipeline #530 skipped
......@@ -19,8 +19,7 @@ vec3 position();
void main()
{
// Logarithmic Depth buffer
float Fcoef = 2.0 / log2(uFar + 1.0);
vNormal = inverse(transpose(mat3(uModelMatrix))) * normal();
vTexCoord = texCoord();
......@@ -31,6 +30,8 @@ void main()
vPosition = worldPosition.xyz;
gl_Position = uViewProjectionMatrix * worldPosition;
// Logarithmic Depth buffer
float Fcoef = 2.0 / log2(uFar + 1.0);
//gl_Position.z = log2(max(1e-6, 1.0 + gl_Position.w)) * Fcoef - 1.0;
}
......@@ -31,6 +31,10 @@ float linearizeDepth(float depth) {
return (2.0 * uNear) / (uFar + uNear - depth * (uFar - uNear)); // convert to linear values
}
float unpackDepth(float depth) {
return depth;
}
vec3 unpackWorldPosition(float depth) {
vec4 clipSpaceLocation;
clipSpaceLocation.xy = vTexCoord * 2.0 - 1.0;
......@@ -69,7 +73,7 @@ void main()
vec4 emissive = texture(uSamplerEmissive, vTexCoord);
vec3 normal = unpackNormal(texture(uSamplerNormal, vTexCoord));
float depth = texture(uSamplerDepth, vTexCoord).r;
float depth = unpackDepth(texture(uSamplerDepth, vTexCoord).r);
if(depth == 1) discard;
......
......@@ -155,6 +155,8 @@ void RendererSystem::frame(double interp, double totalTime) {
glDisable(GL_BLEND);
auto gBufferRes = m_gBufferObject->getSize();
glViewport(0, 0, gBufferRes.x, gBufferRes.y);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
auto origPos = trans->thisGlobalTransform.pos;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment