1
0
forked from 0ad/0ad

Interpolate cinematic camera rotation + allow more points in cinematic path + add comments. Patch by Vladislav. Refs #3814

This was SVN commit r17975.
This commit is contained in:
sanderd17 2016-04-04 20:31:18 +00:00
parent 46ead523b8
commit 2a11d3ca7b
2 changed files with 27 additions and 6 deletions

View File

@ -43,7 +43,10 @@ CCinemaPath::CCinemaPath(const CCinemaData& data, const TNSpline& spline, const
: CCinemaData(data), TNSpline(spline), m_TargetSpline(targetSpline), m_TimeElapsed(0.f)
{
m_TimeElapsed = 0;
// Calculate curves by nodes
BuildSpline();
m_TargetSpline.BuildSpline();
if (m_Orientation == L"target")
{

View File

@ -15,19 +15,23 @@
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
//Desc: Contains classes for smooth splines
//Borrowed from Game Programming Gems4. (Slightly changed to better suit our purposes
//(and compatability). Any references to external material can be found there
/**
* Contains classes for smooth splines
* Borrowed from Game Programming Gems 4. (Slightly changed to better suit our purposes
* and compatability. Any references to external material can be found there.
*/
#ifndef INCLUDED_NUSPLINE
#define INCLUDED_NUSPLINE
#define MAX_SPLINE_NODES 40
#include <stdlib.h>
#define MAX_SPLINE_NODES 128
#include "FixedVector3D.h"
#include "Vector3D.h"
/**
* Describes a node of the spline
*/
struct SplineData
{
// Should be fixed, because used in the simulation
@ -35,9 +39,14 @@ struct SplineData
CVector3D Velocity;
// TODO: make rotation as other spline
CFixedVector3D Rotation;
fixed Distance/*, DistanceOffset*/; //DistanceOffset is to keep track of how far into the spline this node is
// Time interval to the previous node, should be 0 for the first node
fixed Distance;
};
/**
* Rounded Nonuniform Spline for describing spatial curves or paths with constant speed
*/
class RNSpline
{
public:
@ -61,6 +70,11 @@ protected:
CVector3D GetEndVelocity(int index);
};
/**
* Smooth Nonuniform Spline for describing paths with smooth acceleration and deceleration,
* but without turning
*/
class SNSpline : public RNSpline
{
public:
@ -69,6 +83,10 @@ public:
void Smooth();
};
/**
* Timed Nonuniform Spline for paths with different time intervals between nodes
*/
class TNSpline : public SNSpline
{
public: