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

Method GetBatchesImpl

trinity/Tr2GrannyPrimitiveSet.cpp:135–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135void Tr2GrannyPrimitiveSet::GetBatchesImpl( ITriRenderBatchAccumulator* accumulator, const Tr2PerObjectData* perObjectData, Tr2Material* effect, GetBatchesReason reason )
136{
137 if( !m_vertexBuffer.IsValid() )
138 {
139 return;
140 }
141
142 if( m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
143 {
144 return;
145 }
146
147 Tr2RenderBatch batch;
148 batch.SetMaterial( effect );
149 batch.SetPerObjectData( perObjectData );
150 batch.SetVertexDeclaration( m_vertexDeclHandle );
151 batch.SetStreamSource( 0, m_vertexBuffer, sizeof( TriangleVertex ) );
152 if( m_renderSolid || reason == GetBatchesReason::Picking )
153 {
154 batch.SetInidices( m_triangleIndexBuffer, m_triangleIndexBuffer.GetDesc().stride );
155 if( reason == GetBatchesReason::Picking && ( m_pickingPrimitiveCount > 0 ) )
156 {
157 batch.SetDrawIndexedInstanced( m_pickingPrimitiveCount * 3, 1, m_pickingIndexOffset, 0, 0 );
158 }
159 else
160 {
161 batch.SetDrawIndexedInstanced( ( m_primitiveCount - m_pickingPrimitiveCount ) * 3, 1, 0, 0, 0 );
162 }
163 }
164 else
165 {
166 batch.SetInidices( m_lineIndexBuffer, m_lineIndexBuffer.GetDesc().stride );
167 batch.SetTopology( TOP_LINES );
168 batch.SetDrawIndexedInstanced( ( m_primitiveCount - m_pickingPrimitiveCount ) * 6, 1, 0, 0, 0 );
169 }
170 accumulator->Commit( batch );
171}
172
173
174bool Tr2GrannyPrimitiveSet::OnModified( Be::Var* value )

Callers

nothing calls this directly

Calls 9

SetVertexDeclarationMethod · 0.80
SetInidicesMethod · 0.80
IsValidMethod · 0.45
SetMaterialMethod · 0.45
SetPerObjectDataMethod · 0.45
SetStreamSourceMethod · 0.45
SetTopologyMethod · 0.45
CommitMethod · 0.45

Tested by

no test coverage detected