mirror of https://github.com/AxioDL/zeus.git
Major scoped-enum refactor
This commit is contained in:
parent
fca8742f99
commit
b757bcd368
|
@ -19,7 +19,7 @@ class alignas(16) CAABox
|
||||||
public:
|
public:
|
||||||
ZE_DECLARE_ALIGNED_ALLOCATOR();
|
ZE_DECLARE_ALIGNED_ALLOCATOR();
|
||||||
|
|
||||||
enum EBoxEdgeId
|
enum class EBoxEdgeId
|
||||||
{
|
{
|
||||||
UnknownEdge0,
|
UnknownEdge0,
|
||||||
UnknownEdge1,
|
UnknownEdge1,
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
UnknownEdge11
|
UnknownEdge11
|
||||||
};
|
};
|
||||||
|
|
||||||
enum EBoxFaceID
|
enum class EBoxFaceID
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -160,40 +160,40 @@ public:
|
||||||
{
|
{
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case UnknownEdge0:
|
case EBoxEdgeId::UnknownEdge0:
|
||||||
return CLine({m_min.x, m_min.y, m_min.z},
|
return CLine({m_min.x, m_min.y, m_min.z},
|
||||||
CUnitVector3f({m_min.x, m_min.y, m_max.z}));
|
CUnitVector3f({m_min.x, m_min.y, m_max.z}));
|
||||||
case UnknownEdge1:
|
case EBoxEdgeId::UnknownEdge1:
|
||||||
return CLine({m_max.x, m_min.y, m_min.z},
|
return CLine({m_max.x, m_min.y, m_min.z},
|
||||||
CUnitVector3f({m_min.x, m_min.y, m_min.z}));
|
CUnitVector3f({m_min.x, m_min.y, m_min.z}));
|
||||||
case UnknownEdge2:
|
case EBoxEdgeId::UnknownEdge2:
|
||||||
return CLine({m_max.x, m_min.y, m_max.z},
|
return CLine({m_max.x, m_min.y, m_max.z},
|
||||||
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
|
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
|
||||||
case UnknownEdge3:
|
case EBoxEdgeId::UnknownEdge3:
|
||||||
return CLine({m_min.x, m_min.y, m_max.z},
|
return CLine({m_min.x, m_min.y, m_max.z},
|
||||||
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
|
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
|
||||||
case UnknownEdge4:
|
case EBoxEdgeId::UnknownEdge4:
|
||||||
return CLine({m_max.x, m_max.y, m_min.z},
|
return CLine({m_max.x, m_max.y, m_min.z},
|
||||||
CUnitVector3f({m_max.x, m_max.y, m_max.z}));
|
CUnitVector3f({m_max.x, m_max.y, m_max.z}));
|
||||||
case UnknownEdge5:
|
case EBoxEdgeId::UnknownEdge5:
|
||||||
return CLine({m_min.x, m_max.y, m_min.z},
|
return CLine({m_min.x, m_max.y, m_min.z},
|
||||||
CUnitVector3f({m_max.x, m_max.y, m_min.z}));
|
CUnitVector3f({m_max.x, m_max.y, m_min.z}));
|
||||||
case UnknownEdge6:
|
case EBoxEdgeId::UnknownEdge6:
|
||||||
return CLine({m_min.x, m_max.y, m_max.z},
|
return CLine({m_min.x, m_max.y, m_max.z},
|
||||||
CUnitVector3f({m_min.x, m_max.y, m_min.z}));
|
CUnitVector3f({m_min.x, m_max.y, m_min.z}));
|
||||||
case UnknownEdge7:
|
case EBoxEdgeId::UnknownEdge7:
|
||||||
return CLine({m_max.x, m_max.y, m_max.z},
|
return CLine({m_max.x, m_max.y, m_max.z},
|
||||||
CUnitVector3f({m_min.x, m_max.y, m_max.z}));
|
CUnitVector3f({m_min.x, m_max.y, m_max.z}));
|
||||||
case UnknownEdge8:
|
case EBoxEdgeId::UnknownEdge8:
|
||||||
return CLine({m_min.x, m_max.y, m_max.z},
|
return CLine({m_min.x, m_max.y, m_max.z},
|
||||||
CUnitVector3f({m_min.x, m_min.y, m_max.z}));
|
CUnitVector3f({m_min.x, m_min.y, m_max.z}));
|
||||||
case UnknownEdge9:
|
case EBoxEdgeId::UnknownEdge9:
|
||||||
return CLine({m_min.x, m_max.y, m_min.z},
|
return CLine({m_min.x, m_max.y, m_min.z},
|
||||||
CUnitVector3f({m_min.x, m_min.y, m_min.z}));
|
CUnitVector3f({m_min.x, m_min.y, m_min.z}));
|
||||||
case UnknownEdge10:
|
case EBoxEdgeId::UnknownEdge10:
|
||||||
return CLine({m_max.x, m_max.y, m_min.z},
|
return CLine({m_max.x, m_max.y, m_min.z},
|
||||||
CUnitVector3f({m_max.x, m_min.y, m_min.z}));
|
CUnitVector3f({m_max.x, m_min.y, m_min.z}));
|
||||||
case UnknownEdge11:
|
case EBoxEdgeId::UnknownEdge11:
|
||||||
return CLine({m_max.x, m_max.y, m_max.z},
|
return CLine({m_max.x, m_max.y, m_max.z},
|
||||||
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
|
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -9,11 +9,11 @@
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
namespace Zeus
|
namespace Zeus
|
||||||
{
|
{
|
||||||
enum EProjType
|
enum class EProjType
|
||||||
{
|
{
|
||||||
PROJ_NONE = 0,
|
None = 0,
|
||||||
PROJ_ORTHO = 1,
|
Orthographic = 1,
|
||||||
PROJ_PERSP = 2
|
Perspective = 2
|
||||||
};
|
};
|
||||||
struct SProjOrtho
|
struct SProjOrtho
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
|
|
||||||
CProjection()
|
CProjection()
|
||||||
{
|
{
|
||||||
m_projType = PROJ_ORTHO;
|
m_projType = EProjType::Orthographic;
|
||||||
m_ortho = SProjOrtho();
|
m_ortho = SProjOrtho();
|
||||||
m_mtx = CMatrix4f::skIdentityMatrix4f;
|
m_mtx = CMatrix4f::skIdentityMatrix4f;
|
||||||
}
|
}
|
||||||
|
@ -58,14 +58,14 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setOrtho(const SProjOrtho& ortho)
|
inline void setOrtho(const SProjOrtho& ortho)
|
||||||
{m_projType = PROJ_ORTHO; m_ortho = ortho; _updateCachedMatrix();}
|
{m_projType = EProjType::Orthographic; m_ortho = ortho; _updateCachedMatrix();}
|
||||||
inline void setPersp(const SProjPersp& persp)
|
inline void setPersp(const SProjPersp& persp)
|
||||||
{m_projType = PROJ_PERSP; m_persp = persp; _updateCachedMatrix();}
|
{m_projType = EProjType::Perspective; m_persp = persp; _updateCachedMatrix();}
|
||||||
|
|
||||||
inline EProjType getType() const {return m_projType;}
|
inline EProjType getType() const {return m_projType;}
|
||||||
inline const SProjOrtho& getOrtho() const
|
inline const SProjOrtho& getOrtho() const
|
||||||
{
|
{
|
||||||
if (m_projType != PROJ_ORTHO)
|
if (m_projType != EProjType::Orthographic)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "attempted to access orthographic structure of non-ortho projection");
|
fprintf(stderr, "attempted to access orthographic structure of non-ortho projection");
|
||||||
abort();
|
abort();
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
}
|
}
|
||||||
inline const SProjPersp& getPersp() const
|
inline const SProjPersp& getPersp() const
|
||||||
{
|
{
|
||||||
if (m_projType != PROJ_PERSP)
|
if (m_projType != EProjType::Perspective)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "attempted to access perspective structure of non-persp projection");
|
fprintf(stderr, "attempted to access perspective structure of non-persp projection");
|
||||||
abort();
|
abort();
|
||||||
|
|
|
@ -6,7 +6,7 @@ namespace Zeus
|
||||||
{
|
{
|
||||||
void CProjection::_updateCachedMatrix()
|
void CProjection::_updateCachedMatrix()
|
||||||
{
|
{
|
||||||
if (m_projType == PROJ_ORTHO)
|
if (m_projType == EProjType::Orthographic)
|
||||||
{
|
{
|
||||||
float tmp;
|
float tmp;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ void CProjection::_updateCachedMatrix()
|
||||||
m_mtx.m[2][3] = 0.0f;
|
m_mtx.m[2][3] = 0.0f;
|
||||||
m_mtx.m[3][3] = 1.0f;
|
m_mtx.m[3][3] = 1.0f;
|
||||||
}
|
}
|
||||||
else if (m_projType == PROJ_PERSP)
|
else if (m_projType == EProjType::Perspective)
|
||||||
{
|
{
|
||||||
float cot,tmp;
|
float cot,tmp;
|
||||||
float t_fovy = tanf(m_persp.m_fov / 2.0);
|
float t_fovy = tanf(m_persp.m_fov / 2.0);
|
||||||
|
|
Loading…
Reference in New Issue