2015-08-29 04:49:19 +00:00
|
|
|
#ifndef CSPHERE_HPP
|
|
|
|
#define CSPHERE_HPP
|
|
|
|
|
|
|
|
#include "CVector3f.hpp"
|
|
|
|
|
2015-10-08 00:21:38 +00:00
|
|
|
namespace Zeus
|
|
|
|
{
|
2015-08-29 04:49:19 +00:00
|
|
|
class ZE_ALIGN(16) CSphere
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ZE_DECLARE_ALIGNED_ALLOCATOR();
|
|
|
|
|
2015-10-08 00:21:38 +00:00
|
|
|
CSphere(const CVector3f& position, float radius) { vec = position; r = radius; }
|
|
|
|
inline CVector3f getSurfaceNormal(const CVector3f& coord) { return (vec - coord).normalized(); }
|
2015-08-29 04:49:19 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct { float x, y, z, r; };
|
|
|
|
float s[4];
|
|
|
|
CVector3f vec;
|
|
|
|
#if __SSE__
|
|
|
|
__m128 mVec128;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
};
|
2015-10-08 00:21:38 +00:00
|
|
|
}
|
2015-08-29 04:49:19 +00:00
|
|
|
|
|
|
|
#endif
|