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

Method CollectAreaBlocksWithSharedMaterials

trinity/Tr2MeshBase.cpp:527–559  ·  view source on GitHub ↗

------------------------------------------------------------- Description: Put the very basic info of a mesharea (block) into a class that contains the list of areas and a pointer to a material -------------------------------------------------------------

Source from the content-addressed store, hash-verified

525// Put the very basic info of a mesharea (block) into a class that contains the list of areas and a pointer to a material
526// -------------------------------------------------------------
527void Tr2MeshBase::CollectAreaBlocksWithSharedMaterials( std::vector<TriRenderBatchAreaBlocksWithSharedMaterial>& collectors, TriBatchType areaType ) const
528{
529 const Tr2MeshAreaVector* areas = GetAreas( areaType );
530 for( auto a = areas->begin(); a != areas->end(); ++a )
531 {
532 if( areaType == TRIBATCHTYPE_OPAQUE && !( *a )->IsCastingShadows() )
533 {
534 continue;
535 }
536 if( areaType == TRIBATCHTYPE_DECAL && !( *a )->IsCastingShadows() )
537 {
538 continue;
539 }
540
541 uint32_t i = 0;
542 for( ; i < collectors.size(); i++ )
543 {
544 if( collectors[i].m_shaderMaterial->GetHashValue() == ( *a )->GetMaterialInterface()->GetHashValue() )
545 {
546 break;
547 }
548 }
549 if( i == collectors.size() )
550 {
551 auto entry = TriRenderBatchAreaBlocksWithSharedMaterial();
552 entry.m_shaderMaterial = ( *a )->GetMaterialInterface();
553 collectors.push_back( entry );
554 }
555
556 TriRenderBatchAreaBlock ab( ( *a )->GetIndex(), ( *a )->GetCount() );
557 collectors[i].m_areaBlockVector.push_back( ab );
558 }
559}
560
561void Tr2MeshBase::SetShaderOption( const BlueSharedString& name, const BlueSharedString& value )
562{

Callers 1

RebuildCachedDataMethod · 0.80

Calls 9

IsCastingShadowsMethod · 0.80
sizeMethod · 0.80
GetMaterialInterfaceMethod · 0.80
GetIndexMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetHashValueMethod · 0.45
GetCountMethod · 0.45

Tested by

no test coverage detected