This is required because certain clipping scenarios stopped working as we only changed the depth
index on the nodes but not the order in which they appear in the container.
Clipping relied on the order of the nodes in the hieararchy.
Change-Id: I7194c35318f55c326fe82886d6b58a865999e7bc
+/**
+ * Descends into node's hierarchy and sorts the children of each child according to their depth-index.
+ * @param[in] node The node whose hierarchy to descend
+ */
+void SortSiblingNodesRecursively( Node& node )
+{
+ NodeContainer& container = node.GetChildren();
+ std::sort( container.Begin(), container.End(),
+ []( Node* a, Node* b ) { return a->GetDepthIndex() < b->GetDepthIndex(); } );
+
+ // Descend tree and sort as well
+ for( auto&& iter : container )
+ {
+ SortSiblingNodesRecursively( *iter );
+ }
+} // unnamed namespace
+
/**
* Structure to contain UpdateManager internal data
*/
/**
* Structure to contain UpdateManager internal data
*/
{
iter.node->SetDepthIndex( iter.sortedDepth );
}
{
iter.node->SetDepthIndex( iter.sortedDepth );
}
+
+ // Go through node hierarchy and rearrange siblings according to depth-index
+ SortSiblingNodesRecursively( *( mImpl->root ) );
}
void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler )
}
void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler )