/// <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 Occlusion8(RayStruct8 *ray, uint *activityMask) { #if DEBUG CheckDisposed(); if (!AlgorithmFlags.HasFlag(AlgorithmFlags.Intersect8)) { throw new InvalidOperationException("AlgorithmFlags.Intersect8 not set."); } #endif RTC.Occluded8(activityMask, NativePtr, ray); }
/// <summary> /// Performs an occlusion test against a packet of 8 rays. /// </summary> public unsafe Boolean[] Occludes8 <Ray>(Ray[] rays, float near = 0, float far = float.PositiveInfinity, float time = 0) where Ray : IEmbreeRay { #if DEBUG if (!traversalFlags.HasFlag(TraversalFlags.Packet8)) { throw new InvalidOperationException("Traversal flags forbid 8-ray packet traversal"); } #endif var p = RTC.RayInterop.Packet8; var a = RTC.RayInterop.Activity; for (var t = 0; t < 8; ++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.Occluded8(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, }); }