Exemple #1
0
        /// <summary>
        /// Performs an occlusion test against a packet of 16 rays.
        /// </summary>
        public unsafe Boolean[] Occludes16 <Ray>(Ray[] rays, float near = 0, float far = float.PositiveInfinity, float time = 0) where Ray : IEmbreeRay
        {
            #if DEBUG
            if (!traversalFlags.HasFlag(TraversalFlags.Packet16))
            {
                throw new InvalidOperationException("Traversal flags forbid 16-ray packet traversal");
            }
            #endif

            var p = RTC.RayInterop.Packet16;
            var a = RTC.RayInterop.Activity;

            for (var t = 0; t < 16; ++t)
            {
                if (rays[t] != null)
                {
                    a[t] = RTC.RayInterop.Active;
                }
                else
                {
                    a[t] = RTC.RayInterop.Inactive;
                    continue;
                }

                var o = rays[t].Origin;
                var d = rays[t].Direction;

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

                p->geomID[t] = RTC.InvalidGeometryID;
                p->primID[t] = RTC.InvalidGeometryID;
                p->instID[t] = RTC.InvalidGeometryID;

                p->time[t]  = time;
                p->tnear[t] = near;
                p->tfar[t]  = far;
            }

            RTC.Occluded16(a, scenePtr, p);

            return(new[]
            {
                p->geomID[0] == 0, p->geomID[1] == 0,
                p->geomID[2] == 0, p->geomID[3] == 0,
                p->geomID[4] == 0, p->geomID[5] == 0,
                p->geomID[6] == 0, p->geomID[7] == 0,
                p->geomID[8] == 0, p->geomID[9] == 0,
                p->geomID[10] == 0, p->geomID[11] == 0,
                p->geomID[12] == 0, p->geomID[13] == 0,
                p->geomID[14] == 0, p->geomID[15] == 0,
            });
        }
Exemple #2
0
        /// <summary>
        /// Performs an occlusion query on this scene.
        /// </summary>
        /// <param name="ray">The ray structure to use.</param>
        /// <param name="activityMask">The ray activity mask.</param>
        public unsafe void Occlusion16(RayStruct16 *ray, uint *activityMask)
        {
            #if DEBUG
            CheckDisposed();

            if (!AlgorithmFlags.HasFlag(AlgorithmFlags.Intersect16))
            {
                throw new InvalidOperationException("AlgorithmFlags.Intersect16 not set.");
            }
            #endif

            RTC.Occluded16(activityMask, NativePtr, ray);
        }