Added editorconfig file for VS C++ code style formatting.
Applied C++ auto formatting.
This commit is contained in:
@@ -43,61 +43,63 @@ namespace kraken {
|
||||
|
||||
class Matrix4;
|
||||
|
||||
class AABB {
|
||||
class AABB
|
||||
{
|
||||
public:
|
||||
Vector3 min;
|
||||
Vector3 max;
|
||||
|
||||
void init(const Vector3 &minPoint, const Vector3 &maxPoint);
|
||||
void init(const Vector3 &corner1, const Vector3 &corner2, const Matrix4 &modelMatrix);
|
||||
void init(const Vector3& minPoint, const Vector3& maxPoint);
|
||||
void init(const Vector3& corner1, const Vector3& corner2, const Matrix4& modelMatrix);
|
||||
void init();
|
||||
static AABB Create(const Vector3 &minPoint, const Vector3 &maxPoint);
|
||||
static AABB Create(const Vector3 &corner1, const Vector3 &corner2, const Matrix4 &modelMatrix);
|
||||
static AABB Create(const Vector3& minPoint, const Vector3& maxPoint);
|
||||
static AABB Create(const Vector3& corner1, const Vector3& corner2, const Matrix4& modelMatrix);
|
||||
static AABB Create();
|
||||
|
||||
void scale(const Vector3 &s);
|
||||
void scale(const Vector3& s);
|
||||
void scale(float s);
|
||||
|
||||
|
||||
Vector3 center() const;
|
||||
Vector3 size() const;
|
||||
float volume() const;
|
||||
bool intersects(const AABB& b) const;
|
||||
bool contains(const AABB &b) const;
|
||||
bool contains(const Vector3 &v) const;
|
||||
|
||||
bool intersectsLine(const Vector3 &v1, const Vector3 &v2) const;
|
||||
bool intersectsRay(const Vector3 &v1, const Vector3 &dir) const;
|
||||
bool intersectsSphere(const Vector3 ¢er, float radius) const;
|
||||
void encapsulate(const AABB & b);
|
||||
|
||||
bool contains(const AABB& b) const;
|
||||
bool contains(const Vector3& v) const;
|
||||
|
||||
bool intersectsLine(const Vector3& v1, const Vector3& v2) const;
|
||||
bool intersectsRay(const Vector3& v1, const Vector3& dir) const;
|
||||
bool intersectsSphere(const Vector3& center, float radius) const;
|
||||
void encapsulate(const AABB& b);
|
||||
|
||||
bool operator ==(const AABB& b) const;
|
||||
bool operator !=(const AABB& b) const;
|
||||
|
||||
|
||||
// Comparison operators are implemented to allow insertion into sorted containers such as std::set
|
||||
bool operator >(const AABB& b) const;
|
||||
bool operator <(const AABB& b) const;
|
||||
|
||||
|
||||
static AABB Infinite();
|
||||
static AABB Zero();
|
||||
|
||||
|
||||
float longest_radius() const;
|
||||
Vector3 nearestPoint(const Vector3 & v) const;
|
||||
Vector3 nearestPoint(const Vector3& v) const;
|
||||
};
|
||||
static_assert(std::is_pod<AABB>::value, "kraken::AABB must be a POD type.");
|
||||
|
||||
} // namespace kraken
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<kraken::AABB> {
|
||||
public:
|
||||
size_t operator()(const kraken::AABB &s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector3>()(s.min);
|
||||
size_t h2 = hash<kraken::Vector3>()(s.max);
|
||||
return h1 ^ ( h2 << 1 );
|
||||
}
|
||||
};
|
||||
template<>
|
||||
struct hash<kraken::AABB>
|
||||
{
|
||||
public:
|
||||
size_t operator()(const kraken::AABB& s) const
|
||||
{
|
||||
size_t h1 = hash<kraken::Vector3>()(s.min);
|
||||
size_t h2 = hash<kraken::Vector3>()(s.max);
|
||||
return h1 ^ (h2 << 1);
|
||||
}
|
||||
};
|
||||
} // namespace std
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user