#ifndef OpenGl_Element_Header
#define OpenGl_Element_Header
-#include <Handle_OpenGl_Context.hxx>
-#include <Handle_OpenGl_Workspace.hxx>
#include <OpenGl_RenderFilter.hxx>
+#include <Standard_Type.hxx>
+
+class Graphic3d_FrameStatsDataTmp;
+class OpenGl_Workspace;
+class OpenGl_Context;
//! Base interface for drawable elements.
class OpenGl_Element
public:
- //! Render element if it passes the filtering procedure. This method should
- //! be used for elements which can be used in scope of rendering algorithms.
- //! E.g. elements of groups during recursive rendering.
- //! If render filter is null, pure rendering is performed.
- //! @param theWorkspace [in] the rendering workspace.
- //! @param theFilter [in] the rendering filter to check whether the element
- //! should be rendered or not.
- //! @return True if element passes the filering check and is rendered.
- inline Standard_Boolean
- RenderFiltered (const Handle(OpenGl_Workspace)& theWorkspace,
- const Handle(OpenGl_RenderFilter)& theFilter) const
- {
- if (!theFilter.IsNull() && !theFilter->CanRender (this))
- {
- return Standard_False;
- }
+ //! Return TRUE if primitive type generates shaded triangulation (to be used in filters).
+ virtual Standard_Boolean IsFillDrawMode() const { return false; }
- Render (theWorkspace);
+ //! Returns estimated GPU memory usage for holding data without considering overheads and allocation alignment rules.
+ virtual Standard_Size EstimatedDataSize() const { return 0; }
- return Standard_True;
- }
+ //! Increment memory usage statistics.
+ //! Default implementation puts EstimatedDataSize() into Graphic3d_FrameStatsCounter_EstimatedBytesGeom.
+ Standard_EXPORT virtual void UpdateMemStats (Graphic3d_FrameStatsDataTmp& theStats) const;
+
+ //! Increment draw calls statistics.
+ //! @param theStats [in] [out] frame counters to increment
+ //! @param theIsDetailed [in] indicate detailed dump (more counters - number of triangles, points, etc.)
+ Standard_EXPORT virtual void UpdateDrawStats (Graphic3d_FrameStatsDataTmp& theStats,
+ bool theIsDetailed) const;
+
+ //! Update parameters of the drawable elements.
+ virtual void SynchronizeAspects() {}
+
+ //! Dumps the content of me into the stream
+ Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const;
protected: