/// <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 Intersection4(RayStruct4 *ray, uint *activityMask) { #if DEBUG CheckDisposed(); if (!AlgorithmFlags.HasFlag(AlgorithmFlags.Intersect4)) { throw new InvalidOperationException("AlgorithmFlags.Intersect4 not set."); } #endif RTC.Intersect4(activityMask, NativePtr, ray); }
/// <summary> /// Performs an intersection test against a packet of 4 rays. /// </summary> public unsafe RTC.RayPacket4 Intersects4 <Ray>(Ray[] rays, float near = 0, float far = float.PositiveInfinity, float time = 0) where Ray : IEmbreeRay { #if DEBUG if (!traversalFlags.HasFlag(TraversalFlags.Packet4)) { throw new InvalidOperationException("Traversal flags forbid 4-ray packet traversal"); } #endif var p = RTC.RayInterop.Packet4; var a = RTC.RayInterop.Activity; for (var t = 0; t < 4; ++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.Intersect4(a, scenePtr, p); return(*p); }