Skip to content
Permalink
Browse files

[Rendering] Removed dependency from VisibilityGroup to ShadowMapRende…

…rView
  • Loading branch information
xen2 committed Feb 12, 2019
1 parent cc4bd9f commit 1cd0f982ac1818fdde11624ad4ceada230c25ec6
@@ -95,6 +95,12 @@ public class RenderView
/// <remarks>This is a temporary workaround until shadow maps have a real scope: global or view-dependent (single view or multiple views).</remarks>
public RenderView LightingView { get; set; }

// TODO: This should be configured by the creator of the view. E.g. near clipping can be enabled for spot light shadows.
/// <summary>
/// Ignore depth planes in visibility test
/// </summary>
public bool VisiblityIgnoreDepthPlanes = false;

public override string ToString()
{
return $"RenderView ({Features.Sum(x => x.ViewObjectNodes.Count)} objects, {Features.Sum(x => x.RenderNodes.Count)} render nodes, {RenderStages.Count} stages)";
@@ -11,6 +11,11 @@ namespace Xenko.Rendering.Shadows
/// </summary>
public class ShadowMapRenderView : RenderView
{
public ShadowMapRenderView()
{
VisiblityIgnoreDepthPlanes = true;
}

/// <summary>
/// The view for which this shadow map is rendered
/// </summary>
@@ -28,11 +33,6 @@ public class ShadowMapRenderView : RenderView

public ProfilingKey ProfilingKey { get; } = new ProfilingKey($"ShadowMapRenderView");

/// <summary>
/// Ignore depth planes in visibility test
/// </summary>
public bool VisiblityIgnoreDepthPlanes = true;

internal ParameterCollection ViewParameters = new ParameterCollection();
}
}
@@ -106,10 +106,6 @@ public void TryCollect(RenderView view)
var pointOnPlane = viewInverse.TranslationVector + viewInverse.Forward * view.NearClipPlane;
var plane = new Plane(planeNormal, Vector3.Dot(pointOnPlane, planeNormal)); // TODO: Point-normal-constructor seems wrong. Check.

// TODO: This should be configured by the creator of the view. E.g. near clipping can be enabled for spot light shadows.
var shadowView = view as ShadowMapRenderView;
var ignoreDepthPlanes = shadowView?.VisiblityIgnoreDepthPlanes ?? false;

// Prepare culling mask
foreach (var renderViewStage in view.RenderStages)
{
@@ -169,7 +165,7 @@ public void TryCollect(RenderView view)
// Compute transformed AABB (by world)
if (cullingMode == CameraCullingMode.Frustum
&& renderObject.BoundingBox.Extent != Vector3.Zero
&& !FrustumContainsBox(ref frustum, ref renderObject.BoundingBox, ignoreDepthPlanes))
&& !FrustumContainsBox(ref frustum, ref renderObject.BoundingBox, view.VisiblityIgnoreDepthPlanes))
{
return;
}

0 comments on commit 1cd0f98

Please sign in to comment.
You can’t perform that action at this time.