0027961: Visualization - remove unused and no more working OpenGl_AVIWriter
[occt.git] / src / OpenGl / OpenGl_ShaderManager.cxx
index 270c5e9..d94768d 100644 (file)
@@ -83,7 +83,7 @@ const char THE_FUNC_pointLight[] =
   EOL"  vec3 aLight = occLight_Position (theId).xyz;"
   EOL"  if (occLight_IsHeadlight (theId) == 0)"
   EOL"  {"
-  EOL"    aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 1.0));"
+  EOL"    aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 1.0));"
   EOL"  }"
   EOL"  aLight -= thePoint;"
   EOL
@@ -121,8 +121,8 @@ const char THE_FUNC_spotLight[] =
   EOL"  vec3 aSpotDir = occLight_SpotDirection (theId).xyz;"
   EOL"  if (occLight_IsHeadlight (theId) == 0)"
   EOL"  {"
-  EOL"    aLight   = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight,   1.0));"
-  EOL"    aSpotDir = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aSpotDir, 0.0));"
+  EOL"    aLight   = vec3 (occWorldViewMatrix * vec4 (aLight,   1.0));"
+  EOL"    aSpotDir = vec3 (occWorldViewMatrix * vec4 (aSpotDir, 0.0));"
   EOL"  }"
   EOL"  aLight -= thePoint;"
   EOL
@@ -171,7 +171,7 @@ const char THE_FUNC_directionalLight[] =
   EOL"  vec3 aLight = normalize (occLight_Position (theId).xyz);"
   EOL"  if (occLight_IsHeadlight (theId) == 0)"
   EOL"  {"
-  EOL"    aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 0.0));"
+  EOL"    aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 0.0));"
   EOL"  }"
   EOL
   EOL"  vec3 aHalf = normalize (aLight + theView);"
@@ -200,7 +200,7 @@ const char THE_FUNC_directionalLightFirst[] =
   EOL"  vec3 aLight = normalize (occLightSources[1].xyz);"
   EOL"  if (occLight_IsHeadlight (0) == 0)"
   EOL"  {"
-  EOL"    aLight = vec3 (occWorldViewMatrix * occModelWorldMatrix * vec4 (aLight, 0.0));"
+  EOL"    aLight = vec3 (occWorldViewMatrix * vec4 (aLight, 0.0));"
   EOL"  }"
   EOL
   EOL"  vec3 aHalf = normalize (aLight + theView);"
@@ -767,30 +767,21 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
     return;
   }
 
-  GLint aPlanesNb = 0;
-  for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
-       anIter.More(); anIter.Next())
-  {
-    const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value();
-    if (!myContext->Clipping().IsEnabled (aPlane))
-    {
-      continue;
-    }
-
-    ++aPlanesNb;
-  }
-  if (aPlanesNb < 1)
+  const GLint aNbPlanes = Min (myContext->Clipping().NbClippingOrCappingOn(), THE_MAX_CLIP_PLANES);
+  theProgram->SetUniform (myContext,
+                          theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
+                          aNbPlanes);
+  if (aNbPlanes < 1)
   {
     return;
   }
 
   OpenGl_Vec4 anEquations[THE_MAX_CLIP_PLANES];
   GLuint aPlaneId = 0;
-  for (Graphic3d_SequenceOfHClipPlane::Iterator anIter (myContext->Clipping().Planes());
-       anIter.More(); anIter.Next())
+  for (OpenGl_ClippingIterator aPlaneIter (myContext->Clipping()); aPlaneIter.More(); aPlaneIter.Next())
   {
-    const Handle(Graphic3d_ClipPlane)& aPlane = anIter.Value();
-    if (!myContext->Clipping().IsEnabled (aPlane))
+    const Handle(Graphic3d_ClipPlane)& aPlane = aPlaneIter.Value();
+    if (aPlaneIter.IsDisabled())
     {
       continue;
     }
@@ -810,9 +801,6 @@ void OpenGl_ShaderManager::PushClippingState (const Handle(OpenGl_ShaderProgram)
     ++aPlaneId;
   }
 
-  theProgram->SetUniform (myContext,
-                          theProgram->GetStateLocation (OpenGl_OCC_CLIP_PLANE_COUNT),
-                          aPlanesNb);
   theProgram->SetUniform (myContext, aLocEquations, THE_MAX_CLIP_PLANES, anEquations);
 }