-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpotLight.cpp
More file actions
50 lines (41 loc) · 1.56 KB
/
SpotLight.cpp
File metadata and controls
50 lines (41 loc) · 1.56 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
#include "SpotLight.h"
SpotLight::SpotLight():PointLight()
{
direction = glm::vec3(0.0f, -1.0f, 0.0f);
edge = 0.0f;
procEdge = cosf(glm::radians(edge));
}
SpotLight::SpotLight(GLfloat red, GLfloat green, GLfloat blue,
GLfloat aIntensity, GLfloat dIntensity,
GLfloat xPos, GLfloat yPos, GLfloat zPos,
GLfloat xDir, GLfloat yDir, GLfloat zDir,
GLfloat con, GLfloat lin, GLfloat exp,
GLfloat edg) : PointLight(red,green,blue,aIntensity,dIntensity,xPos,yPos,zPos,con,lin,exp)
{
direction = glm::normalize(glm::vec3(xDir, yDir, zDir));
edge = edg;
procEdge = cosf(glm::radians(edge));
}
void SpotLight::UseLight(GLuint ambientIntensityLocaiton, GLuint ambientColourLocation,
GLuint diffuseIntensityLocation, GLuint positionLocation, GLuint directionLocation,
GLuint constantLocation, GLuint linearLocation, GLuint exponentLocation,
GLuint edgeLocation)
{
glUniform3f(ambientColourLocation, colour.x, colour.y, colour.z);
glUniform1f(ambientIntensityLocaiton, ambientIntensity);
glUniform1f(diffuseIntensityLocation, diffuseIntensity);
glUniform3f(positionLocation, position.x, position.y, position.z);
glUniform1f(constantLocation, constant);
glUniform1f(linearLocation, linear);
glUniform1f(exponentLocation, exponent);
glUniform3f(directionLocation, direction.x, direction.y, direction.z);
glUniform1f(edgeLocation, procEdge);
}
void SpotLight::setFlash(glm::vec3 pos, glm::vec3 dir)
{
position = pos;
direction = dir;
}
SpotLight::~SpotLight()
{
}