From 57c2f9241543a7d18eab98077530730d49ee10c2 Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 14 Jan 2021 00:56:57 +0100 Subject: Replace color with pbr-book inspired Spectrum class --- src/render.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/render.cpp') 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(); -- cgit v1.2.3