2017-01-30 02:15:21 +00:00
|
|
|
#ifndef __URDE_CCAMERASPLINE_HPP__
|
|
|
|
#define __URDE_CCAMERASPLINE_HPP__
|
|
|
|
|
|
|
|
#include "World/CEntityInfo.hpp"
|
2017-10-25 07:47:49 +00:00
|
|
|
#include "zeus/CVector3f.hpp"
|
2017-01-30 02:15:21 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CStateManager;
|
2018-06-26 05:24:31 +00:00
|
|
|
class CMaterialFilter;
|
|
|
|
|
2017-01-30 02:15:21 +00:00
|
|
|
class CCameraSpline
|
|
|
|
{
|
2017-10-09 02:41:50 +00:00
|
|
|
friend class CBallCamera;
|
2017-10-10 03:50:48 +00:00
|
|
|
std::vector<zeus::CVector3f> x4_positions;
|
2017-10-14 06:34:57 +00:00
|
|
|
std::vector<TUniqueId> x14_wpTracker;
|
2017-10-13 07:19:22 +00:00
|
|
|
std::vector<float> x24_t;
|
2017-10-10 03:50:48 +00:00
|
|
|
std::vector<zeus::CVector3f> x34_directions;
|
2017-10-13 07:19:22 +00:00
|
|
|
float x44_length = 0.f;
|
|
|
|
bool x48_closedLoop = false;
|
|
|
|
bool GetSurroundingPoints(int idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
|
|
|
|
rstl::reserved_vector<zeus::CVector3f, 4>& directions) const;
|
2017-01-30 02:15:21 +00:00
|
|
|
public:
|
2018-06-26 05:42:16 +00:00
|
|
|
CCameraSpline(bool closedLoop);
|
2017-01-30 02:15:21 +00:00
|
|
|
void CalculateKnots(TUniqueId, const std::vector<SConnection>&, CStateManager&);
|
|
|
|
void Initialize(TUniqueId, const std::vector<SConnection>&, CStateManager&);
|
2017-10-09 02:41:50 +00:00
|
|
|
void Reset(int size);
|
2017-10-10 03:50:48 +00:00
|
|
|
void AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir);
|
|
|
|
void SetKnotPosition(int idx, const zeus::CVector3f& pos);
|
2017-10-13 07:19:22 +00:00
|
|
|
const zeus::CVector3f& GetKnotPosition(int idx) const;
|
|
|
|
float GetKnotT(int idx) const;
|
2017-10-09 02:41:50 +00:00
|
|
|
float CalculateSplineLength();
|
2017-10-13 07:19:22 +00:00
|
|
|
void UpdateSplineLength() { x44_length = CalculateSplineLength(); }
|
2017-10-15 05:38:10 +00:00
|
|
|
zeus::CTransform GetInterpolatedSplinePointByLength(float pos) const;
|
|
|
|
zeus::CVector3f GetInterpolatedSplinePointByTime(float time, float range) const;
|
2018-06-26 05:24:31 +00:00
|
|
|
float FindClosestLengthOnSpline(float time, const zeus::CVector3f& p) const;
|
|
|
|
float ValidateLength(float t) const;
|
|
|
|
float ClampLength(const zeus::CVector3f& pos, bool collide,
|
|
|
|
const CMaterialFilter& filter, const CStateManager& mgr) const;
|
2018-06-25 01:02:29 +00:00
|
|
|
s32 GetSize() const { return x4_positions.size(); }
|
|
|
|
float GetLength() const { return x44_length; }
|
2018-06-26 05:24:31 +00:00
|
|
|
bool IsClosedLoop() const { return x48_closedLoop; }
|
2017-01-30 02:15:21 +00:00
|
|
|
};
|
2018-06-26 05:24:31 +00:00
|
|
|
|
2017-01-30 02:15:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CCAMERASPLINE_HPP__
|