1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-10 18:51:21 +03:00
occt/tests/v3d/glsl/phong_pos3
kgv 992ed6b3c0 0029290: Visualization, TKOpenGl - allow defining Light source per ZLayer
Graphic3d_CLight is now defined as a class inheriting Standard_Transient,
so that it's fields now should be accessed through methods.
Graphic3d_CLight::IsEnabled() - new property allowing to disable light source everywhere.
Confusing alias OpenGl_Light has been removed.

Graphic3d_CLight::SetAttenuation() - the upper limit 1.0 of attenuation factors has been removed
since it contradicts to OpenGL specs and does not make sense.

Graphic3d_ZLayerSettings::Lights() - light sources list is now property of ZLayer.
When defined, it overrides light sources defined for View/Viewer.
New class Graphic3d_LightSet has been defined to define a set of light sources.

V3d_Light - removed obsolete interface for debug drawing lights sources.
V3d_Light is now an alias to Graphic3d_CLight.
V3d_TypeOfLight is now defined as a typedef to Graphic3d_TypeOfLightSource.
2017-11-30 23:09:23 +03:00

47 lines
1.4 KiB
Plaintext

puts "========"
puts "0029290: Visualization, TKOpenGl - allow defining Light source per ZLayer"
puts "========"
pload MODELING VISUALIZATION
vclear
vclose ALL
vinit View1 -width 1024 -height 768
vaxo
vcaps -ffp 0
vrenderparams -shadingModel phong
vlight clear
set THE_LIGHTS {
{ -1 -1 -1 RED1 }
{ 1 -1 -1 YELLOW }
{ -1 1 -1 BLUE1 }
{ -1 -1 1 CYAN1 }
{ 1 1 -1 PURPLE }
{ 1 1 1 WHITE }
{ -1 1 1 HOTPINK }
{ 1 -1 1 GREEN }
{ 0 -1 0 MAGENTA1 }
{ 0 1 0 MAGENTA3 }
}
set aLayers [list [vzlayer -add -disable depthClear] [vzlayer -add -disable depthClear] [vzlayer -add -disable depthClear]]
for { set aLayIter 0 } { $aLayIter < 3 } { incr aLayIter } {
set aLayer [lindex $aLayers $aLayIter]
set aShiftX [expr $aLayIter * 4]
psphere s$aLayer 0.5
vdisplay -dispMode 1 -layer $aLayer s$aLayer
vsetlocation s$aLayer $aShiftX 0 0
for { set aLightIter 0 } { $aLightIter < 10 } { incr aLightIter } {
set aLight [lindex $THE_LIGHTS $aLightIter]
set aColor [lindex $aLight 3]
set aPos [list [expr $aShiftX + [lindex $aLight 0]] [lindex $aLight 1] [lindex $aLight 2]]
vlight -layer $aLayer -add positional -pos {*}$aPos -color $aColor -headLight 0
vpoint v${aLayIter}_${aLightIter} {*}$aPos
vdrawtext t${aLayIter}_${aLightIter} "l${aLayIter}_${aLightIter} $aColor" -pos {*}$aPos -color $aColor
}
}
vfit
vdump $::imagedir/${::casename}.png