aboutsummaryrefslogtreecommitdiff
path: root/src/render.cpp
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2021-01-14 00:56:57 +0100
committerJulian T <julian@jtle.dk>2021-01-14 00:56:57 +0100
commit57c2f9241543a7d18eab98077530730d49ee10c2 (patch)
tree9dcb819f6c89621f214346a3cbbc88762d05d831 /src/render.cpp
parent8251be3e7ec0e381391c951fd4c8f1ab8080bef9 (diff)
Replace color with pbr-book inspired Spectrum class
Diffstat (limited to 'src/render.cpp')
-rw-r--r--src/render.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/render.cpp b/src/render.cpp
index a81c6bb..286cbae 100644
--- a/src/render.cpp
+++ b/src/render.cpp
@@ -86,9 +86,9 @@ Ray Renderer::findray(double x, double y) const {
return Ray(m_eye, dir, true);
}
-Color Renderer::render(unsigned x, unsigned y, unsigned samples) {
+Spectrum Renderer::render(unsigned x, unsigned y, unsigned samples) {
- Color sum(0, 0, 0);
+ Spectrum sum;
for (unsigned i = 0; i < samples; i++) {
auto r = findray(x + m_random(), y + m_random());
@@ -98,20 +98,20 @@ Color Renderer::render(unsigned x, unsigned y, unsigned samples) {
if (samples < 2) {
return sum;
} else {
- return Vec3d(sum) / (double)samples;
+ return sum / (double)samples;
}
}
-Color Renderer::pathtrace_sample(const Ray &r, unsigned hop) {
+Spectrum Renderer::pathtrace_sample(const Ray &r, unsigned hop) {
if (hop >= m_maxhops) {
- return Color(0, 0, 0);
+ return Spectrum();
}
double dist;
auto res = cast_ray(r, 0, &dist);
if (!res) {
- return Color(0, 0, 0);
+ return Spectrum();
}
auto col = res->m_mat.emits();