mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-03 17:56:21 +03:00
Cosmetic fixes.
This commit is contained in:
parent
13ce02aa6c
commit
2108a68f57
@ -419,7 +419,7 @@ is
|
||||
primitive Mat4;
|
||||
primitive Mat4d;
|
||||
|
||||
primitive ZLayerSettings;
|
||||
imported ZLayerSettings;
|
||||
|
||||
--------------------
|
||||
-- Category: Classes
|
||||
|
@ -308,7 +308,7 @@ public:
|
||||
//! Sets the settings for a single Z layer of specified view.
|
||||
Standard_EXPORT void SetZLayerSettings (const Graphic3d_CView& theCView,
|
||||
const Standard_Integer theLayerId,
|
||||
const Graphic3d_ZLayerSettings theSettings);
|
||||
const Graphic3d_ZLayerSettings& theSettings);
|
||||
|
||||
public:
|
||||
|
||||
|
@ -632,7 +632,7 @@ void OpenGl_GraphicDriver::RemoveZLayer (const Graphic3d_CView& theCView,
|
||||
//=======================================================================
|
||||
Standard_EXPORT void OpenGl_GraphicDriver::SetZLayerSettings (const Graphic3d_CView& theCView,
|
||||
const Standard_Integer theLayerId,
|
||||
const Graphic3d_ZLayerSettings theSettings)
|
||||
const Graphic3d_ZLayerSettings& theSettings)
|
||||
{
|
||||
const OpenGl_CView* aCView = (const OpenGl_CView* )theCView.ptrView;
|
||||
if (aCView)
|
||||
|
@ -17,20 +17,6 @@
|
||||
|
||||
#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
|
||||
//purpose :
|
||||
@ -48,13 +34,13 @@ OpenGl_Layer::OpenGl_Layer (const Standard_Integer theNbPriorities)
|
||||
void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||
{
|
||||
// separate depth buffers
|
||||
if (IsSettingEnabled (OpenGl_LayerDepthClear))
|
||||
if (IsSettingEnabled (Graphic3d_ZLayerDepthClear))
|
||||
{
|
||||
glClear (GL_DEPTH_BUFFER_BIT);
|
||||
}
|
||||
|
||||
// handle depth test
|
||||
if (IsSettingEnabled (OpenGl_LayerDepthTest))
|
||||
if (IsSettingEnabled (Graphic3d_ZLayerDepthTest))
|
||||
{
|
||||
glDepthFunc (GL_LESS);
|
||||
}
|
||||
@ -64,17 +50,17 @@ void OpenGl_Layer::Render (const Handle(OpenGl_Workspace) &AWorkspace) const
|
||||
}
|
||||
|
||||
// handle depth offset
|
||||
if (IsSettingEnabled (OpenGl_LayerDepthOffset))
|
||||
if (IsSettingEnabled (Graphic3d_ZLayerDepthOffset))
|
||||
{
|
||||
glPolygonOffset (myLayerSettings.DepthOffsetFactor, myLayerSettings.DepthOffsetUnits);
|
||||
}
|
||||
else
|
||||
{
|
||||
glPolygonOffset (0.f, 0.f);
|
||||
glPolygonOffset (0.0f, 0.0f);
|
||||
}
|
||||
|
||||
// handle depth write
|
||||
if (IsSettingEnabled (OpenGl_LayerDepthWrite))
|
||||
if (IsSettingEnabled (Graphic3d_ZLayerDepthWrite))
|
||||
{
|
||||
glDepthMask (GL_TRUE);
|
||||
}
|
||||
|
@ -17,34 +17,10 @@
|
||||
#define _OpenGl_Layer_Header
|
||||
|
||||
#include <OpenGl_PriorityList.hxx>
|
||||
#include <Graphic3d_ZLayerSettings.hxx>
|
||||
|
||||
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
|
||||
{
|
||||
public:
|
||||
@ -53,16 +29,16 @@ public:
|
||||
OpenGl_Layer (const Standard_Integer theNbPriorities = 11);
|
||||
|
||||
//! 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.
|
||||
void SetLayerSettings (OpenGl_LayerSettings theSettings)
|
||||
void SetLayerSettings (Graphic3d_ZLayerSettings theSettings)
|
||||
{
|
||||
myLayerSettings = theSettings;
|
||||
}
|
||||
|
||||
//! 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);
|
||||
}
|
||||
@ -77,8 +53,8 @@ public:
|
||||
|
||||
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
|
||||
|
@ -1518,13 +1518,6 @@ void OpenGl_View::ChangeZLayer (const OpenGl_Structure *theStructure,
|
||||
void OpenGl_View::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||
const Graphic3d_ZLayerSettings theSettings)
|
||||
{
|
||||
// Convert Graphic3d_ZLayerSettings to OpenGl_LayerSettings
|
||||
OpenGl_LayerSettings aConvertedSettings;
|
||||
|
||||
aConvertedSettings.DepthOffsetFactor = theSettings.DepthOffsetFactor;
|
||||
aConvertedSettings.DepthOffsetUnits = theSettings.DepthOffsetUnits;
|
||||
aConvertedSettings.Flags = theSettings.Flags;
|
||||
|
||||
myZLayers.Layer (theLayerId).SetLayerSettings (aConvertedSettings);
|
||||
myZLayers.Layer (theLayerId).SetLayerSettings (theSettings);
|
||||
}
|
||||
|
||||
|
@ -359,7 +359,7 @@ void V3d_Viewer::DelView( const Handle(V3d_View)& TheView ) {
|
||||
//=======================================================================
|
||||
|
||||
void V3d_Viewer::SetZLayerSettings (const Standard_Integer theLayerId,
|
||||
const Graphic3d_ZLayerSettings theSettings)
|
||||
const Graphic3d_ZLayerSettings& 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,
|
||||
const Graphic3d_ZLayerSettings theSettings)
|
||||
const Graphic3d_ZLayerSettings& theSettings)
|
||||
{
|
||||
MyGraphicDriver->SetZLayerSettings (MyCView, theLayerId, theSettings);
|
||||
}
|
||||
|
@ -1207,12 +1207,14 @@ Standard_Integer Visual3d_ViewManager::GetZLayer (const Handle(Graphic3d_Structu
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
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);
|
||||
for ( ; aViewIt.More (); aViewIt.Next ())
|
||||
for (; aViewIt.More (); aViewIt.Next ())
|
||||
{
|
||||
(aViewIt.Value ())->SetZLayerSettings (theLayerId, theSettings);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
if (!myLayerIds.Contains (theLayerId))
|
||||
{
|
||||
return Graphic3d_ZLayerSettings();
|
||||
}
|
||||
|
||||
return myMapOfZLayerSettings.Find (theLayerId);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user