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

Method GetBatchesImpl

trinity/Tr2LineSet.cpp:140–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140void Tr2LineSet::GetBatchesImpl( ITriRenderBatchAccumulator* accumulator, const Tr2PerObjectData* perObjectData, Tr2Material* effect, GetBatchesReason reason )
141{
142 if( !m_vertexBuffer.IsValid() )
143 {
144 return;
145 }
146
147 if( ( m_currentSubmittedTriangleCount > 0 ) && reason == GetBatchesReason::Picking )
148 {
149 if( m_pickingVertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
150 {
151 return;
152 }
153
154 Tr2RenderBatch batch;
155 batch.SetMaterial( effect );
156 batch.SetPerObjectData( perObjectData );
157 batch.SetVertexDeclaration( m_pickingVertexDeclHandle );
158 batch.SetStreamSource( 0, m_pickingVertexBuffer, sizeof( Triangle ) / 3 );
159 batch.SetDrawInstanced( m_currentSubmittedTriangleCount * 3, 1, 0, 0 );
160 accumulator->Commit( batch );
161 }
162 else
163 {
164 if( m_vertexDeclHandle == Tr2EffectStateManager::UNINITIALIZED_DECLARATION )
165 {
166 return;
167 }
168
169 Tr2RenderBatch batch;
170 batch.SetMaterial( effect );
171 batch.SetPerObjectData( perObjectData );
172 batch.SetTopology( TOP_LINES );
173 batch.SetVertexDeclaration( m_vertexDeclHandle );
174 batch.SetStreamSource( 0, m_vertexBuffer, sizeof( LineData ) / 2 );
175 batch.SetDrawInstanced( m_currentSubmittedLineCount * 2, 1, 0, 0 );
176 accumulator->Commit( batch );
177 }
178}
179
180void Tr2LineSet::AddLine( const Vector3& position1, const Vector4& color1, const Vector3& position2, const Vector4& color2 )
181{

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected