Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/CinemaPath.cpp
/* Copyright (C) 2016 Wildfire Games. | /* Copyright (C) 2017 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
Show All 27 Lines | |||||
#include "ps/CStr.h" | #include "ps/CStr.h" | ||||
#include "ps/Game.h" | #include "ps/Game.h" | ||||
#include "renderer/Renderer.h" | #include "renderer/Renderer.h" | ||||
CCinemaPath::CCinemaPath(const CCinemaData& data, const TNSpline& spline, const TNSpline& targetSpline) | CCinemaPath::CCinemaPath(const CCinemaData& data, const TNSpline& spline, const TNSpline& targetSpline) | ||||
: CCinemaData(data), TNSpline(spline), m_TargetSpline(targetSpline), m_TimeElapsed(0.f) | : CCinemaData(data), TNSpline(spline), m_TargetSpline(targetSpline), m_TimeElapsed(0.f) | ||||
{ | { | ||||
m_TimeElapsed = 0; | |||||
// Calculate curves by nodes | // Calculate curves by nodes | ||||
BuildSpline(); | BuildSpline(); | ||||
m_TargetSpline.BuildSpline(); | m_TargetSpline.BuildSpline(); | ||||
if (m_Orientation == L"target") | if (m_Orientation == L"target") | ||||
{ | { | ||||
m_LookAtTarget = true; | m_LookAtTarget = true; | ||||
ENSURE(!m_TargetSpline.GetAllNodes().empty()); | ENSURE(!m_TargetSpline.GetAllNodes().empty()); | ||||
▲ Show 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | CStrW CCinemaPath::GetName() const | ||||
return m_Name; | return m_Name; | ||||
} | } | ||||
void CCinemaPath::SetTimescale(fixed scale) | void CCinemaPath::SetTimescale(fixed scale) | ||||
{ | { | ||||
m_Timescale = scale; | m_Timescale = scale; | ||||
} | } | ||||
void CCinemaPath::MoveToPointAt(float t, float nodet, const CVector3D& startRotation, CCamera* camera) | void CCinemaPath::MoveToPointAt(float t, float nodet, const CVector3D& startRotation, CCamera* camera) const | ||||
{ | { | ||||
t = (this->*DistModePtr)(t); | t = (this->*DistModePtr)(t); | ||||
CVector3D pos = GetPosition(t); | CVector3D pos = GetPosition(t); | ||||
if (m_LookAtTarget) | if (m_LookAtTarget) | ||||
{ | { | ||||
if (m_TimeElapsed <= m_TargetSpline.MaxDistance.ToFloat()) | if (m_TimeElapsed <= m_TargetSpline.MaxDistance.ToFloat()) | ||||
▲ Show 20 Lines • Show All 143 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator