-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderer.h
65 lines (50 loc) · 1.27 KB
/
renderer.h
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
/*
Copyright (c) RELEX Oy
All rights reserved.
Source made public only to facilitate research and bug reproduction in WASM, Esmcripten, C# Runtimes such as Blazor, Angular and WebGL.
*/
#ifndef __RENDERER_H_INCLUDED__
#define __RENDERER_H_INCLUDED__
#include <GL/glew.h>
#include <vector>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#define GL_GLEXT_PROTOTYPES
#define EGL_EGLEXT_PROTOTYPES
#endif
class Renderer {
private:
static constexpr int FBOCOUNT = 2,
CUBEMAP_COUNT = 2;
int m_window_width = -1,
m_window_height = -1,
m_frame_counter = -1,
m_cubemap_index = -1;
GLint m_iMouse_location = -1,
m_iChannel0_location = -1,
m_iChannel1_location = -1,
m_iTime_location = -1,
m_iResolution_location = -1,
m_iEnv_location = -1,
m_iFramesRcp_location = -1;
GLuint m_program,
m_VAO,
m_FBOs[FBOCOUNT],
m_render_textures[FBOCOUNT],
m_cubemaps[CUBEMAP_COUNT];
bool m_setup_complete;
void clear_render();
void init_cubemaps();
void load_shader(const char* shaderPath, GLenum shaderType);
public:
int m_shaders_loaded = 0;
GLuint getProgram();
void init();
Renderer(int w, int h);
void change_cubemap();
void render();
void Set_iMouse(GLfloat x, GLfloat y);
void Set_iEnv(GLint env);
void Set_iTime(GLfloat t);
};
#endif // !__RENDERER_H_INCLUDED__