igor::iInstancingBuffer Class Reference

#include <iInstancingBuffer.h>

Public Member Functions

void addInstance (uint32 size, const void *data)
 
void setSizeHint (uint32 maxInstanceSizeHint)
 
void finalizeData ()
 
void clear ()
 
void bind ()
 
uint32 getInstanceCount () const
 
iVertexBufferPtr getVertexBuffer () const
 

Static Public Member Functions

static iInstancingBufferPtr create (const iBufferLayout &layout, uint32 maxInstanceSizeHint=100)
 

Friends

class iInstancingBufferDeleter
 

Detailed Description

instancing buffer is a convenience wrapper arround a vertex buffer to help with instancing

Member Function Documentation

◆ addInstance()

void igor::iInstancingBuffer::addInstance ( uint32  size,
const void *  data 
)

adds instance data. This can be the data of just one instance or many.

Will reallocate memory if amount of instances exceeds size hint.

Parameters
sizethe size of the data in bytes. Must be multiple of the layout size (or stride)
datathe data to add

◆ bind()

void igor::iInstancingBuffer::bind ( )

bind instacing buffer

◆ clear()

void igor::iInstancingBuffer::clear ( )

clear the instancing data

◆ create()

iInstancingBufferPtr igor::iInstancingBuffer::create ( const iBufferLayout layout,
uint32  maxInstanceSizeHint = 100 
)
static
Returns
a newly created vertex buffer
Parameters
layoutthe layout of data used for instancing
maxInstanceSizeHinta hint for the maximum amout of instances

Adding more instances then specified with maxInstanceSizeHint will lead to reallocating memory and doubling the buffer size.

◆ finalizeData()

void igor::iInstancingBuffer::finalizeData ( )

sets data on vertex buffer

◆ getInstanceCount()

uint32 igor::iInstancingBuffer::getInstanceCount ( ) const
Returns
instance count

◆ getVertexBuffer()

iVertexBufferPtr igor::iInstancingBuffer::getVertexBuffer ( ) const
Returns
vertex buffer

◆ setSizeHint()

void igor::iInstancingBuffer::setSizeHint ( uint32  maxInstanceSizeHint)

sets a new size hint.

If new size hint is smaller then the previous one nothing will change.

Parameters
maxInstanceSizeHinta hint for the maximum amout of instances

Friends And Related Function Documentation

◆ iInstancingBufferDeleter

friend class iInstancingBufferDeleter
friend

The documentation for this class was generated from the following files: