//----------------------------------------------------------------------------
void Element::update(double dt)
{
+ if( !_transform->getNodeMask() )
+ // Don't do anything if element is hidden
+ return;
+
if( _transform_dirty )
{
osg::Matrix m;
{
if( child->getNameString() == "update" )
update(0);
+ else if( child->getNameString() == "visible" )
+ // TODO check if we need another nodemask
+ _transform->setNodeMask( child->getBoolValue() ? 0xffffffff : 0 );
else
childChanged(child);
}
_paint_fill(VG_INVALID_HANDLE),
_attributes_dirty(~0),
_stroke_width(1),
+ _stroke_linecap(VG_CAP_BUTT),
_fill(false)
{
setSupportsDisplayList(false);
_attributes_dirty |= FILL_COLOR;
}
+ /**
+ * Set stroke-linecap
+ *
+ * @see http://www.w3.org/TR/SVG/painting.html#StrokeLinecapProperty
+ */
+ void setStrokeLinecap(const std::string& linecap)
+ {
+ if( linecap == "round" )
+ _stroke_linecap = VG_CAP_ROUND;
+ else if( linecap == "square" )
+ _stroke_linecap = VG_CAP_SQUARE;
+ else
+ _stroke_linecap = VG_CAP_BUTT;
+ }
+
/**
* Draw callback
*/
vgSetPaint(_paint, VG_STROKE_PATH);
vgSetf(VG_STROKE_LINE_WIDTH, _stroke_width);
+ vgSeti(VG_STROKE_CAP_STYLE, _stroke_linecap);
vgSetfv( VG_STROKE_DASH_PATTERN,
_stroke_dash.size(),
_stroke_dash.empty() ? 0 : &_stroke_dash[0] );
VGfloat _stroke_color[4];
VGfloat _stroke_width;
std::vector<VGfloat> _stroke_dash;
+ VGCapStyle _stroke_linecap;
bool _fill;
VGfloat _fill_color[4];
else if( child->getNameString() == "stroke-width"
|| child->getNameString() == "stroke-dasharray" )
_attributes_dirty |= STROKE;
+ else if( child->getNameString() == "stroke-linecap" )
+ _path->setStrokeLinecap( child->getStringValue() );
else if( child->getNameString() == "fill" )
_path->enableFill( child->getBoolValue() );
}
if( _font_size == child || _font_aspect == child )
_attributes_dirty |= FONT_SIZE;
else if( child->getNameString() == "text" )
- _text->setText( child->getStringValue() );
+ _text->setText
+ (
+ osgText::String( child->getStringValue(),
+ osgText::String::ENCODING_UTF8 )
+ );
+ else if( child->getNameString() == "max-width" )
+ _text->setMaximumWidth( child->getFloatValue() );
else if( child->getNameString() == "font" )
setFont( child->getStringValue() );
}