00001 const Int_t Ns = 7; 00002 00003 void add_blobs(TEveElement* p, Float_t rad, Float_t height, Float_t size, 00004 Int_t level) 00005 { 00006 if (level <= 0) return; 00007 00008 for (Int_t i = 0; i < Ns; ++i) 00009 { 00010 TEveGeoShape* x = new TEveGeoShape("SS"); 00011 x->SetShape(new TGeoSphere(0, size)); 00012 Double_t phi = TMath::TwoPi() * i / Ns; 00013 x->RefMainTrans().SetPos(rad*TMath::Cos(phi), 00014 rad*TMath::Sin(phi), 00015 height); 00016 x->SetMainColor(TColor::GetColorPalette 00017 (gRandom->Integer(TColor::GetNumberOfColors()))); 00018 p->AddElement(x); 00019 00020 add_blobs(x, 0.8 * rad, 0.8 * height, 0.8 * size, level - 1); 00021 } 00022 } 00023 00024 void hierarchical_scene() 00025 { 00026 TEveManager::Create(); 00027 00028 TColor::SetPalette(1, 0); 00029 gRandom = new TRandom3(0); 00030 00031 TEveScene *s = gEve->SpawnNewScene("Hierachical Scene", "OoogaDooga"); 00032 s->SetHierarchical(kTRUE); 00033 00034 gEve->GetDefaultViewer()->AddScene(s); 00035 00036 add_blobs(s, 6, 4, 0.5, 4); 00037 00038 gEve->Redraw3D(kTRUE); 00039 }