OCCT 8.0.1
OCCT documentation

Search guides and API reference

Enter at least two characters.

    Open CASCADE Technology Reference Manual 8.0.1
    OpenGl_Structure Class Reference

    Implementation of low-level graphic structure. More...

    #include <OpenGl_Structure.hxx>

    Inheritance diagram for OpenGl_Structure:

    Public Types

    typedef SubclassStructIterator< OpenGl_StructureStructIterator
     Auxiliary wrapper to iterate OpenGl_Structure sequence.
    typedef SubclassGroupIterator< OpenGl_GroupGroupIterator
     Auxiliary wrapper to iterate OpenGl_Group sequence.
    typedef void base_type
     Returns a type descriptor about this object.

    Public Member Functions

     OpenGl_Structure (const occ::handle< Graphic3d_StructureManager > &theManager)
     Create empty structure.
    void OnVisibilityChanged () override
     Setup structure graphic state.
    void Clear () override
     Clear graphic data.
    void Connect (Graphic3d_CStructure &theStructure) override
     Connect other structure to this one.
    void Disconnect (Graphic3d_CStructure &theStructure) override
     Disconnect other structure to this one.
    void SetTransformation (const occ::handle< TopLoc_Datum3D > &theTrsf) override
     Synchronize structure transformation.
    void SetTransformPersistence (const occ::handle< Graphic3d_TransformPers > &theTrsfPers) override
     Set transformation persistence.
    void SetZLayer (const Graphic3d_ZLayerId theLayerIndex) override
     Set z layer ID to display the structure in specified layer.
    void GraphicHighlight (const occ::handle< Graphic3d_PresentationAttributes > &theStyle) override
     Highlights structure according to the given style and updates corresponding class fields (highlight status and style).
    void GraphicUnhighlight () override
     Unighlights structure and updates corresponding class fields (highlight status and style).
    occ::handle< Graphic3d_CStructureShadowLink (const occ::handle< Graphic3d_StructureManager > &theManager) const override
     Create shadow link to this structure.
    occ::handle< Graphic3d_GroupNewGroup (const occ::handle< Graphic3d_Structure > &theStruct) override
     Create new group within this structure.
    void RemoveGroup (const occ::handle< Graphic3d_Group > &theGroup) override
     Remove group from this structure.
    OpenGl_GraphicDriverGlDriver () const
     Access graphic driver.
    void Clear (const occ::handle< OpenGl_Context > &theGlCtx)
    virtual void Render (const occ::handle< OpenGl_Workspace > &theWorkspace) const
     Renders the structure.
    virtual void Release (const occ::handle< OpenGl_Context > &theGlCtx)
     Releases structure resources.
    void ReleaseGlResources (const occ::handle< OpenGl_Context > &theGlCtx)
     This method releases GL resources without actual elements destruction. As result structure could be correctly destroyed layer without GL context (after last window was closed for example).
    const OpenGl_StructureInstancedStructure () const
     Returns instanced OpenGL structure.
    size_t ModificationState () const
     Returns structure modification state (for ray-tracing).
    void ResetModificationState () const
     Resets structure modification state (for ray-tracing).
    bool IsRaytracable () const
     Is the structure ray-tracable (contains ray-tracable elements)?
    void updateLayerTransformation () override
     Update render transformation matrix.
    void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const override
     Dumps the content of me into the stream.
    Public Member Functions inherited from Graphic3d_CStructure
    const occ::handle< Graphic3d_GraphicDriver > & GraphicDriver () const
    const NCollection_Sequence< occ::handle< Graphic3d_Group > > & Groups () const
    const occ::handle< TopLoc_Datum3D > & Transformation () const
     Return transformation.
    const occ::handle< Graphic3d_TransformPers > & TransformPersistence () const
     Return transformation persistence.
    bool HasGroupTransformPersistence () const
     Return TRUE if some groups might have transform persistence; FALSE by default.
    void SetGroupTransformPersistence (bool theValue)
     Set if some groups might have transform persistence.
    bool HasGroupFlipping () const
     Return TRUE if some groups might have flipping options; FALSE by default.
    void SetGroupFlipping (bool theValue)
     Set if some groups might have flipping options.
    const occ::handle< Graphic3d_SequenceOfHClipPlane > & ClipPlanes () const
    void SetClipPlanes (const occ::handle< Graphic3d_SequenceOfHClipPlane > &thePlanes)
     Pass clip planes to the associated graphic driver structure.
    const Graphic3d_BndBox3dBoundingBox () const
    Graphic3d_BndBox3dChangeBoundingBox ()
    bool IsVisible () const
     Return structure visibility flag.
    bool IsVisible (const int theViewId) const
     Return structure visibility considering both View Affinity and global visibility state.
    Graphic3d_ZLayerId ZLayer () const
     Get z layer ID.
    const occ::handle< Graphic3d_PresentationAttributes > & HighlightStyle () const
     Returns valid handle to highlight style of the structure in case if highlight flag is set to true.
    int Identification () const
     Return structure id (generated by Graphic3d_GraphicDriver::NewIdentification() during structure construction).
    Graphic3d_DisplayPriority Priority () const
     Return structure display priority.
    void SetPriority (Graphic3d_DisplayPriority thePriority)
     Set structure display priority.
    Graphic3d_DisplayPriority PreviousPriority () const
     Return previous structure display priority.
    void SetPreviousPriority (Graphic3d_DisplayPriority thePriority)
     Set previous structure display priority.
    bool IsCulled () const
     Returns FALSE if the structure hits the current view volume, otherwise returns TRUE.
    void SetCulled (bool theIsCulled) const
     Marks structure as culled/not culled - note that IsAlwaysRendered() is ignored here!
    void MarkAsNotCulled () const
     Marks structure as overlapping the current view volume one. The method is called during traverse of BVH tree.
    bool BndBoxClipCheck () const
     Returns whether check of object's bounding box clipping is enabled before drawing of object; TRUE by default.
    void SetBndBoxClipCheck (bool theBndBoxClipCheck)
     Enable/disable check of object's bounding box clipping before drawing of object.
    bool IsAlwaysRendered () const
     Checks if the structure should be included into BVH tree or not.
    Public Member Functions inherited from Standard_Transient
     Standard_Transient ()
     Empty constructor.
     Standard_Transient (const Standard_Transient &)
     Copy constructor – does nothing.
    Standard_Transientoperator= (const Standard_Transient &)
     Assignment operator, needed to avoid copying reference counter.
    virtual ~Standard_Transient ()=default
     Destructor must be virtual.
    virtual const opencascade::handle< Standard_Type > & DynamicType () const
     Returns a type descriptor about this object.
    bool IsInstance (const opencascade::handle< Standard_Type > &theType) const
     Returns a true value if this is an instance of Type.
    bool IsInstance (const char *const theTypeName) const
     Returns a true value if this is an instance of TypeName.
    bool IsKind (const opencascade::handle< Standard_Type > &theType) const
     Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    bool IsKind (const char *const theTypeName) const
     Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism.
    Standard_TransientThis () const
     Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero.
    int GetRefCount () const noexcept
     Get the reference counter of this object.
    void IncrementRefCounter () noexcept
     Increments the reference counter of this object. Uses relaxed memory ordering since incrementing only requires atomicity, not synchronization with other memory operations.
    int DecrementRefCounter () noexcept
     Decrements the reference counter of this object; returns the decremented value. Uses release ordering for the decrement to ensure all writes to the object are visible before the count reaches zero. An acquire fence is added only when the count reaches zero, ensuring proper synchronization before deletion. This is more efficient than using acq_rel for every decrement.
    virtual void Delete () const
     Memory deallocator for transient classes.

    Protected Member Functions

     ~OpenGl_Structure () override
    void UpdateStateIfRaytracable (const bool toCheck=true) const
     Updates ray-tracable status for structure and its parents.
    void renderGeometry (const occ::handle< OpenGl_Workspace > &theWorkspace, bool &theHasClosed) const
     Renders groups of structure without applying any attributes (i.e. transform, material etc).
    void renderBoundingBox (const occ::handle< OpenGl_Workspace > &theWorkspace) const
     Render the bounding box.
    void applyTransformation (const occ::handle< OpenGl_Context > &theContext, const gp_Trsf &theTrsf, const bool toEnable) const
     Apply transformation into context.
    void applyPersistence (const occ::handle< OpenGl_Context > &theCtx, const occ::handle< Graphic3d_TransformPers > &theTrsfPersistence, const bool theIsLocal, bool &theOldCastShadows) const
     Apply transform persistence into context. It disables shadows on non-3d objects when toEnable is true and restores otherwise.
    void revertPersistence (const occ::handle< OpenGl_Context > &theCtx, const occ::handle< Graphic3d_TransformPers > &theTrsfPersistence, const bool theIsLocal, const bool theOldCastShadows) const
     Restore context from transform persistence changes.
    Protected Member Functions inherited from Graphic3d_CStructure
     Graphic3d_CStructure (const occ::handle< Graphic3d_StructureManager > &theManager)
     Create empty structure.

    Protected Attributes

    OpenGl_StructuremyInstancedStructure
    NCollection_Mat4< float > myRenderTrsf
     transformation, actually used for rendering (includes Local Origin shift)
    bool myIsRaytracable
    size_t myModificationState
    bool myIsMirrored
     Used to tell OpenGl to interpret polygons in clockwise order.
    Protected Attributes inherited from Graphic3d_CStructure
    occ::handle< Graphic3d_GraphicDrivermyGraphicDriver
    NCollection_Sequence< occ::handle< Graphic3d_Group > > myGroups
    Graphic3d_BndBox3d myBndBox
    occ::handle< TopLoc_Datum3DmyTrsf
    occ::handle< Graphic3d_TransformPersmyTrsfPers
    occ::handle< Graphic3d_SequenceOfHClipPlanemyClipPlanes
    occ::handle< Graphic3d_PresentationAttributesmyHighlightStyle
    int myId
     Current highlight style; is set only if highlight flag is true.
    Graphic3d_ZLayerId myZLayer
    Graphic3d_DisplayPriority myPriority
    Graphic3d_DisplayPriority myPreviousPriority
    bool myIsCulled
     A status specifying is structure needs to be rendered after BVH tree traverse.
    bool myBndBoxClipCheck
     Flag responsible for checking of bounding box clipping before drawing of object.
    bool myHasGroupTrsf
     flag specifying that some groups might have transform persistence
    bool myHasGroupFlipping
     flag specifying that some groups might have flipping options

    Additional Inherited Members

    static constexpr const char * get_type_name ()
     Returns a type descriptor about this object.
    static const opencascade::handle< Standard_Type > & get_type_descriptor ()
     Returns type descriptor of Standard_Transient class.
    Data Fields inherited from Graphic3d_CStructure
    occ::handle< Graphic3d_ViewAffinityViewAffinity
     view affinity mask
    unsigned IsInfinite: 1
    unsigned stick: 1
     displaying state - should be set when structure has been added to scene graph (but can be in hidden state)
    unsigned highlight: 1
    unsigned visible: 1
     visibility flag - can be used to suppress structure while leaving it in the scene graph
    unsigned HLRValidation: 1
    unsigned IsForHighlight: 1
    unsigned IsMutable: 1
    unsigned Is2dText: 1

    Detailed Description

    Implementation of low-level graphic structure.

    Member Typedef Documentation

    ◆ GroupIterator

    Auxiliary wrapper to iterate OpenGl_Group sequence.

    ◆ StructIterator

    Constructor & Destructor Documentation

    ◆ OpenGl_Structure()

    OpenGl_Structure::OpenGl_Structure ( const occ::handle< Graphic3d_StructureManager > & theManager)

    Create empty structure.

    ◆ ~OpenGl_Structure()

    OpenGl_Structure::~OpenGl_Structure ( )
    overrideprotected

    Member Function Documentation

    ◆ applyPersistence()

    void OpenGl_Structure::applyPersistence ( const occ::handle< OpenGl_Context > & theCtx,
    const occ::handle< Graphic3d_TransformPers > & theTrsfPersistence,
    const bool theIsLocal,
    bool & theOldCastShadows ) const
    protected

    Apply transform persistence into context. It disables shadows on non-3d objects when toEnable is true and restores otherwise.

    Parameters
    [in]theCtxcurrent context
    [in]theTrsfPerstransform persistence
    [in]theIsLocalspecifies if transform persistence is defined locally or to entire presentation
    [out]theOldCastShadowsstate of the previous cast shadows state

    ◆ applyTransformation()

    void OpenGl_Structure::applyTransformation ( const occ::handle< OpenGl_Context > & theContext,
    const gp_Trsf & theTrsf,
    const bool toEnable ) const
    protected

    Apply transformation into context.

    Parameters
    theWorkspacecurrent workspace
    theTrsftransformation
    toEnableflag to switch ON/OFF transformation

    ◆ Clear() [1/2]

    void OpenGl_Structure::Clear ( )
    overridevirtual

    Clear graphic data.

    Implements Graphic3d_CStructure.

    ◆ Clear() [2/2]

    void OpenGl_Structure::Clear ( const occ::handle< OpenGl_Context > & theGlCtx)

    ◆ Connect()

    void OpenGl_Structure::Connect ( Graphic3d_CStructure & theStructure)
    overridevirtual

    Connect other structure to this one.

    Implements Graphic3d_CStructure.

    Reimplemented in OpenGl_StructureShadow.

    ◆ Disconnect()

    void OpenGl_Structure::Disconnect ( Graphic3d_CStructure & theStructure)
    overridevirtual

    Disconnect other structure to this one.

    Implements Graphic3d_CStructure.

    Reimplemented in OpenGl_StructureShadow.

    ◆ DumpJson()

    void OpenGl_Structure::DumpJson ( Standard_OStream & theOStream,
    int theDepth = -1 ) const
    overridevirtual

    Dumps the content of me into the stream.

    Reimplemented from Graphic3d_CStructure.

    ◆ GlDriver()

    OpenGl_GraphicDriver * OpenGl_Structure::GlDriver ( ) const
    inline

    Access graphic driver.

    ◆ GraphicHighlight()

    void OpenGl_Structure::GraphicHighlight ( const occ::handle< Graphic3d_PresentationAttributes > & theStyle)
    overridevirtual

    Highlights structure according to the given style and updates corresponding class fields (highlight status and style).

    Implements Graphic3d_CStructure.

    ◆ GraphicUnhighlight()

    void OpenGl_Structure::GraphicUnhighlight ( )
    overridevirtual

    Unighlights structure and updates corresponding class fields (highlight status and style).

    Implements Graphic3d_CStructure.

    ◆ InstancedStructure()

    const OpenGl_Structure * OpenGl_Structure::InstancedStructure ( ) const
    inline

    Returns instanced OpenGL structure.

    ◆ IsRaytracable()

    bool OpenGl_Structure::IsRaytracable ( ) const

    Is the structure ray-tracable (contains ray-tracable elements)?

    ◆ ModificationState()

    size_t OpenGl_Structure::ModificationState ( ) const
    inline

    Returns structure modification state (for ray-tracing).

    ◆ NewGroup()

    occ::handle< Graphic3d_Group > OpenGl_Structure::NewGroup ( const occ::handle< Graphic3d_Structure > & theStruct)
    overridevirtual

    Create new group within this structure.

    Implements Graphic3d_CStructure.

    ◆ OnVisibilityChanged()

    void OpenGl_Structure::OnVisibilityChanged ( )
    overridevirtual

    Setup structure graphic state.

    Implements Graphic3d_CStructure.

    ◆ Release()

    virtual void OpenGl_Structure::Release ( const occ::handle< OpenGl_Context > & theGlCtx)
    virtual

    Releases structure resources.

    ◆ ReleaseGlResources()

    void OpenGl_Structure::ReleaseGlResources ( const occ::handle< OpenGl_Context > & theGlCtx)

    This method releases GL resources without actual elements destruction. As result structure could be correctly destroyed layer without GL context (after last window was closed for example).

    Notice however that reusage of this structure after calling this method is incorrect and will lead to broken visualization due to loosed data.

    ◆ RemoveGroup()

    void OpenGl_Structure::RemoveGroup ( const occ::handle< Graphic3d_Group > & theGroup)
    overridevirtual

    Remove group from this structure.

    Implements Graphic3d_CStructure.

    ◆ Render()

    virtual void OpenGl_Structure::Render ( const occ::handle< OpenGl_Workspace > & theWorkspace) const
    virtual

    Renders the structure.

    ◆ renderBoundingBox()

    void OpenGl_Structure::renderBoundingBox ( const occ::handle< OpenGl_Workspace > & theWorkspace) const
    protected

    Render the bounding box.

    ◆ renderGeometry()

    void OpenGl_Structure::renderGeometry ( const occ::handle< OpenGl_Workspace > & theWorkspace,
    bool & theHasClosed ) const
    protected

    Renders groups of structure without applying any attributes (i.e. transform, material etc).

    Parameters
    theWorkspacecurrent workspace
    theHasClosedflag will be set to TRUE if structure contains at least one group of closed primitives

    ◆ ResetModificationState()

    void OpenGl_Structure::ResetModificationState ( ) const
    inline

    Resets structure modification state (for ray-tracing).

    ◆ revertPersistence()

    void OpenGl_Structure::revertPersistence ( const occ::handle< OpenGl_Context > & theCtx,
    const occ::handle< Graphic3d_TransformPers > & theTrsfPersistence,
    const bool theIsLocal,
    const bool theOldCastShadows ) const
    protected

    Restore context from transform persistence changes.

    Parameters
    [in]theCtxcurrent context
    [in]theTrsfPerstransform persistence
    [in]theIsLocalspecifies if transform persistence is defined locally or to entire presentation
    [in]theOldCastShadowsstate of the previous cast shadows state

    ◆ SetTransformation()

    void OpenGl_Structure::SetTransformation ( const occ::handle< TopLoc_Datum3D > & theTrsf)
    overridevirtual

    Synchronize structure transformation.

    Reimplemented from Graphic3d_CStructure.

    ◆ SetTransformPersistence()

    void OpenGl_Structure::SetTransformPersistence ( const occ::handle< Graphic3d_TransformPers > & theTrsfPers)
    overridevirtual

    Set transformation persistence.

    Reimplemented from Graphic3d_CStructure.

    ◆ SetZLayer()

    void OpenGl_Structure::SetZLayer ( const Graphic3d_ZLayerId theLayerIndex)
    overridevirtual

    Set z layer ID to display the structure in specified layer.

    Reimplemented from Graphic3d_CStructure.

    ◆ ShadowLink()

    occ::handle< Graphic3d_CStructure > OpenGl_Structure::ShadowLink ( const occ::handle< Graphic3d_StructureManager > & theManager) const
    overridevirtual

    Create shadow link to this structure.

    Implements Graphic3d_CStructure.

    ◆ updateLayerTransformation()

    void OpenGl_Structure::updateLayerTransformation ( )
    overridevirtual

    Update render transformation matrix.

    Reimplemented from Graphic3d_CStructure.

    ◆ UpdateStateIfRaytracable()

    void OpenGl_Structure::UpdateStateIfRaytracable ( const bool toCheck = true) const
    protected

    Updates ray-tracable status for structure and its parents.

    Field Documentation

    ◆ myInstancedStructure

    OpenGl_Structure* OpenGl_Structure::myInstancedStructure
    protected

    ◆ myIsMirrored

    bool OpenGl_Structure::myIsMirrored
    protected

    Used to tell OpenGl to interpret polygons in clockwise order.

    ◆ myIsRaytracable

    bool OpenGl_Structure::myIsRaytracable
    mutableprotected

    ◆ myModificationState

    size_t OpenGl_Structure::myModificationState
    mutableprotected

    ◆ myRenderTrsf

    NCollection_Mat4<float> OpenGl_Structure::myRenderTrsf
    protected

    transformation, actually used for rendering (includes Local Origin shift)


    The documentation for this class was generated from the following file: