King_DuckZ
9086de8dae
The iterator is not included anywhere yet so it's completely untested. Next step is to define the relationship between views and layers, so iterators can be put into the class that will be responsible to spawn them.
42 lines
1.7 KiB
C++
42 lines
1.7 KiB
C++
namespace dk {
|
|
///--------------------------------------------------------------------------
|
|
///--------------------------------------------------------------------------
|
|
template <size_t D>
|
|
Tyler<D>::Tyler (const coords& parSize, const coords& parTileSize) :
|
|
m_size(parSize),
|
|
m_tilesize(parTileSize)
|
|
{
|
|
assert(m_size.x() > 0 and m_size.y() > 0);
|
|
}
|
|
|
|
///--------------------------------------------------------------------------
|
|
///--------------------------------------------------------------------------
|
|
template <size_t D>
|
|
typename Tyler<D>::coords::value_type Tyler<D>::tiles_count() const {
|
|
typename coords::value_type retval = 1;
|
|
for (size_t d = 0; d < D; ++d) {
|
|
retval *= m_size[d];
|
|
}
|
|
return retval;
|
|
}
|
|
|
|
///--------------------------------------------------------------------------
|
|
///--------------------------------------------------------------------------
|
|
template <size_t D>
|
|
template <typename T>
|
|
size_t Tyler<D>::push_layer (typename Layer<T, D>::streamer_type&& parStreamer) {
|
|
const size_t retval = m_layers.size();
|
|
m_layers.push_back(LayerPtr(new Layer<T, D>(m_size, m_tilesize, coords(1), std::move(parStreamer))));
|
|
return retval;
|
|
}
|
|
|
|
///--------------------------------------------------------------------------
|
|
///--------------------------------------------------------------------------
|
|
template <size_t D>
|
|
template <typename T>
|
|
size_t Tyler<D>::push_layer (typename Layer<T, D>::streamer_type&& parStreamer, const coords& parSubdiv) {
|
|
const size_t retval = m_layers.size();
|
|
m_layers.push_back(LayerPtr(new Layer<T, D>(m_size * parSubdiv, m_tilesize / parSubdiv, m_tilesize, std::move(parStreamer))));
|
|
return retval;
|
|
}
|
|
} //namespace dk
|