1
0
forked from 0ad/0ad

Play cinematic paths on arbitrary cameras to prepare previews of the camera frustum in atlas. Patch by Vladislav, refs #3814.

This was SVN commit r18992.
This commit is contained in:
elexis 2016-11-23 14:50:47 +00:00
parent 417c84870c
commit 808dd347b6
3 changed files with 8 additions and 7 deletions

View File

@ -172,7 +172,8 @@ void CCinemaManager::Update(const float deltaRealTime)
// TODO: implement skip
}
m_CinematicSimulationData.m_PathQueue.front().Play(deltaRealTime);
CCamera *camera = g_Game->GetView()->GetCamera();
m_CinematicSimulationData.m_PathQueue.front().Play(deltaRealTime, camera);
}
void CCinemaManager::Render()

View File

@ -217,9 +217,8 @@ void CCinemaPath::SetTimescale(fixed scale)
m_Timescale = scale;
}
void CCinemaPath::MoveToPointAt(float t, float nodet, const CVector3D& startRotation)
void CCinemaPath::MoveToPointAt(float t, float nodet, const CVector3D& startRotation, CCamera* camera)
{
CCamera *camera = g_Game->GetView()->GetCamera();
t = (this->*DistModePtr)(t);
CVector3D pos = GetPosition(t);
@ -341,13 +340,13 @@ bool CCinemaPath::Validate()
return false;
}
bool CCinemaPath::Play(const float deltaRealTime)
bool CCinemaPath::Play(const float deltaRealTime, CCamera* camera)
{
m_TimeElapsed += m_Timescale.ToFloat() * deltaRealTime;
if (!Validate())
return false;
MoveToPointAt(m_TimeElapsed / GetDuration().ToFloat(), GetNodeFraction(), m_PreviousRotation);
MoveToPointAt(m_TimeElapsed / GetDuration().ToFloat(), GetNodeFraction(), m_PreviousRotation, camera);
return true;
}

View File

@ -61,7 +61,7 @@ public:
CCinemaPath(const CCinemaData& data, const TNSpline& spline, const TNSpline& targetSpline);
// Sets camera position to calculated point on spline
void MoveToPointAt(float t, float nodet, const CVector3D&);
void MoveToPointAt(float t, float nodet, const CVector3D& startRotation, CCamera* camera);
// Distortion mode functions-change how ratio is passed to distortion style functions
float EaseIn(float t) const;
@ -109,8 +109,9 @@ public:
/**
* Returns false if finished.
* @param deltaRealTime Elapsed real time since the last frame.
* @param camera An affected camera
*/
bool Play(const float deltaRealTime);
bool Play(const float deltaRealTime, CCamera* camera);
/**
* Validate the path