Camera smoothness adjustment

dev-time-step
krzys-h 2016-01-30 10:37:39 +01:00
parent f3820bc81a
commit d9ccd6edf3
2 changed files with 7 additions and 19 deletions

View File

@ -124,13 +124,11 @@ CCamera::CCamera()
m_visitDist = 0.0f; m_visitDist = 0.0f;
m_visitTime = 0.0f; m_visitTime = 0.0f;
m_visitType = CAM_TYPE_NULL; m_visitType = CAM_TYPE_NULL;
m_visitDirectionH = 0.0f;
m_visitDirectionV = 0.0f; m_visitDirectionV = 0.0f;
m_editHeight = 40.0f; m_editHeight = 40.0f;
m_remotePan = 0.0f; m_remotePan = 0.0f;
m_remoteZoom = 0.0f;
m_mouseDirH = 0.0f; m_mouseDirH = 0.0f;
m_mouseDirV = 0.0f; m_mouseDirV = 0.0f;
@ -156,7 +154,7 @@ CCamera::CCamera()
m_overType = CAM_OVER_EFFECT_NULL; m_overType = CAM_OVER_EFFECT_NULL;
m_overForce = 0.0f; m_overForce = 0.0f;
m_overTime = 0.0f; m_overTime = 0.0f;
m_overMode = 0.0f; m_overMode = 0;
m_overFadeIn = 0.0f; m_overFadeIn = 0.0f;
m_overFadeOut = 0.0f; m_overFadeOut = 0.0f;
@ -262,7 +260,6 @@ void CCamera::Init(Math::Vector eye, Math::Vector lookat, float delay)
m_scriptLookat = m_actualLookat; m_scriptLookat = m_actualLookat;
m_focus = 1.00f; m_focus = 1.00f;
m_remotePan = 0.0f; m_remotePan = 0.0f;
m_remoteZoom = 0.0f;
FlushEffect(); FlushEffect();
FlushOver(); FlushOver();
@ -283,7 +280,6 @@ CObject* CCamera::GetControllingObject()
void CCamera::SetType(CameraType type) void CCamera::SetType(CameraType type)
{ {
m_remotePan = 0.0f; m_remotePan = 0.0f;
m_remoteZoom = 0.0f;
if ( (m_type == CAM_TYPE_BACK) && m_transparency ) if ( (m_type == CAM_TYPE_BACK) && m_transparency )
{ {
@ -406,7 +402,7 @@ void CCamera::SetSmooth(CameraSmooth type)
m_smooth = type; m_smooth = type;
} }
CameraSmooth CCamera::GetSmoth() CameraSmooth CCamera::GetSmooth()
{ {
return m_smooth; return m_smooth;
} }
@ -482,7 +478,6 @@ void CCamera::StartVisit(Math::Vector goal, float dist)
m_visitGoal = goal; m_visitGoal = goal;
m_visitDist = dist; m_visitDist = dist;
m_visitTime = 0.0f; m_visitTime = 0.0f;
m_visitDirectionH = 0.0f;
m_visitDirectionV = -Math::PI*0.10f; m_visitDirectionV = -Math::PI*0.10f;
} }
@ -891,9 +886,8 @@ void CCamera::SetViewTime(const Math::Vector &eyePt,
float dist = Math::Distance(m_finalEye, m_actualEye); float dist = Math::Distance(m_finalEye, m_actualEye);
if (m_smooth == CAM_SMOOTH_NONE) prog = dist; if (m_smooth == CAM_SMOOTH_NONE) prog = dist;
if (m_smooth == CAM_SMOOTH_NORM) prog = powf(dist, 1.5f) * rTime * 0.5f; if (m_smooth == CAM_SMOOTH_NORM) prog = dist * rTime * 3.0f;
if (m_smooth == CAM_SMOOTH_HARD) prog = powf(dist, 1.0f) * rTime * 4.0f; if (m_smooth == CAM_SMOOTH_HARD) prog = dist * rTime * 4.0f;
if (m_smooth == CAM_SMOOTH_SPEC) prog = powf(dist, 1.0f) * rTime * 0.05f;
if (dist == 0.0f) if (dist == 0.0f)
{ {
m_actualEye = m_finalEye; m_actualEye = m_finalEye;
@ -907,9 +901,8 @@ void CCamera::SetViewTime(const Math::Vector &eyePt,
dist = Math::Distance(m_finalLookat, m_actualLookat); dist = Math::Distance(m_finalLookat, m_actualLookat);
if ( m_smooth == CAM_SMOOTH_NONE ) prog = dist; if ( m_smooth == CAM_SMOOTH_NONE ) prog = dist;
if ( m_smooth == CAM_SMOOTH_NORM ) prog = powf(dist, 1.5f) * rTime * 2.0f; if ( m_smooth == CAM_SMOOTH_NORM ) prog = dist * rTime * 6.0f;
if ( m_smooth == CAM_SMOOTH_HARD ) prog = powf(dist, 1.0f) * rTime * 4.0f; if ( m_smooth == CAM_SMOOTH_HARD ) prog = dist * rTime * 4.0f;
if ( m_smooth == CAM_SMOOTH_SPEC ) prog = powf(dist, 1.0f) * rTime * 4.0f;
if ( dist == 0.0f ) if ( dist == 0.0f )
{ {
m_actualLookat = m_finalLookat; m_actualLookat = m_finalLookat;

View File

@ -77,8 +77,6 @@ enum CameraSmooth
CAM_SMOOTH_NORM = 1, CAM_SMOOTH_NORM = 1,
//! Hard //! Hard
CAM_SMOOTH_HARD = 2, CAM_SMOOTH_HARD = 2,
//! Special
CAM_SMOOTH_SPEC = 3,
}; };
enum CenteringPhase enum CenteringPhase
@ -151,7 +149,7 @@ public:
//! Management of the smoothing mode //! Management of the smoothing mode
void SetSmooth(CameraSmooth type); void SetSmooth(CameraSmooth type);
CameraSmooth GetSmoth(); CameraSmooth GetSmooth();
//! Management of the setback distance //! Management of the setback distance
void SetDist(float dist); void SetDist(float dist);
@ -347,15 +345,12 @@ protected:
//! CAM_TYPE_VISIT: initial type //! CAM_TYPE_VISIT: initial type
CameraType m_visitType; CameraType m_visitType;
//! CAM_TYPE_VISIT: direction //! CAM_TYPE_VISIT: direction
float m_visitDirectionH;
//! CAM_TYPE_VISIT: direction
float m_visitDirectionV; float m_visitDirectionV;
//! CAM_TYPE_EDIT: height //! CAM_TYPE_EDIT: height
float m_editHeight; float m_editHeight;
float m_remotePan; float m_remotePan;
float m_remoteZoom;
Math::Point m_mousePos; Math::Point m_mousePos;
float m_mouseDirH; float m_mouseDirH;