13#include "TGLIncludes.h"
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());
40 virtual ~TGLClipPlaneLogical() {}
44 fBoundingBox.SetAligned(
TGLVertex3(-ext, -ext, 0),
57 glEnable(GL_NORMALIZE);
59 glDisable(GL_NORMALIZE);
64 virtual ~TGLClipBoxLogical() {}
68 fBoundingBox.SetAligned(lowVertex, highVertex);
112 Warning(
"TGLClip::Setup",
"Called on base-class -- should be re-implemented in derived class.");
124 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
125 glDisable(GL_CULL_FACE);
126 glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
130 glPolygonMode(GL_FRONT, GL_FILL);
131 glEnable(GL_CULL_FACE);
166 TGLPlane plane(0.0, -1.0, 0.0, 0.0);
184 TGLClipPlaneLogical* cpl = (TGLClipPlaneLogical*)
GetLogical();
185 cpl->Resize(extents);
213 TGLClipPlaneLogical* cpl = (TGLClipPlaneLogical*)
GetLogical();
214 cpl->Resize(extents);
222 Warning(
"TGLClipPlane::Setup",
"Normal with zero length passed.");
284 TGLClipBoxLogical* cbl = (TGLClipBoxLogical*)
GetLogical();
285 cbl->Resize(center - halfLengths, center + halfLengths);
304 TGLClipBoxLogical* cbl = (TGLClipBoxLogical*)
GetLogical();
305 cbl->Resize(min_point, max_point);
319 while (i != set.end()) {
490 data[0] = planes[0].A();
491 data[1] = planes[0].B();
492 data[2] = planes[0].C();
493 data[3] = planes[0].D();
502 data[0] =
box.Center().
X();
503 data[1] =
box.Center().Y();
504 data[2] =
box.Center().Z();
505 data[3] =
box.Extents().X();
506 data[4] =
box.Extents().Y();
507 data[5] =
box.Extents().Z();
511 Error(
"TGLClipSet::GetClipState",
"invalid clip type '%d'.",
type);
531 TGLPlane newPlane(-data[0], -data[1], -data[2], -data[3]);
540 data[1] - currentBox.
Center().
Y(),
541 data[2] - currentBox.
Center().
Z());
547 data[4] / currentBox.
Extents().
Y() * currentScale.
Y(),
548 data[5] / currentBox.
Extents().
Z() * currentScale.
Z());
570 Error(
"TGLClipSet::GetClipType" ,
"Unknown clip type");
596 Error(
"TGLClipSet::SetClipType" ,
"Unknown clip type");
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
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.
virtual void PlaneSet(TGLPlaneSet_t &set) const
Return set of 6 planes describing faces of the box but invert them so that they point inside of box.
virtual void Setup(const TGLBoundingBox &bbox)
Setup the clip object for scene encompassed by bbox.
TGLClipBox()
Fixed color of clip box.
static const float fgColor[4]
virtual ~TGLClipBox()
Destroy clip box object.
Concrete clip plane object.
virtual void PlaneSet(TGLPlaneSet_t &set) const
Return set of planes (actually a single one) describing this clip plane.
static const float fgColor[4]
virtual void Setup(const TGLBoundingBox &bbox)
Setup the clip object for scene encompassed by bbox.
void Set(const TGLPlane &plane)
Update clip plane object to follow passed 'plane' equation.
TGLClipPlane()
Fixed color of clip plane.
virtual ~TGLClipPlane()
Destroy clip plane object.
A collection of concrete TGLClip objects to be selected from.
void InvalidateClips()
Invalidate clip objects.
virtual ~TGLClipSet()
Destructor.
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.
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
void SetupCurrentClip(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
virtual void MouseLeave()
Mouse has left the element.
void SetClipType(TGLClip::EType type)
Set current clip active in viewer - 'type' is one of kClipNone kClipPlane or kClipBox.
virtual Bool_t MouseStillInside(TGLOvlSelectRecord &selRec)
TGLClipPlane * fClipPlane
void SetupCurrentClipIfInvalid(const TGLBoundingBox &sceneBBox)
Setup current clipping object for given scene bounding box.
virtual void Render(TGLRnrCtx &rnrCtx)
Render clip-shape and manipulator.
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.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered this element.
void InvalidateCurrentClip()
Invalidate current clip object.
Abstract clipping shape - derives from TGLPhysicalShape Adds clip mode (inside/outside) and pure virt...
virtual void Setup(const TGLBoundingBox &bbox)=0
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw out clipping object with blending and back + front filling.
TGLClip(const TGLLogicalShape &logical, const TGLMatrix &transform, const float color[4])
Construct a stand-alone physical clipping object.
virtual ~TGLClip()
Destroy clip object.
virtual void PlaneSet(TGLPlaneSet_t &set) const =0
Abstract logical shape - a GL 'drawable' - base for all shapes - faceset sphere etc.
virtual void DirectDraw(TGLRnrCtx &rnrCtx) const =0
void UpdateBoundingBoxesOfPhysicals()
Update bounding-boxed of all dependent physicals.
void StrongRef(Bool_t strong) const
Combine all available manipulators in a collection.
virtual Bool_t Handle(TGLRnrCtx &rnrCtx, TGLOvlSelectRecord &selRec, Event_t *event)
Handle overlay event.
virtual Bool_t MouseEnter(TGLOvlSelectRecord &selRec)
Mouse has entered this element.
virtual void MouseLeave()
Mouse has left the element.
virtual void SetPShape(TGLPhysicalShape *shape)
Set phys-shape, override of virtual from TGLPShapeRef.
virtual void Render(TGLRnrCtx &rnrCtx)
Render the manipulator and bounding-box.
16 component (4x4) transform matrix - column MAJOR as per GL.
virtual Bool_t MouseStillInside(TGLOvlSelectRecord &selRec)
Selection record for overlay objects.
Concrete physical shape - a GL drawable.
void Scale(const TGLVector3 &scale)
void SetTransform(const TGLMatrix &transform)
const TGLBoundingBox & BoundingBox() const
void SetManip(EManip manip)
TGLVector3 GetScale() const
const TGLLogicalShape * GetLogical() const
virtual void Draw(TGLRnrCtx &rnrCtx) const
Draw physical shape, using LOD flags, potential from display list cache.
void Translate(const TGLVector3 &vect)
3D plane class - of format Ax + By + Cz + D = 0
void Negate()
Negate the plane.
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)