|
Revision 7328, 2.4 kB
(checked in by robert, 6 years ago)
|
|
Changed RenderLeaf? and StateGraph? so that they use ref_ptr<> by default for Drawable and StateSet?.
|
-
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/RenderLeaf> |
|---|
| 14 | #include <osgUtil/StateGraph> |
|---|
| 15 | #include <osg/Notify> |
|---|
| 16 | |
|---|
| 17 | using namespace osg; |
|---|
| 18 | using namespace osgUtil; |
|---|
| 19 | |
|---|
| 20 | void RenderLeaf::render(osg::RenderInfo& renderInfo,RenderLeaf* previous) |
|---|
| 21 | { |
|---|
| 22 | osg::State& state = *renderInfo.getState(); |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | if (state.getAbortRendering()) |
|---|
| 26 | { |
|---|
| 27 | |
|---|
| 28 | return; |
|---|
| 29 | } |
|---|
| 30 | |
|---|
| 31 | if (previous) |
|---|
| 32 | { |
|---|
| 33 | |
|---|
| 34 | |
|---|
| 35 | state.applyProjectionMatrix(_projection.get()); |
|---|
| 36 | state.applyModelViewMatrix(_modelview.get()); |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | StateGraph* prev_rg = previous->_parent; |
|---|
| 40 | StateGraph* prev_rg_parent = prev_rg->_parent; |
|---|
| 41 | StateGraph* rg = _parent; |
|---|
| 42 | if (prev_rg_parent!=rg->_parent) |
|---|
| 43 | { |
|---|
| 44 | StateGraph::moveStateGraph(state,prev_rg_parent,rg->_parent); |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | state.apply(rg->getStateSet()); |
|---|
| 48 | |
|---|
| 49 | } |
|---|
| 50 | else if (rg!=prev_rg) |
|---|
| 51 | { |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | state.apply(rg->getStateSet()); |
|---|
| 55 | |
|---|
| 56 | } |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | _drawable->draw(renderInfo); |
|---|
| 61 | } |
|---|
| 62 | else |
|---|
| 63 | { |
|---|
| 64 | |
|---|
| 65 | state.applyProjectionMatrix(_projection.get()); |
|---|
| 66 | state.applyModelViewMatrix(_modelview.get()); |
|---|
| 67 | |
|---|
| 68 | |
|---|
| 69 | StateGraph::moveStateGraph(state,NULL,_parent->_parent); |
|---|
| 70 | |
|---|
| 71 | state.apply(_parent->getStateSet()); |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | _drawable->draw(renderInfo); |
|---|
| 75 | } |
|---|
| 76 | |
|---|
| 77 | if (_dynamic) |
|---|
| 78 | { |
|---|
| 79 | state.decrementDynamicObjectCount(); |
|---|
| 80 | } |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | } |
|---|