Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

CSimpleRenderer.h

Go to the documentation of this file.
00001 /*
00002  * CSimpleRenderer.h
00003  * $Id: CSimpleRenderer.h,v 1.2 2001/10/01 10:14:49 mjanich 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  */
00022 
00023 //  Description : Definition of an example renderer drawing a cube
00024 //                in wire frame and catching a key signal 
00025 
00026 
00027 #ifndef CRENDERER__H
00028 #define CRENDERER__H
00029     
00030     
00031 // Own
00033 #include "QSimpleViewer.h"
00034 
00035 // Qt
00037 #include <qmainwindow.h>
00038 #include <qslider.h>
00039 #include <qgl.h>
00040 
00041 
00042 // System
00044 #include <math.h>
00045 
00046 
00047 
00048 
00055 class CSimpleRenderer : public QObject {
00056   Q_OBJECT
00057 
00058   //****** All methods ******
00059 
00060 public:
00061   CSimpleRenderer(QGLViewer*);
00062 
00063   ~CSimpleRenderer();
00064 
00065   QGLViewer* getViewer(void) { return m_pViewer; };
00066 
00067   void MakeGlList();
00068 
00069 private:
00071   GLuint processHits(GLint hits, GLuint buffer[]);
00072 
00073 
00074   // **** All the slots *****
00075 private slots:
00076 
00078   void sltInitializeGL();
00079 
00081   void sltResizeGL(int w, int h);
00082 
00084   void sltPaintGL();
00085 
00087   void sltManageSelection(QMouseEvent *pqEvent);
00088 
00090   void sltManageRelease(QMouseEvent *pqEvent);
00091 
00093   void sltManageMove(QMouseEvent *pqEvent);
00094 
00096   void sltCatchKey(int);
00097 
00100   void sltResetSelection();
00101 
00102 private:
00103 
00105   void renderScene(void);
00106 
00108   void renderSolidSphere(const CP3D &cCenter, float radius,
00109                          int n1, int n2, float lw=2.5);
00110 
00112   void renderWireSphere(const CP3D &cCenter, float radius,
00113                         int n1, int n2, float lw=2.5);
00114 
00115   //****** All data ******
00116 
00117   QGLViewer *m_pViewer;
00118 
00119   GLuint m_glDispList;
00120 
00121   bool m_afSelected[12];               // select state of the spheres
00122 
00123   bool m_fLeftButtonPressed;           // saves left button state
00124   bool m_fMiddleButtonPressed;         // saves middle button state
00125   bool m_fRightButtonPressed;          // saves right button state
00126 
00127   CP3D m_cSphereCenter[12];            // saves centers of the spheres
00128 
00129   int m_nMousePosX, m_nMousePosY;      // last mouse position
00130 };
00131 
00132 #endif // CRENDERER__H 

Generated at Thu Oct 4 17:17:25 2001 for QGLViewer by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001