public OptixPrimeIntersectionDevice(IRayEngineScene scene, bool lowLatency = false)
            : base(scene)
        {
            this.lowLatency = lowLatency;
            Context = new Context { CpuNumThreads = 4, RayTypeCount = 1, EntryPointCount = 1 };

            trav  = new OptixPrime(Context, QueryType.ClosestHit, RayFormat.OriginDirectionMinMaxInterleaved, TriFormat.Mesh, TraversalOutput.Normal, InitOptions.GpuOnly);

            this.todoRayBuffers = new InputRayBufferCollection();
            this.doneRayBuffers = new OutputRayBufferCollection();
            this.started = false;

            this.SetScene(scene);
        }
        public override void SetScene(IRayEngineScene secn)
        {

            Tracer.TraceLine("OptixIntersectionDevice  -  Initializing Optix");
            this.scene = (RayEngineScene)secn;
            this.vertices = scene.Vertices.ToFloatList().ToArray();

             indices =
                    scene.Triangles.ToList()
                         .SelectMany(tri => new []
                             {
                                 tri.v0.VertexIndex,
                                 tri.v1.VertexIndex,
                                 tri.v2.VertexIndex
                             })
                         .ToArray();
            if (trav == null)
                trav = new OptixPrime(Context, QueryType.ClosestHit, RayFormat.OriginDirectionMinMaxInterleaved, TriFormat.Mesh, TraversalOutput.Normal, InitOptions.GpuOnly);

            trav.SetTriangles(indices, vertices);
        }