{
const unsigned int renderFlags = renderList.GetFlags();
- bool enableDepthBuffer = ( ( renderFlags & RenderList::DEPTH_BUFFER_ENABLED ) != 0u );
+ if( ( renderFlags & RenderList::DEPTH_BUFFER_ENABLED ) != 0u )
+ {
+ //Enable depth testing
+ context.EnableDepthBuffer( true );
+ }
+ else
+ {
+ //Disable depth test and depth write
+ context.EnableDepthBuffer( false );
+ context.DepthMask( false );
+ }
GLbitfield clearMask = ( renderFlags & RenderList::DEPTH_CLEAR ) ? GL_DEPTH_BUFFER_BIT : 0u;
- context.EnableDepthBuffer( enableDepthBuffer );
-
// Stencil enabled, writing, and clearing...
const bool enableStencilBuffer( renderFlags & RenderList::STENCIL_BUFFER_ENABLED );
const bool enableStencilWrite( renderFlags & RenderList::STENCIL_WRITE );
-
context.EnableStencilBuffer( enableStencilBuffer );
-
if( enableStencilBuffer )
{
context.StencilFunc( (enableStencilWrite ? GL_ALWAYS : GL_EQUAL), 1, 0xFF );
* @param[in] context The GL context.
* @param[in] defaultShader The default shader to use.
* @param[in] buffer The current render buffer index (previous update buffer)
- * @param[in] frameTime The elapsed time between the last two updates.
* @param[in] viewMatrix The view matrix from the appropriate camera.
* @param[in] projectionMatrix The projection matrix from the appropriate camera.
- * @param[in] cullMode True if the renderers should be subjected to clipspace culling
*/
inline void ProcessRenderList(
const RenderList& renderList,
SceneGraph::TextureCache& textureCache,
SceneGraph::Shader& defaultShader,
BufferIndex bufferIndex,
- float frameTime,
const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- bool cullMode )
+ const Matrix& projectionMatrix )
{
DALI_PRINT_RENDER_LIST( renderList );
{
bool depthBufferEnabled = ( ( renderList.GetFlags() & RenderList::DEPTH_BUFFER_ENABLED ) != 0u );
size_t count = renderList.Count();
- for ( size_t index = 0; index < count; ++index )
+
+ if( depthBufferEnabled )
{
- const RenderItem& item = renderList.GetItem( index );
- DALI_PRINT_RENDER_ITEM( item );
+ for ( size_t index = 0; index < count; ++index )
+ {
+ const RenderItem& item = renderList.GetItem( index );
+ DALI_PRINT_RENDER_ITEM( item );
- //Enable depth writes if depth buffer is enabled and item is opaque
- context.DepthMask( depthBufferEnabled && item.IsOpaque() );
+ DepthWriteMode::Type depthWriteMode = item.mRenderer->GetDepthWriteMode();
+ context.DepthMask( ( depthWriteMode == DepthWriteMode::AUTO && item.mIsOpaque ) ||
+ ( depthWriteMode == DepthWriteMode::ON ) );
- item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, frameTime, cullMode, !item.IsOpaque() );
+ item.mRenderer->Render( context, textureCache, bufferIndex, *item.mNode, defaultShader,
+ item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque );
+ }
+ }
+ else
+ {
+ for ( size_t index = 0; index < count; ++index )
+ {
+ const RenderItem& item = renderList.GetItem( index );
+ DALI_PRINT_RENDER_ITEM( item );
+ item.mRenderer->Render( context, textureCache, bufferIndex, *item.mNode, defaultShader,
+ item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque );
+ }
}
}
else
const RenderItem& item = renderList.GetItem( index );
DALI_PRINT_RENDER_ITEM( item );
- item.GetRenderer().Render( context, textureCache, bufferIndex, item.GetNode(), defaultShader, item.GetModelViewMatrix(), viewMatrix, projectionMatrix, frameTime, cullMode, !item.IsOpaque() );
+ item.mRenderer->Render( context, textureCache, bufferIndex, *item.mNode, defaultShader,
+ item.mModelMatrix, item.mModelViewMatrix, viewMatrix, projectionMatrix, item.mSize, !item.mIsOpaque );
}
}
}
-/**
- * Render items from the currentIndex until the depth index changes.
- * Leaves currentIndex pointing at the
- *
- * @param[in] renderList The render-list to process.
- * @param[in] context The GL context.
- * @param[in] defaultShader The default shader to use.
- * @param[in] buffer The current render buffer index (previous update buffer)
- * @param[in] frameTime The elapsed time between the last two updates.
- * @param[in] viewMatrix The view matrix from the appropriate camera.
- * @param[in] projectionMatrix The projection matrix from the appropriate camera.
- * @param[in] cullMode True if the renderers should be subjected to clipspace culling
- * @param[in] depthIndex The current depth index
- * @param[inout] currentIndex On entry, the index in the render list of the first item at the given depth index. On exit, the index of the first item at the next depth index.
- */
-inline void RenderItemsAtDepthIndex(
- const RenderList& renderList,
- Context& context,
- SceneGraph::TextureCache& textureCache,
- SceneGraph::Shader& defaultShader,
- BufferIndex bufferIndex,
- float frameTime,
- const Matrix& viewMatrix,
- const Matrix& projectionMatrix,
- bool cullMode,
- int depthIndex,
- size_t& currentIndex ) // Out parameter
-{
- const size_t count = renderList.Count();
-
- // Don't initialise currentIndex. Ever.
- for( ; currentIndex < count ; currentIndex++ )
- {
- const RenderItem& renderItem = renderList.GetItem( currentIndex );
- DALI_PRINT_RENDER_ITEM( renderItem );
-
- if( renderItem.GetDepthIndex() == depthIndex )
- {
- const Matrix& modelViewMatrix = renderItem.GetModelViewMatrix();
- renderItem.GetRenderer().Render( context, textureCache, bufferIndex, renderItem.GetNode(), defaultShader, modelViewMatrix, viewMatrix, projectionMatrix, frameTime, cullMode, !renderItem.IsOpaque() );
-
- }
- else
- {
- break; // Stop iterating when we reach a new depth index
- }
- }
-}
-
-
-
void ProcessRenderInstruction( const RenderInstruction& instruction,
Context& context,
SceneGraph::TextureCache& textureCache,
SceneGraph::Shader& defaultShader,
- BufferIndex bufferIndex,
- float frameTime )
+ BufferIndex bufferIndex )
{
DALI_PRINT_RENDER_INSTRUCTION( instruction, bufferIndex );
if( renderList &&
!renderList->IsEmpty() )
{
- ProcessRenderList( *renderList, context, textureCache, defaultShader, bufferIndex, frameTime, *viewMatrix, *projectionMatrix, instruction.mCullMode );
+ ProcessRenderList( *renderList, context, textureCache, defaultShader, bufferIndex, *viewMatrix, *projectionMatrix );
}
}
}