From 0a3b6206dffe1b4632cdc484a4bd021f165ee87a Mon Sep 17 00:00:00 2001 From: Giulio M <1172898+giuliom@users.noreply.github.com> Date: Wed, 24 Jul 2024 14:05:00 +0100 Subject: [PATCH] Added Color on QT side --- BasicRenderer/source/ImageExporter.cpp | 4 ++-- QtGUI/QRenderingWidget.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BasicRenderer/source/ImageExporter.cpp b/BasicRenderer/source/ImageExporter.cpp index 82d432b..b4526eb 100644 --- a/BasicRenderer/source/ImageExporter.cpp +++ b/BasicRenderer/source/ImageExporter.cpp @@ -92,9 +92,9 @@ namespace BasicRenderer //BGR uint32_t index = (height - j - 1) * width + i; Color c = cBuf[index]; - bmpData.emplace_back((uint8_t)(c.r * 255.999f)); - bmpData.emplace_back((uint8_t)(c.g * 255.999f)); bmpData.emplace_back((uint8_t)(c.b * 255.999f)); + bmpData.emplace_back((uint8_t)(c.g * 255.999f)); + bmpData.emplace_back((uint8_t)(c.r * 255.999f)); } uint32_t padding = bmpData.size() % 4; diff --git a/QtGUI/QRenderingWidget.cpp b/QtGUI/QRenderingWidget.cpp index 24eb65a..2c01ee0 100644 --- a/QtGUI/QRenderingWidget.cpp +++ b/QtGUI/QRenderingWidget.cpp @@ -239,9 +239,9 @@ void QRenderingWidget::CopyFrameBufferToQImage(QImage& img, const FrameBuffer& f for (uint i = 0; i < size; ++i) { uint ua = 255u << 24; - ua |= static_cast(c[i].x * 255.999f) << 16; - ua |= static_cast(c[i].y * 255.999f) << 8; - ua |= static_cast(c[i].z * 255.999f); + ua |= static_cast(c[i].r * 255.999f) << 16; + ua |= static_cast(c[i].g * 255.999f) << 8; + ua |= static_cast(c[i].b * 255.999f); rgb[i] = ua; }