31 lines
658 B
C
31 lines
658 B
C
|
|
#pragma once
|
||
|
|
|
||
|
|
#include "Math.h"
|
||
|
|
#include "Vector3.h"
|
||
|
|
#include "Matrix4.h"
|
||
|
|
|
||
|
|
namespace XCEngine {
|
||
|
|
namespace Math {
|
||
|
|
|
||
|
|
struct Sphere;
|
||
|
|
struct Ray;
|
||
|
|
|
||
|
|
struct Box {
|
||
|
|
Vector3 center = Vector3::Zero();
|
||
|
|
Vector3 extents = Vector3::Zero();
|
||
|
|
Matrix4x4 transform = Matrix4x4::Identity();
|
||
|
|
|
||
|
|
Box() = default;
|
||
|
|
Box(const Vector3& center, const Vector3& extents);
|
||
|
|
|
||
|
|
Vector3 GetMin() const;
|
||
|
|
Vector3 GetMax() const;
|
||
|
|
bool Contains(const Vector3& point) const;
|
||
|
|
bool Intersects(const Sphere& sphere) const;
|
||
|
|
bool Intersects(const Box& other) const;
|
||
|
|
bool Intersects(const Ray& ray, float& t) const;
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace Math
|
||
|
|
} // namespace XCEngine
|