34 ClassImp(TGLPolyMarker);
39 TGLPolyMarker::TGLPolyMarker(
const TBuffer3D & buffer) :
40 TGLLogicalShape(buffer),
41 fVertices(buffer.fPnts, buffer.fPnts + 3 * buffer.NbPnts()),
45 if (TAttMarker *realObj = dynamic_cast<TAttMarker *>(buffer.fID)) {
46 fStyle = realObj->GetMarkerStyle();
47 fSize = realObj->GetMarkerSize() / 2.;
55 void TGLPolyMarker::DirectDraw(TGLRnrCtx & rnrCtx)
const
58 Info(
"TGLPolyMarker::DirectDraw",
"this %ld (class %s) LOD %d", (Long_t)
this, IsA()->GetName(), rnrCtx.ShapeLOD());
61 if (rnrCtx.DrawPass() == TGLRnrCtx::kPassOutlineLine)
64 const Double_t *vertices = &fVertices[0];
65 UInt_t size = fVertices.size();
66 Int_t stacks = 6, slices = 6;
67 Float_t pixelSize = 1;
68 Double_t topRadius = fSize;
72 stacks = 2, slices = 4;
74 case 4:
case 8:
case 20:
case 24:
75 for (UInt_t i = 0; i < size; i += 3) {
77 glTranslated(vertices[i], vertices[i + 1], vertices[i + 2]);
78 gluSphere(rnrCtx.GetGluQuadric(), fSize, slices, stacks);
86 for (UInt_t i = 0; i < size; i += 3) {
88 glTranslated(vertices[i], vertices[i + 1], vertices[i + 2]);
89 gluCylinder(rnrCtx.GetGluQuadric(), fSize, topRadius, fSize, 4, 1);
94 for (UInt_t i = 0; i < size; i += 3) {
96 glTranslated(vertices[i], vertices[i + 1], vertices[i + 2]);
97 glRotated(180, 1., 0., 0.);
98 gluCylinder(rnrCtx.GetGluQuadric(), fSize, 0., fSize, 4, 1);
102 case 3:
case 2:
case 5:
111 case 1:
case 9:
case 10:
case 11:
default:
112 TGLUtil::PointSize(pixelSize);
114 for (UInt_t i = 0; i < size; i += 3)
115 glVertex3dv(vertices + i);
125 void TGLPolyMarker::DrawStars()
const
127 glDisable(GL_LIGHTING);
128 const Double_t diag = TMath::Sqrt(2 * fSize * fSize) / 2;
130 for (UInt_t i = 0; i < fVertices.size(); i += 3) {
131 Double_t x = fVertices[i];
132 Double_t y = fVertices[i + 1];
133 Double_t z = fVertices[i + 2];
135 if (fStyle == 2 || fStyle == 3) {
136 glVertex3d(x - fSize, y, z);
137 glVertex3d(x + fSize, y, z);
138 glVertex3d(x, y, z - fSize);
139 glVertex3d(x, y, z + fSize);
140 glVertex3d(x, y - fSize, z);
141 glVertex3d(x, y + fSize, z);
144 glVertex3d(x - diag, y - diag, z - diag);
145 glVertex3d(x + diag, y + diag, z + diag);
146 glVertex3d(x - diag, y - diag, z + diag);
147 glVertex3d(x + diag, y + diag, z - diag);
148 glVertex3d(x - diag, y + diag, z - diag);
149 glVertex3d(x + diag, y - diag, z + diag);
150 glVertex3d(x - diag, y + diag, z + diag);
151 glVertex3d(x + diag, y - diag, z - diag);
155 glEnable(GL_LIGHTING);