00001 /* 00002 * QSceneTreeRenderer.h 00003 * $Id: QSceneTreeRenderer.h,v 1.6 2001/09/28 11:06:08 mjanich Exp $ 00004 * 00005 * Copyright (C) 2001 Richard Guenther, Markus Janich 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 the QSceneTreeRenderer class 00024 // Purpose : 00025 // 00026 00027 #ifndef __QSCENETREERENDERER_H 00028 #define __QSCENETREERENDERER_H 00029 00030 #include "QSceneTreeNode.h" 00031 #include "QGLViewer.h" 00032 00033 class QTimer; 00034 00035 #define SELECT_BUF_SIZE 1024 00036 00037 00038 /* Renderer object that is itself the scene tree root node 00039 * which only has to handle requestUpdate() requests itself. 00040 */ 00041 00042 class QSceneTreeRenderer : public QObject, public QSceneTreeNode { 00043 Q_OBJECT 00044 00045 public: 00046 /* Default constructor. */ 00047 QSceneTreeRenderer(QGLViewer *pViewer); 00048 /* Destructor. */ 00049 ~QSceneTreeRenderer(); 00050 00051 /* 00052 * QSceneTreeNode part. 00053 */ 00054 00058 virtual void requestUpdate(); 00059 00060 /* 00061 * QGLViewer interaction part. 00062 */ 00063 00064 public slots: 00066 // PUBLIC SLOTS // 00068 00070 virtual void sltManageSelection(QMouseEvent *pqEvent); 00071 00073 virtual void sltManageRelease(QMouseEvent *pqEvent); 00074 00076 virtual void sltManageMove(QMouseEvent *pqEvent); 00077 00079 virtual void sltInitializeGL(); 00080 00084 virtual void sltPaintGL(); 00085 00086 00087 protected slots: 00088 /* A m_fNeedUpdate polling timer handler. */ 00089 virtual void sltPollUpdate(); 00090 00091 protected: 00093 // PRIVATE METHODS // 00095 00097 virtual GLuint processHits(GLint hits, GLuint buffer[]); 00098 00100 void traverseTree(int &nId, QSceneTreeNode *node); 00101 00103 // PRIVATE MEMBERS // 00105 00106 QGLViewer * const m_pViewer; 00107 bool m_fNeedUpdate; 00108 QTimer *m_pTimer; 00109 00110 bool m_fLeftButtonPressed, 00111 m_fMiddleButtonPressed, 00112 m_fRightButtonPressed; 00113 int m_nMousePosX, m_nMousePosY; 00114 unsigned int m_nChosen; 00115 }; 00116 00117 00118 #endif