12 #include <boost/bind.hpp>
17 #include "TGLScenePad.h"
18 #include "TGLViewer.h"
20 #include "TGLPerspectiveCamera.h"
21 #include "TEveManager.h"
22 #include "TEveElement.h"
24 #include "TEveBoxSet.h"
25 #include "TEveScene.h"
26 #include "TGLLogicalShape.h"
39 class TGLClipsiLogical :
public TGLLogicalShape
42 virtual void DirectDraw(TGLRnrCtx & rnrCtx)
const override{}
45 TGLClipsiLogical() : TGLLogicalShape() {}
46 virtual ~TGLClipsiLogical() {}
47 void Resize(Double_t ext){}
50 const float fgColor[4] = { 1.0, 0.6, 0.2, 0.5 };
52 class Clipsi :
public TGLClip
56 Clipsi(
const Clipsi&);
57 Clipsi& operator=(
const Clipsi&);
60 Clipsi(TGLRnrCtx* ctx):TGLClip(* new TGLClipsiLogical, TGLMatrix(), fgColor), m_rnrCtx(ctx){}
63 virtual void Setup(
const TGLBoundingBox & bbox)
override {}
65 using TGLClip::PlaneSet;
66 virtual void PlaneSet(TGLPlaneSet_t & planeSet)
const override
68 TGLCamera& cam = m_rnrCtx->RefCamera();
72 f[0] = Intersection(cam.FrustumPlane(TGLCamera::kFar),
73 cam.FrustumPlane(TGLCamera::kBottom),
74 cam.FrustumPlane(TGLCamera::kLeft)).
second;
76 f[1] = Intersection(cam.FrustumPlane(TGLCamera::kFar),
77 cam.FrustumPlane(TGLCamera::kBottom),
78 cam.FrustumPlane(TGLCamera::kRight)).
second;
80 f[2] = Intersection(cam.FrustumPlane(TGLCamera::kFar),
81 cam.FrustumPlane(TGLCamera::kTop),
82 cam.FrustumPlane(TGLCamera::kRight)).
second;
84 f[3] = Intersection(cam.FrustumPlane(TGLCamera::kFar),
85 cam.FrustumPlane(TGLCamera::kTop),
86 cam.FrustumPlane(TGLCamera::kLeft)).
second;
88 TGLVector3
dd = cam.FrustumPlane(TGLCamera::kNear).Norm();
89 dd *= (cam.GetFarClip() -cam.GetNearClip() );
97 planeSet.push_back(TGLPlane(c, f[0], f[1]));
98 planeSet.push_back(TGLPlane(c, f[1], f[2]));
99 planeSet.push_back(TGLPlane(c, f[2], f[3]));
100 planeSet.push_back(TGLPlane(c, f[3], f[0]));
117 m_showMuonBarrel(this,
"Show Muon Barrel", 0
l, 0
l, 2
l ),
118 m_showMuonEndcap(this,
"Show Muon Endcap",
false ),
119 m_showPixelBarrel(this,
"Show Pixel Barrel",
false ),
120 m_showPixelEndcap(this,
"Show Pixel Endcap",
false),
121 m_showTrackerBarrel(this,
"Show Tracker Barrel",
false ),
122 m_showTrackerEndcap(this,
"Show Tracker Endcap",
false),
125 m_rnrStyle(this,
"Render Style", 0
l, 0
l, 2
l),
126 m_clipParam(this,
"View dependent Clip",
false),
127 m_selectable(this,
"Enable Tooltips",
false),
128 m_cameraType(this,
"Camera Type", 0
l, 0
l, 5
l),
132 viewerGL()->SetCurrentCamera(TGLViewer::kCameraPerspXOZ);
186 TGLClipPlane* c=
new TGLClipPlane();
187 c->Setup(TGLVector3(1e10,0,0), TGLVector3(-1,0,0));
212 viewerGL()->RefCamera(TGLViewer::ECameraType(x)).IncTimeStamp();
213 viewerGL()->SetCurrentCamera(TGLViewer::ECameraType(x));
222 geoScene()->GetGLScene()->SetStyle(x);
230 geoScene()->GetGLScene()->SetSelectable(x);
240 for (TEveElement::List_i it =gEve->GetScenes()->BeginChildren(); it != gEve->GetScenes()->EndChildren(); ++it )
242 if (strncmp((*it)->GetElementName(),
"TopGeoNodeScene", 15) == 0)
243 ((TEveScene*)(*it))->GetGLScene()->SetClip(x ? m_glClip : 0);
254 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
266 TGLPerspectiveCamera* camera =
dynamic_cast<TGLPerspectiveCamera*
>(&(
viewerGL()->CurrentCamera()));
289 printf(
"ERROR!!!! FW3DViewBase::setCurrentDMTVertex \n");
320 Form(
"TEveGedEditor::SpawnNewEditor((TGLViewer*)0x%lx)", (
unsigned long)
viewerGL())));
334 m_ecalBarrel->Reset(TEveBoxSet::kBT_FreeBox,
true, ids.size() );
335 for (std::vector<unsigned int>::iterator it = ids.begin(); it != ids.end(); ++it) {
349 TEveElement* calo =
eventScene()->FindChild(
"calo barrel");
351 TEveCalo3D* c3d =
dynamic_cast<TEveCalo3D*
>(calo);
352 c3d->SetRnrFrame(!x, !x);
353 c3d->ElementChanged();
virtual bool requestGLHandlerPick() const
void showEcalBarrel(bool)
void showMuonBarrel(long)
virtual void setFrom(const FWConfiguration &)
FWBoolParameter m_showMuonEndcap
void showMuonBarrel(bool)
virtual void populateController(ViewerParameterGUI &) const
const FWGeometry * getGeom() const
FWBoolParameter m_clipParam
FWColorManager * colorManager() const
ViewerParameterGUI & requestTab(const char *)
void showTrackerEndcap(bool)
virtual void setFrom(const FWConfiguration &)
ViewerParameterGUI & separator()
unsigned int version() const
void setCurrentDMTVertex(double x, double y, double z)
FWBoolParameter m_showTrackerBarrel
TGLViewer * viewerGL() const
sigc::signal< void, T > changed_
FW3DViewDistanceMeasureTool * m_DMT
void showMuonBarrelFull(bool)
void showTrackerBarrel(bool)
void setGeomTransparency(Color_t idx, bool projectedType)
U second(std::pair< T, U > const &p)
virtual void addTo(FWConfiguration &) const
virtual void populateController(ViewerParameterGUI &) const
void showMuonEndcap(bool)
FWEnumParameter m_rnrStyle
FWBoolParameter m_showPixelEndcap
bool addEntry(Long_t id, const std::string &txt)
virtual void setContext(const fireworks::Context &)
const std::string & value(unsigned int iIndex=0) const
const fireworks::Context & context()
const float * getCorners(unsigned int id) const
void setFromPerspectiveCamera(TGLPerspectiveCamera *, const std::string &, const FWConfiguration &)
void showPixelBarrel(bool)
FWBoolParameter m_showEcalBarrel
ViewerParameterGUI & addParam(const FWParameterBase *)
TGCompositeFrame * getTabContainer()
void showPixelEndcap(bool)
std::vector< unsigned int > getMatchedIds(Detector det, SubDetector subdet) const
TEveBoxSet * m_ecalBarrel
FWEnumParameter m_showMuonBarrel
FW3DViewBase(TEveWindowSlot *, FWViewType::EType, unsigned int version=8)
FW3DViewGeometry * m_geometry
const FWConfiguration * valueForKey(const std::string &iKey) const
volatile std::atomic< bool > shutdown_flag false
FWBoolParameter m_selectable
FWEnumParameter m_cameraType
virtual void addTo(FWConfiguration &) const
virtual void setContext(const fireworks::Context &x)
FWBoolParameter m_showTrackerEndcap
FWBoolParameter m_showPixelBarrel
FWViewType::EType typeId() const
void addToPerspectiveCamera(TGLPerspectiveCamera *, const std::string &, FWConfiguration &) const