EgtGraphics :
- migliorato calcolo centro di vista in Zwin utilizzando GetPixelZ.
This commit is contained in:
@@ -941,6 +941,24 @@ Scene::UnProject( const Point3d& ptView, Point3d& ptWorld) const
|
||||
return ( nRes == GL_TRUE) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
Scene::GetPixelZ( const Point3d& ptWin, double& dWinZ)
|
||||
{
|
||||
glGetError() ;
|
||||
GLint Viewport[ 4] ;
|
||||
glGetIntegerv( GL_VIEWPORT, Viewport) ;
|
||||
float dZ ;
|
||||
glReadBuffer( GL_FRONT) ;
|
||||
glReadPixels( int( ptWin.x), Viewport[3] - int( ptWin.y), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &dZ) ;
|
||||
if ( glGetError() == GL_NO_ERROR && dZ > 0.001 && dZ < 0.999) {
|
||||
dWinZ = dZ ;
|
||||
return true ;
|
||||
}
|
||||
dWinZ = GetProjectedCenter().z ;
|
||||
return false ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
void
|
||||
Scene::Destroy( void)
|
||||
|
||||
Reference in New Issue
Block a user