|
Revision 13041, 1.8 kB
(checked in by robert, 15 months ago)
|
|
Ran script to remove trailing spaces and tabs
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #include <osgUtil/StateGraph> |
|---|
| 14 | |
|---|
| 15 | #include <osg/Notify> |
|---|
| 16 | |
|---|
| 17 | using namespace osg; |
|---|
| 18 | using namespace osgUtil; |
|---|
| 19 | |
|---|
| 20 | void StateGraph::reset() |
|---|
| 21 | { |
|---|
| 22 | _parent = NULL; |
|---|
| 23 | _stateset = NULL; |
|---|
| 24 | |
|---|
| 25 | _depth = 0; |
|---|
| 26 | |
|---|
| 27 | _children.clear(); |
|---|
| 28 | _leaves.clear(); |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | void StateGraph::clean() |
|---|
| 34 | { |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | _leaves.clear(); |
|---|
| 38 | |
|---|
| 39 | |
|---|
| 40 | for(ChildList::iterator itr=_children.begin(); |
|---|
| 41 | itr!=_children.end(); |
|---|
| 42 | ++itr) |
|---|
| 43 | { |
|---|
| 44 | itr->second->clean(); |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | } |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | void StateGraph::prune() |
|---|
| 51 | { |
|---|
| 52 | std::vector<const osg::StateSet*> toEraseList; |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | for(ChildList::iterator citr=_children.begin(); |
|---|
| 56 | citr!=_children.end(); |
|---|
| 57 | ++citr) |
|---|
| 58 | { |
|---|
| 59 | citr->second->prune(); |
|---|
| 60 | |
|---|
| 61 | if (citr->second->empty()) |
|---|
| 62 | { |
|---|
| 63 | toEraseList.push_back(citr->first); |
|---|
| 64 | } |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | for(std::vector<const osg::StateSet*>::iterator eitr=toEraseList.begin(); |
|---|
| 68 | eitr!=toEraseList.end(); |
|---|
| 69 | ++eitr) |
|---|
| 70 | { |
|---|
| 71 | _children.erase(*eitr); |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | } |
|---|