aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/main.cpp11
-rw-r--r--app/rendercoord.cpp14
2 files changed, 13 insertions, 12 deletions
diff --git a/app/main.cpp b/app/main.cpp
index ebb0536..0455ba7 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -4,6 +4,7 @@
#include "mainwindow.hpp"
#include <core/vector.hpp>
+#include <core/spectrum.hpp>
#include <scene.hpp>
#include <render.hpp>
#include <object.hpp>
@@ -23,11 +24,11 @@ int main(int argc, char *argv[])
conf.m_workers = 4;
- Material blue(Color(0.3, 0.3, 1), 1);
- Material green(Color(0.3, 1, 0.3), 0, 1, 50);
- Material red(Color(1, 0.3, 0.3), 1);
- Material white(Color(1, 1, 1), 1);
- Material em(Color(1, 1, 1), 0, 0, 0, 2);
+ Material blue(Spectrum::FromRGB(0.3, 0.3, 1), 1);
+ Material green(Spectrum::FromRGB(0.3, 1, 0.3), 0, 1, 50);
+ Material red(Spectrum::FromRGB(1, 0.3, 0.3), 1);
+ Material white(Spectrum::FromRGB(1, 1, 1), 1);
+ Material em(Spectrum::FromRGB(1, 1, 1), 0, 0, 0, 2);
scn.addShape(new Sphere(red, Vec3d(2, 6, -1), 1));
scn.addShape(new Sphere(green, Vec3d(0, 4, -1), 1.3));
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;