1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Compare commits

...

3 Commits

Author SHA1 Message Date
drochalo
d44b7b7442 0027832: Visualization - Scaled zbuffer trihedron
Code cleanup and test case modified.
2023-10-27 17:18:25 +01:00
drochalo
6b9af22de9 0027832: Visualization - Scaled zbuffer trihedron
Minor update on axial scale test
2023-10-20 18:40:09 +01:00
drochalo
d28545ca7b 0027832: Scaled zbuffer trihedron
Adjusted calculation of scale in Graphic3d_TransformPers::Apply().
Now takes into consideration the Axial Scale of the camera.
2023-10-20 15:11:54 +01:00
2 changed files with 57 additions and 0 deletions

View File

@@ -409,6 +409,17 @@ 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 > 0.0 && anAxialY > 0.0 && anAxialZ > 0.0)
{
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);

View File

@@ -0,0 +1,46 @@
puts "========"
puts "0027832: Visualization - Scaled zbuffer trihedron"
puts "========"
puts ""
pload MODELING VISUALIZATION
vinit
box b 10 10 10
vdisplay b
vfit
vsetdispmode 1
vzbufftrihedron -on
#draw initial picture of box without visual scale
vdump $imagedir/${casename}_unscaled.png
#draw picture of box after visual scale
#and zoomed out
vscale 1 3 10
vzoom 0.99
set color_1 [vreadpixel 55 360 -rgb -name]
set color_2 [vreadpixel 50 350 -rgb -name]
set color_3 [vreadpixel 55 355 -rgb -name]
if {$color_1 != "RED3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: RED3"
puts " current color is: $color_1"
}
if {$color_2 != "BLUE3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: BLUE3"
puts " current color is: $color_2"
}
if {$color_3 != "GREEN3"} {
puts "ERROR: trihedron does not maintain position"
puts " additional investigation is needed"
puts " expected color is: GREEN3"
puts " current color is: $color_3"
}
vdump $imagedir/${casename}_scaled.png