1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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:
kgv
2021-03-22 12:29:04 +03:00
committed by bugmaster
parent a076535090
commit 0d828ac838
1891 changed files with 4279 additions and 6199 deletions

View File

@@ -0,0 +1,29 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading)"
puts "========"
pload MODELING VISUALIZATION
# create box
box b 1 2 3
# draw box
vclear
vclose ALL
vinit View1
vsetdispmode 1
vaxo
vdisplay b
vfit
vrotate 0.2 0.0 0.0
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
vshaderprog b phong
vdump $::imagedir/${::casename}_ph1.png
vclear
vdisplay b
vshaderprog b phong
vdump $::imagedir/${::casename}_ph2.png
vmoveto 250 250

View File

@@ -0,0 +1,33 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading)"
puts "========"
pload MODELING VISUALIZATION
# import model
restore [locate_data_file occ/fuse.brep] f
tclean f
box b 2 0 0 1 0.5 0.25
# draw box
vclear
vclose ALL
vinit View1
vdefaults -absDefl 0.5
vsetdispmode 1
vaxo
vdisplay f
vfit
vrotate -0.5 0.0 0.0
vdisplay b
vfit
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
vshaderprog f phong
vshaderprog b phong
vshaderprog b off
vrotate -0.2 0.0 0.0
vmoveto 100 100
vdump $::imagedir/${::casename}_ph1.png

View File

@@ -0,0 +1,32 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading)"
puts "========"
pload MODELING VISUALIZATION
# import model
restore [locate_data_file occ/fuse.brep] f
tclean f
# draw box
vclear
vclose ALL
vinit View1
vdefaults -absDefl 0.5
vsetdispmode 1
vaxo
vdisplay f
vfit
vrotate -0.5 0.0 0.0
vfit
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
vshaderprog f phong
vdump $::imagedir/${::casename}_ph1.png
vclear
vdisplay f
vshaderprog f phong
vdump $::imagedir/${::casename}_ph2.png
vmoveto 250 250

View File

@@ -0,0 +1,42 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading)"
puts "========"
pload MODELING VISUALIZATION
# import model
restore [locate_data_file occ/fuse.brep] f
tclean f
# draw box
vclear
vclose ALL
vinit View1
vdefaults -absDefl 0.5
vsetdispmode 1
vaxo
vdisplay f
vfit
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
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
vshaderprog f phong
vdump $::imagedir/${::casename}_ph1.png
vclear
vdisplay f
vshaderprog f phong
vdump $::imagedir/${::casename}_ph2.png
vmoveto 250 250

View File

@@ -0,0 +1,32 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading), check plastic material"
puts "========"
pload MODELING VISUALIZATION
# create box
box b 1 2 3
# draw box
vclear
vclose ALL
vinit View1
vsetdispmode 1
vaxo
vdisplay b
vsetmaterial b PLASTIC
vsetcolor b GREEN
vfit
vrotate 0.2 0.0 0.0
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
set aColorL [vreadpixel 150 250 rgb name]
set aColorR [vreadpixel 250 250 rgb name]
if { "$aColorL" != "GREEN3" || "$aColorR" != "GREEN4" } { puts "Error: wrong color (fixed pipeline)!" }
vshaderprog b phong
set aColorL [vreadpixel 150 250 rgb name]
set aColorR [vreadpixel 250 250 rgb name]
if { "$aColorL" != "GREEN3" || "$aColorR" != "GREEN4" } { puts "Error: wrong color (Phong shader)!" }
vdump ${imagedir}/${casename}.png

View File

@@ -0,0 +1,34 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading), check lighting of back faces"
puts "========"
pload MODELING VISUALIZATION
# create box
box b 1 2 3
explode b F
# draw box
vclear
vclose ALL
vinit View1
vsetdispmode 1
vaxo
vdisplay b_1 b_2
vfit
vrotate 0.2 0.0 0.0
# take snapshot with fixed pipeline
vdump $::imagedir/${::casename}_OFF.png
set aColorB [vreadpixel 150 150 rgb name]
set aColorF [vreadpixel 250 250 rgb name]
if { "$aColorB" != "$aColorF"} { puts "Error: front/back colors are different!" }
set aColorFixed $aColorF
# activate phong shader
vshaderprog phong
set aColorB [vreadpixel 150 150 rgb name]
set aColorF [vreadpixel 250 250 rgb name]
if { "$aColorB" != "$aColorF"} { puts "Error: front/back colors are different!" }
if { "$aColorF" != "$aColorFixed"} { puts "Error: colors are different!" }
vdump ${imagedir}/${casename}.png

View File

@@ -0,0 +1,30 @@
puts "========"
puts "Per-pixel lighting using GLSL program (Phong shading)"
puts "========"
pload MODELING VISUALIZATION
# create box
box b 1 2 3
# draw box
vclear
vclose ALL
vinit View1
vsetdispmode 1
vaxo
vdisplay b
vfit
vrotate 0.2 0.0 0.0
vshaderprog b phong
vdump $::imagedir/${::casename}_v1.png
vinit View2
vfit
vdump $::imagedir/${::casename}_v2.png
vmoveto 250 250
vdump $::imagedir/${::casename}_v2sel.png
vactivate View1
vdump $::imagedir/${::casename}_v1sel.png
vclose View2

View File

@@ -0,0 +1,42 @@
puts "========"
puts "0028912: Visualization, TKOpenGl - multi-texture support"
puts "========"
pload MODELING VISUALIZATION
set aShaderVert "
THE_SHADER_OUT vec2 TexCoord;
void main() {
TexCoord = occTexCoord.st;
gl_Position = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * occVertex;
}"
set aShaderFrag "
uniform sampler2D occSampler1;
uniform sampler2D occSampler2;
uniform sampler2D occSampler3;
THE_SHADER_IN vec2 TexCoord;
void main() {
if (TexCoord.s < 0.5 && TexCoord.t < 0.5) { occFragColor = occTexture2D(occSampler0, TexCoord.st); }
else if (TexCoord.s < 0.5 && TexCoord.t >= 0.5) { occFragColor = occTexture2D(occSampler1, TexCoord.st); }
else if (TexCoord.s >= 0.5 && TexCoord.t < 0.5) { occFragColor = occTexture2D(occSampler2, TexCoord.st); }
else { occFragColor = occTexture2D(occSampler3, TexCoord.st); }
}"
# draw a box
box b 1 2 3
vclear
vclose ALL
vinit View1
vaxo
vdisplay -dispMode 1 b
vfit
vrotate 0.2 0.0 0.0
# take snapshot with built-in shader
vtexture b -tex0 3 -tex1 4 -tex2 5 -tex3 6
vdump $::imagedir/${::casename}_normal.png
#vshaderprog b $aShaderVert $aShaderFrag
vshaderprog b -vert $aShaderVert -frag $aShaderFrag
vdump $::imagedir/${::casename}_multi.png