diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-21 14:31:50 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2021-02-21 14:31:50 +0000 |
commit | 288d1b2905f717a84e80ce5cde78a05483a9500e (patch) | |
tree | 5ed98b1c6496ed4c1eea916e9bf9c5d5f651674c /game/network/rail.cpp | |
parent | Tweak rail mesh to work in junctions better (diff) | |
download | ilt-288d1b2905f717a84e80ce5cde78a05483a9500e.tar.bz2 ilt-288d1b2905f717a84e80ce5cde78a05483a9500e.tar.xz ilt-288d1b2905f717a84e80ce5cde78a05483a9500e.zip |
Fix inverted rail arc generation
Diffstat (limited to 'game/network/rail.cpp')
-rw-r--r-- | game/network/rail.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/game/network/rail.cpp b/game/network/rail.cpp index b27aba9..fe513ff 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -122,14 +122,14 @@ RailLinkCurve::RailLinkCurve(const NodePtr & a, const NodePtr & b, glm::vec3 c, const auto & e1p {ends[1].first->pos}; const auto slength = round_sleepers(length / 2.F); const auto segs = std::round(5.F * slength / std::pow(radius, 0.7F)); - const auto step {glm::vec3 {arc_length(arc), e0p.y - e1p.y, slength} / segs}; + const auto step {glm::vec3 {-arc_length(arc), e0p.y - e1p.y, slength} / segs}; const auto trans {glm::translate(centreBase)}; int segCount = segs; vertices.reserve((segCount + 1) * railCrossSection.size()); indices.reserve(segCount * 2 * railCrossSection.size()); for (glm::vec3 swing = {arc.second, e1p.y - centreBase.y, 0.F}; segCount >= 0; swing += step, --segCount) { - const auto t {trans * glm::rotate(half_pi - swing.x, up) * glm::translate(glm::vec3 {radius, swing.y, 0.F})}; + const auto t {trans * glm::rotate(swing.x - half_pi, up) * glm::translate(glm::vec3 {radius, swing.y, 0.F})}; for (const auto & rcs : railCrossSection) { const glm::vec3 m {(t * glm::vec4 {rcs.first, 1})}; vertices.emplace_back(m, glm::vec2 {rcs.second, swing.z}, up); |