diff --git a/Source/Graphics/Renderers/ShadowRenderer.cs b/Source/Graphics/Renderers/ShadowRenderer.cs index c9cfc41..69bfad5 100644 --- a/Source/Graphics/Renderers/ShadowRenderer.cs +++ b/Source/Graphics/Renderers/ShadowRenderer.cs @@ -152,10 +152,15 @@ public void Dispose() for (int i = 0; i < hullCount; i++) { Hull hull = _engine.Hulls[i]; - if (!hull.Enabled || !hull.Valid || !light.Intersects(hull)) + if (!hull.Enabled || + !hull.Valid || + light.IgnoredHulls.Contains(hull) || + !light.Intersects(hull)) + { continue; + } - Polygon points = hull.WorldPoints; + Polygon points = hull.WorldPoints; Vector2 prevPoint = points[points.Count - 1]; diff --git a/Source/Hull.cs b/Source/Hull.cs index 9d6cfed..c68b3a3 100644 --- a/Source/Hull.cs +++ b/Source/Hull.cs @@ -298,10 +298,14 @@ public bool Contains(Light light) for (int i = 0; i < hullCount; i++) { Hull hull = this[i]; - // If hull is valid and enabled: + // If hull is not ignored by light, valid and enabled: // 1. test AABB intersection // 2. test point is contained in polygon - if (hull.Enabled && hull.Valid && light.Bounds.Intersects(ref hull.Bounds) && hull.WorldPoints.Contains(ref light._position)) + if (!light.IgnoredHulls.Contains(hull) && + hull.Enabled && + hull.Valid && + light.Bounds.Intersects(ref hull.Bounds) && + hull.WorldPoints.Contains(ref light._position)) return true; } return false; diff --git a/Source/Light.cs b/Source/Light.cs index c136020..1b1d77f 100644 --- a/Source/Light.cs +++ b/Source/Light.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Penumbra.Geometry; @@ -185,7 +186,12 @@ public float Radius /// Gets or sets how the shadow s are shadowed. See /// for more information. /// - public ShadowType ShadowType { get; set; } = ShadowType.Illuminated; + public ShadowType ShadowType { get; set; } = ShadowType.Illuminated; + + /// + /// Gets a list of hulls not participating in the light's shadow casting process. + /// + public List IgnoredHulls { get; } = new List(); // Cleared by the engine. Used by other systems to know if the light's world transform has changed. internal bool Dirty;