Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Ogre::VertexBufferBinding Class Reference

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>

List of all members.

Public Types

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.

virtual ~VertexBufferBinding ()
virtual void setBinding (unsigned short index, HardwareVertexBufferSharedPtr buffer)
 Set a binding, associating a vertex buffer with a given index.

virtual void unsetBinding (unsigned short index)
 Removes an existing binding.

virtual void unsetAllBindings (void)
 Removes all the bindings.

virtual const VertexBufferBindingMapgetBindings (void) const
 Gets a read-only version of the buffer bindings.

virtual HardwareVertexBufferSharedPtr getBuffer (unsigned short index)
 Gets the buffer bound to the given source index.

virtual size_t getBufferCount (void) const
virtual unsigned short getNextIndex (void) const
 Gets the highest index which has already been set, plus 1.


Protected Attributes

VertexBufferBindingMap mBindingMap
unsigned short mHighIndex


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.

Definition at line 429 of file OgreHardwareVertexBuffer.h.


Member Typedef Documentation

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

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

Definition at line 433 of file OgreHardwareVertexBuffer.h.


Constructor & Destructor Documentation

Ogre::VertexBufferBinding::VertexBufferBinding  ) 
 

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

virtual Ogre::VertexBufferBinding::~VertexBufferBinding  )  [virtual]
 


Member Function Documentation

virtual const VertexBufferBindingMap& Ogre::VertexBufferBinding::getBindings void   )  const [virtual]
 

Gets a read-only version of the buffer bindings.

virtual HardwareVertexBufferSharedPtr Ogre::VertexBufferBinding::getBuffer unsigned short  index  )  [virtual]
 

Gets the buffer bound to the given source index.

virtual size_t Ogre::VertexBufferBinding::getBufferCount void   )  const [virtual]
 

Definition at line 462 of file OgreHardwareVertexBuffer.h.

virtual unsigned short Ogre::VertexBufferBinding::getNextIndex void   )  const [virtual]
 

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.

Definition at line 469 of file OgreHardwareVertexBuffer.h.

virtual void Ogre::VertexBufferBinding::setBinding unsigned short  index,
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.

virtual void Ogre::VertexBufferBinding::unsetAllBindings void   )  [virtual]
 

Removes all the bindings.

virtual void Ogre::VertexBufferBinding::unsetBinding unsigned short  index  )  [virtual]
 

Removes an existing binding.


Member Data Documentation

VertexBufferBindingMap Ogre::VertexBufferBinding::mBindingMap [protected]
 

Definition at line 435 of file OgreHardwareVertexBuffer.h.

unsigned short Ogre::VertexBufferBinding::mHighIndex [mutable, protected]
 

Definition at line 436 of file OgreHardwareVertexBuffer.h.


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

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 13:00:45 2006