File indexing completed on 2025-01-18 10:10:40
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT7_REveRenderData
0013 #define ROOT7_REveRenderData
0014
0015 #include <ROOT/REveVector.hxx>
0016
0017 #include <string>
0018 #include <vector>
0019
0020 namespace ROOT {
0021 namespace Experimental {
0022
0023 class REveRenderData
0024 {
0025 private:
0026 std::string fRnrFunc;
0027 std::vector<float> fVertexBuffer;
0028 std::vector<float> fNormalBuffer;
0029 std::vector<int> fIndexBuffer;
0030 std::vector<float> fMatrix;
0031
0032 public:
0033
0034
0035 enum Primitive_e { GL_POINTS = 0, GL_LINES, GL_LINE_LOOP, GL_LINE_STRIP, GL_TRIANGLES };
0036
0037 REveRenderData() = default;
0038 REveRenderData(const std::string &func, int size_vert = 0, int size_norm = 0, int size_idx = 0);
0039
0040 void Reserve(int size_vert = 0, int size_norm = 0, int size_idx = 0);
0041
0042 void PushV(float x) { fVertexBuffer.emplace_back(x); }
0043
0044 void PushV(float x, float y, float z)
0045 {
0046 PushV(x);
0047 PushV(y);
0048 PushV(z);
0049 }
0050
0051 void PushV(const REveVectorF &v)
0052 {
0053 PushV(v.fX);
0054 PushV(v.fY);
0055 PushV(v.fZ);
0056 }
0057
0058 void PushV(float *v, int len) { fVertexBuffer.insert(fVertexBuffer.end(), v, v + len); }
0059
0060 void PushN(float x) { fNormalBuffer.emplace_back(x); }
0061
0062 void PushN(float x, float y, float z)
0063 {
0064 PushN(x);
0065 PushN(y);
0066 PushN(z);
0067 }
0068
0069 void PushN(const REveVectorF &v)
0070 {
0071 PushN(v.fX);
0072 PushN(v.fY);
0073 PushN(v.fZ);
0074 }
0075
0076 void PushI(UInt_t i) { fIndexBuffer.emplace_back(i); }
0077
0078 void PushI(UInt_t i, UInt_t j, UInt_t k)
0079 {
0080 PushI(i);
0081 PushI(j);
0082 PushI(k);
0083 }
0084
0085 void PushI(UInt_t *v, int len) { fIndexBuffer.insert(fIndexBuffer.end(), v, v + len); }
0086
0087 void PushI(std::vector<UInt_t> &v) { fIndexBuffer.insert(fIndexBuffer.end(), v.begin(), v.end()); }
0088
0089 void SetMatrix(const double *arr);
0090
0091 const std::string GetRnrFunc() const { return fRnrFunc; }
0092
0093 void ResizeV(int s) { fVertexBuffer.resize(s); }
0094
0095 int SizeV() const { return fVertexBuffer.size(); }
0096 int SizeN() const { return fNormalBuffer.size(); }
0097 int SizeI() const { return fIndexBuffer.size(); }
0098 int SizeT() const { return fMatrix.size(); }
0099
0100 int GetBinarySize() { return (SizeV() + SizeN() + SizeT()) * sizeof(float) + SizeI() * sizeof(int); }
0101
0102 int Write(char *msg, int maxlen);
0103
0104 static void CalcTextureSize(int nel, int align, int &sx, int &sy);
0105 };
0106
0107 }
0108 }
0109
0110 #endif