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

Method UpdateBuffer

trinity/Eve/SpaceObject/Children/EveChildLineSet.cpp:304–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304void EveChildLineSet::UpdateBuffer( Tr2RenderContext& renderContext )
305{
306 unsigned points, total = 0;
307 for( auto it = begin( m_lines ); it != end( m_lines ); ++it )
308 {
309 ( *it )->GetPointCount( points );
310 total += points;
311 }
312 m_totalObjectCount = total;
313
314 if( !m_vertexBuffer.IsValid() || m_vertexBuffer.GetDesc().count < m_totalObjectCount )
315 {
316 USE_MAIN_THREAD_RENDER_CONTEXT();
317 m_vertexBuffer.Create(
318 m_stride,
319 uint32_t( m_totalObjectCount ),
320 Tr2GpuUsage::VERTEX_BUFFER,
321 Tr2CpuUsage::WRITE_OFTEN,
322 nullptr,
323 renderContext );
324 }
325
326 uint8_t* data;
327
328 CR_RETURN( m_vertexBuffer.MapForWriting( data, renderContext ) );
329
330 for( auto it = begin( m_lines ); it != end( m_lines ); ++it )
331 {
332 ( *it )->UpdateBuffer( renderContext, data, m_worldTransform, m_stride );
333 }
334
335 m_vertexBuffer.UnmapForWriting( renderContext );
336}
337
338void EveChildLineSet::CreateSpriteVertexDeclaration()
339{

Callers 2

EndCaptureMethod · 0.45

Calls 7

beginFunction · 0.50
endFunction · 0.50
GetPointCountMethod · 0.45
IsValidMethod · 0.45
CreateMethod · 0.45
MapForWritingMethod · 0.45
UnmapForWritingMethod · 0.45

Tested by

no test coverage detected