Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:47

0001 // Copyright (c) 2018 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _Graphic3d_AttribBuffer_HeaderFile
0015 #define _Graphic3d_AttribBuffer_HeaderFile
0016 
0017 #include <Graphic3d_Buffer.hxx>
0018 
0019 //! Buffer of vertex attributes.
0020 //! This class is intended for advanced usage allowing invalidation of entire buffer content or its sub-part.
0021 class Graphic3d_AttribBuffer : public Graphic3d_Buffer
0022 {
0023   DEFINE_STANDARD_RTTIEXT(Graphic3d_AttribBuffer, Graphic3d_Buffer)
0024 public:
0025   //! Empty constructor.
0026   Standard_EXPORT Graphic3d_AttribBuffer (const Handle(NCollection_BaseAllocator)& theAlloc);
0027 
0028   //! Allocates new empty array
0029   Standard_EXPORT bool Init (const Standard_Integer     theNbElems,
0030                              const Graphic3d_Attribute* theAttribs,
0031                              const Standard_Integer     theNbAttribs);
0032 
0033   //! Allocates new empty array
0034   bool Init (const Standard_Integer             theNbElems,
0035              const Graphic3d_Array1OfAttribute& theAttribs)
0036   {
0037     return Init (theNbElems, &theAttribs.First(), theAttribs.Size());
0038   }
0039 
0040   //! Return TRUE if data can be invalidated; FALSE by default.
0041   virtual Standard_Boolean IsMutable() const Standard_OVERRIDE { return myIsMutable; }
0042 
0043   //! Set if data can be invalidated.
0044   Standard_EXPORT void SetMutable (Standard_Boolean theMutable);
0045 
0046   //! Return TRUE for interleaved array; TRUE by default.
0047   virtual Standard_Boolean IsInterleaved() const Standard_OVERRIDE { return myIsInterleaved; }
0048 
0049   //! Setup interleaved/non-interleaved array.
0050   //! WARNING! Filling non-interleaved buffer should be implemented on user side
0051   //!          without Graphic3d_Buffer auxiliary methods designed for interleaved data.
0052   Standard_EXPORT void SetInterleaved (Standard_Boolean theIsInterleaved);
0053 
0054   //! Return invalidated range.
0055   virtual Graphic3d_BufferRange InvalidatedRange() const Standard_OVERRIDE { return myInvalidatedRange; }
0056 
0057   //! Reset invalidated range.
0058   virtual void Validate() Standard_OVERRIDE { myInvalidatedRange.Clear(); }
0059 
0060   //! Invalidate the entire buffer data.
0061   Standard_EXPORT virtual void Invalidate() Standard_OVERRIDE;
0062 
0063   //! Invalidate the entire attribute data.
0064   Standard_EXPORT void Invalidate (Standard_Integer theAttributeIndex);
0065 
0066   //! Invalidate attribute data within specified sub-range (starting from 0).
0067   Standard_EXPORT void Invalidate (Standard_Integer theAttributeIndex,
0068                                    Standard_Integer theVertexLower,
0069                                    Standard_Integer theVertexUpper);
0070 
0071   //! Invalidate all attribute data within specified vertex sub-range (starting from 0).
0072   Standard_EXPORT void Invalidate (Standard_Integer theVertexLower,
0073                                    Standard_Integer theVertexUpper);
0074 
0075   //! Invalidate specified sub-range of data (as byte offsets).
0076   Standard_EXPORT void invalidate (const Graphic3d_BufferRange& theRange);
0077 
0078 protected:
0079   Graphic3d_BufferRange myInvalidatedRange; //!< invalidated buffer data range (as byte offsets)
0080   Standard_Boolean      myIsInterleaved;    //!< flag indicating the vertex attributes being interleaved
0081   Standard_Boolean      myIsMutable;        //!< flag indicating that data can be invalidated
0082 };
0083 
0084 #endif // _Graphic3d_AttribBuffer_HeaderFile