@@ -53,6 +53,7 @@ Pixel Camera::castDebugRay(Ray ray, std::vector<DebugObject> particles) {
53
53
DebugObject *hit = &hitObject;
54
54
hit = nullptr ;
55
55
56
+ // Calculate hit for every object
56
57
for (int i = 0 ; i < particles.size (); i++) {
57
58
DebugObject &obj = particles.at (i);
58
59
double currDist = bestDistance;
@@ -119,6 +120,7 @@ Frame Camera::renderFrame(std::vector<ParticleObject> particles, int frameID) {
119
120
Vector3 vec_u = findSkalarVectorWithYZero (this ->direction ).normalize ();
120
121
Vector3 vec_v = findUpVector (this ->direction , vec_u).normalize ();
121
122
123
+ // Cast ray for every pixel
122
124
for (int x = 0 ; x < this ->width ; x++) {
123
125
for (int y = 0 ; y < this ->height ; y++) {
124
126
double u = l + (r - l) * (x + 0 .5f ) / this ->width ;
@@ -127,14 +129,23 @@ Frame Camera::renderFrame(std::vector<ParticleObject> particles, int frameID) {
127
129
Vector3 vec_s = vec_u * u + vec_v * v + this ->direction * d;
128
130
Ray ray = Ray (vec_s, this ->location );
129
131
130
-
132
+ // Set pixel color in Frame
131
133
frame.setPixel (x, y, castVolumeRay (ray, particles));
132
134
}
133
135
}
134
136
135
137
return frame;
136
138
}
137
139
140
+ void Camera::renderGeometryFrame (Terrain t) {
141
+ // TODO: implement rendering of the base Frame. See renderFrame(...) and castDebugRay(...)
142
+ Frame frame;
143
+
144
+
145
+
146
+ this ->baseFrame = frame;
147
+ }
148
+
138
149
void Camera::outputDebugFrame (Frame f, const char * fileName) {
139
150
writeFrameToBitmap (f, fileName, this ->width , this ->height );
140
151
}
0 commit comments