0030102: Visualization, TKOpenGl - Graphic3d_TOSM_FACET shading is incorrect in some...
authormnv <mnv@opencascade.com>
Fri, 31 Aug 2018 12:14:49 +0000 (15:14 +0300)
committerbugmaster <bugmaster@opencascade.com>
Mon, 3 Sep 2018 12:46:20 +0000 (15:46 +0300)
gl_FrontFacing is now considered within Normal computation.

src/OpenGl/OpenGl_ShaderManager.cxx
tests/bugs/vis/bug30102 [new file with mode: 0644]

index bdde9fb..71f6bda 100644 (file)
@@ -2192,6 +2192,7 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramPhong (Handle(OpenGl_Sha
     + aSrcFragExtraMain
     + (isFlatNormal
     ? EOL"  Normal = normalize (cross (dFdx (Position.xyz / Position.w), dFdy (Position.xyz / Position.w)));"
+      EOL"  if (!gl_FrontFacing) { Normal = -Normal; }"
     : "")
     + EOL"  occSetFragColor (getColor());"
     + aSrcFragWriteOit
diff --git a/tests/bugs/vis/bug30102 b/tests/bugs/vis/bug30102
new file mode 100644 (file)
index 0000000..3028be9
--- /dev/null
@@ -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