-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLightClass.cpp
89 lines (66 loc) · 1.46 KB
/
LightClass.cpp
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#include "stdafx.h"
#include "LightClass.h"
LightClass::LightClass()
{
at.x = 0.0f;
at.y = 0.0f;
at.z = 1.0f;
}
LightClass::LightClass(const LightClass& other)
{
}
LightClass::~LightClass()
{
}
void LightClass::SetAmbientColor(float red, float green, float blue, float alpha)
{
m_ambientColor = XMFLOAT4(red, green, blue, alpha);
}
void LightClass::SetDiffuseColor(float red, float green, float blue, float alpha)
{
m_diffuseColor = XMFLOAT4(red, green, blue, alpha);
}
void LightClass::SetPosition(float x, float y, float z)
{
m_position = XMFLOAT3(x, y, z);
}
void LightClass::SetSpecularColor(float red, float green, float blue, float alpha)
{
m_specularColor = XMFLOAT4(red, green, blue, alpha);
}
void LightClass::SetSpecularPower(float power)
{
m_specularPower = power;
}
XMFLOAT4 LightClass::GetAmbientColor()
{
return m_ambientColor;
}
XMFLOAT4 LightClass::GetDiffuseColor()
{
return m_diffuseColor;
}
XMFLOAT3 LightClass::GetPosition()
{
return m_position;
}
XMFLOAT4 LightClass::GetSpecularColor()
{
return m_specularColor;
}
float LightClass::GetSpecularPower()
{
return m_specularPower;
}
XMMATRIX LightClass::lightViewMatrix(XMFLOAT3 pos, XMFLOAT3 at)
{
XMFLOAT3 up, position, lookAt;
XMVECTOR upVector, positionVector, lookAtVector;
positionVector = XMLoadFloat3(&pos);
up.x = 0.0f;
up.y = 1.0f;
up.z = 0.0f;
upVector = XMLoadFloat3(&up);
lookAtVector = XMLoadFloat3(&at);
return XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
}