1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-08 14:17:06 +03:00

0024437: Visualization - silhouette edges based on OpenGL

Added new flag Graphic3d_AspectFillArea3d::ToDrawSilhouette() activating silhouette (outline) rendering.

The new feature can simulate fake HLR look-n-feel,
when combined with Aspect_IS_HIDDENLINE interior style (filling object with background color),
face boundary edges (with most continuity flag set to c2 or lower).

Silhouette GLSL program is very simple - it displaces model alongside vertex normal,
so that it is applicable only to smooth surfaces and closed volumes,
and produces visual artifacts at sharp corners, especially when face boundary is disabled.

OpenGl_SetOfShaderPrograms has been modified so that to reduce
dimensions of the grid of static size based on amount of program combinations.

OpenGl_PrimitiveArray no more allocates VBO resources if primitive array
is marked to be not drawn via interior style / line type / marker type.
This commit is contained in:
asl
2019-02-28 01:36:32 +03:00
committed by apn
parent 967d2f4f30
commit 6ef0d6f156
12 changed files with 303 additions and 109 deletions

25
tests/v3d/glsl/outline1 Normal file
View File

@@ -0,0 +1,25 @@
puts "========"
puts "0024437: Visualization - silhouette edges based on OpenGL"
puts "Draw box and sphere primitives"
puts "========"
puts ""
pload MODELING VISUALIZATION
vclear
vinit View1
vsetcolorbg 220 220 220
#vsetgradientbg 180 200 255 180 180 180 2
vaxo
psphere s 1.0
box b 2 -2 -2 1 2 3
vdisplay -dispMode 1 b s
vfit
vaspects b s -setDrawSilhouette 1 -setEdgeColor RED -setEdgeWidth 4 -setFaceBoundaryDraw 1 -setFaceBoundaryColor BLUE1 -setFaceBoundaryWidth 1 -setInteriorStyle HIDDENLINE
vdump $::imagedir/${::casename}_0.png
vaspects b s -setDrawSilhouette 1 -setEdgeColor RED -setEdgeWidth 4 -setFaceBoundaryDraw 1 -setFaceBoundaryColor RED -setFaceBoundaryWidth 4 -setInteriorStyle HIDDENLINE
vdump $::imagedir/${::casename}_1.png

31
tests/v3d/glsl/outline2 Normal file
View File

@@ -0,0 +1,31 @@
puts "========"
puts "0024437: Visualization - silhouette edges based on OpenGL"
puts "Draw bottle sample"
puts "========"
puts ""
pload MODELING VISUALIZATION
# test for creation of bottle as in tutorial (script is in samples)
source $env(CSF_OCCTSamplesPath)/tcl/bottle.tcl
vsetcolorbg 255 255 255
vzbufftrihedron -type wireframe -colorLabels BLACK
vaspects bottle -setDrawSilhouette 1 -setEdgeColor BLACK -setFaceBoundaryDraw 1 -setMostContinuity c0 -setFaceBoundaryColor BLACK -setInteriorStyle HIDDENLINE
vrenderparams -rendScale 2
vcamera -ortho
vfit
vaspects bottle -setDrawSilhouette 0
vdump $::imagedir/${::casename}_ortho0.png
vaspects bottle -setDrawSilhouette 1
vdump $::imagedir/${::casename}_ortho1.png
vcamera -persp
vfit
vaspects bottle -setDrawSilhouette 0
vdump $::imagedir/${::casename}_persp0.png
vaspects bottle -setDrawSilhouette 1
vdump $::imagedir/${::casename}_persp1.png