-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathlight_game.cpp
More file actions
58 lines (48 loc) · 1.46 KB
/
Copy pathlight_game.cpp
File metadata and controls
58 lines (48 loc) · 1.46 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
#include "light_game.h"
#include "../framework/imgui/imgui.h"
AmbientLight GameLight::m_ambientLight(XMFLOAT4(0.55f, 0.55f, 0.55f, 1.0f));
PointLight* GameLight::m_pointLight = nullptr;
void GameLight::Init()
{
m_pointLight = new PointLight(
TRUE,
{ 0.0f, 4.0f, -4.0f, 1.0f },
{ 1.0f, 1.0f, 1.0f, 1.0f },
40.0f,
1.0f
);
m_pointLight->Apply(m_ambientLight);
}
void GameLight::Finalize()
{
SAFE_DELETE(m_pointLight);
}
void GameLight::Update()
{
//if (m_pointLight) m_pointLight->Apply(m_ambientLight);
}
void GameLight::Draw()
{
#ifdef _DEBUG
if (!m_pointLight) return;
XMFLOAT4 lightPosition = m_pointLight->GetPosition();
XMFLOAT4 lightDiffuse = m_pointLight->GetDiffuse();
XMFLOAT4 ambientColor = m_ambientLight.GetColor();
float lightRange = m_pointLight->GetRange();
float lightIntensity = m_pointLight->GetIntensity();
//ライトのパラメータ
/*ImGui::Begin("Game PBR Light");
ImGui::DragFloat3("Light Pos", &lightPosition.x, 0.1f, -50.0f, 50.0f);
ImGui::SliderFloat("Light Range", &lightRange, 1.0f, 100.0f);
ImGui::SliderFloat("Light Intensity", &lightIntensity, 0.0f, 5.0f);
ImGui::ColorEdit3("Light Color", &lightDiffuse.x);
ImGui::ColorEdit3("Ambient", &ambientColor.x);
ImGui::End();*/
m_pointLight->SetPosition(lightPosition);
m_pointLight->SetDiffuse(lightDiffuse);
m_pointLight->SetRange(lightRange);
m_pointLight->SetIntensity(lightIntensity);
m_ambientLight.SetColor(ambientColor);
m_pointLight->Apply(m_ambientLight);
#endif
}