include/svx/viewpt3d.hxx | 30 ++++++------- svx/source/engine3d/camera3d.cxx | 2 svx/source/engine3d/viewpt3d2.cxx | 86 +++++++++++++++++++------------------- 3 files changed, 59 insertions(+), 59 deletions(-)
New commits: commit ac90d5a823ef95617e79f78dd83571b26f9ff662 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Oct 21 08:19:23 2024 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon Oct 21 11:28:48 2024 +0200 svx: prefix members of Viewport3D See tdf#94879 for motivation. Change-Id: Ice9c1353d3411146f11d4ca34eb6369403cd4094 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/175294 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins diff --git a/include/svx/viewpt3d.hxx b/include/svx/viewpt3d.hxx index 5d7856bd9ab0..06b808326f2d 100644 --- a/include/svx/viewpt3d.hxx +++ b/include/svx/viewpt3d.hxx @@ -47,24 +47,24 @@ enum class ProjectionType { Parallel, Perspective }; class SVXCORE_DLLPUBLIC Viewport3D { protected: - basegfx::B3DHomMatrix aViewTf; // the real transformations matrix - basegfx::B3DPoint aVRP; // View Reference Point - basegfx::B3DVector aVPN; // View Plane Normal - basegfx::B3DVector aVUV; // View Up Vector - basegfx::B3DPoint aPRP; // Projection Reference Point(View-coordinates) + basegfx::B3DHomMatrix m_aViewTf; // the real transformations matrix + basegfx::B3DPoint m_aVRP; // View Reference Point + basegfx::B3DVector m_aVPN; // View Plane Normal + basegfx::B3DVector m_aVUV; // View Up Vector + basegfx::B3DPoint m_aPRP; // Projection Reference Point(View-coordinates) // up to now only the z-coordinate is considered - ProjectionType eProjection; // kind of the projection - tools::Rectangle aDeviceRect; // position and size of the output area + ProjectionType m_eProjection; // kind of the projection + tools::Rectangle m_aDeviceRect; // position and size of the output area struct { double X, Y, W, H; // position and size of the view window - } aViewWin; // in view coordinates + } m_aViewWin; // in view coordinates - basegfx::B3DPoint aViewPoint; //observers position in world coordinates; + basegfx::B3DPoint m_aViewPoint; //observers position in world coordinates; // is calculated by the transformation - bool bTfValid; // flag, if transformation is valid + bool m_bTfValid; // flag, if transformation is valid public: Viewport3D(); @@ -74,17 +74,17 @@ class SVXCORE_DLLPUBLIC Viewport3D void SetVUV(const basegfx::B3DVector& rNewVUV); void SetPRP(const basegfx::B3DPoint& rNewPRP); - const basegfx::B3DPoint& GetVRP() const { return aVRP; } - const basegfx::B3DVector& GetVUV() const { return aVUV; } + const basegfx::B3DPoint& GetVRP() const { return m_aVRP; } + const basegfx::B3DVector& GetVUV() const { return m_aVUV; } void SetProjection(ProjectionType ePrj) - { eProjection = ePrj; bTfValid = false; } - ProjectionType GetProjection() const { return eProjection; } + { m_eProjection = ePrj; m_bTfValid = false; } + ProjectionType GetProjection() const { return m_eProjection; } void SetViewWindow(double fX, double fY, double fW, double fH); void SetDeviceWindow(const tools::Rectangle& rRect); - const tools::Rectangle& GetDeviceWindow() const { return aDeviceRect; } + const tools::Rectangle& GetDeviceWindow() const { return m_aDeviceRect; } // returns observers position in world coordinates const basegfx::B3DPoint& GetViewPoint(); diff --git a/svx/source/engine3d/camera3d.cxx b/svx/source/engine3d/camera3d.cxx index 1f3600b13e68..d281ae91fa91 100644 --- a/svx/source/engine3d/camera3d.cxx +++ b/svx/source/engine3d/camera3d.cxx @@ -173,7 +173,7 @@ void Camera3D::SetFocalLength(double fLen) { if (fLen < 5) fLen = 5; - SetPRP(basegfx::B3DPoint(0.0, 0.0, fLen / 35.0 * aViewWin.W)); + SetPRP(basegfx::B3DPoint(0.0, 0.0, fLen / 35.0 * m_aViewWin.W)); m_fFocalLength = fLen; } diff --git a/svx/source/engine3d/viewpt3d2.cxx b/svx/source/engine3d/viewpt3d2.cxx index c2e55a085d0e..6a4d04f772fc 100644 --- a/svx/source/engine3d/viewpt3d2.cxx +++ b/svx/source/engine3d/viewpt3d2.cxx @@ -20,29 +20,29 @@ #include <svx/viewpt3d.hxx> Viewport3D::Viewport3D() : - aVRP(0, 0, 5), - aVPN(0, 0, 1), - aVUV(0, 1, 1), - aPRP(0, 0, 2), - eProjection(ProjectionType::Perspective), - aDeviceRect(Point(0,0), Size(-1,-1)), - aViewPoint (0, 0, 5000), - bTfValid(false) + m_aVRP(0, 0, 5), + m_aVPN(0, 0, 1), + m_aVUV(0, 1, 1), + m_aPRP(0, 0, 2), + m_eProjection(ProjectionType::Perspective), + m_aDeviceRect(Point(0,0), Size(-1,-1)), + m_aViewPoint (0, 0, 5000), + m_bTfValid(false) { - aViewWin.X = -1; aViewWin.Y = -1; - aViewWin.W = 2; aViewWin.H = 2; + m_aViewWin.X = -1; m_aViewWin.Y = -1; + m_aViewWin.W = 2; m_aViewWin.H = 2; } // Set ViewWindow (in View coordinates) void Viewport3D::SetViewWindow(double fX, double fY, double fW, double fH) { - aViewWin.X = fX; - aViewWin.Y = fY; - if ( fW > 0 ) aViewWin.W = fW; - else aViewWin.W = 1.0; - if ( fH > 0 ) aViewWin.H = fH; - else aViewWin.H = 1.0; + m_aViewWin.X = fX; + m_aViewWin.Y = fY; + if ( fW > 0 ) m_aViewWin.W = fW; + else m_aViewWin.W = 1.0; + if ( fH > 0 ) m_aViewWin.H = fH; + else m_aViewWin.H = 1.0; } // Returns observer position (PRP) in world coordinates @@ -50,47 +50,47 @@ void Viewport3D::SetViewWindow(double fX, double fY, double fW, double fH) const basegfx::B3DPoint& Viewport3D::GetViewPoint() { // Calculate View transformations matrix - if ( !bTfValid ) + if ( !m_bTfValid ) { double fV, fXupVp, fYupVp; - aViewPoint = aVRP + aVPN * aPRP.getZ(); + m_aViewPoint = m_aVRP + m_aVPN * m_aPRP.getZ(); // Reset to Identity matrix - aViewTf.identity(); + m_aViewTf.identity(); // shift in the origin - aViewTf.translate(-aVRP.getX(), -aVRP.getY(), -aVRP.getZ()); + m_aViewTf.translate(-m_aVRP.getX(), -m_aVRP.getY(), -m_aVRP.getZ()); // fV = Length of the projection of aVPN on the yz plane: - fV = aVPN.getYZLength(); + fV = m_aVPN.getYZLength(); if ( fV != 0 ) { basegfx::B3DHomMatrix aTemp; - const double fSin(aVPN.getY() / fV); - const double fCos(aVPN.getZ() / fV); + const double fSin(m_aVPN.getY() / fV); + const double fCos(m_aVPN.getZ() / fV); aTemp.set(2, 2, fCos); aTemp.set(1, 1, fCos); aTemp.set(2, 1, fSin); aTemp.set(1, 2, -fSin); - aViewTf *= aTemp; + m_aViewTf *= aTemp; } { basegfx::B3DHomMatrix aTemp; - const double fSin(-aVPN.getX()); + const double fSin(-m_aVPN.getX()); const double fCos(fV); aTemp.set(2, 2, fCos); aTemp.set(0, 0, fCos); aTemp.set(0, 2, fSin); aTemp.set(2, 0, -fSin); - aViewTf *= aTemp; + m_aViewTf *= aTemp; } // Convert X- and Y- coordinates of the view up vector to the // (preliminary) view coordinate system. - fXupVp = aViewTf.get(0, 0) * aVUV.getX() + aViewTf.get(0, 1) * aVUV.getY() + aViewTf.get(0, 2) * aVUV.getZ(); - fYupVp = aViewTf.get(1, 0) * aVUV.getX() + aViewTf.get(1, 1) * aVUV.getY() + aViewTf.get(1, 2) * aVUV.getZ(); + fXupVp = m_aViewTf.get(0, 0) * m_aVUV.getX() + m_aViewTf.get(0, 1) * m_aVUV.getY() + m_aViewTf.get(0, 2) * m_aVUV.getZ(); + fYupVp = m_aViewTf.get(1, 0) * m_aVUV.getX() + m_aViewTf.get(1, 1) * m_aVUV.getY() + m_aViewTf.get(1, 2) * m_aVUV.getZ(); fV = std::hypot(fXupVp, fYupVp); if ( fV != 0 ) @@ -102,52 +102,52 @@ const basegfx::B3DPoint& Viewport3D::GetViewPoint() aTemp.set(0, 0, fCos); aTemp.set(1, 0, fSin); aTemp.set(0, 1, -fSin); - aViewTf *= aTemp; + m_aViewTf *= aTemp; } - bTfValid = true; + m_bTfValid = true; } - return aViewPoint; + return m_aViewPoint; } void Viewport3D::SetDeviceWindow(const tools::Rectangle& rRect) { - aDeviceRect = rRect; + m_aDeviceRect = rRect; } // Set View Reference Point void Viewport3D::SetVRP(const basegfx::B3DPoint& rNewVRP) { - aVRP = rNewVRP; - bTfValid = false; + m_aVRP = rNewVRP; + m_bTfValid = false; } // Set View Plane Normal void Viewport3D::SetVPN(const basegfx::B3DVector& rNewVPN) { - aVPN = rNewVPN; - aVPN.normalize(); - bTfValid = false; + m_aVPN = rNewVPN; + m_aVPN.normalize(); + m_bTfValid = false; } // Set View Up Vector void Viewport3D::SetVUV(const basegfx::B3DVector& rNewVUV) { - aVUV = rNewVUV; - bTfValid = false; + m_aVUV = rNewVUV; + m_bTfValid = false; } // Set Center Of Projection void Viewport3D::SetPRP(const basegfx::B3DPoint& rNewPRP) { - aPRP = rNewPRP; - aPRP.setX(0.0); - aPRP.setY(0.0); - bTfValid = false; + m_aPRP = rNewPRP; + m_aPRP.setX(0.0); + m_aPRP.setY(0.0); + m_bTfValid = false; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */