• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

volumerenderer.h

Go to the documentation of this file.
00001 #ifndef VOLUMERENDERER_H
00002 #define VOLUMERENDERER_H
00003 
00004 #include <QtGui>
00005 #include <QtOpenGL>
00006 #include <QGLWidget>
00007 
00008 #include "GL/glext.h"
00009 
00010 #include "arthurwidgets.h"
00011 
00012 #include "Volume.h"
00013 #include "renderingoptions.h"
00014 
00015 /****************************************************************************
00016  **
00017  ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00018  ** All rights reserved.
00019  ** Contact: Nokia Corporation (qt-info@nokia.com)
00020  **
00021  ** This file is part of the examples of the Qt Toolkit.
00022  **
00023  ** $QT_BEGIN_LICENSE:BSD$
00024  ** You may use this file under the terms of the BSD license as follows:
00025  **
00026  ** "Redistribution and use in source and binary forms, with or without
00027  ** modification, are permitted provided that the following conditions are
00028  ** met:
00029  **   * Redistributions of source code must retain the above copyright
00030  **     notice, this list of conditions and the following disclaimer.
00031  **   * Redistributions in binary form must reproduce the above copyright
00032  **     notice, this list of conditions and the following disclaimer in
00033  **     the documentation and/or other materials provided with the
00034  **     distribution.
00035  **   * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
00036  **     the names of its contributors may be used to endorse or promote
00037  **     products derived from this software without specific prior written
00038  **     permission.
00039  **
00040  ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00041  ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00042  ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00043  ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00044  ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00045  ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00046  ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00047  ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00048  ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00049  ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00050  ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
00051  ** $QT_END_LICENSE$
00052  **
00053  ****************************************************************************/
00054 
00059  class VolumeRenderer : public QGLWidget
00060  {
00061      Q_OBJECT
00062 
00063  public:
00069      VolumeRenderer(QWidget *parent = 0);
00070 
00075      ~VolumeRenderer();
00076 
00082          //void paint(QPainter *p);
00083 
00089          //void paintEvent(QPaintEvent *e);
00090 
00091          QSize minimumSizeHint() const;
00092          QSize sizeHint() const;
00093 
00094  public:
00095     void setVolume(Volume* volume);
00096     void setTransfer();
00097     void setRenderingOptions(RenderingOptions *options);
00098 
00099      public slots:
00105          void setGradientStops(const QGradientStops &stops);
00106  public slots:
00107      void setXRotation(int angle);
00108      void setYRotation(int angle);
00109      void setZRotation(int angle);
00110 
00111  signals:
00112      void xRotationChanged(int angle);
00113      void yRotationChanged(int angle);
00114      void zRotationChanged(int angle);
00115 
00116  protected:
00117      virtual void initializeGL();
00118      virtual void paintGL();
00119      virtual void resizeGL(int width, int height);
00120      void mousePressEvent(QMouseEvent *event);
00121      void mouseMoveEvent(QMouseEvent *event);
00122 
00123  private:
00124      QGradientStops m_stops; 
00126      QImage *image; 
00128      QImage transferLUT; 
00136      QRgb transfer(float value);
00137 
00139 
00143      void updateTransfer();
00144  private:
00145      int xRot;
00146      int yRot;
00147      int zRot;
00148      QPoint lastPos;
00149  private:
00150      QGLShaderProgram *program;
00151      int vertexLocation, texCoordLocation;
00152      int n0Location, uLocation, vLocation;
00153      int NLocation, volumeSizeLocation, volumeResolutionLocation;
00154      int samplerLocation;
00155      int lightColorLocation;
00156      int ambientColorLocation;
00157      int diffuseColorLocation;
00158      int specularColorLocation;
00159      int specularExponentLocation;
00160      int transferLocation;
00161      int k1Location, k2Location;
00162 
00163      int width, height; // witdh and height of viewport
00164 
00165      Volume *volume;
00166      RenderingOptions *options;
00167      GLuint textureName;
00168      GLuint transferTextureName;
00169 
00170      PFNGLTEXIMAGE3DEXTPROC glTexImage3DEXT1;
00171      PFNGLACTIVETEXTUREPROC glActiveTextureEXT1;
00172 
00173  };
00174 
00175 #endif // VOLUMERENDERER_H

Generated on Mon Dec 6 2010 12:10:16 for LU Visualisierung WS2010 - Beispiel 1 by  doxygen 1.7.2