Fixed split bounding box computation

simple_math_single_header
Martin Felis 2018-06-29 22:10:49 +02:00
parent 3b327af022
commit 0fceeca4de
1 changed files with 10 additions and 8 deletions

View File

@ -794,6 +794,7 @@ void Renderer::DebugDrawShadowCascades() {
glUseProgram(mSimpleProgram.mProgramId);
// Enable wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
gVertexArray.Bind();
@ -835,15 +836,15 @@ void Renderer::DebugDrawShadowCascades() {
float yf = split_far * tan_half_hfov;
Vector4f frustum_corners[] = {
Vector4f (xn, yn, split_near, 1.0f),
Vector4f (-xn, yn, split_near, 1.0f),
Vector4f (xn, -yn, split_near, 1.0f),
Vector4f (-xn, -yn, split_near, 1.0f),
Vector4f (xn, yn, -split_near, 1.0f),
Vector4f (-xn, yn, -split_near, 1.0f),
Vector4f (xn, -yn, -split_near, 1.0f),
Vector4f (-xn, -yn, -split_near, 1.0f),
Vector4f (xf, yf, split_far, 1.0f),
Vector4f (-xf, yf, split_far, 1.0f),
Vector4f (xf, -yf, split_far, 1.0f),
Vector4f (-xf, -yf, split_far, 1.0f)
Vector4f (xf, yf, -split_far, 1.0f),
Vector4f (-xf, yf, -split_far, 1.0f),
Vector4f (xf, -yf, -split_far, 1.0f),
Vector4f (-xf, -yf, -split_far, 1.0f)
};
Vector4f frustum_corners_world[8];
@ -901,6 +902,7 @@ void Renderer::DebugDrawShadowCascades() {
// Disable wireframe
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
}
void Renderer::RenderScene(RenderProgram &program, const Camera& camera) {