05363f94b7
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
44 lines
744 B
C++
44 lines
744 B
C++
#pragma once
|
|
|
|
#include "ShaderProgram.h"
|
|
#include "Shader.h"
|
|
#include "Mesh.h"
|
|
#include "Renderable.h"
|
|
|
|
class MyBatchTestShaderProgram : public ShaderProgram
|
|
{
|
|
public:
|
|
struct Vertex
|
|
{
|
|
Vertex() {}
|
|
Vertex(float x, float y, float z)
|
|
: x(x), y(y), z(z)
|
|
{}
|
|
float x;
|
|
float y;
|
|
float z;
|
|
};
|
|
struct Color // Try changing to normalized unsigned chars (0-255) for the example
|
|
{
|
|
float r = 0.0f;
|
|
float g = 0.0f;
|
|
float b = 0.0f;
|
|
float a = 1.0f;
|
|
};
|
|
struct Offset
|
|
{
|
|
float x = 0.0f;
|
|
float y = 0.0f;
|
|
float z = 0.0f;
|
|
};
|
|
typedef unsigned int Index;
|
|
typedef Renderable<Vertex, Index> Renderable;
|
|
typedef Mesh<Vertex, Index> Mesh;
|
|
|
|
MyBatchTestShaderProgram();
|
|
|
|
private:
|
|
Shader m_vertex_shader;
|
|
Shader m_fragment_shader;
|
|
};
|