-
Notifications
You must be signed in to change notification settings - Fork 1
/
light.h
50 lines (40 loc) · 1.04 KB
/
light.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
43
44
45
46
47
48
49
50
#ifndef LIGHT_H
#define LIGHT_H
#include <iostream>
#include <cmath>
#include <vector>
#include "vector.h"
#include "ray.h"
#include "color.h"
#include "localgeo.h"
using namespace std;
class Light {
public:
Vector pos;
Color color;
int type; /* 0 for directional, 1 for point light */
/* This is an abstract class that will generate a ray starting from
* the position stored in local to the position of the light source.
* For directional light, the origin of the ray is the same, and the
* ray points to the light direction, however, t_max is infinity.*/
void generateLightRay(LocalGeo&, Ray*, Color*);
void print();
};
class DirLight : public Light {
// the pos vector is the direction
public:
DirLight(Vector, Color);
};
class PointLight : public Light {
//for point light the pos is the position of the light
public:
float falloff;
PointLight(Vector, Color);
PointLight(Vector, Color, float);
};
class AmbientLight : public Light {
public:
AmbientLight();
AmbientLight(Color);
};
#endif