# HG changeset patch # User John Tsiombikas # Date 1334430630 -10800 # Node ID 40df2cdc63234c161385fbb1d474a63e76038990 # Parent 93d889a3726a8318743a1d43d5f823b2f1ce70ba transfer function window diff -r 93d889a3726a -r 40df2cdc6323 src/ui.cc --- a/src/ui.cc Sat Apr 14 20:52:53 2012 +0300 +++ b/src/ui.cc Sat Apr 14 22:10:30 2012 +0300 @@ -3,6 +3,10 @@ #include #include #include "ui.h" +#include "ui_maingl.h" +#include "ui_sliceview.h" +#include "ui_xferview.h" + static Volume *volume; std::vector glwlist; @@ -64,16 +68,18 @@ SideWindow::SideWindow() { - QGroupBox *groupbox = new QGroupBox("Volume slice"); + QGroupBox *group_slice = new QGroupBox("Volume slice"); { slice_view = new SliceGLView(glwlist[0]); glwlist.push_back(slice_view); QCheckBox *chk_clip = new QCheckBox("clip"); + chk_clip->setStatusTip("Enable clipping at the current slice"); chk_clip->setChecked(false); connect(chk_clip, SIGNAL(stateChanged(int)), this, SLOT(clip_change(int))); QSlider *zslider = new QSlider(Qt::Horizontal); + zslider->setStatusTip("Change current Z slice"); zslider->setRange(0, 256); zslider->setValue(volray_getvalue(VolRayOpt::ZCURSOR) * 256.0); connect(zslider, SIGNAL(valueChanged(int)), this, SLOT(zslider_change(int))); @@ -83,14 +89,26 @@ vbox->addWidget(chk_clip); vbox->addWidget(zslider); - groupbox->setLayout(vbox); + group_slice->setLayout(vbox); + } + + QGroupBox *group_xfer = new QGroupBox("Transfer function"); + { + XFerGLView *xfer_view = new XFerGLView(glwlist[0]); + glwlist.push_back(xfer_view); + + QVBoxLayout *vbox = new QVBoxLayout; + vbox->addWidget(xfer_view); + + group_xfer->setLayout(vbox); } QWidget *win = new QWidget; setWidget(win); QVBoxLayout *vbox = new QVBoxLayout; - vbox->addWidget(groupbox); + vbox->addWidget(group_slice); + vbox->addWidget(group_xfer); vbox->addStretch(); win->setLayout(vbox); diff -r 93d889a3726a -r 40df2cdc6323 src/ui.h --- a/src/ui.h Sat Apr 14 20:52:53 2012 +0300 +++ b/src/ui.h Sat Apr 14 22:10:30 2012 +0300 @@ -4,10 +4,11 @@ #include #include #include "volray.h" -#include "ui_maingl.h" -#include "ui_sliceview.h" class SideWindow; +class MainGLView; +class SliceGLView; +class XFerGLView; // This is the main application window (duh) class MainWindow : public QMainWindow { @@ -22,8 +23,6 @@ public: MainWindow(); - - void update(); }; /* This is the detachable window with the volume slice view @@ -34,6 +33,7 @@ Q_OBJECT SliceGLView *slice_view; + XFerGLView *xfer_view; private slots: void zslider_change(int val); @@ -41,8 +41,6 @@ public: SideWindow(); - - void update(); }; // call to force a redisplay on all GL views diff -r 93d889a3726a -r 40df2cdc6323 src/ui_xferview.cc --- a/src/ui_xferview.cc Sat Apr 14 20:52:53 2012 +0300 +++ b/src/ui_xferview.cc Sat Apr 14 22:10:30 2012 +0300 @@ -1,26 +1,26 @@ #include "ui_xferview.h" #include "volray.h" -XFerView::XFerView(QGLWidget *share_widget) +XFerGLView::XFerGLView(QGLWidget *share_widget) : QGLWidget(QGLFormat(QGL::DoubleBuffer), 0, share_widget) { } -QSize XFerView::minimumSizeHint() const +QSize XFerGLView::minimumSizeHint() const { return QSize(160, 100); } -void XFerView::initializeGL() +void XFerGLView::initializeGL() { } -void XFerView::resizeGL(int xsz, int ysz) +void XFerGLView::resizeGL(int xsz, int ysz) { glViewport(0, 0, xsz, ysz); } -void XFerView::paintGL() +void XFerGLView::paintGL() { volray_draw_xfer(); } diff -r 93d889a3726a -r 40df2cdc6323 src/ui_xferview.h --- a/src/ui_xferview.h Sat Apr 14 20:52:53 2012 +0300 +++ b/src/ui_xferview.h Sat Apr 14 22:10:30 2012 +0300 @@ -3,7 +3,7 @@ #include -class XFerView : public QGLWidget { +class XFerGLView : public QGLWidget { private: Q_OBJECT @@ -12,7 +12,7 @@ void paintGL(); public: - XFerView(QGLWidget *share_widget = 0); + XFerGLView(QGLWidget *share_widget = 0); QSize minimumSizeHint() const; }; diff -r 93d889a3726a -r 40df2cdc6323 src/volray.cc --- a/src/volray.cc Sat Apr 14 20:52:53 2012 +0300 +++ b/src/volray.cc Sat Apr 14 22:10:30 2012 +0300 @@ -233,8 +233,8 @@ { glMatrixMode(GL_MODELVIEW); glPushMatrix(); - glTranslatef(-0.9, -0.9, 0); - glScalef(0.5, 0.1, 1); + glTranslatef(-1, -1, 0); + glScalef(2, 2, 1); glBindTexture(GL_TEXTURE_1D, xfer_tex); glEnable(GL_TEXTURE_1D);