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

View File

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