2018-09-05 15:47:09 +00:00
|
|
|
#pragma once
|
|
|
|
|
2018-10-11 05:26:24 +00:00
|
|
|
#include <charcoal/Batch.h>
|
|
|
|
#include <charcoal/Poseable.h>
|
2018-09-10 15:35:02 +00:00
|
|
|
|
2018-09-11 05:18:17 +00:00
|
|
|
#include "MySimpleShaderProgram.h"
|
2018-09-05 20:26:50 +00:00
|
|
|
|
2018-09-12 21:03:46 +00:00
|
|
|
using namespace charcoal;
|
|
|
|
|
2018-09-14 22:09:43 +00:00
|
|
|
class MyBatch : public charcoal::Batch<MySimpleShaderProgram::Vertex, MySimpleShaderProgram::Index, 2>
|
2018-09-05 15:47:09 +00:00
|
|
|
{
|
2018-09-05 20:26:50 +00:00
|
|
|
public:
|
2018-09-08 04:06:10 +00:00
|
|
|
MyBatch(
|
2018-09-19 07:52:42 +00:00
|
|
|
const MySimpleShaderProgram::RenderableT* renderable,
|
2018-09-14 22:09:43 +00:00
|
|
|
int element_count
|
2018-09-08 04:06:10 +00:00
|
|
|
) : MyBatch(renderable, element_count, element_count) {}
|
|
|
|
|
2018-09-07 03:22:40 +00:00
|
|
|
MyBatch(
|
2018-09-19 07:52:42 +00:00
|
|
|
const MySimpleShaderProgram::RenderableT* renderable,
|
2018-09-14 22:09:43 +00:00
|
|
|
int element_count,
|
|
|
|
int element_render_count
|
2018-09-10 15:35:02 +00:00
|
|
|
) : Batch(renderable, element_render_count), m_color_elements(element_count), m_poseable_elements(element_count) {}
|
2018-09-07 15:45:32 +00:00
|
|
|
|
2018-09-14 22:09:43 +00:00
|
|
|
MySimpleShaderProgram::Color& get_color(int index) { return m_color_elements[index]; }
|
2018-09-07 15:45:32 +00:00
|
|
|
|
2018-09-14 22:09:43 +00:00
|
|
|
Poseable& get_pose(int index) { return m_poseable_elements[index]; }
|
2018-09-07 04:41:34 +00:00
|
|
|
|
2018-09-05 20:26:50 +00:00
|
|
|
protected:
|
2018-09-07 04:41:34 +00:00
|
|
|
void setup_element_buffers() override;
|
|
|
|
|
2018-09-05 20:26:50 +00:00
|
|
|
void setup_vao() override;
|
2018-09-07 04:41:34 +00:00
|
|
|
|
|
|
|
void update_element_buffers() override;
|
2018-09-07 15:45:32 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
const int COLOR_VBO_INDEX = 0;
|
2018-09-10 15:35:02 +00:00
|
|
|
const int POSEABLE_VBO_INDEX = 1;
|
2018-09-07 15:45:32 +00:00
|
|
|
|
2018-09-11 05:18:17 +00:00
|
|
|
std::vector<MySimpleShaderProgram::Color> m_color_elements;
|
2018-09-10 15:35:02 +00:00
|
|
|
std::vector<Poseable> m_poseable_elements;
|
2018-09-05 15:47:09 +00:00
|
|
|
};
|