CCamera: Make use of in-class initializers

Same behavior, less code.
This commit is contained in:
Lioncash 2020-06-18 13:32:44 -04:00
parent 46e5056ba7
commit 7177295cbb
2 changed files with 12 additions and 26 deletions

View File

@ -4,17 +4,7 @@
#include <Common/Math/MathUtil.h>
CCamera::CCamera()
: mMode(ECameraMoveMode::Free)
, mPosition(0)
, mAspectRatio(1.7777777f)
, mYaw(-Math::skHalfPi)
, mPitch(0.f)
, mMoveSpeed(1.f)
, mLookSpeed(1.f)
, mTransformDirty(true)
, mViewDirty(true)
, mProjectionDirty(true)
, mFrustumPlanesDirty(true)
: mYaw(-Math::skHalfPi)
{
ResetOrbit();
}
@ -22,12 +12,8 @@ CCamera::CCamera()
// todo: make it actually look at the target!
// don't actually use this constructor, it's unfinished and won't work properly
CCamera::CCamera(CVector3f Position, CVector3f /*Target*/)
: mMode(ECameraMoveMode::Free)
, mPosition(Position)
: mPosition(Position)
, mYaw(-Math::skHalfPi)
, mPitch(0.f)
, mMoveSpeed(1.f)
, mLookSpeed(1.f)
{
}

View File

@ -26,28 +26,28 @@ enum class ECameraMoveMode
* const function). */
class CCamera
{
ECameraMoveMode mMode;
ECameraMoveMode mMode{ECameraMoveMode::Free};
mutable CVector3f mPosition;
mutable CVector3f mDirection;
mutable CVector3f mRightVector;
mutable CVector3f mUpVector;
float mAspectRatio;
float mAspectRatio = 1.7777777f;
float mYaw;
float mPitch;
float mPitch = 0.0f;
CVector3f mOrbitTarget;
mutable float mOrbitDistance;
float mMoveSpeed;
float mLookSpeed;
mutable float mOrbitDistance = 0.0f;
float mMoveSpeed = 1.0f;
float mLookSpeed = 1.0f;
mutable CMatrix4f mViewMatrix;
mutable CMatrix4f mProjectionMatrix;
mutable CFrustumPlanes mFrustumPlanes;
mutable bool mTransformDirty;
mutable bool mViewDirty;
mutable bool mProjectionDirty;
mutable bool mFrustumPlanesDirty;
mutable bool mTransformDirty = true;
mutable bool mViewDirty = true;
mutable bool mProjectionDirty = true;
mutable bool mFrustumPlanesDirty = true;
public:
CCamera();