src/glRenderer.h

changeset 1100
9b2797729c82
parent 1099
14276e435640
child 1104
edddb9b0db9e
equal deleted inserted replaced
1099:14276e435640 1100:9b2797729c82
41 bool negatedX; 41 bool negatedX;
42 bool negatedY; 42 bool negatedY;
43 bool negatedDepth; // is greater depth value closer to camera? 43 bool negatedDepth; // is greater depth value closer to camera?
44 }; 44 };
45 45
46 //
47 // Meta for overlays
48 //
49 struct LDGLOverlay
50 {
51 ~LDGLOverlay();
52
53 Vertex v0,
54 v1;
55 int offsetX,
56 offsetY;
57 double width,
58 height;
59 QString fileName;
60 QImage* image = nullptr;
61 bool invalid = false;
62 };
63
64 enum Camera 46 enum Camera
65 { 47 {
66 TopCamera, 48 TopCamera,
67 FrontCamera, 49 FrontCamera,
68 LeftCamera, 50 LeftCamera,
94 76
95 Camera camera() const; 77 Camera camera() const;
96 const CameraInfo& cameraInfo(Camera camera) const; 78 const CameraInfo& cameraInfo(Camera camera) const;
97 QString cameraName(Camera camera) const; 79 QString cameraName(Camera camera) const;
98 QByteArray capturePixels(); 80 QByteArray capturePixels();
99 void clearOverlay();
100 void compileObject(LDObject* obj); 81 void compileObject(LDObject* obj);
101 GLCompiler* compiler() const; 82 GLCompiler* compiler() const;
102 Vertex convert2dTo3d(const QPoint& pos2d, bool snap) const; 83 Vertex convert2dTo3d(const QPoint& pos2d, bool snap) const;
103 QPoint convert3dTo2d(const Vertex& pos3d) const; 84 QPoint convert3dTo2d(const Vertex& pos3d) const;
104 QString currentCameraName() const; 85 QString currentCameraName() const;
109 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos); 90 void drawBlipCoordinates(QPainter& painter, const Vertex& pos3d, QPointF pos);
110 void drawGLScene(); 91 void drawGLScene();
111 void forgetObject(LDObject* obj); 92 void forgetObject(LDObject* obj);
112 Axis getCameraAxis(bool y, Camera camid = (Camera) -1); 93 Axis getCameraAxis(bool y, Camera camid = (Camera) -1);
113 double getDepthValue() const; 94 double getDepthValue() const;
114 LDGLOverlay& getOverlay(int newcam);
115 void getRelativeAxes(Axis& relX, Axis& relY) const; 95 void getRelativeAxes(Axis& relX, Axis& relY) const;
116 Axis getRelativeZ() const; 96 Axis getRelativeZ() const;
117 void hardRefresh(); 97 void hardRefresh();
118 void highlightCursorObject(); 98 void highlightCursorObject();
119 void initGLData(); 99 void initGLData();
120 void initOverlaysFromObjects();
121 bool isDrawOnly() const; 100 bool isDrawOnly() const;
122 bool isPicking() const; 101 bool isPicking() const;
123 Qt::KeyboardModifiers keyboardModifiers() const; 102 Qt::KeyboardModifiers keyboardModifiers() const;
124 QPen linePen() const; 103 QPen linePen() const;
125 void makeCurrent(); 104 void makeCurrent();
139 void setCamera(Camera cam); 118 void setCamera(Camera cam);
140 void setDepthValue(double depth); 119 void setDepthValue(double depth);
141 void setDrawOnly(bool value); 120 void setDrawOnly(bool value);
142 void setEditMode(EditModeType type); 121 void setEditMode(EditModeType type);
143 void setPicking(bool a); 122 void setPicking(bool a);
144 bool setupOverlay(Camera camera, QString fileName, int x, int y, int w, int h);
145 QPen textPen() const; 123 QPen textPen() const;
146 void updateOverlayObjects();
147 void zoomNotch(bool inward); 124 void zoomNotch(bool inward);
148 125
149 protected: 126 protected:
150 void contextMenuEvent(QContextMenuEvent* event); 127 void contextMenuEvent(QContextMenuEvent* event);
151 void dragEnterEvent(QDragEnterEvent* event); 128 void dragEnterEvent(QDragEnterEvent* event);
176 QGenericMatrix<4, 4, GLfloat> m_rotationMatrix; 153 QGenericMatrix<4, 4, GLfloat> m_rotationMatrix;
177 double m_panX[7] = {0}; 154 double m_panX[7] = {0};
178 double m_panY[7] = {0}; 155 double m_panY[7] = {0};
179 double m_zoom[7] = {30}; 156 double m_zoom[7] = {30};
180 double m_depthValues[6]; 157 double m_depthValues[6];
181 LDGLOverlay m_overlays[6];
182 bool m_useDarkBackground = false; 158 bool m_useDarkBackground = false;
183 bool m_drawToolTip = false; 159 bool m_drawToolTip = false;
184 bool m_takingScreenCapture = false; 160 bool m_takingScreenCapture = false;
185 bool m_panning = false; 161 bool m_panning = false;
186 bool m_initialized = false; 162 bool m_initialized = false;
203 GLuint m_axesVbo; 179 GLuint m_axesVbo;
204 GLuint m_axesColorVbo; 180 GLuint m_axesColorVbo;
205 181
206 void calcCameraIcons(); 182 void calcCameraIcons();
207 void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type); 183 void drawVbos (SurfaceVboType surface, ComplementVboType colors, GLenum type);
208 LDOverlay* findOverlayObject (Camera cam);
209 double& panning (Axis ax); 184 double& panning (Axis ax);
210 double panning (Axis ax) const; 185 double panning (Axis ax) const;
211 double& zoom(); 186 double& zoom();
212 void zoomToFit(); 187 void zoomToFit();
213 void zoomAllToFit(); 188 void zoomAllToFit();

mercurial