-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLight.cpp
More file actions
34 lines (27 loc) · 925 Bytes
/
Light.cpp
File metadata and controls
34 lines (27 loc) · 925 Bytes
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
#include "Light.h"
Light::Light()
{
color = glm::vec3(1.0f, 1.0f, 1.0f);
ambientIntensity = 1.0f;
direction = glm::vec3(0.0f, 0.0f, -1.0f);
diffuseIntensity = 0.0f;
}
Light::Light(GLfloat red, GLfloat green, GLfloat blue, GLfloat aIntensity,
GLfloat xDirection, GLfloat yDirection, GLfloat zDirection, GLfloat dIntensity)
{
color = glm::vec3(red, green, blue);
ambientIntensity = aIntensity;
direction = glm::vec3(xDirection, yDirection, zDirection);
diffuseIntensity = dIntensity;
}
void Light::UseLight(GLfloat ambientIntensityLocation, GLfloat ambientColorLocation,
GLfloat diffuseIntensityLocation, GLfloat directionLocation)
{
glUniform3f(ambientColorLocation, color.x, color.y, color.z);
glUniform1f(ambientIntensityLocation, ambientIntensity);
glUniform3f(directionLocation, direction.x, direction.y, direction.z);
glUniform1f(diffuseIntensityLocation, diffuseIntensity);
}
Light::~Light()
{
}