Jump to content
  • Advertisement
Sign in to follow this  
luasitdown

why last?

This topic is 4829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I see a code . /** Set true by camera if the node is visible in this frame. */ void setRenderedInLastFrame( bool enabled ); why care about last frame?

Share this post


Link to post
Share on other sites
Advertisement
Most programmers tend to name their functions and variables something descriptive. A name that will give a hint to its purpose, or maybe how its used.

Looking at this function, the name tells me that its a function to check whether or not the node was rendered in the previous(last) frame.

Share this post


Link to post
Share on other sites
I don't know why they care. Why don't you see where that value is actually used? Chances are that that function simply sets a boolean variable in the class... search through the source code for where that variable is used.

Offtopic: do you realize that you've posted EIGHT topics today? Just out of curiosity, what do you do to try to answer your own questions before posting them here?

Share this post


Link to post
Share on other sites
Absolutely, we should all solve our own problems and not post anything here. ;)

Share this post


Link to post
Share on other sites
It's for optimization. You would use it something like this:
    // If the object was rendered last frame, then it will probably be visible
// this frame too, so just draw it. Otherwise, test if it is visible before drawing.

if ( getRenderedInLastFrame()
{
Draw();
}
else
{
// Test if the object is visible. If it is, then draw it.

bool visible;
visible = ExpensiveTestToDetermineVisibility();
if ( visible )
{
Draw();
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!