File indexing completed on 2025-09-18 09:32:03
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_REveBoxSet
0013 #define ROOT_REveBoxSet
0014
0015 #include "ROOT/REveDigitSet.hxx"
0016 #include "ROOT/REveVector.hxx"
0017
0018 class TGeoMatrix;
0019 class TRandom;
0020
0021 namespace ROOT {
0022 namespace Experimental {
0023 class REveBoxSet: public REveDigitSet
0024 {
0025 friend class REveBoxSetGL;
0026
0027 REveBoxSet(const REveBoxSet&) = delete;
0028 REveBoxSet& operator=(const REveBoxSet&) = delete;
0029
0030 public:
0031 enum EBoxType_e {
0032 kBT_Undef,
0033 kBT_FreeBox,
0034 kBT_Instanced,
0035 kBT_InstancedScaled,
0036 kBT_InstancedScaledRotated
0037 };
0038
0039 enum EShape_e {
0040 kBox,
0041 kHex,
0042 kCone,
0043 kConeCapped
0044 };
0045
0046 struct BFreeBox_t : public DigitBase_t { Float_t fVertices[8][3]; };
0047
0048 struct Instanced_t : public DigitBase_t { Float_t fX, fY, fZ; };
0049
0050 struct InstancedScaled_t : public Instanced_t { Float_t fW, fH, fD; };
0051
0052 struct InstancedScaledRotated_t : public DigitBase_t { Float_t fMat[16]; };
0053
0054
0055
0056 protected:
0057 EBoxType_e fBoxType;
0058 EShape_e fShapeType{kBox};
0059
0060 Float_t fDefWidth {1};
0061 Float_t fDefHeight {1};
0062 Float_t fDefDepth {1};
0063
0064 Int_t fBoxSkip;
0065
0066 Bool_t fDrawConeCap{false};
0067
0068 int fTexX{0}, fTexY{0};
0069 static Int_t SizeofAtom(EBoxType_e bt);
0070 void WriteShapeData(REveDigitSet::DigitBase_t &digit);
0071 unsigned int GetColorFromDigit(REveDigitSet::DigitBase_t &digit);
0072 float GetColorFromDigitAsFloat(REveDigitSet::DigitBase_t &digit);
0073
0074 public:
0075 REveBoxSet(const char* n="REveBoxSet", const char* t="");
0076 ~REveBoxSet() override {}
0077
0078 void Reset(EBoxType_e boxType, Bool_t valIsCol, Int_t chunkSize);
0079 void Reset();
0080
0081 void AddFreeBox(const Float_t* verts);
0082 void AddInstanceScaled(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d);
0083 void AddInstance(Float_t a, Float_t b, Float_t c);
0084 void AddInstanceMat4(const Float_t* mat4);
0085
0086 void AddBox(const Float_t* verts) { AddFreeBox(verts); }
0087 void AddBox(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d) { AddInstanceScaled(a, b, c, w, h, d); }
0088 void AddBox(Float_t a, Float_t b, Float_t c) { AddInstance(a, b, c);}
0089
0090 void AddCone(const REveVector& pos, const REveVector& dir, Float_t r);
0091 void AddEllipticCone(const REveVector& pos, const REveVector& dir, Float_t r, Float_t r2, Float_t angle=0);
0092
0093 void AddHex(const REveVector& pos, Float_t r, Float_t angle, Float_t depth);
0094 void SetShape(EShape_e x){fShapeType = x;}
0095
0096 void ComputeBBox() override;
0097
0098 void Test(Int_t nboxes);
0099
0100 Float_t GetDefWidth() const { return fDefWidth; }
0101 Float_t GetDefHeight() const { return fDefHeight; }
0102 Float_t GetDefDepth() const { return fDefDepth; }
0103 Bool_t GetDrawConeCap() const { return fDrawConeCap; }
0104
0105 void SetDefWidth(Float_t v) { fDefWidth = v ; }
0106 void SetDefHeight(Float_t v) { fDefHeight = v ; }
0107 void SetDefDepth(Float_t v) { fDefDepth = v ; }
0108 void SetDrawConeCap(Bool_t x) { fDrawConeCap=x; StampObjProps(); }
0109
0110 Int_t GetBoxSkip() const { return fBoxSkip; }
0111 void SetBoxSkip(Int_t bs) { fBoxSkip = bs; }
0112
0113
0114 Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0115 void BuildRenderData() override;
0116
0117 bool Instanced();
0118 };
0119
0120 }
0121 }
0122 #endif