Loading...
Searching...
No Matches
Ogre::VertexBufferBinding Class Reference
Core » RenderSystem

Records the state of all the vertex buffer bindings required to provide a vertex declaration with the input data it needs for the vertex elements. More...

`#include <OgreHardwareVertexBuffer.h>`

Inheritance diagram for Ogre::VertexBufferBinding:
[legend]

## Public Types

typedef std::map< ushort, ushort > | BindingIndexMap
typedef std::map< unsigned short, HardwareVertexBufferSharedPtr > | VertexBufferBindingMap
| Defines the vertex buffer bindings used as source for vertex declarations.

## Public Member Functions

| VertexBufferBinding ()
| Constructor, should not be called direct, use HardwareBufferManager::createVertexBufferBinding.
| ~VertexBufferBinding ()
void | closeGaps (BindingIndexMap &bindingIndexMap)
| Remove any gaps in the bindings.
const VertexBufferBindingMap & | getBindings (void) const
| Gets a read-only version of the buffer bindings.
const HardwareVertexBufferSharedPtr & | getBuffer (unsigned short index) const
| Gets the buffer bound to the given source index.
size_t | getBufferCount (void) const
unsigned short | getLastBoundIndex (void) const
| Gets the last bound index.
unsigned short | getNextIndex (void) const
| Gets the highest index which has already been set, plus 1.
bool | hasGaps (void) const
| Check whether any gaps in the bindings.
bool | hasInstanceData () const
| Returns true if this binding has an element that contains instance data.
bool | isBufferBound (unsigned short index) const
| Gets whether a buffer is bound to the given source index.
void | setBinding (unsigned short index, const HardwareVertexBufferSharedPtr &buffer)
| Set a binding, associating a vertex buffer with a given index.
void | unsetAllBindings (void)
| Removes all the bindings.
void | unsetBinding (unsigned short index)
| Removes an existing binding.

## Detailed Description

Records the state of all the vertex buffer bindings required to provide a vertex declaration with the input data it needs for the vertex elements.

Why do we have this binding list rather than just have VertexElement referring to the vertex buffers direct? Well, in the underlying APIs, binding the vertex buffers to an index (or 'stream') is the way that vertex data is linked, so this structure better reflects the realities of that. In addition, by separating the vertex declaration from the list of vertex buffer bindings, it becomes possible to reuse bindings between declarations and vice versa, giving opportunities to reduce the state changes required to perform rendering.

  Like the other classes in this functional area, these binding maps should be created and destroyed using the HardwareBufferManager.

## Member Typedef Documentation

## VertexBufferBindingMap

typedef std::map<unsigned short, HardwareVertexBufferSharedPtr> Ogre::VertexBufferBinding::VertexBufferBindingMap

Defines the vertex buffer bindings used as source for vertex declarations.

## BindingIndexMap

typedef std::map<ushort, ushort> Ogre::VertexBufferBinding::BindingIndexMap

## Constructor & Destructor Documentation

## VertexBufferBinding()

Ogre::VertexBufferBinding::VertexBufferBinding | ( |  | ) |

Constructor, should not be called direct, use HardwareBufferManager::createVertexBufferBinding.

## ~VertexBufferBinding()

Ogre::VertexBufferBinding::~VertexBufferBinding | ( |  | ) |

## Member Function Documentation

## setBinding()

void Ogre::VertexBufferBinding::setBinding | ( | unsigned short | index,
|  | const HardwareVertexBufferSharedPtr & | buffer )

Set a binding, associating a vertex buffer with a given index.

If the index is already associated with a vertex buffer, the association will be replaced. This may cause the old buffer to be destroyed if nothing else is referring to it. You should assign bindings from 0 and not leave gaps, although you can bind them in any order.

## unsetBinding()

void Ogre::VertexBufferBinding::unsetBinding | ( | unsigned short | index | ) |

Removes an existing binding.

## unsetAllBindings()

void Ogre::VertexBufferBinding::unsetAllBindings | ( | void |  | ) |

Removes all the bindings.

## getBindings()

const VertexBufferBindingMap & Ogre::VertexBufferBinding::getBindings | ( | void |  | ) | const

Gets a read-only version of the buffer bindings.

## getBuffer()

const HardwareVertexBufferSharedPtr & Ogre::VertexBufferBinding::getBuffer | ( | unsigned short | index | ) | const

Gets the buffer bound to the given source index.

## isBufferBound()

bool Ogre::VertexBufferBinding::isBufferBound | ( | unsigned short | index | ) | const

Gets whether a buffer is bound to the given source index.

## getBufferCount()

size_t Ogre::VertexBufferBinding::getBufferCount | ( | void |  | ) | const

inline

## getNextIndex()

unsigned short Ogre::VertexBufferBinding::getNextIndex | ( | void |  | ) | const

inline

Gets the highest index which has already been set, plus 1.

This is to assist in binding the vertex buffers such that there are not gaps in the list.

## getLastBoundIndex()

unsigned short Ogre::VertexBufferBinding::getLastBoundIndex | ( | void |  | ) | const

Gets the last bound index.

## hasGaps()

bool Ogre::VertexBufferBinding::hasGaps | ( | void |  | ) | const

Check whether any gaps in the bindings.

## closeGaps()

void Ogre::VertexBufferBinding::closeGaps | ( | BindingIndexMap & | bindingIndexMap | ) |

Remove any gaps in the bindings.

This is useful if you've removed vertex buffer from this vertex buffer bindings and want to remove any gaps in the bindings. Note, however, that if this bindings is already being used with a VertexDeclaration, you will need to alter that too. This method is mainly useful when reorganising buffers manually.

Parameters

  bindingIndexMap | To be retrieve the binding index map that used to translation old index to new index; will be cleared by this method before fill-in.

## hasInstanceData()

bool Ogre::VertexBufferBinding::hasInstanceData | ( |  | ) | const

inline

Returns true if this binding has an element that contains instance data.

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

- OgreHardwareVertexBuffer.h