Om  1.0.0
A universal framework for multimedia simulation
Classes | Public Member Functions | Static Public Attributes | List of all members
om::graphics::buffers::VertexBufferSet Class Reference

A class that encapsulates a set of vertex buffers associated with VertexUsage types. More...

#include <omGraphicsVertexBufferSet.h>

Inheritance diagram for om::graphics::buffers::VertexBufferSet:
om::graphics::devices::GraphicsContextObject

Public Member Functions

 VertexBufferSet ()
 Create a new empty vertex buffer set. More...
 
Size getBufferCount () const
 Return the number of vertex buffers in this vertex buffer set. More...
 
VertexBuffergetBuffer (Index bufferIndex) const
 Return a pointer to the buffer with the specified index in this vertex buffer set. More...
 
Bool setBuffer (Index bufferIndex, VertexBuffer *buffer)
 Set the buffer at the specified index in this vertex buffer set. More...
 
VertexBuffergetBuffer (VertexUsage::Enum usage) const
 Return a pointer to the vertex buffer with the specified usage in this vertex buffer set. More...
 
VertexBuffergetBuffer (const VertexUsage &usage) const
 Return a pointer to the vertex buffer with the specified usage in this vertex buffer set. More...
 
Bool setBuffer (VertexUsage::Enum usage, VertexBuffer *buffer)
 Set the buffer with the specified usage in this vertex buffer set. More...
 
Bool setBuffer (const VertexUsage &usage, VertexBuffer *buffer)
 Set the buffer with the specified usage in this vertex buffer set. More...
 
const VertexUsagegetBufferUsage (Index bufferIndex) const
 Return an object indicating the usage of the buffer with the specified index in this buffer list. More...
 
Bool setBufferUsage (Index bufferIndex, const VertexUsage &newUsage)
 Set the usage of the buffer at the specified index in this vertex buffer set. More...
 
Bool addBuffer (const VertexUsage &newUsage, VertexBuffer *newBuffer)
 Add a vertex buffer with the specified usage to this vertex buffer set. More...
 
Bool removeBuffer (const VertexBuffer *buffer)
 Remove the first buffer with the specified address from this vertex buffer set. More...
 
Bool removeBuffer (const VertexUsage &usage)
 Remove the first buffer with the specified usage from this vertex buffer set. More...
 
void clearBuffers ()
 Clear all vertex buffers from this vertex buffer set. More...
 
Size getMinimumCapacity () const
 Return the smallest capacity of the buffers within this vertex buffer set. More...
 
void setContext (devices::GraphicsContext *context)
 Prepare this vertex buffer set and its buffers for rendering with the specified context. More...
 
virtual void upload (UploadRequest &request)
 Upload this vertex buffer set's CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the vertex buffer set's GPU representation to CPU memory. More...
 
- Public Member Functions inherited from om::graphics::devices::GraphicsContextObject
virtual ~GraphicsContextObject ()
 Destory this graphics context object. More...
 
GraphicsContextgetContext () const
 Return a pointer to the graphics context this context object is using to do rendering. More...
 
void clearContext ()
 Clear the previous context from this object. More...
 
void upload ()
 Upload this resource's CPU representation to the GPU device. More...
 
void download ()
 Upload this resource's CPU representation to the GPU device. More...
 
virtual Bool isUploaded () const
 Return whether or not this graphics resource has been successfully created and uploaded to the device. More...
 
virtual Bool isDownloaded () const
 Return whether or not this graphics resource has a copy of its data stored in CPU-side memory. More...
 
virtual Bool isValid () const
 Return whether or not the state of this graphics resource is valid (either on CPU or GPU) and able to be used for rendering. More...
 

Static Public Attributes

static const ResourceType RESOURCE_TYPE
 The resource type for a vertex buffer set. More...
 

Additional Inherited Members

- Protected Member Functions inherited from om::graphics::devices::GraphicsContextObject
 GraphicsContextObject ()
 Create a new graphics context object that doesn't have an associated graphics context. More...
 
 GraphicsContextObject (GraphicsContext *newContext)
 Create a new graphics context object that uses the specified context for rendering. More...
 
- Protected Attributes inherited from om::graphics::devices::GraphicsContextObject
GraphicsContextcontext
 A pointer to the graphics context this object is using. More...
 

Detailed Description

A class that encapsulates a set of vertex buffers associated with VertexUsage types.

This class allows the user to provide external vertex data to a ShaderPass without having to modify the buffer bindings of the shader pass. This is useful when a shader pass is shared among many objects that may each have different vertex buffers.

At render time, an object's vertex buffer set is used to provide vertex data to the shader pass with which it is being rendered by connecting the VertexUsage of each buffer with shader inputs of the same usage types.

Constructor & Destructor Documentation

om::graphics::buffers::VertexBufferSet::VertexBufferSet ( )

Create a new empty vertex buffer set.

Member Function Documentation

Size om::graphics::buffers::VertexBufferSet::getBufferCount ( ) const
inline

Return the number of vertex buffers in this vertex buffer set.

VertexBuffer* om::graphics::buffers::VertexBufferSet::getBuffer ( Index  bufferIndex) const
inline

Return a pointer to the buffer with the specified index in this vertex buffer set.

Bool om::graphics::buffers::VertexBufferSet::setBuffer ( Index  bufferIndex,
VertexBuffer buffer 
)
inline

Set the buffer at the specified index in this vertex buffer set.

VertexBuffer* om::graphics::buffers::VertexBufferSet::getBuffer ( VertexUsage::Enum  usage) const
inline

Return a pointer to the vertex buffer with the specified usage in this vertex buffer set.

VertexBuffer* om::graphics::buffers::VertexBufferSet::getBuffer ( const VertexUsage usage) const

Return a pointer to the vertex buffer with the specified usage in this vertex buffer set.

Bool om::graphics::buffers::VertexBufferSet::setBuffer ( VertexUsage::Enum  usage,
VertexBuffer buffer 
)
inline

Set the buffer with the specified usage in this vertex buffer set.

Bool om::graphics::buffers::VertexBufferSet::setBuffer ( const VertexUsage usage,
VertexBuffer buffer 
)

Set the buffer with the specified usage in this vertex buffer set.

const VertexUsage& om::graphics::buffers::VertexBufferSet::getBufferUsage ( Index  bufferIndex) const
inline

Return an object indicating the usage of the buffer with the specified index in this buffer list.

Bool om::graphics::buffers::VertexBufferSet::setBufferUsage ( Index  bufferIndex,
const VertexUsage newUsage 
)
inline

Set the usage of the buffer at the specified index in this vertex buffer set.

Bool om::graphics::buffers::VertexBufferSet::addBuffer ( const VertexUsage newUsage,
VertexBuffer newBuffer 
)

Add a vertex buffer with the specified usage to this vertex buffer set.

Bool om::graphics::buffers::VertexBufferSet::removeBuffer ( const VertexBuffer buffer)

Remove the first buffer with the specified address from this vertex buffer set.

The method returns whether or not the buffer was successfully removed.

Bool om::graphics::buffers::VertexBufferSet::removeBuffer ( const VertexUsage usage)

Remove the first buffer with the specified usage from this vertex buffer set.

The method returns whether or not the buffer was successfully removed.

void om::graphics::buffers::VertexBufferSet::clearBuffers ( )

Clear all vertex buffers from this vertex buffer set.

Size om::graphics::buffers::VertexBufferSet::getMinimumCapacity ( ) const

Return the smallest capacity of the buffers within this vertex buffer set.

This value is computed by taking the minimum capacity of all buffers that the buffer list has which have data. If there are no buffers in the list, the method returns 0.

void om::graphics::buffers::VertexBufferSet::setContext ( devices::GraphicsContext context)
virtual

Prepare this vertex buffer set and its buffers for rendering with the specified context.

The method propagates the context to the set's buffers and regenerates any context-specific data for the new context if the upload flag is TRUE. The method returns whether or not the context can be successfully used for rendering this vertex buffer set.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::buffers::VertexBufferSet::upload ( UploadRequest request)
virtual

Upload this vertex buffer set's CPU representation to the GPU device.

Reimplemented from om::graphics::devices::GraphicsContextObject.

virtual void om::graphics::buffers::VertexBufferSet::download ( DownloadRequest request)
virtual

Download the vertex buffer set's GPU representation to CPU memory.

Reimplemented from om::graphics::devices::GraphicsContextObject.

Member Data Documentation

const ResourceType om::graphics::buffers::VertexBufferSet::RESOURCE_TYPE
static

The resource type for a vertex buffer set.


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