]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Started to work on reimplementation of the quad-set, renamed the old one to OldQuadSet.
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Oct 2006 09:13:32 +0000 (09:13 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 31 Oct 2006 09:13:32 +0000 (09:13 +0000)
EVE/Reve/LinkDef.h
EVE/Reve/QuadSet.cxx
EVE/Reve/QuadSet.h
EVE/Reve/QuadSetGL.cxx
EVE/Reve/QuadSetGL.h

index 5fc48fc726370aaeed407ab318c361dcc71ef7f7..9dad7218bc657ffba9bb24a2a376e731cd8375bd 100644 (file)
 
 // QuadSet
 #pragma link C++ class Reve::Quad+;
+#pragma link C++ class Reve::OldQuadSet+;
 #pragma link C++ class Reve::QuadSet+;
 
 // BoxSet
 //================================
 
 // 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;
index 8d1cf0f437ef9676b14313b896e31d6785d90b38..630c42f6b9468fd5e71cd939a0e5d48448b3164d 100644 (file)
@@ -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<Quad>::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(),
index c26ab1b444a96f7866090cc9aa0c46dc0e1f6ce7..b8e982d98a365cefb6fdfd441ae187b096ddd8cb 100644 (file)
@@ -8,6 +8,10 @@
 #include <TAtt3D.h>
 #include <TAttBBox.h>
 
+#include <Reve/RenderElement.h>
+#include <Reve/Reve.h>
+#include "ZTrans.h"
+
 #include <vector>
 
 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<Quad> 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<Reve::Quad>& 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);
 };
index cab1d5c4549736814c885dd5f49aebce3cdef6d7..ea8cf80f29119f74f3f0ebf3bf9981aa844d6405 100644 (file)
 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);
 
index 3143ea62a6647947a90c1e66556453e29875839f..e6f45c13d5a4a0ce7f4c6208bff74675d13ad8dd 100644 (file)
@@ -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);
 };
 
 }