mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0025276: Visualization - Lighting is broken if some kinds of transformation applied to a shape
In order to solve the problem, triangle vertices order is inverted in mirrored mesh (triangulation). Mesh considered to be mirrored if its transformation matrix determinant is less than 0. To handle AIS object mirror transformations "Mirrored" flag stored in OpenGl_Structure. If this flag is enabled, glFrontFace (GL_CW) applied before the draw call. New DRAW commands for visualization level transformations added.
This commit is contained in:
@@ -120,6 +120,7 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
||||
myGlVerMinor (0),
|
||||
myIsInitialized (Standard_False),
|
||||
myIsStereoBuffers (Standard_False),
|
||||
myIsGlNormalizeEnabled (Standard_False),
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
myRenderMode (GL_RENDER),
|
||||
#else
|
||||
@@ -2126,3 +2127,32 @@ void OpenGl_Context::SetPointSize (const Standard_ShortReal theSize)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
// function : SetGlNormalizeEnabled
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
Standard_Boolean OpenGl_Context::SetGlNormalizeEnabled (Standard_Boolean isEnabled)
|
||||
{
|
||||
if (isEnabled == myIsGlNormalizeEnabled)
|
||||
{
|
||||
return myIsGlNormalizeEnabled;
|
||||
}
|
||||
|
||||
Standard_Boolean anOldGlNormalize = myIsGlNormalizeEnabled;
|
||||
|
||||
myIsGlNormalizeEnabled = isEnabled;
|
||||
|
||||
#if !defined(GL_ES_VERSION_2_0)
|
||||
if (isEnabled)
|
||||
{
|
||||
glEnable (GL_NORMALIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDisable (GL_NORMALIZE);
|
||||
}
|
||||
#endif
|
||||
|
||||
return anOldGlNormalize;
|
||||
}
|
||||
|
Reference in New Issue
Block a user