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

CSimpleRenderer.h

Go to the documentation of this file.
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

Generated on Sun May 16 12:02:02 2004 for QGLViewer by doxygen 1.3.7