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

Method GetBatches

trinity/Tr2QuadRenderer.cpp:297–318  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Adds render batches for each effect with instance data. Arguments: accumulator - batch accumulator batchType - batch rendering mode --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

295// batchType - batch rendering mode
296// --------------------------------------------------------------------------------------
297void Tr2QuadRenderer::GetBatches( TriBatchType batchType, ITriRenderBatchAccumulator* accumulator )
298{
299 if( m_vertexBufferOffset == -1 || !m_quadIB.IsValid() )
300 {
301 return;
302 }
303
304 for( auto& it : m_effects )
305 {
306 auto& record = *it.second;
307 if( record.count && record.batchType == batchType && record.vertexDeclHandle != Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
308 {
309 Tr2RenderBatch batch;
310 batch.SetMaterial( record.effect );
311 batch.SetGeometry( record.vertexDeclHandle, m_quad, 4, m_quadIB, m_quadIB.GetDesc().stride );
312 batch.SetStreamSource( 1, m_vertexBuffer.GetBuffer(), record.instanceSize );
313 batch.SetDrawIndexedInstanced( 6 * record.quadCount, record.count, 0, 0, ( m_vertexBufferOffset + record.bufferOffset ) / record.instanceSize );
314
315 accumulator->Commit( batch );
316 }
317 }
318}
319
320// --------------------------------------------------------------------------------------
321// Description:

Callers

nothing calls this directly

Calls 7

SetGeometryMethod · 0.80
IsValidMethod · 0.45
SetMaterialMethod · 0.45
SetStreamSourceMethod · 0.45
GetBufferMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected