16#include "TGLIncludes.h" 
   50   virtual void Draw() 
const = 0;
 
  116   fRmin1(r1), fRmax1(r2), fRmin2(r3), fRmax2(r4),
 
  117   fDz(dz), fNlow(
l), fNhigh(
h)
 
  175                 :
TGLMesh(LOD, r1, r2, r3, r4, dz, 
l, 
h), fMesh(), fNorm()
 
  179   const Double_t delta = (phi2 - phi1) / LOD;
 
  185   const Int_t topShift = (
fLOD + 1) * 4 + 8;
 
  186   const Int_t botShift = (
fLOD + 1) * 6 + 8;
 
  190   for (
Int_t i = 0, 
e = (
fLOD + 1) * 2; i < 
e; ++i) {
 
  229   fNorm[ind + 1] = norm;
 
  230   fNorm[ind + 2] = norm;
 
  231   fNorm[ind + 3] = norm;
 
  241   fNorm[ind + 1] = norm;
 
  242   fNorm[ind + 2] = norm;
 
  243   fNorm[ind + 3] = norm;
 
  252   glEnableClientState(GL_VERTEX_ARRAY);
 
  253   glEnableClientState(GL_NORMAL_ARRAY);
 
  263   glDisableClientState(GL_VERTEX_ARRAY);
 
  264   glDisableClientState(GL_NORMAL_ARRAY);
 
  272             :
TGLMesh(LOD, r1, r2, r3, r4, z, 
l, 
h), fMesh(), fNorm()
 
  286   for (
Int_t i = 0, 
e = (
fLOD + 1) * 2; i < 
e; ++i) {
 
  320   glEnableClientState(GL_VERTEX_ARRAY);
 
  321   glEnableClientState(GL_NORMAL_ARRAY);
 
  332   glDisableClientState(GL_VERTEX_ARRAY);
 
  333   glDisableClientState(GL_NORMAL_ARRAY);
 
  341                 :
TGLMesh(LOD, 0., r1, 0., r2, dz, 
l, 
h), fMesh(), fNorm()
 
  357   Int_t botShift = topShift + 2 * (
fLOD + 1);
 
  363   for (
Int_t i = 0, 
e = (
fLOD + 1) * 2, j = 0; i < 
e; ++i) {
 
  389   glEnableClientState(GL_VERTEX_ARRAY);
 
  390   glEnableClientState(GL_NORMAL_ARRAY);
 
  401   glDisableClientState(GL_VERTEX_ARRAY);
 
  402   glDisableClientState(GL_NORMAL_ARRAY);
 
  411                     :
TGLMesh(LOD, 0., r1, 0., r2, dz, 
l, 
h), fMesh(), fNorm()
 
  425   fMesh[topShift] = vTop;
 
  431   fMesh[botShift] = vBot;
 
  438   for (
Int_t e = (
fLOD + 1) * 2, j = 0; i < 
e; ++i) {
 
  464   fMesh[ind + 2] = vTop;
 
  465   fMesh[ind + 3] = vBot;
 
  469   fNorm[ind + 1] = norm;
 
  470   fNorm[ind + 2] = norm;
 
  471   fNorm[ind + 3] = norm;
 
  475   fMesh[ind + 1] = vBot;
 
  481   fNorm[ind + 1] = norm;
 
  482   fNorm[ind + 2] = norm;
 
  483   fNorm[ind + 3] = norm;
 
  493   glEnableClientState(GL_VERTEX_ARRAY);
 
  494   glEnableClientState(GL_NORMAL_ARRAY);
 
  504   glDisableClientState(GL_VERTEX_ARRAY);
 
  505   glDisableClientState(GL_NORMAL_ARRAY);
 
  535   switch (buffer.
Type())
 
  553            Error(
"TGLCylinder::TGLCylinder", 
"cannot cast TBuffer3D");
 
  566               Error(
"TGLCylinder::TGLCylinder", 
"cannot cast TBuffer3D");
 
  570            for (
UInt_t i =0; i < 3; i++) {
 
  594   if      (lod >= 100) off = 0;
 
  595   else if (lod <  10)  off = lod / 2;
 
  596   else                 off = lod / 10 + 4;
 
  614      lod            = 10  *   
static_cast<Int_t>(quant);
 
  619      lod            = 2   *   
static_cast<Int_t>(quant);
 
  621   return static_cast<Short_t>(lod);
 
  630      Info(
"TGLCylinder::DirectDraw", 
"this %zd (class %s) LOD %d",
 
  631           (
size_t)
this, 
IsA()->GetName(), rnrCtx.
ShapeLOD());
 
  639   std::vector<TGLMesh *> meshParts;
 
  652   for (
UInt_t i = 0; i < meshParts.size(); ++i) meshParts[i]->
Draw();
 
  655   for (
UInt_t i = 0; i < meshParts.size(); ++i) {
 
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
 
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
 
TGLVector3 gHighNormalDefault(0., 0., 1.)
 
TGLVector3 gLowNormalDefault(0., 0., -1.)
 
Cut tube segment description class - see TBuffer3DTypes for producer classes.
 
Double_t fLowPlaneNorm[3]
 
Double_t fHighPlaneNorm[3]
 
Tube segment description class - see TBuffer3DTypes for producer classes.
 
Complete tube description class - see TBuffer3DTypes for producer classes.
 
void Draw() const
draw cylinder mesh
 
TGLVertex3 fMesh[(TGLRnrCtx::kLODHigh+1) *4+2]
 
TGLVector3 fNorm[(TGLRnrCtx::kLODHigh+1) *4+2]
 
TCylinderMesh(UInt_t LOD, Double_t r1, Double_t r2, Double_t dz, const TGLVector3 &l=gLowNormalDefault, const TGLVector3 &h=gHighNormalDefault)
constructor
 
TGLVector3 fNorm[(TGLRnrCtx::kLODHigh+1) *4+10]
 
void Draw() const
Cylinder segment is drawn as one quad strip and two triangle fans.
 
TGLVertex3 fMesh[(TGLRnrCtx::kLODHigh+1) *4+10]
 
TCylinderSegMesh(UInt_t LOD, Double_t r1, Double_t r2, Double_t dz, Double_t phi1, Double_t phi2, const TGLVector3 &l=gLowNormalDefault, const TGLVector3 &h=gHighNormalDefault)
One quad mesh and two fans.
 
Implements a native ROOT-GL cylinder that can be rendered at different levels of detail.
 
TGLVector3 fHighPlaneNorm
 
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const
Debug tracing.
 
virtual Short_t QuantizeShapeLOD(Short_t shapeLOD, Short_t combiLOD) const
Factor in scene/viewer LOD and quantize.
 
TGLCylinder(const TBuffer3DTube &buffer)
Copy out relevant parts of buffer - we create and delete mesh parts on demand in DirectDraw() and the...
 
virtual UInt_t DLOffset(Short_t lod) const
Return display-list offset for given LOD.
 
virtual TClass * IsA() const
 
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
 
Int_t fDLSize
display-list id base
 
const TGLVertex3 & MakeVertex(Double_t x, Double_t y, Double_t z) const
make vertex
 
virtual void Draw() const =0
 
TGLMesh(UInt_t LOD, Double_t r1, Double_t r2, Double_t r3, Double_t r4, Double_t dz, const TGLVector3 &l=gLowNormalDefault, const TGLVector3 &h=gHighNormalDefault)
 
Double_t GetZcoord(Double_t x, Double_t y, Double_t z) const
get Z coordinate
 
void GetNormal(const TGLVertex3 &vertex, TGLVector3 &normal) const
get normal
 
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
 
3 component (x/y/z) vector class.
 
3 component (x/y/z) vertex class.
 
TGLVertex3 fMesh[(TGLRnrCtx::kLODHigh+1) *8]
 
void Draw() const
Tube is drawn as four quad strips.
 
TubeMesh(UInt_t LOD, Double_t r1, Double_t r2, Double_t r3, Double_t r4, Double_t dz, const TGLVector3 &l=gLowNormalDefault, const TGLVector3 &h=gHighNormalDefault)
constructor
 
TGLVector3 fNorm[(TGLRnrCtx::kLODHigh+1) *8]
 
TGLVertex3 fMesh[(TGLRnrCtx::kLODHigh+1) *8+8]
 
TGLVector3 fNorm[(TGLRnrCtx::kLODHigh+1) *8+8]
 
TubeSegMesh(UInt_t LOD, Double_t r1, Double_t r2, Double_t r3, Double_t r4, Double_t dz, Double_t phi1, Double_t phi2, const TGLVector3 &l=gLowNormalDefault, const TGLVector3 &h=gHighNormalDefault)
 
void Draw() const
Tube segment is drawn as three quad strips.
 
T * Normal2Plane(const T v1[3], const T v2[3], const T v3[3], T normal[3])
Calculates a normal vector of a plane.
 
constexpr Double_t DegToRad()
Conversion from degree to radian: .
 
Double_t Sqrt(Double_t x)
Returns the square root of x.
 
Double_t Cos(Double_t)
Returns the cosine of an angle of x radians.
 
Double_t Sin(Double_t)
Returns the sine of an angle of x radians.
 
constexpr Double_t TwoPi()