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]] s16 railIdx()
const {
61 [[nodiscard]]
u16 pointCount()
const {
65 [[nodiscard]] f32 speed()
const {
74 return m_curTangentDir;
77 [[nodiscard]] f32 currVel()
const {
81 [[nodiscard]] f32 segmentT()
const {
85 [[nodiscard]]
bool isMovementDirectionForward()
const {
86 return m_movementDirectionForward;
89 [[nodiscard]] s16 curPointIdx()
const {
90 return m_currPointIdx;
93 [[nodiscard]] s16 nextPointIdx()
const {
94 return m_nextPointIdx;
99 void calcVelocities();
100 [[nodiscard]]
bool shouldChangeDirection()
const;
101 void calcDirectionChange();
102 void calcNextIndices();
106 std::span<System::MapdataPointInfo::Point> m_points;
107 bool m_isOscillating;
109 bool m_usePerPointVelocities;
115 f32 m_currSegmentVel;
117 bool m_movementDirectionForward;
128 void init(f32 t,
u32 idx)
override;
129 Status calc()
override;
130 void setCurrVel(f32 speed)
override;
133 [[nodiscard]] f32 getCurrVel()
override {
139 void getPathLocation(f32 t, s16 &idx, f32 &len)
override;
142 [[nodiscard]] f32 getCurrSegmentLength()
const override {
143 s16 idx = m_movementDirectionForward ? m_currPointIdx : m_nextPointIdx;
144 return m_transitions[idx].m_length;
148 void calcNextSegment();
152 std::span<RailLineTransition> m_transitions;
160 void init(f32 t,
u32 idx)
override;
161 Status calc()
override;
162 void setCurrVel(f32 speed)
override;
165 [[nodiscard]] f32 getCurrVel()
override {
171 void getPathLocation(f32 t, s16 &idx, f32 &len)
override;
174 [[nodiscard]] f32 getCurrSegmentLength()
const override {
175 s16 idx = m_movementDirectionForward ? m_currPointIdx : m_nextPointIdx;
176 return m_transitions[idx].m_length;
185 [[nodiscard]] f32 calcT(f32 t)
const;
186 void calcNextSegment();
188 std::span<RailSplineTransition> m_transitions;
189 u32 m_estimatorSampleCount;
191 std::span<f32> m_pathPercentages;