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

Method GetBatchImpl

trinity/Tr2CurveLineSet.cpp:1103–1127  ·  view source on GitHub ↗

------------------------------------------------------------- Description: Creates render batches for line set. Arguments: batches - Render batch accumulator batchType - Type of batches to gather data - Per-object data -------------------------------------------------------------

Source from the content-addressed store, hash-verified

1101// data - Per-object data
1102// -------------------------------------------------------------
1103void Tr2CurveLineSet::GetBatchImpl( ITriRenderBatchAccumulator* accumulator, const Tr2PerObjectData* perObjectData, Tr2Material* effect )
1104{
1105 if( !effect || !m_vertexBuffer.IsValid() || m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
1106 {
1107 return;
1108 }
1109
1110 Tr2RenderBatch batch;
1111 batch.SetMaterial( effect );
1112 batch.SetPerObjectData( perObjectData );
1113
1114 float maxDepth = Tr2Renderer::GetFrustumRadius();
1115
1116 Vector3 center( m_boundingSphere.x, m_boundingSphere.y, m_boundingSphere.z );
1117 center -= Tr2Renderer::GetViewPosition();
1118 float z = std::min( std::max( ( Length( center ) + m_depthOffset ) / maxDepth, 0.f ), 1.f );
1119
1120 unsigned int depth = (unsigned int)( (float)0xFFFFFFF * ( 1.0f - z ) );
1121 batch.m_depth = depth;
1122
1123 batch.SetVertexDeclaration( m_vertexDeclHandle );
1124 batch.SetStreamSource( 0, m_vertexBuffer, sizeof( LineVertex ) );
1125 batch.SetDrawInstanced( 6 * m_currentSubmittedLineCount, 1, 0, 0 );
1126 accumulator->Commit( batch );
1127}
1128
1129// ------------------------------------------------------------------------------------------------------
1130// Description:

Callers

nothing calls this directly

Calls 9

GetViewPositionFunction · 0.85
LengthFunction · 0.85
SetVertexDeclarationMethod · 0.80
SetDrawInstancedMethod · 0.80
IsValidMethod · 0.45
SetMaterialMethod · 0.45
SetPerObjectDataMethod · 0.45
SetStreamSourceMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected