Added support for set/getColor to ShapeDrawable.

This commit is contained in:
Robert Osfield
2003-04-16 20:02:15 +00:00
parent cad160fbe6
commit 0b0c6c4e60
3 changed files with 73 additions and 35 deletions

View File

@@ -12,6 +12,7 @@
*/
#include <osg/ShapeDrawable>
#include <osg/GL>
#include <osg/Notify>
using namespace osg;
@@ -26,7 +27,14 @@ class DrawShapeVisitor : public ConstShapeVisitor
DrawShapeVisitor(State& state,const TessellationHints* hints):
_state(state),
_hints(hints) {}
_hints(hints)
{
if (hints)
{
notify(NOTICE)<<"Warning: TessellationHints ignored in present osg::ShapeDrawable implementation."<<std::endl;
}
}
virtual void apply(const Sphere&);
virtual void apply(const Box&);
@@ -1249,17 +1257,21 @@ void PrimitiveShapeVisitor::apply(const CompositeShape& group)
//
ShapeDrawable::ShapeDrawable()
ShapeDrawable::ShapeDrawable():
_color(1.0f,1.0f,1.0f,1.0f)
{
}
ShapeDrawable::ShapeDrawable(Shape* shape)
ShapeDrawable::ShapeDrawable(Shape* shape):
_color(1.0f,1.0f,1.0f,1.0f)
{
setShape(shape);
}
ShapeDrawable::ShapeDrawable(const ShapeDrawable& pg,const CopyOp& copyop):
Drawable(pg,copyop)
Drawable(pg,copyop),
_color(pg._color),
_tessellationHints(pg._tessellationHints)
{
}
@@ -1271,7 +1283,10 @@ void ShapeDrawable::drawImplementation(State& state) const
{
if (_shape.valid())
{
glColor4fv(_color.ptr());
DrawShapeVisitor dsv(state,_tessellationHints.get());
_shape->accept(dsv);
}
}