Daniele Bartolini 10 лет назад
Родитель
Сommit
0633909f56
1 измененных файлов с 5 добавлено и 4 удалено
  1. 5 4
      src/core/math/sphere.h

+ 5 - 4
src/core/math/sphere.h

@@ -73,12 +73,13 @@ namespace sphere
 	{
 		for (uint32_t i = 0; i < num; ++i)
 		{
-			const float dist = length_squared(spheres[i].c - s.c);
+			const Sphere si = spheres[i];
+			const float dist = length_squared(si.c - s.c);
 
-			if (dist < (spheres[i].r + s.r) * (spheres[i].r + s.r))
+			if (dist < (si.r + s.r) * (si.r + s.r))
 			{
-				if (spheres[i].r * spheres[i].r > s.r * s.r)
-					s.r = sqrtf(dist + spheres[i].r * spheres[i].r);
+				if (si.r*si.r > s.r*s.r)
+					s.r = sqrtf(dist + si.r*si.r);
 			}
 		}
 	}