Mercator
|
Template for managing buffers of data for a segment. More...
#include <Buffer.h>
Public Member Functions | |
Buffer (const Segment &segment, unsigned int channels=4) | |
Constructor. More... | |
DataType & | operator() (unsigned int x, unsigned int y, unsigned int channel) |
Retrieve the data value at a given point. More... | |
const DataType & | operator() (unsigned int x, unsigned int y, unsigned int channel) const |
Retrieve the data value at a given point. More... | |
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. More... | |
bool | isValid () const |
Determine if this buffer has valid allocated storage. More... | |
void | invalidate () |
De-allocate the storage for this buffer. More... | |
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. | |
Template for managing buffers of data for a segment.
|
explicit |
Constructor.
segment | terrain height segment this buffer is associated with. |
channels | number of data values per height point. |
References Mercator::Buffer< DataType >::m_data.
|
inline |
Allocate the storage required by the buffer.
Allocate memory based on the size and number of channels required by the buffer.
|
inline |
De-allocate the storage for this buffer.
Free the storage allocate for this buffer.
|
inline |
Determine if this buffer has valid allocated storage.
|
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.
|
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.