aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-08-11 21:21:02 +0200
committerJulian T <julian@jtle.dk>2020-08-11 21:21:02 +0200
commit690b72664ca8d471f5c117f6ed87aeae2de0a208 (patch)
tree8bc30efc009462d4390ac6eb8fe28ccbdbbd88a1 /app
parent3b8893902ac5f529faf15accaa3fb5360771d3b3 (diff)
Defuse coloring
Diffstat (limited to 'app')
-rw-r--r--app/main.cpp21
-rw-r--r--app/rendercoord.cpp2
2 files changed, 14 insertions, 9 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 64e413a..e174d4d 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -14,16 +14,21 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Scene scn;
- scn.addShape(new Sphere(Vec3d(2, 6, -1), 1));
- scn.addShape(new Sphere(Vec3d(0, 4, -1), 1.3));
- scn.addShape(new Sphere(Vec3d(-2, 5, -2), 1.3));
+
+ Material blue(Color(0.3, 0.3, 1), 1);
+ Material red(Color(1, 0.3, 0.3), 1);
+ Material white(Color(1, 1, 1), 1);
+
+ scn.addShape(new Sphere(blue, Vec3d(2, 6, -1), 1));
+ scn.addShape(new Sphere(white, Vec3d(0, 4, -1), 1.3));
+ scn.addShape(new Sphere(white, Vec3d(-2, 5, -2), 1.3));
//scn.addShape(new Sphere(Vec3d(0, 7, 0), 0.5));
- scn.addShape(new Plane(Vec3d(0, 0, 0), Vec3d(0, 1, 0)));
- scn.addShape(new Plane(Vec3d(0, 10, 0), Vec3d(0, 1, 0)));
- scn.addShape(new Plane(Vec3d(0, 0, -5), Vec3d(0, 0, 1)));
- scn.addShape(new Plane(Vec3d(-5, 0, 0), Vec3d(1, 0, 0)));
- scn.addShape(new Plane(Vec3d(5, 0, 0), Vec3d(1, 0, 0)));
+ scn.addShape(new Plane(white, Vec3d(0, 0, 0), Vec3d(0, 1, 0)));
+ scn.addShape(new Plane(white, Vec3d(0, 10, 0), Vec3d(0, 1, 0)));
+ scn.addShape(new Plane(white, Vec3d(0, 0, -5), Vec3d(0, 0, 1)));
+ scn.addShape(new Plane(red, Vec3d(-5, 0, 0), Vec3d(1, 0, 0)));
+ scn.addShape(new Plane(blue, Vec3d(5, 0, 0), Vec3d(1, 0, 0)));
Renderer render(scn, Vec3d(0, 5, 4), Vec3d(0, 5, 0), 500, 500);
diff --git a/app/rendercoord.cpp b/app/rendercoord.cpp
index 8db7c97..f9fc9f8 100644
--- a/app/rendercoord.cpp
+++ b/app/rendercoord.cpp
@@ -30,7 +30,7 @@ void RenderThread::run() {
for (unsigned x = 0; x < m_render.m_width; x++) {
for (unsigned y = 0; y < m_render.m_height; y++) {
- auto c = m_render.render(x, y);
+ auto c = m_render.render(m_render.m_width - x, m_render.m_height - y);
m_writebuffer[x + y * m_render.m_height] =
static_cast<QRgb>(colorToUint32(c));
}