From a6e28fe377b41500d6ce3e0a9a4d6e6288d97f61 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 17 Jan 2024 01:08:54 +0000 Subject: Copy render vital link data to vertex buffer --- test/test-network.cpp | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'test/test-network.cpp') diff --git a/test/test-network.cpp b/test/test-network.cpp index 0274b00..dbc184d 100644 --- a/test/test-network.cpp +++ b/test/test-network.cpp @@ -23,25 +23,37 @@ BOOST_GLOBAL_FIXTURE(ApplicationBase); BOOST_GLOBAL_FIXTURE(TestMainWindow); -struct TestLink : public LinkStraight { - TestLink(const Node::Ptr & a, const Node::Ptr & b) : TestLink {a, b, (a->pos - b->pos)} { } +struct TestLinkS; - TestLink(Node::Ptr a, Node::Ptr b, RelativePosition2D l) : +struct TestLink : public virtual Link { + using StraightLink = TestLinkS; + using CurveLink = TestLinkS; +}; + +struct TestLinkS : public TestLink, public LinkStraight { + TestLinkS(NetworkLinkHolder & network, const Node::Ptr & a, const Node::Ptr & b) : + TestLinkS {network, a, b, (a->pos - b->pos)} + { + } + + TestLinkS(NetworkLinkHolder &, Node::Ptr a, Node::Ptr b, RelativePosition2D l) : Link {{std::move(a), 0}, {std::move(b), pi}, glm::length(l)} { } - TestLink(Node::Ptr a, Node::Ptr b, float l) : Link {{std::move(a), 0}, {std::move(b), pi}, l} { } + struct Vertex { }; - using StraightLink = TestLink; - using CurveLink = TestLink; + TestLinkS(NetworkLinkHolder &, Node::Ptr a, Node::Ptr b, float l) : + Link {{std::move(a), 0}, {std::move(b), pi}, l} + { + } }; constexpr GlobalPosition3D p000 {0, 0, 0}, p100 {10000, 0, 0}, p200 {20000, 0, 0}, p300 {30000, 0, 0}; constexpr GlobalPosition3D p110 {10000, 10000, 0}; -struct TestNetwork : public NetworkOf { - TestNetwork() : NetworkOf {RESDIR "rails.jpg"} +struct TestNetwork : public NetworkOf { + TestNetwork() : NetworkOf {RESDIR "rails.jpg"} { // 0 1 2 // p000 <-> p100 <-> p200 <-> p300 @@ -49,12 +61,12 @@ struct TestNetwork : public NetworkOf { // \ 5 / // 3 | 4 // \-> p110 <-/ - addLink(p000, p100, 1.F); - addLink(p100, p200, 1.F); - addLink(p200, p300, 1.F); - addLink(p000, p110, 2.F); - addLink(p200, p110, 2.F); - addLink(p100, p110, 1.F); + addLink(p000, p100, 1.F); + addLink(p100, p200, 1.F); + addLink(p200, p300, 1.F); + addLink(p000, p110, 2.F); + addLink(p200, p110, 2.F); + addLink(p100, p110, 1.F); } }; -- cgit v1.2.3 From c7af64b7061c59c987958d0830838f1c05caeb29 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 19 Jan 2024 00:23:56 +0000 Subject: Render rail network using new shaders Non-functional, totally unimplemented at this stage --- test/test-network.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/test-network.cpp') diff --git a/test/test-network.cpp b/test/test-network.cpp index dbc184d..df61b94 100644 --- a/test/test-network.cpp +++ b/test/test-network.cpp @@ -68,6 +68,11 @@ struct TestNetwork : public NetworkOf { addLink(p200, p110, 2.F); addLink(p100, p110, 1.F); } + + void + render(const SceneShader &) const override + { + } }; const auto VALID_NODES = boost::unit_test::data::make({ -- cgit v1.2.3 From 538af692b66e67dfa4f347cc9ddd784a36f9a991 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sat, 20 Jan 2024 01:23:53 +0000 Subject: Update network with vertex array --- test/test-network.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'test/test-network.cpp') diff --git a/test/test-network.cpp b/test/test-network.cpp index df61b94..174e2a5 100644 --- a/test/test-network.cpp +++ b/test/test-network.cpp @@ -52,6 +52,8 @@ struct TestLinkS : public TestLink, public LinkStraight { constexpr GlobalPosition3D p000 {0, 0, 0}, p100 {10000, 0, 0}, p200 {20000, 0, 0}, p300 {30000, 0, 0}; constexpr GlobalPosition3D p110 {10000, 10000, 0}; +template<> NetworkLinkHolder::NetworkLinkHolder() = default; + struct TestNetwork : public NetworkOf { TestNetwork() : NetworkOf {RESDIR "rails.jpg"} { -- cgit v1.2.3