12#include "TGLIncludes.h"
25 const std::vector<UInt_t> &fTS)
27 glEnableClientState(GL_VERTEX_ARRAY);
28 glEnableClientState(GL_NORMAL_ARRAY);
29 glVertexPointer(3,
type, 0, &vs[0]);
30 glNormalPointer(
type, 0, &
ns[0]);
31 glDrawElements(
GL_TRIANGLES, fTS.size(), GL_UNSIGNED_INT, &fTS[0]);
32 glDisableClientState(GL_NORMAL_ARRAY);
33 glDisableClientState(GL_VERTEX_ARRAY);
39void DrawMesh(
const std::vector<Float_t> &vs,
const std::vector<Float_t> &
ns,
40 const std::vector<UInt_t> &ts)
48void DrawMesh(
const std::vector<Double_t> &vs,
const std::vector<Double_t> &
ns,
49 const std::vector<UInt_t> &ts)
60 glEnableClientState(GL_VERTEX_ARRAY);
61 glVertexPointer(3,
type, 0, &vs[0]);
62 glDrawElements(
GL_TRIANGLES, fTS.size(), GL_UNSIGNED_INT, &fTS[0]);
63 glDisableClientState(GL_VERTEX_ARRAY);
69void DrawMesh(
const std::vector<Float_t> &vs,
const std::vector<UInt_t> &ts)
77void DrawMesh(
const std::vector<Double_t> &vs,
const std::vector<UInt_t> &ts)
86template<
class V,
class GLN,
class GLV>
87void DrawMesh(GLN normal3, GLV vertex3,
const std::vector<V> &vs,
88 const std::vector<V> &
ns,
const std::vector<UInt_t> &fTS,
93 for (
UInt_t i = 0,
e = fTS.size() / 3; i <
e; ++i) {
94 const UInt_t * t = &fTS[i * 3];
95 if (
box.IsInCut(&vs[t[0] * 3]))
97 if (
box.IsInCut(&vs[t[1] * 3]))
99 if (
box.IsInCut(&vs[t[2] * 3]))
102 normal3(&
ns[t[0] * 3]);
103 vertex3(&vs[t[0] * 3]);
105 normal3(&
ns[t[1] * 3]);
106 vertex3(&vs[t[1] * 3]);
108 normal3(&
ns[t[2] * 3]);
109 vertex3(&vs[t[2] * 3]);
118void DrawMesh(
const std::vector<Float_t> &vs,
const std::vector<Float_t> &
ns,
127void DrawMesh(
const std::vector<Double_t> &vs,
const std::vector<Double_t> &
ns,
137template<
class V,
class GLV>
138void DrawMesh(GLV vertex3,
const std::vector<V> &vs,
const std::vector<UInt_t> &fTS,
143 for (
UInt_t i = 0,
e = fTS.size() / 3; i <
e; ++i) {
144 const UInt_t * t = &fTS[i * 3];
145 if (
box.IsInCut(&vs[t[0] * 3]))
147 if (
box.IsInCut(&vs[t[1] * 3]))
149 if (
box.IsInCut(&vs[t[2] * 3]))
152 vertex3(&vs[t[0] * 3]);
153 vertex3(&vs[t[1] * 3]);
154 vertex3(&vs[t[2] * 3]);
184 rfColor[0] = (
x > 0. ?
x : 0.) + (
y < 0. ? -0.5 *
y : 0.) + (z < 0. ? -0.5 * z : 0.);
185 rfColor[1] = (
y > 0. ?
y : 0.) + (z < 0. ? -0.5 * z : 0.) + (
x < 0. ? -0.5 *
x : 0.);
186 rfColor[2] = (z > 0. ? z : 0.) + (
x < 0. ? -0.5 *
x : 0.) + (
y < 0. ? -0.5 *
y : 0.);
193 const std::vector<UInt_t> &fTS)
195 Double_t color[] = {0., 0., 0., 0.15};
199 for (
UInt_t i = 0,
e = fTS.size() / 3; i <
e; ++i) {
200 const UInt_t *t = &fTS[i * 3];
205 glVertex3dv(&vs[t[0] * 3]);
210 glVertex3dv(&vs[t[1] * 3]);
215 glVertex3dv(&vs[t[2] * 3]);
227 Double_t color[] = {0., 0., 0., 0.15};
231 for (
UInt_t i = 0,
e = fTS.size() / 3; i <
e; ++i) {
232 const UInt_t *t = &fTS[i * 3];
233 if (
box.IsInCut(&vs[t[0] * 3]))
235 if (
box.IsInCut(&vs[t[1] * 3]))
237 if (
box.IsInCut(&vs[t[2] * 3]))
243 glVertex3dv(&vs[t[0] * 3]);
248 glVertex3dv(&vs[t[1] * 3]);
253 glVertex3dv(&vs[t[2] * 3]);
Used by plot-painters to determine the area of the plot that is cut away.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
void DrawMapleMesh(const std::vector< Double_t > &vs, const std::vector< Double_t > &ns, const std::vector< UInt_t > &ts)
Colored mesh with lighting disabled.
void NormalToColor(Double_t *rfColor, const Double_t *n)
NormalToColor generates a color from a given normal.
void DrawMesh(const std::vector< Float_t > &vs, const std::vector< Float_t > &ns, const std::vector< UInt_t > &ts)
Call function-template.
static constexpr double ns