diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-17 01:08:54 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-20 15:08:43 +0000 |
commit | a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61 (patch) | |
tree | 7a77359865cb1359071d91ded0f0c574f57215bb /game/network/network.impl.h | |
parent | Add mail rail network to render test, include curves (diff) | |
download | ilt-a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61.tar.bz2 ilt-a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61.tar.xz ilt-a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61.zip |
Copy render vital link data to vertex buffer
Diffstat (limited to 'game/network/network.impl.h')
-rw-r--r-- | game/network/network.impl.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/game/network/network.impl.h b/game/network/network.impl.h index f9595ed..c1f079d 100644 --- a/game/network/network.impl.h +++ b/game/network/network.impl.h @@ -2,9 +2,9 @@ #include <gfx/gl/sceneShader.h> #include <gfx/models/texture.h> -template<typename T> +template<typename T, typename... Links> void -NetworkOf<T>::render(const SceneShader & shader) const +NetworkOf<T, Links...>::render(const SceneShader & shader) const { if constexpr (std::is_base_of_v<Renderable, T>) { shader.absolute.use(); @@ -13,18 +13,18 @@ NetworkOf<T>::render(const SceneShader & shader) const } } -template<typename T> +template<typename T, typename... Links> void -NetworkOf<T>::joinLinks(const Link::Ptr & l) const +NetworkOf<T, Links...>::joinLinks(const Link::Ptr & l) const { for (const auto & ol : links.objects) { Network::joinLinks(l, ol); } } -template<typename T> +template<typename T, typename... Links> Link::Ptr -NetworkOf<T>::intersectRayLinks(const Ray<GlobalPosition3D> & ray) const +NetworkOf<T, Links...>::intersectRayLinks(const Ray<GlobalPosition3D> & ray) const { // Click link if (const auto link = std::find_if(links.objects.begin(), links.objects.end(), @@ -37,9 +37,9 @@ NetworkOf<T>::intersectRayLinks(const Ray<GlobalPosition3D> & ray) const return {}; } -template<typename T> +template<typename T, typename... Links> float -NetworkOf<T>::findNodeDirection(Node::AnyCPtr n) const +NetworkOf<T, Links...>::findNodeDirection(Node::AnyCPtr n) const { for (const auto & l : links.objects) { for (const auto & e : l->ends) { @@ -52,16 +52,16 @@ NetworkOf<T>::findNodeDirection(Node::AnyCPtr n) const throw std::runtime_error("Node exists but couldn't find it"); } -template<typename T> +template<typename T, typename... Links> Link::CCollection -NetworkOf<T>::candidateStraight(GlobalPosition3D n1, GlobalPosition3D n2) +NetworkOf<T, Links...>::candidateStraight(GlobalPosition3D n1, GlobalPosition3D n2) { return {candidateLink<typename T::StraightLink>(n1, n2)}; } -template<typename T> +template<typename T, typename... Links> Link::CCollection -NetworkOf<T>::candidateJoins(GlobalPosition3D start, GlobalPosition3D end) +NetworkOf<T, Links...>::candidateJoins(GlobalPosition3D start, GlobalPosition3D end) { if (glm::length(RelativePosition3D(start - end)) < 2000.F) { return {}; @@ -73,24 +73,24 @@ NetworkOf<T>::candidateJoins(GlobalPosition3D start, GlobalPosition3D end) return {candidateLink<typename T::CurveLink>(c1s, c1e, c1c), candidateLink<typename T::CurveLink>(c2s, c2e, c2c)}; } -template<typename T> +template<typename T, typename... Links> Link::CCollection -NetworkOf<T>::candidateExtend(GlobalPosition3D start, GlobalPosition3D end) +NetworkOf<T, Links...>::candidateExtend(GlobalPosition3D start, GlobalPosition3D end) { const auto [cstart, cend, centre] = genCurveDef(start, end, findNodeDirection(candidateNodeAt(start).first)); return {candidateLink<typename T::CurveLink>(cstart, cend, centre)}; } -template<typename T> +template<typename T, typename... Links> Link::CCollection -NetworkOf<T>::addStraight(GlobalPosition3D n1, GlobalPosition3D n2) +NetworkOf<T, Links...>::addStraight(GlobalPosition3D n1, GlobalPosition3D n2) { return {addLink<typename T::StraightLink>(n1, n2)}; } -template<typename T> +template<typename T, typename... Links> Link::CCollection -NetworkOf<T>::addJoins(GlobalPosition3D start, GlobalPosition3D end) +NetworkOf<T, Links...>::addJoins(GlobalPosition3D start, GlobalPosition3D end) { if (glm::length(RelativePosition3D(start - end)) < 2000.F) { return {}; @@ -101,9 +101,9 @@ NetworkOf<T>::addJoins(GlobalPosition3D start, GlobalPosition3D end) return {addLink<typename T::CurveLink>(c1s, c1e, c1c), addLink<typename T::CurveLink>(c2s, c2e, c2c)}; } -template<typename T> +template<typename T, typename... Links> Link::CCollection -NetworkOf<T>::addExtend(GlobalPosition3D start, GlobalPosition3D end) +NetworkOf<T, Links...>::addExtend(GlobalPosition3D start, GlobalPosition3D end) { const auto [cstart, cend, centre] = genCurveDef(start, end, findNodeDirection(nodeAt(start))); return {addLink<typename T::CurveLink>(cstart, cend, centre)}; |