X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-algorithms.cpp;h=406f21655e6c98aeaf4682fc85e238647953e08f;hb=8f612650d20752ab6aba022a9dbefdb883968e8f;hp=a8d2162aa91cc0c96761408f3b3b26035592169d;hpb=9e520e9eeb3debf05aaf74e01d712126e2fa2f66;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-algorithms.cpp b/dali/internal/render/common/render-algorithms.cpp old mode 100644 new mode 100755 index a8d2162..406f216 --- a/dali/internal/render/common/render-algorithms.cpp +++ b/dali/internal/render/common/render-algorithms.cpp @@ -271,7 +271,7 @@ inline void RenderAlgorithms::SetupScissorClipping( const RenderItem& item, Cont // This is a clipping node. We generate the AABB for this node and intersect it with the previous intersection further up the tree. // Get the AABB bounding box for the current render item. - const ClippingBox scissorBox( item.CalculateViewportSpaceAABB( mViewportRectangle.width, mViewportRectangle.height ) ); + const ClippingBox scissorBox( item.CalculateViewportSpaceAABB( item.mSize, mViewportRectangle.width, mViewportRectangle.height ) ); // Get the AABB for the parent item that we must intersect with. const ClippingBox& parentBox( mScissorStack.back() ); @@ -415,6 +415,8 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable, Vector& boundTextures, + const RenderInstruction& instruction, + const Rect& rootClippingRect, int orientation ) { DALI_PRINT_RENDER_LIST( renderList ); @@ -441,6 +443,22 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, // Setup Scissor testing (for both viewport and per-node scissor) mScissorStack.clear(); + + // Add root clipping rect (set manually for Render function ny partial update for example) + // on the bottom of the stack + if (!rootClippingRect.IsEmpty()) + { + context.SetScissorTest( true ); + context.Scissor( rootClippingRect.x, rootClippingRect.y, rootClippingRect.width, rootClippingRect.height ); + mScissorStack.push_back( rootClippingRect ); + } + // We are not performing a layer clip and no clipping rect set. Add the viewport as the root scissor rectangle. + else if (!renderList.IsClipping()) + { + context.SetScissorTest( false ); + mScissorStack.push_back( mViewportRectangle ); + } + if( renderList.IsClipping() ) { context.SetScissorTest( true ); @@ -474,17 +492,28 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, mScissorStack.push_back( layerScissorBox ); mHasLayerScissor = true; } - else - { - // We are not performing a layer clip. Add the viewport as the root scissor rectangle. - context.SetScissorTest( false ); - mScissorStack.push_back( mViewportRectangle ); - } // Loop through all RenderList in the RenderList, set up any prerequisites to render them, then perform the render. for( uint32_t index = 0u; index < count; ++index ) { const RenderItem& item = renderList.GetItem( index ); + + // Discard renderers outside the root clipping rect + bool skip = true; + if( !rootClippingRect.IsEmpty() ) + { + auto rect = item.CalculateViewportSpaceAABB( item.mUpdateSize, mViewportRectangle.width, mViewportRectangle.height ); + + if(rect.Intersect( rootClippingRect )) + { + skip = false; + } + } + else + { + skip = false; + } + DALI_PRINT_RENDER_ITEM( item ); // Set up clipping based on both the Renderer and Actor APIs. @@ -498,14 +527,26 @@ inline void RenderAlgorithms::ProcessRenderList( const RenderList& renderList, // draw-mode state, such as Overlays. // If the flags are set to "AUTO", the behavior then depends on the type of renderer. Overlay Renderers will always // disable depth testing and writing. Color Renderers will enable them if the Layer does. - if( depthBufferAvailable == Integration::DepthBufferAvailable::TRUE ) + if (depthBufferAvailable == Integration::DepthBufferAvailable::TRUE) { - SetupDepthBuffer( item, context, autoDepthTestMode, firstDepthBufferUse ); + SetupDepthBuffer(item, context, autoDepthTestMode, firstDepthBufferUse); } - // Render the item. - item.mRenderer->Render( context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, - viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, boundTextures ); + // Depending on whether the renderer has draw commands attached or not the rendering process will + // iterate through all the render queues. If there are no draw commands attached, only one + // iteration must be done and the default behaviour of the renderer will be executed. + // The queues allow to iterate over the same renderer multiple times changing the state of the renderer. + // It is similar to the multi-pass rendering. + if( !skip ) + { + auto const MAX_QUEUE = item.mRenderer->GetDrawCommands().empty() ? 1 : DevelRenderer::RENDER_QUEUE_MAX; + for (auto queue = 0u; queue < MAX_QUEUE; ++queue) + { + // Render the item. + item.mRenderer->Render(context, bufferIndex, *item.mNode, item.mModelMatrix, item.mModelViewMatrix, + viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque, boundTextures, instruction, queue); + } + } } } } @@ -522,6 +563,7 @@ void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instru Integration::DepthBufferAvailable depthBufferAvailable, Integration::StencilBufferAvailable stencilBufferAvailable, Vector& boundTextures, + const Rect& rootClippingRect, int orientation ) { DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex ); @@ -552,6 +594,8 @@ void RenderAlgorithms::ProcessRenderInstruction( const RenderInstruction& instru depthBufferAvailable, stencilBufferAvailable, boundTextures, + instruction, //added for reflection effect + rootClippingRect, orientation ); } }