forked from pkivolowitz/Shapes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathphong_shader.h
51 lines (44 loc) · 1.15 KB
/
phong_shader.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
#pragma once
#include "shader.h"
// Portions lifted from OpenGL SuperBible 7th Edition.
class PhongShader : public Shader
{
public:
void Use(glm::mat4 &model_matrix, glm::mat4 &view_matrix, glm::mat4 &projection_matrix);
void UnUse();
void SetMaterial(glm::vec3 diffuse_albedo, glm::vec3 specular_albedo, float specular_power, glm::vec3 ambient);
void SetParameters(float p1 , float p2);
void SetLightPosition(glm::vec3 light_position);
void SelectSubroutine(int subroutine_index);
void CustomSetup();
void SetGlobalTime(float global_time);
void EnableTexture(ILContainer & ilcontainer , GLuint texture_unit);
void SetOpacity(float opacity);
enum SubroutineIndices
{
CONSTANT,
BASIC_PHONG,
PHONG_WITH_TEXTURE,
SHADER_TOY_1,
NUMBER_OF_SUBROUTINES
};
private:
struct
{
GLuint modelview_matrix;
GLuint view_matrix;
GLuint normal_matrix;
GLuint projection_matrix;
GLuint diffuse_albedo;
GLuint specular_albedo;
GLuint specular_power;
GLuint ambient;
GLuint light_position;
GLuint base_texture_location;
GLuint global_time;
GLuint opacity;
GLuint param1;
GLuint param2;
} uniforms;
std::vector<GLuint> subroutine_indices;
};