mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0032208: Tests - refactor visualization tests to cover several graphic drivers
Removed testgrids 'bugs/vis' and '3rdparty'; tests have been redistributed across other grids. Moved testgrid 'v3d/ivtk' into dedicated 'vtk/ivtk'. Added testgrid 'vselect' dedicated to 3D viewer picking/selection functionality and filled with tests from 'v3d/vertex', 'v3d/face' and similar groups. Added testgrid 'opengl' dedicated to OpenGL driver low-level functionality (GLSL programs and similar) and filled with tests from 'v3d/glsl', 'v3d/raytrace', '3rdparty/fonts', 'bugs/vis' (portion) and similar. Added testgrid 'opengles3' dedicated to OpenGL ES 3.0 driver low-level functionality and reusing tests from 'opengl' testgrid. Subgroup 'opengles3/raytrace' is disabled on Windows, as Ray-Tracing currently requires OpenGL ES 3.2. while ANGLE library implements only OpenGL ES 3.0. Added testgrid 'opengles2' dedicated to OpenGL ES 2.0 driver low-level functionality and reusing a limited subset of passing tests from 'opengl' testgrid. Currently testgrid is activated only on Windows platform when using ANGLE library (properietary OpenGL ES drivers do not allow creation of restricted 2.0 context). Test cases have been cleaned out to put bug description into log, to properly load necessary plugins and to explicitly dump viewer.
This commit is contained in:
13
tests/opengl/data/shading/bug30102
Normal file
13
tests/opengl/data/shading/bug30102
Normal file
@@ -0,0 +1,13 @@
|
||||
puts "============="
|
||||
puts "0030102: Visualization, TKOpenGl - Graphic3d_TOSM_FACET shading is incorrect in some casesn"
|
||||
puts "============="
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vinit View1
|
||||
vaxo
|
||||
vdrawparray b triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 55 0 v 0 75 0 v 0 55 20 v 0 55 0 v 0 55 20 v 20 55 0 v 0 75 0 v 0 55 20 v 20 55 0
|
||||
vrotate 0.3 0.0 0.0
|
||||
vfit
|
||||
|
||||
vdump ${imagedir}/${casename}.png
|
37
tests/opengl/data/shading/distinguish_off
Normal file
37
tests/opengl/data/shading/distinguish_off
Normal file
@@ -0,0 +1,37 @@
|
||||
puts "========"
|
||||
puts "0025822: Visualization, TKOpenGl - front material should be used instead of back material within distinguish mode turned off"
|
||||
puts "========"
|
||||
|
||||
pload MODELING OCAF XDE
|
||||
box b 10 10 10
|
||||
vclear
|
||||
vinit View1
|
||||
Close D -silent
|
||||
NewDocument D BinXCAF
|
||||
XAddShape D b
|
||||
XSetColor D b BLUE
|
||||
explode b f
|
||||
XSetColor D b_1 RED
|
||||
|
||||
XDisplay D
|
||||
vviewparams -proj 1 0.1 0.1
|
||||
vfit
|
||||
vsetdispmode 1
|
||||
|
||||
catch { vclipplane delete pln }
|
||||
vclipplane create pln
|
||||
vclipplane set pln view Driver1/Viewer1/View1
|
||||
vclipplane change pln equation -1 0 0 5
|
||||
|
||||
# FFP on
|
||||
if { [vdriver -default] == "TKOpenGl" } {
|
||||
vcaps -ffp 1
|
||||
set aColorFfp [vreadpixel 200 200 rgb name]
|
||||
if { "$aColorFfp" != "RED" } { puts "Error: RED color is expected at the back side (FFP)" }
|
||||
}
|
||||
|
||||
# GLSL on
|
||||
vcaps -ffp 0
|
||||
set aColorGlsl [vreadpixel 200 200 rgb name]
|
||||
if { "$aColorGlsl" != "FIREBRICK" && "$aColorGlsl" != "RED" } { puts "Error: FIREBRICK color is expected at the back side (GLSL)" }
|
||||
vdump ${imagedir}/${casename}.png
|
22
tests/opengl/data/shading/flat_fuse1
Normal file
22
tests/opengl/data/shading/flat_fuse1
Normal file
@@ -0,0 +1,22 @@
|
||||
puts "========"
|
||||
puts "0028069: Visualization, TKOpenGl - handle flat shading model within GLSL programs"
|
||||
puts "========"
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
vviewparams -scale 551.55 -proj 0.85 -0.16 0.51 -up -0.41 0.41 0.82 -at 0.55 0.55 0.55
|
||||
|
||||
restore [locate_data_file occ/fuse.brep] f
|
||||
tclean f
|
||||
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
|
||||
|
||||
vrenderparams -shadingModel flat
|
||||
vdump $::imagedir/${::casename}.png
|
20
tests/opengl/data/shading/gouraud_dir1
Normal file
20
tests/opengl/data/shading/gouraud_dir1
Normal file
@@ -0,0 +1,20 @@
|
||||
puts "========"
|
||||
puts "Per-vertex lighting using built-in GLSL program, one directional light source."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
vcaps -ffp 0
|
||||
vrenderparams -shadingModel vert
|
||||
|
||||
# display shape
|
||||
restore [locate_data_file occ/fuse.brep] f
|
||||
vaxo
|
||||
vdisplay f -dispmode 1
|
||||
vfit
|
||||
vrotate -0.5 0.0 0.0
|
||||
vfit
|
||||
vdump ${imagedir}/${casename}.png
|
28
tests/opengl/data/shading/gouraud_dir2
Normal file
28
tests/opengl/data/shading/gouraud_dir2
Normal file
@@ -0,0 +1,28 @@
|
||||
puts "========"
|
||||
puts "Per-vertex lighting using built-in GLSL program, two directional light sources."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
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
|
||||
|
||||
# display shape
|
||||
restore [locate_data_file occ/fuse.brep] f
|
||||
vaxo
|
||||
vdisplay f -dispmode 1
|
||||
vfit
|
||||
vrotate -0.5 0.0 0.0
|
||||
vfit
|
||||
vdump ${imagedir}/${casename}.png
|
45
tests/opengl/data/shading/gouraud_pos1
Normal file
45
tests/opengl/data/shading/gouraud_pos1
Normal file
@@ -0,0 +1,45 @@
|
||||
puts "========"
|
||||
puts "Per-vertex lighting using built-in GLSL program, one positional light source."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
|
||||
# create objects
|
||||
set anX 0.001
|
||||
circle c 0 0 0 0.001
|
||||
mkedge e c
|
||||
wire w e
|
||||
plane s
|
||||
mkface f1 s w
|
||||
mkface f2 s w
|
||||
ttranslate f1 $anX -0.001 0
|
||||
|
||||
# display objects
|
||||
vtop
|
||||
vdisplay -dispMode 1 f1 f2
|
||||
vsetlocation f2 $anX 0.001 0
|
||||
vpoint vl $anX 0 0.001
|
||||
vfit
|
||||
|
||||
# setup light
|
||||
vcaps -ffp 0
|
||||
vrenderparams -shadingModel vert
|
||||
vlight clear
|
||||
vlight add positional pos $anX 0 0.001 color RED1 headLight 0
|
||||
|
||||
set aColor1 [vreadpixel 205 180 rgb name]
|
||||
set aColor2 [vreadpixel 205 210 rgb name]
|
||||
if { "$aColor1" != "RED" || "$aColor2" != "RED" } {
|
||||
puts "Error: expected color near the light spot is RED"
|
||||
}
|
||||
|
||||
set aColor3 [vreadpixel 205 100 rgb name]
|
||||
set aColor4 [vreadpixel 205 306 rgb name]
|
||||
if { "$aColor3" != "RED4" || "$aColor4" != "RED4" } {
|
||||
puts "Error: expected color far from the light spot is RED4"
|
||||
}
|
||||
vdump ${imagedir}/${casename}.png
|
45
tests/opengl/data/shading/gouraud_spot1
Normal file
45
tests/opengl/data/shading/gouraud_spot1
Normal file
@@ -0,0 +1,45 @@
|
||||
puts "========"
|
||||
puts "Per-vertex lighting using built-in GLSL program, one spot light source."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
|
||||
# create objects
|
||||
set anX 0.001
|
||||
circle c 0 0 0 0.001
|
||||
mkedge e c
|
||||
wire w e
|
||||
plane s
|
||||
mkface f1 s w
|
||||
mkface f2 s w
|
||||
ttranslate f1 $anX -0.001 0
|
||||
|
||||
# display objects
|
||||
vtop
|
||||
vdisplay -dispMode 1 f1 f2
|
||||
vsetlocation f2 $anX 0.001 0
|
||||
vpoint vl $anX 0 0.001
|
||||
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
|
||||
|
||||
set aColor1 [vreadpixel 205 180 rgb name]
|
||||
set aColor2 [vreadpixel 205 220 rgb name]
|
||||
if { "$aColor1" != "RED" || "$aColor2" != "RED" } {
|
||||
puts "Error: expected color near the light spot is RED"
|
||||
}
|
||||
|
||||
set aColor3 [vreadpixel 205 132 rgb name]
|
||||
set aColor4 [vreadpixel 205 280 rgb name]
|
||||
if { "$aColor3" != "RED" || "$aColor4" != "RED4" } {
|
||||
puts "Error: expected color mid from the light spot is RED4"
|
||||
}
|
||||
vdump ${imagedir}/${casename}.png
|
73
tests/opengl/data/shading/pbr_attenuation
Normal file
73
tests/opengl/data/shading/pbr_attenuation
Normal file
@@ -0,0 +1,73 @@
|
||||
puts "========"
|
||||
puts "0031099: Visualization, TKOpenGl - support Point light source with artistic full cut-off distance"
|
||||
puts "Test of point light's (positional and spot) attenuation and range in PBR"
|
||||
puts "========"
|
||||
|
||||
pload XDE OCAF VISUALIZATION MODELING
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
Close D -silent
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1 -w 512 -h 512
|
||||
|
||||
vtop
|
||||
vrenderparams -shadingmodel pbr
|
||||
|
||||
box b -2 -2 -0.00001 4 4 0.00001
|
||||
XNewDoc D
|
||||
set bs [XAddShape D b 0]
|
||||
XAddVisMaterial D m -baseColor WHITE -transparency 0.0 -metallic 0.0 -roughness 1.0
|
||||
XSetVisMaterial D $bs m
|
||||
XDisplay -dispMode 1 D
|
||||
vfit
|
||||
|
||||
vlight -clear
|
||||
vlight -add positional -pos -1 0 1 -intensity 0.5
|
||||
vlight -add spot -pos 1 0 1 -dir 0 0 -1 -intensity 0.5 -angle 100
|
||||
|
||||
vdump $::imagedir/${::casename}_norange_high.png
|
||||
|
||||
vlight -change 0 -pos -1 0 0.5
|
||||
vlight -change 1 -pos 1 0 0.5
|
||||
|
||||
vdump $::imagedir/${::casename}_norange_low.png
|
||||
|
||||
vlight -change 0 -range 1
|
||||
vlight -change 1 -range 1
|
||||
|
||||
vdump $::imagedir/${::casename}_range1.png
|
||||
|
||||
vlight -change 0 -range 0.5
|
||||
vlight -change 1 -range 0.5
|
||||
|
||||
vdump $::imagedir/${::casename}_range0_5.png
|
||||
|
||||
vlight -change 0 -range 0.6
|
||||
vlight -change 1 -range 0.6
|
||||
|
||||
vdump $::imagedir/${::casename}_range0_6.png
|
||||
|
||||
vlight -change 0 -range 10
|
||||
vlight -change 1 -range 10
|
||||
|
||||
vdump $::imagedir/${::casename}_range10.png
|
||||
|
||||
box b -5.0 -5.0 -0.00001 10 10 0.00001
|
||||
XNewDoc D
|
||||
set bs [XAddShape D b 0]
|
||||
XAddVisMaterial D m -baseColor WHITE -transparency 0.0 -metallic 0.0 -roughness 1.0
|
||||
XSetVisMaterial D $bs m
|
||||
XDisplay -dispMode 1 D
|
||||
vfit
|
||||
vlight -clear
|
||||
for {set i 0} {$i < 5} {incr i} {
|
||||
for {set j 0} {$j < 5} {incr j} {
|
||||
vlight -add spot -pos [expr -4.0+2.0*$i] [expr -4.0+2.0*$j] 0.5 -dir 0 0 -1 -intensity 0.5 -angle 100 -exp [expr ($i*5+$j) / 24.0]
|
||||
}
|
||||
}
|
||||
|
||||
vdump $::imagedir/${::casename}_angle_attenuation.png
|
34
tests/opengl/data/shading/pbr_spheres
Normal file
34
tests/opengl/data/shading/pbr_spheres
Normal file
@@ -0,0 +1,34 @@
|
||||
puts "========"
|
||||
puts "0030700: Visualization, TKOpenGl - support PBR Metallic-Roughness shading model"
|
||||
puts "Spheres grid with different roughness values"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
source $env(CSF_OCCTSamplesPath)/tcl/vis_pbr_spheres.tcl
|
||||
|
||||
vcamera -ortho
|
||||
vfit
|
||||
vlight -change 1 -intensity 0.0001
|
||||
vdump $::imagedir/${::casename}_ortho0.png
|
||||
vlight -change 1 -intensity 0.3
|
||||
vdump $::imagedir/${::casename}_ortho30.png
|
||||
vcamera -persp
|
||||
vfit
|
||||
vlight -change 1 -intensity 0.0001
|
||||
vdump $::imagedir/${::casename}_persp0.png
|
||||
vlight -change 1 -intensity 0.3
|
||||
vdump $::imagedir/${::casename}_persp30.png
|
||||
|
||||
set aCubeMap [locate_data_file Circus_CubeMap_V.png]
|
||||
vlight -change 1 -intensity 1
|
||||
vbackground -cubemap $aCubeMap
|
||||
vcamera -ortho
|
||||
vdump $::imagedir/${::casename}_orthoenv.png
|
||||
vcamera -persp
|
||||
vdump $::imagedir/${::casename}_perspenv.png
|
22
tests/opengl/data/shading/phong_dir1
Normal file
22
tests/opengl/data/shading/phong_dir1
Normal file
@@ -0,0 +1,22 @@
|
||||
puts "========"
|
||||
puts "Per-fragment lighting using built-in GLSL program, one directional light source."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# setup viewer
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
vcaps -ffp 0
|
||||
vrenderparams -shadingModel phong
|
||||
|
||||
# display shape
|
||||
restore [locate_data_file occ/fuse.brep] f
|
||||
vaxo
|
||||
vdisplay f -dispmode 1
|
||||
vfit
|
||||
vrotate -0.5 0.0 0.0
|
||||
vfit
|
||||
vdump ${imagedir}/${casename}.png
|
30
tests/opengl/data/shading/phong_dir2
Normal file
30
tests/opengl/data/shading/phong_dir2
Normal file
@@ -0,0 +1,30 @@
|
||||
puts "========"
|
||||
puts "Per-fragment lighting using built-in GLSL program, two directional light sources."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# setup viewer
|
||||
vclear
|
||||
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
|
||||
|
||||
# display shape
|
||||
restore [locate_data_file occ/fuse.brep] f
|
||||
vaxo
|
||||
vdisplay f -dispmode 1
|
||||
vfit
|
||||
vrotate -0.5 0.0 0.0
|
||||
vfit
|
||||
vdump ${imagedir}/${casename}.png
|
54
tests/opengl/data/shading/phong_pos1
Normal file
54
tests/opengl/data/shading/phong_pos1
Normal file
@@ -0,0 +1,54 @@
|
||||
puts "========"
|
||||
puts "Per-fragment lighting using built-in GLSL program, one positional light source."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
|
||||
# create objects
|
||||
set anX 0.001
|
||||
circle c 0 0 0 0.001
|
||||
mkedge e c
|
||||
wire w e
|
||||
plane s
|
||||
mkface f1 s w
|
||||
mkface f2 s w
|
||||
ttranslate f1 $anX -0.001 0
|
||||
|
||||
# display objects
|
||||
vtop
|
||||
vdisplay -dispMode 1 f1 f2
|
||||
vsetlocation f2 $anX 0.001 0
|
||||
vpoint vl $anX 0 0.001
|
||||
vfit
|
||||
vzbufftrihedron
|
||||
|
||||
# setup light
|
||||
vcaps -ffp 0
|
||||
vrenderparams -shadingModel phong
|
||||
vlight -layer default -clear
|
||||
vlight -layer default -add positional -pos $anX 0 0.001 -color RED1 -headLight 0
|
||||
|
||||
set aColor1 [vreadpixel 205 180 rgb name]
|
||||
set aColor2 [vreadpixel 205 220 rgb name]
|
||||
if { "$aColor1" != "RED" || "$aColor2" != "RED" } {
|
||||
puts "Error: expected color near the light spot is RED"
|
||||
}
|
||||
|
||||
set aColor3 [vreadpixel 205 132 rgb name]
|
||||
set aColor4 [vreadpixel 205 280 rgb name]
|
||||
if { "$aColor3" != "RED3" || "$aColor4" != "RED3" } {
|
||||
if { "$aColor3" != "RED4" && "$aColor4" != "RED4" } {
|
||||
puts "Error: expected color mid from the light spot is RED3"
|
||||
}
|
||||
}
|
||||
|
||||
set aColor5 [vreadpixel 205 100 rgb name]
|
||||
set aColor6 [vreadpixel 205 306 rgb name]
|
||||
if { "$aColor5" != "RED4" || "$aColor6" != "RED4" } {
|
||||
puts "Error: expected color far from the light spot is RED4"
|
||||
}
|
||||
vdump ${imagedir}/${casename}.png
|
44
tests/opengl/data/shading/phong_pos2
Normal file
44
tests/opengl/data/shading/phong_pos2
Normal file
@@ -0,0 +1,44 @@
|
||||
puts "========"
|
||||
puts "0029283: Visualization - allow defining more than 8 light sources"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# display objects
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1 -width 1024 -height 768
|
||||
vcaps -ffp 0
|
||||
vrenderparams -shadingModel phong
|
||||
vaxo
|
||||
for { set anObjIter 0 } { $anObjIter < 3 } { incr anObjIter } {
|
||||
set aShiftX [expr -4 + $anObjIter * 4]
|
||||
psphere s$anObjIter 0.5
|
||||
vdisplay -dispMode 1 s$anObjIter
|
||||
vsetlocation s$anObjIter $aShiftX 0 0
|
||||
}
|
||||
vfit
|
||||
|
||||
# define lights
|
||||
set THE_LIGHTS {
|
||||
{ -1 -1 -1 RED1 }
|
||||
{ 1 -1 -1 YELLOW }
|
||||
{ -1 1 -1 BLUE }
|
||||
{ -1 -1 1 CYAN }
|
||||
{ 1 1 -1 PURPLE }
|
||||
{ 1 1 1 WHITE }
|
||||
{ -1 1 1 HOTPINK }
|
||||
{ 1 -1 1 GREEN }
|
||||
{ -4 -1 0 MAGENTA }
|
||||
{ 4 -1 0 MAGENTA3 }
|
||||
}
|
||||
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
|
||||
vpoint v${aLightIter} {*}$aPos
|
||||
vdrawtext t${aLightIter} "light${aLightIter} $aColor" -pos {*}$aPos -color $aColor
|
||||
vdump $::imagedir/${::casename}_${aLightIter}.png
|
||||
}
|
46
tests/opengl/data/shading/phong_pos3
Normal file
46
tests/opengl/data/shading/phong_pos3
Normal file
@@ -0,0 +1,46 @@
|
||||
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 BLUE }
|
||||
{ -1 -1 1 CYAN }
|
||||
{ 1 1 -1 PURPLE }
|
||||
{ 1 1 1 WHITE }
|
||||
{ -1 1 1 HOTPINK }
|
||||
{ 1 -1 1 GREEN }
|
||||
{ 0 -1 0 MAGENTA }
|
||||
{ 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
|
36
tests/opengl/data/shading/phong_pos4
Normal file
36
tests/opengl/data/shading/phong_pos4
Normal file
@@ -0,0 +1,36 @@
|
||||
puts "========"
|
||||
puts "0029283: Visualization - allow defining more than 8 light sources"
|
||||
puts "Test case creates about 100 of light sources."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
vcaps -ffp 0
|
||||
vrenderparams -shadingModel phong
|
||||
box b -50 5 -50 100 100 100
|
||||
vdisplay -dispMode 1 b
|
||||
vfront
|
||||
vfit
|
||||
|
||||
# define lights
|
||||
set THE_COLORS { RED1 YELLOW BLUE CYAN PURPLE WHITE HOTPINK GREEN MAGENTA MAGENTA3 }
|
||||
vlight clear
|
||||
set aNbColors 10
|
||||
set aLightIndex 0
|
||||
set aConstAtten 0.1
|
||||
set aLinAtten 1
|
||||
set aRand [expr srand(1)]
|
||||
for { set anZIter -50 } { $anZIter <= 50 } { set anZIter [expr $anZIter + 10] } {
|
||||
for { set anXIter -50 } { $anXIter <= 50 } { set anXIter [expr $anXIter + 10] } {
|
||||
set anIndex [expr {int(rand() * $aNbColors)}]
|
||||
set aColor [lindex $THE_COLORS $anIndex]
|
||||
set aPos "$anXIter 0 $anZIter"
|
||||
vlight -add positional -pos {*}$aPos -color $aColor -headLight 0 -constAttenuation $aConstAtten -linearAttenuation $aLinAtten
|
||||
vpoint v${aLightIndex} {*}$aPos
|
||||
set aLightIndex [expr $aLightIndex + 1]
|
||||
}
|
||||
}
|
||||
vdump ${imagedir}/${casename}.png
|
53
tests/opengl/data/shading/phong_spot1
Normal file
53
tests/opengl/data/shading/phong_spot1
Normal file
@@ -0,0 +1,53 @@
|
||||
puts "========"
|
||||
puts "Per-fragment lighting using built-in GLSL program, one spot light source."
|
||||
puts "Visual comparison with the reference snapshot should be performed for this test case."
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1
|
||||
|
||||
# create objects
|
||||
set anX 0.001
|
||||
circle c 0 0 0 0.001
|
||||
mkedge e c
|
||||
wire w e
|
||||
plane s
|
||||
mkface f1 s w
|
||||
mkface f2 s w
|
||||
ttranslate f1 $anX -0.001 0
|
||||
|
||||
# display objects
|
||||
vtop
|
||||
vdisplay -dispMode 1 f1 f2
|
||||
vsetlocation f2 $anX 0.001 0
|
||||
vpoint vl $anX 0 0.001
|
||||
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
|
||||
|
||||
set aColor1 [vreadpixel 205 180 rgb name]
|
||||
set aColor2 [vreadpixel 205 220 rgb name]
|
||||
if { "$aColor1" != "RED" || "$aColor2" != "RED" } {
|
||||
puts "Error: expected color near the light spot is RED"
|
||||
}
|
||||
|
||||
set aColor3 [vreadpixel 205 132 rgb name]
|
||||
set aColor4 [vreadpixel 205 280 rgb name]
|
||||
if { "$aColor3" != "RED4" || "$aColor4" != "RED4" } {
|
||||
puts "Error: expected color mid from the light spot is RED4"
|
||||
}
|
||||
|
||||
set aColor5 [vreadpixel 205 100 rgb name]
|
||||
set aColor6 [vreadpixel 205 306 rgb name]
|
||||
if { "$aColor5" != "GRAY7" || "$aColor6" != "GRAY8" } {
|
||||
if { "$aColor5" != "GRAY2" && "$aColor6" != "GRAY2" } {
|
||||
puts "Error: expected color far from the light spot is GRAY7"
|
||||
}
|
||||
}
|
||||
vdump ${imagedir}/${casename}.png
|
68
tests/opengl/data/shading/shading_models
Normal file
68
tests/opengl/data/shading/shading_models
Normal file
@@ -0,0 +1,68 @@
|
||||
puts "========"
|
||||
puts "Test various Shading Models assigned per-object"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
# PBR doesn't work with Compatible Profile on macOS
|
||||
#if { $::tcl_platform(os) == "Darwin" } { vcaps -core }
|
||||
|
||||
# setup viewer
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1 -width 912 -height 912
|
||||
|
||||
# define spheres with a rough triangulation to easily distinguish Shading Models
|
||||
psphere p0 10
|
||||
copytranslate p11 p0 0 0 0
|
||||
copytranslate p12 p0 40 0 0
|
||||
copytranslate p21 p0 0 20 0
|
||||
copytranslate p22 p0 40 20 0
|
||||
copytranslate p31 p0 0 40 0
|
||||
copytranslate p32 p0 40 40 0
|
||||
compound p11 p12 p21 p22 p31 p32 ss
|
||||
incmesh ss 1
|
||||
vdefaults -autoTriang 0
|
||||
|
||||
# display objects
|
||||
vdisplay -dispMode 1 p11 p12 p21 p22 p31 p32
|
||||
vdrawparray p41 triangles v 0 55 0 v 0 75 0 v 20 55 0 v 0 55 0 v 0 75 0 v 0 55 20 v 0 55 0 v 0 55 20 v 20 55 0 v 0 75 0 v 0 55 20 v 20 55 0
|
||||
vdrawparray p42 triangles v 40 55 0 v 40 75 0 v 60 55 0 v 40 55 0 v 40 75 0 v 40 55 20 v 40 55 0 v 40 55 20 v 60 55 0 v 40 75 0 v 40 55 20 v 60 55 0
|
||||
vtop
|
||||
vrotate -0.9 0.1 0
|
||||
vfit
|
||||
|
||||
vcaps -ffp 1
|
||||
vdump $::imagedir/${::casename}_defaults_ffp.png
|
||||
|
||||
vcaps -ffp 0
|
||||
vdump $::imagedir/${::casename}_defaults.png
|
||||
|
||||
# customize shading models
|
||||
vaspects p11 -setShadingModel VERTEX
|
||||
vdrawtext t11 Graphic3d_TOSM_VERTEX -pos 10 5 10 -color RED -aspect BOLD
|
||||
vaspects p12 -setShadingModel FRAGMENT
|
||||
vdrawtext t12 Graphic3d_TOSM_FRAGMENT -pos 50 5 10 -color RED -aspect BOLD
|
||||
|
||||
vaspects p21 -setShadingModel PBR
|
||||
vdrawtext t21 Graphic3d_TOSM_PBR -pos 10 25 10 -color RED -aspect BOLD
|
||||
vaspects p22 -setShadingModel PBR_FACET
|
||||
vdrawtext t22 Graphic3d_TOSM_PBR_FACET -pos 50 25 10 -color RED -aspect BOLD
|
||||
|
||||
vaspects p31 -setShadingModel UNLIT
|
||||
vdrawtext t31 Graphic3d_TOSM_UNLIT -pos 10 45 10 -color RED -aspect BOLD
|
||||
vaspects p32 -setShadingModel FACET
|
||||
vdrawtext t32 Graphic3d_TOSM_FACET -pos 50 45 10 -color RED -aspect BOLD
|
||||
vaspects p41 -setShadingModel VERTEX
|
||||
vdrawtext t41 Graphic3d_TOSM_VERTEX -pos 10 65 10 -color RED -aspect BOLD
|
||||
vaspects p42 -setShadingModel FACET
|
||||
vdrawtext t42 Graphic3d_TOSM_FACET -pos 50 65 10 -color RED -aspect BOLD
|
||||
vdisplay -topmost t11 t12 t21 t22 t31 t32 t41 t42
|
||||
|
||||
vcaps -ffp 1
|
||||
vdump $::imagedir/${::casename}_ffp.png
|
||||
|
||||
vcaps -ffp 0
|
||||
vlight -change 1 -intensity 0.1
|
||||
vrenderparams -shadingModel pbr
|
||||
vdump $::imagedir/${::casename}.png
|
76
tests/opengl/data/shading/vert_color
Normal file
76
tests/opengl/data/shading/vert_color
Normal file
@@ -0,0 +1,76 @@
|
||||
puts "============"
|
||||
puts "0032198: Visualization, TKOpenGl - per-vertex lighting ignores back/front material colors"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
set aVerts {
|
||||
{{0 55 0} { 0 75 0} {20 55 0}}
|
||||
{{0 75 0} { 0 55 20} {20 55 0}}
|
||||
{{0 55 0} { 0 55 20} { 0 75 0}}
|
||||
{{0 55 0} {20 55 0} { 0 55 20}}
|
||||
}
|
||||
set aColors {
|
||||
{{1.0 0.0 0.0} {0.0 1.0 0.0} {0.0 0.0 1.0}}
|
||||
{{1.0 1.0 0.0} {1.0 1.0 1.0} {0.0 1.0 1.0}}
|
||||
{{0.5 0.0 0.0} {0.0 0.0 0.5} {0.0 0.5 0.0}}
|
||||
{{0.5 0.5 0.0} {0.0 0.5 0.5} {0.5 0.0 0.5}}
|
||||
}
|
||||
set aNormals {
|
||||
{ 0 0 -1}
|
||||
{ 1 1 1}
|
||||
{-1 0 0}
|
||||
{ 0 -1 0}
|
||||
}
|
||||
|
||||
proc genTris {theFrom theTo theColors} {
|
||||
set aTris ""
|
||||
for {set t $theFrom} {$t <= $theTo} {incr t} {
|
||||
for {set n 0} {$n < 3} {incr n} {
|
||||
set aVert [lindex $::aVerts $t]
|
||||
set aCol [lindex $::aColors $t]
|
||||
set aNorm [lindex $::aNormals $t]
|
||||
set aTris "$aTris v [lindex $aVert $n] n $aNorm"
|
||||
if { $theColors == 1 } { set aTris "$aTris c [lindex $aCol $n]" }
|
||||
}
|
||||
}
|
||||
return $aTris
|
||||
}
|
||||
|
||||
set aTris1 [genTris 0 3 0]
|
||||
set aTris1c [genTris 0 3 1]
|
||||
set aTris2 [genTris 0 1 0]
|
||||
set aTris2c [genTris 0 1 1]
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vinit View1
|
||||
vviewparams -scale 10 -proj -0.3 -0.7 0.6 -up 0.013 0.65 0.75 -at 35.4 61.8 31.5
|
||||
vdrawparray t1 triangles {*}$aTris1
|
||||
vdrawparray t1c triangles {*}$aTris1c
|
||||
vdrawparray t2 triangles {*}$aTris2
|
||||
vdrawparray t2c triangles {*}$aTris2c
|
||||
vdrawparray t3 triangles {*}$aTris2
|
||||
vdrawparray t3c triangles {*}$aTris2c
|
||||
vlocation t1 -location 0 0 0
|
||||
vlocation t2 -location 30 0 0
|
||||
vlocation t3 -location 60 0 0
|
||||
vlocation t1c -location 0 0 30
|
||||
vlocation t2c -location 30 0 30
|
||||
vlocation t3c -location 60 0 30
|
||||
vaspects t1 -color GREEN -backfaceColor RED
|
||||
vaspects t2 -color GREEN -backfaceColor RED
|
||||
vaspects t1c -color GREEN -backfaceColor RED
|
||||
vaspects t2c -color GREEN -backfaceColor RED
|
||||
vaspects t3 -color WHITE -backfaceColor WHITE
|
||||
vaspects t3c -color WHITE -backfaceColor WHITE
|
||||
|
||||
vrenderparams -shadingModel VERT
|
||||
vdump ${imagedir}/${casename}_vert.png
|
||||
vrenderparams -shadingModel PHONG
|
||||
vdump ${imagedir}/${casename}_phong.png
|
||||
vrenderparams -shadingModel FLAT
|
||||
vdump ${imagedir}/${casename}_flat.png
|
||||
vrenderparams -shadingModel UNLIT
|
||||
vdump ${imagedir}/${casename}_unlit.png
|
||||
vrenderparams -shadingModel PBR
|
||||
vdump ${imagedir}/${casename}_pbr.png
|
Reference in New Issue
Block a user