mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-10 18:51:21 +03:00
Cosmetic fixes.
This commit is contained in:
parent
13ce02aa6c
commit
2108a68f57
@ -419,7 +419,7 @@ is
|
|||||||
primitive Mat4;
|
primitive Mat4;
|
||||||
primitive Mat4d;
|
primitive Mat4d;
|
||||||
|
|
||||||
primitive ZLayerSettings;
|
imported ZLayerSettings;
|
||||||
|
|
||||||
--------------------
|
--------------------
|
||||||
-- Category: Classes
|
-- Category: Classes
|
||||||
|
@ -308,7 +308,7 @@ public:
|
|||||||
//! Sets the settings for a single Z layer of specified view.
|
//! Sets the settings for a single Z layer of specified view.
|
||||||
Standard_EXPORT void SetZLayerSettings (const Graphic3d_CView& theCView,
|
Standard_EXPORT void SetZLayerSettings (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId,
|
const Standard_Integer theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings);
|
const Graphic3d_ZLayerSettings& theSettings);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ void OpenGl_GraphicDriver::RemoveZLayer (const Graphic3d_CView& theCView,
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
Standard_EXPORT void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_CView& theCView,
|
Standard_EXPORT void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_CView& theCView,
|
||||||
const Standard_Integer theLayerId,
|
const Standard_Integer theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
||||||
if (aCView)
|
if (aCView)
|
||||||
|
@ -17,20 +17,6 @@
|
|||||||
|
|
||||||
#include <OpenGl_GlCore11.hxx>
|
#include <OpenGl_GlCore11.hxx>
|
||||||
|
|
||||||
//=======================================================================
|
|
||||||
//function : OpenGl_LayerSettings
|
|
||||||
//purpose :
|
|
||||||
//=======================================================================
|
|
||||||
OpenGl_LayerSettings::OpenGl_LayerSettings()
|
|
||||||
: DepthOffsetFactor (1.0f),
|
|
||||||
DepthOffsetUnits (1.0f),
|
|
||||||
Flags (OpenGl_LayerDepthTest
|
|
||||||
| OpenGl_LayerDepthWrite
|
|
||||||
| OpenGl_LayerDepthClear)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
//function : OpenGl_Layer
|
//function : OpenGl_Layer
|
||||||
//purpose :
|
//purpose :
|
||||||
@ -48,13 +34,13 @@ OpenGl_Layer::OpenGl_Layer (const Standard_Integer theNbPriorities)
|
|||||||
void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||||
{
|
{
|
||||||
// separate depth buffers
|
// separate depth buffers
|
||||||
if (IsSettingEnabled (OpenGl_LayerDepthClear))
|
if (IsSettingEnabled (Graphic3d_ZLayerDepthClear))
|
||||||
{
|
{
|
||||||
glClear (GL_DEPTH_BUFFER_BIT);
|
glClear (GL_DEPTH_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle depth test
|
// handle depth test
|
||||||
if (IsSettingEnabled (OpenGl_LayerDepthTest))
|
if (IsSettingEnabled (Graphic3d_ZLayerDepthTest))
|
||||||
{
|
{
|
||||||
glDepthFunc (GL_LESS);
|
glDepthFunc (GL_LESS);
|
||||||
}
|
}
|
||||||
@ -64,17 +50,17 @@ void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handle depth offset
|
// handle depth offset
|
||||||
if (IsSettingEnabled (OpenGl_LayerDepthOffset))
|
if (IsSettingEnabled (Graphic3d_ZLayerDepthOffset))
|
||||||
{
|
{
|
||||||
glPolygonOffset (myLayerSettings.DepthOffsetFactor, myLayerSettings.DepthOffsetUnits);
|
glPolygonOffset (myLayerSettings.DepthOffsetFactor, myLayerSettings.DepthOffsetUnits);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
glPolygonOffset (0.f, 0.f);
|
glPolygonOffset (0.0f, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle depth write
|
// handle depth write
|
||||||
if (IsSettingEnabled (OpenGl_LayerDepthWrite))
|
if (IsSettingEnabled (Graphic3d_ZLayerDepthWrite))
|
||||||
{
|
{
|
||||||
glDepthMask (GL_TRUE);
|
glDepthMask (GL_TRUE);
|
||||||
}
|
}
|
||||||
|
@ -17,34 +17,10 @@
|
|||||||
#define _OpenGl_Layer_Header
|
#define _OpenGl_Layer_Header
|
||||||
|
|
||||||
#include <OpenGl_PriorityList.hxx>
|
#include <OpenGl_PriorityList.hxx>
|
||||||
|
#include <Graphic3d_ZLayerSettings.hxx>
|
||||||
|
|
||||||
class Handle(OpenGl_Workspace);
|
class Handle(OpenGl_Workspace);
|
||||||
|
|
||||||
enum OpenGl_LayerSetting
|
|
||||||
{
|
|
||||||
OpenGl_LayerDepthTest = 1,
|
|
||||||
OpenGl_LayerDepthWrite = 2,
|
|
||||||
OpenGl_LayerDepthClear = 4,
|
|
||||||
OpenGl_LayerDepthOffset = 8
|
|
||||||
};
|
|
||||||
|
|
||||||
struct OpenGl_LayerSettings
|
|
||||||
{
|
|
||||||
//! Initializes settings
|
|
||||||
OpenGl_LayerSettings();
|
|
||||||
|
|
||||||
//! Returns true if theSetting is enabled.
|
|
||||||
const Standard_Boolean IsSettingEnabled (const OpenGl_LayerSetting theSetting) const
|
|
||||||
{
|
|
||||||
return (Flags & theSetting) == theSetting;
|
|
||||||
}
|
|
||||||
|
|
||||||
Standard_ShortReal DepthOffsetFactor; //!< Factor argument value for OpenGl glPolygonOffset function.
|
|
||||||
Standard_ShortReal DepthOffsetUnits; //!< Units argument value for OpenGl glPolygonOffset function.
|
|
||||||
|
|
||||||
Standard_Integer Flags; //!< Storage field for settings.
|
|
||||||
};
|
|
||||||
|
|
||||||
class OpenGl_Layer
|
class OpenGl_Layer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -53,16 +29,16 @@ public:
|
|||||||
OpenGl_Layer (const Standard_Integer theNbPriorities = 11);
|
OpenGl_Layer (const Standard_Integer theNbPriorities = 11);
|
||||||
|
|
||||||
//! Returns settings of the layer object.
|
//! Returns settings of the layer object.
|
||||||
const OpenGl_LayerSettings LayerSettings() const { return myLayerSettings; };
|
const Graphic3d_ZLayerSettings LayerSettings() const { return myLayerSettings; };
|
||||||
|
|
||||||
//! Sets settings of the layer object.
|
//! Sets settings of the layer object.
|
||||||
void SetLayerSettings (OpenGl_LayerSettings theSettings)
|
void SetLayerSettings (Graphic3d_ZLayerSettings theSettings)
|
||||||
{
|
{
|
||||||
myLayerSettings = theSettings;
|
myLayerSettings = theSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns true if theSetting is enabled for the layer.
|
//! Returns true if theSetting is enabled for the layer.
|
||||||
const Standard_Boolean IsSettingEnabled (const OpenGl_LayerSetting theSetting) const
|
const Standard_Boolean IsSettingEnabled (const Graphic3d_ZLayerSetting theSetting) const
|
||||||
{
|
{
|
||||||
return myLayerSettings.IsSettingEnabled (theSetting);
|
return myLayerSettings.IsSettingEnabled (theSetting);
|
||||||
}
|
}
|
||||||
@ -77,8 +53,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
OpenGl_PriorityList myPriorityList; //!< Associated priority list object.
|
OpenGl_PriorityList myPriorityList; //!< Associated priority list object.
|
||||||
|
|
||||||
OpenGl_LayerSettings myLayerSettings; //!< Layer setting flags.
|
Graphic3d_ZLayerSettings myLayerSettings; //!< Layer setting flags.
|
||||||
};
|
};
|
||||||
#endif //_OpenGl_Layer_Header
|
#endif //_OpenGl_Layer_Header
|
||||||
|
@ -1518,13 +1518,6 @@ void OpenGl_View::ChangeZLayer (const OpenGl_Structure *theStructure,
|
|||||||
void OpenGl_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
void OpenGl_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings)
|
const Graphic3d_ZLayerSettings theSettings)
|
||||||
{
|
{
|
||||||
// Convert Graphic3d_ZLayerSettings to OpenGl_LayerSettings
|
myZLayers.Layer (theLayerId).SetLayerSettings (theSettings);
|
||||||
OpenGl_LayerSettings aConvertedSettings;
|
|
||||||
|
|
||||||
aConvertedSettings.DepthOffsetFactor = theSettings.DepthOffsetFactor;
|
|
||||||
aConvertedSettings.DepthOffsetUnits = theSettings.DepthOffsetUnits;
|
|
||||||
aConvertedSettings.Flags = theSettings.Flags;
|
|
||||||
|
|
||||||
myZLayers.Layer (theLayerId).SetLayerSettings (aConvertedSettings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ void V3d_Viewer::DelView( const Handle(V3d_View)& TheView ) {
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void V3d_Viewer::SetZLayerSettings (const Standard_Integer theLayerId,
|
void V3d_Viewer::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
MyViewer->SetZLayerSettings (theLayerId, theSettings);
|
MyViewer->SetZLayerSettings (theLayerId, theSettings);
|
||||||
}
|
}
|
||||||
|
@ -3676,7 +3676,7 @@ Standard_Boolean Visual3d_View::Export (const Standard_CString theFileName
|
|||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
void Visual3d_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
void Visual3d_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
MyGraphicDriver->SetZLayerSettings (MyCView, theLayerId, theSettings);
|
MyGraphicDriver->SetZLayerSettings (MyCView, theLayerId, theSettings);
|
||||||
}
|
}
|
||||||
|
@ -1207,12 +1207,14 @@ Standard_Integer Visual3d_ViewManager::GetZLayer (const Handle(Graphic3d_Structu
|
|||||||
//purpose :
|
//purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
void Visual3d_ViewManager::SetZLayerSettings (const Standard_Integer theLayerId,
|
void Visual3d_ViewManager::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||||
const Graphic3d_ZLayerSettings theSettings)
|
const Graphic3d_ZLayerSettings& theSettings)
|
||||||
{
|
{
|
||||||
// tell all managed views to set zlayer settings display layers
|
// tell all managed views to set zlayer settings
|
||||||
Visual3d_SetIteratorOfSetOfView aViewIt (MyDefinedView);
|
Visual3d_SetIteratorOfSetOfView aViewIt (MyDefinedView);
|
||||||
for ( ; aViewIt.More (); aViewIt.Next ())
|
for (; aViewIt.More (); aViewIt.Next ())
|
||||||
|
{
|
||||||
(aViewIt.Value ())->SetZLayerSettings (theLayerId, theSettings);
|
(aViewIt.Value ())->SetZLayerSettings (theLayerId, theSettings);
|
||||||
|
}
|
||||||
|
|
||||||
if (myMapOfZLayerSettings.IsBound (theLayerId))
|
if (myMapOfZLayerSettings.IsBound (theLayerId))
|
||||||
{
|
{
|
||||||
@ -1232,7 +1234,9 @@ void Visual3d_ViewManager::SetZLayerSettings (const Standard_Integer theLayerId,
|
|||||||
Graphic3d_ZLayerSettings Visual3d_ViewManager::ZLayerSettings (const Standard_Integer theLayerId)
|
Graphic3d_ZLayerSettings Visual3d_ViewManager::ZLayerSettings (const Standard_Integer theLayerId)
|
||||||
{
|
{
|
||||||
if (!myLayerIds.Contains (theLayerId))
|
if (!myLayerIds.Contains (theLayerId))
|
||||||
|
{
|
||||||
return Graphic3d_ZLayerSettings();
|
return Graphic3d_ZLayerSettings();
|
||||||
|
}
|
||||||
|
|
||||||
return myMapOfZLayerSettings.Find (theLayerId);
|
return myMapOfZLayerSettings.Find (theLayerId);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user