]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Calculation of the "View to Display" coordinates transformation coefficient.
authorouv <ouv@opencascade.com>
Thu, 1 Dec 2005 15:49:56 +0000 (15:49 +0000)
committerouv <ouv@opencascade.com>
Thu, 1 Dec 2005 15:49:56 +0000 (15:49 +0000)
src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx

index 87ce9597c3a3403795a9c4a847abebfc4017025b..f4640aee25565e431019ee7ec993227ddb9b43c8 100755 (executable)
@@ -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;