1
0
forked from 0ad/0ad

Removes unused methods and hides private member.

Commented By: elexis
Differential Revision: https://code.wildfiregames.com/D2342
This was SVN commit r23025.
This commit is contained in:
Vladislav Belov 2019-10-01 21:11:29 +00:00
parent f1395c947a
commit 45a18c652d
2 changed files with 28 additions and 22 deletions

View File

@ -119,7 +119,7 @@ public:
double delta = (m_Target - m_Current) * (1.0 - p);
m_Current += delta;
return (float)delta;
return static_cast<float>(delta);
}
void ClampSmoothly(float min, float max)
@ -139,9 +139,19 @@ public:
m_Target = t;
}
float m_Smoothness;
float GetSmoothness() const
{
return m_Smoothness;
}
void SetSmoothness(float smoothness)
{
m_Smoothness = smoothness;
}
private:
float m_Smoothness;
double m_Target; // the value which m_Current is tending towards
double m_Current;
// (We use double because the extra precision is worthwhile here)
@ -438,12 +448,20 @@ int CGameView::Initialize()
CFG_GET_VAL("view.height.smoothness", m->HeightSmoothness);
CFG_GET_VAL("view.height.min", m->HeightMin);
CFG_GET_VAL("view.pos.smoothness", m->PosX.m_Smoothness);
CFG_GET_VAL("view.pos.smoothness", m->PosY.m_Smoothness);
CFG_GET_VAL("view.pos.smoothness", m->PosZ.m_Smoothness);
CFG_GET_VAL("view.zoom.smoothness", m->Zoom.m_Smoothness);
CFG_GET_VAL("view.rotate.x.smoothness", m->RotateX.m_Smoothness);
CFG_GET_VAL("view.rotate.y.smoothness", m->RotateY.m_Smoothness);
#define SETUP_SMOOTHNESS(CFG_PREFIX, SMOOTHED_VALUE) \
{ \
float smoothness = SMOOTHED_VALUE.GetSmoothness(); \
CFG_GET_VAL(CFG_PREFIX ".smoothness", smoothness); \
SMOOTHED_VALUE.SetSmoothness(smoothness); \
}
SETUP_SMOOTHNESS("view.pos", m->PosX);
SETUP_SMOOTHNESS("view.pos", m->PosY);
SETUP_SMOOTHNESS("view.pos", m->PosZ);
SETUP_SMOOTHNESS("view.zoom", m->Zoom);
SETUP_SMOOTHNESS("view.rotate.x", m->RotateX);
SETUP_SMOOTHNESS("view.rotate.y", m->RotateY);
#undef SETUP_SMOOTHNESS
CFG_GET_VAL("view.near", m->ViewNear);
CFG_GET_VAL("view.far", m->ViewFar);
@ -723,7 +741,7 @@ void CGameView::Update(const float deltaRealTime)
cmpPosition->GetInterpolatedPosition2D(frameOffset, x, z, angle);
float height = 4.f;
m->ViewCamera.m_Orientation.SetIdentity();
m->ViewCamera.m_Orientation.RotateX((float)M_PI/24.f);
m->ViewCamera.m_Orientation.RotateX(static_cast<float>(M_PI) / 24.f);
m->ViewCamera.m_Orientation.RotateY(angle);
m->ViewCamera.m_Orientation.Translate(pos.X, pos.Y + height, pos.Z);
@ -881,7 +899,7 @@ void CGameView::Update(const float deltaRealTime)
}
*/
m->RotateY.Wrap(-(float)M_PI, (float)M_PI);
m->RotateY.Wrap(-static_cast<float>(M_PI), static_cast<float>(M_PI));
// Update the camera matrix
SetCameraProjection();
@ -1003,16 +1021,6 @@ entity_id_t CGameView::GetFollowedEntity()
return m->FollowEntity;
}
float CGameView::GetNear() const
{
return m->ViewNear;
}
float CGameView::GetFar() const
{
return m->ViewFar;
}
void CGameView::SetCameraProjection()
{
m->ViewCamera.SetPerspectiveProjection(m->ViewNear, m->ViewFar, m->ViewFOV);

View File

@ -61,8 +61,6 @@ public:
CVector3D GetCameraPosition() const;
CVector3D GetCameraRotation() const;
float GetCameraZoom() const;
float GetNear() const;
float GetFar() const;
void SetCamera(const CVector3D& pos, float rotX, float rotY, float zoom);
void MoveCameraTarget(const CVector3D& target);