Replaced Widget::GraphicsSubgraph with GraphicsSubgraphMap to allow finer control of when the rendering subgraphs are done.

This commit is contained in:
Robert Osfield
2014-05-28 10:06:14 +00:00
parent 6af9edf33b
commit 1fcb91900a
13 changed files with 83 additions and 31 deletions

View File

@@ -1703,6 +1703,10 @@ public:
#define REMOVE_SERIALIZER(PROP) \
wrapper->markSerializerAsRemoved( #PROP );
#define ADD_MAP_SERIALIZER(PROP, TYPE, KEYTYPE, ELEMENTTYPE) \
wrapper->addSerializer( new osgDB::MapSerializer< MyClass, TYPE >( \
#PROP, &MyClass::get##PROP, &MyClass::get##PROP, &MyClass::set##PROP, KEYTYPE, ELEMENTTYPE), osgDB::BaseSerializer::RW_MAP )
#define ADD_METHOD_OBJECT( METHODNAME, METHODOBJECTCLASS ) wrapper->addMethodObject(METHODNAME, new METHODOBJECTCLASS());
#define ADD_METHOD(METHODNAME) \

View File

@@ -44,6 +44,7 @@ public:
void setDisabledTextColor(const osg::Vec4& color) { _disabledTextColor = color; }
const osg::Vec4& getDisabledTextColor() const { return _disabledTextColor; }
virtual osg::Node* createDepthSetPanel(const osg::BoundingBox& extents);
virtual osg::Node* createPanel(const osg::BoundingBox& extents, const osg::Vec4& colour);
virtual osg::Node* createFrame(const osg::BoundingBox& extents, const FrameSettings* frameSettings);
virtual osg::Node* createText(const osg::BoundingBox& extents, const AlignmentSettings* as, const TextSettings* textSettings, const std::string& text);

View File

@@ -42,13 +42,20 @@ public:
virtual void dirty();
typedef std::map<int, osg::ref_ptr<osg::Node> > GraphicsSubgraphMap;
/** Set the subgraph to be used to render the widget.*/
void setGraphicsSubgraph(int orderNum, osg::Node* node) { _graphicsSubgraphMap[orderNum] = node; _graphicsInitialized = true; }
/** Get the subgraph to be used to render the widget.*/
osg::Node* getGraphicsSubgraph(int orderNum) { GraphicsSubgraphMap::iterator itr = _graphicsSubgraphMap.find(orderNum); return (itr!=_graphicsSubgraphMap.end()) ? itr->second.get() : 0; }
/** Get the const subgraph to be used to render the widget.*/
const osg::Node* getGraphicsSubgraph(int orderNum) const { GraphicsSubgraphMap::const_iterator itr = _graphicsSubgraphMap.find(orderNum); return (itr!=_graphicsSubgraphMap.end()) ? itr->second.get() : 0; }
void setGraphicsSubgraphMap(const GraphicsSubgraphMap& gsm) { _graphicsSubgraphMap = gsm; _graphicsInitialized = true; }
GraphicsSubgraphMap& getGraphicsSubgraphMap() { return _graphicsSubgraphMap; }
const GraphicsSubgraphMap& getGraphicsSubgraphMap() const { return _graphicsSubgraphMap; }
/** Set the subgraph to be used to erndering the widget.*/
void setGraphicsSubgraph(osg::Node* node) { _graphicsSubgraph = node; _graphicsInitialized = true; }
/** Get the subgraph to be used to erndering the widget.*/
osg::Node* getGraphicsSubgraph() { return _graphicsSubgraph.get(); }
/** Get the const subgraph to be used to erndering the widget.*/
const osg::Node* getGraphicsSubgraph() const { return _graphicsSubgraph.get(); }
/** createGraphics entry method, calls either callback object named "createGraphics" or the createGraphicsImplementation() method.*/
virtual void createGraphics();
@@ -136,7 +143,7 @@ protected:
bool _hasEventFocus;
bool _graphicsInitialized;
osg::ref_ptr<osg::Node> _graphicsSubgraph;
GraphicsSubgraphMap _graphicsSubgraphMap;
osg::BoundingBoxf _extents;