2022-08-02 00:07:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <list>
|
|
|
|
|
|
|
|
namespace charcoal
|
|
|
|
{
|
|
|
|
namespace builtin
|
|
|
|
{
|
|
|
|
template <typename RenderableType, typename BatchType>
|
|
|
|
class Batched
|
|
|
|
{
|
|
|
|
protected:
|
|
|
|
BatchType& add_batch(RenderableType* renderable, int element_count)
|
|
|
|
{
|
|
|
|
return add_batch(renderable, element_count, element_count);
|
|
|
|
}
|
|
|
|
|
|
|
|
BatchType& add_batch(RenderableType* renderable, int element_count, int element_render_count)
|
|
|
|
{
|
|
|
|
m_batches.emplace_back(renderable, element_count, element_render_count);
|
|
|
|
return m_batches.back();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Since the intention is to access the batches through the returned references,
|
|
|
|
// it is better to store them in a list.
|
|
|
|
std::list<BatchType> m_batches;
|
|
|
|
};
|
|
|
|
}
|
2018-09-14 22:09:43 +00:00
|
|
|
}
|