17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-11-11 15:44:35 +01:00

Merge branch 'master' into feat/renderers-cleanup

This commit is contained in:
2026-11-07 16:44:51 +01:00
177 changed files with 11657 additions and 833 deletions

View File

@@ -9,7 +9,9 @@ http://mozilla.org/MPL/2.0/.
#pragma once
#include <array>
#include <optional>
#include <utility>
#include "utilities/Classes.h"
#include "rendering/geometrybank.h"
@@ -103,11 +105,15 @@ 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 ];
// how the path sits among the others
struct setting {
std::array<float, 2> designrolls { 0.f, 0.f }; // as entered; fRoll1 and fRoll2 can differ at a joint
bool uneven { false }; // see TrackUneven.h
int 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::array<std::optional<std::pair<glm::dvec3, glm::dvec3>>, 2> joints;
};
setting m_setting;
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
@@ -141,9 +147,6 @@ class TSegment
void settle_vertex( gfx::basic_vertex &Vertex, glm::dvec3 const &Origin, glm::vec3 const &Position, glm::vec3 const &Parallel, double const Distance ) const;
// displacement of a point by the unevenness, at a distance along the path
glm::dvec3 stray( glm::dvec3 const &Point, track_uneven::amounts const &Amount, double const Distance ) const;
// a point of the path at a distance, past its ends straight on: the polynomial would run off on a short curved path
glm::dvec3 point_extended( double const Distance ) const;
void design_position( double const fDistance, glm::dvec3 &position, glm::vec3 &rotation ) const;
public:
bool bCurve = false;
@@ -196,17 +199,14 @@ public:
// call before Init, it sets the density of the geometry
void
set_uneven( bool const Uneven, int const Path = 0 ) {
m_uneven = Uneven;
m_path = Path; }
glm::dvec3
end_point( int const End ) const {
return End == 0 ? Point1 : Point2; }
m_setting.uneven = Uneven;
m_setting.path = Path; }
float
design_roll( int const End ) const {
return m_designrolls[ End ]; }
return m_setting.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;
m_setting.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