#ifndef ROOT_TGLCamera
#define ROOT_TGLCamera
#ifndef ROOT_TGLUtil
#include "TGLUtil.h"
#endif
#ifndef ROOT_TGLBoundingBox
#include "TGLBoundingBox.h"
#endif
#ifndef ROOT_TPoint
#include "TPoint.h"
#endif
#include <assert.h>
#include <math.h>
class TGLCamera
{
public:
enum EFrustumPlane
{
kNear = 0,
kLeft = 1,
kRight = 2,
kTop = 3,
kBottom = 4,
kFar = 5,
kPlanesPerFrustum = 6
};
private:
TGLBoundingBox fPreviousInterestBox;
TGLBoundingBox fInterestFrustum;
TGLBoundingBox fInterestFrustumAsBox;
static const Double_t fgInterestBoxExpansion;
TGLBoundingBox Frustum(Bool_t asBox = kTRUE) const;
TGLCamera(const TGLCamera &);
TGLCamera & operator=(const TGLCamera &);
protected:
mutable Bool_t fCacheDirty;
mutable TGLMatrix fProjM;
mutable TGLMatrix fModVM;
mutable TGLMatrix fClipM;
mutable TGLPlane fFrustumPlanes[kPlanesPerFrustum];
TGLRect fViewport;
TGLBoundingBox fInterestBox;
mutable Double_t fLargestSeen;
Bool_t AdjustAndClampVal(Double_t & val, Double_t min, Double_t max,
Int_t screenShift, Int_t screenShiftRange,
Bool_t mod1, Bool_t mod2) const;
void UpdateCache() const;
public:
TGLCamera();
virtual ~TGLCamera();
void SetViewport(const TGLRect & viewport);
virtual void Setup(const TGLBoundingBox & box, Bool_t reset=kTRUE) = 0;
virtual void Reset() = 0;
virtual Bool_t Dolly(Int_t delta, Bool_t mod1, Bool_t mod2) = 0;
virtual Bool_t Zoom (Int_t delta, Bool_t mod1, Bool_t mod2) = 0;
virtual Bool_t Truck(Int_t x, Int_t y, Int_t xDelta, Int_t yDelta) = 0;
virtual Bool_t Rotate(Int_t xDelta, Int_t yDelta) = 0;
virtual void Apply(const TGLBoundingBox & sceneBox, const TGLRect * pickRect = 0) const = 0;
TGLVertex3 EyePoint() const;
TGLVector3 EyeDirection() const;
TGLVertex3 FrustumCenter() const;
const TGLPlane & FrustumPlane(EFrustumPlane plane) const;
EOverlap FrustumOverlap (const TGLBoundingBox & box) const;
EOverlap ViewportOverlap(const TGLBoundingBox & box) const;
TGLRect ViewportRect (const TGLBoundingBox & box, TGLBoundingBox::EFace face) const;
TGLRect ViewportRect (const TGLBoundingBox & box, const TGLBoundingBox::EFace * face = 0) const;
TGLVertex3 WorldToViewport(const TGLVertex3 & worldVertex) const;
TGLVector3 WorldDeltaToViewport(const TGLVertex3 & worldRef, const TGLVector3 & worldDelta) const;
TGLVertex3 ViewportToWorld(const TGLVertex3 & viewportVertex) const;
TGLLine3 ViewportToWorld(Double_t viewportX, Double_t viewportY) const;
TGLLine3 ViewportToWorld(const TPoint & viewport) const;
TGLVector3 ViewportDeltaToWorld(const TGLVertex3 & worldRef, Double_t viewportXDelta, Double_t viewportYDelta) const;
std::pair<Bool_t, TGLVertex3> ViewportPlaneIntersection(Double_t viewportX, Double_t viewportY, const TGLPlane & worldPlane) const;
std::pair<Bool_t, TGLVertex3> ViewportPlaneIntersection(const TPoint & viewport, const TGLPlane & worldPlane) const;
void WindowToViewport(Int_t & , Int_t & y) const { y = fViewport.Height() - y; }
void WindowToViewport(TPoint & point) const { point.SetY(fViewport.Height() - point.GetY()); }
void WindowToViewport(TGLRect & rect) const { rect.Y() = fViewport.Height() - rect.Y(); }
void WindowToViewport(TGLVertex3 & vertex) const { vertex.Y() = fViewport.Height() - vertex.Y(); }
Bool_t OfInterest(const TGLBoundingBox & box, Bool_t ignoreSize) const;
Bool_t UpdateInterest(Bool_t force);
void ResetInterest();
void DrawDebugAids() const;
ClassDef(TGLCamera,0);
};
inline const TGLPlane & TGLCamera::FrustumPlane(EFrustumPlane plane) const
{
if (fCacheDirty) {
Error("TGLCamera::FrustumBox()", "cache dirty");
}
return fFrustumPlanes[plane];
}
#endif // ROOT_TGLCamera
ROOT page - Class index - Class Hierarchy - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.