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
10 class Connection;
11 class Bus;
12 class PCBoard;
13 class Camera;
14
15 class RatsNest
16{
17 public:
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; }
30 private:
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
Camera
Definition Camera.hpp:15
Color
Definition Color.hpp:9
Connection
Definition Connection.hpp:17
PCBoard
Definition PCBoard.hpp:36
Pin
Definition Pin.hpp:18