metaforce/Runtime/Camera/CCameraSpline.hpp

44 lines
1.7 KiB
C++
Raw Normal View History

2018-10-07 03:42:33 +00:00
#pragma once
2017-01-30 02:15:21 +00:00
#include "World/CEntityInfo.hpp"
#include "zeus/CVector3f.hpp"
2017-01-30 02:15:21 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
2017-01-30 02:15:21 +00:00
class CStateManager;
2018-06-26 05:24:31 +00:00
class CMaterialFilter;
2018-12-08 05:30:43 +00: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;
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-12-08 05:30:43 +00:00
CCameraSpline(bool closedLoop);
void CalculateKnots(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Initialize(TUniqueId, const std::vector<SConnection>&, CStateManager&);
void Reset(int size);
void AddKnot(const zeus::CVector3f& pos, const zeus::CVector3f& dir);
void SetKnotPosition(int idx, const zeus::CVector3f& pos);
const zeus::CVector3f& GetKnotPosition(int idx) const;
float GetKnotT(int idx) const;
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-30 02:15:21 +00:00
};
2018-06-26 05:24:31 +00:00
2018-12-08 05:30:43 +00:00
} // namespace urde