Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

QGLExaminerViewer Class Reference

Examiner viewer class. More...

#include <QGLExaminerViewer.h>

Inheritance diagram for QGLExaminerViewer:

QGLViewer QSceneTreeViewer QSimpleViewer List of all members.

Public Slots

void sltResetXSlider ()
void sltResetYSlider ()
void sltSetZoomSlider (int scaling)
virtual void sltToggleStereo ()

Signals

void sigViewerClosed (void)

Public Member Functions

 QGLExaminerViewer (QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat())
 QGLExaminerViewer (const CCamera &homecam, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat())
 QGLExaminerViewer (const CBoundingBox3D &cBBox, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat())
virtual ~QGLExaminerViewer ()
virtual void setCamera (const CCamera &Camera, CameraType which=CurrentCam)
virtual void setFullViewer (bool state)
virtual void enableMouseEvents (bool state)

Protected Slots

virtual void sltToggleRenderMode ()
virtual void sltGoHome ()
virtual void sltSetCamera (const CCamera &cCamera)

Protected Member Functions

virtual void keyPressEvent (QKeyEvent *event)
virtual void closeEvent (QCloseEvent *event)
virtual void ManageMouseMove (QMouseEvent *event)
virtual void ManageMousePress (QMouseEvent *event)
virtual void ManageMouseRelease (QMouseEvent *event)
bool eventFilter (QObject *pqObject, QEvent *pqEvent)
virtual void makeFullViewer ()
virtual void makeSimpleViewer ()

Private Slots

void sltCamXRotate (int iAngle)
void sltCamYRotate (int iAngle)
void sltSetZoom (int zoom_factor)
void sltSetZoomSlider (double rdFovy)
void sltSetZoomSlider (const QString &qText)
void sltSetZoomText (int n)
void sltSaveVectors ()
void sltCamRotStep ()
void sltToggleDeco ()
void sltToggleToolTips ()
void sltToggleSpinning ()
void sltSwitchBehave ()
void sltMenuToggleRenderMode ()
void sltTimeOut ()
void sltSetRefreshRate ()

Private Member Functions

void init (bool viewertype)

Private Attributes

int m_nMousePosX
int m_nMousePosY
int m_nXDiff
int m_nYDiff
float m_rfXAlpha
float m_rfYAlpha
int m_nQuadrant
CV3D m_cUp
CV3D m_cRight
CV3D m_cDir
int m_nLastRotAngle
bool m_fLeftButtonPressed
bool m_fMiddleButtonPressed
QBoxLayout * m_pqTopLayout
QSlider * m_pqXRot
QSlider * m_pqYRot
QSlider * m_pqZoom
QLineEdit * m_pqZoomText
QTimer * m_pqTimer
QTimer * m_pqTimeOut
QWidget * m_apqWidgets [NUM_WIDGETS]
int m_nSelectionID
int m_nDecoID
int m_nTTipsID
int m_nSpinOnOffID
int m_nSwitchBehaveID
int m_nStereoID
bool m_fToolTips
bool m_fAnimationOn
bool m_fOldBehave
bool m_fShiftPressed

Detailed Description

Examiner viewer class.

This is a viewer which inherits functionality from the baseclass QGLViewer. It implements the necessary functions which handle the mouseevents and creates a layoutmanager to handle the frame with the QGLWidget in it. It also creates some buttons and sliders which have new functionalities and it handles input from keyboard (try pressing 'i').

Author:
Markus Janich
Here's an example for an inherited viewer (CSimpleViewer) which implements catching a key event when the key 'v' was pressed. It also shoes an application which instantiates an object of that viewer and implements the slots PaintGL(), ResizeGL() and InitializeGL() inside the render program (CSimpleRenderer).
Files for a derived viewer:
/* * QSimpleViewer.h * $Id: QSimpleViewer.h,v 1.3 2001/11/15 16:54:51 guenth Exp $ * * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * As a special exception to the GPL, the QGLViewer authors (Markus * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas * Woerner) give permission to link this program with Qt (non-)commercial * edition, and distribute the resulting executable, without including * the source code for the Qt (non-)commercial edition in the source * distribution. * */ // Description : Class inherits from QGLExaminerViewer // Purpose : Overloads the catch key method and emits an own key signal #ifndef QMYVIEWER__H #define QMYVIEWER__H // Qt #include <qlabel.h> #include <qslider.h> #include <qpushbutton.h> #include <qlayout.h> // Own #include "QGLExaminerViewer.h" // Defines #define ZOOMSCALING 100.0 // used for translating slidervalue to real (double) value. class QSimpleViewer : public QGLExaminerViewer { Q_OBJECT public: QSimpleViewer(const CCamera &homecam, QWidget *parent=0, const char *name=0, const QGLWidget *shareWidget=0, WFlags f=0, bool viewertype=true, const QGLFormat &format=QGLFormat::defaultFormat()) : QGLExaminerViewer(homecam, parent, name, shareWidget, f, viewertype, format) {}; virtual ~QSimpleViewer() {}; signals: void sigMyKey(int); protected: virtual void keyPressEvent(QKeyEvent *event); private: }; #endif // QMYVIEWER__H
00001 /* 00002 * QSimpleViewer.h 00003 * $Id: QSimpleViewer.h,v 1.3 2001/11/15 16:54:51 guenth Exp $ 00004 * 00005 * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * As a special exception to the GPL, the QGLViewer authors (Markus 00022 * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas 00023 * Woerner) give permission to link this program with Qt (non-)commercial 00024 * edition, and distribute the resulting executable, without including 00025 * the source code for the Qt (non-)commercial edition in the source 00026 * distribution. 00027 * 00028 */ 00029 00030 // Description : Class inherits from QGLExaminerViewer 00031 // Purpose : Overloads the catch key method and emits an own key signal 00032 00033 00034 00035 #ifndef QMYVIEWER__H 00036 #define QMYVIEWER__H 00037 00038 00039 // Qt 00041 #include <qlabel.h> 00042 #include <qslider.h> 00043 #include <qpushbutton.h> 00044 #include <qlayout.h> 00045 00046 00047 // Own 00049 #include "QGLExaminerViewer.h" 00050 00051 00052 // Defines 00054 #define ZOOMSCALING 100.0 // used for translating slidervalue to real (double) value. 00055 00056 00057 00067 class QSimpleViewer : public QGLExaminerViewer { 00068 Q_OBJECT 00069 00070 public: 00071 00074 QSimpleViewer(const CCamera &homecam, QWidget *parent=0, 00075 const char *name=0, const QGLWidget *shareWidget=0, 00076 WFlags f=0, bool viewertype=true, 00077 const QGLFormat &format=QGLFormat::defaultFormat()) 00078 : QGLExaminerViewer(homecam, parent, name, shareWidget, f, viewertype, format) {}; 00079 00081 virtual ~QSimpleViewer() {}; 00082 00083 signals: 00084 00086 void sigMyKey(int); 00087 00088 00089 protected: 00090 00092 virtual void keyPressEvent(QKeyEvent *event); 00093 00094 private: 00095 }; 00096 00097 #endif // QMYVIEWER__H

/* * QSimpleViewer.cpp * $Id: QSimpleViewer.cpp,v 1.2 2001/11/15 16:54:51 guenth Exp $ * * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * As a special exception to the GPL, the QGLViewer authors (Markus * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas * Woerner) give permission to link this program with Qt (non-)commercial * edition, and distribute the resulting executable, without including * the source code for the Qt (non-)commercial edition in the source * distribution. * */ // Description : Class inherits from QGLExaminerViewer // Purpose : Overloads the catch key method and emits an own key signal // QT #include <qlabel.h> #include <qslider.h> #include <qpushbutton.h> #include <qlayout.h> // Own #include "QSimpleViewer.h" // Function : keyPressEvent // Parameters : QKeyEvent *event // Purpose : Catch any key and emit a signal containing the // key's ascii code // Comments : void QSimpleViewer::keyPressEvent(QKeyEvent *event) /********************************************************************/ { switch(event->state()) { case NoButton: cout << endl << "QSimpleViewer: Emitting the signal for the "; cout << "pressed key" << endl; emit(sigMyKey(event->ascii())); break; } QGLExaminerViewer::keyPressEvent(event); return; }
00001 /* 00002 * QSimpleViewer.cpp 00003 * $Id: QSimpleViewer.cpp,v 1.2 2001/11/15 16:54:51 guenth Exp $ 00004 * 00005 * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * As a special exception to the GPL, the QGLViewer authors (Markus 00022 * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas 00023 * Woerner) give permission to link this program with Qt (non-)commercial 00024 * edition, and distribute the resulting executable, without including 00025 * the source code for the Qt (non-)commercial edition in the source 00026 * distribution. 00027 * 00028 */ 00029 00030 // Description : Class inherits from QGLExaminerViewer 00031 // Purpose : Overloads the catch key method and emits an own key signal 00032 00033 00044 // QT 00046 #include <qlabel.h> 00047 #include <qslider.h> 00048 #include <qpushbutton.h> 00049 #include <qlayout.h> 00050 00051 00052 // Own 00054 #include "QSimpleViewer.h" 00055 00056 00057 00058 00059 // Function : keyPressEvent 00060 // Parameters : QKeyEvent *event 00061 // Purpose : Catch any key and emit a signal containing the 00062 // key's ascii code 00063 // Comments : 00064 void QSimpleViewer::keyPressEvent(QKeyEvent *event) 00065 /********************************************************************/ 00066 { 00067 switch(event->state()) { 00068 case NoButton: 00069 cout << endl << "QSimpleViewer: Emitting the signal for the "; 00070 cout << "pressed key" << endl; 00071 emit(sigMyKey(event->ascii())); 00072 break; 00073 } 00074 QGLExaminerViewer::keyPressEvent(event); 00075 00076 return; 00077 }

Files for a program doing the rendering:
/* * CSimpleRenderer.h * $Id: CSimpleRenderer.h,v 1.3 2001/11/15 16:54:51 guenth Exp $ * * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * As a special exception to the GPL, the QGLViewer authors (Markus * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas * Woerner) give permission to link this program with Qt (non-)commercial * edition, and distribute the resulting executable, without including * the source code for the Qt (non-)commercial edition in the source * distribution. * */ // Description : Definition of an example renderer drawing a cube // in wire frame and catching a key signal #ifndef CRENDERER__H #define CRENDERER__H // Own #include "QSimpleViewer.h" // Qt #include <qmainwindow.h> #include <qslider.h> #include <qgl.h> // System #include <math.h> class CSimpleRenderer : public QObject { Q_OBJECT //****** All methods ****** public: CSimpleRenderer(QGLViewer*); ~CSimpleRenderer(); QGLViewer* getViewer(void) { return m_pViewer; }; void MakeGlList(); private: GLuint processHits(GLint hits, GLuint buffer[]); // **** All the slots ***** private slots: void sltInitializeGL(); void sltResizeGL(int w, int h); void sltPaintGL(); void sltManageSelection(QMouseEvent *pqEvent); void sltManageRelease(QMouseEvent *pqEvent); void sltManageMove(QMouseEvent *pqEvent); void sltCatchKey(int); void sltResetSelection(); private: void renderScene(void); void renderSolidSphere(const CP3D &cCenter, float radius, int n1, int n2, float lw=2.5); void renderWireSphere(const CP3D &cCenter, float radius, int n1, int n2, float lw=2.5); //****** All data ****** QGLViewer *m_pViewer; GLuint m_glDispList; bool m_afSelected[12]; // select state of the spheres bool m_fLeftButtonPressed; // saves left button state bool m_fMiddleButtonPressed; // saves middle button state bool m_fRightButtonPressed; // saves right button state CP3D m_cSphereCenter[12]; // saves centers of the spheres int m_nMousePosX, m_nMousePosY; // last mouse position }; #endif // CRENDERER__H
00001 /* 00002 * CSimpleRenderer.h 00003 * $Id: CSimpleRenderer.h,v 1.3 2001/11/15 16:54:51 guenth Exp $ 00004 * 00005 * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * As a special exception to the GPL, the QGLViewer authors (Markus 00022 * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas 00023 * Woerner) give permission to link this program with Qt (non-)commercial 00024 * edition, and distribute the resulting executable, without including 00025 * the source code for the Qt (non-)commercial edition in the source 00026 * distribution. 00027 * 00028 */ 00029 00030 // Description : Definition of an example renderer drawing a cube 00031 // in wire frame and catching a key signal 00032 00033 00034 #ifndef CRENDERER__H 00035 #define CRENDERER__H 00036 00037 00038 // Own 00040 #include "QSimpleViewer.h" 00041 00042 // Qt 00044 #include <qmainwindow.h> 00045 #include <qslider.h> 00046 #include <qgl.h> 00047 00048 00049 // System 00051 #include <math.h> 00052 00053 00054 00055 00062 class CSimpleRenderer : public QObject { 00063 Q_OBJECT 00064 00065 //****** All methods ****** 00066 00067 public: 00068 CSimpleRenderer(QGLViewer*); 00069 00070 ~CSimpleRenderer(); 00071 00072 QGLViewer* getViewer(void) { return m_pViewer; }; 00073 00074 void MakeGlList(); 00075 00076 private: 00078 GLuint processHits(GLint hits, GLuint buffer[]); 00079 00080 00081 // **** All the slots ***** 00082 private slots: 00083 00085 void sltInitializeGL(); 00086 00088 void sltResizeGL(int w, int h); 00089 00091 void sltPaintGL(); 00092 00094 void sltManageSelection(QMouseEvent *pqEvent); 00095 00097 void sltManageRelease(QMouseEvent *pqEvent); 00098 00100 void sltManageMove(QMouseEvent *pqEvent); 00101 00103 void sltCatchKey(int); 00104 00107 void sltResetSelection(); 00108 00109 private: 00110 00112 void renderScene(void); 00113 00115 void renderSolidSphere(const CP3D &cCenter, float radius, 00116 int n1, int n2, float lw=2.5); 00117 00119 void renderWireSphere(const CP3D &cCenter, float radius, 00120 int n1, int n2, float lw=2.5); 00121 00122 //****** All data ****** 00123 00124 QGLViewer *m_pViewer; 00125 00126 GLuint m_glDispList; 00127 00128 bool m_afSelected[12]; // select state of the spheres 00129 00130 bool m_fLeftButtonPressed; // saves left button state 00131 bool m_fMiddleButtonPressed; // saves middle button state 00132 bool m_fRightButtonPressed; // saves right button state 00133 00134 CP3D m_cSphereCenter[12]; // saves centers of the spheres 00135 00136 int m_nMousePosX, m_nMousePosY; // last mouse position 00137 }; 00138 00139 #endif // CRENDERER__H

/* * CSimpleRenderer.cpp * $Id: CSimpleRenderer.cpp,v 1.2 2001/11/15 16:54:51 guenth Exp $ * * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * As a special exception to the GPL, the QGLViewer authors (Markus * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas * Woerner) give permission to link this program with Qt (non-)commercial * edition, and distribute the resulting executable, without including * the source code for the Qt (non-)commercial edition in the source * distribution. * */ // Description : Implementation of the example renderer // Own #include "CSimpleRenderer.h" // Qt #include <qapplication.h> #include <qstring.h> #include <qgl.h> #include <qmenubar.h> // only for the menu #include <qpopupmenu.h> // only for the menu // System #include <iostream.h> #include <math.h> // defines #define SELECT_BUF_SIZE 512 // Function : CSimpleRenderer // Parameters : // Purpose : // Comments : CSimpleRenderer::CSimpleRenderer(QGLViewer *pViewer) : QObject() /******************************************************************/ { int i; m_pViewer = pViewer; for (i=0; i<12; i++) m_afSelected[i] = false; m_fLeftButtonPressed = m_fMiddleButtonPressed = m_fRightButtonPressed = false; m_cSphereCenter[0] = CP3D(0.0, 0.0, 1.0); m_cSphereCenter[1] = CP3D(-1.0, 0.0, 0.0); m_cSphereCenter[2] = CP3D(1.0, 0.0, 0.0); m_cSphereCenter[3] = CP3D(0.0, 0.0, -2.5); m_cSphereCenter[4] = CP3D(0.0, -3.0, 0.0); m_cSphereCenter[5] = CP3D(-3.5, 0.0, 0.0); m_cSphereCenter[6] = CP3D(0.0, 0.0, -1.0); m_cSphereCenter[7] = CP3D(0.0, 1.0, 0.0); m_cSphereCenter[8] = CP3D(0.0,-1.0, 0.0); m_cSphereCenter[9] = CP3D(0.0, 0.0, 2.5); m_cSphereCenter[10] = CP3D(0.0, 3.0, 0.0); m_cSphereCenter[11] = CP3D(3.5, 0.0, 0.0); MakeGlList(); return; } // Function : ~CSimpleRenderer // Parameters : // Purpose : // Comments : CSimpleRenderer::~CSimpleRenderer() /**************************************************************/ { glDeleteLists(m_glDispList, 1); } // Function : MakeGlList // Parameters : // Purpose : // Comments : void CSimpleRenderer::MakeGlList() /**************************************************************/ { m_pViewer->makeCurrent(); // generate display list for bounding box if (glIsList(m_glDispList)) glDeleteLists(m_glDispList, 1); m_glDispList = glGenLists(1); glNewList(m_glDispList, GL_COMPILE); glLineWidth(1.5); // Determine bounding box CP3D LowerLeft = m_pViewer->getCamera().getBoundingBox().getLowerLeft(); CP3D UpperRight = m_pViewer->getCamera().getBoundingBox().getUpperRight(); // Draw box glColor3f(1.0, 1.0, 1.0); glBegin(GL_LINE_LOOP); glVertex3f(LowerLeft[0], LowerLeft[1], LowerLeft[2]); glVertex3f(UpperRight[0], LowerLeft[1], LowerLeft[2]); glVertex3f(UpperRight[0], UpperRight[1], LowerLeft[2]); glVertex3f(LowerLeft[0], UpperRight[1], LowerLeft[2]); glEnd(); glBegin(GL_LINE_LOOP); glVertex3f(LowerLeft[0], LowerLeft[1], UpperRight[2]); glVertex3f(UpperRight[0], LowerLeft[1], UpperRight[2]); glVertex3f(UpperRight[0], UpperRight[1], UpperRight[2]); glVertex3f(LowerLeft[0], UpperRight[1], UpperRight[2]); glEnd(); glBegin(GL_LINES); glVertex3f(LowerLeft[0], LowerLeft[1], LowerLeft[2]); glVertex3f(LowerLeft[0], LowerLeft[1], UpperRight[2]); glEnd(); glBegin(GL_LINES); glVertex3f(UpperRight[0], LowerLeft[1], LowerLeft[2]); glVertex3f(UpperRight[0], LowerLeft[1], UpperRight[2]); glEnd(); glBegin(GL_LINES); glVertex3f(UpperRight[0], UpperRight[1], LowerLeft[2]); glVertex3f(UpperRight[0], UpperRight[1], UpperRight[2]); glEnd(); glBegin(GL_LINES); glVertex3f(LowerLeft[0], UpperRight[1], LowerLeft[2]); glVertex3f(LowerLeft[0], UpperRight[1], UpperRight[2]); glEnd(); glEndList(); return; } // Function : renderScene // Parameters : ... // Purpose : // Comments : void CSimpleRenderer::renderScene(void) /**************************************************************/ { float mat_specular[] = { .72, .8, .93, 1.0 }; // render bounding box glCallList(m_glDispList); glDepthFunc(GL_LEQUAL); glEnable(GL_DEPTH_TEST); glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glLineWidth(1.5); glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 128.0); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glEnable(GL_NORMALIZE); if(m_afSelected[0]) glColor3f(1.0, 1.0, 1.0); else glColor3f(.5, .5, 1.0); glLoadName(1); // assign name '1' which will reply in selectionmode renderSolidSphere(m_cSphereCenter[0], 1.0,16,16); if(m_afSelected[1]) glColor3f(1.0, 1.0, 1.0); else glColor3f(1.0, 0.0, 0.0); glLoadName(2); // assign name '2' which will reply in selectionmode renderSolidSphere(m_cSphereCenter[1], 1.0,16,16); if(m_afSelected[2]) glColor3f(1.0, 1.0, 1.0); else glColor3f(0.0, 1.0, 0.0); glLoadName(3); // assign name '3' which will reply in selectionmode renderSolidSphere(m_cSphereCenter[2], 1.0,16,16); if(m_afSelected[3]) glColor3f(1.0, 1.0, 1.0); else glColor3f(0.0, 1.0, 1.0); glLoadName(4); // assign name '4' which will reply in selectionmode renderSolidSphere(m_cSphereCenter[3], 0.5,8,8); if(m_afSelected[4]) glColor3f(1.0, 1.0, 1.0); else glColor3f(1.0, 0.0, 1.0); glLoadName(5); // assign name '5' which will reply in selectionmode renderSolidSphere(m_cSphereCenter[4], 0.5,8,8); if(m_afSelected[5]) glColor3f(1.0, 1.0, 1.0); else glColor3f(1.0, 1.0, 0.0); glLoadName(6); // assign name '6' which will reply in selectionmode renderSolidSphere(m_cSphereCenter[5], 0.5,8,8); glDisable(GL_LIGHT0); glDisable(GL_LIGHTING); if(m_afSelected[6]) glColor3f(1.0, 1.0, 1.0); else glColor3f(1.0, 1.0, 0.0); glLoadName(7); // assign name '7' which will reply in selectionmode renderWireSphere(m_cSphereCenter[6], 1.0,16,16); if(m_afSelected[7]) glColor3f(1.0, 1.0, 1.0); else glColor3f(0.0, 0.0, 1.0); glLoadName(8); // assign name '8' which will reply in selectionmode renderWireSphere(m_cSphereCenter[7], 1.0,16,16); if(m_afSelected[8]) glColor3f(1.0, 1.0, 1.0); else glColor3f(1.0, 0.0, 1.0); glLoadName(9); // assign name '9' which will reply in selectionmode renderWireSphere(m_cSphereCenter[8], 1.0,16,16); if(m_afSelected[9]) glColor3f(1.0, 1.0, 1.0); else glColor3f(1.0, 0.0, 0.0); glLoadName(10); // assign name '10' which will reply in selectionmode renderWireSphere(m_cSphereCenter[9], 0.5,16,16,1.0); if(m_afSelected[10]) glColor3f(1.0, 1.0, 1.0); else glColor3f(0.0, 1.0, 0.0); glLoadName(11); // assign name '11' which will reply in selectionmode renderWireSphere(m_cSphereCenter[10], 0.5,16,16,1.0); if(m_afSelected[11]) glColor3f(1.0, 1.0, 1.0); else glColor3f(0.0, 0.0, 1.0); glLoadName(12); // assign name '12' which will reply in selectionmode renderWireSphere(m_cSphereCenter[11], 0.5,16,16,1.0); return; } // Function : renderSolidSphere // Parameters : ... // Purpose : // Comments : void CSimpleRenderer::renderSolidSphere(const CP3D &cCenter, float radius, int n1,int n2,float lw) /**************************************************************/ { static GLUquadricObj *quadObj; static int entry = 0; int sphere_slices = n1; int sphere_stacks = n2; glEnable(GL_COLOR_MATERIAL); glPushMatrix(); glTranslatef(cCenter.getX(), cCenter.getY(), cCenter.getZ()); quadObj = gluNewQuadric (); if (!entry) { gluQuadricDrawStyle (quadObj, (GLenum)GLU_FILL); gluQuadricOrientation(quadObj, (GLenum)GLU_OUTSIDE); gluQuadricNormals (quadObj, (GLenum)GLU_SMOOTH); } gluSphere (quadObj, radius, sphere_slices, sphere_stacks); gluDeleteQuadric(quadObj); glPopMatrix(); glDisable(GL_COLOR_MATERIAL); return; } // Function : renderWireSphere // Parameters : ... // Purpose : // Comments : void CSimpleRenderer::renderWireSphere(const CP3D &cCenter, float radius, int n1,int n2,float lw) /**************************************************************/ { static GLUquadricObj *quadObj; static int entry = 0; int sphere_slices = n1; int sphere_stacks = n2; glLineWidth(lw); glEnable(GL_COLOR_MATERIAL); glPushMatrix(); glTranslatef(cCenter.getX(), cCenter.getY(), cCenter.getZ()); quadObj = gluNewQuadric (); if (!entry) { gluQuadricDrawStyle (quadObj, (GLenum)GLU_LINE); gluQuadricOrientation(quadObj, (GLenum)GLU_OUTSIDE); gluQuadricNormals (quadObj, (GLenum)GLU_SMOOTH); } gluSphere (quadObj, radius, sphere_slices, sphere_stacks); gluDeleteQuadric(quadObj); glPopMatrix(); glDisable(GL_COLOR_MATERIAL); return; } // Function : sltCatchKey // Parameters : int nTmp // Purpose : // Comments : void CSimpleRenderer::sltCatchKey(int nTmp) /**************************************************************/ { cout << "CSimpleRenderer: Caught the signal! It is a " << nTmp; cout << " (ascii)" << endl; return; } // Function : sltResetSelection // Parameters : // Purpose : Slot to reset selection // Comments : void CSimpleRenderer::sltResetSelection() /**************************************************************/ { int i; for (i=0; i<12; i++) m_afSelected[i] = false; m_pViewer->sltUpdateView(); return; } // Function : sltInitializeGL // Parameters : // Purpose : Set up the OpenGL rendering state // Comments : void CSimpleRenderer::sltInitializeGL() /**************************************************************/ { m_pViewer->makeCurrent(); glClearColor(0.0, 0.0, 0.0, 0.0); // Let OpenGL clear to black glShadeModel(GL_SMOOTH); // enable flat shading glMatrixMode(GL_MODELVIEW); return; } // Function : sltResizeGL // Parameters : // Purpose : // Comments : if something special should be done after resizing void CSimpleRenderer::sltResizeGL(int w, int h) /**************************************************************/ { return; } // Function : sltPaintGL // Parameters : // Purpose : Slot for paint "events" // Comments : Actual openGL commands for drawing box are performed void CSimpleRenderer::sltPaintGL() /**************************************************************/ { // now render your own stuff renderScene(); return; } // Function : sltManageSelection // Parameters : // Purpose : // Comments : void CSimpleRenderer::sltManageSelection(QMouseEvent *pqEvent) /**************************************************************/ { GLuint selectBuf[SELECT_BUF_SIZE]; // HARD coded limit!!! GLint hits; GLint viewport[4]; double ardVVolume[6]; unsigned int nChosen; // Save state of mouse buttons if ( pqEvent->button() == LeftButton ) { m_fLeftButtonPressed = true; } if ( pqEvent->button() == MidButton ) { m_fMiddleButtonPressed = true; } if ( pqEvent->button() == RightButton ) { m_fRightButtonPressed = true; } // save mouse position m_nMousePosX = pqEvent->x(); m_nMousePosY = pqEvent->y(); if(m_fLeftButtonPressed) { // get camera data m_pViewer->getCameraPtr()->getVVolume(ardVVolume); m_pViewer->makeCurrent(); glGetIntegerv(GL_VIEWPORT, viewport); glSelectBuffer(SELECT_BUF_SIZE, selectBuf); glRenderMode(GL_SELECT); glInitNames(); glPushName(0); glPushMatrix(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); // create 10x10 pixel picking region near cursor location. gluPickMatrix((GLdouble) m_nMousePosX, (GLdouble) (viewport[3] - m_nMousePosY), 5.0, 5.0, viewport); if (m_pViewer->getProjectionMode() == QGLViewer::perspective) glFrustum(ardVVolume[0], ardVVolume[1], ardVVolume[2], ardVVolume[3], ardVVolume[4], ardVVolume[5]); else glOrtho(ardVVolume[0], ardVVolume[1], ardVVolume[2], ardVVolume[3], ardVVolume[4], ardVVolume[5]); glMatrixMode(GL_MODELVIEW); renderScene(); glPopMatrix(); glFlush(); hits = glRenderMode(GL_RENDER); nChosen = processHits(hits, selectBuf); if(nChosen>0) m_afSelected[nChosen-1] = m_afSelected[nChosen-1] ? false : true; m_pViewer->sltUpdateView(); } return; } // Function : processHits // Parameters : // Purpose : processHits prints out the contents of the selection array // Comments : GLuint CSimpleRenderer::processHits (GLint hits, GLuint buffer[]) /**************************************************************/ { unsigned int i, j; GLuint names, nChosen, *ptr; float rfZValue, rfZ1; if(hits != 0) { nChosen = 1; rfZValue = (float)*(buffer+1)/0x7fffffff; cout << "Number of hits is = " << hits << endl; cout << "Now show all hits!" << endl; ptr = (GLuint *) buffer; for (i=0; i<hits; i++) { // for each hit names = *ptr; cout << "Number of names for this hit: " << ptr; ptr++; rfZ1 = (float) *ptr/0x7fffffff; cout << " z1 = " << rfZ1; ptr++; cout << " z2 = " << (float) *ptr/0x7fffffff << endl; ptr++; cout << " ..... and the names are: "; if(rfZValue >= rfZ1) { rfZValue = rfZ1; nChosen = *ptr; } for (j=0; j<names; j++) { // for each name cout << *ptr << " "; ptr++; } cout << endl; } } else { nChosen = 0; } cout << "Chosen sphere: " <<nChosen << endl; return nChosen; } // Function : sltManageRelease // Parameters : // Purpose : // Comments : void CSimpleRenderer::sltManageRelease(QMouseEvent *pqEvent) /**************************************************************/ { // Save state of mouse buttons if ( pqEvent->button() == LeftButton ) { m_fLeftButtonPressed = false; } if ( pqEvent->button() == MidButton ) { m_fMiddleButtonPressed = false; } if ( pqEvent->button() == RightButton ) { m_fRightButtonPressed = false; } } // Function : sltManageMove // Parameters : // Purpose : // Comments : void CSimpleRenderer::sltManageMove(QMouseEvent *pqEvent) /**************************************************************/ { int i, nDiffX, nDiffY; float rfDistance, rfTransX, rfTransY, rfVTan, rfHTan; CCamera *pCamera; CP3D cNewCenter; if(m_fMiddleButtonPressed) { nDiffX = pqEvent->x() - m_nMousePosX; nDiffY = m_nMousePosY - pqEvent->y(); pCamera = m_pViewer->getCameraPtr(); // save mouse position m_nMousePosX = pqEvent->x(); m_nMousePosY = pqEvent->y(); // now do the move for(i=0; i<12; i++) { if(m_afSelected[i]) { // calculations just heuristic. Don't really try to understand it. rfDistance = (m_cSphereCenter[i] - pCamera->getEyePos()).getNorm(); rfVTan = tan(pCamera->getFovy()/360.0*M_PI); rfHTan = tan((pCamera->getFovy()*pCamera->getRatio()) / 360.0 * M_PI); rfTransX = (rfHTan * float(nDiffX)) / m_pViewer->getDrawArea()->width() * rfDistance * 2.1; rfTransY = (rfVTan * float(nDiffY)) / m_pViewer->getDrawArea()->height() * rfDistance * 2.1; cNewCenter = m_cSphereCenter[i] + pCamera->getViewRight() * rfTransX + pCamera->getViewUp() * rfTransY; if(pCamera->getBoundingBox().isInside(cNewCenter)) m_cSphereCenter[i] = cNewCenter; } } m_pViewer->sltUpdateView(); } return; }
00001 /* 00002 * CSimpleRenderer.cpp 00003 * $Id: CSimpleRenderer.cpp,v 1.2 2001/11/15 16:54:51 guenth Exp $ 00004 * 00005 * Copyright (C) 1999, 2000 Markus Janich, Michael Meissner 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * As a special exception to the GPL, the QGLViewer authors (Markus 00022 * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas 00023 * Woerner) give permission to link this program with Qt (non-)commercial 00024 * edition, and distribute the resulting executable, without including 00025 * the source code for the Qt (non-)commercial edition in the source 00026 * distribution. 00027 * 00028 */ 00029 00030 // Description : Implementation of the example renderer 00031 00032 00042 // Own 00044 #include "CSimpleRenderer.h" 00045 00046 00047 // Qt 00049 #include <qapplication.h> 00050 #include <qstring.h> 00051 #include <qgl.h> 00052 #include <qmenubar.h> // only for the menu 00053 #include <qpopupmenu.h> // only for the menu 00054 00055 // System 00057 #include <iostream.h> 00058 #include <math.h> 00059 00060 // defines 00062 #define SELECT_BUF_SIZE 512 00063 00064 00065 00066 // Function : CSimpleRenderer 00067 // Parameters : 00068 // Purpose : 00069 // Comments : 00070 CSimpleRenderer::CSimpleRenderer(QGLViewer *pViewer) 00071 : QObject() 00072 /******************************************************************/ 00073 { 00074 int i; 00075 00076 m_pViewer = pViewer; 00077 00078 for (i=0; i<12; i++) 00079 m_afSelected[i] = false; 00080 00081 m_fLeftButtonPressed = m_fMiddleButtonPressed = m_fRightButtonPressed = false; 00082 00083 m_cSphereCenter[0] = CP3D(0.0, 0.0, 1.0); 00084 m_cSphereCenter[1] = CP3D(-1.0, 0.0, 0.0); 00085 m_cSphereCenter[2] = CP3D(1.0, 0.0, 0.0); 00086 m_cSphereCenter[3] = CP3D(0.0, 0.0, -2.5); 00087 m_cSphereCenter[4] = CP3D(0.0, -3.0, 0.0); 00088 m_cSphereCenter[5] = CP3D(-3.5, 0.0, 0.0); 00089 m_cSphereCenter[6] = CP3D(0.0, 0.0, -1.0); 00090 m_cSphereCenter[7] = CP3D(0.0, 1.0, 0.0); 00091 m_cSphereCenter[8] = CP3D(0.0,-1.0, 0.0); 00092 m_cSphereCenter[9] = CP3D(0.0, 0.0, 2.5); 00093 m_cSphereCenter[10] = CP3D(0.0, 3.0, 0.0); 00094 m_cSphereCenter[11] = CP3D(3.5, 0.0, 0.0); 00095 00096 MakeGlList(); 00097 00098 return; 00099 } 00100 00101 00102 00103 // Function : ~CSimpleRenderer 00104 // Parameters : 00105 // Purpose : 00106 // Comments : 00107 CSimpleRenderer::~CSimpleRenderer() 00108 /**************************************************************/ 00109 { 00110 glDeleteLists(m_glDispList, 1); 00111 } 00112 00113 00114 00115 // Function : MakeGlList 00116 // Parameters : 00117 // Purpose : 00118 // Comments : 00119 void CSimpleRenderer::MakeGlList() 00120 /**************************************************************/ 00121 { 00122 m_pViewer->makeCurrent(); 00123 00124 // generate display list for bounding box 00126 if (glIsList(m_glDispList)) 00127 glDeleteLists(m_glDispList, 1); 00128 m_glDispList = glGenLists(1); 00129 glNewList(m_glDispList, GL_COMPILE); 00130 00131 glLineWidth(1.5); 00132 00133 // Determine bounding box 00135 CP3D LowerLeft = m_pViewer->getCamera().getBoundingBox().getLowerLeft(); 00136 CP3D UpperRight = m_pViewer->getCamera().getBoundingBox().getUpperRight(); 00137 00138 // Draw box 00140 glColor3f(1.0, 1.0, 1.0); 00141 glBegin(GL_LINE_LOOP); 00142 glVertex3f(LowerLeft[0], LowerLeft[1], LowerLeft[2]); 00143 glVertex3f(UpperRight[0], LowerLeft[1], LowerLeft[2]); 00144 glVertex3f(UpperRight[0], UpperRight[1], LowerLeft[2]); 00145 glVertex3f(LowerLeft[0], UpperRight[1], LowerLeft[2]); 00146 glEnd(); 00147 00148 glBegin(GL_LINE_LOOP); 00149 glVertex3f(LowerLeft[0], LowerLeft[1], UpperRight[2]); 00150 glVertex3f(UpperRight[0], LowerLeft[1], UpperRight[2]); 00151 glVertex3f(UpperRight[0], UpperRight[1], UpperRight[2]); 00152 glVertex3f(LowerLeft[0], UpperRight[1], UpperRight[2]); 00153 glEnd(); 00154 00155 glBegin(GL_LINES); 00156 glVertex3f(LowerLeft[0], LowerLeft[1], LowerLeft[2]); 00157 glVertex3f(LowerLeft[0], LowerLeft[1], UpperRight[2]); 00158 glEnd(); 00159 00160 glBegin(GL_LINES); 00161 glVertex3f(UpperRight[0], LowerLeft[1], LowerLeft[2]); 00162 glVertex3f(UpperRight[0], LowerLeft[1], UpperRight[2]); 00163 glEnd(); 00164 00165 glBegin(GL_LINES); 00166 glVertex3f(UpperRight[0], UpperRight[1], LowerLeft[2]); 00167 glVertex3f(UpperRight[0], UpperRight[1], UpperRight[2]); 00168 glEnd(); 00169 00170 glBegin(GL_LINES); 00171 glVertex3f(LowerLeft[0], UpperRight[1], LowerLeft[2]); 00172 glVertex3f(LowerLeft[0], UpperRight[1], UpperRight[2]); 00173 glEnd(); 00174 00175 glEndList(); 00176 00177 return; 00178 } 00179 00180 00181 00182 // Function : renderScene 00183 // Parameters : ... 00184 // Purpose : 00185 // Comments : 00186 void CSimpleRenderer::renderScene(void) 00187 /**************************************************************/ 00188 { 00189 float mat_specular[] = { .72, .8, .93, 1.0 }; 00190 00191 // render bounding box 00193 glCallList(m_glDispList); 00194 00195 glDepthFunc(GL_LEQUAL); 00196 glEnable(GL_DEPTH_TEST); 00197 00198 glEnable(GL_LINE_SMOOTH); 00199 glEnable(GL_BLEND); 00200 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 00201 glLineWidth(1.5); 00202 00203 glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 00204 glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 128.0); 00205 00206 glEnable(GL_LIGHT0); 00207 glEnable(GL_LIGHTING); 00208 glEnable(GL_NORMALIZE); 00209 00210 00211 if(m_afSelected[0]) 00212 glColor3f(1.0, 1.0, 1.0); 00213 else 00214 glColor3f(.5, .5, 1.0); 00215 glLoadName(1); // assign name '1' which will reply in selectionmode 00216 renderSolidSphere(m_cSphereCenter[0], 1.0,16,16); 00217 00218 if(m_afSelected[1]) 00219 glColor3f(1.0, 1.0, 1.0); 00220 else 00221 glColor3f(1.0, 0.0, 0.0); 00222 glLoadName(2); // assign name '2' which will reply in selectionmode 00223 renderSolidSphere(m_cSphereCenter[1], 1.0,16,16); 00224 00225 if(m_afSelected[2]) 00226 glColor3f(1.0, 1.0, 1.0); 00227 else 00228 glColor3f(0.0, 1.0, 0.0); 00229 glLoadName(3); // assign name '3' which will reply in selectionmode 00230 renderSolidSphere(m_cSphereCenter[2], 1.0,16,16); 00231 00232 if(m_afSelected[3]) 00233 glColor3f(1.0, 1.0, 1.0); 00234 else 00235 glColor3f(0.0, 1.0, 1.0); 00236 glLoadName(4); // assign name '4' which will reply in selectionmode 00237 renderSolidSphere(m_cSphereCenter[3], 0.5,8,8); 00238 00239 if(m_afSelected[4]) 00240 glColor3f(1.0, 1.0, 1.0); 00241 else 00242 glColor3f(1.0, 0.0, 1.0); 00243 glLoadName(5); // assign name '5' which will reply in selectionmode 00244 renderSolidSphere(m_cSphereCenter[4], 0.5,8,8); 00245 00246 if(m_afSelected[5]) 00247 glColor3f(1.0, 1.0, 1.0); 00248 else 00249 glColor3f(1.0, 1.0, 0.0); 00250 glLoadName(6); // assign name '6' which will reply in selectionmode 00251 renderSolidSphere(m_cSphereCenter[5], 0.5,8,8); 00252 00253 glDisable(GL_LIGHT0); 00254 glDisable(GL_LIGHTING); 00255 00256 if(m_afSelected[6]) 00257 glColor3f(1.0, 1.0, 1.0); 00258 else 00259 glColor3f(1.0, 1.0, 0.0); 00260 glLoadName(7); // assign name '7' which will reply in selectionmode 00261 renderWireSphere(m_cSphereCenter[6], 1.0,16,16); 00262 00263 if(m_afSelected[7]) 00264 glColor3f(1.0, 1.0, 1.0); 00265 else 00266 glColor3f(0.0, 0.0, 1.0); 00267 glLoadName(8); // assign name '8' which will reply in selectionmode 00268 renderWireSphere(m_cSphereCenter[7], 1.0,16,16); 00269 00270 if(m_afSelected[8]) 00271 glColor3f(1.0, 1.0, 1.0); 00272 else 00273 glColor3f(1.0, 0.0, 1.0); 00274 glLoadName(9); // assign name '9' which will reply in selectionmode 00275 renderWireSphere(m_cSphereCenter[8], 1.0,16,16); 00276 00277 if(m_afSelected[9]) 00278 glColor3f(1.0, 1.0, 1.0); 00279 else 00280 glColor3f(1.0, 0.0, 0.0); 00281 glLoadName(10); // assign name '10' which will reply in selectionmode 00282 renderWireSphere(m_cSphereCenter[9], 0.5,16,16,1.0); 00283 00284 if(m_afSelected[10]) 00285 glColor3f(1.0, 1.0, 1.0); 00286 else 00287 glColor3f(0.0, 1.0, 0.0); 00288 glLoadName(11); // assign name '11' which will reply in selectionmode 00289 renderWireSphere(m_cSphereCenter[10], 0.5,16,16,1.0); 00290 00291 if(m_afSelected[11]) 00292 glColor3f(1.0, 1.0, 1.0); 00293 else 00294 glColor3f(0.0, 0.0, 1.0); 00295 glLoadName(12); // assign name '12' which will reply in selectionmode 00296 renderWireSphere(m_cSphereCenter[11], 0.5,16,16,1.0); 00297 00298 00299 return; 00300 } 00301 00302 00303 00304 // Function : renderSolidSphere 00305 // Parameters : ... 00306 // Purpose : 00307 // Comments : 00308 void CSimpleRenderer::renderSolidSphere(const CP3D &cCenter, float radius, 00309 int n1,int n2,float lw) 00310 /**************************************************************/ 00311 { 00312 static GLUquadricObj *quadObj; 00313 static int entry = 0; 00314 int sphere_slices = n1; 00315 int sphere_stacks = n2; 00316 00317 glEnable(GL_COLOR_MATERIAL); 00318 glPushMatrix(); 00319 glTranslatef(cCenter.getX(), cCenter.getY(), cCenter.getZ()); 00320 quadObj = gluNewQuadric (); 00321 if (!entry) { 00322 gluQuadricDrawStyle (quadObj, (GLenum)GLU_FILL); 00323 gluQuadricOrientation(quadObj, (GLenum)GLU_OUTSIDE); 00324 gluQuadricNormals (quadObj, (GLenum)GLU_SMOOTH); 00325 } 00326 gluSphere (quadObj, radius, sphere_slices, sphere_stacks); 00327 gluDeleteQuadric(quadObj); 00328 00329 glPopMatrix(); 00330 glDisable(GL_COLOR_MATERIAL); 00331 00332 return; 00333 } 00334 00335 00336 00337 // Function : renderWireSphere 00338 // Parameters : ... 00339 // Purpose : 00340 // Comments : 00341 void CSimpleRenderer::renderWireSphere(const CP3D &cCenter, float radius, 00342 int n1,int n2,float lw) 00343 /**************************************************************/ 00344 { 00345 static GLUquadricObj *quadObj; 00346 static int entry = 0; 00347 int sphere_slices = n1; 00348 int sphere_stacks = n2; 00349 00350 glLineWidth(lw); 00351 glEnable(GL_COLOR_MATERIAL); 00352 glPushMatrix(); 00353 glTranslatef(cCenter.getX(), cCenter.getY(), cCenter.getZ()); 00354 quadObj = gluNewQuadric (); 00355 if (!entry) { 00356 gluQuadricDrawStyle (quadObj, (GLenum)GLU_LINE); 00357 gluQuadricOrientation(quadObj, (GLenum)GLU_OUTSIDE); 00358 gluQuadricNormals (quadObj, (GLenum)GLU_SMOOTH); 00359 } 00360 gluSphere (quadObj, radius, sphere_slices, sphere_stacks); 00361 gluDeleteQuadric(quadObj); 00362 00363 glPopMatrix(); 00364 glDisable(GL_COLOR_MATERIAL); 00365 00366 return; 00367 } 00368 00369 00370 00371 // Function : sltCatchKey 00372 // Parameters : int nTmp 00373 // Purpose : 00374 // Comments : 00375 void CSimpleRenderer::sltCatchKey(int nTmp) 00376 /**************************************************************/ 00377 { 00378 cout << "CSimpleRenderer: Caught the signal! It is a " << nTmp; 00379 cout << " (ascii)" << endl; 00380 00381 return; 00382 } 00383 00384 00385 00386 // Function : sltResetSelection 00387 // Parameters : 00388 // Purpose : Slot to reset selection 00389 // Comments : 00390 void CSimpleRenderer::sltResetSelection() 00391 /**************************************************************/ 00392 { 00393 int i; 00394 00395 for (i=0; i<12; i++) 00396 m_afSelected[i] = false; 00397 00398 m_pViewer->sltUpdateView(); 00399 00400 return; 00401 } 00402 00403 00404 00405 // Function : sltInitializeGL 00406 // Parameters : 00407 // Purpose : Set up the OpenGL rendering state 00408 // Comments : 00409 void CSimpleRenderer::sltInitializeGL() 00410 /**************************************************************/ 00411 { 00412 m_pViewer->makeCurrent(); 00413 glClearColor(0.0, 0.0, 0.0, 0.0); // Let OpenGL clear to black 00414 glShadeModel(GL_SMOOTH); // enable flat shading 00415 00416 glMatrixMode(GL_MODELVIEW); 00417 00418 return; 00419 } 00420 00421 00422 00423 // Function : sltResizeGL 00424 // Parameters : 00425 // Purpose : 00426 // Comments : if something special should be done after resizing 00427 void CSimpleRenderer::sltResizeGL(int w, int h) 00428 /**************************************************************/ 00429 { 00430 return; 00431 } 00432 00433 00434 00435 // Function : sltPaintGL 00436 // Parameters : 00437 // Purpose : Slot for paint "events" 00438 // Comments : Actual openGL commands for drawing box are performed 00439 void CSimpleRenderer::sltPaintGL() 00440 /**************************************************************/ 00441 { 00442 // now render your own stuff 00444 renderScene(); 00445 00446 return; 00447 } 00448 00449 00450 00451 // Function : sltManageSelection 00452 // Parameters : 00453 // Purpose : 00454 // Comments : 00455 void CSimpleRenderer::sltManageSelection(QMouseEvent *pqEvent) 00456 /**************************************************************/ 00457 { 00458 GLuint selectBuf[SELECT_BUF_SIZE]; // HARD coded limit!!! 00459 GLint hits; 00460 GLint viewport[4]; 00461 double ardVVolume[6]; 00462 unsigned int nChosen; 00463 00464 // Save state of mouse buttons 00466 if ( pqEvent->button() == LeftButton ) { 00467 m_fLeftButtonPressed = true; 00468 } 00469 if ( pqEvent->button() == MidButton ) { 00470 m_fMiddleButtonPressed = true; 00471 } 00472 if ( pqEvent->button() == RightButton ) { 00473 m_fRightButtonPressed = true; 00474 } 00475 00476 // save mouse position 00478 m_nMousePosX = pqEvent->x(); 00479 m_nMousePosY = pqEvent->y(); 00480 00481 if(m_fLeftButtonPressed) { 00482 // get camera data 00484 m_pViewer->getCameraPtr()->getVVolume(ardVVolume); 00485 m_pViewer->makeCurrent(); 00486 00487 glGetIntegerv(GL_VIEWPORT, viewport); 00488 00489 glSelectBuffer(SELECT_BUF_SIZE, selectBuf); 00490 glRenderMode(GL_SELECT); 00491 00492 glInitNames(); 00493 glPushName(0); 00494 00495 glPushMatrix(); 00496 glMatrixMode(GL_PROJECTION); 00497 glLoadIdentity(); 00498 00499 // create 10x10 pixel picking region near cursor location. 00501 gluPickMatrix((GLdouble) m_nMousePosX, 00502 (GLdouble) (viewport[3] - m_nMousePosY), 00503 5.0, 5.0, viewport); 00504 if (m_pViewer->getProjectionMode() == QGLViewer::perspective) 00505 glFrustum(ardVVolume[0], ardVVolume[1], ardVVolume[2], 00506 ardVVolume[3], ardVVolume[4], ardVVolume[5]); 00507 else 00508 glOrtho(ardVVolume[0], ardVVolume[1], ardVVolume[2], 00509 ardVVolume[3], ardVVolume[4], ardVVolume[5]); 00510 00511 glMatrixMode(GL_MODELVIEW); 00512 renderScene(); 00513 00514 glPopMatrix(); 00515 glFlush(); 00516 00517 hits = glRenderMode(GL_RENDER); 00518 nChosen = processHits(hits, selectBuf); 00519 if(nChosen>0) 00520 m_afSelected[nChosen-1] = m_afSelected[nChosen-1] ? false : true; 00521 00522 m_pViewer->sltUpdateView(); 00523 } 00524 00525 return; 00526 } 00527 00528 00529 00530 // Function : processHits 00531 // Parameters : 00532 // Purpose : processHits prints out the contents of the selection array 00533 // Comments : 00534 GLuint CSimpleRenderer::processHits (GLint hits, GLuint buffer[]) 00535 /**************************************************************/ 00536 { 00537 unsigned int i, j; 00538 GLuint names, nChosen, *ptr; 00539 float rfZValue, rfZ1; 00540 00541 00542 if(hits != 0) { 00543 nChosen = 1; 00544 rfZValue = (float)*(buffer+1)/0x7fffffff; 00545 00546 cout << "Number of hits is = " << hits << endl; 00547 cout << "Now show all hits!" << endl; 00548 ptr = (GLuint *) buffer; 00549 00550 for (i=0; i<hits; i++) { // for each hit 00551 names = *ptr; 00552 cout << "Number of names for this hit: " << ptr; 00553 ptr++; 00554 rfZ1 = (float) *ptr/0x7fffffff; 00555 cout << " z1 = " << rfZ1; 00556 ptr++; 00557 cout << " z2 = " << (float) *ptr/0x7fffffff << endl; 00558 ptr++; 00559 cout << " ..... and the names are: "; 00560 00561 if(rfZValue >= rfZ1) { 00562 rfZValue = rfZ1; 00563 nChosen = *ptr; 00564 } 00565 00566 for (j=0; j<names; j++) { // for each name 00567 cout << *ptr << " "; 00568 ptr++; 00569 } 00570 cout << endl; 00571 } 00572 } 00573 else { 00574 nChosen = 0; 00575 } 00576 00577 cout << "Chosen sphere: " <<nChosen << endl; 00578 00579 return nChosen; 00580 } 00581 00582 00583 00584 // Function : sltManageRelease 00585 // Parameters : 00586 // Purpose : 00587 // Comments : 00588 void CSimpleRenderer::sltManageRelease(QMouseEvent *pqEvent) 00589 /**************************************************************/ 00590 { 00591 // Save state of mouse buttons 00593 if ( pqEvent->button() == LeftButton ) { 00594 m_fLeftButtonPressed = false; 00595 } 00596 if ( pqEvent->button() == MidButton ) { 00597 m_fMiddleButtonPressed = false; 00598 } 00599 if ( pqEvent->button() == RightButton ) { 00600 m_fRightButtonPressed = false; 00601 } 00602 } 00603 00604 00605 00606 // Function : sltManageMove 00607 // Parameters : 00608 // Purpose : 00609 // Comments : 00610 void CSimpleRenderer::sltManageMove(QMouseEvent *pqEvent) 00611 /**************************************************************/ 00612 { 00613 int i, nDiffX, nDiffY; 00614 float rfDistance, rfTransX, rfTransY, rfVTan, rfHTan; 00615 CCamera *pCamera; 00616 CP3D cNewCenter; 00617 00618 if(m_fMiddleButtonPressed) { 00619 00620 nDiffX = pqEvent->x() - m_nMousePosX; 00621 nDiffY = m_nMousePosY - pqEvent->y(); 00622 pCamera = m_pViewer->getCameraPtr(); 00623 00624 // save mouse position 00626 m_nMousePosX = pqEvent->x(); 00627 m_nMousePosY = pqEvent->y(); 00628 00629 // now do the move 00631 for(i=0; i<12; i++) { 00632 if(m_afSelected[i]) { 00633 // calculations just heuristic. Don't really try to understand it. 00634 rfDistance = (m_cSphereCenter[i] - pCamera->getEyePos()).getNorm(); 00635 rfVTan = tan(pCamera->getFovy()/360.0*M_PI); 00636 rfHTan = tan((pCamera->getFovy()*pCamera->getRatio()) / 360.0 * M_PI); 00637 rfTransX = (rfHTan * float(nDiffX)) / m_pViewer->getDrawArea()->width() * rfDistance * 2.1; 00638 rfTransY = (rfVTan * float(nDiffY)) / m_pViewer->getDrawArea()->height() * rfDistance * 2.1; 00639 00640 cNewCenter = m_cSphereCenter[i] 00641 + pCamera->getViewRight() * rfTransX 00642 + pCamera->getViewUp() * rfTransY; 00643 if(pCamera->getBoundingBox().isInside(cNewCenter)) 00644 m_cSphereCenter[i] = cNewCenter; 00645 } 00646 } 00647 00648 m_pViewer->sltUpdateView(); 00649 00650 } 00651 00652 return; 00653 }

Main program:
/* * CameraPathPlayer.cpp * * Copyright (C) 2001 Michael Meissner, Alexander Buck * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * As a special exception to the GPL, the QGLViewer authors (Markus * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas * Woerner) give permission to link this program with Qt (non-)commercial * edition, and distribute the resulting executable, without including * the source code for the Qt (non-)commercial edition in the source * distribution. * */ /* [tw] 2001/04/29 initial version */ // System #include <stdlib.h> #include <string.h> #include <stdio.h> // Qt #include <qapplication.h> #include <qstring.h> #include <qgl.h> #include <qmenubar.h> // only for the menu #include <qpopupmenu.h> // only for the menu // QGLViewer #include <QGLExaminerViewer.h> #include <CP3D.h> // Own #include "CPlayerRenderer.h" #include "CBoundingBox3D.h" #include "QCameraPathPlayer.h" // // // // // M A I N // // // // // int main(int argc, char *argv[]) { // start Qt stuff QApplication::setColorSpec(QApplication::CustomColor); QApplication app(argc,argv); QGLFormat f; QGLFormat::setDefaultFormat(f); QGLExaminerViewer *pViewer = new QGLExaminerViewer(CCamera(0.0, 0.0, -25.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, CBoundingBox3D(-4.0,-4.0,-4.0, 4.0,4.0,4.0)), NULL, "viewer", NULL, 0, true, f); // fullviewer Q_CHECK_PTR(pViewer); QCameraPathPlayer *pPlayer = new QCameraPathPlayer(pViewer); Q_CHECK_PTR(pPlayer); pPlayer->show(); // generate new renderer CPlayerRenderer *pRenderer = new CPlayerRenderer(pViewer); Q_CHECK_PTR(pRenderer); // Connect signals of pPlayer with slots of renderer QObject::connect(pViewer, SIGNAL(sigInitGL()), pRenderer, SLOT(sltInitializeGL())); QObject::connect(pViewer, SIGNAL(sigResizeGL(int,int)), pRenderer, SLOT(sltResizeGL(int,int))); QObject::connect(pViewer, SIGNAL(sigRedrawGL()), pRenderer, SLOT(sltPaintGL())); // Launch pPlayer app.setMainWidget(pViewer); pViewer->resize(450, 420); pViewer->show(); int nRet = app.exec(); delete pRenderer; delete pPlayer; delete pViewer; return nRet; }
00001 /* 00002 * CameraPathPlayer.cpp 00003 * 00004 * Copyright (C) 2001 Michael Meissner, Alexander Buck 00005 * 00006 * This program is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software 00018 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 * 00020 * As a special exception to the GPL, the QGLViewer authors (Markus 00021 * Janich, Michael Meissner, Richard Guenther, Alexander Buck and Thomas 00022 * Woerner) give permission to link this program with Qt (non-)commercial 00023 * edition, and distribute the resulting executable, without including 00024 * the source code for the Qt (non-)commercial edition in the source 00025 * distribution. 00026 * 00027 */ 00028 00029 /* 00030 [tw] 2001/04/29 initial version 00031 */ 00032 00033 00034 // System 00036 #include <stdlib.h> 00037 #include <string.h> 00038 #include <stdio.h> 00039 00040 // Qt 00042 #include <qapplication.h> 00043 #include <qstring.h> 00044 #include <qgl.h> 00045 #include <qmenubar.h> // only for the menu 00046 #include <qpopupmenu.h> // only for the menu 00047 00048 // QGLViewer 00050 #include <QGLExaminerViewer.h> 00051 #include <CP3D.h> 00052 00053 // Own 00055 #include "CPlayerRenderer.h" 00056 #include "CBoundingBox3D.h" 00057 #include "QCameraPathPlayer.h" 00058 00059 00060 00063 // // 00064 // // 00065 // M A I N // 00066 // // 00067 // // 00070 int main(int argc, char *argv[]) 00071 { 00072 // start Qt stuff 00074 QApplication::setColorSpec(QApplication::CustomColor); 00075 QApplication app(argc,argv); 00076 00077 QGLFormat f; 00078 QGLFormat::setDefaultFormat(f); 00079 00080 QGLExaminerViewer *pViewer = new QGLExaminerViewer(CCamera(0.0, 0.0, -25.0, 00081 0.0, 0.0, 0.0, 00082 0.0, 1.0, 0.0, 00083 CBoundingBox3D(-4.0,-4.0,-4.0, 00084 4.0,4.0,4.0)), 00085 NULL, "viewer", NULL, 0, true, f); // fullviewer 00086 Q_CHECK_PTR(pViewer); 00087 00088 QCameraPathPlayer *pPlayer = new QCameraPathPlayer(pViewer); 00089 Q_CHECK_PTR(pPlayer); 00090 pPlayer->show(); 00091 00092 00093 // generate new renderer 00095 CPlayerRenderer *pRenderer = new CPlayerRenderer(pViewer); 00096 Q_CHECK_PTR(pRenderer); 00097 00098 // Connect signals of pPlayer with slots of renderer 00100 QObject::connect(pViewer, SIGNAL(sigInitGL()), 00101 pRenderer, SLOT(sltInitializeGL())); 00102 QObject::connect(pViewer, SIGNAL(sigResizeGL(int,int)), 00103 pRenderer, SLOT(sltResizeGL(int,int))); 00104 QObject::connect(pViewer, SIGNAL(sigRedrawGL()), 00105 pRenderer, SLOT(sltPaintGL())); 00106 00107 // Launch pPlayer 00109 app.setMainWidget(pViewer); 00110 pViewer->resize(450, 420); 00111 pViewer->show(); 00112 00113 int nRet = app.exec(); 00114 00115 delete pRenderer; 00116 delete pPlayer; 00117 delete pViewer; 00118 00119 return nRet; 00120 }


Constructor & Destructor Documentation

QGLExaminerViewer::QGLExaminerViewer QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0,
WFlags  f = 0,
bool  viewertype = true,
const QGLFormat &  format = QGLFormat::defaultFormat()
[inline]
 

Default Constructor.

QGLExaminerViewer::QGLExaminerViewer const CCamera homecam,
QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0,
WFlags  f = 0,
bool  viewertype = true,
const QGLFormat &  format = QGLFormat::defaultFormat()
[inline]
 

Constructor including a camera for the home position of the scene.

NOTE: The current camera will also be set to the given homecam.

QGLExaminerViewer::QGLExaminerViewer const CBoundingBox3D cBBox,
QWidget *  parent = 0,
const char *  name = 0,
const QGLWidget *  shareWidget = 0,
WFlags  f = 0,
bool  viewertype = true,
const QGLFormat &  format = QGLFormat::defaultFormat()
[inline]
 

Constructor including the bounding box of the scene.

virtual QGLExaminerViewer::~QGLExaminerViewer  )  [inline, virtual]
 

Default Destructor.


Member Function Documentation

void QGLExaminerViewer::closeEvent QCloseEvent *  event  )  [protected, virtual]
 

Implements a handler for CloseEvents. The default emits a sigViewerClosed()-signal and then calls the closeEvent()-function of the QWidget-class.

virtual void QGLExaminerViewer::enableMouseEvents bool  state  )  [inline, virtual]
 

Reimplements inherited function to stop the timer if running.

Reimplemented from QGLViewer.

bool QGLExaminerViewer::eventFilter QObject *  pqObject,
QEvent *  pqEvent
[protected]
 

Implements inherited method.

void QGLExaminerViewer::init bool  viewertype  )  [private]
 

Initializes all stuff that is unique to all constructors.

void QGLExaminerViewer::keyPressEvent QKeyEvent *  event  )  [protected, virtual]
 

Implements a handler for keyPressEvents. You can overwrite this method in your derived class. Original implementation manage the following keys:
i : opens a box with this key definitions
CURSOR_UP : rotate "back" around x-axis
CURSOR_DOWN : rotate "to the front" around x-axis
CURSOR_LEFT : rotate left around y-axis
CURSOR_RIGHT : rotate right around y-axis
a : view all
s : set homecamera to current camera
h : set current camera to homecamera
p : toggle projectionmode
+ : zoom in
- : zoom out
ESC or q : exit application
CTRL+CURSOR_LEFT : translate to the left
CTRL+CURSOR_RIGHT : translate to the right
CTRL+CURSOR_UP : translate up
CTRL+CURSOR_DOWN : translate down
SHIFT+CURSOR_UP : move forward
SHIFT+CURSOR_DOWN : move back

Reimplemented in QSimpleViewer, and QSceneTreeViewer.

void QGLExaminerViewer::makeFullViewer  )  [protected, virtual]
 

Manage the layout of a fullviewer after it is constructed or 'setFullViewer(true)' is called.

void QGLExaminerViewer::makeSimpleViewer  )  [protected, virtual]
 

Manage the layout of a non-fullviewer after it is constructed or 'setFullViewer(false)' is called.

void QGLExaminerViewer::ManageMouseMove QMouseEvent *  event  )  [protected, virtual]
 

Implements the method from the derived class QGLViever.

Reimplemented from QGLViewer.

void QGLExaminerViewer::ManageMousePress QMouseEvent *  event  )  [protected, virtual]
 

Implements the method from the derived class QGLViever.

Reimplemented from QGLViewer.

void QGLExaminerViewer::ManageMouseRelease QMouseEvent *  event  )  [protected, virtual]
 

Implements the method from the derived class QGLViever.

Reimplemented from QGLViewer.

void QGLExaminerViewer::setCamera const CCamera Camera,
CameraType  which = CurrentCam
[virtual]
 

Reimplements inherited function for interaction with zoom-slider.

Reimplemented from QGLViewer.

void QGLExaminerViewer::setFullViewer bool  state  )  [virtual]
 

Reimplements inherited function.

Reimplemented from QGLViewer.

void QGLExaminerViewer::sigViewerClosed void   )  [signal]
 

This signal is emitted when the window of the viewer is closed.

void QGLExaminerViewer::sltCamRotStep  )  [private, slot]
 

Rotates the camera around the x- and y-axis depending on the values saved in 'm_nXDiff', 'm_nYDiff', 'm_rfXAlpha' and 'm_rfYAlpha'. Usually it will be connected with a Timer for animated rotation.

void QGLExaminerViewer::sltCamXRotate int  iAngle  )  [private, slot]
 

Rotate camera around the x-axis with an angle of 'iAngle' degrees. This slot emits the signal sigCameraChanged() for the application which owns the viewer.

void QGLExaminerViewer::sltCamYRotate int  iAngle  )  [private, slot]
 

Rotate camera around the y-axis with an angle of 'iAngle' degrees. This slot emits the signal sigCameraChanged() for the application which owns the viewer.

void QGLExaminerViewer::sltGoHome  )  [protected, virtual, slot]
 

Reimplementes inherited function for interaction with zoom-slider and other GUI things.

Reimplemented from QGLViewer.

void QGLExaminerViewer::sltMenuToggleRenderMode  )  [private, slot]
 

Toggles the render mode by using the menu.

void QGLExaminerViewer::sltResetXSlider  )  [slot]
 

Sets the value of the slider which handles the rotationangle around the x-axis to zero.

void QGLExaminerViewer::sltResetYSlider  )  [slot]
 

Sets the value of the slider which handles the rotationangle around the y-axis to zero.

void QGLExaminerViewer::sltSaveVectors  )  [private, slot]
 

Saves the ViewUp direction in 'vUp' and the ViewRight direction in 'vRight'.

virtual void QGLExaminerViewer::sltSetCamera const CCamera cCamera  )  [inline, protected, virtual, slot]
 

This slot sets the current camera to the one passed by the argument.

void QGLExaminerViewer::sltSetRefreshRate  )  [private, slot]
 

Shows an dialog to enter a new refresh rate.

void QGLExaminerViewer::sltSetZoom int  zoom_factor  )  [private, slot]
 

Adjusts the camera while zooming.

void QGLExaminerViewer::sltSetZoomSlider const QString &  qText  )  [private, slot]
 

void QGLExaminerViewer::sltSetZoomSlider double  rdFovy  )  [private, slot]
 

Sets the value of the slider, which handles the fovy angle, to the new value. The allowed range goes from 0 to 180 (degrees).

void QGLExaminerViewer::sltSetZoomSlider int  scaling  )  [slot]
 

Sets the value of the slider, which handles the fovy angle, to the new value. The allowed range goes from 0 to 18000.

See also:
ScalingChanged(int)

void QGLExaminerViewer::sltSetZoomText int  n  )  [private, slot]
 

void QGLExaminerViewer::sltSwitchBehave  )  [inline, private, slot]
 

Switches between old and new mousehandling.

void QGLExaminerViewer::sltTimeOut  )  [inline, private, slot]
 

Manages the timeout for animation.

void QGLExaminerViewer::sltToggleDeco  )  [private, slot]
 

Toggles between full and simple viewer.

void QGLExaminerViewer::sltToggleRenderMode  )  [protected, virtual, slot]
 

Reimplementation of the inherited slot.

Reimplemented from QGLViewer.

void QGLExaminerViewer::sltToggleSpinning  )  [inline, private, slot]
 

Toggles spinning on and off.

void QGLExaminerViewer::sltToggleStereo  )  [virtual, slot]
 

Reimplementation of the inherited slot.

Reimplemented from QGLViewer.

void QGLExaminerViewer::sltToggleToolTips  )  [private, slot]
 

Toggles between the tooltip on and off. Initially the tooltips are off


Member Data Documentation

QWidget* QGLExaminerViewer::m_apqWidgets[NUM_WIDGETS] [private]
 

CV3D QGLExaminerViewer::m_cDir [private]
 

CV3D QGLExaminerViewer::m_cRight [private]
 

CV3D QGLExaminerViewer::m_cUp [private]
 

bool QGLExaminerViewer::m_fAnimationOn [private]
 

bool QGLExaminerViewer::m_fLeftButtonPressed [private]
 

bool QGLExaminerViewer::m_fMiddleButtonPressed [private]
 

bool QGLExaminerViewer::m_fOldBehave [private]
 

bool QGLExaminerViewer::m_fShiftPressed [private]
 

bool QGLExaminerViewer::m_fToolTips [private]
 

int QGLExaminerViewer::m_nDecoID [private]
 

int QGLExaminerViewer::m_nLastRotAngle [private]
 

int QGLExaminerViewer::m_nMousePosX [private]
 

int QGLExaminerViewer::m_nMousePosY [private]
 

int QGLExaminerViewer::m_nQuadrant [private]
 

int QGLExaminerViewer::m_nSelectionID [private]
 

int QGLExaminerViewer::m_nSpinOnOffID [private]
 

int QGLExaminerViewer::m_nStereoID [private]
 

int QGLExaminerViewer::m_nSwitchBehaveID [private]
 

int QGLExaminerViewer::m_nTTipsID [private]
 

int QGLExaminerViewer::m_nXDiff [private]
 

int QGLExaminerViewer::m_nYDiff [private]
 

QTimer * QGLExaminerViewer::m_pqTimeOut [private]
 

QTimer* QGLExaminerViewer::m_pqTimer [private]
 

QBoxLayout* QGLExaminerViewer::m_pqTopLayout [private]
 

QSlider* QGLExaminerViewer::m_pqXRot [private]
 

QSlider * QGLExaminerViewer::m_pqYRot [private]
 

QSlider * QGLExaminerViewer::m_pqZoom [private]
 

QLineEdit* QGLExaminerViewer::m_pqZoomText [private]
 

float QGLExaminerViewer::m_rfXAlpha [private]
 

float QGLExaminerViewer::m_rfYAlpha [private]
 


The documentation for this class was generated from the following files:
Generated on Sun May 16 12:02:03 2004 for QGLViewer by doxygen 1.3.7