diff options
author | Julian T <julian@jtle.dk> | 2021-01-14 00:56:57 +0100 |
---|---|---|
committer | Julian T <julian@jtle.dk> | 2021-01-14 00:56:57 +0100 |
commit | 57c2f9241543a7d18eab98077530730d49ee10c2 (patch) | |
tree | 9dcb819f6c89621f214346a3cbbc88762d05d831 /app/rendercoord.cpp | |
parent | 8251be3e7ec0e381391c951fd4c8f1ab8080bef9 (diff) |
Replace color with pbr-book inspired Spectrum class
Diffstat (limited to 'app/rendercoord.cpp')
-rw-r--r-- | app/rendercoord.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/app/rendercoord.cpp b/app/rendercoord.cpp index 00a6437..4abc5d0 100644 --- a/app/rendercoord.cpp +++ b/app/rendercoord.cpp @@ -8,13 +8,13 @@ #include <render.hpp> #include <sstream> -uint32_t colorToUint32(const Color &c) { - Color cnew = Color(c); - cnew.clamp(); +uint32_t colorToUint32(const Spectrum &c) { + Spectrum cnew = c.clamp(0, 1); + cnew *= 255; return (0xFF << 24) + - (cnew.r() << 16) + - (cnew.g() << 8) + - cnew.b(); + ((int)cnew.R() << 16) + + ((int)cnew.G() << 8) + + cnew.B(); } // Run by main thread @@ -36,7 +36,7 @@ void RenderThread::run() { m_work.acquire(); // Very expensive, but necesary to get live rendering - Color *sum = new Color[m_render.m_width * m_render.m_height]; + Spectrum *sum = new Spectrum[m_render.m_width * m_render.m_height]; m_current_samples = 0; |