Skip to content

Commit

Permalink
Traktor: Do not gather more than one volume fog component.
Browse files Browse the repository at this point in the history
  • Loading branch information
apistol78 committed Mar 10, 2024
1 parent 8715058 commit 5cc2471
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 12 deletions.
4 changes: 2 additions & 2 deletions code/World/Deferred/WorldRendererDeferred.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,8 @@ void WorldRendererDeferred::setupVisualPass(
}
}

// Use first volumetric fog volume, only support one in forward.
const VolumetricFogComponent* fog = (!worldRenderView.getSnapshot() && !m_gatheredView.fogs.empty()) ? m_gatheredView.fogs.front() : nullptr;
// Get volumetric fog volume.
const VolumetricFogComponent* fog = !worldRenderView.getSnapshot() ? m_gatheredView.fog : nullptr;

// Add visual render pass.
Ref< render::RenderPass > rp = new render::RenderPass(L"Visual");
Expand Down
4 changes: 2 additions & 2 deletions code/World/Forward/WorldRendererForward.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ void WorldRendererForward::setupVisualPass(
}
}

// Use first volumetric fog volume, only support one in forward.
const VolumetricFogComponent* fog = (!worldRenderView.getSnapshot() && !m_gatheredView.fogs.empty()) ? m_gatheredView.fogs.front() : nullptr;
// Get volumetric fog volume.
const VolumetricFogComponent* fog = !worldRenderView.getSnapshot() ? m_gatheredView.fog : nullptr;

// Create render pass.
Ref< render::RenderPass > rp = new render::RenderPass(L"Visual");
Expand Down
9 changes: 2 additions & 7 deletions code/World/Shared/WorldRendererShared.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void WorldRendererShared::gather(const World* world, const std::function< bool(c
m_gatheredView.renderables.resize(0);
m_gatheredView.lights.resize(0);
m_gatheredView.probes.resize(0);
m_gatheredView.fogs.resize(0);
m_gatheredView.fog = nullptr;

for (auto entity : world->getEntities())
{
Expand All @@ -228,11 +228,6 @@ void WorldRendererShared::gather(const World* world, const std::function< bool(c
else if (filter == nullptr && entity->getState().visible == false)
continue;

//#todo No longer allow entities to be rendered.
//IEntityRenderer* entityRenderer = m_entityRenderers->find(type_of(entity));
//if (entityRenderer)
// m_gatheredView.renderables.push_back({ entityRenderer, entity });

for (auto component : entity->getComponents())
{
IEntityRenderer* entityRenderer = m_entityRenderers->find(type_of(component));
Expand All @@ -248,7 +243,7 @@ void WorldRendererShared::gather(const World* world, const std::function< bool(c
else if (auto probeComponent = dynamic_type_cast< const ProbeComponent* >(component))
m_gatheredView.probes.push_back(probeComponent);
else if (auto volumetricFogComponent = dynamic_type_cast< const VolumetricFogComponent* >(component))
m_gatheredView.fogs.push_back(volumetricFogComponent);
m_gatheredView.fog = volumetricFogComponent;
}
}

Expand Down
2 changes: 1 addition & 1 deletion code/World/WorldTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct GatherView
AlignedVector< Renderable > renderables;
AlignedVector< const LightComponent* > lights;
AlignedVector< const ProbeComponent* > probes;
AlignedVector< const VolumetricFogComponent* > fogs;
const VolumetricFogComponent* fog;
};

/*!
Expand Down

0 comments on commit 5cc2471

Please sign in to comment.