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

Method SetLayout

trinity/Tr2RuntimeInstanceData.cpp:359–376  ·  view source on GitHub ↗

-------------------------------------------------------------------------------------- Description: Sets vertex layout for instance data. This invalidates all data. Arguments: layout - new vertex layout --------------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

357// layout - new vertex layout
358// --------------------------------------------------------------------------------------
359void Tr2RuntimeInstanceData::SetLayout( const Tr2VertexDefinition& layout )
360{
361 m_data.reset();
362 g_sharedBuffer.Free( m_vb );
363 m_stride = 0;
364 m_count = 0;
365 for( auto it = layout.m_items.begin(); it != layout.m_items.end(); ++it )
366 {
367 if( it->m_stream != 0 )
368 {
369 CCP_LOGERR( "Tr2PythonInstanceData: vertex layout needs to reference stream 0 only" );
370 return;
371 }
372 m_stride = std::max( m_stride, it->m_offset + layout.GetDataTypeSizeInBytes( it->m_dataType ) );
373 }
374 m_layout = layout;
375 m_vertexDeclaration = Tr2EffectStateManager::GetVertexDeclarationHandle( m_layout );
376}
377
378// --------------------------------------------------------------------------------------
379// Description:

Callers

nothing calls this directly

Calls 6

resetMethod · 0.80
FreeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected