1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
// external libs
#include "glad/glad.h"
#include "glm/glm.hpp"
// project headers
#include "texture.hpp"
// std libs
#include <vector>
namespace Ogle
{
class Batch
{
public:
unsigned int VAO, VBO, EBO;
std::vector<float> vertices = {};
std::vector<unsigned int> indices = {};
unsigned int size, batch_limit;
unsigned int last_texture = 0;
Batch(unsigned int batch_limit = 8192);
int drawTexture(
Texture texture,
float x,
float y,
float width,
float height,
glm::vec4 color
);
int drawRectangle(
float x,
float y,
float width,
float height,
glm::vec4 color
);
void flush();
private:
int primativeDrawQuad(
unsigned int texture_id,
glm::vec3 a,
glm::vec3 b,
glm::vec3 c,
glm::vec3 d,
glm::vec4 color
);
};
}
|