From d28545ca7b36b7f02e36f9fa3aeaacab1bbdebf9 Mon Sep 17 00:00:00 2001 From: drochalo Date: Fri, 20 Oct 2023 15:11:54 +0100 Subject: [PATCH] 0027832: Scaled zbuffer trihedron Adjusted calculation of scale in Graphic3d_TransformPers::Apply(). Now takes into consideration the Axial Scale of the camera. --- src/Graphic3d/Graphic3d_TransformPers.hxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/Graphic3d/Graphic3d_TransformPers.hxx b/src/Graphic3d/Graphic3d_TransformPers.hxx index e0db73b4e8..f9c1e2ec8d 100644 --- a/src/Graphic3d/Graphic3d_TransformPers.hxx +++ b/src/Graphic3d/Graphic3d_TransformPers.hxx @@ -409,6 +409,19 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera, } NCollection_Mat4 aWorldView = theCamera->OrientationMatrix(); + + //Adjust the camera axial scale for trihedron behaviour + gp_XYZ anAxialScale = theCamera->AxialScale(); + Standard_Real anAxialX = anAxialScale.X(); + Standard_Real anAxialY = anAxialScale.Y(); + Standard_Real anAxialZ = anAxialScale.Z(); + if ((anAxialX > Precision::Confusion() && + anAxialY > Precision::Confusion() && + anAxialZ > Precision::Confusion())) + { + Graphic3d_TransformUtils::Scale(aWorldView, 1.0 / anAxialX, 1.0 / anAxialY, 1.0 / anAxialZ); + } + Graphic3d_TransformUtils::Translate (aWorldView, aCenter.X(), aCenter.Y(), aCenter.Z()); Graphic3d_TransformUtils::Scale (aWorldView, aScale, aScale, aScale); theWorldView.ConvertFrom (aWorldView);