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
63afe8ea
Commit
63afe8ea
authored
Apr 06, 2010
by
Alexander Wiebel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] ROIBoxes are now resizeable in a more intuitive way
parent
ba88d9cf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
7 deletions
+12
-7
src/graphicsEngine/WROIBox.cpp
src/graphicsEngine/WROIBox.cpp
+11
-7
src/graphicsEngine/WROIBox.h
src/graphicsEngine/WROIBox.h
+1
-0
No files found.
src/graphicsEngine/WROIBox.cpp
View file @
63afe8ea
...
...
@@ -113,6 +113,7 @@ void setVertices( osg::Vec3Array* vertices, wmath::WPosition minPos, wmath::WPos
WROIBox
::
WROIBox
(
wmath
::
WPosition
minPos
,
wmath
::
WPosition
maxPos
)
:
WROI
(),
boxId
(
maxBoxId
++
),
m_pickNormal
(
wmath
::
WVector3D
()
),
m_oldPixelPosition
(
std
::
make_pair
(
0
,
0
)
)
{
m_minPos
=
minPos
;
...
...
@@ -242,16 +243,15 @@ void WROIBox::updateGFX()
osg
::
ref_ptr
<
osg
::
Vec3Array
>
vertices
=
osg
::
ref_ptr
<
osg
::
Vec3Array
>
(
new
osg
::
Vec3Array
);
// resize Box
if
(
m_pickInfo
.
getModifierKey
()
==
WPickInfo
::
SHIFT
&&
m_pickInfo
.
getPickNormal
()
!=
wmath
::
WVector3D
()
)
if
(
m_pickInfo
.
getModifierKey
()
==
WPickInfo
::
SHIFT
)
{
wmath
::
WVector3D
normal
=
m_pickInfo
.
getPickNormal
();
if
(
normal
[
0
]
<=
0
&&
normal
[
1
]
<=
0
&&
normal
[
2
]
<=
0
)
if
(
m_pickNormal
[
0
]
<=
0
&&
m_pickNormal
[
1
]
<=
0
&&
m_pickNormal
[
2
]
<=
0
)
{
m_maxPos
+=
normal
*
(
moveVec
*
n
ormal
);
m_maxPos
+=
m_pickNormal
*
(
moveVec
*
m_pickN
ormal
);
}
if
(
normal
[
0
]
>=
0
&&
normal
[
1
]
>=
0
&&
n
ormal
[
2
]
>=
0
)
if
(
m_pickNormal
[
0
]
>=
0
&&
m_pickNormal
[
1
]
>=
0
&&
m_pickN
ormal
[
2
]
>=
0
)
{
m_minPos
+=
normal
*
(
moveVec
*
n
ormal
);
m_minPos
+=
m_pickNormal
*
(
moveVec
*
m_pickN
ormal
);
}
setVertices
(
vertices
,
m_minPos
,
m_maxPos
);
...
...
@@ -269,6 +269,7 @@ void WROIBox::updateGFX()
}
else
{
m_pickNormal
=
m_pickInfo
.
getPickNormal
();
// color for moving box
if
(
m_pickInfo
.
getModifierKey
()
==
WPickInfo
::
NONE
)
{
...
...
@@ -283,7 +284,7 @@ void WROIBox::updateGFX()
}
m_surfaceGeometry
->
setColorArray
(
colors
);
}
if
(
m_pickInfo
.
getModifierKey
()
==
WPickInfo
::
SHIFT
&&
m_pickInfo
.
getPickNormal
()
!=
wmath
::
WVector3D
()
)
if
(
m_pickInfo
.
getModifierKey
()
==
WPickInfo
::
SHIFT
)
{
osg
::
ref_ptr
<
osg
::
Vec4Array
>
colors
=
osg
::
ref_ptr
<
osg
::
Vec4Array
>
(
new
osg
::
Vec4Array
);
colors
->
push_back
(
osg
::
Vec4
(
.0
f
,
1.0
f
,
.0
f
,
0.4
f
)
);
...
...
@@ -298,6 +299,8 @@ void WROIBox::updateGFX()
}
if
(
m_isPicked
&&
m_pickInfo
.
getName
()
==
"unpick"
)
{
// Perform all actions necessary for finishing a pick
osg
::
ref_ptr
<
osg
::
Vec4Array
>
colors
=
osg
::
ref_ptr
<
osg
::
Vec4Array
>
(
new
osg
::
Vec4Array
);
if
(
m_isNot
)
{
...
...
@@ -308,6 +311,7 @@ void WROIBox::updateGFX()
colors
->
push_back
(
osg
::
Vec4
(
0.
f
,
1.
f
,
1.
f
,
0.4
f
)
);
}
m_surfaceGeometry
->
setColorArray
(
colors
);
m_pickNormal
=
wmath
::
WVector3D
();
m_isPicked
=
false
;
}
...
...
src/graphicsEngine/WROIBox.h
View file @
63afe8ea
...
...
@@ -71,6 +71,7 @@ private:
wmath
::
WPosition
m_maxPos
;
//!< The maximum position of the box
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 cmoparison
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
boost
::
shared_mutex
m_updateLock
;
//!< Lock to prevent concurrent threads trying to update the osg node
osg
::
ref_ptr
<
osg
::
Geometry
>
m_surfaceGeometry
;
//!< store this pointer for use in updates
...
...
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