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
38 lines
624 B
C++
38 lines
624 B
C++
#pragma once
|
|
|
|
#include "ShaderProgram.h"
|
|
#include "Shader.h"
|
|
#include "Mesh.h"
|
|
#include "Renderable.h"
|
|
|
|
class MyShaderProgram : 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;
|
|
float g;
|
|
float b;
|
|
float a;
|
|
};
|
|
typedef unsigned int Index;
|
|
typedef Renderable<Vertex, Index> Renderable;
|
|
typedef Mesh<Vertex, Index> Mesh;
|
|
|
|
MyShaderProgram();
|
|
|
|
private:
|
|
Shader m_vertex_shader;
|
|
Shader m_fragment_shader;
|
|
}; |