0024166: Unable to create file with "Save" menu of voxeldemo Qt sample
[occt.git] / src / OpenGl / OpenGl_CappingPlaneResource.hxx
CommitLineData
4269bd1b 1// Created on: 2013-08-15
2// Created by: Anton POLETAEV
3// Copyright (c) 2013 OPEN CASCADE SAS
4//
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.
9//
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.
12//
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.
19
20#ifndef _OpenGl_CappingPlaneResource_H__
21#define _OpenGl_CappingPlaneResource_H__
22
23#include <OpenGl_Resource.hxx>
24#include <OpenGl_AspectFace.hxx>
25#include <OpenGl_Matrix.hxx>
26#include <Graphic3d_ClipPlane.hxx>
27
28class Handle(OpenGl_Context);
29
30DEFINE_STANDARD_HANDLE (OpenGl_CappingPlaneResource, OpenGl_Resource)
31
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).
39class OpenGl_CappingPlaneResource : public OpenGl_Resource
40{
41public:
42
43 //! Constructor.
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);
47
48 //! Destroy object.
49 Standard_EXPORT virtual ~OpenGl_CappingPlaneResource();
50
51 //! Update resource data in the passed context.
52 //! @param theContext [in] the context.
53 Standard_EXPORT void Update (const Handle(OpenGl_Context)& theContext);
54
55 //! Release associated OpenGl resources.
56 //! @param theContext [in] the resource context.
57 Standard_EXPORT void Release (const OpenGl_Context* theContext);
58
59 //! @return aspect face for rendering capping surface.
60 inline const OpenGl_AspectFace* AspectFace() const { return myAspect; }
61
62 //! @return evaluated orientation matrix to transform infinite plane.
63 inline const OpenGl_Matrix* Orientation() const { return &myOrientation; }
64
65private:
66
67 //! Update precomputed plane orientation matrix.
68 void UpdateTransform();
69
70 //! Update resources.
71 //! @param theContext [in] the context.
72 void UpdateAspect (const Handle(OpenGl_Context)& theContext);
73
74private:
75
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.
81
82public:
83
84 DEFINE_STANDARD_RTTI(OpenGl_CappingPlaneResource) // Type definition
85
86};
87
88#endif