charcoal/OpenGLEngine/MyBatch.h
elipzer 05363f94b7 Abstracted Batch Element Specification
Now, the batch subclasses define the Element specification and the
elements are not stored in the main Batch class. It is suggested
that the batch subclasses use vectors of the different element
types per requested VBO and offer a function to return a reference
to one of the elements by index. This functionality is implemented
in the current version of MyBatch.

A test for the movement needs to be completed
2018-09-07 11:45:32 -04:00

33 lines
979 B
C++

#pragma once
#include "Batch.h"
#include "MyBatchTestShaderProgram.h"
class MyBatch : public Batch<MyBatchTestShaderProgram::Vertex, MyBatchTestShaderProgram::Index, 2>
{
public:
MyBatch(
const MyBatchTestShaderProgram::Renderable* renderable,
const SizeType& element_count,
const SizeType& element_render_count
) : Batch(renderable, element_render_count), m_color_elements(element_count), m_offset_elements(element_count) {}
MyBatchTestShaderProgram::Color& get_color(const SizeType& index) { return m_color_elements[index]; }
MyBatchTestShaderProgram::Offset& get_offset(const SizeType& index) { return m_offset_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 OFFSET_VBO_INDEX = 1;
std::vector<MyBatchTestShaderProgram::Color> m_color_elements;
std::vector<MyBatchTestShaderProgram::Offset> m_offset_elements;
};