Fix occlusion rendering to work with reverse triangle winding. Fix MultipleViewports C++ example using depth test in debug geometry.
This commit is contained in:
Родитель
a5049d423f
Коммит
16c05ee6cf
|
@ -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 topY = (int)vertices[top].y_;
|
||||||
int middleY = (int)vertices[middle].y_;
|
int middleY = (int)vertices[middle].y_;
|
||||||
int bottomY = (int)vertices[bottom].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 topToBottom(gradients, vertices[top], vertices[bottom], topY);
|
||||||
Edge middleToBottom(gradients, vertices[middle], vertices[bottom], middleY);
|
Edge middleToBottom(gradients, vertices[middle], vertices[bottom], middleY);
|
||||||
|
|
||||||
// The triangle is clockwise, so if bottom > middle then middle is right
|
|
||||||
if (middleIsRight)
|
if (middleIsRight)
|
||||||
{
|
{
|
||||||
// Top half
|
// 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
|
// 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
|
// bones. Disable depth test so that we can see the effect of occlusion
|
||||||
if (drawDebug_)
|
if (drawDebug_)
|
||||||
GetSubsystem<Renderer>()->DrawDebugGeometry(true);
|
GetSubsystem<Renderer>()->DrawDebugGeometry(false);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче