Beispiel #1
0
        public ShadowRay MakeBackgroundShadowRay(Hit from, Vector3 direction)
        {
            var ray = SpawnRay(from, direction);

            return(new ShadowRay(ray, float.MaxValue));
        }
Beispiel #2
0
        Vector3 OffsetPoint(Hit from, Vector3 dir)
        {
            float sign = Vector3.Dot(dir, from.Normal) < 0.0f ? -1.0f : 1.0f;

            return(from.Position + sign * from.ErrorOffset * from.Normal);
        }
Beispiel #3
0
        public bool IsOccluded(Hit from, Hit to)
        {
            var ray = MakeShadowRay(from, to);

            return(IsOccluded(ray));
        }
Beispiel #4
0
        public bool IsOccluded(Hit from, Vector3 target)
        {
            var ray = MakeShadowRay(from, target);

            return(IsOccluded(ray));
        }
Beispiel #5
0
        /// <summary>
        /// Convenience wrapper that calls <see cref="MakeBackgroundShadowRay"/> and then
        /// <see cref="IsOccluded(ShadowRay)"/>.
        /// </summary>
        /// <returns>True if the shadow ray is occluded</returns>
        public bool LeavesScene(Hit from, Vector3 direction)
        {
            var ray = MakeBackgroundShadowRay(from, direction);

            return(!IsOccluded(ray));
        }