Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-07-05 08:37:23

0001 // Created on: 2013-08-15
0002 // Created by: Anton POLETAEV
0003 // Copyright (c) 2013-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef OpenGl_CappingPlaneResource_HeaderFile
0017 #define OpenGl_CappingPlaneResource_HeaderFile
0018 
0019 #include <OpenGl_PrimitiveArray.hxx>
0020 #include <OpenGl_Resource.hxx>
0021 #include <OpenGl_Aspects.hxx>
0022 #include <OpenGl_Vec.hxx>
0023 #include <Graphic3d_ClipPlane.hxx>
0024 
0025 class OpenGl_CappingPlaneResource;
0026 DEFINE_STANDARD_HANDLE(OpenGl_CappingPlaneResource, OpenGl_Resource)
0027 
0028 //! Container of graphical resources for rendering capping plane
0029 //! associated to graphical clipping plane.
0030 //! This resource holds data necessary for OpenGl_CappingAlgo.
0031 //! This object is implemented as OpenGl resource for the following reasons:
0032 //! - one instance should be shared between contexts.
0033 //! - instance associated to Graphic3d_ClipPlane data by id.
0034 //! - should created and released within context (owns OpenGl elements and resources).
0035 class OpenGl_CappingPlaneResource : public OpenGl_Resource
0036 {
0037 public:
0038   //! Constructor.
0039   //! Create capping plane presentation associated to clipping plane data.
0040   //! @param[in] thePlane  the plane data.
0041   Standard_EXPORT OpenGl_CappingPlaneResource(const Handle(Graphic3d_ClipPlane)& thePlane);
0042 
0043   //! Destroy object.
0044   Standard_EXPORT virtual ~OpenGl_CappingPlaneResource();
0045 
0046   //! Update resource data in the passed context.
0047   //! @param[in] theContext    the context
0048   //! @param[in] theObjAspect  object aspect
0049   Standard_EXPORT void Update(const Handle(OpenGl_Context)&    theContext,
0050                               const Handle(Graphic3d_Aspects)& theObjAspect);
0051 
0052   //! Release associated OpenGl resources.
0053   //! @param[in] theContext  the resource context.
0054   Standard_EXPORT virtual void Release(OpenGl_Context* theContext) Standard_OVERRIDE;
0055 
0056   //! Returns estimated GPU memory usage - not implemented.
0057   virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
0058 
0059   //! Return parent clipping plane structure.
0060   const Handle(Graphic3d_ClipPlane)& Plane() const { return myPlaneRoot; }
0061 
0062   //! @return aspect face for rendering capping surface.
0063   inline const OpenGl_Aspects* AspectFace() const { return myAspect; }
0064 
0065   //! @return evaluated orientation matrix to transform infinite plane.
0066   inline const OpenGl_Mat4& Orientation() const { return myOrientation; }
0067 
0068   //! @return primitive array of vertices to render infinite plane.
0069   inline const OpenGl_PrimitiveArray& Primitives() const { return myPrimitives; }
0070 
0071 private:
0072   //! Update precomputed plane orientation matrix.
0073   void updateTransform(const Handle(OpenGl_Context)& theCtx);
0074 
0075   //! Update resources.
0076   void updateAspect(const Handle(Graphic3d_Aspects)& theObjAspect);
0077 
0078 private:
0079   OpenGl_PrimitiveArray       myPrimitives;     //!< vertices and texture coordinates for rendering
0080   OpenGl_Mat4                 myOrientation;    //!< plane transformation matrix.
0081   OpenGl_Aspects*             myAspect;         //!< capping face aspect.
0082   Handle(Graphic3d_ClipPlane) myPlaneRoot;      //!< parent clipping plane structure.
0083   Handle(Graphic3d_Aspects)   myFillAreaAspect; //!< own capping aspect
0084   gp_XYZ                      myLocalOrigin;    //!< layer origin
0085   unsigned int                myEquationMod;    //!< modification counter for plane equation.
0086   unsigned int                myAspectMod;      //!< modification counter for aspect.
0087 
0088 public:
0089   DEFINE_STANDARD_RTTIEXT(OpenGl_CappingPlaneResource, OpenGl_Resource) // Type definition
0090 };
0091 
0092 #endif