Commit 467c3fd8 authored by Isaak Lim's avatar Isaak Lim
Browse files

- fixed a bug in TextNode where the scaling factor of a possible parent...

- fixed a bug in TextNode where the scaling factor of a possible parent TransformNode was not considered 
refs #269

- switched to screen aligned display style of the TextNode in RulerPlugin 
refs #741

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14704 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7fe0adbd
......@@ -246,10 +246,25 @@ draw(GLState& _state, const DrawModes::DrawMode& /*_drawMode*/)
// do not rotate the quads in this case
if (textMode_ == SCREEN_ALIGNED) {
_state.push_modelview_matrix();
// try to get the scale factor from the parent TransformNode if it exists
BaseNode* pParent = parent();
double scale = 1.0;
while (pParent) {
TransformNode* pTrans = dynamic_cast<TransformNode*>(pParent);
if (pTrans) {
scale = pTrans->scale()(0,0);
break;
}
pParent = pParent->parent();
}
// get the translation
Vec3d projected = _state.project(Vec3d(0.0, 0.0, 0.0));
_state.reset_modelview();
Vec3d unprojected = _state.unproject(projected);
_state.translate(unprojected);
_state.scale(scale);
}
_state.push_modelview_matrix();
......
......@@ -158,7 +158,7 @@ void RulerPlugin::slotMouseEvent(QMouseEvent* _event)
if (!object->getAdditionalNode(textNode_,name(),textNodeName_.c_str()))
{
textNode_ = new ACG::SceneGraph::TextNode(textTransformNode_,textNodeName_,ACG::SceneGraph::TextNode::OBJECT_ALIGNED);
textNode_ = new ACG::SceneGraph::TextNode(textTransformNode_,textNodeName_,ACG::SceneGraph::TextNode::SCREEN_ALIGNED);
object->addAdditionalNode(textNode_,name(),textNodeName_.c_str());
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment