mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-09-03 14:10:33 +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:
59
tests/opengl/data/geom/geom1
Normal file
59
tests/opengl/data/geom/geom1
Normal file
@@ -0,0 +1,59 @@
|
||||
puts "========"
|
||||
puts "0029074: Visualization, TKOpenGl - support Geometry Shader definition"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
set aShaderVert "
|
||||
out vec4 VertColor;
|
||||
void main() {
|
||||
VertColor = occColor;
|
||||
gl_Position = occVertex;
|
||||
}"
|
||||
|
||||
# define a Geometry shader drawing shrinked triangles
|
||||
set aShaderGeom "
|
||||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices=3) out;
|
||||
in vec4 VertColor\[3\];
|
||||
out vec4 Color;
|
||||
void main() {
|
||||
mat4 aMat = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix;
|
||||
vec3 aCenter = vec3 (0.0, 0.0, 0.0);
|
||||
for (int aTriVertIter = 0; aTriVertIter < 3; ++aTriVertIter) {
|
||||
aCenter += gl_in\[aTriVertIter\].gl_Position.xyz;
|
||||
}
|
||||
aCenter /= 3.0;
|
||||
for (int aTriVertIter = 0; aTriVertIter < 3; ++aTriVertIter) {
|
||||
vec3 aVec = gl_in\[aTriVertIter\].gl_Position.xyz - aCenter;
|
||||
vec3 aVertRes = aCenter + normalize (aVec) * length (aVec) * 0.75;
|
||||
gl_Position = aMat * vec4 (aVertRes, 1.0);
|
||||
Color = VertColor\[aTriVertIter\] * 2.0;
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}"
|
||||
|
||||
set aShaderFrag "
|
||||
in vec4 Color;
|
||||
void main() {
|
||||
occFragColor = Color;
|
||||
}"
|
||||
|
||||
# draw a box
|
||||
box b 1 2 3
|
||||
vcaps -core
|
||||
vclear
|
||||
vinit View1
|
||||
if { [string match "OpenGL ES 2.0*" [vglinfo VERSION]] || [string match "OpenGL ES 3.0*" [vglinfo VERSION]] } {
|
||||
puts "Skipping test case: OpenGL ES 3.2+ is required"
|
||||
return
|
||||
}
|
||||
vaxo
|
||||
vdisplay -dispMode 1 -mutable b
|
||||
vfit
|
||||
vrotate 0.2 0.0 0.0
|
||||
vdump $::imagedir/${::casename}_normal.png
|
||||
|
||||
vshaderprog b -vert $aShaderVert -geom $aShaderGeom -frag $aShaderFrag
|
||||
vdump $::imagedir/${::casename}_geom.png
|
72
tests/opengl/data/geom/interior1
Normal file
72
tests/opengl/data/geom/interior1
Normal file
@@ -0,0 +1,72 @@
|
||||
puts "============"
|
||||
puts "0029076: Visualization - implement element shrinking Shader"
|
||||
puts "Test case on spheres"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1 -width 768 -height 409
|
||||
vdefaults -autoTriang 0
|
||||
vzbufftrihedron
|
||||
psphere s1 2
|
||||
psphere s2 1
|
||||
psphere s3 1
|
||||
psphere s4 1
|
||||
psphere s5 1
|
||||
compound s1 s2 s3 s4 s5 c
|
||||
incmesh c 1.0
|
||||
vdisplay -dispMode 1 s1 s2 s3 s4 s5
|
||||
vsetlocation s2 -1.3 -1.3 1.3
|
||||
vsetlocation s3 1.3 1.3 1.3
|
||||
vsetlocation s4 1.3 -1.3 0.0
|
||||
vsetlocation s5 -1.3 -1.3 -1.3
|
||||
vrotate 0.0 0.5 0.0
|
||||
vrotate 0.4 0.0 0.0
|
||||
vfit
|
||||
|
||||
vaspects s1 -setShadingModel PHONG -setInteriorStyle HOLLOW -setDrawEdges 1 -color GRAY80
|
||||
vdrawtext t1 " s1: phong hollow-edges " -pos 2 0 0 -disptype SUBTITLE -color BLACK -subColor GRAY80
|
||||
|
||||
vaspects s2 -setShadingModel GOURAUD -setInteriorStyle SOLID -setDrawEdges 1 -setEdgeColor YELLOW
|
||||
vdrawtext t2 " s2: gouraud solid-edges " -pos -1.3 -1.3 2.5 -halign CENTER -disptype SUBTITLE -color BLACK -subColor YELLOW
|
||||
|
||||
vaspects s3 -setShadingModel PHONG -setInteriorStyle SOLID -setDrawEdges 1 -edgeWidth 2 -setEdgeColor BLUE
|
||||
vdrawtext t3 " s3: phong solid-edges " -pos 1.3 1.3 2.5 -halign CENTER -disptype SUBTITLE -color WHITE -subColor BLUE
|
||||
|
||||
vaspects s4 -setShadingModel GOURAUD -setInteriorStyle HIDDENLINE -setDrawEdges 1 -setEdgeColor RED
|
||||
vdrawtext t4 " s4: hiddenline-edges " -pos 1.3 -1.3 -1.3 -halign CENTER -disptype SUBTITLE -color BLACK -subColor RED
|
||||
|
||||
vaspects s5 -setShadingModel FLAT -setInteriorStyle SOLID -setDrawEdges 1 -setEdgeColor 0 1 0 0 -edgeWidth 3
|
||||
vdrawtext t5 " s5: flat solid-edges " -pos -1.3 -1.3 -2.5 -halign CENTER -disptype SUBTITLE -color BLACK -subColor GREEN
|
||||
|
||||
vrenderparams -msaa 0
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_ortho_polmode.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_ortho_glsl.png
|
||||
|
||||
vrenderparams -msaa 4
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_ortho_polmode_msaa.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_ortho_glsl_msaa.png
|
||||
|
||||
vcamera -persp
|
||||
vzoom 0.8
|
||||
vrenderparams -msaa 0
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_persp_polmode.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_persp_glsl.png
|
||||
|
||||
vrenderparams -msaa 4
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_persp_polmode_msaa.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_persp_glsl_msaa.png
|
69
tests/opengl/data/geom/interior2
Normal file
69
tests/opengl/data/geom/interior2
Normal file
@@ -0,0 +1,69 @@
|
||||
puts "============"
|
||||
puts "0029076: Visualization - implement element shrinking Shader"
|
||||
puts "Test case on boxes"
|
||||
puts "============"
|
||||
puts ""
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
vclear
|
||||
vclose ALL
|
||||
vinit View1 -width 768 -height 409
|
||||
vzbufftrihedron
|
||||
vbackground -gradient B4C8FF B4B4B4 -gradientMode VERTICAL
|
||||
box b1 -2 0 2 1 0.2 1
|
||||
box b2 2 0 2 1 0.2 1
|
||||
box b3 0 0 0 1 0.2 1
|
||||
box b4 -2 0 -2 1 0.2 1
|
||||
box b5 2 0 -2 1 0.2 1
|
||||
vdisplay -dispMode 1 b1 b2 b3 b4 b5
|
||||
vfit
|
||||
|
||||
vaspects b1 -setShadingModel PHONG -setInteriorStyle HOLLOW -setDrawEdges 1 -color BLACK
|
||||
vdrawtext t1 " b1: phong hollow-edges " -pos -2 0 2 -halign RIGHT -disptype SUBTITLE -color WHITE -subColor BLACK
|
||||
|
||||
vaspects b2 -setShadingModel GOURAUD -setInteriorStyle SOLID -setDrawEdges 1 -setEdgeColor YELLOW
|
||||
vdrawtext t2 " b2: gouraud solid-edges " -pos 2 0 2 -halign RIGHT -disptype SUBTITLE -color BLACK -subColor YELLOW
|
||||
|
||||
vaspects b3 -setShadingModel PHONG -setInteriorStyle SOLID -setDrawEdges 1 -edgeWidth 2 -setEdgeColor BLUE
|
||||
vdrawtext t3 " b3: phong solid-edges " -pos 0 0 0 -halign RIGHT -disptype SUBTITLE -color WHITE -subColor BLUE
|
||||
|
||||
vaspects b4 -setShadingModel GOURAUD -setInteriorStyle HIDDENLINE -setDrawEdges 1 -setEdgeColor RED
|
||||
vdrawtext t4 " b4: hiddenline-edges " -pos -2 0 -2 -halign RIGHT -disptype SUBTITLE -color BLACK -subColor RED
|
||||
|
||||
vaspects b5 -setShadingModel FLAT -setInteriorStyle SOLID -setDrawEdges 1 -setEdgeColor 0 1 0 0 -edgeWidth 3
|
||||
vdrawtext t5 " b5: flat solid-edges " -pos 2 0 -2 -halign RIGHT -disptype SUBTITLE -color BLACK -subColor GREEN
|
||||
|
||||
vdrawparray p6 triangles v 0 0 0 v 0 1 0 v 1 1 0 v 1 0 0 v 2 1 0 v 2 0 0 e 3 e 1 e 2 e 1 e 3 e 4 e 5 e 4 e 3 e 4 e 5 e 6
|
||||
vlocation p6 -setLocation 2 1 0
|
||||
vaspects p6 -setInteriorStyle SOLID -setDrawEdges 1 -setEdgeColor FIREBRICK -setEdgeWidth 4 -setQuadEdges 1
|
||||
vdrawtext t6 " p6: quads " -pos 2 1 -0.4 -halign RIGHT -disptype SUBTITLE -color BLACK -subColor FIREBRICK
|
||||
|
||||
vrenderparams -msaa 0
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_ortho_polmode.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_ortho_glsl.png
|
||||
|
||||
vrenderparams -msaa 4
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_ortho_polmode_msaa.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_ortho_glsl_msaa.png
|
||||
|
||||
vcamera -persp
|
||||
vzoom 0.7
|
||||
vrenderparams -msaa 0
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_persp_polmode.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_persp_glsl.png
|
||||
|
||||
vrenderparams -msaa 4
|
||||
vcaps -polygonMode 1
|
||||
vdump $imagedir/${casename}_persp_polmode_msaa.png
|
||||
|
||||
vcaps -polygonMode 0
|
||||
vdump $imagedir/${casename}_persp_glsl_msaa.png
|
79
tests/opengl/data/geom/tess1
Normal file
79
tests/opengl/data/geom/tess1
Normal file
@@ -0,0 +1,79 @@
|
||||
puts "========"
|
||||
puts "0029074: Visualization, TKOpenGl - support of Tessellation Shaders"
|
||||
puts "========"
|
||||
|
||||
pload MODELING VISUALIZATION
|
||||
|
||||
set aShaderVert "
|
||||
out vec4 VertColor;
|
||||
void main() {
|
||||
VertColor = occColor;
|
||||
gl_Position = occVertex;
|
||||
}"
|
||||
|
||||
set aShaderTessCtrl "
|
||||
layout(vertices = 3) out;
|
||||
void main() {
|
||||
if (gl_InvocationID == 0) {
|
||||
gl_TessLevelInner\[0\] = 7.0;
|
||||
gl_TessLevelOuter\[0\] = 2.0;
|
||||
gl_TessLevelOuter\[1\] = 3.0;
|
||||
gl_TessLevelOuter\[2\] = 7.0;
|
||||
}
|
||||
gl_out\[gl_InvocationID\].gl_Position = gl_in\[gl_InvocationID\].gl_Position;
|
||||
}"
|
||||
|
||||
set aShaderTessEval "
|
||||
layout(triangles, equal_spacing, ccw) in;
|
||||
void main() {
|
||||
vec3 aPnt0 = gl_TessCoord.x * gl_in\[0\].gl_Position.xyz;
|
||||
vec3 aPnt1 = gl_TessCoord.y * gl_in\[1\].gl_Position.xyz;
|
||||
vec3 aPnt2 = gl_TessCoord.z * gl_in\[2\].gl_Position.xyz;
|
||||
gl_Position = vec4 (aPnt0 + aPnt1 + aPnt2, 1.0);
|
||||
}"
|
||||
|
||||
set aShaderGeom "
|
||||
layout(triangles) in;
|
||||
layout(triangle_strip, max_vertices=3) out;
|
||||
void main() {
|
||||
mat4 aMat = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix;
|
||||
vec3 aCenter = vec3 (0.0, 0.0, 0.0);
|
||||
for (int aTriVertIter = 0; aTriVertIter < 3; ++aTriVertIter) {
|
||||
aCenter += gl_in\[aTriVertIter\].gl_Position.xyz;
|
||||
}
|
||||
aCenter /= 3.0;
|
||||
for (int aTriVertIter = 0; aTriVertIter < 3; ++aTriVertIter) {
|
||||
vec3 aVec = gl_in\[aTriVertIter\].gl_Position.xyz - aCenter;
|
||||
vec3 aVertRes = aCenter + normalize (aVec) * length (aVec) * 0.75;
|
||||
gl_Position = aMat * vec4 (aVertRes, 1.0);
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}"
|
||||
|
||||
set aShaderFrag "
|
||||
void main() {
|
||||
occFragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}"
|
||||
|
||||
# draw a box
|
||||
box b 1 2 3
|
||||
explode b F
|
||||
|
||||
vcaps -core
|
||||
vclear
|
||||
vinit View1
|
||||
if { [string match "OpenGL ES 2.0*" [vglinfo VERSION]] || [string match "OpenGL ES 3.0*" [vglinfo VERSION]] } {
|
||||
puts "Skipping test case: OpenGL ES 3.2+ is required"
|
||||
return
|
||||
}
|
||||
vaxo
|
||||
vdisplay -dispMode 1 -mutable b_1
|
||||
vfit
|
||||
vrotate 0.2 0.0 0.0
|
||||
|
||||
# take snapshot with built-in shader
|
||||
vdump $::imagedir/${::casename}_normal.png
|
||||
|
||||
vshaderprog b_1 -vert $aShaderVert -tessCtrl $aShaderTessCtrl -tessEval $aShaderTessEval -geom $aShaderGeom -frag $aShaderFrag
|
||||
vdump $::imagedir/${::casename}_tess.png
|
Reference in New Issue
Block a user