File indexing completed on 2026-09-28 09:20:19
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef _Graphic3d_BoundBuffer_HeaderFile
0015 #define _Graphic3d_BoundBuffer_HeaderFile
0016
0017 #include <Graphic3d_Buffer.hxx>
0018
0019
0020 class Graphic3d_BoundBuffer : public NCollection_Buffer
0021 {
0022 DEFINE_STANDARD_RTTIEXT(Graphic3d_BoundBuffer, NCollection_Buffer)
0023 public:
0024
0025 Graphic3d_BoundBuffer(const occ::handle<NCollection_BaseAllocator>& theAlloc)
0026 : NCollection_Buffer(theAlloc),
0027 Colors(nullptr),
0028 Bounds(nullptr),
0029 NbBounds(0),
0030 NbMaxBounds(0)
0031 {
0032 }
0033
0034
0035 bool Init(const int theNbBounds, const bool theHasColors)
0036 {
0037 Colors = nullptr;
0038 Bounds = nullptr;
0039 NbBounds = 0;
0040 NbMaxBounds = 0;
0041 Free();
0042 if (theNbBounds < 1)
0043 {
0044 return false;
0045 }
0046
0047 const size_t aBoundsSize = sizeof(int) * theNbBounds;
0048 const size_t aColorsSize = theHasColors ? sizeof(NCollection_Vec4<float>) * theNbBounds : 0;
0049 if (!Allocate(aColorsSize + aBoundsSize))
0050 {
0051 Free();
0052 return false;
0053 }
0054
0055 NbBounds = theNbBounds;
0056 NbMaxBounds = theNbBounds;
0057 Colors = theHasColors ? reinterpret_cast<NCollection_Vec4<float>*>(myData) : nullptr;
0058 Bounds = reinterpret_cast<int*>(theHasColors ? (myData + aColorsSize) : myData);
0059 return true;
0060 }
0061
0062
0063 void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override
0064 {
0065 OCCT_DUMP_TRANSIENT_CLASS_BEGIN(theOStream)
0066 OCCT_DUMP_BASE_CLASS(theOStream, theDepth, NCollection_Buffer)
0067
0068 OCCT_DUMP_FIELD_VALUE_POINTER(theOStream, Colors)
0069 OCCT_DUMP_FIELD_VALUE_POINTER(theOStream, Bounds)
0070
0071 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, NbBounds)
0072 OCCT_DUMP_FIELD_VALUE_NUMERICAL(theOStream, NbMaxBounds)
0073 }
0074
0075 public:
0076 NCollection_Vec4<float>* Colors;
0077 int* Bounds;
0078 int NbBounds;
0079 int NbMaxBounds;
0080 };
0081
0082 #endif