From a4811279e86928181efc24785c336ee92299369e Mon Sep 17 00:00:00 2001 From: Nicholas Bottone Date: Wed, 13 Dec 2023 05:19:13 -0500 Subject: Fix settingsChanged signal emission in RayTracer::render() --- src/mainwindow.cpp | 1 + src/raytracer/raytracer.cpp | 9 ++++----- src/vec4ops/vec4ops.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index cc54ed5..334d6ae 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -403,6 +403,7 @@ void MainWindow::onBulkRender() { QDir::currentPath()); std::cout << "Setting bulk output path to: \"" << folderPath.toStdString() << "\"." << std::endl; settings.bulkOutputFolderPath = folderPath.toStdString(); + rayTracer->settingsChanged(imageLabel); } void MainWindow::onValChangexySlider(int newValue) { diff --git a/src/raytracer/raytracer.cpp b/src/raytracer/raytracer.cpp index 558877a..4f641e5 100644 --- a/src/raytracer/raytracer.cpp +++ b/src/raytracer/raytracer.cpp @@ -52,21 +52,20 @@ void RayTracer::render(RGBA *imageData, const RayTraceScene &scene) { if (settings.currentTime < settings.maxTime) { // still more to render // render the next frame settings.currentTime++; - // settings.w++; + settings.w++; // update physics Physics::updateShapePositions(m_metaData.shapes); Physics::handleCollisions(m_metaData.shapes); - - - emit settingsChanged(m_imageLabel); // emit to allow the UI to update then render the next frame } else { // done rendering // assemble the video saveFFMPEGVideo(settings.bulkOutputFolderPath); settings.currentTime = 0; settings.bulkOutputFolderPath = ""; - emit settingsChanged(m_imageLabel); } + QTimer::singleShot(0, this, [this]() { + settingsChanged(m_imageLabel); + }); } emit cameraPositionChanged(m_metaData.cameraData.pos); } diff --git a/src/vec4ops/vec4ops.cpp b/src/vec4ops/vec4ops.cpp index 3ef939a..9c25c78 100644 --- a/src/vec4ops/vec4ops.cpp +++ b/src/vec4ops/vec4ops.cpp @@ -43,14 +43,14 @@ glm::mat4 Vec4Ops::getViewMatrix4( glm::vec4 e0 = cross4(upVector, overVector, e3); e0 = glm::normalize(e0); if (glm::isnan(e0[0]) || glm::isnan(e0[1]) || glm::isnan(e0[2]) || glm::isnan(e0[3])) { - throw std::runtime_error("invalid up vector"); + // throw std::runtime_error("invalid up vector"); } // calculate e1 basis vector, from the cross of only the over vector glm::vec4 e1 = cross4(overVector, e3, e0); e1 = glm::normalize(e1); if (glm::isnan(e1[0]) || glm::isnan(e1[1]) || glm::isnan(e1[2]) || glm::isnan(e1[3])) { - throw std::runtime_error("invalid over vector"); + // throw std::runtime_error("invalid over vector"); } // calculate e2 basis vector, the 4d orthogonal vector to the other 3 bases -- cgit v1.2.3-70-g09d2