charcoal/CharcoalBuiltin/TexturedBatch.h
elipzer 94de35536a Got it working but its not working...
The UVs are off for some reason but I'm not 100% sure why. Possibly
caused by some sort of offset not being accounted for.
2018-10-14 21:19:38 -04:00

40 lines
1.0 KiB
C++

#pragma once
#include "TexturedTypes.h"
#include "TexturedRenderable.h"
#include "PoseableBatch.h"
namespace charcoal
{
namespace builtin
{
namespace textured
{
class Batch : public PoseableBatch<Vertex, Index, 2, Renderable>
{
public:
using PoseableBatch<Vertex, Index, 2, Renderable>::PoseableBatch;
protected:
void setup_vao_vertex() override
{
glBindBuffer(GL_ARRAY_BUFFER, m_vertex_vbo);
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, position));
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (void*)offsetof(Vertex, uv));
glVertexAttribDivisor(0, 0);
glVertexAttribDivisor(1, 0);
}
void preprender() const override {
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, m_p_renderable->get_texture()->get_texture());
glBindSampler(0, m_p_renderable->get_sampler()->get_sampler());
}
};
}
}
}