inline void doRenderNonInstanced( RenderPass const & pass , UniformBuffer & ubo , Scene const & scene , PickingPass::NodeType type , MapType & nodes ) { uint32_t count{ 1u }; for ( auto itPipelines : nodes ) { pass.updatePipeline( *itPipelines.first ); itPipelines.first->apply(); auto drawIndex = ubo.getUniform< UniformType::eUInt >( DrawIndex ); auto nodeIndex = ubo.getUniform< UniformType::eUInt >( NodeIndex ); drawIndex->setValue( uint8_t( type ) + ( ( count & 0x00FFFFFF ) << 8 ) ); uint32_t index{ 0u }; for ( auto & renderNode : itPipelines.second ) { nodeIndex->setValue( index++ ); ubo.update(); if ( renderNode.m_data.isInitialised() ) { doRenderNodeNoPass( renderNode ); } } count++; } }
inline void doTraverseNodes( RenderPass const & pass , UniformBuffer & ubo , MapType & nodes , PickingPass::NodeType type , FuncType function ) { uint32_t count{ 1u }; for ( auto itPipelines : nodes ) { pass.updatePipeline( *itPipelines.first ); itPipelines.first->apply(); auto drawIndex = ubo.getUniform< UniformType::eUInt >( DrawIndex ); auto nodeIndex = ubo.getUniform< UniformType::eUInt >( NodeIndex ); drawIndex->setValue( uint8_t( type ) + ( ( count & 0x00FFFFFF ) << 8 ) ); uint32_t index{ 0u }; for ( auto itPass : itPipelines.second ) { for ( auto itSubmeshes : itPass.second ) { nodeIndex->setValue( index++ ); ubo.update(); function( *itPipelines.first , *itPass.first , *itSubmeshes.first , itSubmeshes.first->getInstantiation() , itSubmeshes.second ); } } count++; } }