Back to home page

EIC code displayed by LXR

 
 

    


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

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_MutableIndexBuffer_HeaderFile
0015 #define _Graphic3d_MutableIndexBuffer_HeaderFile
0016 
0017 #include <Graphic3d_IndexBuffer.hxx>
0018 
0019 //! Mutable index buffer.
0020 class Graphic3d_MutableIndexBuffer : public Graphic3d_IndexBuffer
0021 {
0022   DEFINE_STANDARD_RTTIEXT(Graphic3d_MutableIndexBuffer, Graphic3d_IndexBuffer)
0023 public:
0024 
0025   //! Empty constructor.
0026   Graphic3d_MutableIndexBuffer (const Handle(NCollection_BaseAllocator)& theAlloc) : Graphic3d_IndexBuffer (theAlloc) {}
0027 
0028   //! Return TRUE if data can be invalidated.
0029   virtual Standard_Boolean IsMutable() const Standard_OVERRIDE { return Standard_True; }
0030 
0031   //! Return invalidated range.
0032   virtual Graphic3d_BufferRange InvalidatedRange() const Standard_OVERRIDE { return myInvalidatedRange; }
0033 
0034   //! Reset invalidated range.
0035   virtual void Validate() Standard_OVERRIDE { myInvalidatedRange.Clear(); }
0036 
0037   //! Invalidate the entire buffer data.
0038   virtual void Invalidate() Standard_OVERRIDE
0039   {
0040     invalidate (Graphic3d_BufferRange (0, (Standard_Integer )mySize));
0041   }
0042 
0043   //! Invalidate the given indexes (starting from 0)
0044   void Invalidate (Standard_Integer theIndexLower, Standard_Integer theIndexUpper)
0045   {
0046     Standard_OutOfRange_Raise_if (theIndexLower > theIndexUpper, "Graphic3d_MutableIndexBuffer::Invalidate()");
0047     invalidate (Graphic3d_BufferRange (Stride * theIndexLower, Stride * (theIndexUpper - theIndexLower + 1)));
0048   }
0049 
0050   //! Invalidate specified sub-range of data (as byte offsets).
0051   void invalidate (const Graphic3d_BufferRange& theRange) { myInvalidatedRange.Unite (theRange); }
0052 
0053 protected:
0054 
0055   Graphic3d_BufferRange myInvalidatedRange; //!< invalidated buffer data range (as byte offsets)
0056 
0057 };
0058 
0059 #endif // _Graphic3d_MutableIndexBuffer_HeaderFile