Exemple #1
0
        /// <summary>
        /// Performs an occlusion test against the specified ray.
        /// </summary>
        public unsafe Boolean Occludes <Ray>(Ray ray, float near = 0, float far = float.PositiveInfinity, float time = 0) where Ray : IEmbreeRay
        {
            #if DEBUG
            if (!traversalFlags.HasFlag(TraversalFlags.Single))
            {
                throw new InvalidOperationException("Traversal flags forbid single-ray traversal");
            }
            #endif

            var o = ray.Origin;
            var d = ray.Direction;
            var p = RTC.RayInterop.Packet1;

            p->orgX = o.X; p->orgY = o.Y; p->orgZ = o.Z;
            p->dirX = d.X; p->dirY = d.Y; p->dirZ = d.Z;

            p->geomID = RTC.InvalidGeometryID;
            p->primID = RTC.InvalidGeometryID;
            p->instID = RTC.InvalidGeometryID;

            p->time  = time;
            p->tnear = near;
            p->tfar  = far;

            RTC.Occluded1(scenePtr, p);

            return(p->geomID == 0);
        }