/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
// The depth buffer must be enabled if either reading or writing.
context.EnableDepthBuffer( true );
- // Set up the depth mask based on our depth write setting.
- context.DepthMask( enableDepthWrite );
-
// Look-up the GL depth function from the Dali::DepthFunction enum, and set it.
context.DepthFunc( DaliDepthToGLDepthTable[ item.mRenderer->GetDepthFunction() ] );
firstDepthBufferUse = false;
// Note: The buffer will only be cleared if written to since a previous clear.
+ context.DepthMask( true );
context.Clear( GL_DEPTH_BUFFER_BIT, Context::CHECK_CACHED_VALUES );
}
+
+ // Set up the depth mask based on our depth write setting.
+ context.DepthMask( enableDepthWrite );
}
else
{
// So we know if we are at depth 4 and the stackDepth is 5, that we have gone up.
// If the depth is the same then we are effectively part of a different sub-tree from the parent, we must also remove the current clip.
// Note: Stack depth must always be at least 1, as we will have the layer or stage size as the root value.
- if( ( childStackDepth > 0u ) && ( scissorDepth <= childStackDepth ) )
+ if( ( childStackDepth > 0u ) && ( scissorDepth < childStackDepth ) )
{
- while( scissorDepth <= childStackDepth ) // Pop until sibling
+ while( scissorDepth < childStackDepth )
{
mScissorStack.pop_back();
--childStackDepth;
// We traversed up the tree, we need to apply a new scissor rectangle (unless we are at the root).
traversedUpTree = true;
}
- else if( clippingNode && childStackDepth > 0u && childStackDepth == scissorDepth ) // case of sibling clip area
+ if( clippingNode && childStackDepth > 0u && childStackDepth == scissorDepth ) // case of sibling clip area
{
mScissorStack.pop_back();
--childStackDepth;
// 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() );
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
Integration::DepthBufferAvailable depthBufferAvailable,
- Integration::StencilBufferAvailable stencilBufferAvailable )
+ Integration::StencilBufferAvailable stencilBufferAvailable,
+ Vector<GLuint>& boundTextures,
+ const RenderInstruction& instruction,
+ const Rect<int>& rootClippingRect
+ )
{
DALI_PRINT_RENDER_LIST( 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 );
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( size_t index( 0u ); index < count; ++index )
+ for( uint32_t index = 0u; index < count; ++index )
{
const RenderItem& item = renderList.GetItem( index );
+
DALI_PRINT_RENDER_ITEM( item );
// Set up clipping based on both the Renderer and Actor APIs.
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 );
+ // 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.
+ 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);
+ }
}
}
}
Context& context,
BufferIndex bufferIndex,
Integration::DepthBufferAvailable depthBufferAvailable,
- Integration::StencilBufferAvailable stencilBufferAvailable )
+ Integration::StencilBufferAvailable stencilBufferAvailable,
+ Vector<GLuint>& boundTextures,
+ const Rect<int>& rootClippingRect )
{
DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex );
*viewMatrix,
*projectionMatrix,
depthBufferAvailable,
- stencilBufferAvailable );
+ stencilBufferAvailable,
+ boundTextures,
+ instruction, //added for reflection effect
+ rootClippingRect );
}
}
}