-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderable.h
More file actions
64 lines (51 loc) · 1.66 KB
/
Copy pathRenderable.h
File metadata and controls
64 lines (51 loc) · 1.66 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
#ifndef __RENDERABLE_H_
#define __RENDERABLE_H_
#include "OpenGLUtil.h"
#include "ShaderProgram.h"
class Matrix4x4;
class Program;
class Vector4;
struct UVCoord { float u, v; };
struct RGBColor { float r, g, b; };
class Renderable
{
public:
Renderable();
~Renderable();
bool uploaded();
virtual void upload();
virtual void bind();
virtual void draw();
void setShaderProgram(const std::shared_ptr<Program> & program);
void useProgram();
void setWorldMatrix(const Matrix4x4 & mat);
void setViewMatrix(const Matrix4x4 & mat);
void setProjection(const Matrix4x4 & mat);
void setCameraPosition(const Vector4 & pos);
void setAnimTime(float t);
void setHighlighted(bool highlighted);
void setLights(float * pos, float * intensity, int numLights);
void setTexture(GLuint texId);
void setRoughness(float roughness);
void setF0(float F0);
void setDiffuseColor(const RGBColor & c);
void uploadMaterialUniforms();
void uploadTextureUniforms();
const GLuint POSITION_ATTRIB_INDEX = 0;
const GLuint NORMAL_ATTRIB_INDEX = 1;
const GLuint TEX_COORD_ATTRIB_INDEX = 2;
bool is_uploaded = false;
VertexArrayObject vao;
BufferObject vbo;
BufferObject ibo;
unsigned long long numVertices = 0;
GLuint textureId = 0;
bool hasTexture = false;
std::shared_ptr<Program> shaderProgram;
// Material properties
float roughness = 0.1;
float F0 = 0.25;
RGBColor diffuseColor;
bool visible = true;
};
#endif