Fix incorrect culling when drawing actors depth only
This commit is contained in:
@@ -1265,7 +1265,7 @@ void AnimatedModel::Draw(RenderContextBatch& renderContextBatch)
|
||||
auto drawState = renderContext.Buffers->GetGeometryDrawState(&GetScene()->Rendering, _sceneRenderingKey, this);
|
||||
SkinnedMesh::DrawInfo draw;
|
||||
draw.DrawModes = DrawModes;
|
||||
if (drawState && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
if (drawState && EnumHasAllFlags(renderContext.View.Flags, ViewFlags::OcclusionCulling) && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
{
|
||||
// Draw shadows-only (or cull)
|
||||
draw.DrawModes &= DrawPass::Depth;
|
||||
|
||||
@@ -398,7 +398,7 @@ void SplineModel::Draw(RenderContextBatch& renderContextBatch)
|
||||
auto drawState = renderContext.Buffers->GetGeometryDrawState(&GetScene()->Rendering, _sceneRenderingKey, this);
|
||||
ACTOR_GET_WORLD_MATRIX(this, view, world);
|
||||
DrawPass drawModes = DrawModes;
|
||||
if (drawState && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
if (drawState && EnumHasAllFlags(renderContext.View.Flags, ViewFlags::OcclusionCulling) && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
{
|
||||
// Draw shadows-only (or cull)
|
||||
drawModes &= DrawPass::Depth;
|
||||
|
||||
@@ -389,7 +389,7 @@ void StaticModel::Draw(RenderContextBatch& renderContextBatch)
|
||||
ACTOR_GET_WORLD_MATRIX(this, view, world);
|
||||
Mesh::DrawInfo draw;
|
||||
draw.DrawModes = _drawModes;
|
||||
if (drawState && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
if (drawState && EnumHasAllFlags(renderContext.View.Flags, ViewFlags::OcclusionCulling) && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
{
|
||||
// Draw shadows-only (or cull)
|
||||
draw.DrawModes &= DrawPass::Depth;
|
||||
|
||||
@@ -617,7 +617,7 @@ void ParticleEffect::Draw(RenderContextBatch& renderContextBatch)
|
||||
return;
|
||||
auto drawState = renderContext.Buffers->GetGeometryDrawState(&GetScene()->Rendering, _sceneRenderingKey, this);
|
||||
DrawPass drawModes = DrawModes;
|
||||
if (drawState && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
if (drawState && EnumHasAllFlags(renderContext.View.Flags, ViewFlags::OcclusionCulling) && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
drawModes &= DrawPass::Depth;
|
||||
Particles::DrawParticles(renderContextBatch, this, drawModes);
|
||||
|
||||
|
||||
@@ -303,6 +303,7 @@ void Renderer::DrawSceneDepth(GPUContext* context, SceneRenderTask* task, GPUTex
|
||||
RenderContext renderContext(task);
|
||||
renderContext.List = RenderList::GetFromPool();
|
||||
renderContext.View.Pass = DrawPass::Depth;
|
||||
renderContext.View.Flags &= ~ViewFlags::OcclusionCulling;
|
||||
renderContext.View.Prepare(renderContext);
|
||||
|
||||
// Call drawing (will collect draw calls)
|
||||
|
||||
@@ -378,7 +378,7 @@ void TextRender::Draw(RenderContextBatch& renderContextBatch)
|
||||
renderContext.View.GetWorldMatrix(_transform, world);
|
||||
auto drawState = renderContext.Buffers->GetGeometryDrawState(&GetScene()->Rendering, _sceneRenderingKey, this);
|
||||
DrawPass drawModes = DrawModes;
|
||||
if (drawState && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
if (drawState && EnumHasAllFlags(renderContext.View.Flags, ViewFlags::OcclusionCulling) && renderContextBatch.Buffers->OcclusionCulling && !renderContextBatch.Buffers->OcclusionCulling->IsVisible(_box, *drawState))
|
||||
{
|
||||
// Draw shadows-only (or cull)
|
||||
drawModes &= DrawPass::Depth;
|
||||
|
||||
Reference in New Issue
Block a user