]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Alpha threshold parameter
authorouv <ouv@opencascade.com>
Fri, 23 Sep 2005 13:08:07 +0000 (13:08 +0000)
committerouv <ouv@opencascade.com>
Fri, 23 Sep 2005 13:08:07 +0000 (13:08 +0000)
src/PIPELINE/VISU_GaussPointsPL.cxx
src/PIPELINE/VISU_GaussPointsPL.hxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx
src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx

index e129da4a95b0dfa3122f3950ac212849b258f031..85802771c67971e2d2d074369adb2ef25635e334 100644 (file)
@@ -342,6 +342,24 @@ VISU_GaussPointsPL
   return myAverageCellSize*myRelativeMaxSize;
 }
 
+//----------------------------------------------------------------------------
+void
+VISU_GaussPointsPL
+::SetAlphaThreshold(float theAlphaThreshold)
+{
+  myPSMapper->SetPointSpriteAlphaThreshold( theAlphaThreshold );
+
+  Modified();
+}
+
+//----------------------------------------------------------------------------
+float
+VISU_GaussPointsPL
+::GetAlphaThreshold()
+{
+  return myPSMapper->GetPointSpriteAlphaThreshold();
+}
+
 //----------------------------------------------------------------------------
 void
 VISU_GaussPointsPL
index 6cdd85c800bca77cfc082a24e40a64d42c12f04b..3d9cab6682a11d215151fd24e55308cc90fe1fbf 100644 (file)
@@ -150,6 +150,12 @@ public:
   float
   GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray);
 
+  void
+  SetAlphaThreshold(float theAlphaThreshold);
+
+  float
+  GetAlphaThreshold();
+
   void
   SetImageData(vtkImageData* theImageData);
 
index 1b30eae45012fe225c5824834773a94f2a2e0e81..513c8a5ed8043e992424626e287ff6ff6c3bd6bb 100755 (executable)
@@ -124,14 +124,13 @@ VISU_OpenGLPointSpriteMapper::VISU_OpenGLPointSpriteMapper()
   this->OpenGLLibrary            = 0;
 #endif
 
-  this->AlphaThreshold           = 0.1;
-
   this->PointSpriteClamp         = 100.0;
   this->PointSpriteSize          =   0.0;
   this->PointSpriteMinSize       =  15.0;
   this->PointSpriteMaxSize       =  50.0;
   this->PointSpriteMagnification =   1.0;
 
+  this->PointSpriteAlphaThreshold = 0.1;
   this->PointSpriteTexture       = 0;
   this->IsUsingOpenGLMapper      = false;
 }
@@ -168,6 +167,7 @@ void VISU_OpenGLPointSpriteMapper::ShallowCopy( vtkAbstractMapper* mapper )
     this->SetPointSpriteMagnification( m->GetPointSpriteMagnification() );
 
     this->SetImageData( m->GetImageData() );
+    this->SetPointSpriteAlphaThreshold( m->GetPointSpriteAlphaThreshold() );
   }
   MAPPER_SUPERCLASS::ShallowCopy(mapper);
 
@@ -667,9 +667,12 @@ void VISU_OpenGLPointSpriteMapper::InitSprites()
     case VISU_OpenGLPointSpriteMapper::Accumulate:
     {
       glDisable(GL_DEPTH_TEST);
+
       glEnable( GL_BLEND );
       glBlendFunc( GL_SRC_ALPHA, GL_ONE );
-      glAlphaFunc( GL_GREATER, this->AlphaThreshold );
+
+      glEnable( GL_ALPHA_TEST );
+      glAlphaFunc( GL_GREATER, this->PointSpriteAlphaThreshold );
       break;
     }
 
@@ -677,6 +680,7 @@ void VISU_OpenGLPointSpriteMapper::InitSprites()
     {
       glDepthFunc( GL_LEQUAL );
       glEnable( GL_DEPTH_TEST );
+
       glDisable( GL_BLEND );
       break;
     }
index 694b5c4664b594e88627550fc08c310997857990..3916ea454694f353005db37f7d9afc0a996e3ddf 100755 (executable)
@@ -155,6 +155,9 @@ public:
   void SetPointSpriteMaxSize( float );
   void SetPointSpriteMagnification( float );
 
+  vtkGetMacro(PointSpriteAlphaThreshold, float);
+  vtkSetMacro(PointSpriteAlphaThreshold, float);
+
   void SetImageData(vtkImageData* theImageData);
   vtkImageData* GetImageData();
 
@@ -197,8 +200,6 @@ protected:
   void*             OpenGLLibrary;
 #endif
 
-  float             AlphaThreshold;
-
   float             PointSpriteClamp;
   float             PointSpriteSize;
   float             PointSpriteMinSize;
@@ -206,8 +207,8 @@ protected:
   float             PointSpriteMagnification;
 
   GLuint            PointSpriteTexture;
+  float             PointSpriteAlphaThreshold;
 
-  
   vtkSmartPointer<vtkImageData> ImageData;
 
   bool              IsUsingOpenGLMapper;