forked from WenlinMao/SleepWalking
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShapeTextureProgram.hpp
More file actions
50 lines (39 loc) · 1.23 KB
/
Copy pathShapeTextureProgram.hpp
File metadata and controls
50 lines (39 loc) · 1.23 KB
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
#pragma once
#include "GL.hpp"
#include "Load.hpp"
#include "Scene.hpp"
#include <ft2build.h>
#include FT_FREETYPE_H
struct ShapeTextureProgram
{
ShapeTextureProgram();
~ShapeTextureProgram();
GLuint program = 0;
GLuint Position_vec4 = -1U;
GLuint Color_vec4 = -1U;
GLuint TexCoord_vec2 = -1U;
struct Vertex
{
glm::vec2 Position;
glm::u8vec4 Color;
glm::vec2 TexCoord;
};
// Code from https://github.com/GenBrg/MarryPrincess/blob/master/Texture2DProgram.hpp
struct BoxDrawable
{
GLuint vertex_array{ 0 };
GLuint vertex_buffer{ 0 };
glm::u8vec4 color{ 0xff, 0xff, 0xff, 0xff };
void Clear();
};
static_assert(sizeof(Vertex) == 2 * 4 + 4 * 1 + 2 * 4);
GLuint GetVao(GLuint vertex_buffer) const;
GLuint GetTextureId(const FT_Bitmap& bitmap) const;
void SetBoxHighlight(BoxDrawable& drawable, const glm::vec4& box) const;
void ResetBoxHighlight(BoxDrawable& drawable, const glm::vec4& box) const;
void DeleteTextureId(const GLuint texture_id) const;
void SetBox(BoxDrawable& drawable, const glm::vec4& box, const glm::u8vec4 color) const;
void DrawBox(const BoxDrawable& drawable) const;
void DrawFont(const Vertex* vertices, const GLuint texture_id) const;
};
extern Load < ShapeTextureProgram > shape_texture_program;