Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
OpenWalnut Core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
44
Issues
44
List
Boards
Labels
Service Desk
Milestones
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
82084199
Commit
82084199
authored
Aug 06, 2010
by
Sebastian Eichelbaum
Browse files
Options
Browse Files
Download
Plain Diff
[MERGE]
parents
0593a98a
db844a13
Changes
41
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
41 changed files
with
1752 additions
and
156 deletions
+1752
-156
src/dataHandler/WDataSetScalar.cpp
src/dataHandler/WDataSetScalar.cpp
+6
-4
src/dataHandler/WDataSetSphericalHarmonics.cpp
src/dataHandler/WDataSetSphericalHarmonics.cpp
+11
-2
src/dataHandler/WDataSetSphericalHarmonics.h
src/dataHandler/WDataSetSphericalHarmonics.h
+7
-0
src/dataHandler/WDataSetVector.cpp
src/dataHandler/WDataSetVector.cpp
+6
-5
src/dataHandler/WGridRegular3D.cpp
src/dataHandler/WGridRegular3D.cpp
+6
-4
src/dataHandler/WGridRegular3D.h
src/dataHandler/WGridRegular3D.h
+4
-1
src/dataHandler/test/WGridRegular3D_test.h
src/dataHandler/test/WGridRegular3D_test.h
+44
-1
src/graphicsEngine/WROI.cpp
src/graphicsEngine/WROI.cpp
+9
-0
src/graphicsEngine/WROI.h
src/graphicsEngine/WROI.h
+10
-0
src/graphicsEngine/WROIBox.h
src/graphicsEngine/WROIBox.h
+4
-4
src/graphicsEngine/WROISphere.cpp
src/graphicsEngine/WROISphere.cpp
+209
-0
src/graphicsEngine/WROISphere.h
src/graphicsEngine/WROISphere.h
+181
-0
src/graphicsEngine/shaders/WGELighting-fragment.glsl
src/graphicsEngine/shaders/WGELighting-fragment.glsl
+0
-19
src/graphicsEngine/shaders/WGELighting-vertex.glsl
src/graphicsEngine/shaders/WGELighting-vertex.glsl
+22
-0
src/gui/icons/WIcons.h
src/gui/icons/WIcons.h
+2
-1
src/gui/icons/tango/README
src/gui/icons/tango/README
+14
-0
src/gui/icons/tango/preferences-system.png
src/gui/icons/tango/preferences-system.png
+0
-0
src/gui/icons/tango/preferences-system.xpm
src/gui/icons/tango/preferences-system.xpm
+117
-0
src/gui/qt4/WMainWindow.cpp
src/gui/qt4/WMainWindow.cpp
+7
-6
src/gui/qt4/WMainWindow.h
src/gui/qt4/WMainWindow.h
+2
-1
src/gui/qt4/WQt4Gui.cpp
src/gui/qt4/WQt4Gui.cpp
+12
-3
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
src/gui/qt4/datasetbrowser/WQtDatasetBrowser.cpp
+7
-7
src/modules/CMakeLists.txt
src/modules/CMakeLists.txt
+1
-0
src/modules/arbitraryPlane/CMakeLists.txt
src/modules/arbitraryPlane/CMakeLists.txt
+42
-0
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
src/modules/arbitraryPlane/WMArbitraryPlane.cpp
+473
-0
src/modules/arbitraryPlane/WMArbitraryPlane.h
src/modules/arbitraryPlane/WMArbitraryPlane.h
+292
-0
src/modules/arbitraryPlane/arbitraryPlane.xpm
src/modules/arbitraryPlane/arbitraryPlane.xpm
+118
-0
src/modules/arbitraryPlane/shaders/WMArbitraryPlane-fragment.glsl
...les/arbitraryPlane/shaders/WMArbitraryPlane-fragment.glsl
+114
-0
src/modules/arbitraryPlane/shaders/WMArbitraryPlane-vertex.glsl
...dules/arbitraryPlane/shaders/WMArbitraryPlane-vertex.glsl
+21
-0
src/modules/homeGlyphs/shaders/WMHomeGlyphs-fragment.glsl
src/modules/homeGlyphs/shaders/WMHomeGlyphs-fragment.glsl
+1
-1
src/modules/homeGlyphs/shaders/WMHomeGlyphs-vertex.glsl
src/modules/homeGlyphs/shaders/WMHomeGlyphs-vertex.glsl
+1
-1
src/modules/lic/fibernavigator/TensorField.cpp
src/modules/lic/fibernavigator/TensorField.cpp
+2
-1
src/modules/lic/fibernavigator/triangleMesh.cpp
src/modules/lic/fibernavigator/triangleMesh.cpp
+0
-2
src/modules/lic/shaders/WMLIC-fragment.glsl
src/modules/lic/shaders/WMLIC-fragment.glsl
+1
-1
src/modules/lic/shaders/WMLIC-vertex.glsl
src/modules/lic/shaders/WMLIC-vertex.glsl
+1
-1
src/modules/marchingCubes/shaders/WMMarchingCubes-fragment.glsl
...dules/marchingCubes/shaders/WMMarchingCubes-fragment.glsl
+1
-1
src/modules/marchingCubes/shaders/WMMarchingCubes-vertex.glsl
...modules/marchingCubes/shaders/WMMarchingCubes-vertex.glsl
+1
-1
src/modules/probTractDisplay/shaders/WMProbTractDisplay-fragment.glsl
...probTractDisplay/shaders/WMProbTractDisplay-fragment.glsl
+1
-1
src/modules/triangleMeshRenderer/shaders/WMTriangleMeshRenderer-fragment.glsl
...MeshRenderer/shaders/WMTriangleMeshRenderer-fragment.glsl
+1
-1
src/modules/triangleMeshRenderer/shaders/WMTriangleMeshRenderer-vertex.glsl
...leMeshRenderer/shaders/WMTriangleMeshRenderer-vertex.glsl
+1
-1
tools/MacOS/macOS_install_tool
tools/MacOS/macOS_install_tool
+0
-86
No files found.
src/dataHandler/WDataSetScalar.cpp
View file @
82084199
...
...
@@ -84,14 +84,16 @@ double WDataSetScalar::interpolate( const wmath::WPosition& pos, bool* success )
WAssert
(
(
m_valueSet
->
order
()
==
0
&&
m_valueSet
->
dimension
()
==
1
),
"Only implemented for scalar values so far."
);
*
success
=
grid
->
encloses
(
pos
);
bool
isInside
=
true
;
size_t
cellId
=
grid
->
getCellId
(
pos
,
&
isInside
);
if
(
!
*
success
)
if
(
!
isInside
)
{
return
0
;
*
success
=
false
;
return
0.0
;
}
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
grid
->
getCellId
(
pos
)
);
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
cellId
);
wmath
::
WPosition
localPos
=
pos
-
grid
->
getPosition
(
vertexIds
[
0
]
);
...
...
src/dataHandler/WDataSetSphericalHarmonics.cpp
View file @
82084199
...
...
@@ -69,13 +69,17 @@ wmath::WSymmetricSphericalHarmonic WDataSetSphericalHarmonics::interpolate( cons
*
success
=
grid
->
encloses
(
pos
);
if
(
!*
success
)
bool
isInside
=
true
;
size_t
cellId
=
grid
->
getCellId
(
pos
,
&
isInside
);
if
(
!
isInside
)
{
*
success
=
false
;
return
wmath
::
WSymmetricSphericalHarmonic
();
}
// ids of vertices for interpolation
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
grid
->
getCellId
(
pos
)
);
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
cellId
);
wmath
::
WPosition
localPos
=
pos
-
grid
->
getPosition
(
vertexIds
[
0
]
);
...
...
@@ -128,3 +132,8 @@ const std::string WDataSetSphericalHarmonics::getDescription() const
{
return
"Contains factors for spherical harmonics."
;
}
bool
WDataSetSphericalHarmonics
::
isTexture
()
const
{
return
false
;
}
src/dataHandler/WDataSetSphericalHarmonics.h
View file @
82084199
...
...
@@ -102,6 +102,13 @@ public:
*/
virtual
const
std
::
string
getDescription
()
const
;
/**
* Determines whether this dataset can be used as a texture.
*
* \return true if usable as texture.
*/
virtual
bool
isTexture
()
const
;
protected:
/**
...
...
src/dataHandler/WDataSetVector.cpp
View file @
82084199
...
...
@@ -72,14 +72,15 @@ wmath::WVector3D WDataSetVector::interpolate( const wmath::WPosition& pos, bool
WAssert
(
(
m_valueSet
->
order
()
==
1
&&
m_valueSet
->
dimension
()
==
3
),
"Only implemented for 3D Vectors so far."
);
*
success
=
grid
->
encloses
(
pos
);
bool
isInside
=
true
;
size_t
cellId
=
grid
->
getCellId
(
pos
,
&
isInside
);
if
(
!
*
success
)
if
(
!
isInside
)
{
return
wmath
::
WVector3D
(
0
,
0
,
0
);
*
success
=
false
;
return
wmath
::
WVector3D
();
}
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
grid
->
getCellId
(
pos
)
);
std
::
vector
<
size_t
>
vertexIds
=
grid
->
getCellVertexIds
(
cellId
);
wmath
::
WPosition
localPos
=
pos
-
grid
->
getPosition
(
vertexIds
[
0
]
);
...
...
src/dataHandler/WGridRegular3D.cpp
View file @
82084199
...
...
@@ -441,15 +441,17 @@ bool WGridRegular3D::isNotRotatedOrSheared() const
return
onlyTranslatedOrScaled
;
}
size_t
WGridRegular3D
::
getCellId
(
const
wmath
::
WPosition
&
pos
)
const
size_t
WGridRegular3D
::
getCellId
(
const
wmath
::
WPosition
&
pos
,
bool
*
success
)
const
{
WAssert
(
isNotRotatedOrSheared
(),
"Only feasible for grids that are only translated or scaled so far."
);
wmath
::
WPosition
posRelativeToOrigin
=
pos
-
m_origin
;
size_t
xCellId
=
floor
(
posRelativeToOrigin
[
0
]
/
m_offsetX
);
size_t
yCellId
=
floor
(
posRelativeToOrigin
[
1
]
/
m_offsetY
);
size_t
zCellId
=
floor
(
posRelativeToOrigin
[
2
]
/
m_offsetZ
);
double
xCellId
=
floor
(
posRelativeToOrigin
[
0
]
/
m_offsetX
);
double
yCellId
=
floor
(
posRelativeToOrigin
[
1
]
/
m_offsetY
);
double
zCellId
=
floor
(
posRelativeToOrigin
[
2
]
/
m_offsetZ
);
*
success
=
xCellId
>=
0
&&
yCellId
>=
0
&&
zCellId
>=
0
&&
xCellId
<
m_nbPosX
-
1
&&
yCellId
<
m_nbPosY
-
1
&&
zCellId
<
m_nbPosZ
-
1
;
return
xCellId
+
yCellId
*
(
m_nbPosX
-
1
)
+
zCellId
*
(
m_nbPosX
-
1
)
*
(
m_nbPosY
-
1
);
}
...
...
src/dataHandler/WGridRegular3D.h
View file @
82084199
...
...
@@ -41,6 +41,8 @@
* A grid that has parallelepiped cells which all have the same proportion. I.e.
* the samples along a single axis are equidistant. The distance of samples may
* vary between axes.
*
* \warning Positions on the upper bounddaries in x, y and z are considered outside the grid.
* \ingroup dataHandler
*/
class
WGridRegular3D
:
public
WGrid
...
...
@@ -339,8 +341,9 @@ public:
* Computes the id of the cell containing the position pos.
*
* \param pos The position selecting the cell.
* \param success True if the position pos is inside the grid.
*/
size_t
getCellId
(
const
wmath
::
WPosition
&
pos
)
const
;
size_t
getCellId
(
const
wmath
::
WPosition
&
pos
,
bool
*
success
)
const
;
/**
* Computes the ids of the vertices of a cell given by its id.
...
...
src/dataHandler/test/WGridRegular3D_test.h
View file @
82084199
...
...
@@ -511,8 +511,51 @@ public:
void
testGetCellId
(
void
)
{
WGridRegular3D
g
(
5
,
3
,
3
,
0
,
0
,
0
,
1
,
1
,
1
);
size_t
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
1.75
,
0.78
)
);
bool
isInside
=
true
;
// Test some value
size_t
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
1.75
,
0.78
),
&
isInside
);
TS_ASSERT_EQUALS
(
cellId
,
7
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
// Test bounds for X direction
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
4.0
,
1.75
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
false
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
4.0
-
wlimits
::
FLT_EPS
,
1.75
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
0.0
,
1.75
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
0.0
-
wlimits
::
FLT_EPS
,
1.75
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
false
);
// Test bounds for Y direction
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
2.0
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
false
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
2.0
-
wlimits
::
FLT_EPS
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
0.0
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
0.0
-
wlimits
::
FLT_EPS
,
0.3
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
false
);
// Test bounds for Z direction
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
1.75
,
2.0
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
false
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
1.75
,
2.0
-
wlimits
::
FLT_EPS
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
1.75
,
0.0
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
true
);
cellId
=
g
.
getCellId
(
wmath
::
WPosition
(
3.3
,
1.75
,
0.0
-
wlimits
::
FLT_EPS
),
&
isInside
);
TS_ASSERT_EQUALS
(
isInside
,
false
);
}
/**
...
...
src/graphicsEngine/WROI.cpp
View file @
82084199
...
...
@@ -69,3 +69,12 @@ bool WROI::isModified()
return
tmp
;
}
void
WROI
::
hide
()
{
setNodeMask
(
0x0
);
}
void
WROI
::
unhide
()
{
setNodeMask
(
0xFFFFFFFF
);
}
src/graphicsEngine/WROI.h
View file @
82084199
...
...
@@ -84,6 +84,16 @@ public:
*/
void
setActive
(
bool
active
);
/**
* hides the roi in the scene
*/
void
hide
();
/**
* unhides the roi in the scene
*/
void
unhide
();
/**
* Getter for modified flag
*/
...
...
src/graphicsEngine/WROIBox.h
View file @
82084199
...
...
@@ -62,14 +62,14 @@ public:
wmath
::
WPosition
getMaxPos
()
const
;
/**
*
sette
r
* \param color
*
Setter for standard colo
r
* \param color
The new color.
*/
void
setColor
(
osg
::
Vec4
color
);
/**
*
setter
* \param color
*
Setter for color in negated state
* \param color
The new color.
*/
void
setNotColor
(
osg
::
Vec4
color
);
...
...
src/graphicsEngine/WROISphere.cpp
0 → 100644
View file @
82084199
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <string>
#include <utility>
#include <osg/LightModel>
#include "WROISphere.h"
#include "WGraphicsEngine.h"
#include "WGEUtils.h"
size_t
WROISphere
::
maxSphereId
=
0
;
WROISphere
::
WROISphere
(
wmath
::
WPosition
position
,
float
radius
)
:
WROI
(),
sphereId
(
maxSphereId
++
),
m_position
(
position
),
m_originalPosition
(
position
),
m_radius
(
radius
),
m_lockX
(
false
),
m_lockY
(
false
),
m_lockZ
(
false
),
m_pickNormal
(
wmath
::
WVector3D
()
),
m_oldPixelPosition
(
std
::
make_pair
(
0
,
0
)
),
m_color
(
osg
::
Vec4
(
0.
f
,
1.
f
,
1.
f
,
0.4
f
)
),
m_notColor
(
osg
::
Vec4
(
1.0
f
,
0.0
f
,
0.0
f
,
0.4
f
)
)
{
boost
::
shared_ptr
<
WGraphicsEngine
>
ge
=
WGraphicsEngine
::
getGraphicsEngine
();
assert
(
ge
);
boost
::
shared_ptr
<
WGEViewer
>
viewer
=
ge
->
getViewerByName
(
"main"
);
assert
(
viewer
);
m_viewer
=
viewer
;
m_pickHandler
=
m_viewer
->
getPickHandler
();
m_pickHandler
->
getPickSignal
()
->
connect
(
boost
::
bind
(
&
WROISphere
::
registerRedrawRequest
,
this
,
_1
)
);
redrawSphere
();
//**********************************************************
m_isModified
=
true
;
m_isNot
=
false
;
assert
(
WGraphicsEngine
::
getGraphicsEngine
()
);
WGraphicsEngine
::
getGraphicsEngine
()
->
getScene
()
->
addChild
(
this
);
setUserData
(
this
);
setUpdateCallback
(
osg
::
ref_ptr
<
ROISphereNodeCallback
>
(
new
ROISphereNodeCallback
)
);
}
void
WROISphere
::
redrawSphere
()
{
removeDrawables
(
0
);
osg
::
ShapeDrawable
*
shape
=
new
osg
::
ShapeDrawable
(
new
osg
::
Sphere
(
osg
::
Vec3
(
m_position
[
0
],
m_position
[
1
],
m_position
[
2
]
),
m_radius
)
);
std
::
stringstream
ss
;
ss
<<
"ROISphere"
<<
sphereId
;
setName
(
ss
.
str
()
);
shape
->
setName
(
ss
.
str
()
);
addDrawable
(
shape
);
}
WROISphere
::~
WROISphere
()
{
// std::cout << "destructor called" << std::endl;
// std::cout << "ref count geode: " << m_geode->referenceCount() << std::endl;
//
// WGraphicsEngine::getGraphicsEngine()->getScene()->remove( m_geode );
}
wmath
::
WPosition
WROISphere
::
getPosition
()
const
{
return
m_position
;
}
void
WROISphere
::
setPosition
(
wmath
::
WPosition
position
)
{
m_position
=
position
;
m_originalPosition
=
position
;
m_isModified
=
true
;
}
void
WROISphere
::
registerRedrawRequest
(
WPickInfo
pickInfo
)
{
m_pickInfo
=
pickInfo
;
}
void
WROISphere
::
updateGFX
()
{
std
::
stringstream
ss
;
ss
<<
"ROISphere"
<<
sphereId
<<
""
;
if
(
m_pickInfo
.
getName
()
==
ss
.
str
()
)
{
std
::
pair
<
float
,
float
>
newPixelPos
(
m_pickInfo
.
getPickPixelPosition
()
);
if
(
m_isPicked
)
{
osg
::
Vec3
in
(
newPixelPos
.
first
,
newPixelPos
.
second
,
0.0
);
osg
::
Vec3
world
=
wge
::
unprojectFromScreen
(
in
,
m_viewer
->
getCamera
()
);
wmath
::
WPosition
newPixelWorldPos
(
world
[
0
],
world
[
1
],
world
[
2
]
);
wmath
::
WPosition
oldPixelWorldPos
;
if
(
m_oldPixelPosition
.
first
==
0
&&
m_oldPixelPosition
.
second
==
0
)
{
oldPixelWorldPos
=
newPixelWorldPos
;
}
else
{
osg
::
Vec3
in
(
m_oldPixelPosition
.
first
,
m_oldPixelPosition
.
second
,
0.0
);
osg
::
Vec3
world
=
wge
::
unprojectFromScreen
(
in
,
m_viewer
->
getCamera
()
);
oldPixelWorldPos
=
wmath
::
WPosition
(
world
[
0
],
world
[
1
],
world
[
2
]
);
}
wmath
::
WVector3D
moveVec
=
newPixelWorldPos
-
oldPixelWorldPos
;
osg
::
ref_ptr
<
osg
::
Vec3Array
>
vertices
=
osg
::
ref_ptr
<
osg
::
Vec3Array
>
(
new
osg
::
Vec3Array
);
// move sphere
if
(
m_pickInfo
.
getModifierKey
()
==
WPickInfo
::
NONE
)
{
moveSphere
(
moveVec
);
}
}
m_oldPixelPosition
=
newPixelPos
;
m_isModified
=
true
;
m_isPicked
=
true
;
m_signalIsModified
();
}
if
(
m_isPicked
&&
m_pickInfo
.
getName
()
==
"unpick"
)
{
// Perform all actions necessary for finishing a pick
m_pickNormal
=
wmath
::
WVector3D
();
m_isPicked
=
false
;
}
if
(
isModified
()
)
{
redrawSphere
();
}
}
void
WROISphere
::
moveSphere
(
wmath
::
WVector3D
offset
)
{
m_position
+=
offset
;
if
(
m_lockX
)
{
m_position
[
0
]
=
m_originalPosition
[
0
];
}
if
(
m_lockY
)
{
m_position
[
1
]
=
m_originalPosition
[
1
];
}
if
(
m_lockZ
)
{
m_position
[
2
]
=
m_originalPosition
[
2
];
}
}
void
WROISphere
::
setLockX
(
bool
value
)
{
m_lockX
=
value
;
}
void
WROISphere
::
setLockY
(
bool
value
)
{
m_lockY
=
value
;
}
void
WROISphere
::
setLockZ
(
bool
value
)
{
m_lockZ
=
value
;
}
void
WROISphere
::
setColor
(
osg
::
Vec4
color
)
{
m_color
=
color
;
}
void
WROISphere
::
setNotColor
(
osg
::
Vec4
color
)
{
m_notColor
=
color
;
}
src/graphicsEngine/WROISphere.h
0 → 100644
View file @
82084199
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WROISPHERE_H
#define WROISPHERE_H
#include <string>
#include <utility>
#include <boost/thread.hpp>
#include "../common/math/WPosition.h"
#include "WPickHandler.h"
#include "WGEViewer.h"
#include "WROI.h"
/**
* A sphere representing a region of interest.
*/
class
WROISphere
:
public
WROI
{
public:
/**
* Yields sphere with desired center point and radius
* \param position position of the center of the sphere
* \param radius radius of the sphere
*/
WROISphere
(
wmath
::
WPosition
position
,
float
radius
=
5.0
);
/**
* standard destructor
*/
virtual
~
WROISphere
();
/**
* getter
* \return position
*/
wmath
::
WPosition
getPosition
()
const
;
/**
* setter
* \param position
*/
void
setPosition
(
wmath
::
WPosition
position
);
/**
* Setter for standard color
* \param color The new color.
*/
void
setColor
(
osg
::
Vec4
color
);
/**
* Setter for color in negated state
* \param color The new color.
*/
void
setNotColor
(
osg
::
Vec4
color
);
/**
* removes the old drawable from the osg geode and adds a new one at the current position and size
*/
void
redrawSphere
();
/**
* sets the flag that allows or disallows movement along the x axis
*
* \param value the flag
*/
void
setLockX
(
bool
value
=
true
);
/**
* sets the flag that allows or disallows movement along the y axis
*
* \param value the flag
*/
void
setLockY
(
bool
value
=
true
);
/**
* sets the flag that allows or disallows movement along the z axis
*
* \param value the flag
*/
void
setLockZ
(
bool
value
=
true
);
/**
* move the sphere with a given offset
*
* \param offset the distance to move
*/
void
moveSphere
(
wmath
::
WVector3D
offset
);
protected:
private:
static
size_t
maxSphereId
;
//!< Current maximum boxId over all spheres.
size_t
sphereId
;
//!< Id of the current sphere.
wmath
::
WPosition
m_position
;
//!< The position of the sphere
wmath
::
WPosition
m_originalPosition
;
//!< The position of the sphere when created, used for locking
float
m_radius
;
//!< The radius of the sphere
bool
m_lockX
;
//!< if true disallows changing of the X component of the position
bool
m_lockY
;
//!< if true disallows changing of the Y component of the position
bool
m_lockZ
;
//!< if true disallows changing of the Z component of the position
bool
m_isPicked
;
//!< Indicates whether the box is currently picked or not.
wmath
::
WPosition
m_pickedPosition
;
//!< Caches the old picked position to a allow for comparison
wmath
::
WVector3D
m_pickNormal
;
//!< Store the normal that occured when the pick action was started.
std
::
pair
<
float
,
float
>
m_oldPixelPosition
;
//!< Caches the old picked position to a allow for cmoparison
WPickInfo
m_pickInfo
;
//!< Stores the pick information for potential redraw
boost
::
shared_ptr
<
WGEViewer
>
m_viewer
;
//!< makes viewer available all over this class.
osg
::
Vec4
m_color
;
//!< the color of the box
osg
::
Vec4
m_notColor
;
//!< the color of the box when negated
/**
* note that there was a pick
* \param pickInfo info from pick
*/
void
registerRedrawRequest
(
WPickInfo
pickInfo
);
/**
* updates the graphics
*/
virtual
void
updateGFX
();
/**
* Node callback to handle updates properly
*/
class
ROISphereNodeCallback
:
public
osg
::
NodeCallback
{
public:
// NOLINT
/**
* operator ()
*
* \param node the osg node
* \param nv the node visitor
*/
virtual
void
operator
()(
osg
::
Node
*
node
,
osg
::
NodeVisitor
*
nv
)
{
osg
::
ref_ptr
<
WROISphere
>
module
=
static_cast
<
WROISphere
*
>
(
node
->
getUserData
()
);
if
(
module
)
{
module
->
updateGFX
();
}
traverse
(
node
,
nv
);
}
};
};
#endif // WROISPHERE_H
src/graphicsEngine/shaders/WGELighting.glsl
→
src/graphicsEngine/shaders/WGELighting
-fragment
.glsl
View file @
82084199
...
...
@@ -26,28 +26,9 @@ void directionalLight( in int i, in vec3 normal, in float shininess,
ambient
+=
gl_LightSource
[