theWorkspace->View()->Window()->Size(aViewWidth, aViewHeight);
Standard_Integer aMin = aViewWidth < aViewHeight ? aViewWidth : aViewHeight;
- Standard_ShortReal anEdgeWidth = (Standard_ShortReal)anAspectFace->Aspect()->EdgeWidth() / (Standard_ShortReal)aMin;
+ Standard_ShortReal anEdgeWidth = 2*(Standard_ShortReal)anAspectFace->Aspect()->EdgeWidth() / (Standard_ShortReal)aMin;
aCtx->SetSilhouetteThickness(anEdgeWidth);
aCtx->SetIsSilhouettePass(Standard_True);
EOL"uniform float occOrthoScale;"
EOL"uniform float occIsSilhouettePass;"
EOL"uniform float occSilhouetteThickness;"
- EOL""
- EOL"THE_SHADER_IN vec4 normal;"
;
aSrcVertExtraMain +=
EOL" vec3 delta = vec3(0.0, 0.0, 0.0);"
- EOL" if (occIsSilhouettePass > 0.1)"
+ EOL" vec3 pdelta = vec3(0.0, 0.0, 0.0);"
+ EOL" vec4 proj_normal = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * vec4(occNormal, 0.0);"
+ EOL""
+ EOL" float aShift = occSilhouetteThickness / 2.0;"
+ EOL" if (occOrthoScale > 0.0)"
EOL" {"
- EOL" float aShift = occSilhouetteThickness;"
- EOL" if (occOrthoScale > 0.0)"
+ EOL" if (abs(proj_normal[2]) < 0.1)"
EOL" {"
- EOL" aShift *= occOrthoScale;"
- EOL" delta = normal.xyz * aShift;"
+ EOL" float k = 1.0;"
+ EOL" if (occIsSilhouettePass < 0.1)"
+ EOL" k = -1.0;"
+ EOL" "
+ EOL" //aShift *= occOrthoScale;"
+ EOL" vec3 pn = normalize(vec3(proj_normal.xy, 0.0));"
+ EOL" //delta = k * occNormal * aShift;"
+ EOL" pdelta = k * pn * aShift;"
EOL" }"
- EOL" else"
+ EOL" }"
+ EOL" else"
+ EOL" {"
+ EOL" if (occIsSilhouettePass > 0.1)"
EOL" {"
EOL" vec4 pos = occProjectionMatrix * occWorldViewMatrix * occModelWorldMatrix * vertex;"
- EOL" delta = normal.xyz * aShift * pos.w;"
+ EOL" delta = occNormal.xyz * aShift * pos.w;"
EOL" }"
EOL" }"
+ EOL" "
EOL" vertex += vec4(delta, 0.0);"
;
+ aSrcVertEndMain +=
+ EOL"gl_Position += vec4(pdelta.xy, 0.0, 0.0);"
+ ;
+
aSrcFragExtraOut +=
EOL"uniform float occIsSilhouettePass;"
EOL"uniform vec3 occBackgroundColor;"
vsetcolorbg 220 220 220
psphere sph 1.0
+
box b 1 2 3
ttranslate b 2 -2 -2
+pcylinder cyl 1.0 1.0
+ttranslate cyl 4.2 0 0
+
vdisplay -dispMode 1 b
vsetinteriorstyle b outline
-vshowfaceboundary b 1 255 0 0 1.0
+vshowfaceboundary b 1 255 0 0 1
vsetedgetype b -color 255 0 0
vfit
vdisplay -dispMode 1 sph
vsetinteriorstyle sph outline
-vshowfaceboundary sph 1 255 0 0 1.0
+vshowfaceboundary sph 1 255 0 0 1
vsetedgetype sph -color 255 0 0
vfit
+
+vdisplay -dispMode 1 cyl
+vsetinteriorstyle cyl outline
+vshowfaceboundary cyl 1 255 0 0 1
+vsetedgetype cyl -color 255 0 0
+vfit