From 961f69d8cda0364c04ec98efc70a6f21e0a091e6 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 22 Jan 2024 02:25:47 +0000 Subject: Bind the network profile in as uniforms Makes the network shaders generic to network type --- game/network/rail.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'game/network') 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(start, end, centre.first); } -constexpr const std::array, 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 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 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 & n, auto & s) { if (auto count = n.vertices.size()) { - s.use(); + s.use(railCrossSection, railTexturePos); glBindVertexArray(n.vao); glDrawArrays(GL_POINTS, 0, static_cast(count)); } -- cgit v1.2.3