43class Box :
public Shape {
59 : Shape(color,
x,
y, z), fDX(dX), fDY(dY), fDZ(dZ)
69 buffer.ClearSectionsValid();
71 buffer.fColor = fColor;
72 buffer.fTransparency = 0;
73 buffer.fLocalFrame =
kFALSE;
74 buffer.SetLocalMasterIdentity();
75 buffer.fReflection =
kFALSE;
81 Double_t halfLength[3] = {fDX, fDY, fDZ};
82 buffer.SetAABoundingBox(origin, halfLength);
89 buffer.SetRawSizes(8, 3 * 8, 12, 3 * 12, 6, 6 * 6);
96 buffer.fPnts[0] = fX - fDX;
97 buffer.fPnts[1] = fY - fDY;
98 buffer.fPnts[2] = fZ - fDZ;
99 buffer.fPnts[3] = fX + fDX;
100 buffer.fPnts[4] = fY - fDY;
101 buffer.fPnts[5] = fZ - fDZ;
102 buffer.fPnts[6] = fX + fDX;
103 buffer.fPnts[7] = fY + fDY;
104 buffer.fPnts[8] = fZ - fDZ;
105 buffer.fPnts[9] = fX - fDX;
106 buffer.fPnts[10] = fY + fDY;
107 buffer.fPnts[11] = fZ - fDZ;
108 buffer.fPnts[12] = fX - fDX;
109 buffer.fPnts[13] = fY - fDY;
110 buffer.fPnts[14] = fZ + fDZ;
111 buffer.fPnts[15] = fX + fDX;
112 buffer.fPnts[16] = fY - fDY;
113 buffer.fPnts[17] = fZ + fDZ;
114 buffer.fPnts[18] = fX + fDX;
115 buffer.fPnts[19] = fY + fDY;
116 buffer.fPnts[20] = fZ + fDZ;
117 buffer.fPnts[21] = fX - fDX;
118 buffer.fPnts[22] = fY + fDY;
119 buffer.fPnts[23] = fZ + fDZ;
124 buffer.fSegs[0] = fColor;
127 buffer.fSegs[3] = fColor;
130 buffer.fSegs[6] = fColor;
133 buffer.fSegs[9] = fColor;
134 buffer.fSegs[10] = 3;
135 buffer.fSegs[11] = 0;
136 buffer.fSegs[12] = fColor;
137 buffer.fSegs[13] = 4;
138 buffer.fSegs[14] = 5;
139 buffer.fSegs[15] = fColor;
140 buffer.fSegs[16] = 5;
141 buffer.fSegs[17] = 6;
142 buffer.fSegs[18] = fColor;
143 buffer.fSegs[19] = 6;
144 buffer.fSegs[20] = 7;
145 buffer.fSegs[21] = fColor;
146 buffer.fSegs[22] = 7;
147 buffer.fSegs[23] = 4;
148 buffer.fSegs[24] = fColor;
149 buffer.fSegs[25] = 0;
150 buffer.fSegs[26] = 4;
151 buffer.fSegs[27] = fColor;
152 buffer.fSegs[28] = 1;
153 buffer.fSegs[29] = 5;
154 buffer.fSegs[30] = fColor;
155 buffer.fSegs[31] = 2;
156 buffer.fSegs[32] = 6;
157 buffer.fSegs[33] = fColor;
158 buffer.fSegs[34] = 3;
159 buffer.fSegs[35] = 7;
166 buffer.fPols[0] = fColor;
172 buffer.fPols[6] = fColor;
176 buffer.fPols[10] = 10;
177 buffer.fPols[11] = 1;
178 buffer.fPols[12] = fColor;
179 buffer.fPols[13] = 4;
180 buffer.fPols[14] = 10;
181 buffer.fPols[15] = 6;
182 buffer.fPols[16] = 11;
183 buffer.fPols[17] = 2;
184 buffer.fPols[18] = fColor;
185 buffer.fPols[19] = 4;
186 buffer.fPols[20] = 11;
187 buffer.fPols[21] = 7;
188 buffer.fPols[22] = 8;
189 buffer.fPols[23] = 3;
190 buffer.fPols[24] = fColor;
191 buffer.fPols[25] = 4;
192 buffer.fPols[26] = 1;
193 buffer.fPols[27] = 2;
194 buffer.fPols[28] = 3;
195 buffer.fPols[29] = 0;
196 buffer.fPols[30] = fColor;
197 buffer.fPols[31] = 4;
198 buffer.fPols[32] = 7;
199 buffer.fPols[33] = 6;
200 buffer.fPols[34] = 5;
201 buffer.fPols[35] = 4;
209class SBPyramid :
public Shape {
212 ~SBPyramid()
override{};
226 : Shape(color,
x,
y, z), fDX(dX), fDY(dY), fDZ(dZ)
236 buffer.ClearSectionsValid();
238 buffer.fColor = fColor;
239 buffer.fTransparency = 0;
240 buffer.fLocalFrame =
kFALSE;
241 buffer.SetLocalMasterIdentity();
242 buffer.fReflection =
kFALSE;
247 Double_t halfLength[3] = {fDX, fDY, fDZ / 2.0};
248 Double_t origin[3] = {fX, fY, fZ + halfLength[2]};
249 buffer.SetAABoundingBox(origin, halfLength);
256 buffer.SetRawSizes(5, 3 * 5, 8, 3 * 8, 5, 6 + 4 * 5);
263 buffer.fPnts[0] = fX - fDX;
264 buffer.fPnts[1] = fY - fDY;
265 buffer.fPnts[2] = fZ;
266 buffer.fPnts[3] = fX + fDX;
267 buffer.fPnts[4] = fY - fDY;
268 buffer.fPnts[5] = fZ;
269 buffer.fPnts[6] = fX + fDX;
270 buffer.fPnts[7] = fY + fDY;
271 buffer.fPnts[8] = fZ;
272 buffer.fPnts[9] = fX - fDX;
273 buffer.fPnts[10] = fY + fDY;
274 buffer.fPnts[11] = fZ;
275 buffer.fPnts[12] = fX;
276 buffer.fPnts[13] = fY;
277 buffer.fPnts[14] = fZ + fDZ;
283 buffer.fSegs[0] = fColor;
286 buffer.fSegs[3] = fColor;
289 buffer.fSegs[6] = fColor;
292 buffer.fSegs[9] = fColor;
293 buffer.fSegs[10] = 3;
294 buffer.fSegs[11] = 0;
295 buffer.fSegs[12] = fColor;
296 buffer.fSegs[13] = 0;
297 buffer.fSegs[14] = 4;
298 buffer.fSegs[15] = fColor;
299 buffer.fSegs[16] = 1;
300 buffer.fSegs[17] = 4;
301 buffer.fSegs[18] = fColor;
302 buffer.fSegs[19] = 2;
303 buffer.fSegs[20] = 4;
304 buffer.fSegs[21] = fColor;
305 buffer.fSegs[22] = 3;
306 buffer.fSegs[23] = 4;
313 buffer.fPols[0] = fColor;
320 buffer.fPols[6] = fColor;
324 buffer.fPols[10] = 5;
325 buffer.fPols[11] = fColor;
326 buffer.fPols[12] = 3;
327 buffer.fPols[13] = 1;
328 buffer.fPols[14] = 5;
329 buffer.fPols[15] = 6;
330 buffer.fPols[16] = fColor;
331 buffer.fPols[17] = 3;
332 buffer.fPols[18] = 2;
333 buffer.fPols[19] = 6;
334 buffer.fPols[20] = 7;
335 buffer.fPols[21] = fColor;
336 buffer.fPols[22] = 3;
337 buffer.fPols[23] = 3;
338 buffer.fPols[24] = 7;
339 buffer.fPols[25] = 4;
356 std::vector<Shape *> fShapes;
368 aShape =
new Box(
kRed, 0.0, 0.0, 0.0, 20.0, 20.0, 20.0);
369 fShapes.push_back(aShape);
370 aShape =
new Box(
kBlue, 50.0, 100.0, 200.0, 5.0, 10.0, 15.0);
371 fShapes.push_back(aShape);
372 aShape =
new SBPyramid(
kGreen, 20.0, 25.0, 45.0, 30.0, 30.0, 90.0);
373 fShapes.push_back(aShape);
402 std::vector<Shape *>::const_iterator ShapeIt = fShapes.begin();
404 while (ShapeIt != fShapes.end()) {
408 TBuffer3D &buffer = shape->GetBuffer3D(reqSections);
412 shape->GetBuffer3D(reqSections);
423 printf(
"\n\nviewer3DMaster: This frame demonstates master frame use of 3D viewer architecture.\n");
424 printf(
"Creates two boxes and a square based pyramid, described in master frame.\n\n");
426 MyGeom *myGeom =
new MyGeom;
#define ClassDefOverride(name, id)
Use this attribute class when an object should have 3D capabilities.
Generic 3D primitive description class.
Mother of all ROOT objects.
virtual void Draw(Option_t *option="")
Default Draw method for all objects.
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
Abstract 3D shapes viewer.
virtual Int_t AddObject(const TBuffer3D &buffer, Bool_t *addChildren=nullptr)=0