MCPcopy Create free account
hub / github.com/carbonengine/trinity / RenderBatchesForPicking

Method RenderBatchesForPicking

trinity/Tr2RenderContext.cpp:863–925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

861}
862
863void Tr2RenderContextBase::RenderBatchesForPicking( ITriRenderBatchAccumulator* batches, const BlueSharedString& techniqueName )
864{
865 CCP_STATS_ZONE( __FUNCTION__ );
866 D3DPERF_EVENT( L"Tr2EffectStateManager::RenderBatchesForPicking" );
867
868 Tr2RenderContext* primaryContext = reinterpret_cast<Tr2RenderContext*>( this );
869 Tr2RingBuffer::GetInstance<Float4x3>().PrepareBuffer( *primaryContext );
870 Tr2RingBuffer::GetInstance<Tr2MorphTargetAnimationData>().PrepareBuffer( *primaryContext );
871
872
873 Tr2RenderContext* renderContext = reinterpret_cast<Tr2RenderContext*>( this );
874 UseTextures( batches, techniqueName, *renderContext );
875
876 const Tr2PerObjectData* curPerObjectData = nullptr;
877
878 Tr2ConstantBufferAL* perObjectConstantBuffers[CBUFFER_COUNT];
879 for( uint32_t i = 0; i != CBUFFER_COUNT; ++i )
880 {
881 perObjectConstantBuffers[i] = &m_perObjectConstantBuffers[i];
882 }
883
884 for( auto& batch : batches->GetBatches() )
885 {
886 uint32_t technique;
887 if( !batch.m_shader->GetTechniqueIndex( techniqueName, technique ) )
888 {
889 continue;
890 }
891
892 if( batch.m_objectData )
893 {
894 if( batch.m_objectData != curPerObjectData )
895 {
896 D3DPERF_EVENT( L"Set per-object data to device" );
897 batch.m_objectData->SetPerObjectDataToDevice( perObjectConstantBuffers, batch.m_shader->GetShaderTypeMask( technique ), *renderContext );
898 curPerObjectData = batch.m_objectData;
899 }
900
901 uint32_t id = batch.m_objectData->GetUserData();
902 if( m_objectIdVariable )
903 {
904 m_objectIdVariable->SetValue( (float)id );
905 }
906
907 uint32_t areaID = batch.m_pickingData;
908 if( m_areaIdVariable )
909 {
910 m_areaIdVariable->SetValue( (float)areaID );
911 }
912 }
913
914 uint32_t passCount = batch.m_shader->GetPassCount( technique );
915 CCP_ASSERT( passCount == 1 );
916
917 batch.m_shader->ApplyAllStateForPass( technique, 0, *renderContext );
918 batch.m_material->ApplyMaterialDataForPass( technique, 0, *renderContext );
919 Tr2GpuProfiler::GetProfiler().Begin( batch.m_material, "", *renderContext );
920 SubmitGeometry( batch, *renderContext );

Callers 3

RenderPickingMethod · 0.80
RenderPickingMethod · 0.80
PerformPickingMethod · 0.80

Calls 14

UseTexturesFunction · 0.85
SubmitGeometryFunction · 0.85
PrepareBufferMethod · 0.80
GetTechniqueIndexMethod · 0.80
GetShaderTypeMaskMethod · 0.80
GetUserDataMethod · 0.80
GetPassCountMethod · 0.80
ApplyAllStateForPassMethod · 0.80
GetBatchesMethod · 0.45
SetValueMethod · 0.45

Tested by

no test coverage detected