Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members
Public Member Functions | Protected Member Functions | Protected Attributes
render::MemoryVertexBuffer Class Reference

#include <MemoryVertexBuffer.h>

Inheritance diagram for render::MemoryVertexBuffer:
render::VertexBuffer resource::Buffer

List of all members.

Public Member Functions

void * lock (u32 offset, u32 length, resource::BufferLocking options)
 MemoryVertexBuffer (u32 vertexSize, u32 numVertices, resource::BufferUsage usage)
void readData (u32 offset, u32 length, void *pDest)
void unlock ()
void writeData (u32 offset, u32 length, const void *pSource, bool discardWholeBuffer=false)
virtual ~MemoryVertexBuffer ()

Protected Member Functions

void * lockImpl (u32 offset, u32 length, resource::BufferLocking options)
 Internal implementation of lock().
void unlockImpl ()
 Internal implementation of unlock().

Protected Attributes

u8mpData

Constructor & Destructor Documentation

render::MemoryVertexBuffer::MemoryVertexBuffer ( u32  vertexSize,
u32  numVertices,
resource::BufferUsage  usage 
)
render::MemoryVertexBuffer::~MemoryVertexBuffer ( ) [virtual]

References mpData.


Member Function Documentation

void * render::MemoryVertexBuffer::lock ( u32  offset,
u32  length,
resource::BufferLocking  options 
) [virtual]

Lock the buffer for (potentially) reading / writing.

Parameters:
offset,:The byte offset from the start of the buffer to lock
length,:The size of the area to lock, in bytes
options,:Locking options
Returns:
Pointer to the locked memory

Reimplemented from resource::Buffer.

References resource::Buffer::mIsLocked, and mpData.

void * render::MemoryVertexBuffer::lockImpl ( u32  offset,
u32  length,
resource::BufferLocking  options 
) [protected, virtual]

Internal implementation of lock().

Implements resource::Buffer.

References mpData.

void render::MemoryVertexBuffer::readData ( u32  offset,
u32  length,
void *  pDest 
) [virtual]

Reads data from the buffer and places it in the memory pointed to by pDest.

Parameters:
offset,:The byte offset from the start of the buffer to read
length,:The size of the area to read, in bytes
pDest,:The area of memory in which to place the data, must be large enough to accommodate the data!

Implements resource::Buffer.

References mpData, and resource::Buffer::mSizeInBytes.

void render::MemoryVertexBuffer::unlock ( ) [virtual]

Releases the lock on this buffer.

Locking and unlocking a buffer can, in some rare circumstances such as switching video modes whilst the buffer is locked, corrupt the contents of a buffer. This is pretty rare, but if it occurs, this method will throw an exception, meaning you must re-upload the data. Note that using the 'read' and 'write' forms of updating the buffer does not suffer from this problem, so if you want to be 100% sure your data will not be lost, use the 'read' and 'write' forms instead.

Reimplemented from resource::Buffer.

References resource::Buffer::mIsLocked.

void render::MemoryVertexBuffer::unlockImpl ( ) [protected, virtual]

Internal implementation of unlock().

Implements resource::Buffer.

void render::MemoryVertexBuffer::writeData ( u32  offset,
u32  length,
const void *  pSource,
bool  discardWholeBuffer = false 
) [virtual]

Writes data to the buffer from an area of system memory; note that you must ensure that your buffer is big enough.

Parameters:
offset,:The byte offset from the start of the buffer to start writing
length,:The size of the data to write to, in bytes
pSource,:The source of the data to be written
discardWholeBuffer,:If true, this allows the driver to discard the entire buffer when writing, such that DMA stalls can be avoided; use if you can.

Implements resource::Buffer.

References mpData, and resource::Buffer::mSizeInBytes.


Member Data Documentation


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

The KG Game Engine
The KG Game Engine Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:08 by Doxygen (1.7.4)