2018-10-08 19:19:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-11 05:26:24 +00:00
|
|
|
#include <charcoal/Poseable2D.h>
|
|
|
|
#include <charcoal/TextureRenderable.h>
|
|
|
|
|
2018-10-14 04:52:32 +00:00
|
|
|
#include "PoseableBatch.h"
|
2018-10-08 19:19:48 +00:00
|
|
|
|
|
|
|
namespace charcoal
|
|
|
|
{
|
|
|
|
namespace builtin
|
|
|
|
{
|
2018-10-09 23:58:26 +00:00
|
|
|
template <typename VertexType, typename IndexType, int position_offset, int uv_offset>
|
2018-10-14 04:52:32 +00:00
|
|
|
class SpriteBatch : public PoseableBatch<VertexType, IndexType, TextureRenderable<VertexType, IndexType> >
|
2018-10-08 19:19:48 +00:00
|
|
|
{
|
2018-10-09 23:58:26 +00:00
|
|
|
public:
|
2018-10-09 15:42:17 +00:00
|
|
|
// Note: This is VERY similar to builtin::textured::Batch
|
|
|
|
// Note: Uses GL_TEXTURE0. The uniform for this texture should be set in the scene before rendering.
|
2018-10-14 04:52:32 +00:00
|
|
|
using PoseableBatch<VertexType, IndexType, TextureRenderable<VertexType, IndexType> >::PoseableBatch;
|
2018-10-09 15:42:17 +00:00
|
|
|
|
|
|
|
void preprender() const override
|
|
|
|
{
|
|
|
|
// Note: Uses GL_TEXTURE0. The uniform for this texture should be set in the scene.
|
|
|
|
glActiveTexture(GL_TEXTURE0);
|
|
|
|
glBindTexture(GL_TEXTURE_2D, charcoal::Batch<VertexType, IndexType, 1, TextureRenderable<VertexType, IndexType> >::m_p_renderable->get_texture()->get_texture());
|
|
|
|
glBindSampler(0, charcoal::Batch<VertexType, IndexType, 1, TextureRenderable<VertexType, IndexType> >::m_p_renderable->get_sampler()->get_sampler());
|
|
|
|
}
|
2018-10-08 19:19:48 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|