-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModuleRender.h
More file actions
133 lines (97 loc) · 2.86 KB
/
Copy pathModuleRender.h
File metadata and controls
133 lines (97 loc) · 2.86 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#ifndef __ModuleRender_H__
#define __ModuleRender_H__
#include "Module.h"
#include "Globals.h"
#include "MathGeoLib/Math/float4x4.h"
#include "MathGeoLib/Math/float3x3.h"
#include "ComponentCamera.h"
#include "GL/glew.h"
#include "ImGuizmo/ImGuizmo.h"
#include "Timer.h"
#include <vector>
#include <set>
struct SDL_Texture;
struct SDL_Renderer;
struct SDL_Rect;
class Skybox;
class ModuleRender : public Module
{
public:
ModuleRender() = default;
~ModuleRender() = default;
bool Init();
update_status PreUpdate();
update_status Update();
update_status PostUpdate();
bool CleanUp();
//Touch render variables
void EnableFaceCulling() const;
void EnableDepthTest() const;
void ChangeFrontFace() const;
void EnableTexture2D() const;
void FillTriangles() const;
void EnableAlphaTest() const;
bool faceCullingIsActive = true;
bool dephtTestIsActive = true;
bool changingFrontFace = true;
bool texture2DIsActive = true;
bool fillTrianglesIsActive = true;
bool alphaTestIsActive = false;
float aspect = 1.0f;
bool showBoundingBox = true;
bool showSkybox = false;
//Frustum Culling
bool frustumCullingIsActivated = false;
//Debug
//void OurOpenGLErrorFunction(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam);
//Draw
void DrawGuizmo() const;
void DrawAllGameObjects() const;
void DrawGame() const;
//If scene create buffer for scene else create buffer for game window
void CreateFrameBuffer(int width, int height, bool scene = true);
void GenerateTexture(int width, int height);
void GenerateTextureGame(int width, int height);
//Quadtree variables
bool showQuadTree = false;
bool showAABBTree = false;
bool showFrustum = true;
bool showGrid = false;
bool antialiasing = false;
//Windows size
int heightScene, widthScene;
int heightGame, widthGame;
bool firstTimeCreatingBuffer = true;
void Pick() const;
void DrawGuizmoButtons() const;
ImGuizmo::OPERATION currentOperation = ImGuizmo::TRANSLATE;
ImGuizmo::MODE currentMode = ImGuizmo::WORLD;
bool isGamePlaying = false;
ComponentCamera* gameCamera = nullptr;
//Skybox
Skybox* skybox = nullptr;
float timeForRendering = 0.0f;
bool showBothSceneGame = false;
private:
void* context;
Timer* timeRender = nullptr;
int height = 0;
int width = 0;
unsigned int vbo;
unsigned int index;
//Framebuffer windows variables
unsigned int frameBufferObject = 0; // FBO
unsigned int renderBufferObject = 0; // RBO
//Framebuffer windows variables
unsigned int frameBufferObjectGame = 0; // FBO
unsigned int renderBufferObjectGame = 0; // RBO
unsigned int multiSampledAntiAliasingDepth = 0; //MSAAD
unsigned int multiSampledAntiAliasingColor = 0; //MSAAC
unsigned int sceneTexture = 0;
unsigned int gameTexture = 0;
//Methods
void DrawDebug() const;
void DrawSceneBuffer();
void DrawGameBuffer();
};
#endif __ModuleRender_H__