Several Classes in gb Rendering

Source: Internet
Author: User

From: http://www.cppblog.com/rise-worlds/archive/2009/04/22/80688.html

Several Classes in gb rendering:

RenderFrame

RenderStep

RenderClick

RenderView

**************************************** **************************************** **************************************** ******

RenderFrame is a complete rendering frame. It encapsulates the interfaces called by the upper layer for the rendering system. Each RenderFrame contains multiple nirendersteps;

RenderStep: a rendering step in one frame. Each step contains n rendering batches of NiRenderClick;

NiRenderClick a rendering batch, which represents a drawing operation of the graphic hardware. It calls DrawPrimitive for the vertex cache of all objects in the rendering queue. Each RenderClick corresponds to a RenderTarget (equivalent to a set of vertex streams ), the exact literal meaning of RenderClick is a painting. The function of this class is basically like this. You know what you want to draw, but you need RenderClick to figure out what you want to draw, each RenderClick corresponds to a RenderTarget. Is the place to draw. This is the process of drawing an image. First, finding the RenderTarget is the place where the image is to be drawn, because if it is a post-effect, sometimes there will be multiple rendertargets.

RenderView is equivalent to an object to be rendered. It is connected to our current scene node through the AppendScene interface. Another important tool in RenderView is the "Culler, what is the use of Culler? It is responsible for cropping. Here, the cropping is logical, that is, precise to the ry level. (Note that it is not at the triangle level ). Culler is added as a Processor, which is a cropping process. Culler provides some abstract interfaces to meet user-defined cropping requirements. That is to say, you can crop the image before rendering as needed.

 

Call method:

When an application calls the Display interface of the NiRenderFrame, The NiRenderFrame calls the Render () interface of each NiRenderStep in sequence, and the NiRenderStep executes all NiRenderClick operations.

 

For each NiRenderClick, you must first set the view and rendering target, that is, the entry and exit of the rendering data stream. After creating a viewport, You can crop the objects in the scene graph by using the associated camera (the default options include the viewport cropping and occlusion cropping, and you can also add your own cropping method by using the callback function ), put uncropped objects into the rendering queue. Gambyro then sorts the objects in the rendering queue based on the materials, so that the objects with the same materials are in adjacent positions, which reduces the overhead of switching shader.

01. <pre class = "cpp" name = "code"> // creates a rendered texture viewport. crop the objects in the scene chart using the associated camera 02. ni3DRenderView * pkRenderedTextureRenderView = NiNew Ni3DRenderView (03. m_spExtraCamera, m_spCuller); 04. pkRenderedTextureRenderView-> SetName (m_kRenderedTextureRenderViewName); 05. // mount to the scene 06. pkRenderedTextureRenderView-> AppendScene (m_spScene); 07. 08. // create NiRenderClick for the rendering texture. 09. niViewRenderClick * pkRenderedTextureRenderClick = NiNew NiViewRenderClick; 10. pkRenderedTextureRenderClick-> SetName (m_kRenderedTextureRenderClickName); 11. pkRenderedTextureRenderClick-> AppendRenderView (12. pkRenderedTextureRenderView); 13. // set the rendering target 14. pkRenderedTextureRenderClick-> SetRenderTargetGroup (m_spRenderTargetGroup); 15. pkRenderedTextureRenderClick-> SetClearAllBuffers (true); 16. pkRenderedTextureRenderClick-> SetPreProcessingCallbackFunc (17. renderedTextureRenderClickPre, this); 18. pkRenderedTextureRenderClick-> SetPostProcessingCallbackFunc (19. renderedTextureRenderClickPost, this );

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.