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

Method SetupShaders

trinity/Eve/SpaceObjectFactory/EveSOF.cpp:2131–2156  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: helper method to fill shaders of a mesh --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

2129// helper method to fill shaders of a mesh
2130// --------------------------------------------------------------------------------
2131void EveSOF::SetupShaders( const EveSOFDNAPtr dna, Tr2MeshBase* mesh ) const
2132{
2133 if( mesh == nullptr )
2134 {
2135 return;
2136 }
2137 // multi-hull! so mesh index must be tracked
2138 size_t meshIndexOffset = 0;
2139 // cycle over all hulls in the multi-hull list
2140 for( size_t hullIdx = 0; hullIdx < dna->GetMultiHullCount(); ++hullIdx )
2141 {
2142 size_t cntr = 0;
2143 cntr += FillMeshAreaVector( mesh->GetAreas( TRIBATCHTYPE_OPAQUE ), TRIBATCHTYPE_OPAQUE, dna, hullIdx, meshIndexOffset );
2144 cntr += FillMeshAreaVector( mesh->GetAreas( TRIBATCHTYPE_OPAQUE ), TRIBATCHTYPE_DECAL, dna, hullIdx, meshIndexOffset );
2145 cntr += FillMeshAreaVector( mesh->GetAreas( TRIBATCHTYPE_TRANSPARENT ), TRIBATCHTYPE_TRANSPARENT, dna, hullIdx, meshIndexOffset );
2146 cntr += FillMeshAreaVector( mesh->GetAreas( TRIBATCHTYPE_ADDITIVE ), TRIBATCHTYPE_ADDITIVE, dna, hullIdx, meshIndexOffset );
2147 cntr += FillMeshAreaVector( mesh->GetAreas( TRIBATCHTYPE_DISTORTION ), TRIBATCHTYPE_DISTORTION, dna, hullIdx, meshIndexOffset );
2148
2149 auto distortionAreas = mesh->GetAreas( TRIBATCHTYPE_DISTORTION );
2150 for( auto ait = begin( *distortionAreas ); ait != end( *distortionAreas ); ++ait )
2151 {
2152 ( *ait )->SetMinLod( TR2_LOD_HIGH );
2153 }
2154 meshIndexOffset += cntr;
2155 }
2156}
2157
2158// --------------------------------------------------------------------------------
2159// Description:

Callers

nothing calls this directly

Calls 5

GetMultiHullCountMethod · 0.80
GetAreasMethod · 0.80
SetMinLodMethod · 0.80
beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected