ProtoTracer  1.0
Real-time 3D rendering and animation engine
Loading...
Searching...
No Matches
Light.cpp
Go to the documentation of this file.
1#include "Light.h"
2
4 // Default constructor
5}
6
7Light::Light(Vector3D p, Vector3D intensity, float falloff, float a, float b)
8 : p(p), intensity(intensity), falloff(falloff), a(a), b(b) {
9}
10
11void Light::Set(Vector3D p, Vector3D intensity, float falloff, float a, float b) {
12 this->p = p;
13 this->intensity = intensity;
14 this->falloff = falloff;
15 this->a = a;
16 this->b = b;
17}
18
20 this->intensity = intensity;
21}
22
23void Light::SetFalloff(float falloff, float a, float b) {
24 this->falloff = falloff;
25 this->a = a;
26 this->b = b;
27}
28
30 this->p = p;
31}
32
34 this->p = this->p + p;
35}
36
37void Light::SetFalloff(float falloff) {
38 this->falloff = fabs(falloff);
39}
40
41void Light::SetCurve(float a, float b) {
42 this->a = a;
43 this->b = b;
44}
45
46
48 return p;
49}
50
54
56 return falloff;
57}
58
60 return a;
61}
62
64 return b;
65}
Defines the Light class for managing light sources in a 3D scene.
void Translate(Vector3D p)
Translates the light by a specified vector.
Definition Light.cpp:33
Vector3D intensity
Intensity vector of the light.
Definition Light.h:120
void SetCurve(float a, float b)
Sets the attenuation curve parameters for the light.
Definition Light.cpp:41
float a
Attenuation curve parameter A.
Definition Light.h:122
void SetIntensity(Vector3D intensity)
Sets the intensity of the light.
Definition Light.cpp:19
float GetCurveA()
Retrieves the first curve parameter for attenuation.
Definition Light.cpp:59
Light()
Default constructor for the Light class.
Definition Light.cpp:3
float GetFalloff()
Retrieves the falloff rate of the light.
Definition Light.cpp:55
float b
Attenuation curve parameter B.
Definition Light.h:123
Vector3D GetIntensity()
Retrieves the intensity of the light.
Definition Light.cpp:51
float GetCurveB()
Retrieves the second curve parameter for attenuation.
Definition Light.cpp:63
Vector3D GetPosition()
Retrieves the position of the light source.
Definition Light.cpp:47
void Set(Vector3D p, Vector3D intensity, float falloff, float a, float b)
Sets the light's properties.
Definition Light.cpp:11
void SetFalloff(float falloff, float a, float b)
Sets the falloff and attenuation parameters for the light.
Definition Light.cpp:23
float falloff
Falloff rate of the light.
Definition Light.h:121
Vector3D p
Position of the light source.
Definition Light.h:119
void MoveTo(Vector3D p)
Moves the light to a specified position.
Definition Light.cpp:29
Represents a 3D vector (X, Y, Z) and provides methods for vector arithmetic.
Definition Vector3D.h:26