Cleaning for opengl rendering prep.
This commit is contained in:
parent
402f381d10
commit
7c6a92f4ec
58 changed files with 570 additions and 533 deletions
|
@ -0,0 +1,50 @@
|
|||
#include "Grid.h"
|
||||
|
||||
template<typename T>
|
||||
Grid<T>::Grid(const Rectangle& bounds)
|
||||
: mBounds(bounds)
|
||||
{
|
||||
mValues = std::vector<T>(mNumX*mNumY, T());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const Rectangle& Grid<T>::getBounds() const
|
||||
{
|
||||
return mBounds;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
double Grid<T>::getXSpacing() const
|
||||
{
|
||||
return mBounds.getWidth()/double(mNumX);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
double Grid<T>::getYSpacing() const
|
||||
{
|
||||
return mBounds.getHeight()/double(mNumY);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const std::vector<T>& Grid<T>::getValues() const
|
||||
{
|
||||
return mValues;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Grid<T>::resetBounds(const Rectangle& bounds)
|
||||
{
|
||||
mBounds = bounds;
|
||||
mValues = std::vector<T>(mNumX*mNumY, T());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void Grid<T>::setValues(const std::vector<std::size_t>& indices, T value)
|
||||
{
|
||||
for (auto index : indices)
|
||||
{
|
||||
mValues[index] = value;
|
||||
}
|
||||
}
|
||||
|
||||
template class Grid<unsigned char>;
|
Loading…
Add table
Add a link
Reference in a new issue