Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:21

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 
0039   //! Constructor.
0040   //! Create capping plane presentation associated to clipping plane data.
0041   //! @param thePlane [in] the plane data.
0042   Standard_EXPORT OpenGl_CappingPlaneResource (const Handle(Graphic3d_ClipPlane)& thePlane);
0043 
0044   //! Destroy object.
0045   Standard_EXPORT virtual ~OpenGl_CappingPlaneResource();
0046 
0047   //! Update resource data in the passed context.
0048   //! @param theContext   [in] the context
0049   //! @param theObjAspect [in] object aspect
0050   Standard_EXPORT void Update (const Handle(OpenGl_Context)& theContext,
0051                                const Handle(Graphic3d_Aspects)& theObjAspect);
0052 
0053   //! Release associated OpenGl resources.
0054   //! @param theContext [in] the resource context.
0055   Standard_EXPORT virtual void Release (OpenGl_Context* theContext) Standard_OVERRIDE;
0056 
0057   //! Returns estimated GPU memory usage - not implemented.
0058   virtual Standard_Size EstimatedDataSize() const Standard_OVERRIDE { return 0; }
0059 
0060   //! Return parent clipping plane structure.
0061   const Handle(Graphic3d_ClipPlane)& Plane() const { return myPlaneRoot; }
0062 
0063   //! @return aspect face for rendering capping surface.
0064   inline const OpenGl_Aspects* AspectFace() const { return myAspect; }
0065 
0066   //! @return evaluated orientation matrix to transform infinite plane.
0067   inline const OpenGl_Mat4& Orientation() const { return myOrientation; }
0068 
0069   //! @return primitive array of vertices to render infinite plane.
0070   inline const OpenGl_PrimitiveArray& Primitives() const { return myPrimitives; }
0071 
0072 private:
0073 
0074   //! Update precomputed plane orientation matrix.
0075   void updateTransform (const Handle(OpenGl_Context)& theCtx);
0076 
0077   //! Update resources.
0078   void updateAspect (const Handle(Graphic3d_Aspects)& theObjAspect);
0079 
0080 private:
0081 
0082   OpenGl_PrimitiveArray       myPrimitives;    //!< vertices and texture coordinates for rendering
0083   OpenGl_Mat4                 myOrientation;   //!< plane transformation matrix.
0084   OpenGl_Aspects*             myAspect;        //!< capping face aspect.
0085   Handle(Graphic3d_ClipPlane) myPlaneRoot;     //!< parent clipping plane structure.
0086   Handle(Graphic3d_Aspects)   myFillAreaAspect;//!< own capping aspect
0087   gp_XYZ                      myLocalOrigin;   //!< layer origin
0088   unsigned int                myEquationMod;   //!< modification counter for plane equation.
0089   unsigned int                myAspectMod;     //!< modification counter for aspect.
0090 
0091 public:
0092 
0093   DEFINE_STANDARD_RTTIEXT(OpenGl_CappingPlaneResource,OpenGl_Resource) // Type definition
0094 
0095 };
0096 
0097 #endif