Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenFlipper-Free
OpenFlipper
Commits
d582c099
Commit
d582c099
authored
Jun 11, 2018
by
Martin Schultz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into fixCompatProfileIntelLinux
parents
e9025b0a
7c19d075
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
15 deletions
+48
-15
libs_required/ACG/Scenegraph/TransformNode.cc
libs_required/ACG/Scenegraph/TransformNode.cc
+35
-8
libs_required/ACG/Scenegraph/TransformNode.hh
libs_required/ACG/Scenegraph/TransformNode.hh
+13
-7
No files found.
libs_required/ACG/Scenegraph/TransformNode.cc
View file @
d582c099
...
@@ -134,6 +134,17 @@ translate(const Vec3d& _v)
...
@@ -134,6 +134,17 @@ translate(const Vec3d& _v)
updateMatrix
();
updateMatrix
();
}
}
//----------------------------------------------------------------------------
void
TransformNode
::
setTranslation
(
const
Vec3d
&
_v
)
{
translation_
=
_v
;
updateMatrix
();
}
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
...
@@ -154,6 +165,22 @@ rotate(double _angle, const Vec3d& _axis)
...
@@ -154,6 +165,22 @@ rotate(double _angle, const Vec3d& _axis)
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void
TransformNode
::
setRotation
(
const
Quaterniond
&
rotation
)
{
quaternion_
=
rotation
;
quaternion_
.
normalize
();
rotation_matrix_
=
quaternion_
.
rotation_matrix
();
inverse_rotation_matrix_
=
rotation_matrix_
;
inverse_rotation_matrix_
.
transpose
();
updateMatrix
();
}
//----------------------------------------------------------------------------
void
void
TransformNode
::
TransformNode
::
scale
(
const
Vec3d
&
_s
)
scale
(
const
Vec3d
&
_s
)
...
@@ -256,7 +283,7 @@ enter(GLState& _state, const DrawModes::DrawMode& /* _drawmode */ )
...
@@ -256,7 +283,7 @@ enter(GLState& _state, const DrawModes::DrawMode& /* _drawmode */ )
if
(
is2DObject_
)
if
(
is2DObject_
)
ortho2DMode
(
_state
);
ortho2DMode
(
_state
);
if
(
isPerSkeletonObject_
)
if
(
isPerSkeletonObject_
)
perSkeletonMode
(
_state
);
perSkeletonMode
(
_state
);
}
}
...
@@ -360,19 +387,19 @@ ortho2DMode(GLState& _state)
...
@@ -360,19 +387,19 @@ ortho2DMode(GLState& _state)
if
(
width
==
0
||
height
==
0
)
if
(
width
==
0
||
height
==
0
)
return
;
return
;
// _state.viewport(0,0,width, height);
// _state.viewport(0,0,width, height);
_state
.
reset_projection
();
_state
.
reset_projection
();
_state
.
ortho
(
-
(
GLdouble
)
width
/
2.0
,
(
GLdouble
)
width
/
2.0
,
-
(
GLdouble
)
height
/
2.0
,
(
GLdouble
)
height
/
2.0
,
0.01
,
20.0
);
_state
.
ortho
(
-
(
GLdouble
)
width
/
2.0
,
(
GLdouble
)
width
/
2.0
,
-
(
GLdouble
)
height
/
2.0
,
(
GLdouble
)
height
/
2.0
,
0.01
,
20.0
);
// _state.ortho(0.0, (GLdouble)width, (GLdouble)height, 0.0, 0.01,20.0);
// _state.ortho(0.0, (GLdouble)width, (GLdouble)height, 0.0, 0.01,20.0);
_state
.
reset_modelview
();
_state
.
reset_modelview
();
_state
.
lookAt
(
Vec3d
(
0.0
,
0.0
,
0.0
),
_state
.
lookAt
(
Vec3d
(
0.0
,
0.0
,
0.0
),
Vec3d
(
0.0
,
0.0
,
1.0
),
Vec3d
(
0.0
,
0.0
,
1.0
),
Vec3d
(
0.0
,
-
1.0
,
0.0
));
// flip up direction (y-axis) s.t. opengl coordsys matches image coordsys
Vec3d
(
0.0
,
-
1.0
,
0.0
));
// flip up direction (y-axis) s.t. opengl coordsys matches image coordsys
_state
.
scale
(
scaleFactor2D_
,
scaleFactor2D_
,
1.0
);
_state
.
scale
(
scaleFactor2D_
,
scaleFactor2D_
,
1.0
);
// move image center to window center
// move image center to window center
...
...
libs_required/ACG/Scenegraph/TransformNode.hh
View file @
d582c099
...
@@ -86,7 +86,7 @@ namespace SceneGraph {
...
@@ -86,7 +86,7 @@ namespace SceneGraph {
specified center. This is the base class for e.g. the
specified center. This is the base class for e.g. the
TrackballNode and the ManipulatorNode, that only add a GUI for
TrackballNode and the ManipulatorNode, that only add a GUI for
generating the transformations.
generating the transformations.
Note that in order for the transformations to apply in
Note that in order for the transformations to apply in
each traversal of the scenegraph, one has to call
each traversal of the scenegraph, one has to call
apply_transformation(true) once.
apply_transformation(true) once.
...
@@ -137,10 +137,16 @@ public:
...
@@ -137,10 +137,16 @@ public:
/// Add a translation to the current Transformation.
/// Add a translation to the current Transformation.
void
translate
(
const
Vec3d
&
_v
);
void
translate
(
const
Vec3d
&
_v
);
/// translation setter
void
setTranslation
(
const
Vec3d
&
_v
);
/** Add a rotation to the current Transformation.
/** Add a rotation to the current Transformation.
Assume angle in degree and axis normalized */
Assume angle in degree and axis normalized */
void
rotate
(
double
_angle
,
const
Vec3d
&
_axis
);
void
rotate
(
double
_angle
,
const
Vec3d
&
_axis
);
/// rotation setter
void
setRotation
(
const
Quaterniond
&
rotation
);
/// Add scaling to the current Transformation.
/// Add scaling to the current Transformation.
void
scale
(
double
_s
)
{
scale
(
Vec3d
(
_s
,
_s
,
_s
));
}
void
scale
(
double
_s
)
{
scale
(
Vec3d
(
_s
,
_s
,
_s
));
}
...
@@ -178,12 +184,12 @@ public:
...
@@ -178,12 +184,12 @@ public:
const
Vec3d
&
translation
()
const
{
return
translation_
;
}
const
Vec3d
&
translation
()
const
{
return
translation_
;
}
/// return scale matrix
/// return scale matrix
const
GLMatrixd
&
scale
()
const
{
const
GLMatrixd
&
scale
()
const
{
return
scale_matrix_
;
return
scale_matrix_
;
}
}
/// return inverse scale matrix
/// return inverse scale matrix
const
GLMatrixd
&
inverse_scale
()
const
{
const
GLMatrixd
&
inverse_scale
()
const
{
return
inverse_scale_matrix_
;
return
inverse_scale_matrix_
;
}
}
bool
apply_transformation
()
{
return
applyTransformation_
;
}
bool
apply_transformation
()
{
return
applyTransformation_
;
}
...
@@ -194,11 +200,11 @@ public:
...
@@ -194,11 +200,11 @@ public:
// ortho 2d mode
// ortho 2d mode
bool
is2D
(){
return
is2DObject_
;};
bool
is2D
(){
return
is2DObject_
;};
void
set2D
(
bool
_2d
){
is2DObject_
=
_2d
;};
void
set2D
(
bool
_2d
){
is2DObject_
=
_2d
;};
bool
isPerSkeletonObject
(){
return
isPerSkeletonObject_
;};
bool
isPerSkeletonObject
(){
return
isPerSkeletonObject_
;};
void
setPerSkeletonObject
(
bool
_is
){
isPerSkeletonObject_
=
_is
;};
void
setPerSkeletonObject
(
bool
_is
){
isPerSkeletonObject_
=
_is
;};
void
setPerSkeletonModelView
(
GLMatrixd
_is
){
perSkeletonModelView_
=
_is
;};
void
setPerSkeletonModelView
(
GLMatrixd
_is
){
perSkeletonModelView_
=
_is
;};
void
ortho2DMode
(
GLState
&
_state
);
void
ortho2DMode
(
GLState
&
_state
);
void
perSkeletonMode
(
GLState
&
_state
);
void
perSkeletonMode
(
GLState
&
_state
);
void
update2DOffset
(
ACG
::
Vec2d
_offset
){
offset_
+=
_offset
;};
void
update2DOffset
(
ACG
::
Vec2d
_offset
){
offset_
+=
_offset
;};
...
...
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