Major scoped-enum refactor

This commit is contained in:
Jack Andersen 2015-11-20 15:14:10 -10:00
parent fca8742f99
commit b757bcd368
3 changed files with 25 additions and 25 deletions

View File

@ -19,7 +19,7 @@ class alignas(16) CAABox
public:
ZE_DECLARE_ALIGNED_ALLOCATOR();
enum EBoxEdgeId
enum class EBoxEdgeId
{
UnknownEdge0,
UnknownEdge1,
@ -35,7 +35,7 @@ public:
UnknownEdge11
};
enum EBoxFaceID
enum class EBoxFaceID
{
};
@ -160,40 +160,40 @@ public:
{
switch (id)
{
case UnknownEdge0:
case EBoxEdgeId::UnknownEdge0:
return CLine({m_min.x, m_min.y, m_min.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},
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},
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},
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},
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},
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},
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},
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},
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},
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},
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},
CUnitVector3f({m_max.x, m_min.y, m_max.z}));
default:

View File

@ -9,11 +9,11 @@
#include <math.h>
namespace Zeus
{
enum EProjType
enum class EProjType
{
PROJ_NONE = 0,
PROJ_ORTHO = 1,
PROJ_PERSP = 2
None = 0,
Orthographic = 1,
Perspective = 2
};
struct SProjOrtho
{
@ -38,7 +38,7 @@ public:
CProjection()
{
m_projType = PROJ_ORTHO;
m_projType = EProjType::Orthographic;
m_ortho = SProjOrtho();
m_mtx = CMatrix4f::skIdentityMatrix4f;
}
@ -58,14 +58,14 @@ public:
}
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)
{m_projType = PROJ_PERSP; m_persp = persp; _updateCachedMatrix();}
{m_projType = EProjType::Perspective; m_persp = persp; _updateCachedMatrix();}
inline EProjType getType() const {return m_projType;}
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");
abort();
@ -74,7 +74,7 @@ public:
}
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");
abort();

View File

@ -6,7 +6,7 @@ namespace Zeus
{
void CProjection::_updateCachedMatrix()
{
if (m_projType == PROJ_ORTHO)
if (m_projType == EProjType::Orthographic)
{
float tmp;
@ -33,7 +33,7 @@ void CProjection::_updateCachedMatrix()
m_mtx.m[2][3] = 0.0f;
m_mtx.m[3][3] = 1.0f;
}
else if (m_projType == PROJ_PERSP)
else if (m_projType == EProjType::Perspective)
{
float cot,tmp;
float t_fovy = tanf(m_persp.m_fov / 2.0);