-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFilm.cpp
43 lines (37 loc) · 780 Bytes
/
Film.cpp
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
/*
* Film.cpp
*
* Created on: Dec 7, 2013
* Author: Owner
*/
#include "Film.h"
Film::Film() {
imgWidth = 640;
imgHeight = 480;
}
Film::Film(float x, float y) {
imgWidth = x;
imgHeight = y;
}
void Film::commitSample(Sample s) {
pixelRGBAs.push_back(s.colorVals.getX());
pixelRGBAs.push_back(s.colorVals.getY());
pixelRGBAs.push_back(s.colorVals.getZ());
pixelRGBAs.push_back(s.opacity);
}
float* Film::getBMP() {
return &(pixelRGBAs[0]);
}
void Film::renderScene(Camera &c, float stepSize) {
Sampler sampler = Sampler(c);
Sample s;
while (sampler.hasNext()) {
sampler.next();
if (sampler.getSample().x < 300 && sampler.getSample().y > 100) {
commitSample(Sample());
continue;
}
s = sampler.getPixelRGBA(stepSize);
commitSample(s);
}
}