/// <summary> /// Performs an intersection 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 Intersection8(RayStruct8 *ray, uint *activityMask) { #if DEBUG CheckDisposed(); if (!AlgorithmFlags.HasFlag(AlgorithmFlags.Intersect8)) { throw new InvalidOperationException("AlgorithmFlags.Intersect8 not set."); } #endif RTC.Intersect8(activityMask, NativePtr, ray); }
/// <summary> /// Performs an intersection test against a packet of 8 rays. /// </summary> public unsafe RTC.RayPacket8 Intersects8 <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.Intersect8(a, scenePtr, p); return(*p); }