1 // Created on: 2013-08-15
2 // Created by: Anton POLETAEV
3 // Copyright (c) 2013 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and / or modify it
8 // under the terms of the GNU Lesser General Public version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _OpenGl_CappingPlaneResource_H__
17 #define _OpenGl_CappingPlaneResource_H__
19 #include <OpenGl_Resource.hxx>
20 #include <OpenGl_AspectFace.hxx>
21 #include <OpenGl_Matrix.hxx>
22 #include <Graphic3d_ClipPlane.hxx>
24 class Handle(OpenGl_Context);
26 DEFINE_STANDARD_HANDLE (OpenGl_CappingPlaneResource, OpenGl_Resource)
28 //! Container of graphical resources for rendering capping plane
29 //! associated to graphical clipping plane.
30 //! This resource holds data necessary for OpenGl_CappingAlgo.
31 //! This object is implemented as OpenGl resource for the following reasons:
32 //! - one instance should be shared between contexts.
33 //! - instance associated to Graphic3d_ClipPlane data by id.
34 //! - should created and released within context (owns OpenGl elements and resources).
35 class OpenGl_CappingPlaneResource : public OpenGl_Resource
40 //! Create capping plane presentation associated to clipping plane data.
41 //! @param thePlane [in] the plane data.
42 Standard_EXPORT OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane);
45 Standard_EXPORT virtual ~OpenGl_CappingPlaneResource();
47 //! Update resource data in the passed context.
48 //! @param theContext [in] the context.
49 Standard_EXPORT void Update (const Handle(OpenGl_Context)& theContext);
51 //! Release associated OpenGl resources.
52 //! @param theContext [in] the resource context.
53 Standard_EXPORT void Release (const OpenGl_Context* theContext);
55 //! @return aspect face for rendering capping surface.
56 inline const OpenGl_AspectFace* AspectFace() const { return myAspect; }
58 //! @return evaluated orientation matrix to transform infinite plane.
59 inline const OpenGl_Matrix* Orientation() const { return &myOrientation; }
63 //! Update precomputed plane orientation matrix.
64 void UpdateTransform();
67 //! @param theContext [in] the context.
68 void UpdateAspect (const Handle(OpenGl_Context)& theContext);
72 OpenGl_Matrix myOrientation; //!< plane transformation matrix.
73 OpenGl_AspectFace* myAspect; //!< capping face aspect.
74 Handle(Graphic3d_ClipPlane) myPlaneRoot; //!< parent clipping plane structure.
75 unsigned int myEquationMod; //!< modification counter for plane equation.
76 unsigned int myAspectMod; //!< modification counter for aspect.
80 DEFINE_STANDARD_RTTI(OpenGl_CappingPlaneResource) // Type definition