Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-26 09:03:26

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   //! Empty constructor.
0025   Graphic3d_MutableIndexBuffer(const occ::handle<NCollection_BaseAllocator>& theAlloc)
0026       : Graphic3d_IndexBuffer(theAlloc)
0027   {
0028   }
0029 
0030   //! Return TRUE if data can be invalidated.
0031   bool IsMutable() const override { return true; }
0032 
0033   //! Return invalidated range.
0034   Graphic3d_BufferRange InvalidatedRange() const override { return myInvalidatedRange; }
0035 
0036   //! Reset invalidated range.
0037   void Validate() override { myInvalidatedRange.Clear(); }
0038 
0039   //! Invalidate the entire buffer data.
0040   void Invalidate() override { invalidate(Graphic3d_BufferRange(0, (int)mySize)); }
0041 
0042   //! Invalidate the given indexes (starting from 0)
0043   void Invalidate(int theIndexLower, int theIndexUpper)
0044   {
0045     Standard_OutOfRange_Raise_if(theIndexLower > theIndexUpper,
0046                                  "Graphic3d_MutableIndexBuffer::Invalidate()");
0047     invalidate(
0048       Graphic3d_BufferRange(Stride * theIndexLower, Stride * (theIndexUpper - theIndexLower + 1)));
0049   }
0050 
0051   //! Invalidate specified sub-range of data (as byte offsets).
0052   void invalidate(const Graphic3d_BufferRange& theRange) { myInvalidatedRange.Unite(theRange); }
0053 
0054 protected:
0055   Graphic3d_BufferRange myInvalidatedRange; //!< invalidated buffer data range (as byte offsets)
0056 };
0057 
0058 #endif // _Graphic3d_MutableIndexBuffer_HeaderFile