#include <Buffer.h>
Public Member Functions | |
Buffer (const Segment &segment, unsigned int channels=4) | |
Constructor. | |
DataType & | operator() (unsigned int x, unsigned int y, unsigned int channel) |
Retrieve the data value at a given point. | |
const DataType & | operator() (unsigned int x, unsigned int y, unsigned int channel) const |
Retrieve the data value at a given point. | |
const Segment & | getSegment () const |
Accessor for the terrain height segment this buffer is associated with. | |
unsigned int | getSize () const |
Accessor for the size of segment, m_res + 1. | |
unsigned int | getChannels () const |
Accessor for the number of data values per height point. | |
DataType * | getData () |
Accessor for a pointer to buffer containing data values. | |
void | allocate () |
Allocate the storage required by the buffer. | |
bool | isValid () const |
Determine if this buffer has valid allocated storage. | |
void | invalidate () |
De-allocate the storage for this buffer. | |
Public Attributes | |
const Segment & | m_segment |
The terrain height segment this buffer is associated with. | |
Private Attributes | |
const unsigned int | m_channels |
The number of data values per height point. | |
const unsigned int | m_size |
The size of segment, m_res + 1. | |
DataType * | m_data |
Pointer to buffer containing data values. |
Mercator::Buffer< DataType >::Buffer | ( | const Segment & | segment, | |
unsigned int | channels = 4 | |||
) | [inline, explicit] |
Constructor.
segment | terrain height segment this buffer is associated with. | |
channels | number of data values per height point. |
DataType& Mercator::Buffer< DataType >::operator() | ( | unsigned int | x, | |
unsigned int | y, | |||
unsigned int | channel | |||
) | [inline] |
Retrieve the data value at a given point.
Access the data value associated with given point in the segment in a given channel in this buffer.
const DataType& Mercator::Buffer< DataType >::operator() | ( | unsigned int | x, | |
unsigned int | y, | |||
unsigned int | channel | |||
) | const [inline] |
Retrieve the data value at a given point.
Return the data value associated with given point in the segment in a given channel in this buffer.
void Mercator::Buffer< DataType >::allocate | ( | ) | [inline] |
Allocate the storage required by the buffer.
Allocate memory based on the size and number of channels required by the buffer.
Referenced by Mercator::Surface::populate().
bool Mercator::Buffer< DataType >::isValid | ( | ) | const [inline] |
Determine if this buffer has valid allocated storage.
Referenced by Mercator::Surface::populate().
void Mercator::Buffer< DataType >::invalidate | ( | ) | [inline] |
De-allocate the storage for this buffer.
Free the storage allocate for this buffer.