Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ac78227f0b | |||
| 8eff351f17 | |||
| 0405079553 | |||
| 50b446c371 | |||
| a68b502938 |
Binary file not shown.
+3
-3
@@ -972,17 +972,17 @@ Scene::GetPixelZ( const Point3d& ptWin, double& dWinZ)
|
||||
glClear( GL_DEPTH_BUFFER_BIT) ; // pulizia buffer depth per futura scrittura
|
||||
|
||||
// disegno la scena nella viewport ridotta : questo scrive il depth buffer ( se fossi nella vera
|
||||
// modalità di selezione GL_SELECT non scriverei le depth nel buffer, in qaunto non c'è una
|
||||
// modalità di selezione GL_SELECT non scriverei le depth nel buffer, in quanto non c'è una
|
||||
// modalità di rendering)
|
||||
DrawGroup( GDB_ID_ROOT, 1, MdStMkCol( GDB_MD_STD, GDB_ST_ON, GDB_MK_OFF, m_colDef)) ;
|
||||
glFlush() ; // per sicurezza attendo
|
||||
|
||||
// leggo la Z del pizel corrente, le coordinate x e y non cambiano rispetto alla viewport originale
|
||||
// leggo la Z del pixel corrente, le coordinate x e y non cambiano rispetto alla viewport originale
|
||||
glReadBuffer( GL_FRONT) ;
|
||||
float dZ ;
|
||||
bool bOk = true ;
|
||||
glReadPixels( int( ptWin.x), int( Viewport[3] - ptWin.y), 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &dZ) ;
|
||||
if ( glGetError() == GL_NO_ERROR && dZ > 0.001f && dZ < 0.999f)
|
||||
if ( glGetError() == GL_NO_ERROR && dZ > 0.1f && dZ < 0.9f)
|
||||
dWinZ = dZ ;
|
||||
else {
|
||||
bOk = false ;
|
||||
|
||||
+10
-4
@@ -14,9 +14,11 @@
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "Scene.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EGkFrame3d.h"
|
||||
#include "/EgtDev/Include/EGnStringUtils.h"
|
||||
#include "/EgtDev/Include/EgtNumUtils.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
|
||||
|
||||
using namespace std ;
|
||||
|
||||
@@ -574,12 +576,16 @@ Scene::ZoomOnPoint( const Point3d& ptWin, double dCoeff)
|
||||
bool
|
||||
Scene::ZoomWin( const Point3d& ptWin1, const Point3d& ptWin2)
|
||||
{
|
||||
// leggo Z del pixel
|
||||
double dWinZ ;
|
||||
GetPixelZ( Media( ptWin1, ptWin2), dWinZ) ;
|
||||
|
||||
// porto i punti in coordinate mondo
|
||||
Point3d ptWorld1 ;
|
||||
if ( ! UnProject( Point3d( ptWin1.x, ptWin1.y, GetProjectedCenter().z), ptWorld1))
|
||||
if ( ! UnProject( Point3d( ptWin1.x, ptWin1.y, dWinZ), ptWorld1))
|
||||
return false ;
|
||||
Point3d ptWorld2 ;
|
||||
if ( ! UnProject( Point3d( ptWin2.x, ptWin2.y, GetProjectedCenter().z), ptWorld2))
|
||||
if ( ! UnProject( Point3d( ptWin2.x, ptWin2.y, dWinZ), ptWorld2))
|
||||
return false ;
|
||||
|
||||
// recupero il riferimento della camera (vista)
|
||||
|
||||
Reference in New Issue
Block a user