00001 /* 00002 * QSceneTreeRenderer.h 00003 * $Id: QSceneTreeRenderer.h,v 1.7 2001/11/15 16:54:52 guenth 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 * 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 the QSceneTreeRenderer class 00031 // Purpose : 00032 // 00033 00034 #ifndef __QSCENETREERENDERER_H 00035 #define __QSCENETREERENDERER_H 00036 00037 #include "QSceneTreeNode.h" 00038 #include "QGLViewer.h" 00039 00040 class QTimer; 00041 00042 #define SELECT_BUF_SIZE 1024 00043 00044 00045 /* Renderer object that is itself the scene tree root node 00046 * which only has to handle requestUpdate() requests itself. 00047 */ 00048 00049 class QSceneTreeRenderer : public QObject, public QSceneTreeNode { 00050 Q_OBJECT 00051 00052 public: 00053 /* Default constructor. */ 00054 QSceneTreeRenderer(QGLViewer *pViewer); 00055 /* Destructor. */ 00056 ~QSceneTreeRenderer(); 00057 00058 /* 00059 * QSceneTreeNode part. 00060 */ 00061 00065 virtual void requestUpdate(); 00066 00067 /* 00068 * QGLViewer interaction part. 00069 */ 00070 00071 public slots: 00073 // PUBLIC SLOTS // 00075 00077 virtual void sltManageSelection(QMouseEvent *pqEvent); 00078 00080 virtual void sltManageRelease(QMouseEvent *pqEvent); 00081 00083 virtual void sltManageMove(QMouseEvent *pqEvent); 00084 00086 virtual void sltInitializeGL(); 00087 00091 virtual void sltPaintGL(); 00092 00093 00094 protected slots: 00095 /* A m_fNeedUpdate polling timer handler. */ 00096 virtual void sltPollUpdate(); 00097 00098 protected: 00100 // PRIVATE METHODS // 00102 00104 virtual GLuint processHits(GLint hits, GLuint buffer[]); 00105 00107 void traverseTree(int &nId, QSceneTreeNode *node); 00108 00110 // PRIVATE MEMBERS // 00112 00113 QGLViewer * const m_pViewer; 00114 bool m_fNeedUpdate; 00115 QTimer *m_pTimer; 00116 00117 bool m_fLeftButtonPressed, 00118 m_fMiddleButtonPressed, 00119 m_fRightButtonPressed; 00120 int m_nMousePosX, m_nMousePosY; 00121 unsigned int m_nChosen; 00122 }; 00123 00124 00125 #endif