summaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-01-20 23:27:01 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-01-20 23:27:01 +0000
commit35a9f035963458156c719dc16f4073b8244d66eb (patch)
tree4a96298e2be58dd4d55fafb612d1bfdd855091f5 /game
parentImplement basic network curve part shader (diff)
downloadilt-35a9f035963458156c719dc16f4073b8244d66eb.tar.bz2
ilt-35a9f035963458156c719dc16f4073b8244d66eb.tar.xz
ilt-35a9f035963458156c719dc16f4073b8244d66eb.zip
Pass curve link radius, no recalculate, its constant
Diffstat (limited to 'game')
-rw-r--r--game/network/rail.cpp4
-rw-r--r--game/network/rail.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/game/network/rail.cpp b/game/network/rail.cpp
index 46c129b..b500006 100644
--- a/game/network/rail.cpp
+++ b/game/network/rail.cpp
@@ -156,7 +156,7 @@ RailLinkCurve::RailLinkCurve(NetworkLinkHolder<RailLinkCurve> & instances, const
glm::length(RelativePosition3D(a->pos - c)) * arc_length(arc)),
LinkCurve {c, glm::length(RelativePosition3D(ends[0].node->pos - c)), arc},
instance {instances.vertices.acquire(ends[0].node->pos, ends[1].node->pos, c, round_sleepers(length / 2000.F),
- half_pi - arc.first, half_pi - arc.second)}
+ half_pi - arc.first, half_pi - arc.second, radius)}
{
if (glGenVertexArrays) {
const auto & e0p {ends[0].node->pos};
@@ -199,7 +199,7 @@ template<> NetworkLinkHolder<RailLinkCurve>::NetworkLinkHolder()
VertexArrayObject {vao}
.addAttribs<RailLinkCurve::Vertex, &RailLinkCurve::Vertex::a, &RailLinkCurve::Vertex::b,
&RailLinkCurve::Vertex::c, &RailLinkCurve::Vertex::textureRepeats, &RailLinkCurve::Vertex::aangle,
- &RailLinkCurve::Vertex::bangle>(vertices.bufferName());
+ &RailLinkCurve::Vertex::bangle, &RailLinkCurve::Vertex::radius>(vertices.bufferName());
}
namespace {
diff --git a/game/network/rail.h b/game/network/rail.h
index 39dfdc9..a95ba04 100644
--- a/game/network/rail.h
+++ b/game/network/rail.h
@@ -64,7 +64,7 @@ public:
struct Vertex {
GlobalPosition3D a, b, c;
float textureRepeats;
- float aangle, bangle;
+ float aangle, bangle, radius;
};
private: