2014-12-09 21:30:06 +00:00
|
|
|
namespace dk {
|
2014-12-09 22:53:09 +00:00
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
template <size_t D>
|
2014-12-11 22:58:52 +00:00
|
|
|
Tyler<D>::Tyler (const coords& parSize, const coords& parTileSize) :
|
|
|
|
m_size(parSize),
|
|
|
|
m_tilesize(parTileSize)
|
2014-12-09 21:30:06 +00:00
|
|
|
{
|
|
|
|
assert(m_size.x() > 0 and m_size.y() > 0);
|
|
|
|
}
|
2014-12-09 22:53:09 +00:00
|
|
|
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
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>
|
2014-12-12 19:04:48 +00:00
|
|
|
Layer<T, D>& Tyler<D>::push_layer (typename Layer<T, D>::streamer_type&& parStreamer) {
|
|
|
|
auto newLayer = new Layer<T, D>(m_size, m_tilesize, m_tilesize, std::move(parStreamer));
|
|
|
|
m_layers.push_back(LayerPtr(newLayer));
|
|
|
|
return *newLayer;
|
2014-12-11 22:58:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
template <size_t D>
|
|
|
|
template <typename T>
|
2014-12-12 19:04:48 +00:00
|
|
|
Layer<T, D>& Tyler<D>::push_layer (typename Layer<T, D>::streamer_type&& parStreamer, const coords& parSubdiv) {
|
|
|
|
auto newLayer = new Layer<T, D>(m_size * parSubdiv, m_tilesize / parSubdiv, m_tilesize, std::move(parStreamer));
|
|
|
|
m_layers.push_back(LayerPtr(newLayer));
|
|
|
|
return *newLayer;
|
2014-12-09 22:53:09 +00:00
|
|
|
}
|
2014-12-14 12:13:10 +00:00
|
|
|
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
///--------------------------------------------------------------------------
|
|
|
|
template <size_t D>
|
|
|
|
void Tyler<D>::preload (const coords& parFrom, const coords& parTo) {
|
|
|
|
for (auto& layer : m_layers) {
|
|
|
|
layer->preload(parFrom, parTo);
|
|
|
|
}
|
|
|
|
}
|
2014-12-09 21:30:06 +00:00
|
|
|
} //namespace dk
|