mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-04 03:02:05 +01:00
Merge remote-tracking branch 'origin/feat/track-uneven' into feat/renderers-cleanup
This commit is contained in:
@@ -9,12 +9,13 @@ http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "utilities/Classes.h"
|
||||
#include "rendering/geometrybank.h"
|
||||
#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
#include "world/Knots.h"
|
||||
|
||||
struct map_colored_paths {
|
||||
@@ -101,7 +102,11 @@ class TSegment
|
||||
glm::dvec3 Point2;
|
||||
float fRoll1 { 0.f };
|
||||
float fRoll2 { 0.f }; // przechyłka na końcach
|
||||
float m_designrolls[ 2 ] { 0.f, 0.f }; // as entered; the two above can differ at a joint
|
||||
bool m_uneven { false }; // see TrackUneven.h
|
||||
int m_path { 0 }; // which path of a switch
|
||||
// where the path meets the next one: the middle of their ends and their common vector across
|
||||
std::optional<std::pair<glm::dvec3, glm::dvec3>> m_joints[ 2 ];
|
||||
double fLength { -1.0 }; // długość policzona
|
||||
std::vector<double> fTsBuffer; // wartości parametru krzywej t dla równych odcinków s
|
||||
std::vector<double> fTsSlope; // nachylenie dt/du (= dt/ds * fStep) w tych samych punktach
|
||||
@@ -115,7 +120,6 @@ class TSegment
|
||||
TTrack *pOwner = nullptr; // wskaźnik na właściciela
|
||||
std::vector<std::shared_ptr<TSegment>> m_pieces; // parts of a path made of several curves, parametrized by distance
|
||||
std::vector<double> m_starts; // distance from Point1 to the start of each part
|
||||
std::optional<std::pair<glm::dvec3, glm::dvec3>> m_joints[ 2 ];
|
||||
double m_dense { 0.0 };
|
||||
// a switch makes the profiles of its rails and its bed at the mean of the rolls of its paths: lofted along a path, they're turned
|
||||
// from it to the roll of the path there, so a switch on a cant ramp follows it; none for the other paths
|
||||
@@ -188,8 +192,16 @@ public:
|
||||
void RaPositionGet(double const fDistance, glm::dvec3 &position, glm::vec3 &rotation) const;
|
||||
// call before Init, it sets the density of the geometry
|
||||
void
|
||||
set_uneven( bool const Uneven ) {
|
||||
m_uneven = Uneven; }
|
||||
set_uneven( bool const Uneven, int const Path = 0 ) {
|
||||
m_uneven = Uneven;
|
||||
m_path = Path; }
|
||||
float
|
||||
design_roll( int const End ) const {
|
||||
return m_designrolls[ End ]; }
|
||||
void
|
||||
set_joint( int const End, std::optional<std::pair<glm::dvec3, glm::dvec3>> const &Joint, float const Roll ) {
|
||||
m_joints[ End ] = Joint;
|
||||
( End == 0 ? fRoll1 : fRoll2 ) = Roll; }
|
||||
// second derivative of the displacement along the path; times speed squared: acceleration of an axle
|
||||
glm::dvec3
|
||||
uneven_bend( double const Distance ) const;
|
||||
@@ -227,9 +239,6 @@ public:
|
||||
// point of the path and the unit vector across it towards the right rail profile, at a distance from Point1
|
||||
void
|
||||
plan_frame( double const Distance, glm::dvec3 &Point, glm::dvec3 &Across ) const;
|
||||
void
|
||||
set_joint( int const End, std::optional<std::pair<glm::dvec3, glm::dvec3>> const &Joint ) {
|
||||
m_joints[ End ] = Joint; }
|
||||
void
|
||||
set_dense( double const Distance ) {
|
||||
m_dense = Distance; }
|
||||
|
||||
Reference in New Issue
Block a user