File indexing completed on 2025-01-18 10:03:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Graphic3d_BufferRange_HeaderFile
0015 #define _Graphic3d_BufferRange_HeaderFile
0016
0017 #include <Graphic3d_Vec.hxx>
0018 #include <Standard_Integer.hxx>
0019
0020
0021 struct Graphic3d_BufferRange
0022 {
0023 Standard_Integer Start;
0024 Standard_Integer Length;
0025
0026
0027 Graphic3d_BufferRange() : Start (0), Length (0) {}
0028
0029
0030 Graphic3d_BufferRange (Standard_Integer theStart, Standard_Integer theLength) : Start (theStart), Length (theLength) {}
0031
0032
0033 Standard_Boolean IsEmpty() const { return Length == 0; }
0034
0035
0036 Standard_Integer Upper() const { return Start + Length - 1; }
0037
0038
0039 void Clear()
0040 {
0041 Start = 0;
0042 Length = 0;
0043 }
0044
0045
0046 void Unite (const Graphic3d_BufferRange& theRange)
0047 {
0048 if (IsEmpty())
0049 {
0050 *this = theRange;
0051 return;
0052 }
0053 else if (theRange.IsEmpty())
0054 {
0055 return;
0056 }
0057
0058 const Standard_Integer aStart = Min (Start, theRange.Start);
0059 const Standard_Integer aLast = Max (Upper(), theRange.Upper());
0060 Start = aStart;
0061 Length = aLast - aStart + 1;
0062 }
0063 };
0064
0065 #endif