Skip to content
Snippets Groups Projects

adds setters for translation and rotation in TransformNode

Merged Marvin Neurath requested to merge feature/Transformnode_extensions into master
2 files
+ 48
15
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -134,6 +134,17 @@ translate(const Vec3d& _v)
updateMatrix();
}
//----------------------------------------------------------------------------
void
TransformNode::
setTranslation(const Vec3d& _v)
{
translation_ = _v;
updateMatrix();
}
//----------------------------------------------------------------------------
@@ -156,6 +167,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
TransformNode::
scale(const Vec3d& _s)
{
scale_matrix_.scale(_s);
@@ -256,7 +283,7 @@ enter(GLState& _state, const DrawModes::DrawMode& /* _drawmode */ )
if (is2DObject_)
ortho2DMode(_state);
if(isPerSkeletonObject_)
perSkeletonMode(_state);
}
@@ -360,19 +387,19 @@ ortho2DMode(GLState& _state)
if (width == 0 || height == 0)
return;
// _state.viewport(0,0,width, height);
_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(0.0, (GLdouble)width, (GLdouble)height, 0.0, 0.01,20.0);
_state.reset_modelview();
_state.lookAt( Vec3d(0.0,0.0,0.0),
Vec3d(0.0,0.0,1.0),
_state.lookAt( Vec3d(0.0,0.0,0.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
_state.scale(scaleFactor2D_, scaleFactor2D_, 1.0);
// move image center to window center
Loading