mercator
0.4.0
A terrain generation library for the Worldforge system.
|
Data store for terrain surface data. More...
#include <Surface.h>
Public Member Functions | |
Surface (const Segment &segment, const Shader &shader, bool colors=true, bool alpha=true) | |
Constructor. More... | |
void | populate () |
Populate the data buffer using the correct shader. More... | |
const Segment & | getSegment () const |
Accessor for the terrain height segment this surface is associated with. More... | |
ColorT & | operator() (unsigned int x, unsigned int y, unsigned int channel) |
Retrieve the data value at a given point. More... | |
const ColorT & | 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... | |
ColorT * | getData () |
Accessor for a pointer to buffer containing data values. More... | |
const ColorT * | 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... | |
Public Attributes | |
const Shader & | m_shader |
The shader that populates this surface. More... | |
const Segment & | m_segment |
The terrain height segment this buffer is associated with. 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< ColorT > | m_data |
Pointer to buffer containing data values. More... | |
|
explicit |
Constructor.
seg | the terrain height segment this surface maps on to. |
sh | the shader used to generate the surface data. |
color | true if this shader contains color data. |
alpha | true if this shader contains alpha data. |
Definition at line 18 of file Surface.cpp.
|
inlineinherited |
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.
Referenced by populate().
|
inlineinherited |
Accessor for the number of data values per height point.
Definition at line 58 of file Buffer.h.
References Mercator::Buffer< DataType >::m_channels.
|
inlineinherited |
|
inlineinherited |
|
inline |
Accessor for the terrain height segment this surface is associated with.
Definition at line 37 of file Surface.h.
References m_segment.
Referenced by Mercator::AreaShader::shade(), Mercator::FillShader::shade(), Mercator::HighShader::shade(), Mercator::TileShader::shade(), Mercator::DepthShader::shade(), Mercator::LowShader::shade(), Mercator::BandShader::shade(), and Mercator::GrassShader::shade().
|
inlineinherited |
Accessor for the size of segment, m_res + 1.
Definition at line 53 of file Buffer.h.
References Mercator::Buffer< DataType >::m_size.
|
inlineinherited |
|
inlineinherited |
Determine if this buffer has valid allocated storage.
Definition at line 83 of file Buffer.h.
Referenced by populate().
|
inlineinherited |
|
inlineinherited |
void Mercator::Surface::populate | ( | ) |
Populate the data buffer using the correct shader.
Call the shader to full this surface buffer with surface data.
Definition at line 27 of file Surface.cpp.
References Mercator::Buffer< ColorT >::allocate(), Mercator::Buffer< ColorT >::isValid(), m_shader, and Mercator::Shader::shade().
|
protectedinherited |
|
protectedinherited |
const Segment& Mercator::Surface::m_segment |
The terrain height segment this buffer is associated with.
Definition at line 28 of file Surface.h.
Referenced by getSegment(), and Mercator::AreaShader::shade().
const Shader& Mercator::Surface::m_shader |
The shader that populates this surface.
Definition at line 26 of file Surface.h.
Referenced by populate().
|
protectedinherited |