From 3aa97c5dc4f8ee0cedea4a10f093aaf325d955ab Mon Sep 17 00:00:00 2001 From: mtadel Date: Tue, 31 Oct 2006 09:13:32 +0000 Subject: [PATCH] Started to work on reimplementation of the quad-set, renamed the old one to OldQuadSet. --- EVE/Reve/LinkDef.h | 3 +- EVE/Reve/QuadSet.cxx | 26 +++-------- EVE/Reve/QuadSet.h | 99 +++++++++++++++++++++++++++++++++++++++--- EVE/Reve/QuadSetGL.cxx | 32 +++++--------- EVE/Reve/QuadSetGL.h | 8 ++-- 5 files changed, 117 insertions(+), 51 deletions(-) diff --git a/EVE/Reve/LinkDef.h b/EVE/Reve/LinkDef.h index 5fc48fc7263..9dad7218bc6 100644 --- a/EVE/Reve/LinkDef.h +++ b/EVE/Reve/LinkDef.h @@ -101,6 +101,7 @@ // QuadSet #pragma link C++ class Reve::Quad+; +#pragma link C++ class Reve::OldQuadSet+; #pragma link C++ class Reve::QuadSet+; // BoxSet @@ -135,6 +136,6 @@ //================================ // ReveGLRenderers -#pragma link C++ class Reve::QuadSetGL+; +#pragma link C++ class Reve::OldQuadSetGL+; #pragma link C++ class Reve::BoxSetGL+; #pragma link C++ class Reve::TriangleSetGL; diff --git a/EVE/Reve/QuadSet.cxx b/EVE/Reve/QuadSet.cxx index 8d1cf0f437e..630c42f6b94 100644 --- a/EVE/Reve/QuadSet.cxx +++ b/EVE/Reve/QuadSet.cxx @@ -47,18 +47,18 @@ Quad::Quad(TRandom& rnd, Float_t origin, Float_t size) : color(0) } /**************************************************************************/ -// QuadSet +// OldQuadSet /**************************************************************************/ -ClassImp(Reve::QuadSet) +ClassImp(Reve::OldQuadSet) -QuadSet::QuadSet(const Text_t* n, const Text_t* t) : +OldQuadSet::OldQuadSet(const Text_t* n, const Text_t* t) : TNamed(n, t), fQuads(), fTrans(false) {} -void QuadSet::Test(Int_t nquads) +void OldQuadSet::Test(Int_t nquads) { TRandom rnd(0); fQuads.resize(nquads); @@ -67,7 +67,7 @@ void QuadSet::Test(Int_t nquads) } } -void QuadSet::Paint(Option_t* ) +void OldQuadSet::Paint(Option_t* ) { TBuffer3D buffer(TBuffer3DTypes::kGeneric); @@ -83,7 +83,7 @@ void QuadSet::Paint(Option_t* ) // We fill kCore on first pass and try with viewer Int_t reqSections = gPad->GetViewer3D()->AddObject(buffer); if (reqSections == TBuffer3D::kNone) { - // printf("QuadSet::Paint viewer was happy with Core buff3d.\n"); + // printf("OldQuadSet::Paint viewer was happy with Core buff3d.\n"); return; } @@ -139,29 +139,17 @@ void QuadSet::Paint(Option_t* ) /**************************************************************************/ -void QuadSet::ComputeBBox() +void OldQuadSet::ComputeBBox() { if(fQuads.empty()) { -#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2) - bbox_zero(); -#else BBoxZero(); -#endif return; } -#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2) - bbox_init(); -#else BBoxInit(); -#endif for(std::vector::iterator q=fQuads.begin(); q!=fQuads.end(); ++q) { Float_t* p = q->vertices; for(int i=0; i<4; ++i, p+=3) -#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2) - bbox_check_point(p); -#else BBoxCheckPoint(p); -#endif } // printf("%s BBox is x(%f,%f), y(%f,%f), z(%f,%f)\n", GetName(), diff --git a/EVE/Reve/QuadSet.h b/EVE/Reve/QuadSet.h index c26ab1b444a..b8e982d98a3 100644 --- a/EVE/Reve/QuadSet.h +++ b/EVE/Reve/QuadSet.h @@ -8,6 +8,10 @@ #include #include +#include +#include +#include "ZTrans.h" + #include class TRandom; @@ -36,11 +40,9 @@ struct Quad ClassDef(Quad, 1); }; -/**************************************************************************/ - -class QuadSet : public TNamed, public TAtt3D, public TAttBBox +class OldQuadSet : public TNamed, public TAtt3D, public TAttBBox { - friend class QuadSetGL; + friend class OldQuadSetGL; protected: std::vector fQuads; @@ -48,17 +50,102 @@ protected: Bool_t fTrans; public: - QuadSet(const Text_t* n="QuadSet", const Text_t* t=""); - virtual ~QuadSet() {} + OldQuadSet(const Text_t* n="QuadSet", const Text_t* t=""); + virtual ~OldQuadSet() {} Bool_t GetTrans() const { return fTrans; } void SetTrans(Bool_t t) { fTrans = t; } + std::vector& Quads() { return fQuads; } + + void Test(Int_t nquads); + + virtual void ComputeBBox(); + + virtual void Paint(Option_t* option = ""); + + ClassDef(OldQuadSet, 1); +}; + +/**************************************************************************/ +// To become new implementation of QuadSet ... not finished yet. +/**************************************************************************/ + +class QuadSet : public RenderElement, + public TNamed, + public TAtt3D, + public TAttBBox +{ + friend class QuadSetGL; + +public: + enum QuadType_e + { QT_FreeQuad, + QT_AxisAligned, + QT_AxisAlignedFixedZ, + QT_AxisAlignedFixedDim, + QT_AxisAlignedFixedDimZ + }; + +protected: + struct QuadBase { + UChar_t fColor[4]; + }; + + struct FreeQuad : public QuadBase { + Float_t fVertices[12]; + }; + + struct AAFixDimZQuad : public QuadBase { + Float_t fX, fY; + }; + + struct AAFixDimQuad : public AAFixDimZQuad { + Float_t fZ; + }; + + struct AAFixZQuad : public AAFixDimZQuad { + Float_t fW, fH; + }; + + struct AAQuad : public AAFixDimQuad { + Float_t fW, fH; + }; + +protected: + QuadType_e fQuadType; + Int_t fSizeOf; + Int_t fReserveStep; + Int_t fLastEntry; + Int_t fNumReserved; + + // Missing: + // * some actual container + // * RGBAPalette + // * user specifies a value instead of a color + + Color_t fDefaultColor; + Float_t fDefWidth; + Float_t fDefHeight; + Float_t fDefZ; + + ZTrans fHMTrans; + +public: + QuadSet(const Text_t* n="QuadSet", const Text_t* t=""); + virtual ~QuadSet() {} + + ZTrans& RefHMTrans() { return fHMTrans; } + void SetTransMatrix(Double_t* carr) { fHMTrans.SetFrom(carr); } + void SetTransMatrix(const TGeoMatrix& mat) { fHMTrans.SetFrom(mat); } + + /* void Test(Int_t nquads); virtual void ComputeBBox(); virtual void Paint(Option_t* option = ""); + */ ClassDef(QuadSet, 1); }; diff --git a/EVE/Reve/QuadSetGL.cxx b/EVE/Reve/QuadSetGL.cxx index cab1d5c4549..ea8cf80f291 100644 --- a/EVE/Reve/QuadSetGL.cxx +++ b/EVE/Reve/QuadSetGL.cxx @@ -11,50 +11,40 @@ using namespace Reve; //______________________________________________________________________ -// QuadSetGL +// OldQuadSetGL // -ClassImp(QuadSetGL) +ClassImp(OldQuadSetGL) /**************************************************************************/ -QuadSetGL::QuadSetGL() : TGLObject() +OldQuadSetGL::OldQuadSetGL() : TGLObject() { // fCached = false; // Disable DL. } -QuadSetGL::~QuadSetGL() +OldQuadSetGL::~OldQuadSetGL() {} /**************************************************************************/ -Bool_t QuadSetGL::SetModel(TObject* obj) +Bool_t OldQuadSetGL::SetModel(TObject* obj) { -#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2) - return set_model(obj, "Reve::QuadSet"); -#elif ROOT_VERSION_CODE <= ROOT_VERSION(5,13,0) - return SetModelCheckClass(obj, "Reve::QuadSet"); -#else - return SetModelCheckClass(obj, Reve::QuadSet::Class()); -#endif + return SetModelCheckClass(obj, Reve::OldQuadSet::Class()); } -void QuadSetGL::SetBBox() +void OldQuadSetGL::SetBBox() { -#if ROOT_VERSION_CODE <= ROOT_VERSION(5,11,2) - set_axis_aligned_bbox(((QuadSet*)fExternalObj)->AssertBBox()); -#else - SetAxisAlignedBBox(((QuadSet*)fExternalObj)->AssertBBox()); -#endif + SetAxisAlignedBBox(((OldQuadSet*)fExternalObj)->AssertBBox()); } /**************************************************************************/ -void QuadSetGL::DirectDraw(const TGLDrawFlags & ) const +void OldQuadSetGL::DirectDraw(const TGLDrawFlags & ) const { - // printf("QuadSetGLRenderer::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD()); + // printf("OldQuadSetGLRenderer::DirectDraw Style %d, LOD %d\n", flags.Style(), flags.LOD()); - QuadSet& Q = * (QuadSet*) fExternalObj; + OldQuadSet& Q = * (OldQuadSet*) fExternalObj; glPushAttrib(GL_ENABLE_BIT | GL_POLYGON_BIT); diff --git a/EVE/Reve/QuadSetGL.h b/EVE/Reve/QuadSetGL.h index 3143ea62a66..e6f45c13d5a 100644 --- a/EVE/Reve/QuadSetGL.h +++ b/EVE/Reve/QuadSetGL.h @@ -7,19 +7,19 @@ namespace Reve { -class QuadSetGL : public TGLObject +class OldQuadSetGL : public TGLObject { protected: virtual void DirectDraw(const TGLDrawFlags & flags) const; public: - QuadSetGL(); - virtual ~QuadSetGL(); + OldQuadSetGL(); + virtual ~OldQuadSetGL(); virtual Bool_t SetModel(TObject* obj); virtual void SetBBox(); - ClassDef(QuadSetGL, 0); + ClassDef(OldQuadSetGL, 0); }; } -- 2.43.0