File indexing completed on 2026-09-29 09:19:05
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 <NCollection_Vec2.hxx>
0018
0019 #include <Standard_TypeDef.hxx>
0020
0021 #include <NCollection_Vec3.hxx>
0022
0023 #include <NCollection_Vec4.hxx>
0024
0025 #include <NCollection_Mat4.hxx>
0026 #include <Standard_Integer.hxx>
0027
0028
0029 struct Graphic3d_BufferRange
0030 {
0031 int Start;
0032 int Length;
0033
0034
0035 Graphic3d_BufferRange()
0036 : Start(0),
0037 Length(0)
0038 {
0039 }
0040
0041
0042 Graphic3d_BufferRange(int theStart, int theLength)
0043 : Start(theStart),
0044 Length(theLength)
0045 {
0046 }
0047
0048
0049 bool IsEmpty() const { return Length == 0; }
0050
0051
0052 int Upper() const { return Start + Length - 1; }
0053
0054
0055 void Clear()
0056 {
0057 Start = 0;
0058 Length = 0;
0059 }
0060
0061
0062 void Unite(const Graphic3d_BufferRange& theRange)
0063 {
0064 if (IsEmpty())
0065 {
0066 *this = theRange;
0067 return;
0068 }
0069 else if (theRange.IsEmpty())
0070 {
0071 return;
0072 }
0073
0074 const int aStart = (std::min)(Start, theRange.Start);
0075 const int aLast = (std::max)(Upper(), theRange.Upper());
0076 Start = aStart;
0077 Length = aLast - aStart + 1;
0078 }
0079 };
0080
0081 #endif