#include <spDimensionUniversalBuffer.hpp>
Public Member Functions | |
UniversalBuffer () | |
UniversalBuffer (const UniversalBuffer &Other) | |
~UniversalBuffer () | |
UniversalBuffer & | operator= (const UniversalBuffer &Other) |
Basic copy operator. | |
bool | setStride (u32 Stride) |
u32 | getStride () const |
template<typename T > | |
void | set (u32 Offset, const T &Value) |
template<typename T > | |
T | get (u32 Offset) const |
template<typename T > | |
void | set (u32 Index, u32 Offset, const T &Value) |
template<typename T > | |
T | get (u32 Index, u32 Offset) const |
template<typename T > | |
void | set (u32 Index, u32 Offset, u32 MaxSize, const T &Value) |
template<typename T > | |
T | get (u32 Index, u32 Offset, u32 MaxSize) const |
void | setBuffer (u32 Offset, const void *Buffer, u32 Size) |
void | getBuffer (u32 Offset, void *Buffer, u32 Size) const |
void | setBuffer (u32 Index, u32 Offset, const void *Buffer, u32 Size) |
void | getBuffer (u32 Index, u32 Offset, void *Buffer, u32 Size) const |
template<typename T > | |
void | add (const T &Value) |
Adds the specified memory at the end of the array. | |
template<typename T > | |
void | remove (u32 Index, u32 Offset) |
Removes memory in the specified range [Offset .. Offset + Size). | |
void | add (const UniversalBuffer &Other) |
Adds the given buffer to this buffer. This and the given buffer must have the same 'stride' value. | |
void | removeBuffer (u32 Offset, u32 Size) |
void | removeBuffer (u32 Index, u32 Offset, u32 Size) |
s8 * | getArray () |
Returns the buffer array. This points to the first element in the array. | |
const s8 * | getArray () const |
Returns the buffer array. This points to the first element in the array. | |
s8 * | getArray (u32 Offset) |
Returns the buffer array at the specified position. | |
const s8 * | getArray (u32 Offset) const |
Returns the buffer array at the specified position. | |
s8 * | getArray (u32 Index, u32 Offset) |
Returns the buffer array at the specified position (index * stride + offset). | |
const s8 * | getArray (u32 Index, u32 Offset) const |
Returns the buffer array at the specified position (index * stride + offset). | |
void | setSize (u32 Size) |
Resizes the buffer (Size in Bytes). | |
u32 | getSize () const |
Returns the buffer's size (Size in Bytes). | |
void | setCount (u32 Count) |
Resizes the buffer (Size in stride). This is equivalent to "setSize(Count * getStride())". | |
u32 | getCount () const |
Returns the count of elements in the buffer. This is equivalent to "getSize() / getStride()". | |
void | fill (u32 Offset, u32 Size) |
void | clear () |
Clears the whole buffer. | |
bool | empty () const |
Returns true if this universal buffer is empty. | |
std::vector< s8 > & | getContainer () |
Returns a reference to the actual container object (std::vector<s8>). | |
const std::vector< s8 > & | getContainer () const |
Returns a constant reference to the actual container object (std::vector<s8>). |
Universal buffer class to handle any kind of data in a large container. This is primary used for mesh buffers to handle blocks of data (e.g. vertices) easier. Also format conversions (e.g. video::MeshBuffer::setVertexFormat) can be handled easier instead of just using an std::vector. Note that this is an array container. Thus adding new data can be slow.
sp::dim::UniversalBuffer::UniversalBuffer | ( | ) | [inline] |
sp::dim::UniversalBuffer::UniversalBuffer | ( | const UniversalBuffer & | Other | ) | [inline] |
sp::dim::UniversalBuffer::~UniversalBuffer | ( | ) | [inline] |
void sp::dim::UniversalBuffer::add | ( | const T & | Value | ) | [inline] |
Adds the specified memory at the end of the array.
void sp::dim::UniversalBuffer::add | ( | const UniversalBuffer & | Other | ) | [inline] |
Adds the given buffer to this buffer. This and the given buffer must have the same 'stride' value.
void sp::dim::UniversalBuffer::clear | ( | ) | [inline] |
Clears the whole buffer.
bool sp::dim::UniversalBuffer::empty | ( | ) | const [inline] |
Returns true if this universal buffer is empty.
Fills the buffer with 0's.
[in] | Offset | Specifies the offset in bytes. |
[in] | Size | Specifies the size in bytes. |
T sp::dim::UniversalBuffer::get | ( | u32 | Index, | |
u32 | Offset, | |||
u32 | MaxSize | |||
) | const [inline] |
T sp::dim::UniversalBuffer::get | ( | u32 | Offset | ) | const [inline] |
s8* sp::dim::UniversalBuffer::getArray | ( | ) | [inline] |
Returns the buffer array. This points to the first element in the array.
const s8* sp::dim::UniversalBuffer::getArray | ( | ) | const [inline] |
Returns the buffer array. This points to the first element in the array.
Returns the buffer array at the specified position.
Returns the buffer array at the specified position.
Returns the buffer array at the specified position (index * stride + offset).
Returns the buffer array at the specified position (index * stride + offset).
void sp::dim::UniversalBuffer::getBuffer | ( | u32 | Index, | |
u32 | Offset, | |||
void * | Buffer, | |||
u32 | Size | |||
) | const [inline] |
Copies the specified memory from the given position.
[in] | Index | Element index. Byte size is Index * (Buffer's stride). |
[in] | Offset | Byte offset added to the position which is specified by "Index". |
[in,out] | Buffer | Memory which is to be compied to the buffer. |
[in] | Size | Buffer size in bytes. |
std::vector<s8>& sp::dim::UniversalBuffer::getContainer | ( | ) | [inline] |
Returns a reference to the actual container object (std::vector<s8>).
const std::vector<s8>& sp::dim::UniversalBuffer::getContainer | ( | ) | const [inline] |
Returns a constant reference to the actual container object (std::vector<s8>).
u32 sp::dim::UniversalBuffer::getCount | ( | ) | const [inline] |
Returns the count of elements in the buffer. This is equivalent to "getSize() / getStride()".
u32 sp::dim::UniversalBuffer::getSize | ( | ) | const [inline] |
Returns the buffer's size (Size in Bytes).
u32 sp::dim::UniversalBuffer::getStride | ( | ) | const [inline] |
UniversalBuffer& sp::dim::UniversalBuffer::operator= | ( | const UniversalBuffer & | Other | ) | [inline] |
Basic copy operator.
Removes memory in the specified range [Offset .. Offset + Size).
void sp::dim::UniversalBuffer::set | ( | u32 | Offset, | |
const T & | Value | |||
) | [inline] |
Sets the specified memory at the given position.
[in] | Offset | Byte offset which specifies the position. |
[in] | Value | Memory which is to be compied to the buffer. |
void sp::dim::UniversalBuffer::set | ( | u32 | Index, | |
u32 | Offset, | |||
u32 | MaxSize, | |||
const T & | Value | |||
) | [inline] |
Sets the specified memory at the given position and clamps the size.
[in] | Index | Element index. Byte size is Index * (Buffer's stride). |
[in] | Ofset,: | Byte offset added to the position which is specified by "Index". |
[in] | MaxSize | Maximal memory size (in bytes) copied from "Value" to the buffer. |
[in] | Value | Memory which is to be compied to the buffer. |
void sp::dim::UniversalBuffer::set | ( | u32 | Index, | |
u32 | Offset, | |||
const T & | Value | |||
) | [inline] |
Sets the specified memory at the given position.
[in] | Index | Element index. Byte size is Index * (Buffer's stride). |
[in] | Offset | Byte offset added to the position which is specified by "Index". |
[in] | Value | Memory which is to be compied to the buffer. |
Sets the specified memory at the given position.
[in] | Offset | Byte offset which specifies the position. |
[in] | Buffer | Memory which is to be compied to the buffer. |
[in] | Size | Buffer size in bytes. |
void sp::dim::UniversalBuffer::setBuffer | ( | u32 | Index, | |
u32 | Offset, | |||
const void * | Buffer, | |||
u32 | Size | |||
) | [inline] |
Copies the specified memory to the given position.
[in] | Index | Element index. Byte size is Index * (Buffer's stride). |
[in] | Offset | Byte offset added to the position which is specified by "Index". |
[in] | Buffer | Memory which is to be compied to the buffer. |
[in] | Size | Buffer size in bytes. |
void sp::dim::UniversalBuffer::setCount | ( | u32 | Count | ) | [inline] |
Resizes the buffer (Size in stride). This is equivalent to "setSize(Count * getStride())".
void sp::dim::UniversalBuffer::setSize | ( | u32 | Size | ) | [inline] |
Resizes the buffer (Size in Bytes).
bool sp::dim::UniversalBuffer::setStride | ( | u32 | Stride | ) | [inline] |
Sets the buffer's stride which represents the size of each element. The initial stride is 1.
[in] | Stride | Specifies the new stride size (in bytes). This must be greater than 0. |