aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNicholas Bottone <nick@bottone.io>2023-12-13 05:19:13 -0500
committerNicholas Bottone <nick@bottone.io>2023-12-13 05:19:13 -0500
commita4811279e86928181efc24785c336ee92299369e (patch)
tree373414e4182a2861556ceee6d48914c2dd6d325a /src
parentadc6d81d78b3ae24ae16c9d233864432ec09a4cb (diff)
Fix settingsChanged signal emission in RayTracer::render()
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp1
-rw-r--r--src/raytracer/raytracer.cpp9
-rw-r--r--src/vec4ops/vec4ops.cpp4
3 files changed, 7 insertions, 7 deletions
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