Ray Tracer Common Project
Image rendering program based on the ray tracing technique.
photon.hpp
1 
15 #pragma once
16 #include "core/color.hpp"
17 
18 namespace rt{
19 
28 class photon{
29 public:
33  photon();
34 
38  photon(const photon &);
39 
44  photon(const rt::color & clr, double e = 1.0);
45 
52  photon(double r, double g, double b, double e = 1.0);
53 
57  inline const rt::color & color() const{
58  return _color;
59  }
60 
68  double energy() const;
69 
73  void operator+=(const photon &);
74 
79  photon operator+(const photon &) const;
80 
84  void operator*=(const rt::color &);
85 
90  photon operator*(const rt::color &) const;
91 
96  void operator*=(double f);
97 
103  photon operator*(double f) const;
104 
109  operator bool() const;
110 
111 private:
112  rt::color _color;
113  double _e;
114 };
115 
122 photon operator*(double f, const photon & p);
123 
130 photon operator*(const color & c, const photon & p);
131 
132 }
photon operator+(const photon &) const
Additive synthesys with another photon.
Definition: photon.cpp:56
Definition: bitmap.cpp:4
void operator*=(const rt::color &)
Make a color absorb a photon.
Definition: photon.cpp:46
RGBA color representation.
Definition: color.hpp:31
void operator+=(const photon &)
Additive synthesys with another photon.
Definition: photon.cpp:32
const rt::color & color() const
Photon color.
Definition: photon.hpp:57
double energy() const
Photon energy.
Definition: photon.cpp:24
photon()
Create a new null photon (with no energy).
Definition: photon.cpp:6
photon operator*(const rt::color &) const
Make a color absorb a photon.
Definition: photon.cpp:62
Light photon class.
Definition: photon.hpp:28
color operator*(double f, const color &c)
Same as color::operator*(double).