13#include "TGLIncludes.h"
27 void DirectDraw(TGLRnrCtx & rnrCtx)
const override
30 glNormal3d (0.0, 0.0, 1.0);
31 glVertex3dv(fBoundingBox[4].CArr());
32 glVertex3dv(fBoundingBox[7].CArr());
33 glVertex3dv(fBoundingBox[6].CArr());
34 glVertex3dv(fBoundingBox[5].CArr());
39 TGLClipPlaneLogical() : TGLLogicalShape() { fDLCache =
kFALSE; }
40 ~TGLClipPlaneLogical()
override {}
44 fBoundingBox.SetAligned(TGLVertex3(-ext, -ext, 0),
45 TGLVertex3( ext, ext, 0));
46 UpdateBoundingBoxesOfPhysicals();
55 void DirectDraw(TGLRnrCtx & rnrCtx)
const override
57 glEnable(GL_NORMALIZE);
59 glDisable(GL_NORMALIZE);
63 TGLClipBoxLogical() : TGLLogicalShape() { fDLCache =
kFALSE; }
64 ~TGLClipBoxLogical()
override {}
66 void Resize(
const TGLVertex3 & lowVertex,
const TGLVertex3 & highVertex)
68 fBoundingBox.SetAligned(lowVertex, highVertex);
69 UpdateBoundingBoxesOfPhysicals();
111 Warning(
"TGLClip::Setup",
"Called on base-class -- should be re-implemented in derived class.");
121 glDepthMask(GL_FALSE);
123 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
124 glDisable(GL_CULL_FACE);
125 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
129 glPolygonMode(GL_FRONT, GL_FILL);
130 glEnable(GL_CULL_FACE);
132 glDepthMask(GL_TRUE);
164 TGLPlane plane(0.0, -1.0, 0.0, 0.0);
181 Double_t extents = bbox.Extents().Mag();
182 TGLClipPlaneLogical* cpl = (TGLClipPlaneLogical*)
GetLogical();
183 cpl->Resize(extents);
211 TGLClipPlaneLogical* cpl = (TGLClipPlaneLogical*)
GetLogical();
212 cpl->Resize(extents);
220 Warning(
"TGLClipPlane::Setup",
"Normal with zero length passed.");
278 TGLVector3 halfLengths = bbox.Extents() * 0.2501;
279 TGLVertex3 center = bbox.Center() + halfLengths;
281 TGLClipBoxLogical* cbl = (TGLClipBoxLogical*)
GetLogical();
282 cbl->Resize(center - halfLengths, center + halfLengths);
301 TGLClipBoxLogical* cbl = (TGLClipBoxLogical*)
GetLogical();
302 cbl->Resize(min_point, max_point);
316 while (i !=
set.end()) {
360 return fManip->MouseEnter(selRec);
368 return fManip->MouseStillInside(selRec);
378 return fManip->Handle(rnrCtx, selRec, event);
387 return fManip->MouseLeave();
486 data[0] = planes[0].A();
487 data[1] = planes[0].B();
488 data[2] = planes[0].C();
489 data[3] = planes[0].D();
498 data[0] =
box.Center().X();
499 data[1] =
box.Center().Y();
500 data[2] =
box.Center().Z();
501 data[3] =
box.Extents().X();
502 data[4] =
box.Extents().Y();
503 data[5] =
box.Extents().Z();
507 Error(
"TGLClipSet::GetClipState",
"invalid clip type '%d'.", type);
527 TGLPlane newPlane(-data[0], -data[1], -data[2], -data[3]);
536 data[1] - currentBox.
Center().
Y(),
537 data[2] - currentBox.
Center().
Z());
543 data[4] / currentBox.
Extents().
Y() * currentScale.
Y(),
544 data[5] / currentBox.
Extents().
Z() * currentScale.
Z());
566 Error(
"TGLClipSet::GetClipType" ,
"Unknown clip type");
592 Error(
"TGLClipSet::SetClipType" ,
"Unknown clip type");
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
void Warning(const char *location, const char *msgfmt,...)
Use this function in warning situations.
std::vector< TGLPlane > TGLPlaneSet_t
std::vector< TGLPlane >::iterator TGLPlaneSet_i
Concrete class describing an orientated (free) or axis aligned box of 8 vertices.
TGLPlane GetNearPlane() const
Return the near-plane.
TGLVector3 Extents() const
TGLVertex3 Center() const
void PlaneSet(TGLPlaneSet_t &planeSet) const
Fill out supplied plane set vector with TGLPlane objects representing six faces of box.
Concrete clip box object.
~TGLClipBox() override
Destroy clip box object.
void Setup(const TGLBoundingBox &bbox) override
Setup the clip object for scene encompassed by bbox.
void PlaneSet(TGLPlaneSet_t &set) const override
Return set of 6 planes describing faces of the box but invert them so that they point inside of box.
TGLClipBox()
Construct an (initially) axis aligned clip pbox object, extents 'halfLengths', centered on 'center' v...
static const float fgColor[4]
! Fixed color of clip box
Concrete clip plane object.
static const float fgColor[4]
! Fixed color of clip plane
void Set(const TGLPlane &plane)
Update clip plane object to follow passed 'plane' equation.
void PlaneSet(TGLPlaneSet_t &set) const override
Return set of planes (actually a single one) describing this clip plane.
~TGLClipPlane() override
Destroy clip plane object.
void Setup(const TGLBoundingBox &bbox) override
Setup the clip object for scene encompassed by bbox.
TGLClipPlane()
Construct a clip plane object, based on supplied 'plane', with initial manipulation pivot at 'center'...
~TGLClipSet() override
Destructor.
void InvalidateClips()
Invalidate clip objects.
TGLClip * fCurrentClip
! the current clipping shape
void GetClipState(TGLClip::EType type, Double_t data[6]) const
Get state of clip object 'type' into data vector:
void SetClipState(TGLClip::EType type, const Double_t data[6])
Set state of clip object 'type' into data vector:
void FillPlaneSet(TGLPlaneSet_t &set) const
Forward request to fill the plane-set to the current clip.
void SetupCurrentClip(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
void SetClipType(TGLClip::EType type)
Set current clip active in viewer - 'type' is one of kClipNone kClipPlane or kClipBox.
Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event) override
Handle overlay event.
void MouseLeave() override
Mouse has left the element.
Bool_t MouseStillInside(TGLOvlSelectRecord &selRec) override
TGLClipPlane * fClipPlane
Bool_t MouseEnter(TGLOvlSelectRecord &selRec) override
Mouse has entered this element.
void SetupCurrentClipIfInvalid(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
TGLClip::EType GetClipType() const
Get current type active in viewer - returns one of kClipNone kClipPlane or kClipBox.
void SetupClips(const TGLBoundingBox &sceneBBox)
Setup clipping objects for given scene bounding box.
void Render(TGLRnrCtx &rnrCtx) override
Render clip-shape and manipulator.
void InvalidateCurrentClip()
Invalidate current clip object.
~TGLClip() override
Destroy clip object.
virtual void Setup(const TGLBoundingBox &bbox)=0
TGLClip(const TGLLogicalShape &logical, const TGLMatrix &transform, const float color[4])
Construct a stand-alone physical clipping object.
void Draw(TGLRnrCtx &rnrCtx) const override
Draw out clipping object with blending and back + front filling.
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
void StrongRef(Bool_t strong) const
Combine all available manipulators in a collection.
16 component (4x4) transform matrix - column MAJOR as per GL.
TGLOverlayElement(const TGLOverlayElement &)=delete
Selection record for overlay objects.
void SetTransform(const TGLMatrix &transform)
const TGLBoundingBox & BoundingBox() const
void SetManip(EManip manip)
const TGLLogicalShape * GetLogical() const
TGLPhysicalShape(const TGLPhysicalShape &)=delete
friend class TGLLogicalShape
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw physical shape, using LOD flags, potential from display list cache.
3D plane class - of format Ax + By + Cz + D = 0
TGLVertex3 NearestOn(const TGLVertex3 &point) const
Return nearest point on plane.
The TGLRnrCtx class aggregates data for a given redering context as needed by various parts of the RO...
void SetShapeLOD(Short_t LOD)
Bool_t IsDrawPassFilled() const
Returns true if current render-pass uses filled polygon style.
void SetDrawPass(Short_t dpass)
3 component (x/y/z) vector class.
3 component (x/y/z) vertex class.
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)