Logo ROOT  
Reference Guide
REveRenderData.hxx
Go to the documentation of this file.
1// @(#)root/eve7:$Id$
2// Authors: Matevz Tadel & Alja Mrak-Tadel: 2006, 2007, 2018
3
4/*************************************************************************
5 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT7_REveRenderData
13#define ROOT7_REveRenderData
14
15#include <ROOT/REveVector.hxx>
16
17#include <string>
18#include <vector>
19
20namespace ROOT {
21namespace Experimental {
22
24{
25private:
26 std::string fRnrFunc;
27 std::vector<float> fVertexBuffer;
28 std::vector<float> fNormalBuffer;
29 std::vector<int> fIndexBuffer;
30 std::vector<float> fMatrix;
31
32public:
33 // If Primitive_e is changed, change also definition in EveElements.js.
34
36
37 REveRenderData() = default;
38 REveRenderData(const std::string &func, int size_vert = 0, int size_norm = 0, int size_idx = 0);
39
40 void Reserve(int size_vert = 0, int size_norm = 0, int size_idx = 0);
41
42 void PushV(float x) { fVertexBuffer.emplace_back(x); }
43
44 void PushV(float x, float y, float z)
45 {
46 PushV(x);
47 PushV(y);
48 PushV(z);
49 }
50
51 void PushV(const REveVectorF &v)
52 {
53 PushV(v.fX);
54 PushV(v.fY);
55 PushV(v.fZ);
56 }
57
58 void PushV(float *v, int len) { fVertexBuffer.insert(fVertexBuffer.end(), v, v + len); }
59
60 void PushN(float x) { fNormalBuffer.emplace_back(x); }
61
62 void PushN(float x, float y, float z)
63 {
64 PushN(x);
65 PushN(y);
66 PushN(z);
67 }
68
69 void PushN(const REveVectorF &v)
70 {
71 PushN(v.fX);
72 PushN(v.fY);
73 PushN(v.fZ);
74 }
75
76 void PushI(int i) { fIndexBuffer.emplace_back(i); }
77
78 void PushI(int i, int j, int k)
79 {
80 PushI(i);
81 PushI(j);
82 PushI(k);
83 }
84
85 void PushI(int *v, int len) { fIndexBuffer.insert(fIndexBuffer.end(), v, v + len); }
86
87 void PushI(std::vector<int> &v) { fIndexBuffer.insert(fIndexBuffer.end(), v.begin(), v.end()); }
88
89 void SetMatrix(const double *arr);
90
91 const std::string GetRnrFunc() const { return fRnrFunc; }
92
93 int SizeV() const { return fVertexBuffer.size(); }
94 int SizeN() const { return fNormalBuffer.size(); }
95 int SizeI() const { return fIndexBuffer.size(); }
96 int SizeT() const { return fMatrix.size(); }
97
98 int GetBinarySize() { return (SizeV() + SizeN() + SizeT()) * sizeof(float) + SizeI() * sizeof(int); }
99
100 int Write(char *msg, int maxlen);
101};
102
103} // namespace Experimental
104} // namespace ROOT
105
106#endif
void PushI(std::vector< int > &v)
void PushV(float x, float y, float z)
void Reserve(int size_vert=0, int size_norm=0, int size_idx=0)
Reserve place for render data.
void PushI(int i, int j, int k)
int Write(char *msg, int maxlen)
Write render data to binary buffer.
void PushN(const REveVectorF &v)
const std::string GetRnrFunc() const
void PushV(const REveVectorF &v)
void PushN(float x, float y, float z)
void SetMatrix(const double *arr)
Set transformation matrix.
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
VSD Structures.
Definition: StringConv.hxx:21