 
 	real t = AT_MATH_INF;
 
+	cudaTextureObject_t node = ctxt->nodes[0];
+
+#ifdef ENABLE_PLANE_LOOP_BVH
+	aten::ray transformedRay = r;
+
+	int toplayerHit = -1;
+	int toplayerMiss = -1;
+	int objid = 0;
+	int meshid = 0;
+
 	while (nodeid >= 0) {
-		node0 = tex1Dfetch<float4>(nodes, aten::GPUBvhNodeSize * nodeid + 0);	// xyz : boxmin, z: hit
-		node1 = tex1Dfetch<float4>(nodes, aten::GPUBvhNodeSize * nodeid + 1);	// xyz : boxmin, z: hit
-		attrib = tex1Dfetch<float4>(nodes, aten::GPUBvhNodeSize * nodeid + 2);	// x : shapeid, y : primid, z : exid, w : meshid
+		node0 = tex1Dfetch<float4>(node, aten::GPUBvhNodeSize * nodeid + 0);	// xyz : boxmin, z: hit
+		node1 = tex1Dfetch<float4>(node, aten::GPUBvhNodeSize * nodeid + 1);	// xyz : boxmin, z: hit
+		attrib = tex1Dfetch<float4>(node, aten::GPUBvhNodeSize * nodeid + 2);	// x : shapeid, y : primid, z : exid, w : meshid
 
 		boxmin = make_float4(node0.x, node0.y, node0.z, 1.0f);
 		boxmax = make_float4(node1.x, node1.y, node1.z, 1.0f);

	return (isect->objid >= 0);
}

template <idaten::IntersectType Type>
AT_CUDA_INLINE __device__ bool intersectBVH(
	cudaTextureObject_t nodes,
	const Context* ctxt,
	const aten::ray r,
	float t_min, float t_max,

			nodeid = (int)node1.w;
		}
	}
#endif

	return (isect->objid >= 0);
}
