Remove unused LodProxyView feature from RenderContext (shadow projections are using the same draw batch as main view now)
This commit is contained in:
@@ -426,11 +426,6 @@ API_STRUCT(NoDefault) struct RenderContext
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
API_FIELD() SceneRenderTask* Task = nullptr;
|
API_FIELD() SceneRenderTask* Task = nullptr;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The proxy render view used to synchronize objects level of detail during rendering (eg. during shadow maps rendering passes). It's optional.
|
|
||||||
/// </summary>
|
|
||||||
API_FIELD() RenderView* LodProxyView = nullptr;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The render view.
|
/// The render view.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -441,8 +441,7 @@ float RenderTools::ComputeBoundsScreenRadiusSquared(const Float3& origin, float
|
|||||||
|
|
||||||
int32 RenderTools::ComputeModelLOD(const Model* model, const Float3& origin, float radius, const RenderContext& renderContext)
|
int32 RenderTools::ComputeModelLOD(const Model* model, const Float3& origin, float radius, const RenderContext& renderContext)
|
||||||
{
|
{
|
||||||
const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View);
|
const float screenRadiusSquared = ComputeBoundsScreenRadiusSquared(origin, radius, renderContext.View) * renderContext.View.ModelLODDistanceFactorSqrt;
|
||||||
const float screenRadiusSquared = ComputeBoundsScreenRadiusSquared(origin, radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt;
|
|
||||||
|
|
||||||
// Check if model is being culled
|
// Check if model is being culled
|
||||||
if (Math::Square(model->MinScreenSize * 0.5f) > screenRadiusSquared)
|
if (Math::Square(model->MinScreenSize * 0.5f) > screenRadiusSquared)
|
||||||
@@ -466,8 +465,7 @@ int32 RenderTools::ComputeModelLOD(const Model* model, const Float3& origin, flo
|
|||||||
|
|
||||||
int32 RenderTools::ComputeSkinnedModelLOD(const SkinnedModel* model, const Float3& origin, float radius, const RenderContext& renderContext)
|
int32 RenderTools::ComputeSkinnedModelLOD(const SkinnedModel* model, const Float3& origin, float radius, const RenderContext& renderContext)
|
||||||
{
|
{
|
||||||
const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View);
|
const float screenRadiusSquared = ComputeBoundsScreenRadiusSquared(origin, radius, renderContext.View) * renderContext.View.ModelLODDistanceFactorSqrt;
|
||||||
const float screenRadiusSquared = ComputeBoundsScreenRadiusSquared(origin, radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt;
|
|
||||||
|
|
||||||
// Check if model is being culled
|
// Check if model is being culled
|
||||||
if (Math::Square(model->MinScreenSize * 0.5f) > screenRadiusSquared)
|
if (Math::Square(model->MinScreenSize * 0.5f) > screenRadiusSquared)
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ void RenderView::Prepare(RenderContext& renderContext)
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderContext.List->Init(renderContext);
|
renderContext.List->Init(renderContext);
|
||||||
renderContext.LodProxyView = nullptr;
|
|
||||||
|
|
||||||
PrepareCache(renderContext, width, height, taaJitter);
|
PrepareCache(renderContext, width, height, taaJitter);
|
||||||
}
|
}
|
||||||
@@ -74,7 +73,7 @@ void RenderView::PrepareCache(const RenderContext& renderContext, float width, f
|
|||||||
WorldPosition = Origin + Position;
|
WorldPosition = Origin + Position;
|
||||||
|
|
||||||
// Ortho views have issues with screen size LOD culling
|
// Ortho views have issues with screen size LOD culling
|
||||||
const float modelLODDistanceFactor = (renderContext.LodProxyView ? renderContext.LodProxyView->IsOrthographicProjection() : IsOrthographicProjection()) ? 100.0f : ModelLODDistanceFactor;
|
const float modelLODDistanceFactor = IsOrthographicProjection() ? 100.0f : ModelLODDistanceFactor;
|
||||||
ModelLODDistanceFactorSqrt = modelLODDistanceFactor * modelLODDistanceFactor;
|
ModelLODDistanceFactorSqrt = modelLODDistanceFactor * modelLODDistanceFactor;
|
||||||
|
|
||||||
// Setup main view render info
|
// Setup main view render info
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ void Decal::Draw(RenderContext& renderContext)
|
|||||||
Material->IsLoaded() &&
|
Material->IsLoaded() &&
|
||||||
Material->IsDecal())
|
Material->IsDecal())
|
||||||
{
|
{
|
||||||
const auto lodView = (renderContext.LodProxyView ? renderContext.LodProxyView : &renderContext.View);
|
const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(_sphere.Center - renderContext.View.Origin, (float)_sphere.Radius, renderContext.View) * renderContext.View.ModelLODDistanceFactorSqrt;
|
||||||
const float screenRadiusSquared = RenderTools::ComputeBoundsScreenRadiusSquared(_sphere.Center - renderContext.View.Origin, (float)_sphere.Radius, *lodView) * renderContext.View.ModelLODDistanceFactorSqrt;
|
|
||||||
|
|
||||||
// Check if decal is being culled
|
// Check if decal is being culled
|
||||||
if (Math::Square(DrawMinScreenSize * 0.5f) > screenRadiusSquared)
|
if (Math::Square(DrawMinScreenSize * 0.5f) > screenRadiusSquared)
|
||||||
|
|||||||
@@ -193,9 +193,6 @@ void ShadowsPass::SetupRenderContext(RenderContext& renderContext, RenderContext
|
|||||||
{
|
{
|
||||||
const auto& view = renderContext.View;
|
const auto& view = renderContext.View;
|
||||||
|
|
||||||
// Use the current render view to sync model LODs with the shadow maps rendering stage
|
|
||||||
shadowContext.LodProxyView = &renderContext.View;
|
|
||||||
|
|
||||||
// Prepare properties
|
// Prepare properties
|
||||||
auto& shadowView = shadowContext.View;
|
auto& shadowView = shadowContext.View;
|
||||||
shadowView.Flags = view.Flags;
|
shadowView.Flags = view.Flags;
|
||||||
|
|||||||
Reference in New Issue
Block a user