diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-22 02:25:47 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-22 02:25:47 +0000 |
commit | 961f69d8cda0364c04ec98efc70a6f21e0a091e6 (patch) | |
tree | bffeb04832ea6615cc9d3908a6de1c8fb01e9bd6 /game | |
parent | Add missing support for glUniform simple span of numbers (diff) | |
download | ilt-961f69d8cda0364c04ec98efc70a6f21e0a091e6.tar.bz2 ilt-961f69d8cda0364c04ec98efc70a6f21e0a091e6.tar.xz ilt-961f69d8cda0364c04ec98efc70a6f21e0a091e6.zip |
Bind the network profile in as uniforms
Makes the network shaders generic to network type
Diffstat (limited to 'game')
-rw-r--r-- | game/network/rail.cpp | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/game/network/rail.cpp b/game/network/rail.cpp index 216ec1c..176a704 100644 --- a/game/network/rail.cpp +++ b/game/network/rail.cpp @@ -73,16 +73,20 @@ RailLinks::addLinksBetween(GlobalPosition3D start, GlobalPosition3D end) return addLink<RailLinkCurve>(start, end, centre.first); } -constexpr const std::array<std::pair<RelativePosition3D, float>, RAIL_CROSSSECTION_VERTICES> railCrossSection {{ - // ___________ - // _/ \_ - // left to right - {{-1900.F, 0.F, 0.F}, 0.F}, - {{-608.F, 0.F, RAIL_HEIGHT.z}, .34F}, - {{0, 0.F, RAIL_HEIGHT.z * .7F}, .5F}, - {{608.F, 0.F, RAIL_HEIGHT.z}, .66F}, - {{1900.F, 0.F, 0.F}, 1.F}, +constexpr const std::array<RelativePosition3D, RAIL_CROSSSECTION_VERTICES> railCrossSection {{ + {-1900.F, 0.F, 0.F}, + {-608.F, 0.F, RAIL_HEIGHT.z}, + {0, 0.F, RAIL_HEIGHT.z * .7F}, + {608.F, 0.F, RAIL_HEIGHT.z}, + {1900.F, 0.F, 0.F}, }}; +constexpr const std::array<float, RAIL_CROSSSECTION_VERTICES> railTexturePos { + 0.F, + .34F, + .5F, + .66F, + 1.F, +}; constexpr auto sleepers {5.F}; // There are 5 repetitions of sleepers in the texture inline auto @@ -149,7 +153,7 @@ namespace { renderType(const NetworkLinkHolder<LinkType> & n, auto & s) { if (auto count = n.vertices.size()) { - s.use(); + s.use(railCrossSection, railTexturePos); glBindVertexArray(n.vao); glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(count)); } |