private bool ForEachRay(ShadowRegion shadow, object p1, object p2, object p3) { if (_Shadows.Contains(shadow)) { return(true); } LightSource light = (LightSource)p1; Vector2 dir = light.Geometry.Position - Geometry.Position; Vector2 diff = shadow.Geometry.Position - Geometry.Position; float t = (diff.X * dir.X + diff.Y * dir.Y) / (dir.X * dir.X + dir.Y * dir.Y); if (t < 0.0f) { t = 0.0f; } if (t > 1.0f) { t = 1.0f; } Vector2 closest = Geometry.Position + t * dir; Vector2 d = shadow.Geometry.Position - closest; float distsqr = d.X * d.X + d.Y * d.Y; return(distsqr > shadow.Radius * shadow.Radius); }
private bool UpdateShadow(ShadowRegion shad, object time, object p2, object p3) { shad.Update(time as GameTime); return(true); }