1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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

@@ -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]