diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index 6f7a0ea4a..8d02b4c1b 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -21,9 +21,12 @@ * * ****************************************************************************/ /**************************************************************************** - History +History $Log$ +Revision 1.5 2005/11/19 12:14:20 glvertex +Some cleanup and renaming + Revision 1.4 2005/11/18 18:25:35 alemochi Rename function in glArea.h @@ -52,76 +55,74 @@ First rough version. It simply load a mesh. using namespace vcg; GLArea::GLArea(QWidget *parent) - : QGLWidget(parent) +: QGLWidget(parent) { - + } QSize GLArea::minimumSizeHint() const { - return QSize(100,100); + return QSize(100,100); } QSize GLArea::sizeHint() const { - return QSize(100,100); + return QSize(100,100); } void GLArea::initializeGL() { - glShadeModel(GL_SMOOTH); - glEnable(GL_DEPTH_TEST); - glEnable(GL_CULL_FACE); - - //renderMode = GLW::DrawMode::DMSmooth; - renderMode = vcg::GLW::DrawMode::DMSmooth; - renderColor = vcg::GLW::CMNone; + glShadeModel(GL_SMOOTH); + glEnable(GL_DEPTH_TEST); + glEnable(GL_CULL_FACE); + + drawMode = GLW::DrawMode::DMSmooth; + drawColor = GLW::CMNone; } void GLArea::paintGL() { - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - glLoadIdentity(); - // Draws a smooth background - // Why drops so slow?? + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + glLoadIdentity(); + // Draws a smooth background + // Why drops so slow?? - //glDisable(GL_DEPTH_TEST); - //glShadeModel(GL_SMOOTH); - //glBegin(GL_TRIANGLE_STRIP); - // glColor3f(0.f,0.f,0.f); glVertex3f(-1.f, 1.f,-1.f); - // glColor3f(.2f,.2f,.4f); glVertex3f(-1.f,-1.f,-1.f); - // glColor3f(0.f,0.f,0.f); glVertex3f( 1.f, 1.f,-1.f); - // glColor3f(.2f,.2f,.4f); glVertex3f( 1.f,-1.f,-1.f); - //glEnd(); - //glShadeModel(GL_FLAT); - //glEnable(GL_DEPTH_TEST); + //glDisable(GL_DEPTH_TEST); + //glShadeModel(GL_SMOOTH); + //glBegin(GL_TRIANGLE_STRIP); + // glColor3f(0.f,0.f,0.f); glVertex3f(-1.f, 1.f,-1.f); + // glColor3f(.2f,.2f,.4f); glVertex3f(-1.f,-1.f,-1.f); + // glColor3f(0.f,0.f,0.f); glVertex3f( 1.f, 1.f,-1.f); + // glColor3f(.2f,.2f,.4f); glVertex3f( 1.f,-1.f,-1.f); + //glEnd(); + //glShadeModel(GL_FLAT); + //glEnable(GL_DEPTH_TEST); - glColor3f(1.f,1.f,1.f); - gluLookAt(0,0,3, 0,0,0, 0,1,0); - - trackball.center=Point3f(0, 0, 0); - trackball.radius= 1; - trackball.GetView(); - trackball.Apply(); - - Box3f bb(Point3f(-.5,-.5,-.5),Point3f(.5,.5,.5)); - glBoxWire(bb); - float d=1.0f/mm->cm.bbox.Diag(); - //float d=1; - glScale(d); - glTranslate(-mm->cm.bbox.Center()); + glColor3f(1.f,1.f,1.f); + gluLookAt(0,0,3, 0,0,0, 0,1,0); - - mm->Render(renderMode,renderColor); + trackball.center=Point3f(0, 0, 0); + trackball.radius= 1; + trackball.GetView(); + trackball.Apply(); + + Box3f bb(Point3f(-.5,-.5,-.5),Point3f(.5,.5,.5)); + glBoxWire(bb); + float d=1.0f/mm->cm.bbox.Diag(); + //float d=1; + glScale(d); + glTranslate(-mm->cm.bbox.Center()); + + mm->Render(drawMode,drawColor); } void GLArea::resizeGL(int _width, int _height) { - //int side = qMin(width, height); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - gluPerspective(60, float(_width)/float(_height), 1, 100); - glMatrixMode(GL_MODELVIEW); + //int side = qMin(width, height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + gluPerspective(60, float(_width)/float(_height), 1, 100); + glMatrixMode(GL_MODELVIEW); - glViewport(0,0, _width, _height); + glViewport(0,0, _width, _height); } Trackball::Button QT2VCG(Qt::MouseButton qtbt, Qt::KeyboardModifiers modifiers) @@ -166,10 +167,8 @@ void GLArea::wheelEvent(QWheelEvent*e) } -void GLArea::SetRenderMode(vcg::GLW::DrawMode mode) +void GLArea::setDrawMode(vcg::GLW::DrawMode mode) { - this->renderMode=mode; + drawMode = mode; updateGL(); - - } \ No newline at end of file diff --git a/src/meshlab/glarea.h b/src/meshlab/glarea.h index a11ae3a05..22de278cc 100644 --- a/src/meshlab/glarea.h +++ b/src/meshlab/glarea.h @@ -24,6 +24,9 @@ History $Log$ +Revision 1.5 2005/11/19 12:14:20 glvertex +Some cleanup and renaming + Revision 1.4 2005/11/18 18:25:35 alemochi Rename function in glArea.h @@ -42,45 +45,37 @@ First rough version. It simply load a mesh. #include #include -#include - -#include -#include -#include #include #include - -class BrushInterface; class MeshModel; class GLArea : public QGLWidget { - Q_OBJECT + Q_OBJECT public: - GLArea(QWidget *parent = 0); - ~GLArea(){} - MeshModel *mm; - vcg::Trackball trackball; - QSize minimumSizeHint() const; - QSize sizeHint() const; - void SetRenderMode(vcg::GLW::DrawMode mode); - + GLArea(QWidget *parent = 0); + ~GLArea(){} + MeshModel *mm; + vcg::Trackball trackball; + QSize minimumSizeHint() const; + QSize sizeHint() const; + void setDrawMode(vcg::GLW::DrawMode mode); + protected: - void initializeGL(); - void paintGL(); - void resizeGL(int width, int height); - void mousePressEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void wheelEvent(QWheelEvent*e); - - + void initializeGL(); + void paintGL(); + void resizeGL(int width, int height); + void mousePressEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void wheelEvent(QWheelEvent*e); + private: - vcg::GLW::DrawMode renderMode; - vcg::GLW::ColorMode renderColor; + vcg::GLW::DrawMode drawMode; + vcg::GLW::ColorMode drawColor; }; #endif diff --git a/src/meshlab/mainwindow.cpp b/src/meshlab/mainwindow.cpp index d4bf0382c..a4603c44b 100644 --- a/src/meshlab/mainwindow.cpp +++ b/src/meshlab/mainwindow.cpp @@ -24,6 +24,9 @@ History $Log$ +Revision 1.12 2005/11/19 12:14:20 glvertex +Some cleanup and renaming + Revision 1.11 2005/11/19 04:59:12 davide_portelli I have added the modifications to the menù view and to the menu windows: - View->Toolbar->File ToolBar @@ -228,6 +231,7 @@ void MainWindow::createActions() viewModeLines = new QAction(QIcon(":/images/backlines.png"),tr("&Hidden Lines"), this); connect(viewModeLines, SIGNAL(triggered()), this, SLOT(RenderHiddenLines())); + viewModeLines->setDisabled(true); viewModeFlatLines = new QAction(QIcon(":/images/flatlines.png"),tr("Flat &Lines"), this); connect(viewModeFlatLines, SIGNAL(triggered()), this, SLOT(RenderFlatLine())); @@ -367,41 +371,34 @@ void MainWindow::viewToolbarRender(){ void MainWindow::RenderPoint() { - gla->SetRenderMode(vcg::GLW::DMPoints); - + gla->setDrawMode(vcg::GLW::DMPoints); } void MainWindow::RenderWire() { - gla->SetRenderMode(vcg::GLW::DMWire); - + gla->setDrawMode(vcg::GLW::DMWire); } void MainWindow::RenderFlat() { -// paintArea->SetMode(GLW::CHFace); - gla->SetRenderMode(vcg::GLW::DMFlat); - + gla->setDrawMode(vcg::GLW::DMFlat); } void MainWindow::RenderSmooth() { -// paintArea->SetMode(vcg::GLW::DrawMode::DMWire); - gla->SetRenderMode(vcg::GLW::DMSmooth); - + gla->setDrawMode(vcg::GLW::DMSmooth); } void MainWindow::RenderFlatLine() { - gla->SetRenderMode(vcg::GLW::DMFlatWire); - + gla->setDrawMode(vcg::GLW::DMFlatWire); } void MainWindow::RenderHiddenLines() { - //gla->SetMode(vcg::GLW::DMHidden); - + gla->setDrawMode(vcg::GLW::DMHidden); } + void MainWindow::updateWindowMenu(){ windowsMenu->clear(); windowsMenu->addAction(closeAct); diff --git a/src/meshlab/mainwindow.h b/src/meshlab/mainwindow.h index 56c0664aa..080dc48b2 100644 --- a/src/meshlab/mainwindow.h +++ b/src/meshlab/mainwindow.h @@ -68,17 +68,17 @@ private: void createToolBars(); void loadPlugins(); void addToMenu(QObject *plugin, const QStringList &texts, QMenu *menu, - const char *member, QActionGroup *actionGroup = 0); + const char *member, QActionGroup *actionGroup = 0); QWorkspace *workspace; QSignalMapper *windowMapper; GLArea *gla; vector VM; - //GLArea *paintArea; QScrollArea *scrollArea; QDir pluginsDir; QStringList pluginFileNames; + QToolBar *mainToolBar; QToolBar *renderToolBar;