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,
121 DrawMesh(&glNormal3fv, &glVertex3fv, vs, ns, ts,
box);
127void DrawMesh(
const std::vector<Double_t> &vs,
const std::vector<Double_t> &ns,
130 DrawMesh(&glNormal3dv, &glVertex3dv, vs, ns, ts,
box);
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.);
192void DrawMapleMesh(
const std::vector<Double_t> &vs,
const std::vector<Double_t> &ns,
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]);
224void DrawMapleMesh(
const std::vector<Double_t> &vs,
const std::vector<Double_t> &ns,
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]);
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
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.