From 58d5124a05c7fa205cefdd5216ef62da1be6477a Mon Sep 17 00:00:00 2001 From: Person Date: Tue, 17 Mar 2020 07:16:14 -0700 Subject: [PATCH] --Bug fixes -Previous commit removing a field ruined strips renders. --- Source/Ember/Ember.h | 4 ++++ Source/Ember/Renderer.cpp | 8 ++++---- Source/Ember/XmlToEmber.cpp | 2 ++ Source/EmberCL/RendererCL.cpp | 2 +- Source/Fractorium/FractoriumParams.cpp | 6 +++--- Source/Fractorium/GLWidget.cpp | 2 +- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Source/Ember/Ember.h b/Source/Ember/Ember.h index 818eb29..c44b1be 100644 --- a/Source/Ember/Ember.h +++ b/Source/Ember/Ember.h @@ -126,6 +126,7 @@ public: m_CamMat = ember.m_CamMat; m_CenterX = T(ember.m_CenterX); m_CenterY = T(ember.m_CenterY); + m_RotCenterY = T(ember.m_RotCenterY); m_Rotate = T(ember.m_Rotate); m_Brightness = T(ember.m_Brightness); m_Gamma = T(ember.m_Gamma); @@ -1403,6 +1404,7 @@ public: m_Palette.m_Index = -1; m_CenterX = 0; m_CenterY = 0; + m_RotCenterY = 0; m_Gamma = 4; m_Vibrancy = 1; m_Brightness = 4; @@ -1537,6 +1539,7 @@ public: << "Depth Blur: " << m_CamDepthBlur << "\n" << "CenterX: " << m_CenterX << "\n" << "CenterY: " << m_CenterY << "\n" + << "RotCenterY: " << m_RotCenterY << "\n" << "Rotate: " << m_Rotate << "\n" << "Brightness: " << m_Brightness << "\n" << "Gamma: " << m_Gamma << "\n" @@ -1677,6 +1680,7 @@ public: //Xml field: "center". T m_CenterX = 0; T m_CenterY = 0; + T m_RotCenterY = 0; //Rotate the camera by this many degrees. Since this is a camera rotation, the final output image will be rotated counter-clockwise. //Xml field: "rotate". diff --git a/Source/Ember/Renderer.cpp b/Source/Ember/Renderer.cpp index becc656..3867eb9 100644 --- a/Source/Ember/Renderer.cpp +++ b/Source/Ember/Renderer.cpp @@ -1527,9 +1527,9 @@ void Renderer::Accumulate(QTIsaac& rand, Poin if (Rotate() != 0) { T p00 = p.m_X - m_Ember.m_CenterX; - T p11 = p.m_Y - m_Ember.m_CenterY; + T p11 = p.m_Y - m_Ember.m_RotCenterY; p.m_X = (p00 * m_RotMat.A()) + (p11 * m_RotMat.B()) + m_Ember.m_CenterX; - p.m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + m_Ember.m_CenterY; + p.m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + m_Ember.m_RotCenterY; } //Checking this first before converting gives better performance than converting and checking a single value, which the original did. @@ -1600,9 +1600,9 @@ void Renderer::Accumulate(QTIsaac& rand, Poin if (Rotate() != 0) { T p00 = p.m_X - m_Ember.m_CenterX; - T p11 = p.m_Y - m_Ember.m_CenterY; + T p11 = p.m_Y - m_Ember.m_RotCenterY; p.m_X = (p00 * m_RotMat.A()) + (p11 * m_RotMat.B()) + m_Ember.m_CenterX; - p.m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + m_Ember.m_CenterY; + p.m_Y = (p00 * m_RotMat.D()) + (p11 * m_RotMat.E()) + m_Ember.m_RotCenterY; } if (m_CarToRas.InBounds(p)) diff --git a/Source/Ember/XmlToEmber.cpp b/Source/Ember/XmlToEmber.cpp index 02d4a6e..eba3c40 100644 --- a/Source/Ember/XmlToEmber.cpp +++ b/Source/Ember/XmlToEmber.cpp @@ -1379,6 +1379,7 @@ bool XmlToEmber::ParseEmberElementFromChaos(xmlNode* emberNode, Ember& cur istringstream istr(pos); istr >> currentEmber.m_CenterX >> currentEmber.m_CenterY; currentEmber.m_CenterY *= -1; + currentEmber.m_RotCenterY = currentEmber.m_CenterY; } else { @@ -1668,6 +1669,7 @@ bool XmlToEmber::ParseEmberElement(xmlNode* emberNode, Ember& currentEmber { istringstream is(attStr); is >> currentEmber.m_CenterX >> currentEmber.m_CenterY; + currentEmber.m_RotCenterY = currentEmber.m_CenterY; } else if (!Compare(curAtt->name, "filter_shape")) { diff --git a/Source/EmberCL/RendererCL.cpp b/Source/EmberCL/RendererCL.cpp index a95fa63..fbb8e9b 100644 --- a/Source/EmberCL/RendererCL.cpp +++ b/Source/EmberCL/RendererCL.cpp @@ -1837,7 +1837,7 @@ void RendererCL::ConvertEmber(Ember& ember, EmberCL& emberCL, emberCL.m_BlurCoef = ember.BlurCoef(); emberCL.m_CamMat = ember.m_CamMat; emberCL.m_CenterX = ember.m_CenterX; - emberCL.m_CenterY = ember.m_CenterY; + emberCL.m_CenterY = ember.m_RotCenterY; emberCL.m_RotA = m_RotMat.A(); emberCL.m_RotB = m_RotMat.B(); emberCL.m_RotD = m_RotMat.D(); diff --git a/Source/Fractorium/FractoriumParams.cpp b/Source/Fractorium/FractoriumParams.cpp index e70b687..fe538e0 100644 --- a/Source/Fractorium/FractoriumParams.cpp +++ b/Source/Fractorium/FractoriumParams.cpp @@ -369,7 +369,7 @@ template void FractoriumEmberController::CenterYChanged(double d { UpdateAll([&](Ember& ember, bool isMain) { - ember.m_CenterY = d; + ember.m_CenterY = ember.m_RotCenterY = d; }, true, eProcessAction::FULL_RENDER, m_Fractorium->ApplyAll()); } void Fractorium::OnCenterYChanged(double d) { m_Controller->CenterYChanged(d); } @@ -772,7 +772,7 @@ void FractoriumEmberController::SetCenter(double x, double y) UpdateAll([&](Ember& ember, bool isMain) { ember.m_CenterX = x; - ember.m_CenterY = y; + ember.m_CenterY = ember.m_RotCenterY = y; }, true, eProcessAction::FULL_RENDER, m_Fractorium->ApplyAll()); m_Fractorium->m_CenterXSpin->SetValueStealth(x);//Don't trigger a redraw twice. m_Fractorium->m_CenterYSpin->SetValueStealth(y); @@ -873,7 +873,7 @@ void FractoriumEmberController::ParamsToEmberPrivate(Ember& ember, bool im ember.m_FinalRasW = m_Fractorium->m_WidthSpin->value();//Geometry. ember.m_FinalRasH = m_Fractorium->m_HeightSpin->value(); ember.m_CenterX = m_Fractorium->m_CenterXSpin->value(); - ember.m_CenterY = m_Fractorium->m_CenterYSpin->value(); + ember.m_CenterY = ember.m_RotCenterY = m_Fractorium->m_CenterYSpin->value(); ember.m_PixelsPerUnit = m_Fractorium->m_ScaleSpin->value(); ember.m_Zoom = m_Fractorium->m_ZoomSpin->value(); ember.m_Rotate = m_Fractorium->m_RotateSpin->value(); diff --git a/Source/Fractorium/GLWidget.cpp b/Source/Fractorium/GLWidget.cpp index 889893b..4dda77d 100644 --- a/Source/Fractorium/GLWidget.cpp +++ b/Source/Fractorium/GLWidget.cpp @@ -1043,7 +1043,7 @@ void GLEmberController::MouseMove(QMouseEvent* e) v2T v1(x, y); v2T v2 = rotMat.TransformVector(v1); ember->m_CenterX = v2.x; - ember->m_CenterY = v2.y; + ember->m_CenterY = ember->m_RotCenterY = v2.y; m_FractoriumEmberController->SetCenter(ember->m_CenterX, ember->m_CenterY);//Will restart the rendering process. } else if (m_DragState == eDragState::DragRotateScale)//Rotating and scaling the whole image.