Added initial shell of PushButton implementation

This commit is contained in:
Robert Osfield
2014-05-16 10:38:40 +00:00
parent 03fc0c3662
commit 3e00764649
10 changed files with 243 additions and 20 deletions

View File

@@ -36,7 +36,25 @@ Style::Style(const Style& style, const osg::CopyOp& copyop):
osg::Node* Style::createPanel(const osg::BoundingBox& extents, const osg::Vec4& colour)
{
return 0;
OSG_NOTICE<<"Creating Panel"<<std::endl;
osg::ref_ptr<osg::Geometry> geometry = new osg::Geometry;
osg::ref_ptr<osg::Vec3Array> vertices = new osg::Vec3Array;
geometry->setVertexArray(vertices.get());
vertices->push_back( osg::Vec3(extents.xMin(), extents.yMin(), extents.zMin()) );
vertices->push_back( osg::Vec3(extents.xMin(), extents.yMax(), extents.zMin()) );
vertices->push_back( osg::Vec3(extents.xMax(), extents.yMin(), extents.zMin()) );
vertices->push_back( osg::Vec3(extents.xMax(), extents.yMax(), extents.zMin()) );
osg::ref_ptr<osg::Vec4Array> colours = new osg::Vec4Array;
geometry->setColorArray(colours, osg::Array::BIND_OVERALL);
colours->push_back( colour );
geometry->addPrimitiveSet( new osg::DrawArrays(GL_TRIANGLE_STRIP, 0, 4) );
return geometry.release();
}
osg::Node* Style::createFrame(const osg::BoundingBox& extents, const FrameSettings* frameSettings)
@@ -46,12 +64,10 @@ osg::Node* Style::createFrame(const osg::BoundingBox& extents, const FrameSettin
osg::Node* Style::createText(const osg::BoundingBox& extents, const AlignmentSettings* as, const TextSettings* ts, const std::string& text)
{
osg::ref_ptr<osg::Geode> textGeode = new osg::Geode;
osg::ref_ptr<osgText::Text> textDrawable = new osgText::Text;
textGeode->addDrawable(textDrawable.get());
textDrawable->setText(text);
textDrawable->setPosition( osg::Vec3(extents.xMin(), extents.yMin(), extents.zMin()) );
if (ts)
{
@@ -65,7 +81,7 @@ osg::Node* Style::createText(const osg::BoundingBox& extents, const AlignmentSet
textDrawable->setAlignment(alignmentType);
}
return textGeode.release();
return textDrawable.release();
}
osg::Node* Style::createIcon(const osg::BoundingBox& extents, const std::string& filename)