From: ouv Date: Fri, 23 Sep 2005 13:08:07 +0000 (+0000) Subject: Alpha threshold parameter X-Git-Tag: BR-D5-38-2003_D2005-12-10~145 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=36eed1500765b07fd45c94584d9d23e34f5f328f;p=modules%2Fvisu.git Alpha threshold parameter --- diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index e129da4a..85802771 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -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 diff --git a/src/PIPELINE/VISU_GaussPointsPL.hxx b/src/PIPELINE/VISU_GaussPointsPL.hxx index 6cdd85c8..3d9cab66 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.hxx +++ b/src/PIPELINE/VISU_GaussPointsPL.hxx @@ -150,6 +150,12 @@ public: float GetPointSize(vtkIdType theID, vtkDataArray* theScalarArray); + void + SetAlphaThreshold(float theAlphaThreshold); + + float + GetAlphaThreshold(); + void SetImageData(vtkImageData* theImageData); diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 1b30eae4..513c8a5e 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -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; } diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx index 694b5c46..3916ea45 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.hxx @@ -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 ImageData; bool IsUsingOpenGLMapper;