-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointLight.h
More file actions
29 lines (27 loc) · 763 Bytes
/
PointLight.h
File metadata and controls
29 lines (27 loc) · 763 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
#pragma once
#include "Graphics.h"
#include "ConstantBuffer.h"
#include "SolidSphere.h"
class PointLight
{
public:
PointLight(Graphics& gfx, float radius = 0.5f);
void SpawnControlWindow() noexcept;
void Reset() noexcept;
void Draw(Graphics& gfx) const noexcept(!IS_DEBUG);
void Bind(Graphics& gfx, DirectX::FXMMATRIX view) const noexcept;
private:
struct PointLightConstantBuf {
alignas(16)DirectX::XMFLOAT3 pos;
alignas(16)DirectX::XMFLOAT3 diffuseColor;
alignas(16)DirectX::XMFLOAT3 ambientColor;
float diffuseIntensity;
float constAttenuation;
float linearAuttenuation;
float quadraticAuttenuation;
};
private:
PointLightConstantBuf cbData;
mutable SolidSphere modelMesh;
mutable PixelConstantBuffer<PointLightConstantBuf> cbuf;
};