primitive Mat4;
primitive Mat4d;
- primitive ZLayerSettings;
+ imported ZLayerSettings;
--------------------
-- Category: Classes
//! 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:
//=======================================================================
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)
#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 :
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);
}
}
// 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);
}
#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:
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);
}
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
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);
}
//=======================================================================
void V3d_Viewer::SetZLayerSettings (const Standard_Integer theLayerId,
- const Graphic3d_ZLayerSettings theSettings)
+ const Graphic3d_ZLayerSettings& theSettings)
{
MyViewer->SetZLayerSettings (theLayerId, theSettings);
}
//=======================================================================
void Visual3d_View::SetZLayerSettings (const Standard_Integer theLayerId,
- const Graphic3d_ZLayerSettings theSettings)
+ const Graphic3d_ZLayerSettings& theSettings)
{
MyGraphicDriver->SetZLayerSettings (MyCView, theLayerId, theSettings);
}
//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))
{
Graphic3d_ZLayerSettings Visual3d_ViewManager::ZLayerSettings (const Standard_Integer theLayerId)
{
if (!myLayerIds.Contains (theLayerId))
+ {
return Graphic3d_ZLayerSettings();
+ }
return myMapOfZLayerSettings.Find (theLayerId);
}