EgtGraphics 2.7b3 :
- in vista prospettica con zoom standard introdotto valore massimo per fov.
This commit is contained in:
+24
-15
@@ -391,10 +391,8 @@ Scene::ZoomAll( void)
|
||||
m_dDistCamera = m_dHalfHeight / tan( PERSPECTIVE_STD_FOV * 0.5 * DEGTORAD) + ( m_b3ExtView.GetMax().z - m_b3ExtView.GetMin().z) * 0.5 ;
|
||||
}
|
||||
else {
|
||||
// verifico di non finire dentro l'oggetto
|
||||
double dDiam ; m_b3ExtView.GetDiameter( dDiam) ;
|
||||
if ( m_dDistCamera < dDiam * 0.5)
|
||||
m_dDistCamera = dDiam * 0.5 ;
|
||||
// aggiusto la distanza della camera
|
||||
m_b3ExtView.GetDiameter( m_dDistCamera) ;
|
||||
|
||||
// il valore di m_dHalfHeight calcolato dal box non garantisce che l'oggetto sia interamente contenuto nel frustum
|
||||
// perchè è il valore in corrispondenza della faccia del box davanti alla camera. Per il calcolo del fov m_dHalfHeight
|
||||
@@ -537,19 +535,30 @@ Scene::ZoomOnPoint( const Point3d& ptWin, double dCoeff)
|
||||
Point3d ptOldCen = m_ptCenter ;
|
||||
Point3d ptNewCen = ptWorld + ( m_ptCenter - ptWorld) * dCoeff ;
|
||||
SetCenter( ptNewCen) ;
|
||||
|
||||
// nel caso di dolly verifico se il nuovo zoom fa entrare negli oggetti
|
||||
if ( ! m_bOrthographic && m_nPerspZoomType == ZT_DOLLY) {
|
||||
double dMinDist = CalcMinCameraDistance() ;
|
||||
if ( m_dDistCamera * dCoeff < dMinDist) {
|
||||
// adatto il coefficiente di zoom e ricalcolo il centro
|
||||
dCoeff = dMinDist / m_dDistCamera ;
|
||||
Point3d ptNewCenter = ptWorld + ( ptOldCen - ptWorld) * dCoeff ;
|
||||
SetCenter( ptNewCenter) ;
|
||||
}
|
||||
}
|
||||
m_bDistOk = true ;
|
||||
|
||||
if ( ! m_bOrthographic) {
|
||||
if ( m_nPerspZoomType == ZT_DOLLY) {
|
||||
// nel caso di dolly verifico se il nuovo zoom fa entrare negli oggetti
|
||||
double dMinDist = CalcMinCameraDistance() ;
|
||||
if ( m_dDistCamera * dCoeff < dMinDist) {
|
||||
// adatto il coefficiente di zoom e ricalcolo il centro
|
||||
dCoeff = dMinDist / m_dDistCamera ;
|
||||
Point3d ptNewCenter = ptWorld + ( ptOldCen - ptWorld) * dCoeff ;
|
||||
SetCenter( ptNewCenter) ;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// nel caso standard verifico se il nuovo fov supera il valore massimo
|
||||
if ( m_dHalfHeight * dCoeff / m_dDistCamera > PERSPECTIVE_TAN_MAX_FOV) {
|
||||
// adatto il coefficiente di zoom e ricalcolo il centro
|
||||
dCoeff = PERSPECTIVE_TAN_MAX_FOV * m_dDistCamera / m_dHalfHeight ;
|
||||
Point3d ptNewCenter = ptWorld + ( ptOldCen - ptWorld) * dCoeff ;
|
||||
SetCenter( ptNewCenter) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return ZoomChange( dCoeff) ;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user