-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPointLight.h
More file actions
49 lines (39 loc) · 1.23 KB
/
PointLight.h
File metadata and controls
49 lines (39 loc) · 1.23 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
// ----------------------------------------------------------------------------------------------------
//
// File name: PointLight.h
// Created By: Haard Panchal
// Create Date: 03/16/2020
//
// Description:
// File has the definition and implementation of the PointLight class
// The point light disperses ray from a single point p_0
//
// History:
// 03/16/19: H. Panchal Created the file
//
// Declaration:
//
// ----------------------------------------------------------------------------------------------------
#ifndef POINTLIGHTH
#define POINTLIGHTH
#include "Vector3.h"
#include "Light.h"
class PointLight: public Light {
private:
Vector3 p_0; // Position of the light
public:
__device__ PointLight();
__device__ PointLight(Vector3& position);
__device__ ~PointLight();
__device__ Vector3 getLightAtPoint(Vector3& point);
__device__ Vector3 getLightPosition() { return p_0; }
};
__device__ PointLight::PointLight() {}
__device__ PointLight::PointLight(Vector3& position) : p_0(position) {}
__device__ PointLight::~PointLight() {}
__device__ Vector3 PointLight::getLightAtPoint(Vector3& point) {
Vector3 p = point - p_0;
p.make_unit_vector();
return p;
}
#endif