00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
#ifndef CRENDERER__H
00035
#define CRENDERER__H
00036
00037
00038
00040
#include "QSimpleViewer.h"
00041
00042
00044
#include <qmainwindow.h>
00045
#include <qslider.h>
00046
#include <qgl.h>
00047
00048
00049
00051
#include <math.h>
00052
00053
00054
00055
00062 class CSimpleRenderer :
public QObject {
00063 Q_OBJECT
00064
00065
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
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
00123
00124 QGLViewer *
m_pViewer;
00125
00126 GLuint
m_glDispList;
00127
00128 bool m_afSelected[12];
00129
00130 bool m_fLeftButtonPressed;
00131 bool m_fMiddleButtonPressed;
00132 bool m_fRightButtonPressed;
00133
00134 CP3D m_cSphereCenter[12];
00135
00136 int m_nMousePosX,
m_nMousePosY;
00137 };
00138
00139
#endif // CRENDERER__H