charcoal/OpenGLEngine/MyBatch.h
2018-09-12 17:03:46 -04:00

42 lines
1.1 KiB
C++

#pragma once
#include "Batch.h"
#include "Poseable.h"
#include "MySimpleShaderProgram.h"
using namespace charcoal;
class MyBatch : public Batch<MySimpleShaderProgram::Vertex, MySimpleShaderProgram::Index, 2>
{
public:
MyBatch(
const MySimpleShaderProgram::Renderable* renderable,
const SizeType& element_count
) : MyBatch(renderable, element_count, element_count) {}
MyBatch(
const MySimpleShaderProgram::Renderable* renderable,
const SizeType& element_count,
const SizeType& element_render_count
) : Batch(renderable, element_render_count), m_color_elements(element_count), m_poseable_elements(element_count) {}
MySimpleShaderProgram::Color& get_color(const SizeType& index) { return m_color_elements[index]; }
Poseable& get_pose(const SizeType& index) { return m_poseable_elements[index]; }
protected:
void setup_element_buffers() override;
void setup_vao() override;
void update_element_buffers() override;
private:
const int COLOR_VBO_INDEX = 0;
const int POSEABLE_VBO_INDEX = 1;
std::vector<MySimpleShaderProgram::Color> m_color_elements;
std::vector<Poseable> m_poseable_elements;
};