/usr/include/root/TGLPadUtils.h is in libroot-graf3d-gl-dev 5.34.14-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | // @(#)root/gl:$Id$
// Author: Timur Pocheptsov 06/05/2009
/*************************************************************************
* Copyright (C) 1995-2009, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TGLPadUtils
#define ROOT_TGLPadUtils
#include <vector>
#include <list>
#ifndef ROOT_RStipples
#include "RStipples.h"
#endif
#ifndef ROOT_TPoint
#include "TPoint.h"
#endif
#ifndef ROOT_Rtypes
#include "Rtypes.h"
#endif
class TGLPadPainter;//For friend declarations.
/*
All code here and in corresponding *.cxx file is only
for TGLPadPainter. So, it can be limited or wrong
for something else, but it's OK for TGLPadPainter.
*/
namespace Rgl {
namespace Pad {
/*
Auxiliary class to converts ROOT's polygon stipples from
RStipples.h into GL's stipples and hold them in a fStipples array.
*/
class PolygonStippleSet {
friend class ::TGLPadPainter;
friend class FillAttribSet;
private:
std::vector<unsigned char> fStipples;
static const UInt_t fgBitSwap[];
static UInt_t SwapBits(UInt_t bits);
enum EGeometry {
kRowSize = 4,//For gl, stipple is a 32x32 pixel pattern. So, 4 GLubyte objects form a single line of a stipple.
kNRows = 32,
kStippleSize = kNRows * kRowSize//4 * 32 == 32 lines.
};
enum EBitMasks {
kLow4 = 0xf,
kUp4 = 0xf0,
k16Bits = 0xff
};
public:
PolygonStippleSet();
};
/*
RAII class to enable/disable selected stipple.
*/
class FillAttribSet {
UInt_t fStipple;
Float_t fAlpha;
public:
FillAttribSet(const PolygonStippleSet & set, Bool_t ignoreStipple);
~FillAttribSet();
};
/*
"ROOT like" line stipples.
*/
extern const UShort_t gLineStipples[];
extern const UInt_t gMaxStipple;
/*
Set/unset line attributes.
*/
class LineAttribSet {
private:
Bool_t fSmooth;
UInt_t fStipple;
Bool_t fSetWidth;
Float_t fAlpha;
public:
LineAttribSet(Bool_t smooth, UInt_t stipple, Double_t maxWidth, Bool_t setWidth);
~LineAttribSet();
};
/*
Marker painter. Most markers can be painted by standlone functions.
For circles, it can be usefull to precalculate the marker geometry
and use it for poly-markers.
*/
/*
Marker painter. Most markers can be painted by standlone functions.
For circles, it can be usefull to precalculate the marker geometry
and use it for poly-markers.
*/
class MarkerPainter {
private:
//Different TArrMarker styles.
mutable TPoint fStar[8];
mutable TPoint fCross[4];
mutable std::vector<TPoint> fCircle;
enum {
kSmallCirclePts = 80,
kLargeCirclePts = 150
};
public:
//Each function draw n markers.
void DrawDot(UInt_t n, const TPoint *xy)const;
void DrawPlus(UInt_t n, const TPoint *xy)const;
void DrawStar(UInt_t n, const TPoint *xy)const;
void DrawX(UInt_t n, const TPoint *xy)const;
void DrawFullDotSmall(UInt_t n, const TPoint *xy)const;
void DrawFullDotMedium(UInt_t n, const TPoint *xy)const;
void DrawCircle(UInt_t n, const TPoint *xy)const;
void DrawFullDotLarge(UInt_t n, const TPoint *xy)const;
void DrawFullSquare(UInt_t n, const TPoint *xy)const;
void DrawFullTrianlgeUp(UInt_t n, const TPoint *xy)const;
void DrawFullTrianlgeDown(UInt_t n, const TPoint *xy)const;
void DrawDiamond(UInt_t n, const TPoint *xy)const;
void DrawCross(UInt_t n, const TPoint *xy)const;
void DrawFullStar(UInt_t n, const TPoint *xy)const;
void DrawOpenStar(UInt_t n, const TPoint *xy)const;
};
//
// OpenGL's tesselator calls callback functions glBegin(MODE), glVertex3(v), glEnd(),
// where v can be new vertex (or existing) and MODE is a type of mesh patch.
// MeshPatch_t is a class to save such a tesselation
// (instead of using glVertex and glBegin to draw.
//
struct MeshPatch_t {
MeshPatch_t(Int_t type) : fPatchType(type)
{}
Int_t fPatchType; //GL_QUADS, GL_QUAD_STRIP, etc.
std::vector<Double_t> fPatch; //vertices.
};
typedef std::list<MeshPatch_t> Tesselation_t;
class Tesselator {
public:
Tesselator(Bool_t dump = kFALSE);
~Tesselator();
void *GetTess()const
{
return fTess;
}
static void SetDump(Tesselation_t *t)
{
fVs = t;
}
static Tesselation_t *GetDump()
{
return fVs;
}
private:
void *fTess;
static Tesselation_t *fVs;//the current tesselator's dump.
};
/*
In future, this should be an interface to per-pad FBO.
Currently, in only save sizes and coordinates (?)
*/
class OffScreenDevice {
friend class ::TGLPadPainter;
public:
OffScreenDevice(UInt_t w, UInt_t h, UInt_t x, UInt_t y, Bool_t top);
private:
UInt_t fW;
UInt_t fH;
UInt_t fX;
UInt_t fY;
Bool_t fTop;
};
void ExtractRGB(Color_t colorIndex, Float_t * rgb);
class GLLimits {
public:
GLLimits();
Double_t GetMaxLineWidth()const;
Double_t GetMaxPointSize()const;
private:
mutable Double_t fMaxLineWidth;
mutable Double_t fMaxPointSize;
};
}//namespace Pad
}//namespace Rgl
#endif
|