I create a scenegragh with function given below which calls the Axesnode::create function which displays the axes labels in Text3D
osg::Group *createSceneGraph(const QString s) { osg::Group *root = TransformerGraph::create(world_name.toStdString())->asGroup(); assert(root); . . . . .
// add coordinate axes
osg::Switch *switch_node = new osg::Switch();
switch_node->addChild(AxesNode::create());
switch_node->setAllChildrenOn();
switch_node->setName("axes_node");
root->addChild(switch_node);
return root;
}
::osg::Node* AxesNode::create(...)
{
.
.
.
.
.
::osgText::Text3D *text3d= new ::osgText::Text3D;
text3d->setText("X");
text3d->setFont(user_font3D.get());
text3d->setCharacterSize(0.1f);
text3d->setPosition(::osg::Vec3d(0.4,0.0,0.02));
text3d->setAxisAlignment(osgText::Text3D::XZ_PLANE);
text3d->setColor( osg::Vec4(0.9f, 0.1f, 0.1f, 1.0f) );
//and same for "Y" and "Z" labels .
}
Now the problem is how do I retrieve this text3D nodes in order to create UI that sets the font style of the axes labels(X,Y,Z) from the chosen fonts.
Aucun commentaire:
Enregistrer un commentaire