Analyze drawimplementation (OSG: renderinfo & renderinfo, renderleaf * & previous)

Source: Internet
Author: User

Void renderbin: drawimplementation (OSG: renderinfo & renderinfo, renderleaf * & previous)
{
OSG: State & State = * renderinfo. getstate ();

// OSG: Notify (OSG: Notice) <"begin renderbin: drawimplementation" <classname () <"sortmode" <getsortmode () <STD:: Endl;

Unsigned int numtopop = (previous? Stategraph: numtopop (previous-> _ parent): 0 );
If (numtopop> 1) -- numtopop;
Unsigned int insertstatesetposition = state. getstatesetstacksize ()-numtopop; // automatically inserts a _ stateset for processing transparent rendering. See the constructor.

If (_ stateset. Valid ())
{
State. insertstateset (insertstatesetposition, _ stateset. Get ());
}

// Draw first set of draw bins.
Renderbinlist: iterator rbitr; // _ bins can be automatically sorted when generated (because it is map type), so first execute-> first less than 0
For (rbitr = _ bins. Begin ();
Rbitr! = _ Bins. End () & rbitr-> first <0;
++ Rbitr)
{
Rbitr-> second-> draw (renderinfo, previous); // because it is a recursive call, it is continuously traversed to the lower layer and recursively calls the renderbin at the lowest layer.
}

// Draw fine grained ordering.
For (renderleaflist: iterator rlitr = _ renderleaflist. Begin (); // when the rendering leaves are sorted before rendering, The _ stategraphlist copies them and clears them at the same time.
Rlitr! = _ Renderleaflist. End ();//
++ Rlitr)
{
Renderleaf * RL = * rlitr;
RL-> render (renderinfo, previous); // _ stategraphlist. If it is in deep sorting, complete the rendering leaves in all _ stategraphilist.
Previous = RL;
}

Bool draw_forward = true; // (_ sortmode! = Sort_by_state) | (State. getframestamp ()-> getframenumber () % 2) = 0;

// draw coarse grained ordering.
If (draw_forward) // if it is not sorted from the back to the front, you do not need to copy the rendering leaves from _ stategraphlist,
{< br> for (stategraphlist: iterator oitr = _ stategraphlist. begin ();
oitr! = _ Stategraphlist. End ();
++ oitr)
{

for (stategraph: leaflist: iterator dw_itr = (* oitr)-> _ leaves. Begin ();
dw_itr! = (* Oitr)-> _ leaves. end ();
++ dw_itr)
{< br> renderleaf * RL = dw_itr-> get ();
RL-> render (renderinfo, previous);
previous = RL;

}< BR >}< br> else
{< br> for (stategraphlist: reverse_iterator oitr = _ stategraphlist. rbegin ();
oitr! = _ Stategraphlist. rend ();
++ oitr)
{

For (stategraph: leaflist: iterator dw_itr = (* oitr)-> _ leaves. Begin ();
Dw_itr! = (* Oitr)-> _ leaves. End ();
++ Dw_itr)
{
Renderleaf * RL = dw_itr-> get ();
RL-> render (renderinfo, previous );
Previous = RL;

}
}
}

// Draw post bins.
For (;
Rbitr! = _ Bins. End ();
++ Rbitr)
{
Rbitr-> second-> draw (renderinfo, previous); // If the rendering number is greater than 0
}

If (_ stateset. Valid ())
{
State. removestateset (insertstatesetposition );
// State. Apply ();
}

// OSG: Notify (OSG: Notice) <"End renderbin: drawimplementation" <classname () <STD: Endl;

// The above function is called recursively. First, the bottom layer of the State Tree is rendered, and the number is smaller than O. Then, the number of the bottom layer is rendered less than O, next, the second-to-last number greater than O

// The relative layers of the rendering tree and state tree are the same. The drawable with the same layers is placed in the bin with the same layers.
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.