src/octree.cc
branchpyrit
changeset 95 ca7d4c665531
parent 93 96d65f841791
child 103 3b3257a410fe
equal deleted inserted replaced
94:4c8abb8977dc 95:ca7d4c665531
   146 		else
   146 		else
   147 			return znode;
   147 			return znode;
   148 	}
   148 	}
   149 }
   149 }
   150 
   150 
   151 Shape * Octree::nearest_intersection(const Shape *origin_shape, const Ray &ray,
   151 const Shape * Octree::nearest_intersection(const Shape *origin_shape, const Ray &ray,
   152 		Float &nearest_distance)
   152 		Float &nearest_distance)
   153 {
   153 {
   154 	/* if we have no tree, fall back to naive test */
   154 	/* if we have no tree, fall back to naive test */
   155 	if (!built)
   155 	if (!built)
   156 		return Container::nearest_intersection(origin_shape, ray, nearest_distance);
   156 		return Container::nearest_intersection(origin_shape, ray, nearest_distance);
   215 		return NULL;
   215 		return NULL;
   216 
   216 
   217 	node = root;
   217 	node = root;
   218 	st_cur->next = -1;
   218 	st_cur->next = -1;
   219 
   219 
   220 	Shape *nearest_shape = NULL;
   220 	const Shape *nearest_shape = NULL;
   221 	for (;;)
   221 	for (;;)
   222 	{
   222 	{
   223 		if (st_cur->next == -1)
   223 		if (st_cur->next == -1)
   224 		{
   224 		{
   225 			st_cur->next = 8;
   225 			st_cur->next = 8;