bb4592ed63
Changing the mechanic of the renderer to support pipelines. One scene could have multiple pipelines. The pipelines allow for one shader, one camera, and multiple batches.
30 lines
1.1 KiB
C++
30 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <charcoal/Poseable2D.h>
|
|
#include <charcoal/TextureRenderable.h>
|
|
|
|
#include "PoseableBatch.h"
|
|
|
|
namespace charcoal
|
|
{
|
|
namespace builtin
|
|
{
|
|
template <typename VertexType, typename IndexType, int position_offset, int uv_offset>
|
|
class SpriteBatch : public PoseableBatch<VertexType, IndexType, TextureRenderable<VertexType, IndexType> >
|
|
{
|
|
public:
|
|
// 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.
|
|
using PoseableBatch<VertexType, IndexType, TextureRenderable<VertexType, IndexType> >::PoseableBatch;
|
|
|
|
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());
|
|
}
|
|
};
|
|
}
|
|
}
|