More work for large worlds

This commit is contained in:
Wojtek Figat
2022-06-29 23:28:03 +02:00
parent 2cd244fbd3
commit 7ebdce5e42
11 changed files with 58 additions and 56 deletions

View File

@@ -3,6 +3,7 @@
#include "BoundingBox.h"
#include "BoundingSphere.h"
#include "Matrix.h"
#include "Transform.h"
#include "../Types/String.h"
const BoundingBox BoundingBox::Empty(Vector3(MAX_float), Vector3(MIN_float));
@@ -147,3 +148,11 @@ void BoundingBox::Transform(const BoundingBox& box, const Matrix& matrix, Boundi
result = FromPoints(corners, 8);
*/
}
void BoundingBox::Transform(const BoundingBox& box, const ::Transform& transform, BoundingBox& result)
{
// TODO: optimize it and support large worlds without using Matrix
Matrix matrix;
transform.GetWorld(matrix);
Transform(box, matrix, result);
}

View File

@@ -296,6 +296,14 @@ public:
/// <param name="result">The result transformed box.</param>
static void Transform(const BoundingBox& box, const Matrix& matrix, BoundingBox& result);
/// <summary>
/// Transforms the bounding box using the specified transformation.
/// </summary>
/// <param name="box">The box.</param>
/// <param name="transform">The transformation.</param>
/// <param name="result">The result transformed box.</param>
static void Transform(const BoundingBox& box, const ::Transform& transform, BoundingBox& result);
public:
/// <summary>
/// Determines if there is an intersection between the current object and a Ray.