-
Notifications
You must be signed in to change notification settings - Fork 4
/
struct.h
116 lines (102 loc) · 2.39 KB
/
struct.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "vector.h"
#ifndef _STRUCT_
#define _STRUCT_
namespace entities
{
class Light
{
public:
float _red;
float _green;
float _blue;
Light(float red, float green, float blue);
const Light& operator+=(const Light& rhs )
{
_red += rhs._red;
_green += rhs._green;
_blue += rhs._blue;
return *this;
}
const Light& operator-=(const Light& rhs )
{
_red -= rhs._red;
_green -= rhs._green;
_blue -= rhs._blue;
return *this;
}
};
/**
* Color is a normalized structure for rgb color
*/
class Color
{
public:
float _red;
float _green;
float _blue;
Color();
Color(double*, double*, double*);
Color(const Color&);
Color(float*);
~Color();
const Color& operator+=(const Color& rhs );
const Color& operator-=(const Color& rhs );
friend std::ostream& operator<<(std::ostream& os, const Color& color);
bool isBlack();
};
/**
* Flow of certain color through space at a certain intensity
*/
class Flux
{
private:
Color * _color;
public:
Flux(double, double, double);
Flux(const Color& color);
Flux();
float getRedFlux() const;
float getGreenFlux() const;
float getBlueFlux() const;
void setRedFlux(float);
void setGreenFlux(float);
void setBlueFlux(float);
void incrementFlux(float, float, float);
friend std::ostream& operator<<(std::ostream& os, const Flux& flux);
const Flux& operator+=(const Flux& other);
const Flux& operator/=(int other);
};
class Patch
{
public:
Color * _reflectance;
vecmath::Point * _center;
vecmath::Vector * _normal;
vecmath::Vector * _up;
int _numVerts;
vecmath::Point * _vertices;
Flux * _incident;
Flux * _excident;
Patch();
Patch(vecmath::Point * center, vecmath::Vector * normal, vecmath::Vector * up, Color * reflectance);
Patch(vecmath::Point * center, vecmath::Vector * normal, vecmath::Vector * up, Color * reflectance, vecmath::Point * vertices, int numVerts);
};
class LightPatch: public Patch
{
public:
Color * _emission;
LightPatch();
LightPatch(vecmath::Point * center, vecmath::Vector * normal, vecmath::Vector * up, Color * reflectance, Color * emitter, vecmath::Point * vertices, int numVerts);
};
struct Hemicube
{
unsigned char * _left;
unsigned char * _right;
unsigned char * _top;
unsigned char * _bottom;
unsigned char * _front;
~Hemicube();
};
}
#else
#endif