1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00
occt/tests/bugs/vis/bug25760_1
osa 0e3025bc14 0030434: Visualization, TKV3d - add "NoUpdate" state of frustum culling optimization
Frustum culling is now managed by Graphic3d_RenderingParams::FrustumCullingState flag
and can be switched into Graphic3d_RenderingParams::FrustumCulling_NoUpdate state
useful for debugging the algorithm.

Draw Harness command vrustumculling has been replaced by vrenderparams -frustumCulling.
2019-01-11 18:57:52 +03:00

80 lines
2.1 KiB
Plaintext

puts "============"
puts "CR25760"
puts "============"
puts ""
#######################################################################
# Visualization - precision factor added to ZNear, ZFar in method ZFitAll() of Graphic3d_Camera is not enough
#######################################################################
vinit View1 w=409 h=409
vclear
proc test2d {} {
set pix1 {135 204}
set pix2 {204 187}
for {set i 8} {$i <= 8} {incr i} {
set min_z [expr pow (-10, $i)]
set max_z [expr $min_z + 1000]
plane p1 0 0 $min_z 0 0 1
plane p2 0 0 $max_z 0 0 1
mkface f1 p1 -1 0 -1 0
mkface f2 p2 0 1 0 1
vclear
vdisplay f1 f2
vtop
vfit
for {set z [expr $max_z + 1.0]} {$z <= 1e10} {set z [expr abs ($z) * 1.2]} {
vviewparams -eye 0 0 $z
vmoveto {*}$pix1
if { [checkcolor {*}$pix1 0 1 1] != 1 } {
puts "Error: 2D projection test failed with the following parameters:"
vviewparams
vzrange
puts ""
puts "z : $z"
puts "min_z: $min_z"
puts "max_z: $max_z"
return 0
}
vmoveto {*}$pix2
if { [checkcolor {*}$pix2 0 1 1] != 1 } {
puts "Error: 2D projection test failed with the following parameters:"
vviewparams
vzrange
puts ""
puts "z : $z"
puts "min_z: $min_z"
puts "max_z: $max_z"
return 0
}
}
}
return 1
}
set tcl_precision 16
####################################################################
# Test orthographic camera without frustum culling. #
####################################################################
vcamera -ortho
vrenderparams -frustumculling off
if { [test2d] != 1 } {
puts "Error: 2D projection test failed: view frustum culling is OFF"
}
####################################################################
# Test orthographic camera with frustum culling. #
####################################################################
vcamera -ortho
vrenderparams -frustumculling on
if { [test2d] != 1 } {
puts "Error: 2D projection test failed: view frustum culling is ON"
}