public unsafe void RayTest(CollidableReference reference, RayData *rayData, float *maximumT)
 {
     if (HitHandler.HitHandler.AllowTest(reference))
     {
         Simulation.GetPoseAndShape(reference, out var pose, out var shape);
         Simulation.Shapes[shape.Type].RayTest(shape.Index, *pose, *rayData, ref *maximumT, ref HitHandler);
     }
 }
示例#2
0
 public unsafe void TestLeaf(int leafIndex, RayData *rayData, float *maximumT)
 {
     ref var triangle = ref Triangles[leafIndex];
示例#3
0
 public unsafe void TestLeaf(int leafIndex, RayData *rayData, float *maximumT)
 {
     LeafTester.RayTest(Leaves[leafIndex], rayData, maximumT);
 }
 static float FindTriangleIntersectionSimd(float3 *vertices, int *indices, int numTriangles, RayData *ray)
 {
     // YOUR SIMD CODE HERE
     return(float.PositiveInfinity);
 }
    [BurstCompile(CompileSynchronously = true)] // note the lack of Fast-math; doesn't play nicely with NaNs
    static float FindTriangleIntersection(float3 *vertices, int *indices, int numTriangles, RayData *rayPtr)
    {
        RayData ray  = *rayPtr;
        float   minT = float.PositiveInfinity;

        for (int tri = 0; tri < numTriangles; tri++)
        {
            int idx0 = indices[3 * tri + 0];
            int idx1 = indices[3 * tri + 1];
            int idx2 = indices[3 * tri + 2];

            float t = IntersectRayTriangle(ray, vertices[idx0], vertices[idx1], vertices[idx2]);
            minT = math.min(t, minT);
        }
        return(minT);
    }