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

Method GetBatches

trinity/Interior/Tr2InteriorPlaceable.cpp:291–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

289}
290
291void Tr2InteriorPlaceable::GetBatches( ITriRenderBatchAccumulator* batches,
292 TriBatchType batchType,
293 const Tr2PerObjectData* data,
294 Tr2RenderReason reason )
295{
296 if( !m_display )
297 {
298 return;
299 }
300
301 float maxDepth = Tr2Renderer::GetFrustumRadius();
302 Matrix instanceToWorld = m_transform;
303
304 if( m_placeableRes )
305 {
306 // Get the model from the res
307 Tr2Model* model = m_placeableRes->GetVisualModel();
308 if( model )
309 {
310 unsigned int numMeshes = model->GetNumOfMeshes();
311
312 for( unsigned int i = 0; i < numMeshes; ++i )
313 {
314 Tr2Mesh* mesh = model->GetMesh( i );
315
316 // Only gather transparent batches if the mesh isn't hidden
317 if( !mesh->GetDisplay() )
318 {
319 continue;
320 }
321 auto geometry = mesh->GetGeometryResource();
322 if( !geometry || !geometry->IsGood() )
323 {
324 continue;
325 }
326 auto lod = geometry->GetMeshLod( mesh->GetMeshIndex(), 0 );
327 if( !lod || !lod->m_allocationsValid )
328 {
329 continue;
330 }
331
332 // Get the transparent areas
333 Tr2MeshAreaVector* areas = mesh->GetAreas( batchType );
334
335 if( areas )
336 {
337 // Loop over the transparent areas
338 for( auto& area : *areas )
339 {
340 auto shader = area->GetMaterialInterface();
341
342 // If the area isn't hidden & has an effect
343 if( !area->GetDisplay() || !shader )
344 {
345 continue;
346 }
347
348 unsigned int depth = 0;

Callers

nothing calls this directly

Calls 15

GetViewPositionFunction · 0.85
LengthFunction · 0.85
CreateGeometryBatchFunction · 0.85
GetNumOfMeshesMethod · 0.80
GetGeometryResourceMethod · 0.80
GetMeshIndexMethod · 0.80
GetAreasMethod · 0.80
GetMaterialInterfaceMethod · 0.80
GetIndexMethod · 0.80
GetMeshMethod · 0.45
GetDisplayMethod · 0.45
IsGoodMethod · 0.45

Tested by

no test coverage detected