From: ouv Date: Thu, 1 Dec 2005 15:49:56 +0000 (+0000) Subject: Calculation of the "View to Display" coordinates transformation coefficient. X-Git-Tag: TG-D5-38-2003_D2005-20-12~79 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4e10e5809d9b08a70d18da4c04b2c9a8b93545ba;p=modules%2Fvisu.git Calculation of the "View to Display" coordinates transformation coefficient. --- diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 87ce9597..f4640aee 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -684,6 +684,21 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p, if( this->UsePointSprites ) this->InitPointSprites(); + float p1[3], p2[3]; + + ren->SetViewPoint( 0.0, 0.0, 0.0 ); + ren->ViewToDisplay(); + ren->GetDisplayPoint( p1 ); + + ren->SetViewPoint( 1.0, 1.0, 1.0 ); + ren->ViewToDisplay(); + ren->GetDisplayPoint( p2 ); + + float coefficient = sqrt( pow( p2[0] - p1[0], 2 ) + pow( p2[1] - p1[1], 2 ) ) / sqrt( 2 ); + //cout << p1[0] << " " << p1[1] << " " << p1[2] << endl; + //cout << p2[0] << " " << p2[1] << " " << p2[2] << endl; + //cout << "ZOOM : " << coefficient << endl; + glPointSize( this->DefaultPointSize ); vglUseProgramObjectARB( this->VertexProgram ); @@ -734,7 +749,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *p, else size = this->PointSpriteSize; - aVertex[i].hue = 1000.0 * this->AverageCellSize * this->PointSpriteMagnification * size; + aVertex[i].hue = coefficient * this->AverageCellSize * this->PointSpriteMagnification * size; } GLuint aBufferObjectID = 0;