lot of changes in floors

This commit is contained in:
h4570
2020-12-07 20:47:41 +01:00
parent cad2623649
commit dd49fc165e
13 changed files with 190 additions and 59 deletions
+36
View File
@@ -32,3 +32,39 @@ float Utils::expoEaseInOut(float t, float b, float c, float d)
return c / 2 * (-powf(2, -10 * --t) + 2) + b;
}
/** Calculates minimum and maximum X, Y, Z of mesh vertices + current position */
void Utils::getMinMax(const Mesh &t_mesh, Vector3 &t_min, Vector3 &t_max)
{
Vector3 calc = Vector3();
u8 isInitialized = 0;
Vector3 *boundingBox = t_mesh.getCurrentBoundingBox();
for (u32 i = 0; i < 8; i++)
{
calc.set(
boundingBox[i].x + t_mesh.position.x,
boundingBox[i].y + t_mesh.position.y,
boundingBox[i].z + t_mesh.position.z);
if (isInitialized == 0)
{
isInitialized = 1;
t_min.set(calc);
t_max.set(calc);
}
if (t_min.x > calc.x)
t_min.x = calc.x;
if (calc.x > t_max.x)
t_max.x = calc.x;
if (t_min.y > calc.y)
t_min.y = calc.y;
if (calc.y > t_max.y)
t_max.y = calc.y;
if (t_min.z > calc.z)
t_min.z = calc.z;
if (calc.z > t_max.z)
t_max.z = calc.z;
}
}