PCB Environment 2
Loading...
Searching...
No Matches
RatsNest.hpp
1
2#ifndef GYM_PCB_UI_RATSNEST_H
3#define GYM_PCB_UI_RATSNEST_H
4
5#include "GLContext.hpp"
6#include "Color.hpp"
7#include <map>
8#include <vector>
9
10class Connection;
11class Bus;
12class PCBoard;
13class Camera;
14
15class RatsNest
16{
17public:
18 RatsNest(const PCBoard&);
19 ~RatsNest();
20 void setHL(const std::vector<Connection *> *);
21 void update();
22 void updateHL();
23 void draw(const Camera&);
24 void setLineWidth(float w) { mLineWidth = w; }
25 float getLayerAlpha(uint z) const { return mLayerAlpha.at(z); }
26 void setLayerAlpha(uint z, float a) { mLayerAlpha.at(z) = a; }
27 void setColorHL(Color c);
28 bool allVisible() const { return mAllVisible; }
29 void setAllVisible(bool b) { mAllVisible = b; }
30private:
31 const PCBoard &mPCB;
32 uint mNumLines{0};
33 float mLineWidth{1.0f};
34 GLfloat mColorVars[2][2][4];
35 bool mAllVisible{true};
36 std::map<const Connection *, std::pair<uint16_t, uint16_t>> mConn2Index;
37 std::vector<uint16_t> mIndicesHL;
38 std::vector<const Connection *> mHLConns;
39 std::vector<float> mLayerAlpha;
40
41 GLuint mVBO{0};
42 GLuint mVAO{0};
43
44 static GLuint sVP, sFP, sPP;
45 static GLint sUniformColors;
46
47 bool shouldAdd(const Connection&) const;
48 float getLayerAlpha(const Pin *) const;
49
50 void createVAO();
51 static void createShaders();
52};
53
54#endif // GYM_PCB_UI_RATSNEST_H
Definition Camera.hpp:15
Definition Color.hpp:9
Definition Connection.hpp:17
Definition PCBoard.hpp:36
Definition Pin.hpp:18