-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRenderer.h
More file actions
72 lines (54 loc) · 1.33 KB
/
Renderer.h
File metadata and controls
72 lines (54 loc) · 1.33 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include <vector>
struct SDL_Window;
struct SDL_Surface;
namespace dae
{
class Scene;
class Material;
struct Ray;
struct Vector2;
struct Vector3;
struct Matrix;
struct Camera;
struct ColorRGB;
class Renderer final
{
public:
Renderer(SDL_Window* pWindow);
~Renderer() = default;
Renderer(const Renderer&) = delete;
Renderer(Renderer&&) noexcept = delete;
Renderer& operator=(const Renderer&) = delete;
Renderer& operator=(Renderer&&) noexcept = delete;
void Render(Scene* pScene) const;
bool SaveBufferToImage() const;
void CycleLightingMode();
void ToggleShadows() { m_ShadowsEnabled = !m_ShadowsEnabled; }
private:
Vector3 GetRayDirection(float x, float y, Camera* pCamera) const;
void RenderPixel(Scene* pScene, const Vector2& rayLocation) const;
void SetupPixelIndices();
SDL_Window* m_pWindow{};
SDL_Surface* m_pBuffer{};
uint32_t* m_pBufferPixels{};
uint32_t m_amountOfPixels{};
std::vector<Vector2> m_PixelIndices{};
float m_AspectRatio{};
static constexpr float m_RayOffset{ 0.001f };
int m_Width{};
int m_Height{};
enum class LightingMode
{
ObservedArea,
Radiance,
BRDF,
Combined,
//@end
COUNT
};
bool m_ShadowsEnabled{ true };
LightingMode m_LightingMode{ LightingMode::Combined };
constexpr int static m_ThreadCount{ 8 };
};
}