Fix occlusion rendering to work with reverse triangle winding. Fix MultipleViewports C++ example using depth test in debug geometry.

This commit is contained in:
Lasse Öörni 2014-11-17 18:04:32 +02:00
Родитель a5049d423f
Коммит 16c05ee6cf
2 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -806,6 +806,10 @@ void OcclusionBuffer::DrawTriangle2D(const Vector3* vertices)
}
}
// If culling is reversed, also reverse the middleIsRight assumption
if (cullMode_ == CULL_CW)
middleIsRight = !middleIsRight;
int topY = (int)vertices[top].y_;
int middleY = (int)vertices[middle].y_;
int bottomY = (int)vertices[bottom].y_;
@ -819,7 +823,6 @@ void OcclusionBuffer::DrawTriangle2D(const Vector3* vertices)
Edge topToBottom(gradients, vertices[top], vertices[bottom], topY);
Edge middleToBottom(gradients, vertices[middle], vertices[bottom], middleY);
// The triangle is clockwise, so if bottom > middle then middle is right
if (middleIsRight)
{
// Top half

Просмотреть файл

@ -283,5 +283,5 @@ void MultipleViewports::HandlePostRenderUpdate(StringHash eventType, VariantMap&
// If draw debug mode is enabled, draw viewport debug geometry, which will show eg. drawable bounding boxes and skeleton
// bones. Disable depth test so that we can see the effect of occlusion
if (drawDebug_)
GetSubsystem<Renderer>()->DrawDebugGeometry(true);
GetSubsystem<Renderer>()->DrawDebugGeometry(false);
}