]> OCCT Git - occt.git/commitdiff
0027832: Scaled zbuffer trihedron
authordrochalo <diogo.lopes@opencascade.com>
Fri, 20 Oct 2023 14:11:54 +0000 (15:11 +0100)
committerdrochalo <diogo.lopes@opencascade.com>
Fri, 20 Oct 2023 14:11:54 +0000 (15:11 +0100)
Adjusted calculation of scale in Graphic3d_TransformPers::Apply().
Now takes into consideration the Axial Scale of the camera.

src/Graphic3d/Graphic3d_TransformPers.hxx

index e0db73b4e8f59ccbff1d5027731a63bf1937a0d5..f9c1e2ec8d8e95cf47d66fd280725f73f5e5d3e5 100644 (file)
@@ -409,6 +409,19 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera,
     }
 
     NCollection_Mat4<Standard_Real> 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);