mercator 0.4.0
A terrain generation library for the Worldforge system.
|
Template for managing buffers of data for a segment. More...
#include <Buffer.h>
Public Member Functions | |
Buffer (unsigned int size, unsigned int channels) | |
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... | |
unsigned int | getSize () const |
Accessor for the size of segment, m_res + 1. More... | |
unsigned int | getChannels () const |
Accessor for the number of data values per height point. More... | |
DataType * | getData () |
Accessor for a pointer to buffer containing data values. More... | |
const DataType * | getData () const |
Accessor for a pointer to buffer containing data values. More... | |
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... | |
Protected Attributes | |
const unsigned int | m_channels |
The number of data values per height point. More... | |
const unsigned int | m_size |
The size of segment, m_res + 1. More... | |
std::vector< DataType > | m_data |
Pointer to buffer containing data values. More... | |
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. |
Definition at line 10 of file Buffer_impl.h.
|
inline |
Allocate the storage required by the buffer.
Allocate memory based on the size and number of channels required by the buffer.
Definition at line 76 of file Buffer.h.
References Mercator::Buffer< DataType >::m_channels, Mercator::Buffer< DataType >::m_data, and Mercator::Buffer< DataType >::m_size.
Referenced by Mercator::Segment::populate().
|
inline |
Accessor for the number of data values per height point.
Definition at line 58 of file Buffer.h.
References Mercator::Buffer< DataType >::m_channels.
Referenced by Mercator::DepthShader::shade(), Mercator::FillShader::shade(), Mercator::GrassShader::shade(), Mercator::HighShader::shade(), Mercator::LowShader::shade(), and Mercator::BandShader::shade().
|
inline |
Accessor for a pointer to buffer containing data values.
Definition at line 63 of file Buffer.h.
References Mercator::Buffer< DataType >::m_data.
Referenced by Mercator::Segment::getPoints(), Mercator::DepthShader::shade(), Mercator::FillShader::shade(), Mercator::GrassShader::shade(), Mercator::HighShader::shade(), Mercator::LowShader::shade(), Mercator::BandShader::shade(), Mercator::TileShader::shade(), and Mercator::AreaShader::shade().
|
inline |
Accessor for a pointer to buffer containing data values.
Definition at line 68 of file Buffer.h.
References Mercator::Buffer< DataType >::m_data.
|
inline |
Accessor for the size of segment, m_res + 1.
Definition at line 53 of file Buffer.h.
References Mercator::Buffer< DataType >::m_size.
Referenced by Mercator::TileShader::shade().
|
inline |
De-allocate the storage for this buffer.
Free the storage allocate for this buffer.
Definition at line 90 of file Buffer.h.
References Mercator::Buffer< DataType >::m_data.
Referenced by Mercator::Segment::invalidate().
|
inline |
Determine if this buffer has valid allocated storage.
Definition at line 83 of file Buffer.h.
References Mercator::Buffer< DataType >::m_data.
Referenced by Mercator::Segment::isValid(), and Mercator::Segment::populateNormals().
|
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.
Definition at line 36 of file Buffer.h.
References Mercator::Buffer< DataType >::m_channels, Mercator::Buffer< DataType >::m_data, and Mercator::Buffer< DataType >::m_size.
|
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.
Definition at line 45 of file Buffer.h.
References Mercator::Buffer< DataType >::m_channels, Mercator::Buffer< DataType >::m_data, and Mercator::Buffer< DataType >::m_size.
|
protected |
The number of data values per height point.
Definition at line 17 of file Buffer.h.
Referenced by Mercator::Buffer< DataType >::allocate(), Mercator::Buffer< DataType >::getChannels(), and Mercator::Buffer< DataType >::operator()().
|
protected |
Pointer to buffer containing data values.
Definition at line 21 of file Buffer.h.
Referenced by Mercator::Buffer< DataType >::allocate(), Mercator::Buffer< DataType >::getData(), Mercator::Buffer< DataType >::invalidate(), Mercator::Buffer< DataType >::isValid(), and Mercator::Buffer< DataType >::operator()().
|
protected |
The size of segment, m_res + 1.
Definition at line 19 of file Buffer.h.
Referenced by Mercator::Buffer< DataType >::allocate(), Mercator::Buffer< DataType >::getSize(), and Mercator::Buffer< DataType >::operator()().