Add culling and render mask check for models rendered via Custom Actors list

This commit is contained in:
Wojtek Figat
2021-07-16 17:13:44 +02:00
parent dcd4a41f7d
commit 4d136af7dd
3 changed files with 16 additions and 7 deletions

View File

@@ -251,9 +251,10 @@ void SceneRenderTask::CollectPostFxVolumes(RenderContext& renderContext)
} }
if ((ActorsSource & ActorsSources::CustomActors) != 0) if ((ActorsSource & ActorsSources::CustomActors) != 0)
{ {
for (int32 i = 0; i < CustomActors.Count(); i++) for (auto a : CustomActors)
{ {
if (auto* postFxVolume = dynamic_cast<PostFxVolume*>(CustomActors[i])) auto* postFxVolume = dynamic_cast<PostFxVolume*>(a);
if (postFxVolume && a->GetIsActive())
{ {
postFxVolume->Collect(renderContext); postFxVolume->Collect(renderContext);
} }
@@ -266,10 +267,12 @@ void SceneRenderTask::OnCollectDrawCalls(RenderContext& renderContext)
// Draw actors (collect draw calls) // Draw actors (collect draw calls)
if ((ActorsSource & ActorsSources::CustomActors) != 0) if ((ActorsSource & ActorsSources::CustomActors) != 0)
{ {
for (int32 i = 0; i < CustomActors.Count(); i++) for (auto a : CustomActors)
{ {
if (CustomActors[i] && CustomActors[i]->GetIsActive()) if (a && a->GetIsActive())
CustomActors[i]->DrawHierarchy(renderContext); {
a->DrawHierarchy(renderContext);
}
} }
} }
if ((ActorsSource & ActorsSources::Scenes) != 0) if ((ActorsSource & ActorsSources::Scenes) != 0)

View File

@@ -623,7 +623,10 @@ void AnimatedModel::Draw(RenderContext& renderContext)
void AnimatedModel::DrawGeneric(RenderContext& renderContext) void AnimatedModel::DrawGeneric(RenderContext& renderContext)
{ {
Draw(renderContext); if (renderContext.View.RenderLayersMask.Mask & GetLayerMask() && renderContext.View.CullingFrustum.Intersects(_box))
{
Draw(renderContext);
}
} }
#if USE_EDITOR #if USE_EDITOR

View File

@@ -268,7 +268,10 @@ void StaticModel::Draw(RenderContext& renderContext)
void StaticModel::DrawGeneric(RenderContext& renderContext) void StaticModel::DrawGeneric(RenderContext& renderContext)
{ {
Draw(renderContext); if (renderContext.View.RenderLayersMask.Mask & GetLayerMask() && renderContext.View.CullingFrustum.Intersects(_box))
{
Draw(renderContext);
}
} }
bool StaticModel::IntersectsItself(const Ray& ray, float& distance, Vector3& normal) bool StaticModel::IntersectsItself(const Ray& ray, float& distance, Vector3& normal)