1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00
Files
occt/tests/bugs/vis/bug25671
apl c357e42610 0024776: Visualization - inherit OpenGl_View from Graphic3d_CView
Expose interface of OpenGl_View (OpenGL graphics rendering methods) to client code
and collecting all high-level API methods of application views in V3d_View class.

1) Exposing interface of OpenGl_View:

The OpenGl_View inherits from new class Graphic3d_CView.
Graphic3d_CView is an interface class that declares abstract methods for managing displayed structures,
display properties and a base layer code that implements computation
and management of HLR (or more broadly speaking view-depended) structures.

In new implementation it takes place of eliminated Visual3d_View.
As before the instance of Graphic3d_CView is still completely managed by V3d_View classes.
It can be accessed through V3d_View interface but normally this should not be required as all its methods are completely wrapped.

In more details, a concrete specialization of Graphic3d_CView is created and returned by graphical driver on request.
Right after creation the views is directly used for setting rendering properties and adding graphical structures to be displayed.

The rendering of graphics is possible after mapping a window and activating the view.
The direct setting of properties makes obsolete usage of intermediate structures with display parameter
like Visual3d_ContextView and etc (the whole package of Visual3d become redundant).

2) Collecting all high-level API methods of application views in V3d package:

The patch includes elimination of Visual3d layer.
All of its methods that could be previously used by application are now exposed and should be accessed on the level of V3d entities.
- Introduced new class Graphic3d_CView.
  This is a base class for render views.
  Made possible to specialize concrete instances of the class by graphical driver.
- Moved all methods managing rendering views into interface of Graphic3d_CView.
  The corresponding methods were removed from interface of graphical driver.

3) Eliminated Visual3d package:

- Logic of managing display of structures was put from Visual3d_ViewManager into Graphic3d_StructureManager.
- Removed Visual3d_View class. Logic of managing computed structures was put into base layer of Graphi3d_CView.
- Removed all intermediate structures for storing view parameters e.g. Visual3d_ContextView.
  All settings are kept by instances of Graphic3d_CView
- Removed Visual3d_Light intermediate class.
  All light properties are still stored in Graphic3d_CLight structure.
  The structure is directly access by instance of V3d_Light classes.
- Moved all needed enumerations into Graphic3d package.

4) Update package D3DHost to new changes.

5) Update code of OCCT samples to new changes.
2015-09-22 11:49:33 +03:00

117 lines
5.7 KiB
Plaintext

puts "============"
puts "CR25671"
puts "============"
puts ""
#######################################################################
# V3d_View::Convert doesn't work as expected in GRID active mode.
#######################################################################
pload VISUALIZATION
vinit View1 w=400 h=400
# 1. Synthetic case for detection with AIS_InteractiveContext::MoveTo
set detect_x 197
set detect_y 229
set cylinder_r 5
set cylinder_h 10
set cylinder_xyz {100 0 0}
vgrid c p -10 0 5 5 45
pcylinder c $cylinder_r $cylinder_h
ttranslate c {*}$cylinder_xyz
vdisplay c
vfit
vmoveto $detect_x $detect_y
checkcolor $detect_x $detect_y 0 1 1
if { $stat != 1 } {
puts "Error : Detection does not work correctly with activated grid."
}
vgrid off
vremove -all
# 2.1 Quick test of coordinate conversion commands
set view_scale 2.5
set view_proj {0 1 0}
set view_up {0 0 1}
set view_eye {0.5 100.5 0.5}
set view_at {0.5 0.5 0.5}
set view_znear 0
set view_zfar 150
vviewparams -scale $view_scale -eye {*}$view_eye -at {*}$view_at -proj {*}$view_proj -up {*}$view_up
vzrange $view_znear $view_zfar
set vconvert_1_view [vconvert 1.0 view]
set vconvert_1_win [vconvert 1.0 window]
set vconvert_00_00_win [vconvert 0.0 0.0 window]
set vconvert_200_200_view [vconvert 200 200 view]
set vconvert_05_05_ray [vconvert 0.5 0.5 ray]
set vconvert_200_200_model [vconvert 200 200]
set vconvert_05_100_05_win [vconvert 0.5 100 0.5 window]
checkreal "vconvert 1.0 view, view 1" [lindex $vconvert_1_view 2] 1.0 1e-7 0.0
checkreal "vconvert 1.0 window, view 1" [lindex $vconvert_1_win 2] 1.0 1e-7 0.0
checkreal "vconvert 0.0 0.0 window, view 1, Xp" [lindex $vconvert_00_00_win 2] 200.0 1.0 0.0
checkreal "vconvert 0.0 0.0 window, view 1, Yp" [lindex $vconvert_00_00_win 3] 200.0 1.0 0.0
checkreal "vconvert 200 200 view, view 1, Xv" [lindex $vconvert_200_200_view 2] 0.0 1e-7 0.0
checkreal "vconvert 200 200 view, view 1, Yv" [lindex $vconvert_200_200_view 3] 0.0 1e-7 0.0
checkreal "vconvert 0.5 0.5 ray, view 1, DX" [lindex $vconvert_05_05_ray 2] 0.0 1e-7 0.0
checkreal "vconvert 0.5 0.5 ray, view 1, DY" [lindex $vconvert_05_05_ray 3] -1.0 1e-7 0.0
checkreal "vconvert 0.5 0.5 ray, view 1, DZ" [lindex $vconvert_05_05_ray 4] 0.0 1e-7 0.0
checkreal "vconvert 200 200, view 1, X" [lindex $vconvert_200_200_model 2] 0.5 1.0 0.0
checkreal "vconvert 200 200, view 1, Y" [lindex $vconvert_200_200_model 3] 100.5 1.0 0.0
checkreal "vconvert 200 200, view 1, Z" [lindex $vconvert_200_200_model 4] -0.5 1.0 0.0
checkreal "vconvert 0.5 100 0.5 window, view 1, Xp" [lindex $vconvert_05_100_05_win 2] 200.0 1.0 0.0
checkreal "vconvert 0.5 100 0.5 window, view 1, Yp" [lindex $vconvert_05_100_05_win 3] 199.0 1.0 0.0
# 2.2 Quick test of coordinate conversion commands
vgrid r 10 10 1 1 45
set view_scale 49.504950495049506
set view_proj {0 0 1}
set view_up {0 1 0}
set view_eye {25 5 125}
set view_at {25 5 45}
set view_znear 0
set view_zfar 150
vviewparams -scale $view_scale -eye {*}$view_eye -at {*}$view_at -proj {*}$view_proj -up {*}$view_up
vautozfit 0
vzrange $view_znear $view_zfar
set vconvert_1_view [vconvert 1.0 view]
set vconvert_1_win [vconvert 1.0 window]
set vconvert_00_00_win [vconvert 0.0 0.0 window]
set vconvert_200_200_view [vconvert 200 200 view]
set vconvert_05_05_ray [vconvert 0.5 0.5 ray]
set vconvert_200_200_model [vconvert 200 200]
set vconvert_200_200_grid [vconvert 200 200 grid]
set vconvert_25_5_35_win [vconvert 25.0 4.94 35.0 window]
set vconvert_25_5_35_grid [vconvert 25.0 4.94 35.0 grid]
checkreal "vconvert 1.0 view, view 2" [lindex $vconvert_1_view 2] 0.05 0.05 0.0
checkreal "vconvert 1.0 window, view 2" [lindex $vconvert_1_win 2] 19.0 0.05 0.0
checkreal "vconvert 0.0 0.0 window, view 2, Xp" [lindex $vconvert_00_00_win 2] 200.0 1.0 0.0
checkreal "vconvert 0.0 0.0 window, view 2, Yp" [lindex $vconvert_00_00_win 3] 200.0 1.0 0.0
checkreal "vconvert 200 200 view, view 2, Xv" [lindex $vconvert_200_200_view 2] 0.0 1e-7 0.0
checkreal "vconvert 200 200 view, view 2, Yv" [lindex $vconvert_200_200_view 3] 0.0 1e-7 0.0
checkreal "vconvert 0.5 0.5 ray, view 2, DX" [lindex $vconvert_05_05_ray 2] 0.0 1e-7 0.0
checkreal "vconvert 0.5 0.5 ray, view 2, DY" [lindex $vconvert_05_05_ray 3] 0.0 1e-7 0.0
checkreal "vconvert 0.5 0.5 ray, view 2, DZ" [lindex $vconvert_05_05_ray 4] -1.0 1e-7 0.0
checkreal "vconvert 200 200, view 2, X" [lindex $vconvert_200_200_model 2] 25.0 0.05 0.0
checkreal "vconvert 200 200, view 2, Y" [lindex $vconvert_200_200_model 3] 4.95 0.05 0.0
checkreal "vconvert 200 200, view 2, Z" [lindex $vconvert_200_200_model 4] 125.0 0.05 0.0
checkreal "vconvert 200 200 grid, view 2, X" [lindex $vconvert_200_200_grid 2] 25.486 0.05 0.0
checkreal "vconvert 200 200 grid, view 2, Y" [lindex $vconvert_200_200_grid 3] 4.856 0.05 0.0
checkreal "vconvert 200 200 grid, view 2, Z" [lindex $vconvert_200_200_grid 4] 0.0 0.05 0.0
checkreal "vconvert 0.5 100 0.5 window, view 2, Xp" [lindex $vconvert_25_5_35_win 2] 200.0 1.0 0.0
checkreal "vconvert 0.5 100 0.5 window, view 2, Yp" [lindex $vconvert_25_5_35_win 3] 200.0 1.0 0.0
checkreal "vconvert 25 4.94 35 grid, view 2, X" [lindex $vconvert_25_5_35_grid 2] 25.486 0.05 0.0
checkreal "vconvert 25 4.94 35 grid, view 2, Y" [lindex $vconvert_25_5_35_grid 3] 4.856 0.05 0.0
checkreal "vconvert 25 4.94 35 grid, view 2, Z" [lindex $vconvert_25_5_35_grid 4] 0.0 0.05 0.0
# do not save any image
set only_screen 0