OGRE-Next: Ogre::v1::VertexBufferBinding Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::v1::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::v1::VertexBufferBinding:
[legend]

## Public Types
typedef map< ushort, ushort >::type | BindingIndexMap
typedef map< unsignedshort, HardwareVertexBufferSharedPtr >::type | 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.
virtual | ~VertexBufferBinding ()
virtual void | closeGaps (BindingIndexMap &bindingIndexMap)
| Remove any gaps in the bindings.
virtual const VertexBufferBindingMap & | getBindings () const
| Gets a read-only version of the buffer bindings.
virtual const HardwareVertexBufferSharedPtr & | getBuffer (unsigned short index) const
| Gets the buffer bound to the given source index.
virtual size_t | getBufferCount () const
virtual bool | getHasInstanceData () const
| Returns true if this binding has an element that contains instance data.
virtual unsigned short | getLastBoundIndex () const
| Gets the last bound index.
virtual unsigned short | getNextIndex () const
| Gets the highest index which has already been set, plus 1.
virtual bool | hasGaps () const
| Check whether any gaps in the bindings.
virtual bool | isBufferBound (unsigned short index) const
| Gets whether a buffer is bound to the given source index.
virtual void | setBinding (unsigned short index, const HardwareVertexBufferSharedPtr &buffer)
| Set a binding, associating a vertex buffer with a given index.
virtual void | unsetAllBindings ()
| Removes all the bindings.
virtual 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.

Remarks
  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

## ◆ BindingIndexMap

typedef map<ushort,ushort>::type Ogre::v1::VertexBufferBinding::BindingIndexMap

## ◆ VertexBufferBindingMap

typedef map<unsignedshort,HardwareVertexBufferSharedPtr>::type Ogre::v1::VertexBufferBinding::VertexBufferBindingMap

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

## Constructor & Destructor Documentation

## ◆ VertexBufferBinding()

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

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

## ◆ ~VertexBufferBinding()

virtual Ogre::v1::VertexBufferBinding::~VertexBufferBinding | ( |  | ) |
| virtual

## Member Function Documentation

## ◆ closeGaps()

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

Remove any gaps in the bindings.

Remarks
  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.

## ◆ getBindings()

virtual const VertexBufferBindingMap & Ogre::v1::VertexBufferBinding::getBindings | ( |  | ) | const
| virtual

Gets a read-only version of the buffer bindings.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

## ◆ getBuffer()

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

Gets the buffer bound to the given source index.

## ◆ getBufferCount()

virtual size_t Ogre::v1::VertexBufferBinding::getBufferCount | ( |  | ) | const
| inlinevirtual

## ◆ getHasInstanceData()

virtual bool Ogre::v1::VertexBufferBinding::getHasInstanceData | ( |  | ) | const
| virtual

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

## ◆ getLastBoundIndex()

virtual unsigned short Ogre::v1::VertexBufferBinding::getLastBoundIndex | ( |  | ) | const
| virtual

Gets the last bound index.

## ◆ getNextIndex()

virtual unsigned short Ogre::v1::VertexBufferBinding::getNextIndex | ( |  | ) | const
| inlinevirtual

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

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

## ◆ hasGaps()

virtual bool Ogre::v1::VertexBufferBinding::hasGaps | ( |  | ) | const
| virtual

Check whether any gaps in the bindings.

## ◆ isBufferBound()

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

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

## ◆ setBinding()

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

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

Remarks
  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.

Referenced by Ogre::VerticesRemapInfo::performVertexDataRemap().

## ◆ unsetAllBindings()

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

Removes all the bindings.

## ◆ unsetBinding()

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

Removes an existing binding.

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

- OgreHardwareVertexBuffer.h