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

Method InitializeInstanceBuffer

trinity/Eve/Turret/EveTurretSet.cpp:326–342  ·  view source on GitHub ↗

-------------------------------------------------------------------------------- Description: Create a vertex buffer, which acts as a instance buffer for the instanced rendering we use for turrets. Fill it just with an index for each instance. An instance is basiclly a single turret of this set. --------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

324// An instance is basiclly a single turret of this set.
325// --------------------------------------------------------------------------------
326void EveTurretSet::InitializeInstanceBuffer()
327{
328 // release old and create new and fill it with 1, 2, 3, 4, ...
329 float pBufferData[EVE_MAX_TURRETS_PER_SET];
330 for( unsigned int i = 0; i < EVE_MAX_TURRETS_PER_SET; ++i )
331 {
332 pBufferData[i] = (float)i;
333 }
334 USE_MAIN_THREAD_RENDER_CONTEXT();
335
336 CR_RETURN( g_sharedBuffer.Allocate(
337 sizeof( float ),
338 EVE_MAX_TURRETS_PER_SET,
339 pBufferData,
340 renderContext,
341 m_instanceBuffer ) );
342}
343
344// --------------------------------------------------------------------------------
345// Description:

Callers

nothing calls this directly

Calls 1

AllocateMethod · 0.45

Tested by

no test coverage detected