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

0032121: Draw Harness, ViewerTest - implement -reset option for vlight command

vlight command has been revised to provide more friendly syntax.
Command now accepts light index or name as first argument.
Added arguments -enable/-disable for managing enabled state.
Added argument -reset to reset light parameters to default values.

V3d_Viewer::SetDefaultLights() now sets names "headlight" and "ambient" to created lights.
Graphic3d_TypeOfLightSource enumeration values have been renamed to avoid shortcuts.
Draw::Atof(), applied corrections to avoid explicit new/delete calls.
This commit is contained in:
kgv
2021-07-09 23:22:29 +03:00
parent cb7f92396f
commit 06d40093b7
44 changed files with 916 additions and 925 deletions

View File

@@ -43,7 +43,7 @@ vdisplay -top -dispMode 1 -trsfPers zoom -trsfPersPos 1000 0 0 zp
vclipplane pln -equation -1 0 0 1000 -set
# check positional lights
vlight add positional pos 1000 0 0.001 color RED1 headlight 0
vlight pntlight -type POSITIONAL -pos 1000 0 0.001 -color RED1 -headlight 0
vremove f1000
vmoveto 220 220

View File

@@ -1,5 +1,5 @@
puts "========"
puts "Test to verify the lights are turned off after 'vlight clear' (and scene is black)"
puts "Test to verify the lights are turned off after 'vlight -clear' (and scene is black)"
puts "========"
pload MODELING VISUALIZATION
@@ -15,7 +15,7 @@ vsetdispmode 1
vdisplay b
vfit
vlight clear
vlight -clear
set color [vreadpixel 100 100 rgb]
set black "0 0 0"

View File

@@ -22,7 +22,7 @@ vdisplay s1 s2
vsetmaterial s1 Gold
vsetmaterial s2 Silver
vsetlocation s1 0.0 0.1 0.0
vlight -change 0 -dir 0.667 -0.667 -0.333
vlight -change 0 -dir 0.667 -0.667 -0.333 -smoothAngle 6 -intensity 100
vturnview 3.0 -1.2 -0.1
vfit
@@ -33,8 +33,6 @@ vrenderparams -rayDepth 12
set aModeNum 0
vlight change 0 sm 0.1
vlight change 0 int 100
vbsdf s1 roughness 6400
vfps 200
@@ -52,4 +50,4 @@ vsetmaterial s2 plaster
vfps 200
vdump $imagedir/${casename}_${aModeNum}.png
incr aModeNum
incr aModeNum

View File

@@ -72,6 +72,6 @@ vfront
vturnview 0 -0.3 0
vfit
vlight -change 0 -dir -0.577 -0.577 -0.577
vlight add directional
vlight dirlight -type directional
vrenderparams -raytrace -raydepth 5 -shadows off -reflections -fsaa
vdump ${imagedir}/${casename}.png

View File

@@ -10,7 +10,6 @@ tclean f
# draw box
vclear
vclose ALL
vinit View1
vdefaults -absDefl 0.5
vsetdispmode 1

View File

@@ -10,7 +10,6 @@ tclean f
# draw box
vclear
vclose ALL
vinit View1
vdefaults -absDefl 0.5
vsetdispmode 1
@@ -21,14 +20,10 @@ vrotate -0.5 0.0 0.0
vfit
# setup lights
vlight delete 0
vlight delete 0
vlight delete 0
vlight delete 0
vlight delete 0
vlight add ambient color WHITE
vlight add directional dir 1 0 0 color GREEN headlight 1
vlight add directional dir -1 0 0 color RED1 headlight 1
vlight -clear
vlight amblight -type AMBIENT -color WHITE
vlight dirlight1 -type DIRECTIONAL -dir 1 0 0 -color GREEN -headlight 1
vlight dirlight2 -type DIRECTIONAL -dir -1 0 0 -color RED1 -headlight 1
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png

View File

@@ -13,10 +13,10 @@ vdefaults -absDefl 0.5
vdisplay -dispMode 1 f
# setup lights
vlight clear
vlight add ambient color WHITE
vlight add directional dir 1 0 0 color GREEN headlight 1
vlight add directional dir -1 0 0 color RED1 headlight 1
vlight -clear
vlight amblight -type AMBIENT -color WHITE
vlight dirlight1 -type DIRECTIONAL -dir 1 0 0 -color GREEN -headlight 1
vlight dirlight2 -type DIRECTIONAL -dir -1 0 0 -color RED1 -headlight 1
vrenderparams -shadingModel flat
vdump $::imagedir/${::casename}.png

View File

@@ -9,14 +9,10 @@ vclose ALL
vinit View1
vcaps -ffp 0
vrenderparams -shadingModel vert
vlight delete 0
vlight delete 0
vlight delete 0
vlight delete 0
vlight delete 0
vlight add ambient color WHITE
vlight add directional dir 1 0 0 color GREEN headlight 1
vlight add directional dir -1 0 0 color RED1 headlight 1
vlight -clear
vlight amblight -type AMBIENT -color WHITE
vlight dirlight1 -type DIRECTIONAL -dir 1 0 0 -color GREEN -headlight 1
vlight dirlight2 -type DIRECTIONAL -dir -1 0 0 -color RED1 -headlight 1
# display shape
restore [locate_data_file occ/fuse.brep] f

View File

@@ -28,8 +28,8 @@ vfit
# setup light
vcaps -ffp 0
vrenderparams -shadingModel vert
vlight clear
vlight add positional pos $anX 0 0.001 color RED1 headLight 0
vlight -clear
vlight pntlight -type POSITIONAL -pos $anX 0 0.001 -color RED1 -headLight 0
set aColor1 [vreadpixel 205 180 rgb name]
set aColor2 [vreadpixel 205 210 rgb name]

View File

@@ -28,8 +28,8 @@ vfit
# setup light
vcaps -ffp 0
vrenderparams -shadingModel vert
vlight clear
vlight add spotLight pos $anX 0 0.001 dir 0 0 -1 angle 60 constAtten 0.1 exponent 0.1 color RED1 headLight 0
vlight -clear
vlight spot -type SPOTLIGHT -pos $anX 0 0.001 -dir 0 0 -1 -spotAngle 60 -constAtten 0.1 -exponent 0.1 -color RED1 -headLight 0
set aColor1 [vreadpixel 205 180 rgb name]
set aColor2 [vreadpixel 205 220 rgb name]

View File

@@ -11,14 +11,10 @@ vclose ALL
vinit View1
vcaps -ffp 0
vrenderparams -shadingModel phong
vlight delete 0
vlight delete 0
vlight delete 0
vlight delete 0
vlight delete 0
vlight add ambient color WHITE
vlight add directional dir 1 0 0 color GREEN headlight 1
vlight add directional dir -1 0 0 color RED1 headlight 1
vlight -clear
vlight amblight -type AMBIENT -color WHITE
vlight dirlight1 -type DIRECTIONAL -dir 1 0 0 -color GREEN -headlight 1
vlight dirlight2 -type DIRECTIONAL -dir -1 0 0 -color RED1 -headlight 1
# display shape
restore [locate_data_file occ/fuse.brep] f

View File

@@ -32,12 +32,12 @@ set THE_LIGHTS {
{ -4 -1 0 MAGENTA }
{ 4 -1 0 MAGENTA3 }
}
vlight clear
vlight -clear
for { set aLightIter 1 } { $aLightIter <= 10 } { incr aLightIter } {
set aLight [lindex $THE_LIGHTS [expr $aLightIter - 1]]
set aColor [lindex $aLight 3]
set aPos [list [lindex $aLight 0] [lindex $aLight 1] [lindex $aLight 2]]
vlight add positional pos {*}$aPos color $aColor headLight 0
vlight pntlight${aLightIter} -type POSITIONAL -pos {*}$aPos -color $aColor -headLight 0
vpoint v${aLightIter} {*}$aPos
vdrawtext t${aLightIter} "light${aLightIter} $aColor" -pos {*}$aPos -color $aColor
vdump $::imagedir/${::casename}_${aLightIter}.png

View File

@@ -11,7 +11,7 @@ vinit View1 -width 1024 -height 768
vaxo
vcaps -ffp 0
vrenderparams -shadingModel phong
vlight clear
vlight -clear
set THE_LIGHTS {
{ -1 -1 -1 RED1 }

View File

@@ -17,7 +17,7 @@ vfit
# define lights
set THE_COLORS { RED1 YELLOW BLUE CYAN PURPLE WHITE HOTPINK GREEN MAGENTA MAGENTA3 }
vlight clear
vlight -clear
set aNbColors 10
set aLightIndex 0
set aConstAtten 0.1

View File

@@ -28,8 +28,8 @@ vfit
# setup light
vcaps -ffp 0
vrenderparams -shadingModel phong
vlight clear
vlight add spotLight pos $anX 0 0.001 dir 0 0 -1 angle 60 constAtten 0.1 exponent 0.1 color RED1 headLight 0
vlight -clear
vlight spot -type SPOTLIGHT -pos $anX 0 0.001 -dir 0 0 -1 -spotAngle 60 -constAtten 0.1 -exponent 0.1 -color RED1 -headLight 0
set aColor1 [vreadpixel 205 180 rgb name]
set aColor2 [vreadpixel 205 220 rgb name]

View File

@@ -13,8 +13,8 @@ box b 1 2 3
vdisplay b
vsetdispmode 1
vtexture b 0
vlight clear
vlight add ambient color white
vlight -clear
vlight amblight -type AMBIENT -color WHITE
vfit
vtexture b -modulate off