1 #ifndef PHOTON_HXX
2 #define PHOTON_HXX
3
4 #include "Vec3f.hxx"
5 #include "TravellingPhoton.hxx"
6
7 class Photon
8 {
9 public:
10 Vec3f energy, // Energy of the Photon
11 point, // Hit point on the surface
12 dir; // Incident direction
13
14 Photon()
15 : energy(Vec3f(0.0f)), point(Vec3f(0.0f)), dir(Vec3f(0.0))
16 {};
17
18 Photon(Vec3f energy, Vec3f point, Vec3f dir)
19 : energy(energy), point(point), dir(dir)
20 {};
21
22 Photon(TravellingPhoton tphoton)
23 : energy(tphoton.energy), point(tphoton.org), dir(tphoton.dir)
24 {};
25
26 // Build a new photon out of a serialized memory range
27 Photon(char *pointer)
28 {
29 memmove(&energy, pointer, 3 * sizeof(Vec3f));
30 }
31
32 void Serialize(char *pointer)
33 {
34 // Assuming the Vec3fs are sored adjecently, this does the job
35 memmove(pointer, &energy, 3 * sizeof(Vec3f));
36 }
37 };
38
39 #endif
syntax highlighted by Code2HTML, v. 0.9.1