00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2005-2008 Trolltech ASA. All rights reserved. 00004 ** 00005 ** This file is part of the example classes of the Qt Toolkit. 00006 ** 00007 ** This file may be used under the terms of the GNU General Public 00008 ** License versions 2.0 or 3.0 as published by the Free Software 00009 ** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 00010 ** included in the packaging of this file. Alternatively you may (at 00011 ** your option) use any later version of the GNU General Public 00012 ** License if such license has been publicly approved by Trolltech ASA 00013 ** (or its successors, if any) and the KDE Free Qt Foundation. In 00014 ** addition, as a special exception, Trolltech gives you certain 00015 ** additional rights. These rights are described in the Trolltech GPL 00016 ** Exception version 1.1, which can be found at 00017 ** http://www.trolltech.com/products/qt/gplexception/ and in the file 00018 ** GPL_EXCEPTION.txt in this package. 00019 ** 00020 ** Please review the following information to ensure GNU General 00021 ** Public Licensing requirements will be met: 00022 ** http://trolltech.com/products/qt/licenses/licensing/opensource/. If 00023 ** you are unsure which license is appropriate for your use, please 00024 ** review the following information: 00025 ** http://trolltech.com/products/qt/licenses/licensing/licensingoverview 00026 ** or contact the sales department at sales@trolltech.com. 00027 ** 00028 ** In addition, as a special exception, Trolltech, as the sole 00029 ** copyright holder for Qt Designer, grants users of the Qt/Eclipse 00030 ** Integration plug-in the right for the Qt/Eclipse Integration to 00031 ** link to functionality provided by Qt Designer and its related 00032 ** libraries. 00033 ** 00034 ** This file is provided "AS IS" with NO WARRANTY OF ANY KIND, 00035 ** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR 00036 ** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly 00037 ** granted herein. 00038 ** 00039 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00040 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00041 ** 00042 ****************************************************************************/ 00043 00044 #ifndef VRGLWIDGET_H 00045 #define VRGLWIDGET_H 00046 00047 #include "VolumeBuffer.h" 00048 #include "VolumeRender.h" 00049 00050 #include <QGLWidget> 00051 00052 00053 class vrGLWidget : public QGLWidget 00054 { 00055 Q_OBJECT 00056 00057 public: 00058 vrGLWidget(QWidget *parent = 0); 00059 ~vrGLWidget(); 00060 00061 QSize minimumSizeHint() const; 00062 //QSize sizeHint() const; 00063 QSize sizeHint() const { return QSize(512, 512); } 00064 00065 void setVolumeRender(VolumeRender *volume_render) { m_vr = volume_render; } 00066 00067 public slots: 00068 void setXRotation(int angle); 00069 void setYRotation(int angle); 00070 void setZRotation(int angle); 00071 void setTFtexture(QImage &tfimg); 00072 void setTFtexture1(QImage &tfimg); 00073 void setTFtexture2(QImage &tfimg); 00074 void setTFtexture3(QImage &tfimg); 00075 void vr_load_data1(VolumeBuffer *vb1); 00076 00077 signals: 00078 void xRotationChanged(int angle); 00079 void yRotationChanged(int angle); 00080 void zRotationChanged(int angle); 00081 00082 protected: 00083 void initializeGL(); 00084 void paintGL(); 00085 void resizeGL(int width, int height); 00086 void mousePressEvent(QMouseEvent *event); 00087 void mouseMoveEvent(QMouseEvent *event); 00088 00089 private: 00090 GLuint makeObject(); 00091 void quad(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2, 00092 GLdouble x3, GLdouble y3, GLdouble x4, GLdouble y4); 00093 void extrude(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2); 00094 void normalizeAngle(int *angle); 00095 00096 GLuint object; 00097 int xRot; 00098 int yRot; 00099 int zRot; 00100 QPoint lastPos; 00101 QColor trolltechGreen; 00102 QColor trolltechPurple; 00103 00104 VolumeRender *m_vr; 00105 VolumeBuffer *m_vb; 00106 00107 //transfer function image 00108 QImage m_tfimg; 00109 unsigned char* m_tf_texture; 00110 00111 }; 00112 00113 #endif