39 lines
987 B
C++
39 lines
987 B
C++
#ifndef SKETCHGRID_H
|
|
#define SKETCHGRID_H
|
|
|
|
#include <QOpenGLFunctions>
|
|
#include <QMatrix4x4>
|
|
#include <QOpenGLVertexArrayObject>
|
|
#include <QOpenGLBuffer>
|
|
|
|
class QOpenGLShaderProgram;
|
|
class QPainter;
|
|
class ViewportWidget;
|
|
|
|
class SketchGrid : protected QOpenGLFunctions
|
|
{
|
|
public:
|
|
enum SketchPlane {
|
|
XY = 1,
|
|
XZ = 2,
|
|
YZ = 3
|
|
};
|
|
|
|
explicit SketchGrid(ViewportWidget* viewport);
|
|
~SketchGrid();
|
|
|
|
void initializeGL();
|
|
void paintGL(SketchPlane plane, QOpenGLShaderProgram* shaderProgram, int colorLoc);
|
|
void paintAxisLabels(QPainter& painter, SketchPlane plane, const QMatrix4x4& modelView, const QMatrix4x4& projection);
|
|
|
|
private:
|
|
void drawGridLines(SketchPlane plane, QOpenGLShaderProgram* shaderProgram, int colorLoc);
|
|
void drawAxes(SketchPlane plane, QOpenGLShaderProgram* shaderProgram, int colorLoc);
|
|
|
|
QOpenGLVertexArrayObject m_vao;
|
|
QOpenGLBuffer m_vbo;
|
|
ViewportWidget* m_viewport = nullptr;
|
|
};
|
|
|
|
#endif // SKETCHGRID_H
|