Improved handling of text
This commit is contained in:
@@ -33,18 +33,10 @@ void Label::createGraphicsImplementation()
|
||||
{
|
||||
OSG_NOTICE<<"Label::createGraphicsImplementation()"<<std::endl;
|
||||
|
||||
if (_textDrawable.valid())
|
||||
{
|
||||
_textDrawable->setText(_text);
|
||||
_graphicsInitialized = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Widget::createGraphicsImplementation();
|
||||
Style* style = (getStyle()!=0) ? getStyle() : Style::instance().get();
|
||||
osg::ref_ptr<Node> node = style->createText(_extents, getAlignmentSettings(), getTextSettings(), _text);
|
||||
_textDrawable = dynamic_cast<osgText::Text*>(node.get());
|
||||
|
||||
Style* style = (getStyle()!=0) ? getStyle() : Style::instance().get();
|
||||
osg::ref_ptr<Node> node = style->createText(_extents, getAlignmentSettings(), getTextSettings(), _text);
|
||||
_textDrawable = dynamic_cast<osgText::Text*>(node.get());
|
||||
addChild(node.get());
|
||||
}
|
||||
style->setupClipStateSet(_extents, getOrCreateStateSet());
|
||||
setGraphicsSubgraph(node.get());
|
||||
}
|
||||
|
||||
@@ -88,6 +88,9 @@ osg::Node* Style::createText(const osg::BoundingBox& extents, const AlignmentSet
|
||||
textDrawable->setText(text);
|
||||
textDrawable->setPosition( osg::Vec3(extents.xMin(), extents.yMin(), extents.zMin()) );
|
||||
|
||||
|
||||
textDrawable->setEnableDepthWrites(false);
|
||||
|
||||
if (ts)
|
||||
{
|
||||
textDrawable->setFont(ts->getFont());
|
||||
|
||||
Reference in New Issue
Block a user