]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Added method method GenerateZNormalColors() that uses Reve::RGBAPalette to set-up...
authormtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 25 Oct 2006 16:18:47 +0000 (16:18 +0000)
committermtadel <mtadel@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 25 Oct 2006 16:18:47 +0000 (16:18 +0000)
EVE/Reve/TriangleSet.cxx
EVE/Reve/TriangleSet.h

index 49d38d5f75663237e776a8ad015ce015adc527f1..ef923c6387573cfc8f85aab3e589aa7fcbf12146 100644 (file)
@@ -8,7 +8,6 @@
 #include <TVirtualViewer3D.h>
 #include <TBuffer3D.h>
 #include <TBuffer3DTypes.h>
-#include <TGeoMatrix.h>
 
 using namespace Reve;
 
@@ -73,6 +72,23 @@ void TriangleSet::GenerateRandomColors()
     }
 }
 
+void TriangleSet::GenerateZNormalColors(Float_t fac, Int_t min, Int_t max,
+                                       Bool_t interp, Bool_t wrap)
+{
+  if (fTringCols  == 0)  fTringCols = new UChar_t[3*fNTrings];
+  if (fTringNorms == 0)  GenerateTriangleNormals();
+
+  Reve::RGBAPalette pal(min, max, interp, wrap);
+  UChar_t *C = fTringCols;
+  Float_t *N = fTringNorms;
+  for(Int_t t=0; t<fNTrings; ++t, C+=3, N+=3)
+    {
+      Int_t v = TMath::Nint(fac * N[2]);
+      pal.ColorFromArray(v, C, kFALSE);
+    }
+  gPad->Modified(); gPad->Update();
+}
+
 /**************************************************************************/
 
 void TriangleSet::ComputeBBox()
index 55ab654ffd6be1f47b384962686e31d831a785b2..32d9ca419e54117e95dc55beeda677acd37842ff 100644 (file)
@@ -6,6 +6,7 @@
 #include "RenderElement.h"
 #include <TNamed.h>
 #include <TAttBBox.h>
+#include <TAtt3D.h>
 
 #include "ZTrans.h"
 
@@ -14,8 +15,9 @@ class TGeoMatrix;
 namespace Reve {
 
 class TriangleSet : public RenderElement,
-                   public TNamed,
-                   public TAttBBox
+                    public TNamed,
+                    public TAttBBox,
+                    public TAtt3D
 {
   friend class TriangleSetEditor;
   friend class TriangleSetGL;
@@ -58,6 +60,8 @@ public:
 
   void GenerateTriangleNormals();
   void GenerateRandomColors();
+  void GenerateZNormalColors(Float_t fac=20, Int_t min=-20, Int_t max=20,
+                            Bool_t interp=kFALSE, Bool_t wrap=kFALSE);
 
   virtual void ComputeBBox();
   virtual void Paint(Option_t* = "");