|
From: Charles L. <cn...@us...> - 2008-12-29 06:27:35
|
Update of /cvsroot/hgengine/Mercury/src In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7705 Modified Files: ScreenMapEditor.cpp Log Message: Add two new features - . selects closest object to camrea, / points camera at selected object Index: ScreenMapEditor.cpp =================================================================== RCS file: /cvsroot/hgengine/Mercury/src/ScreenMapEditor.cpp,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** ScreenMapEditor.cpp 25 Nov 2008 19:42:59 -0000 1.47 --- ScreenMapEditor.cpp 29 Dec 2008 06:27:29 -0000 1.48 *************** *** 79,83 **** Position Normally (When Button1 is pressed) Ctrl: Control Rotation ! Shift: Control Z ---Piece Only Commands--- --- 79,87 ---- Position Normally (When Button1 is pressed) Ctrl: Control Rotation ! ! X/Y/Z control exclusively X/Y/Z axiz ! ! / = point camera at object ! . = select object closest to camera ---Piece Only Commands--- *************** *** 675,678 **** --- 679,729 ---- switch ( data.PeekItem( 1 ).GetValueI() ) { + case '/': + { + MercuryPoint Selected; + if ( GetSelectedHandleVis() ) Selected = GetSelectedHandleVis()->GetPosition(); + else if ( GetSelectedHandleODE() ) Selected = GetSelectedHandleODE()->GetPosition(); + else + { + NotifyMessage( "No piece selected." ); + } + MercuryPoint pAt = m_pCameraPos - Selected; + pAt.NormalizeSelf(); + m_pCameraRot = MercuryPoint( atan2( -pAt.y, -pAt.x ), atan( pAt.z ) * 1.5, 0 ); + } + break; + case '.': + { + MercuryPoint ClosestPV = m_pCameraPos; + float fClosestVal = 10000000.; + int iClosestIndex = -1; + + if (m_bWorldLoaded) + { + for( int i = 0; i < m_vVisObjs.size(); i++ ) + if( m_vVisObjs[i] ) + if( (m_vVisObjs[i]->GetPosition() - ClosestPV).Magnitude() < fClosestVal ) + { + fClosestVal = (m_vVisObjs[i]->GetPosition() - ClosestPV).Magnitude(); + iClosestIndex = i; + } + } + else if(m_bObjectLoaded) + { + for( int i = 0; i < m_vLastVis.size(); i++ ) + if( m_vLastVis[i] ) + if( (m_vLastVis[i]->GetPosition() - ClosestPV).Magnitude() < fClosestVal ) + { + fClosestVal = (m_vLastVis[i]->GetPosition() - ClosestPV).Magnitude(); + iClosestIndex = i; + } + } + + if( iClosestIndex >= 0 ) + SelectObject( iClosestIndex ); + else + NotifyMessage( "No piece selected." ); + } + break; case 'b': if ( m_bWorldLoaded ) |