-
Notifications
You must be signed in to change notification settings - Fork 0
/
LightSources.h
43 lines (36 loc) · 957 Bytes
/
LightSources.h
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
#pragma once
namespace Tmpl8 {
class LightSource
{
public:
LightSource(vec3 position, vec4 color, int intensity);
int id;
vec3 position;
vec4 color;
int intensity;
virtual void intersect(Ray* ray) = 0;
virtual vec3 getRandomPointOnLight(std::mt19937 randomNumbersGenerator) = 0;
virtual vec3 getNormal(vec3 point) = 0;
virtual float getArea() = 0;
};
class DirectLight : public LightSource
{
public:
DirectLight(vec3 position, vec4 color, int intensity);
void intersect(Ray* ray);
vec3 getRandomPointOnLight(std::mt19937 randomNumbersGenerator);
vec3 getNormal(vec3 point);
float getArea();
};
class SphericalLight : public LightSource
{
public:
SphericalLight(vec3 position, float radius, vec4 color, int intensity);
void intersect(Ray* ray);
vec3 getRandomPointOnLight(std::mt19937 randomNumbersGenerator);
vec3 getNormal(vec3 point);
float getArea();
private:
float radius, radius2, area;
};
}