2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2017-01-29 18:15:21 -08:00
|
|
|
|
|
|
|
#include "World/CEntityInfo.hpp"
|
2017-10-25 00:47:49 -07:00
|
|
|
#include "zeus/CVector3f.hpp"
|
2017-01-29 18:15:21 -08:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2017-01-29 18:15:21 -08:00
|
|
|
class CStateManager;
|
2018-06-25 22:24:31 -07:00
|
|
|
class CMaterialFilter;
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CCameraSpline {
|
|
|
|
friend class CBallCamera;
|
|
|
|
std::vector<zeus::CVector3f> x4_positions;
|
|
|
|
std::vector<TUniqueId> x14_wpTracker;
|
|
|
|
std::vector<float> x24_t;
|
|
|
|
std::vector<zeus::CVector3f> x34_directions;
|
|
|
|
float x44_length = 0.f;
|
|
|
|
bool x48_closedLoop = false;
|
2020-04-06 09:46:28 -07:00
|
|
|
bool GetSurroundingPoints(size_t idx, rstl::reserved_vector<zeus::CVector3f, 4>& positions,
|
2018-12-07 21:30:43 -08:00
|
|
|
rstl::reserved_vector<zeus::CVector3f, 4>& directions) const;
|
|
|
|
|
2017-01-29 18:15:21 -08:00
|
|
|
public:
|
2020-03-24 23:40:51 -07:00
|
|
|
explicit CCameraSpline(bool closedLoop);
|
2020-03-24 23:40:00 -07:00
|
|
|
void CalculateKnots(TUniqueId cameraId, const std::vector<SConnection>& connections, CStateManager& mgr);
|
|
|
|
void Initialize(TUniqueId cameraId, const std::vector<SConnection>& connections, CStateManager& mgr);
|
2020-04-06 09:46:28 -07:00
|
|
|
void Reset(size_t size);
|
2018-12-07 21:30:43 -08:00
|
|
|
void AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir);
|
2020-04-06 09:46:28 -07:00
|
|
|
void SetKnotPosition(size_t idx, const zeus::CVector3f& pos);
|
|
|
|
const zeus::CVector3f& GetKnotPosition(size_t idx) const;
|
|
|
|
float GetKnotT(size_t idx) const;
|
2018-12-07 21:30:43 -08:00
|
|
|
float CalculateSplineLength();
|
|
|
|
void UpdateSplineLength() { x44_length = CalculateSplineLength(); }
|
|
|
|
zeus::CTransform GetInterpolatedSplinePointByLength(float pos) const;
|
|
|
|
zeus::CVector3f GetInterpolatedSplinePointByTime(float time, float range) const;
|
|
|
|
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;
|
|
|
|
s32 GetSize() const { return x4_positions.size(); }
|
|
|
|
float GetLength() const { return x44_length; }
|
|
|
|
bool IsClosedLoop() const { return x48_closedLoop; }
|
2017-01-29 18:15:21 -08:00
|
|
|
};
|
2018-06-25 22:24:31 -07:00
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|