18 ChangingDirection = 2,
24 virtual void init(f32 t,
u32 idx) = 0;
25 virtual Status calc() = 0;
26 virtual void setCurrVel(f32 speed) = 0;
28 virtual f32 getCurrVel() = 0;
29 virtual void evalCubicBezierOnPath(f32 t,
EGG::Vector3f &currDir,
31 virtual void getPathLocation(f32 t, s16 &idx, f32 &len) = 0;
33 [[nodiscard]]
virtual f32 getCurrSegmentLength()
const = 0;
35 void setPerPointVelocities(
bool isSet) {
36 m_usePerPointVelocities = isSet;
44 [[nodiscard]]
const EGG::Vector3f &floorNrm(
size_t idx)
const;
45 [[nodiscard]] f32 railLength()
const;
48 ASSERT(
static_cast<size_t>(m_currPointIdx) < m_points.size());
49 return m_points[m_currPointIdx];
53 ASSERT(
static_cast<size_t>(m_nextPointIdx) < m_points.size());
54 return m_points[m_nextPointIdx];
57 [[nodiscard]] f32 speed()
const {
66 return m_curTangentDir;
69 [[nodiscard]] f32 currVel()
const {
73 [[nodiscard]] f32 segmentT()
const {
77 [[nodiscard]]
bool isMovementDirectionForward()
const {
78 return m_movementDirectionForward;
81 [[nodiscard]] s16 curPointIdx()
const {
82 return m_currPointIdx;
85 [[nodiscard]] s16 nextPointIdx()
const {
86 return m_nextPointIdx;
91 void calcVelocities();
92 [[nodiscard]]
bool shouldChangeDirection()
const;
93 void calcDirectionChange();
94 void calcNextIndices();
98 std::span<System::MapdataPointInfo::Point> m_points;
101 bool m_usePerPointVelocities;
107 f32 m_currSegmentVel;
109 bool m_movementDirectionForward;
120 void init(f32 t,
u32 idx)
override;
121 Status calc()
override;
122 void setCurrVel(f32 speed)
override;
125 [[nodiscard]] f32 getCurrVel()
override {
131 void getPathLocation(f32 t, s16 &idx, f32 &len)
override;
134 [[nodiscard]] f32 getCurrSegmentLength()
const override {
135 s16 idx = m_movementDirectionForward ? m_currPointIdx : m_nextPointIdx;
136 return m_transitions[idx].m_length;
140 void calcNextSegment();
144 std::span<RailLineTransition> m_transitions;
152 void init(f32 t,
u32 idx)
override;
153 Status calc()
override;
154 void setCurrVel(f32 speed)
override;
157 [[nodiscard]] f32 getCurrVel()
override {
163 void getPathLocation(f32 t, s16 &idx, f32 &len)
override;
166 [[nodiscard]] f32 getCurrSegmentLength()
const override {
167 s16 idx = m_movementDirectionForward ? m_currPointIdx : m_nextPointIdx;
168 return m_transitions[idx].m_length;
177 [[nodiscard]] f32 calcT(f32 t)
const;
178 void calcNextSegment();
180 std::span<RailSplineTransition> m_transitions;
181 u32 m_estimatorSampleCount;
183 std::span<f32> m_pathPercentages;