1 // Created on: 2013-08-15
2 // Created by: Anton POLETAEV
3 // Copyright (c) 2013 OPEN CASCADE SAS
5 // The content of this file is subject to the Open CASCADE Technology Public
6 // License Version 6.5 (the "License"). You may not use the content of this file
7 // except in compliance with the License. Please obtain a copy of the License
8 // at http://www.opencascade.org and read it completely before using this file.
10 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
11 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
13 // The Original Code and all software distributed under the License is
14 // distributed on an "AS IS" basis, without warranty of any kind, and the
15 // Initial Developer hereby disclaims all such warranties, including without
16 // limitation, any warranties of merchantability, fitness for a particular
17 // purpose or non-infringement. Please see the License for the specific terms
18 // and conditions governing the rights and limitations under the License.
20 #ifndef _OpenGl_CappingPlaneResource_H__
21 #define _OpenGl_CappingPlaneResource_H__
23 #include <OpenGl_Resource.hxx>
24 #include <OpenGl_AspectFace.hxx>
25 #include <OpenGl_Matrix.hxx>
26 #include <Graphic3d_ClipPlane.hxx>
28 class Handle(OpenGl_Context);
30 DEFINE_STANDARD_HANDLE (OpenGl_CappingPlaneResource, OpenGl_Resource)
32 //! Container of graphical resources for rendering capping plane
33 //! associated to graphical clipping plane.
34 //! This resource holds data necessary for OpenGl_CappingAlgo.
35 //! This object is implemented as OpenGl resource for the following reasons:
36 //! - one instance should be shared between contexts.
37 //! - instance associated to Graphic3d_ClipPlane data by id.
38 //! - should created and released within context (owns OpenGl elements and resources).
39 class OpenGl_CappingPlaneResource : public OpenGl_Resource
44 //! Create capping plane presentation associated to clipping plane data.
45 //! @param thePlane [in] the plane data.
46 Standard_EXPORT OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane);
49 Standard_EXPORT virtual ~OpenGl_CappingPlaneResource();
51 //! Update resource data in the passed context.
52 //! @param theContext [in] the context.
53 Standard_EXPORT void Update (const Handle(OpenGl_Context)& theContext);
55 //! Release associated OpenGl resources.
56 //! @param theContext [in] the resource context.
57 Standard_EXPORT void Release (const OpenGl_Context* theContext);
59 //! @return aspect face for rendering capping surface.
60 inline const OpenGl_AspectFace* AspectFace() const { return myAspect; }
62 //! @return evaluated orientation matrix to transform infinite plane.
63 inline const OpenGl_Matrix* Orientation() const { return &myOrientation; }
67 //! Update precomputed plane orientation matrix.
68 void UpdateTransform();
71 //! @param theContext [in] the context.
72 void UpdateAspect (const Handle(OpenGl_Context)& theContext);
76 OpenGl_Matrix myOrientation; //!< plane transformation matrix.
77 OpenGl_AspectFace* myAspect; //!< capping face aspect.
78 Handle(Graphic3d_ClipPlane) myPlaneRoot; //!< parent clipping plane structure.
79 unsigned int myEquationMod; //!< modification counter for plane equation.
80 unsigned int myAspectMod; //!< modification counter for aspect.
84 DEFINE_STANDARD_RTTI(OpenGl_CappingPlaneResource) // Type definition