Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
GraPa
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kai Westerkamp
GraPa
Commits
c0274af6
Commit
c0274af6
authored
Dec 07, 2015
by
Kai Westerkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
transfer functions
parent
9fa4f133
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
177 additions
and
45 deletions
+177
-45
camera.cpp
A3/camera.cpp
+1
-1
controler.cpp
A3/controler.cpp
+56
-25
cubewidget.cpp
A3/cubewidget.cpp
+0
-3
display.frag
A3/display.frag
+7
-7
glview.cpp
A3/glview.cpp
+9
-2
glview.h
A3/glview.h
+1
-0
hellocube.pro
A3/hellocube.pro
+7
-2
mainwindow.cpp
A3/mainwindow.cpp
+86
-1
mainwindow.h
A3/mainwindow.h
+6
-0
scene.cpp
A3/scene.cpp
+2
-2
sceneobject.cpp
A3/sceneobject.cpp
+1
-1
treedelegate.cpp
A3/treedelegate.cpp
+1
-1
No files found.
A3/camera.cpp
View file @
c0274af6
...
@@ -45,7 +45,7 @@ void Camera::setupCamera(GLdouble aspect )
...
@@ -45,7 +45,7 @@ void Camera::setupCamera(GLdouble aspect )
if
(
persp
){
if
(
persp
){
perspective
(
45.0
,
aspect
,
0.01
,
100.0
);
perspective
(
45.0
,
aspect
,
0.01
,
100.0
);
}
else
{
}
else
{
int
size
=
4
;
int
size
=
2
;
glOrtho
(
-
size
*
aspect
,
size
*
aspect
,
-
size
,
size
,
0.01
,
100.0
);
glOrtho
(
-
size
*
aspect
,
size
*
aspect
,
-
size
,
size
,
0.01
,
100.0
);
}
}
...
...
A3/controler.cpp
View file @
c0274af6
...
@@ -10,6 +10,7 @@ Controler::Controler(MainWindow *mainwindow,Scene *scene)
...
@@ -10,6 +10,7 @@ Controler::Controler(MainWindow *mainwindow,Scene *scene)
this
->
mainwindow
=
mainwindow
;
this
->
mainwindow
=
mainwindow
;
this
->
scene
=
scene
;
this
->
scene
=
scene
;
viewMode
=
CAMERA
;
viewMode
=
CAMERA
;
}
}
void
Controler
::
mousePressed
(
GLView
*
view
,
QMouseEvent
*
event
)
void
Controler
::
mousePressed
(
GLView
*
view
,
QMouseEvent
*
event
)
...
@@ -26,7 +27,7 @@ void Controler::mousePressed(GLView* view, QMouseEvent *event)
...
@@ -26,7 +27,7 @@ void Controler::mousePressed(GLView* view, QMouseEvent *event)
void
Controler
::
mouseMoveEvent
(
GLView
*
view
,
QMouseEvent
*
event
)
void
Controler
::
mouseMoveEvent
(
GLView
*
view
,
QMouseEvent
*
event
)
{
{
if
(
activeView
!=
view
)
if
(
activeView
!=
view
)
qDebug
()
<<
"Active view Change"
;
qDebug
()
<<
"Active view Change"
;
if
(
event
->
buttons
()
&
Qt
::
LeftButton
)
{
if
(
event
->
buttons
()
&
Qt
::
LeftButton
)
{
rotate
(
trackballPoint
(
event
->
pos
().
x
(),
event
->
pos
().
y
()));
rotate
(
trackballPoint
(
event
->
pos
().
x
(),
event
->
pos
().
y
()));
...
@@ -37,29 +38,29 @@ void Controler::mouseMoveEvent(GLView* view, QMouseEvent *event)
...
@@ -37,29 +38,29 @@ void Controler::mouseMoveEvent(GLView* view, QMouseEvent *event)
}
}
}
}
void
Controler
::
wheelEvent
(
GLView
*
view
,
QWheelEvent
*
event
)
{
void
Controler
::
wheelEvent
(
GLView
*
view
,
QWheelEvent
*
event
)
{
activeView
=
view
;
activeView
=
view
;
mainwindow
->
setActiveView
(
view
);
mainwindow
->
setActiveView
(
view
);
bool
ctrlPressed
=
QApplication
::
keyboardModifiers
()
&
Qt
::
ControlModifier
;
bool
ctrlPressed
=
QApplication
::
keyboardModifiers
()
&
Qt
::
ControlModifier
;
QVector3D
vec
;
QVector3D
vec
;
if
(
event
->
delta
()
<
0
)
if
(
event
->
delta
()
<
0
)
vec
=
QVector3D
(
0.0
,
0.0
,
1.0
);
vec
=
QVector3D
(
0.0
,
0.0
,
1.0
);
else
else
vec
=
QVector3D
(
0.0
,
0.0
,
-
1.0
);
vec
=
QVector3D
(
0.0
,
0.0
,
-
1.0
);
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
activeView
->
getCamera
()
->
move
(
vec
);
activeView
->
getCamera
()
->
move
(
vec
);
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
vec
=
activeView
->
getCamera
()
->
rotation
->
conjugate
().
rotatedVector
(
vec
);
vec
=
activeView
->
getCamera
()
->
rotation
->
conjugate
().
rotatedVector
(
vec
);
scene
->
moveActive
(
vec
);
scene
->
moveActive
(
vec
);
}
else
{
}
else
{
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
}
}
mainwindow
->
updateGL
();
mainwindow
->
updateGL
();
}
}
QVector3D
*
Controler
::
trackballPoint
(
int
x
,
int
y
){
QVector3D
*
Controler
::
trackballPoint
(
int
x
,
int
y
){
...
@@ -112,8 +113,8 @@ void Controler::move(QPointF * newPos){
...
@@ -112,8 +113,8 @@ void Controler::move(QPointF * newPos){
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
if
((
viewMode
==
CAMERA
)
^
ctrlPressed
){
activeView
->
getCamera
()
->
move
(
QVector3D
(
dx
,
dy
,
0.0
));
activeView
->
getCamera
()
->
move
(
QVector3D
(
dx
,
dy
,
0.0
));
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
}
else
if
((
viewMode
==
EDIT
)
^
ctrlPressed
){
QVector3D
vec
=
activeView
->
getCamera
()
->
rotation
->
conjugate
().
rotatedVector
(
QVector3D
(
dx
,
dy
,
0.0
));
QVector3D
vec
=
activeView
->
getCamera
()
->
rotation
->
conjugate
().
rotatedVector
(
QVector3D
(
dx
,
dy
,
0.0
));
scene
->
moveActive
(
vec
);
scene
->
moveActive
(
vec
);
}
else
{
}
else
{
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
qDebug
()
<<
"möp"
<<
viewMode
<<
" "
<<
CAMERA
<<
" "
<<
EDIT
;
}
}
...
@@ -173,6 +174,12 @@ void Controler::addVolume(QString filePath){
...
@@ -173,6 +174,12 @@ void Controler::addVolume(QString filePath){
char
***
data
=
new
char
**
[
z
];
char
***
data
=
new
char
**
[
z
];
int
*
histogram
=
new
int
[
256
];
for
(
int
i
=
0
;
i
<
256
;
i
++
)
{
histogram
[
i
]
=
0
;
}
int
count
=
0
;
int
count
=
0
;
// std::cout<<std::hex;
// std::cout<<std::hex;
...
@@ -187,9 +194,12 @@ void Controler::addVolume(QString filePath){
...
@@ -187,9 +194,12 @@ void Controler::addVolume(QString filePath){
data
[
k
][
j
]
=
new
char
[
x
];
data
[
k
][
j
]
=
new
char
[
x
];
for
(
int
i
=
0
;
i
<
x
;
i
++
)
for
(
int
i
=
0
;
i
<
x
;
i
++
)
{
{
data
[
k
][
j
][
i
]
=
rawdata
.
at
(
count
++
);
uchar
value
=
rawdata
.
at
(
count
++
);
data
[
k
][
j
][
i
]
=
value
;
histogram
[
value
]
++
;
if
(
k
==
printLine
){
if
(
k
==
printLine
){
int
temp
=
((
uchar
)
data
[
k
][
j
][
i
])
*
9
/
256
;
int
temp
=
value
*
9
/
256
;
std
::
cout
<<
temp
;
std
::
cout
<<
temp
;
}
}
}
}
...
@@ -199,6 +209,8 @@ void Controler::addVolume(QString filePath){
...
@@ -199,6 +209,8 @@ void Controler::addVolume(QString filePath){
}
}
}
}
//qDebug()<<file.readData(data,file.size()-file.pos());
//qDebug()<<file.readData(data,file.size()-file.pos());
int
type
=
GL_UNSIGNED_BYTE
;
int
type
=
GL_UNSIGNED_BYTE
;
if
(
rawdata
.
size
()
>
x
*
y
*
z
)
if
(
rawdata
.
size
()
>
x
*
y
*
z
)
...
@@ -207,12 +219,31 @@ void Controler::addVolume(QString filePath){
...
@@ -207,12 +219,31 @@ void Controler::addVolume(QString filePath){
for
(
int
i
=
0
;
i
<
4
;
i
++
)
for
(
int
i
=
0
;
i
<
4
;
i
++
)
mainwindow
->
getViews
()[
i
]
->
loadData
(
x
,
y
,
z
,
rawdata
.
data
(),
type
);
mainwindow
->
getViews
()[
i
]
->
loadData
(
x
,
y
,
z
,
rawdata
.
data
(),
type
);
SceneVolume
*
volume
=
new
SceneVolume
(
x
,
y
,
z
,
dx
,
dy
,
dz
);
SceneVolume
*
volume
=
new
SceneVolume
(
x
,
y
,
z
,
dx
,
dy
,
dz
);
scene
->
addSceneObjectTaActive
(
volume
);
scene
->
addSceneObjectTaActive
(
volume
);
file
.
close
();
file
.
close
();
uchar
*
trans
=
new
uchar
[
4
*
256
];
for
(
int
i
=
0
;
i
<
256
;
i
+=
1
){
int
index
=
i
*
4
;
trans
[
index
]
=
i
;
trans
[
index
+
1
]
=
i
;
trans
[
index
+
2
]
=
i
;
trans
[
index
+
3
]
=
i
;
}
for
(
int
i
=
0
;
i
<
4
;
i
++
){
// mainwindow->getViews()[i]->loadTransfer(trans);
}
this
->
mainwindow
->
transEditor
->
setHistogram
(
histogram
);
// this->mainwindow->transEditor->setTransferFunction(trans);
qDebug
()
<<
"File Read finish"
;
qDebug
()
<<
"File Read finish"
;
...
...
A3/cubewidget.cpp
View file @
c0274af6
...
@@ -255,8 +255,6 @@ void CubeWidget::mousePressEvent(QMouseEvent *event )
...
@@ -255,8 +255,6 @@ void CubeWidget::mousePressEvent(QMouseEvent *event )
lastSpeherePos
=
trackballPoint
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
lastSpeherePos
=
trackballPoint
(
event
->
pos
().
x
(),
event
->
pos
().
y
());
lastScreenPos
=
new
QPointF
(
event
->
screenPos
());
lastScreenPos
=
new
QPointF
(
event
->
screenPos
());
event
->
accept
();
event
->
accept
();
}
}
void
CubeWidget
::
mouseMoveEvent
(
QMouseEvent
*
event
)
void
CubeWidget
::
mouseMoveEvent
(
QMouseEvent
*
event
)
...
@@ -312,7 +310,6 @@ QVector3D* CubeWidget::trackballPoint(int x, int y){
...
@@ -312,7 +310,6 @@ QVector3D* CubeWidget::trackballPoint(int x, int y){
zo
=
qMax
(
qCos
(
M_PI_2
*
d
),
qreal
(
0.0
));
//qMin(d,1.0f)
zo
=
qMax
(
qCos
(
M_PI_2
*
d
),
qreal
(
0.0
));
//qMin(d,1.0f)
QVector3D
*
pos
=
new
QVector3D
(
xo
,
yo
,
zo
);
QVector3D
*
pos
=
new
QVector3D
(
xo
,
yo
,
zo
);
pos
->
normalize
();
pos
->
normalize
();
// qDebug()<<"x:"<< xo << " y:"<<yo<<" z:"<<zo;
// qDebug()<<"x:"<< xo << " y:"<<yo<<" z:"<<zo;
...
...
A3/display.frag
View file @
c0274af6
...
@@ -17,9 +17,10 @@ float stepsize = 0.001;
...
@@ -17,9 +17,10 @@ float stepsize = 0.001;
vec4
transfer
(
float
scalar
){
vec4
transfer
(
float
scalar
){
float
pos
=
(
scalar
*
255
.
0
/
256
.
0
+
0
.
5
*
256
.
0
);
float
pos
=
(
scalar
*
255
.
0
/
256
.
0
+
1
/
256
.
0
/
2
);
return
vec4
(
scalar
);
//return vec4(scalar);
//return texture1D(transferData,pos);
//return vec4(pos);
return
texture1D
(
transferData
,
pos
);
}
}
vec3
phong
(
vec3
color
,
vec3
normal
){
vec3
phong
(
vec3
color
,
vec3
normal
){
...
@@ -101,10 +102,9 @@ void main(void)
...
@@ -101,10 +102,9 @@ void main(void)
}
}
// gl_FragColor = vec4(gl_TexCoord[0].xyz,1);
//gl_FragColor = vec4(texture1D(transferData,front.x));
//gl_FragColor = vec4(vec3(count),1);
//gl_FragColor = vec4(normalize(step),1);
//gl_FragColor = vec4(gl_TexCoord[0].xyz,1);
//gl_FragColor = vec4(normalize(gl_ModelViewProjectionMatrixInverse*vec4(0,1,0,0.0)));
//gl_FragColor = vec4(texture3D(volumeData,vec3(front.xy,0.5)).x);
//gl_FragColor = vec4(texture3D(volumeData,vec3(front.xy,0.5)).x);
}
}
}
}
...
...
A3/glview.cpp
View file @
c0274af6
...
@@ -12,6 +12,7 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler )
...
@@ -12,6 +12,7 @@ GLView::GLView(Scene *scene,Camera * camera,Controler *controler )
gridStepSize
=
1
;
gridStepSize
=
1
;
isGridEnabled
=
false
;
isGridEnabled
=
false
;
MIP
=
false
;
MIP
=
false
;
afterInit
=
false
;
}
}
QSize
GLView
::
minimumSizeHint
()
const
QSize
GLView
::
minimumSizeHint
()
const
...
@@ -53,6 +54,7 @@ void GLView::initializeGL ( ) {
...
@@ -53,6 +54,7 @@ void GLView::initializeGL ( ) {
//Shader Setup
//Shader Setup
initShader
();
initShader
();
shader
->
bind
();
shader
->
bind
();
afterInit
=
true
;
}
}
void
GLView
::
initShader
()
void
GLView
::
initShader
()
...
@@ -432,18 +434,23 @@ void GLView::loadData(int width, int height, int depth, char* data, int type )
...
@@ -432,18 +434,23 @@ void GLView::loadData(int width, int height, int depth, char* data, int type )
void
GLView
::
loadTransfer
(
uchar
*
data
)
void
GLView
::
loadTransfer
(
uchar
*
data
)
{
{
// uchar *test = new uchar[4*256];
// for(int i = 0; i< 4*256;i++){
// test[i] = data[i];
// }
glGenTextures
(
1
,
&
transferFunction
);
glGenTextures
(
1
,
&
transferFunction
);
glBindTexture
(
GL_TEXTURE_1D
,
transferFunction
);
glBindTexture
(
GL_TEXTURE_1D
,
transferFunction
);
// Filtering
// Filtering
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MIN_FILTER
,
GL_
LINEAR
);
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MIN_FILTER
,
GL_
NEAREST
);
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MAG_FILTER
,
GL_
LINEAR
);
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_MAG_FILTER
,
GL_
NEAREST
);
// Wrap
// Wrap
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP
);
glTexParameteri
(
GL_TEXTURE_1D
,
GL_TEXTURE_WRAP_S
,
GL_CLAMP
);
glTexImage1D
(
GL_TEXTURE_1D
,
0
,
GL_RGBA
,
256
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
data
);
glTexImage1D
(
GL_TEXTURE_1D
,
0
,
GL_RGBA
,
256
,
0
,
GL_RGBA
,
GL_UNSIGNED_BYTE
,
data
);
if
(
afterInit
)
updateGL
();
}
}
...
...
A3/glview.h
View file @
c0274af6
...
@@ -44,6 +44,7 @@ public:
...
@@ -44,6 +44,7 @@ public:
Camera
*
getCamera
();
Camera
*
getCamera
();
private
:
private
:
bool
afterInit
;
QGLShaderProgram
*
shader
;
QGLShaderProgram
*
shader
;
QGLShaderProgram
*
displayShader
;
QGLShaderProgram
*
displayShader
;
Scene
*
scene
;
Scene
*
scene
;
...
...
A3/hellocube.pro
View file @
c0274af6
...
@@ -25,7 +25,8 @@ SOURCES += main.cpp\
...
@@ -25,7 +25,8 @@ SOURCES += main.cpp\
sceneobject
.
cpp
\
sceneobject
.
cpp
\
scenenode
.
cpp
\
scenenode
.
cpp
\
treedelegate
.
cpp
\
treedelegate
.
cpp
\
scenevolume
.
cpp
scenevolume
.
cpp
\
transferfunctioneditor
.
cpp
HEADERS
+=
mainwindow
.
h
\
HEADERS
+=
mainwindow
.
h
\
cubewidget
.
h
\
cubewidget
.
h
\
...
@@ -38,7 +39,8 @@ HEADERS += mainwindow.h \
...
@@ -38,7 +39,8 @@ HEADERS += mainwindow.h \
scenenode
.
h
\
scenenode
.
h
\
glut
.
h
\
glut
.
h
\
treedelegate
.
h
\
treedelegate
.
h
\
scenevolume
.
h
scenevolume
.
h
\
transferfunctioneditor
.
h
RESOURCES
+=
\
RESOURCES
+=
\
hellocube
.
qrc
hellocube
.
qrc
...
@@ -48,3 +50,6 @@ DISTFILES += \
...
@@ -48,3 +50,6 @@ DISTFILES += \
phong
.
vert
\
phong
.
vert
\
display
.
frag
\
display
.
frag
\
display
.
vert
display
.
vert
FORMS
+=
\
transferui
.
ui
A3/mainwindow.cpp
View file @
c0274af6
...
@@ -279,6 +279,8 @@ MainWindow::MainWindow(QWidget *parent)
...
@@ -279,6 +279,8 @@ MainWindow::MainWindow(QWidget *parent)
// Assemble Menus
// Assemble Menus
fileMenu
->
addAction
(
exitAction
);
fileMenu
->
addAction
(
exitAction
);
menuBar
->
addMenu
(
fileMenu
);
menuBar
->
addMenu
(
fileMenu
);
...
@@ -303,7 +305,7 @@ MainWindow::MainWindow(QWidget *parent)
...
@@ -303,7 +305,7 @@ MainWindow::MainWindow(QWidget *parent)
void
MainWindow
::
initScene
(){
void
MainWindow
::
initScene
(){
//scene->simpleScene();
//scene->simpleScene();
// controler->addVolume("D:/Projekte/GraPa/A3/MRI-head.raw");
// controler->addVolume("D:/Projekte/GraPa/A3/MRI-head.raw");
timer
->
stop
();
timer
->
stop
();
}
}
...
@@ -325,9 +327,92 @@ void MainWindow::initDoc()
...
@@ -325,9 +327,92 @@ void MainWindow::initDoc()
dock
->
setWidget
(
sceneView
);
dock
->
setWidget
(
sceneView
);
//Transfer Function Doc
QDockWidget
*
transferDock
=
new
QDockWidget
(
"Transfer Function Editor"
,
this
);
transferDock
->
setAllowedAreas
(
Qt
::
LeftDockWidgetArea
|
Qt
::
RightDockWidgetArea
);
transEditor
=
new
TransferFunctionEditor
(
this
);
connect
(
transEditor
,
SIGNAL
(
dataChanged
(
uchar
*
)),
perspectiveView
,
SLOT
(
loadTransfer
(
uchar
*
)));
connect
(
transEditor
,
SIGNAL
(
dataChanged
(
uchar
*
)),
frontView
,
SLOT
(
loadTransfer
(
uchar
*
)));
connect
(
transEditor
,
SIGNAL
(
dataChanged
(
uchar
*
)),
leftView
,
SLOT
(
loadTransfer
(
uchar
*
)));
connect
(
transEditor
,
SIGNAL
(
dataChanged
(
uchar
*
)),
topView
,
SLOT
(
loadTransfer
(
uchar
*
)));
QPushButton
*
save
=
new
QPushButton
(
"Save"
);
connect
(
save
,
SIGNAL
(
released
()),
transEditor
,
SLOT
(
save
()));
QPushButton
*
load
=
new
QPushButton
(
"Load"
);
connect
(
load
,
SIGNAL
(
released
()),
transEditor
,
SLOT
(
load
()));
QPushButton
*
reset
=
new
QPushButton
(
"Reset"
);
connect
(
reset
,
SIGNAL
(
released
()),
transEditor
,
SLOT
(
reset
()));
QPushButton
*
Smooth
=
new
QPushButton
(
"smooth"
);
connect
(
Smooth
,
SIGNAL
(
released
()),
transEditor
,
SLOT
(
smooth
()));
QCheckBox
*
red
=
new
QCheckBox
(
"red"
);
red
->
setChecked
(
true
);
connect
(
red
,
SIGNAL
(
clicked
(
bool
)),
transEditor
,
SLOT
(
paintRed
(
bool
)));
QCheckBox
*
green
=
new
QCheckBox
(
"green"
);
green
->
setChecked
(
true
);
connect
(
green
,
SIGNAL
(
clicked
(
bool
)),
transEditor
,
SLOT
(
paintGreen
(
bool
)));
QCheckBox
*
blue
=
new
QCheckBox
(
"blue"
);
blue
->
setChecked
(
true
);
connect
(
blue
,
SIGNAL
(
clicked
(
bool
)),
transEditor
,
SLOT
(
paintBlue
(
bool
)));
QCheckBox
*
alpha
=
new
QCheckBox
(
"alpha"
);
alpha
->
setChecked
(
true
);
connect
(
alpha
,
SIGNAL
(
clicked
(
bool
)),
transEditor
,
SLOT
(
paintAlpha
(
bool
)));
QWidget
*
all
=
new
QWidget
;
QWidget
*
buttons
=
new
QWidget
;
QWidget
*
left
=
new
QWidget
;
QWidget
*
right
=
new
QWidget
;
QVBoxLayout
*
checkLayout
=
new
QVBoxLayout
;
checkLayout
->
addWidget
(
red
);
checkLayout
->
addWidget
(
green
);
checkLayout
->
addWidget
(
blue
);
checkLayout
->
addWidget
(
alpha
);
right
->
setLayout
(
checkLayout
);
QGridLayout
*
butLayout
=
new
QGridLayout
;
butLayout
->
addWidget
(
save
,
0
,
0
);
butLayout
->
addWidget
(
load
,
0
,
1
);
butLayout
->
addWidget
(
reset
,
1
,
0
);
butLayout
->
addWidget
(
Smooth
,
1
,
1
);
left
->
setLayout
(
butLayout
);
QHBoxLayout
*
buttonsLayout
=
new
QHBoxLayout
;
buttonsLayout
->
addWidget
(
left
);
buttonsLayout
->
addWidget
(
right
);
buttons
->
setLayout
(
buttonsLayout
);
QVBoxLayout
*
allLayout
=
new
QVBoxLayout
;
allLayout
->
addWidget
(
transEditor
);
allLayout
->
addWidget
(
buttons
);
all
->
setLayout
(
allLayout
);
transferDock
->
setWidget
(
all
);
transferDock
->
setSizePolicy
(
QSizePolicy
::
Maximum
,
QSizePolicy
::
Maximum
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
transferDock
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
dock
);
addDockWidget
(
Qt
::
RightDockWidgetArea
,
dock
);
}
}
void
MainWindow
::
updateStatusBar
()
void
MainWindow
::
updateStatusBar
()
...
...
A3/mainwindow.h
View file @
c0274af6
...
@@ -12,11 +12,13 @@
...
@@ -12,11 +12,13 @@
#include <QStatusBar>
#include <QStatusBar>
#include <QSlider>
#include <QSlider>
#include <QSplitter>
#include <QSplitter>
#include <QPushButton>
#include <glview.h>
#include <glview.h>
#include <scene.h>
#include <scene.h>
#include <camera.h>
#include <camera.h>
#include <controler.h>
#include <controler.h>
#include <transferfunctioneditor.h>
class
MainWindow
:
public
QMainWindow
class
MainWindow
:
public
QMainWindow
{
{
...
@@ -80,6 +82,7 @@ private:
...
@@ -80,6 +82,7 @@ private:
QTimer
*
timer
;
QTimer
*
timer
;
void
initDoc
();
void
initDoc
();
void
initViews
();
void
initViews
();
...
@@ -99,6 +102,9 @@ public:
...
@@ -99,6 +102,9 @@ public:
void
initPrimitivesMenu
();
void
initPrimitivesMenu
();
TransferFunctionEditor
*
transEditor
;
public
slots
:
public
slots
:
void
updateGL
();
void
updateGL
();
void
updateStatusBar
();
void
updateStatusBar
();
...
...
A3/scene.cpp
View file @
c0274af6
...
@@ -122,9 +122,9 @@ void Scene::deletActive()
...
@@ -122,9 +122,9 @@ void Scene::deletActive()
int
pos
=
active
->
childNumber
();
int
pos
=
active
->
childNumber
();
//qDebug()<<"Delet Active in Scene"<<parentIndex<<parent->childCount()<<pos;
//qDebug()<<"Delet Active in Scene"<<parentIndex<<parent->childCount()<<pos;
foreach
(
SceneObject
*
t
,
parent
->
getChildren
())
{
//
foreach (SceneObject * t, parent->getChildren()) {
// qDebug()<<t->getName()<<t->childNumber();
// qDebug()<<t->getName()<<t->childNumber();
}
//
}
beginRemoveRows
(
parentIndex
,
pos
,
pos
);
beginRemoveRows
(
parentIndex
,
pos
,
pos
);
parent
->
remove
(
pos
);
parent
->
remove
(
pos
);
...
...
A3/sceneobject.cpp
View file @
c0274af6
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
#include "scenenode.h"
#include "scenenode.h"
int
Scene
Node
::
idCount
=
1
;
int
Scene
Object
::
idCount
=
1
;
SceneObject
::
SceneObject
()
SceneObject
::
SceneObject
()
{
{
...
...
A3/treedelegate.cpp
View file @
c0274af6
...
@@ -9,7 +9,7 @@ TreeDelegate::TreeDelegate()
...
@@ -9,7 +9,7 @@ TreeDelegate::TreeDelegate()
}
}
void
TreeDelegate
::
setModelData
(
QWidget
*
editor
,
QAbstractItemModel
*
model
,
void
TreeDelegate
::
setModelData
(
QWidget
*
editor
,
QAbstractItemModel
*
model
,
const
QModelIndex
&
index
)
const
const
QModelIndex
&
index
)
const
{
{
qDebug
()
<<
"out"
;
qDebug
()
<<
"out"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment