-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEngine.hpp
More file actions
70 lines (43 loc) · 1.15 KB
/
Engine.hpp
File metadata and controls
70 lines (43 loc) · 1.15 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//
// Created by Ciro on 06/22/2025.
//
#ifndef ENGINE_HPP
#define ENGINE_HPP
#include <vector>
#include "Camera.hpp"
#include "Enums.hpp"
#include "World/Chunk.hpp"
#include "Utils/ShaderProgram.hpp"
namespace VoxelEngine {
struct i8Color3;
struct Vertex;
class Engine {
public:
Engine(float wx, float wy);
~Engine();
void Input(float deltaTime);
void OnWindowResize(int width, int height);
void Update(float deltaTime) const;
void RenderUi();
void Render();
private:
Camera m_Camera;
World::Chunk m_Chunk;
bool m_EnableCulling;
bool m_EnableVoxelFaceCulling;
bool m_IsMeshDirty;
GLuint m_VAO;
GLuint m_VBO;
GLuint m_EBO;
Utils::ShaderProgram m_ShaderProgram;
std::vector<Vertex> m_Vertices;
std::vector<GLuint> m_Indices;
GLuint m_IndexOffset;
std::unordered_map<BlockFaceType, glm::vec4[4]> m_BlockFaces;
void CreateMesh();
void AddQuad(const glm::i8vec3& v0, const glm::i8vec3& v1, const glm::i8vec3& v2, const glm::i8vec3& v3, const i8Color3& color, bool flip);
bool IsFaceVisible(glm::ivec3 pos, int axis, bool backFace) const;
i8Color3 GetColorForFace(BlockFaceType face) const;
};
} // VoxelEngine
#endif //ENGINE_HPP