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

A type of Buffer that is used for specifying indexed geometric primitives. More...

#include <omGraphicsIndexBuffer.h>

Inheritance diagram for om::graphics::buffers::IndexBuffer:
om::graphics::buffers::Buffer om::graphics::devices::GraphicsContextObject

Public Member Functions

 IndexBuffer ()
 Create an empty index buffer with undefined data type and zero capacity. More...
 
 IndexBuffer (const ScalarType &newType)
 Create an empty index buffer with the specified data type and zero capacity. More...
 
 IndexBuffer (const ScalarType &newType, Size capacity)
 Create an empty index buffer containing the specified data type and with the specified capacity. More...
 
 IndexBuffer (const AttributeType &newType, Size capacity)
 Create an empty index buffer containing the specified data type and with the specified capacity. More...
 
 IndexBuffer (devices::GraphicsContext *context, const BufferUsage &usage=BufferUsage::STATIC)
 Create an empty GPU-only index buffer with the specified context and buffer type. More...
 
 IndexBuffer (devices::GraphicsContext *context, const ScalarType &newType, const BufferUsage &usage=BufferUsage::STATIC)
 Create an empty GPU-only index buffer with the specified context, buffer type, and attribute type. More...
 
 IndexBuffer (devices::GraphicsContext *context, const ScalarType &newType, Size capacity, const BufferUsage &usage=BufferUsage::STATIC)
 Create a GPU-only index buffer with the specified context, buffer type, attribute type, and capacity. More...
 
- Public Member Functions inherited from om::graphics::buffers::Buffer
 Buffer ()
 Create an empty vertex buffer with undefined data type and zero capacity. More...
 
 Buffer (const AttributeType &newType)
 Create an empty vertex buffer with the specified data type and zero capacity. More...
 
 Buffer (const AttributeType &newType, Size capacity)
 Create an empty vertex buffer containing the specified data type and with the specified capacity. More...
 
 Buffer (const BufferType &bufferType)
 Create an empty buffer of the given type with undefined data type and zero capacity. More...
 
 Buffer (const BufferType &bufferType, const AttributeType &newType)
 Create an empty buffer of the given type with the specified data type and zero capacity. More...
 
 Buffer (const BufferType &bufferType, const AttributeType &newType, Size capacity)
 Create an empty buffer of the given type containing the specified data type and with the specified capacity. More...
 
 Buffer (devices::GraphicsContext *context, const BufferType &bufferType, const BufferUsage &usage=BufferUsage::STATIC)
 Create an empty GPU-only buffer with the specified context and buffer type. More...
 
 Buffer (devices::GraphicsContext *context, const BufferType &bufferType, const AttributeType &newType, const BufferUsage &usage=BufferUsage::STATIC)
 Create an empty GPU-only buffer with the specified context, buffer type, and attribute type. More...
 
 Buffer (devices::GraphicsContext *context, const BufferType &bufferType, const AttributeType &newType, Size capacity, const BufferUsage &usage=BufferUsage::STATIC)
 Create a GPU-only buffer with the specified context, buffer type, attribute type, and capacity. More...
 
 Buffer (const Buffer &other)
 Create a copy of another buffer. More...
 
 ~Buffer ()
 Destroy a buffer and release its internal resources. More...
 
Bufferoperator= (const Buffer &other)
 Copy the contents and state of one buffer to this one. More...
 
const BufferUsagegetUsage () const
 Return the current expected usage pattern for this hardware buffer. More...
 
void setUsage (const BufferUsage &newUsage)
 Set the current expected usage pattern for this hardware buffer. More...
 
Size getSizeInBytes () const
 Return the size in bytes of the attributes stored in the buffer. More...
 
Size getSize () const
 Return the number of valid attributes stored in the buffer. More...
 
Bool setSize (Size newSize)
 Set the number of valid attributes there are in this buffer. More...
 
Size getCapacity () const
 Return the total number of elements of this buffer's current attribute type that it can hold. More...
 
Bool setCapacity (Size newCapacity)
 Set the number of elements of this buffer's current attribute type that this buffer is able to hold. More...
 
Size getCapacityInBytes () const
 Return the capacity of the buffer in bytes. More...
 
Bool setCapacityInBytes (Size newCapacityInBytes)
 Set the number of bytes that this buffer is able to hold. More...
 
const AttributeTypegetAttributeType () const
 Return the type of elements that this buffer can hold. More...
 
virtual Bool setAttributeType (const AttributeType &newAttributeType)
 Set the type of elements that this buffer can hold. More...
 
void * getPointer ()
 Return a pointer to the start of the internal buffer of attributes, or NULL if it is not allocated. More...
 
const void * getPointer () const
 Return a const pointer to the start of the internal buffer of attributes, or NULL if it is not allocated. More...
 
Size getStride () const
 Return the number of bytes between successive elements in the buffer. More...
 
Bool hasData () const
 Return whether or not this buffer has data. More...
 
Bool getAttributes (void *attributes, Size &numAttributes) const
 Read the specified number of attributes from the buffer into the specified output pointer. More...
 
Bool setAttributes (const void *attributes, const AttributeType &attributeType, Size numAttributes)
 Replace the contents of this hardware buffer with the specified attributes. More...
 
Bool updateAttributes (const void *attributes, const AttributeType &attributeType, Size numAttributes, Index startIndex=0)
 Update a region of this hardware buffer with the specified attributes. More...
 
template<typename T >
get (Index index) const
 Return the attribute stored at the specified index in this buffer. More...
 
Bool getAttribute (Index index, AttributeValue &value) const
 Get the attribute stored at the specified index in this buffer. More...
 
template<typename T >
void set (Index index, const T &element)
 Set the attribute stored at the specified index in this buffer. More...
 
Bool setAttribute (Index index, const AttributeValue &value) const
 Set the attribute stored at the specified index in this buffer. More...
 
Bool addAttribute (const AttributeValue &newAttribute)
 Add the specified attribute to the end of the buffer. More...
 
template<typename T >
Bool add (const T &newAttribute)
 Add the specified attribute to the end of the buffer. More...
 
template<typename T >
Bool add (const T *newAttributes, Size number)
 Add the specified number of attributes from the given array to the buffer's end. More...
 
Bool remove (Index index)
 Remove the element at the specified index in this buffer. More...
 
Bool removeUnordered (Index index)
 Remove the element at the specified index in this buffer. More...
 
void clear ()
 Clear all entries and the associated attribute type type from the buffer. More...
 
Bool reallocate ()
 Reallocate this buffer's data store using its current capacity. More...
 
Bool reallocate (BufferUsage newUsage)
 Reallocate this buffer's data store using its current capacity, changing its usage type. More...
 
void * map (BufferAccessType accessType)
 Map this buffer's data store to the main memory address space and return a pointer to it. More...
 
void * mapRange (BufferAccessType accessType, Index attributeOffset, Size numAttributes)
 Map this buffer's data store to the main memory address space and return a pointer to it. More...
 
void unmap () const
 Unmap this buffer's data store to the main memory address space. More...
 
Bool isMapped () const
 Return whether or not this buffer is currently mapped to main memory. More...
 
virtual void setContext (devices::GraphicsContext *newContext)
 Set a pointer to the graphics context this buffer should use to do rendering. More...
 
virtual void upload (UploadRequest &request)
 Upload this buffer's CPU representation to the GPU device. More...
 
virtual void download (DownloadRequest &request)
 Download the buffer's GPU representation to CPU memory. More...
 
virtual Bool isUploaded () const
 Return whether or not this buffer has been successfully created and uploaded to the device. More...
 
virtual Bool isDownloaded () const
 Return whether or not this buffer has a copy of its data stored in CPU-side memory. More...
 
virtual Bool isValid () const
 Return whether or not the state of this buffer is valid (either on CPU or GPU) and able to be used for rendering. More...
 
const DeviceBuffergetRenderable () const
 Return a pointer to the context-renderable buffer for this buffer, or NULL if there is none. 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...
 

Static Public Attributes

static const ResourceType RESOURCE_TYPE
 The resource type for an index buffer. 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 type of Buffer that is used for specifying indexed geometric primitives.

An IndexBuffer allows the user to specify the type of primitive specified (default, triangles), as well as the way in which the buffer will be used (default, static).

Constructor & Destructor Documentation

om::graphics::buffers::IndexBuffer::IndexBuffer ( )
inline

Create an empty index buffer with undefined data type and zero capacity.

om::graphics::buffers::IndexBuffer::IndexBuffer ( const ScalarType newType)
inline

Create an empty index buffer with the specified data type and zero capacity.

om::graphics::buffers::IndexBuffer::IndexBuffer ( const ScalarType newType,
Size  capacity 
)
inline

Create an empty index buffer containing the specified data type and with the specified capacity.

om::graphics::buffers::IndexBuffer::IndexBuffer ( const AttributeType newType,
Size  capacity 
)
inline

Create an empty index buffer containing the specified data type and with the specified capacity.

om::graphics::buffers::IndexBuffer::IndexBuffer ( devices::GraphicsContext context,
const BufferUsage usage = BufferUsage::STATIC 
)
inline

Create an empty GPU-only index buffer with the specified context and buffer type.

om::graphics::buffers::IndexBuffer::IndexBuffer ( devices::GraphicsContext context,
const ScalarType newType,
const BufferUsage usage = BufferUsage::STATIC 
)
inline

Create an empty GPU-only index buffer with the specified context, buffer type, and attribute type.

om::graphics::buffers::IndexBuffer::IndexBuffer ( devices::GraphicsContext context,
const ScalarType newType,
Size  capacity,
const BufferUsage usage = BufferUsage::STATIC 
)
inline

Create a GPU-only index buffer with the specified context, buffer type, attribute type, and capacity.

Member Data Documentation

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

The resource type for an index buffer.


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