Example #1
0
        public List <int> Traverse(Ray ray, bool trackStats = true)
        {
            Vector3 dirFrac = new Vector3
            {
                X = 1.0f / ray.direction.X,
                Y = 1.0f / ray.direction.Y,
                Z = 1.0f / ray.direction.Z
            };

            return(_root.Traverse(ray, dirFrac, trackStats));
        }
Example #2
0
        public List <int> Traverse(Ray ray, Vector3 dirFrac, bool trackStats = true)
        {
            if (!Intersect(ray, dirFrac, trackStats))
            {
                return(new List <int>());
            }

            Game.numBoxRayIntersections++;

            if (isLeaf)
            {
                return(meshIndices);
            }
            else
            {
                List <int> meshesInNode = new List <int>();

                meshesInNode.AddRange(leftChildNode.Traverse(ray, dirFrac, trackStats));
                meshesInNode.AddRange(rightChildNode.Traverse(ray, dirFrac, trackStats));

                return(meshesInNode);
            }
        }