Remove 'far' too annoying name collision

This commit is contained in:
Jack Andersen 2016-09-10 15:23:44 -10:00
parent f4dd896004
commit 0e491fc8f5
3 changed files with 11 additions and 13 deletions

View File

@ -6,8 +6,6 @@
#include <cstdlib>
#include <cstdio>
#include <cmath>
#undef near
#undef far
namespace zeus
{
@ -21,18 +19,18 @@ enum class EProjType
class SProjOrtho
{
public:
float top, bottom, left, right, near, far;
float top, bottom, left, right, znear, zfar;
explicit SProjOrtho(float p_top = 1.0f, float p_bottom = -1.0f, float p_left = -1.0f, float p_right = 1.0f,
float p_near = 1.0f, float p_far = -1.0f)
: top(p_top), bottom(p_bottom), left(p_left), right(p_right), near(p_near), far(p_far)
: top(p_top), bottom(p_bottom), left(p_left), right(p_right), znear(p_near), zfar(p_far)
{
}
};
struct SProjPersp
{
float fov, aspect, near, far;
float fov, aspect, znear, zfar;
SProjPersp(float p_fov = degToRad(55.0f), float p_aspect = 1.0f, float p_near = 0.1f, float p_far = 4096.f)
: fov(p_fov), aspect(p_aspect), near(p_near), far(p_far)
: fov(p_fov), aspect(p_aspect), znear(p_near), zfar(p_far)
{
}
};

View File

@ -217,14 +217,14 @@ class alignas(16) CNUQuaternion : public CQuaternion
public:
CNUQuaternion() = default;
CNUQuaternion(const CMatrix3f& mtx)
: CQuaternion(mtx)
: CQuaternion(mtx)
{
normalize();
}
CNUQuaternion(const CQuaternion& other)
: CQuaternion(other)
{
*this = other;
normalize();
}
};

View File

@ -23,11 +23,11 @@ void CProjection::_updateCachedMatrix()
m_mtx.m[2][1] = 0.0f;
m_mtx.m[3][1] = -(m_ortho.top + m_ortho.bottom) * tmp;
tmp = 1.0f / (m_ortho.far - m_ortho.near);
tmp = 1.0f / (m_ortho.zfar - m_ortho.znear);
m_mtx.m[0][2] = 0.0f;
m_mtx.m[1][2] = 0.0f;
m_mtx.m[2][2] = -(1.0f) * tmp;
m_mtx.m[3][2] = -m_ortho.far * tmp;
m_mtx.m[3][2] = -m_ortho.zfar * tmp;
m_mtx.m[0][3] = 0.0f;
m_mtx.m[1][3] = 0.0f;
@ -51,11 +51,11 @@ void CProjection::_updateCachedMatrix()
m_mtx.m[2][1] = 0.0f;
m_mtx.m[3][1] = 0.0f;
tmp = 1.0f / (m_persp.far - m_persp.near);
tmp = 1.0f / (m_persp.zfar - m_persp.znear);
m_mtx.m[0][2] = 0.0f;
m_mtx.m[1][2] = 0.0f;
m_mtx.m[2][2] = -m_persp.far * tmp;
m_mtx.m[3][2] = -(m_persp.far * m_persp.near) * tmp;
m_mtx.m[2][2] = -m_persp.zfar * tmp;
m_mtx.m[3][2] = -(m_persp.zfar * m_persp.znear) * tmp;
m_mtx.m[0][3] = 0.0f;
m_mtx.m[1][3] = 0.0f;