86 Bool_t ValidIndex(UInt_t index)
const {
return (index < 3); }
91 TGLVertex3(Double_t x, Double_t y, Double_t z);
92 TGLVertex3(Double_t* v);
93 TGLVertex3(
const TGLVertex3 & other);
96 Bool_t operator == (
const TGLVertex3 & rhs)
const;
97 TGLVertex3 & operator = (
const TGLVertex3 & rhs);
98 TGLVertex3 & operator *= (Double_t f);
99 TGLVertex3 operator - ()
const;
100 const TGLVertex3 & operator -= (
const TGLVector3 & val);
101 const TGLVertex3 & operator += (
const TGLVector3 & val);
104 void Fill(Double_t val);
105 void Set(Double_t x, Double_t y, Double_t z);
106 void Set(
const Double_t* xyz);
107 void Set(
const TGLVertex3 & other);
108 void Shift(TGLVector3 & shift);
109 void Shift(Double_t xDelta, Double_t yDelta, Double_t zDelta);
112 void Minimum(
const TGLVertex3 & other);
113 void Maximum(
const TGLVertex3 & other);
116 Double_t & operator [] (Int_t index);
117 const Double_t & operator [] (Int_t index)
const;
118 Double_t X()
const {
return fVals[0]; }
119 Double_t & X() {
return fVals[0]; }
120 Double_t Y()
const {
return fVals[1]; }
121 Double_t & Y() {
return fVals[1]; }
122 Double_t Z()
const {
return fVals[2]; }
123 Double_t & Z() {
return fVals[2]; }
125 const Double_t * CArr()
const {
return fVals; }
126 Double_t * Arr() {
return fVals; }
130 ClassDefNV(TGLVertex3,1);
134 inline TGLVertex3 operator*(Double_t f,
const TGLVertex3& v)
136 return TGLVertex3(f*v.X(), f*v.Y(), f*v.Z());
140 inline void TGLVertex3::Negate()
142 fVals[0] = -fVals[0];
143 fVals[1] = -fVals[1];
144 fVals[2] = -fVals[2];
148 inline Bool_t TGLVertex3::operator == (
const TGLVertex3 & rhs)
const
150 return (fVals[0] == rhs.fVals[0] && fVals[1] == rhs.fVals[1] && fVals[2] == rhs.fVals[2]);
154 inline TGLVertex3 & TGLVertex3::operator = (
const TGLVertex3 & rhs)
166 inline TGLVertex3 TGLVertex3::operator - ()
const
168 return TGLVertex3(-fVals[0], -fVals[1], -fVals[2]);
172 inline TGLVertex3& TGLVertex3::operator *= (Double_t f)
181 inline Double_t & TGLVertex3::operator [] (Int_t index)
192 inline const Double_t& TGLVertex3::operator [] (Int_t index)
const
203 inline void TGLVertex3::Fill(Double_t val)
209 inline void TGLVertex3::Set(Double_t x, Double_t y, Double_t z)
217 inline void TGLVertex3::Set(
const Double_t* xyz)
225 inline void TGLVertex3::Set(
const TGLVertex3 & other)
227 fVals[0]=other.fVals[0];
228 fVals[1]=other.fVals[1];
229 fVals[2]=other.fVals[2];
246 class TGLVector3 :
public TGLVertex3
249 TGLVector3() =
default;
250 TGLVector3(Double_t x, Double_t y, Double_t z);
251 TGLVector3(
const Double_t *src);
253 TGLVector3& operator = (
const TGLVertex3& v)
254 { fVals[0] = v[0]; fVals[1] = v[1]; fVals[2] = v[2];
return *
this; }
256 TGLVector3 & operator /= (Double_t val);
257 TGLVector3 operator - ()
const;
259 Double_t Mag()
const;
262 ClassDefNV(TGLVector3,1);
267 inline const TGLVertex3 & TGLVertex3::operator -= (
const TGLVector3 & vec)
269 fVals[0] -= vec[0]; fVals[1] -= vec[1]; fVals[2] -= vec[2];
275 inline const TGLVertex3 & TGLVertex3::operator += (
const TGLVector3 & vec)
277 fVals[0] += vec[0]; fVals[1] += vec[1]; fVals[2] += vec[2];
282 inline TGLVector3 & TGLVector3::operator /= (Double_t val)
291 inline TGLVector3 TGLVector3::operator - ()
const
293 return TGLVector3(-fVals[0], -fVals[1], -fVals[2]);
297 inline Double_t TGLVector3::Mag()
const
299 return std::sqrt(fVals[0]*fVals[0] + fVals[1]*fVals[1] + fVals[2]*fVals[2]);
303 inline void TGLVector3::Normalise()
305 Double_t mag = Mag();
307 Error(
"TGLVector3::Normalise",
"vector has zero magnitude");
316 inline Double_t Dot(
const TGLVector3 & v1,
const TGLVector3 & v2)
318 return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
322 inline TGLVector3 Cross(
const TGLVector3 & v1,
const TGLVector3 & v2)
324 return TGLVector3(v1[1]*v2[2] - v2[1]*v1[2],
325 v1[2]*v2[0] - v2[2]*v1[0],
326 v1[0]*v2[1] - v2[0]*v1[1]);
330 inline const TGLVector3 operator / (
const TGLVector3 & vec, Double_t val)
332 return TGLVector3(vec[0] / val, vec[1] / val, vec[2] / val);
336 inline const TGLVector3 operator * (
const TGLVector3 & vec, Double_t val)
338 return TGLVector3(vec[0] * val, vec[1] * val, vec[2] * val);
343 inline TGLVertex3 operator + (
const TGLVertex3 & vertex1,
const TGLVector3 & vertex2)
345 return TGLVertex3(vertex1[0] + vertex2[0], vertex1[1] + vertex2[1], vertex1[2] + vertex2[2]);
350 inline TGLVector3 operator - (
const TGLVertex3 & vertex1,
const TGLVertex3 & vertex2)
352 return TGLVector3(vertex1[0] - vertex2[0], vertex1[1] - vertex2[1], vertex1[2] - vertex2[2]);
357 inline TGLVector3 operator + (
const TGLVector3 & vector1,
const TGLVector3 & vector2)
359 return TGLVector3(vector1[0] + vector2[0], vector1[1] + vector2[1], vector1[2] + vector2[2]);
364 inline TGLVector3 operator - (
const TGLVector3 & vector1,
const TGLVector3 & vector2)
366 return TGLVector3(vector1[0] - vector2[0], vector1[1] - vector2[1], vector1[2] - vector2[2]);
371 inline Double_t operator * (
const TGLVector3 & a,
const TGLVector3 & b)
373 return a[0]*b[0] + a[1]*b[1] + a[2]*b[2];
393 TGLLine3(
const TGLVertex3 & start,
const TGLVertex3 & end);
394 TGLLine3(
const TGLVertex3 & start,
const TGLVector3 & vector);
395 ~TGLLine3() =
default;
397 void Set(
const TGLVertex3 & start,
const TGLVertex3 & end);
398 void Set(
const TGLVertex3 & start,
const TGLVector3 & vector);
403 const TGLVertex3 & Start()
const {
return fVertex; }
404 const TGLVertex3 End()
const {
return fVertex + fVector; }
405 const TGLVector3 & Vector()
const {
return fVector; }
410 ClassDefNV(TGLLine3,0);
425 Int_t fWidth, fHeight;
429 TGLRect(Int_t x, Int_t y, Int_t width, Int_t height);
430 TGLRect(Int_t x, Int_t y, UInt_t width, UInt_t height);
436 void Set(Int_t x, Int_t y, Int_t width, Int_t height);
437 void SetCorner(Int_t x, Int_t y);
438 void Offset(Int_t dX, Int_t dY);
439 void Expand(Int_t x, Int_t y);
442 const Int_t* CArr()
const {
return &fX; }
443 Int_t* CArr() {
return &fX; }
445 Int_t X()
const {
return fX; }
446 Int_t & X() {
return fX; }
447 Int_t Y()
const {
return fY; }
448 Int_t & Y() {
return fY; }
449 Int_t Width()
const {
return fWidth; }
450 Int_t & Width() {
return fWidth; }
451 Int_t Height()
const {
return fHeight; }
452 Int_t & Height() {
return fHeight; }
453 Int_t CenterX()
const {
return fX + fWidth/2; }
454 Int_t CenterY()
const {
return fY + fHeight/2; }
455 Int_t Left()
const {
return fX; }
456 Int_t Right()
const {
return fX + fWidth; }
457 Int_t Top()
const {
return fY; }
458 Int_t Bottom()
const {
return fY + fHeight; }
460 Int_t Diagonal()
const;
461 Int_t Longest()
const;
463 Double_t Aspect()
const;
464 Rgl::EOverlap Overlap(
const TGLRect & other)
const;
470 inline void TGLRect::Set(Int_t x, Int_t y, Int_t width, Int_t height)
479 inline void TGLRect::SetCorner(Int_t x, Int_t y)
486 inline void TGLRect::Offset(Int_t dX, Int_t dY)
493 inline Int_t TGLRect::Longest()
const
495 return fWidth > fHeight ? fWidth : fHeight;
499 inline Double_t TGLRect::Aspect()
const
505 return static_cast<Double_t
>(fWidth) / static_cast<Double_t>(fHeight);
534 TGLPlane(
const TGLPlane & other);
535 TGLPlane(Double_t a, Double_t b, Double_t c, Double_t d);
536 TGLPlane(Double_t eq[4]);
537 TGLPlane(
const TGLVector3 & norm,
const TGLVertex3 & point);
538 TGLPlane(
const TGLVertex3 & p1,
const TGLVertex3 & p2,
const TGLVertex3 & p3);
539 ~TGLPlane() =
default;
541 TGLPlane &operator=(
const TGLPlane &src);
544 void Set(
const TGLPlane & other);
545 void Set(Double_t a, Double_t b, Double_t c, Double_t d);
546 void Set(Double_t eq[4]);
547 void Set(
const TGLVector3 & norm,
const TGLVertex3 & point);
548 void Set(
const TGLVertex3 & p1,
const TGLVertex3 & p2,
const TGLVertex3 & p3);
552 Double_t A()
const {
return fVals[0]; }
553 Double_t B()
const {
return fVals[1]; }
554 Double_t C()
const {
return fVals[2]; }
555 Double_t D()
const {
return fVals[3]; }
557 TGLVector3 Norm()
const {
return TGLVector3( fVals[0], fVals[1], fVals[2]); }
558 Double_t DistanceTo(
const TGLVertex3 & vertex)
const;
559 TGLVertex3 NearestOn(
const TGLVertex3 & point)
const;
562 const Double_t * CArr()
const {
return fVals; }
563 Double_t * Arr() {
return fVals; }
567 ClassDefNV(TGLPlane,0);
570 typedef std::vector<TGLPlane> TGLPlaneSet_t;
571 typedef std::vector<TGLPlane>::iterator TGLPlaneSet_i;
572 typedef std::vector<TGLPlane>::const_iterator TGLPlaneSet_ci;
575 std::pair<Bool_t, TGLLine3> Intersection(
const TGLPlane & p1,
const TGLPlane & p2);
576 std::pair<Bool_t, TGLVertex3> Intersection(
const TGLPlane & p1,
const TGLPlane & p2,
const TGLPlane & p3);
577 std::pair<Bool_t, TGLVertex3> Intersection(
const TGLPlane & plane,
const TGLLine3 & line, Bool_t extend);
603 Bool_t ValidIndex(UInt_t index)
const {
return (index < 16); }
607 TGLMatrix(Double_t x, Double_t y, Double_t z);
608 TGLMatrix(
const TGLVertex3 & translation);
609 TGLMatrix(
const TGLVertex3 & origin,
const TGLVector3 & zAxis,
const TGLVector3 & xAxis);
610 TGLMatrix(
const TGLVertex3 & origin,
const TGLVector3 & zAxis);
611 TGLMatrix(
const Double_t vals[16]);
612 TGLMatrix(
const TGLMatrix & other);
613 virtual ~TGLMatrix();
616 TGLMatrix & operator =(
const TGLMatrix & rhs);
617 Double_t & operator [] (Int_t index);
618 Double_t operator [] (Int_t index)
const;
620 void MultRight(
const TGLMatrix & rhs);
621 void MultLeft (
const TGLMatrix & lhs);
622 TGLMatrix & operator*=(
const TGLMatrix & rhs) { MultRight(rhs);
return *
this; }
625 void Set(
const TGLVertex3 & origin,
const TGLVector3 & zAxis,
const TGLVector3 & xAxis = 0);
626 void Set(
const Double_t vals[16]);
629 void SetTranslation(Double_t x, Double_t y, Double_t z);
630 void SetTranslation(
const TGLVertex3 & translation);
632 void Translate(
const TGLVector3 & vect);
633 void MoveLF(Int_t ai, Double_t amount);
634 void Move3LF(Double_t x, Double_t y, Double_t z);
636 void Scale(
const TGLVector3 & scale);
637 void Rotate(
const TGLVertex3 & pivot,
const TGLVector3 & axis, Double_t angle);
638 void RotateLF(Int_t i1, Int_t i2, Double_t amount);
639 void RotatePF(Int_t i1, Int_t i2, Double_t amount);
640 void TransformVertex(TGLVertex3 & vertex)
const;
645 TGLVector3 GetTranslation()
const;
646 TGLVector3 GetScale()
const;
647 Bool_t IsScalingForRender()
const;
649 void SetBaseVec(Int_t b, Double_t x, Double_t y, Double_t z);
650 void SetBaseVec(Int_t b,
const TGLVector3& v);
651 void SetBaseVec(Int_t b, Double_t* x);
653 TGLVector3 GetBaseVec(Int_t b)
const;
654 void GetBaseVec(Int_t b, TGLVector3& v)
const;
655 void GetBaseVec(Int_t b, Double_t* x)
const;
657 TGLVector3 Multiply(
const TGLVector3& v, Double_t w=1)
const;
658 TGLVector3 Rotate(
const TGLVector3& v)
const;
659 void MultiplyIP(TGLVector3& v, Double_t w=1)
const;
660 void RotateIP(TGLVector3& v)
const;
663 const Double_t * CArr()
const {
return fVals; }
664 Double_t * Arr() {
return fVals; }
668 ClassDef(TGLMatrix,1);
672 inline TGLMatrix & TGLMatrix::operator =(
const TGLMatrix & rhs)
682 inline Double_t & TGLMatrix::operator [] (Int_t index)
693 inline Double_t TGLMatrix::operator [] (Int_t index)
const
704 inline TGLMatrix operator * (
const TGLMatrix & lhs,
const TGLMatrix & rhs)
708 res[ 0] = rhs[ 0] * lhs[ 0] + rhs[ 1] * lhs[ 4] + rhs[ 2] * lhs[ 8] + rhs[ 3] * lhs[12];
709 res[ 1] = rhs[ 0] * lhs[ 1] + rhs[ 1] * lhs[ 5] + rhs[ 2] * lhs[ 9] + rhs[ 3] * lhs[13];
710 res[ 2] = rhs[ 0] * lhs[ 2] + rhs[ 1] * lhs[ 6] + rhs[ 2] * lhs[10] + rhs[ 3] * lhs[14];
711 res[ 3] = rhs[ 0] * lhs[ 3] + rhs[ 1] * lhs[ 7] + rhs[ 2] * lhs[11] + rhs[ 3] * lhs[15];
713 res[ 4] = rhs[ 4] * lhs[ 0] + rhs[ 5] * lhs[ 4] + rhs[ 6] * lhs[ 8] + rhs[ 7] * lhs[12];
714 res[ 5] = rhs[ 4] * lhs[ 1] + rhs[ 5] * lhs[ 5] + rhs[ 6] * lhs[ 9] + rhs[ 7] * lhs[13];
715 res[ 6] = rhs[ 4] * lhs[ 2] + rhs[ 5] * lhs[ 6] + rhs[ 6] * lhs[10] + rhs[ 7] * lhs[14];
716 res[ 7] = rhs[ 4] * lhs[ 3] + rhs[ 5] * lhs[ 7] + rhs[ 6] * lhs[11] + rhs[ 7] * lhs[15];
718 res[ 8] = rhs[ 8] * lhs[ 0] + rhs[ 9] * lhs[ 4] + rhs[10] * lhs[ 8] + rhs[11] * lhs[12];
719 res[ 9] = rhs[ 8] * lhs[ 1] + rhs[ 9] * lhs[ 5] + rhs[10] * lhs[ 9] + rhs[11] * lhs[13];
720 res[10] = rhs[ 8] * lhs[ 2] + rhs[ 9] * lhs[ 6] + rhs[10] * lhs[10] + rhs[11] * lhs[14];
721 res[11] = rhs[ 8] * lhs[ 3] + rhs[ 9] * lhs[ 7] + rhs[10] * lhs[11] + rhs[11] * lhs[15];
723 res[12] = rhs[12] * lhs[ 0] + rhs[13] * lhs[ 4] + rhs[14] * lhs[ 8] + rhs[15] * lhs[12];
724 res[13] = rhs[12] * lhs[ 1] + rhs[13] * lhs[ 5] + rhs[14] * lhs[ 9] + rhs[15] * lhs[13];
725 res[14] = rhs[12] * lhs[ 2] + rhs[13] * lhs[ 6] + rhs[14] * lhs[10] + rhs[15] * lhs[14];
726 res[15] = rhs[12] * lhs[ 3] + rhs[13] * lhs[ 7] + rhs[14] * lhs[11] + rhs[15] * lhs[15];
732 inline void TGLMatrix::SetBaseVec(Int_t b, Double_t x, Double_t y, Double_t z)
734 Double_t* C = fVals + 4*--b;
735 C[0] = x; C[1] = y; C[2] = z;
739 inline void TGLMatrix::SetBaseVec(Int_t b,
const TGLVector3& v)
741 Double_t* C = fVals + 4*--b;
742 C[0] = v[0]; C[1] = v[1]; C[2] = v[2];
746 inline void TGLMatrix::SetBaseVec(Int_t b, Double_t* x)
748 Double_t* C = fVals + 4*--b;
749 C[0] = x[0]; C[1] = x[1]; C[2] = x[2];
753 inline TGLVector3 TGLMatrix::GetBaseVec(Int_t b)
const
755 return TGLVector3(&fVals[4*--b]);
759 inline void TGLMatrix::GetBaseVec(Int_t b, TGLVector3& v)
const
761 const Double_t* C = fVals + 4*--b;
762 v[0] = C[0]; v[1] = C[1]; v[2] = C[2];
766 inline void TGLMatrix::GetBaseVec(Int_t b, Double_t* x)
const
768 const Double_t* C = fVals + 4*--b;
769 x[0] = C[0], x[1] = C[1], x[2] = C[2];
787 mutable Short_t fIndex;
791 TGLColor(Int_t r, Int_t g, Int_t b, Int_t a=255);
792 TGLColor(Float_t r, Float_t g, Float_t b, Float_t a=1);
793 TGLColor(Color_t color_index, Char_t transparency=0);
794 TGLColor(
const TGLColor& c);
796 TGLColor& operator=(
const TGLColor& c);
798 UChar_t* Arr() {
return fRGBA; }
799 const UChar_t* CArr()
const {
return fRGBA; }
801 UChar_t GetRed()
const {
return fRGBA[0]; }
802 UChar_t GetGreen()
const {
return fRGBA[1]; }
803 UChar_t GetBlue()
const {
return fRGBA[2]; }
804 UChar_t GetAlpha()
const {
return fRGBA[3]; }
806 Color_t GetColorIndex()
const;
807 Char_t GetTransparency()
const;
809 void SetRed(Int_t v) { fRGBA[0] = v; }
810 void SetGreen(Int_t v) { fRGBA[1] = v; }
811 void SetBlue(Int_t v) { fRGBA[2] = v; }
812 void SetAlpha(Int_t v) { fRGBA[3] = v; }
814 void SetColor(Int_t r, Int_t g, Int_t b, Int_t a=255);
815 void SetColor(Float_t r, Float_t g, Float_t b, Float_t a=1);
816 void SetColor(Color_t color_index);
817 void SetColor(Color_t color_index, Char_t transparency);
818 void SetTransparency(Char_t transparency);
820 TString AsString()
const;
822 ClassDefNV(TGLColor, 0);
837 TGLColor fBackground;
838 TGLColor fForeground;
841 TGLColor fSelection[5];
845 TGLColorSet(
const TGLColorSet& s);
846 ~TGLColorSet() =
default;
848 TGLColorSet& operator=(
const TGLColorSet& s);
850 TGLColor& Background() {
return fBackground; }
851 TGLColor& Foreground() {
return fForeground; }
852 TGLColor& Outline() {
return fOutline; }
853 TGLColor& Markup() {
return fMarkup; }
854 TGLColor& Selection(Int_t i) {
return fSelection[i]; }
856 const TGLColor& Background()
const {
return fBackground; }
857 const TGLColor& Foreground()
const {
return fForeground; }
858 const TGLColor& Outline()
const {
return fOutline; }
859 const TGLColor& Markup()
const {
return fMarkup; }
860 const TGLColor& Selection(Int_t i)
const {
return fSelection[i]; }
862 void StdDarkBackground();
863 void StdLightBackground();
865 ClassDefNV(TGLColorSet, 0);
883 TColorLocker() { LockColor(); }
884 virtual ~TColorLocker() { UnlockColor(); }
886 ClassDef(TColorLocker,0);
889 class TDrawQualityModifier
893 TDrawQualityModifier(Int_t dq) :
894 fOldQuality(GetDrawQuality()) {SetDrawQuality(dq); }
896 virtual ~TDrawQualityModifier()
897 { SetDrawQuality(fOldQuality); }
899 ClassDef(TDrawQualityModifier,0);
902 class TDrawQualityScaler
906 TDrawQualityScaler(Float_t fac) :
907 fOldQuality(GetDrawQuality()) {SetDrawQuality((Int_t)(fac*fOldQuality)); }
909 virtual ~TDrawQualityScaler()
910 { SetDrawQuality(fOldQuality); }
912 ClassDef(TDrawQualityScaler,0);
916 static UInt_t fgDefaultDrawQuality;
917 static UInt_t fgDrawQuality;
919 static UInt_t fgColorLockCount;
921 static Float_t fgPointSize;
922 static Float_t fgLineWidth;
923 static Float_t fgPointSizeScale;
924 static Float_t fgLineWidthScale;
926 static Float_t fgScreenScalingFactor;
927 static Float_t fgPointLineScalingFactor;
928 static Int_t fgPickingRadius;
930 TGLUtil(
const TGLUtil&);
931 TGLUtil& operator=(
const TGLUtil&);
934 virtual ~TGLUtil() {}
935 static void InitializeIfNeeded();
938 static Int_t CheckError(
const char * loc);
941 static GLUtesselator* GetDrawTesselator3fv();
942 static GLUtesselator* GetDrawTesselator4fv();
943 static GLUtesselator* GetDrawTesselator3dv();
944 static GLUtesselator* GetDrawTesselator4dv();
947 enum ELineHeadShape { kLineHeadNone, kLineHeadArrow, kLineHeadBox };
948 enum EAxesType { kAxesNone, kAxesEdge, kAxesOrigin };
950 static UInt_t GetDrawQuality();
951 static void SetDrawQuality(UInt_t dq);
952 static void ResetDrawQuality();
953 static UInt_t GetDefaultDrawQuality();
954 static void SetDefaultDrawQuality(UInt_t dq);
956 static UInt_t LockColor();
957 static UInt_t UnlockColor();
958 static Bool_t IsColorLocked();
960 static void Color(
const TGLColor& color);
961 static void ColorAlpha(
const TGLColor& color, UChar_t alpha);
962 static void ColorAlpha(
const TGLColor& color, Float_t alpha);
963 static void ColorAlpha(Color_t color_index, Float_t alpha=1);
964 static void ColorTransparency(Color_t color_index, Char_t transparency=0);
965 static void Color3ub(UChar_t r, UChar_t g, UChar_t b);
966 static void Color4ub(UChar_t r, UChar_t g, UChar_t b, UChar_t a);
967 static void Color3ubv(
const UChar_t* rgb);
968 static void Color4ubv(
const UChar_t* rgba);
969 static void Color3f(Float_t r, Float_t g, Float_t b);
970 static void Color4f(Float_t r, Float_t g, Float_t b, Float_t a);
971 static void Color3fv(
const Float_t* rgb);
972 static void Color4fv(
const Float_t* rgba);
975 static void PointToViewport(Int_t& x, Int_t& y);
976 static void PointToViewport(Int_t& x, Int_t& y, Int_t& w, Int_t& h);
977 static Float_t GetScreenScalingFactor();
978 static Float_t GetPointLineScalingFactor();
979 static Int_t GetPickingRadius();
981 static Float_t GetPointSizeScale();
982 static void SetPointSizeScale(Float_t scale);
983 static Float_t GetLineWidthScale();
984 static void SetLineWidthScale(Float_t scale);
986 static void PointSize(Float_t point_size);
987 static void LineWidth(Float_t line_width);
989 static Float_t PointSize();
990 static Float_t LineWidth();
992 static void BeginExtendPickRegion(Float_t scale);
993 static void EndExtendPickRegion();
995 static void RenderPolyMarkers(
const TAttMarker& marker, Char_t transp,
997 Int_t pick_radius=0, Bool_t selection=kFALSE,
998 Bool_t sec_selection=kFALSE);
1000 static void RenderPolyMarkers(
const TAttMarker &marker,
const std::vector<Double_t> &points,
1001 Double_t dX, Double_t dY, Double_t dZ);
1003 static void RenderPoints(
const TAttMarker& marker,
1004 Float_t* p, Int_t n,
1005 Int_t pick_radius=0, Bool_t selection=kFALSE,
1006 Bool_t sec_selection=kFALSE);
1008 static void RenderPoints(
const TAttMarker& marker,
1009 const std::vector<Double_t> &points);
1011 static void RenderCrosses(
const TAttMarker& marker,
1012 Float_t* p, Int_t n,
1013 Bool_t sec_selection=kFALSE);
1015 static void RenderCrosses(
const TAttMarker& marker,
1016 const std::vector<Double_t> &points,
1017 Double_t dX, Double_t dY, Double_t dZ);
1019 static void RenderPolyLine(
const TAttLine& aline, Char_t transp,
1020 Float_t* p, Int_t n,
1021 Int_t pick_radius=0, Bool_t selection=kFALSE);
1023 static void BeginAttLine(
const TAttLine& aline, Char_t transp,
1024 Int_t pick_radius=0, Bool_t selection=kFALSE);
1025 static void EndAttLine(Int_t pick_radius=0, Bool_t selection=kFALSE);
1028 static void SetDrawColors(
const UChar_t rgba[4]);
1029 static void DrawSphere(
const TGLVertex3 & position, Double_t radius,
const UChar_t rgba[4]);
1030 static void DrawLine(
const TGLLine3 & line, ELineHeadShape head, Double_t size,
const UChar_t rgba[4]);
1031 static void DrawLine(
const TGLVertex3 & start,
const TGLVector3 & vector, ELineHeadShape head,
1032 Double_t size,
const UChar_t rgba[4]);
1033 static void DrawRing(
const TGLVertex3 & center,
const TGLVector3 & normal,
1034 Double_t radius,
const UChar_t* rgba);
1036 static void DrawReferenceMarker(
const TGLCamera & camera,
1037 const TGLVertex3 & pos,
1039 const UChar_t * rgba = 0);
1040 static void DrawSimpleAxes(
const TGLCamera & camera,
1041 const TGLBoundingBox & bbox,
1043 static void DrawNumber(
const TString & num,
1044 const TGLVertex3 & pos,
1045 Bool_t center = kFALSE);
1048 static const UChar_t fgRed[4];
1049 static const UChar_t fgGreen[4];
1050 static const UChar_t fgBlue[4];
1051 static const UChar_t fgYellow[4];
1052 static const UChar_t fgWhite[4];
1053 static const UChar_t fgGrey[4];
1055 ClassDef(TGLUtil,0);
1060 class TGLCapabilitySwitch
1063 TGLCapabilitySwitch(
const TGLCapabilitySwitch &);
1064 TGLCapabilitySwitch &operator = (
const TGLCapabilitySwitch &);
1070 void SetState(Bool_t s);
1073 TGLCapabilitySwitch(Int_t what, Bool_t state);
1074 ~TGLCapabilitySwitch();
1077 class TGLCapabilityEnabler
1080 TGLCapabilityEnabler(
const TGLCapabilityEnabler &);
1081 TGLCapabilityEnabler &operator = (
const TGLCapabilityEnabler &);
1087 TGLCapabilityEnabler(Int_t what, Bool_t state);
1088 ~TGLCapabilityEnabler();
1091 class TGLFloatHolder
1093 TGLFloatHolder(
const TGLFloatHolder&);
1094 TGLFloatHolder& operator=(
const TGLFloatHolder&);
1099 void (*fFoo)(Float_t);
1102 TGLFloatHolder(Int_t what, Float_t state,
void (*foo)(Float_t));
1106 class TGLEnableGuard {
1111 TGLEnableGuard(Int_t cap);
1115 TGLEnableGuard(
const TGLEnableGuard &);
1116 TGLEnableGuard &operator = (
const TGLEnableGuard &);
1119 class TGLDisableGuard {
1124 TGLDisableGuard(Int_t cap);
1128 TGLDisableGuard(
const TGLDisableGuard &);
1129 TGLDisableGuard &operator = (
const TGLDisableGuard &);
1132 class TGLSelectionBuffer {
1133 std::vector<UChar_t> fBuffer;
1138 TGLSelectionBuffer();
1139 virtual ~TGLSelectionBuffer();
1141 void ReadColorBuffer(Int_t width, Int_t height);
1142 void ReadColorBuffer(Int_t x, Int_t y, Int_t width, Int_t height);
1143 const UChar_t *GetPixelColor(Int_t px, Int_t py)
const;
1146 TGLSelectionBuffer(
const TGLSelectionBuffer &);
1147 TGLSelectionBuffer &operator = (
const TGLSelectionBuffer &);
1149 ClassDef(TGLSelectionBuffer, 0);
1153 class TGL2DArray :
public std::vector<T> {
1157 typedef typename std::vector<T>::size_type size_type;
1160 TGL2DArray() : fRowLen(0), fMaxRow(0){}
1161 void SetMaxRow(Int_t max)
1165 void SetRowLen(Int_t len)
1169 const T *operator [] (size_type ind)
const
1171 return &std::vector<T>::operator [](ind * fRowLen);
1173 T *operator [] (size_type ind)
1175 return &std::vector<T>::operator [] (ind * fRowLen);
1179 class TGLPlotCoordinates;
1185 extern const Float_t gRedEmission[];
1186 extern const Float_t gGreenEmission[];
1187 extern const Float_t gBlueEmission[];
1188 extern const Float_t gOrangeEmission[];
1189 extern const Float_t gWhiteEmission[];
1190 extern const Float_t gGrayEmission[];
1191 extern const Float_t gNullEmission[];
1193 typedef std::pair<Int_t, Int_t> BinRange_t;
1194 typedef std::pair<Double_t, Double_t> Range_t;
1196 void ObjectIDToColor(Int_t objectID, Bool_t highColor);
1197 Int_t ColorToObjectID(
const UChar_t *color, Bool_t highColor);
1198 void DrawQuadOutline(
const TGLVertex3 &v1,
const TGLVertex3 &v2,
1199 const TGLVertex3 &v3,
const TGLVertex3 &v4);
1200 void DrawQuadFilled(
const TGLVertex3 &v0,
const TGLVertex3 &v1,
1201 const TGLVertex3 &v2,
const TGLVertex3 &v3,
1202 const TGLVector3 &normal);
1203 void DrawQuadFilled(
const Double_t *v0,
const Double_t *v1,
1204 const Double_t *v2,
const Double_t *v3,
1205 const Double_t *normal);
1207 void DrawSmoothFace(
const TGLVertex3 &v1,
const TGLVertex3 &v2,
1208 const TGLVertex3 &v3,
const TGLVector3 &norm1,
1209 const TGLVector3 &norm2,
const TGLVector3 &norm3);
1210 void DrawBoxFront(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax,
1211 Double_t zMin, Double_t zMax, Int_t fp);
1213 void DrawTransparentBox(Double_t xMin, Double_t xMax, Double_t yMin, Double_t yMax,
1214 Double_t zMin, Double_t zMax, Int_t fp);
1217 void DrawBoxFrontTextured(Double_t xMin, Double_t xMax, Double_t yMin,
1218 Double_t yMax, Double_t zMin, Double_t zMax,
1219 Double_t tMin, Double_t tMax, Int_t front);
1221 void DrawBoxWithGradientFill(Double_t y1, Double_t y2, Double_t x1, Double_t x2,
1222 const Double_t *rgba1,
const Double_t *rgba2);
1224 void DrawQuadStripWithRadialGradientFill(
unsigned nPoints,
const Double_t *inner,
const Double_t *innerRGBA,
1225 const Double_t *outer,
const Double_t *outerRGBA);
1228 void DrawTrapezoidTextured(
const Double_t ver[][2], Double_t zMin, Double_t zMax,
1229 Double_t tMin, Double_t tMax);
1230 void DrawTrapezoidTextured(
const Double_t ver[][3], Double_t texMin, Double_t texMax);
1231 void DrawTrapezoidTextured2(
const Double_t ver[][2], Double_t zMin, Double_t zMax,
1232 Double_t tMin, Double_t tMax);
1235 void DrawCylinder(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin,
1236 Double_t yMax, Double_t zMin, Double_t zMax);
1237 void DrawSphere(TGLQuadric *quadric, Double_t xMin, Double_t xMax, Double_t yMin,
1238 Double_t yMax, Double_t zMin, Double_t zMax);
1239 void DrawError(Double_t xMin, Double_t xMax, Double_t yMin,
1240 Double_t yMax, Double_t zMin, Double_t zMax);
1243 void DrawTrapezoid(
const Double_t ver[][2], Double_t zMin, Double_t zMax, Bool_t color = kTRUE);
1244 void DrawTrapezoid(
const Double_t ver[][3]);
1247 void DrawAxes(Int_t frontPoint,
const Int_t *viewport,
const TGLVertex3 *box2D,
1248 const TGLPlotCoordinates *plotCoord, TAxis *xAxis, TAxis *yAxis,
1250 void SetZLevels(TAxis *zAxis, Double_t zMin, Double_t zMax,
1251 Double_t zScale, std::vector<Double_t> &zLevels);
1253 void DrawFaceTextured(
const TGLVertex3 &v1,
const TGLVertex3 &v2,
const TGLVertex3 &v3,
1254 Double_t t1, Double_t t2, Double_t t3,
const TGLVector3 &norm1,
1255 const TGLVector3 &norm2,
const TGLVector3 &norm3);
1256 void DrawFaceTextured(
const TGLVertex3 &v1,
const TGLVertex3 &v2,
const TGLVertex3 &v3,
1257 Double_t t1, Double_t t2, Double_t t3, Double_t z,
const TGLVector3 &planeNormal);
1258 void GetColor(Float_t v, Float_t vmin, Float_t vmax, Int_t type, Float_t *rgba);
1262 mutable Bool_t fActive;
1264 TGuardBase &operator = (
const TGuardBase &rhs);
1270 TGuardBase(
const TGuardBase &rhs)
1273 rhs.fActive = kFALSE;
1276 Bool_t IsActive()
const
1288 template<
class Func,
class Arg>
1289 class TOneArgGuard :
public TGuardBase {
1294 TOneArgGuard(Func f, Arg a)
1305 template<
class Func,
class Arg1,
class Arg2>
1306 class TTwoArgsGuard :
public TGuardBase {
1313 TTwoArgsGuard(Func f, Arg1 a1, Arg2 a2)
1314 : fFunc(f), fArg1(a1), fArg2(a2)
1320 fFunc(fArg1, fArg2);
1324 template<
class Func,
class Arg>
1325 TOneArgGuard<Func, Arg> make_guard(Func f, Arg a)
1327 return TOneArgGuard<Func, Arg>(f, a);
1330 template<
class Func,
class Arg1,
class Arg2>
1331 TTwoArgsGuard<Func, Arg1, Arg2> make_guard(Func f, Arg1 a1, Arg2 a2)
1333 return TTwoArgsGuard<Func, Arg1, Arg2>(f, a1, a2);
1338 class TGLLevelPalette {
1340 std::vector<UChar_t> fTexels;
1341 const std::vector<Double_t> *fContours;
1342 UInt_t fPaletteSize;
1343 mutable UInt_t fTexture;
1344 Int_t fMaxPaletteSize;
1345 Rgl::Range_t fZRange;
1347 TGLLevelPalette(
const TGLLevelPalette&);
1348 TGLLevelPalette& operator=(
const TGLLevelPalette&);
1353 Bool_t GeneratePalette(UInt_t paletteSize,
const Rgl::Range_t &zRange, Bool_t checkSize = kTRUE);
1355 void SetContours(
const std::vector<Double_t> *contours);
1357 void EnableTexture(Int_t mode)
const;
1358 void DisableTexture()
const;
1360 Int_t GetPaletteSize()
const;
1362 Double_t GetTexCoord(Double_t z)
const;
1364 const UChar_t *GetColour(Double_t z)
const;
1365 const UChar_t *GetColour(Int_t ind)
const;
1368 #endif // ROOT_TGLUtil