Commit 8ece7716 by Kai Westerkamp

grid

parent 0de3f161
......@@ -9,7 +9,7 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler )
this->controler = controler;
gridSize = 5;
gridStepSize = 1;
isGridEnabled = true;
isGridEnabled = false;
}
QSize GLView::minimumSizeHint() const
......
......@@ -23,6 +23,10 @@ protected :
public slots:
void home();
void setGridSize(int size){gridSize = size;}
void setGridStepSize(int size){gridStepSize = size;}
void showGrid(bool bo){isGridEnabled = bo;}
public:
GLView(Scene *scene,Camera * camera,Controler *controler );
void setHome(QQuaternion *rotation, QVector3D *translation);
......@@ -47,9 +51,9 @@ private:
GLdouble aspect;
GLuint fbo;
GLuint color;
GLuint picID;
GLuint depth;
GLuint color;
GLuint picID;
GLuint depth;
void drawGrid();
void initShader();
......
......@@ -175,6 +175,42 @@ MainWindow::MainWindow(QWidget *parent)
primitivesMenu->addAction(groupAdd);
primitivesMenu->addAction(activeDelete);
showGridButton = new QToolButton(toolBar);
showGridButton->setCheckable(true);
gridSizeInput = new QSpinBox(toolBar);
gridSizeInput->setRange(0,100);
gridSizeInput->setValue(5);
gridSizeInput->setToolTip("Grid Size");
gridStepInput = new QSpinBox(toolBar);
gridStepInput->setRange(1,10);
gridStepInput->setToolTip("Grid Step Size");
connect(gridSizeInput,SIGNAL(valueChanged(int)),perspectiveView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),perspectiveView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),perspectiveView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),topView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),topView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),topView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),leftView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),leftView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),leftView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),frontView,SLOT(setGridSize(int)));
connect(gridStepInput,SIGNAL(valueChanged(int)),frontView,SLOT(setGridStepSize(int)));
connect(showGridButton,SIGNAL(clicked(bool)),frontView,SLOT(showGrid(bool)));
connect(gridSizeInput,SIGNAL(valueChanged(int)),this,SLOT(updateGL()));
connect(gridStepInput,SIGNAL(valueChanged(int)),this,SLOT(updateGL()));
connect(showGridButton,SIGNAL(clicked(bool)),this,SLOT(updateGL()));
// Assemble Menus
fileMenu->addAction(exitAction);
......@@ -192,6 +228,12 @@ MainWindow::MainWindow(QWidget *parent)
toolBar->addAction(camHome);
toolBar->addSeparator();
toolBar->addWidget(showGridButton);
toolBar->addWidget(gridSizeInput);
toolBar->addWidget(gridStepInput);
toolBar->addSeparator();
QToolButton* toolButton = new QToolButton();
toolButton->setIcon(QIcon(":/img/viewports.png"));
......@@ -215,6 +257,8 @@ MainWindow::MainWindow(QWidget *parent)
addToolBar( toolBar);
scene->simpleScene();
setStatusBar(statusBar);
initDoc();
......
......@@ -71,6 +71,11 @@ private:
QTreeView *sceneView;
QSpinBox* gridSizeInput;
QSpinBox* gridStepInput;
QToolButton* showGridButton;
void initDoc();
public:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment