EgtInterface 1.6e2 :

- esecutore e lua scorporato in EgtExecutor.
This commit is contained in:
Dario Sassi
2015-05-05 22:14:56 +00:00
parent e7ee6d9255
commit 8bc0e986b2
60 changed files with 454 additions and 16260 deletions
+80 -378
View File
@@ -14,60 +14,31 @@
//--------------------------- Include ----------------------------------------
#include "stdafx.h"
#include "API.h"
#include "API_Macro.h"
#include "DllGraphics.h"
#include "/EgtDev/Include/EInAPI.h"
#include "/EgtDev/Include/EXeExecutor.h"
#include "/EgtDev/Include/EGnStringConverter.h"
#include "/EgtDev/Include/EgtPointerOwner.h"
using namespace std ;
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtInitScene( HWND hWnd, int nDriver, int b2Buff, int nColorBits, int nDepthBits)
__stdcall EgtInitScene( HWND hWnd, int nDriver, BOOL b2Buff, int nColorBits, int nDepthBits)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, FALSE)
// inizializzazione scena OpenGL
PtrOwner<IEGrScene> pScene( MyCreateEGrScene()) ;
VERIFY_NULL( Get( pScene), "Error in CreateEGrScene", FALSE)
HDC hdc = GetDC( hWnd) ;
if ( ! pScene->CreateContext( hdc, nDriver, ( b2Buff != 0), nColorBits, nDepthBits))
return FALSE ;
pScene->SetBackground( WHITE, WHITE) ;
pScene->SetShowMode( SM_SHADING) ;
pScene->SetShowCurveDirection( false) ;
pScene->SetCamera( CT_TOP) ;
pScene->ZoomAll() ;
pScene->SetWinRectAttribs( true, BLACK) ;
pScene->SetMark( YELLOW) ;
pScene->Init( pGseCtx->m_pGeomDB) ;
// assegno la scena al contesto
pGseCtx->m_hWnd = hWnd ;
pGseCtx->m_pScene = Release( pScene) ;
// log con info sulla scena
string sSceneInfo = pGseCtx->m_pScene->GetOpenGLInfo() + '\n' +
pGseCtx->m_pScene->GetGLSLInfo() + '\n' +
pGseCtx->m_pScene->GetPixelFormatInfo() ;
LOG_INFO( GetLogger(), sSceneInfo.c_str())
return TRUE ;
return ( ExeInitScene( hWnd, nDriver, ( b2Buff != FALSE), nColorBits, nDepthBits) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetSceneInfo( wchar_t*& wsInfo)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero le informazioni sulla scena
// verifico parametro di ritorno
if ( &wsInfo == nullptr)
return FALSE ;
// recupero le informazioni
string sInfo ;
sInfo += pGseCtx->m_pScene->GetOpenGLInfo() ;
sInfo += "\r\n" ;
sInfo += pGseCtx->m_pScene->GetGLSLInfo() ;
sInfo += "\r\n" ;
sInfo += pGseCtx->m_pScene->GetPixelFormatInfo() ;
if ( ! ExeGetSceneInfo( sInfo))
return FALSE ;
// alloco buffer di ritorno ed eseguo copia
wsInfo = _wcsdup( stringtoW( sInfo)) ;
return (( wsInfo == nullptr) ? FALSE : TRUE) ;
}
@@ -76,254 +47,145 @@ __stdcall EgtGetSceneInfo( wchar_t*& wsInfo)
BOOL
__stdcall EgtSetBackground( const int TopCol[4], const int BottomCol[4], BOOL bRedraw)
{
return ( EgtSetBackground( Color( TopCol), Color( BottomCol), ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetBackground( Color TopCol, Color BottomCol, bool bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// imposto lo sfondo
pGseCtx->m_pScene->SetBackground( TopCol, BottomCol) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return true ;
return ( ExeSetBackground( Color( TopCol), Color( BottomCol), ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMarkAttribs( const int MarkCol[4])
{
return ( EgtSetMarkAttribs( Color( MarkCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetMarkAttribs( Color MarkCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// imposto il colore del Mark
return pGseCtx->m_pScene->SetMark( MarkCol) ;
return ( ExeSetMarkAttribs( Color( MarkCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetSelSurfAttribs( const int SelSurfCol[4])
{
return ( EgtSetSelSurfAttribs( Color( SelSurfCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetSelSurfAttribs( Color SelSurfCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// imposto il colore del Mark
return pGseCtx->m_pScene->SetSelSurf( SelSurfCol) ;
return ( ExeSetSelSurfAttribs( Color( SelSurfCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoLineAttribs( const int GlCol[4])
{
return ( EgtSetGeoLineAttribs( Color( GlCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetGeoLineAttribs( Color GlCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// imposto il colore della linea geometrica gestita direttamente dalla scena
return pGseCtx->m_pScene->SetGeoLineAttribs( GlCol) ;
return ( ExeSetGeoLineAttribs( Color( GlCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoTriaAttribs( const int GtCol[4])
{
return ( EgtSetGeoTriaAttribs( Color( GtCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetGeoTriaAttribs( Color GtCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// imposto il colore del triangolo immediato
return pGseCtx->m_pScene->SetGeoTriaAttribs( GtCol) ;
return ( ExeSetGeoTriaAttribs( Color( GtCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRectAttribs( BOOL bOutline, const int WrCol[4])
{
return ( EgtSetWinRectAttribs( ( bOutline != FALSE), Color( WrCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
bool
EgtSetWinRectAttribs( bool bOutline, Color WrCol)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, false)
// imposto il colore della linea geometrica gestita direttamente dalla scena
return pGseCtx->m_pScene->SetWinRectAttribs( bOutline, WrCol) ;
return ( ExeSetWinRectAttribs( ( bOutline != FALSE), Color( WrCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGlobFrameShow( BOOL bShow)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto stato visualizzazione griglia
return ( pGseCtx->m_pScene->SetGlobFrameShow( ( bShow != FALSE)) ? TRUE : FALSE) ;
return ( ExeSetGlobFrameShow( ( bShow != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridShow( BOOL bShowGrid, BOOL bShowFrame)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto stato visualizzazione griglia
return ( pGseCtx->m_pScene->SetGridShow( ( bShowGrid != FALSE), ( bShowFrame != FALSE)) ? TRUE : FALSE) ;
return ( ExeSetGridShow( ( bShowGrid != FALSE), ( bShowFrame != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridGeo( double dSnapStep, int nMinLineSstep, int nMajLineSstep, int nExtSstep)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto i parametri geometrici di griglia
return ( pGseCtx->m_pScene->SetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ? TRUE : FALSE) ;
return ( ExeSetGridGeo( dSnapStep, nMinLineSstep, nMajLineSstep, nExtSstep) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGridColor( const int nMinCol[4], const int nMajCol[4])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto i colori di griglia
Color colMin( nMinCol) ;
Color colMaj( nMajCol) ;
return ( pGseCtx->m_pScene->SetGridColor( colMin, colMaj) ? TRUE : FALSE) ;
return ( ExeSetGridColor( Color( nMinCol), Color( nMajCol)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResize( int nW, int nH)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// eseguo resize
pScene->Resize( nW, nH) ;
return TRUE ;
return ( ExeResize( nW, nH) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtDraw( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo disegno
pGseCtx->m_pScene->Draw() ;
// valido la finestra disegnata
ValidateRgn( pGseCtx->m_hWnd, NULL) ;
return TRUE ;
return ( ExeDraw() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo la selezione
return ( pGseCtx->m_pScene->Select( Point3d( nWinX, nWinY), nSelW, nSelH, *pnSel) ? TRUE : FALSE) ;
return ( ExeSelect( nWinX, nWinY, nSelW, nSelH, pnSel) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetObjFilterForSelect( BOOL bZerodim, BOOL bCurve, BOOL bSurf, BOOL bVolume, BOOL bExtra)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il filtro
return ( pGseCtx->m_pScene->SetObjFilterForSelect( ( bZerodim != FALSE), ( bCurve != FALSE), ( bSurf != FALSE),
( bVolume != FALSE), ( bExtra != FALSE)) ? TRUE : FALSE) ;
return ( ExeSetObjFilterForSelect( ( bZerodim != FALSE), ( bCurve != FALSE), ( bSurf != FALSE),
( bVolume != FALSE), ( bExtra != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUnselectableRemove( int nId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// tolgo dai non selezionabili
return pGseCtx->m_pScene->UnselectableRemove( nId) ;
return ( ExeUnselectableRemove( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUnselectableAdd( int nId)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// aggiungo ai non selezionabili
return pGseCtx->m_pScene->UnselectableAdd( nId) ;
return ( ExeUnselectableAdd( nId) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUnselectableClearAll( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// cancello tutti i non selezionabili
return pGseCtx->m_pScene->UnselectableClearAll() ;
return ( ExeUnselectableClearAll() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstObjInSelWin( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// restituisco il primo oggetto selezionato
return pGseCtx->m_pScene->GetFirstSelectedObj() ;
return ExeGetFirstObjInSelWin() ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextObjInSelWin( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// restituisco il successivo oggetto selezionato
return pGseCtx->m_pScene->GetNextSelectedObj() ;
return ExeGetNextObjInSelWin() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetPointFromSelect( int nSelId, int nWinX, int nWinY, double ptSel[3], int* pnAux)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// trovo il punto usato in selezione
// verifico parametri di ritorno
if ( ptSel == nullptr || pnAux == nullptr)
return FALSE ;
Point3d ptTmp ;
if ( ! pGseCtx->m_pScene->GetPointFromSelect( nSelId, Point3d( nWinX, nWinY), ptTmp, *pnAux))
if ( ! ExeGetPointFromSelect( nSelId, nWinX, nWinY, ptTmp, pnAux))
return FALSE ;
VEC_FROM_3D( ptSel, ptTmp)
return TRUE ;
@@ -331,14 +193,13 @@ __stdcall EgtGetPointFromSelect( int nSelId, int nWinX, int nWinY, double ptSel[
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetGraphicSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,
double ptP[3])
__stdcall EgtGetGraphicSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH, double ptP[3])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// trovo il punto snap da selezione
// verifico parametro di ritorno
if ( ptP == nullptr)
return FALSE ;
Point3d ptSnap ;
if ( ! pGseCtx->m_pScene->GetGraphicSnapPoint( nSnap, Point3d( nWinX, nWinY), nSelW, nSelH, ptSnap))
if ( ! ExeGetGraphicSnapPoint( nSnap, nWinX, nWinY, nSelW, nSelH, ptSnap))
return FALSE ;
VEC_FROM_3D( ptP, ptSnap)
return TRUE ;
@@ -349,11 +210,11 @@ BOOL
__stdcall EgtGetGridSnapPointZ( BOOL bSketch, int nWinX, int nWinY, const double ptGrid[3],
double ptP[3])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// trovo il punto snap da selezione
// verifico parametro di ritorno
if ( ptP == nullptr)
return FALSE ;
Point3d ptSnap ;
if ( ! pGseCtx->m_pScene->GetGridSnapPointZ( ( bSketch != FALSE), Point3d( nWinX, nWinY), ptGrid, ptSnap))
if ( ! ExeGetGridSnapPointZ( ( bSketch != FALSE), nWinX, nWinY, ptGrid, ptSnap))
return FALSE ;
VEC_FROM_3D( ptP, ptSnap)
return TRUE ;
@@ -363,343 +224,185 @@ __stdcall EgtGetGridSnapPointZ( BOOL bSketch, int nWinX, int nWinY, const double
int
__stdcall EgtGetLastSnapId( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// restituisco Id di ultima entità generatrice di punto snap
return pGseCtx->m_pScene->GetLastSnapId() ;
return ExeGetLastSnapId() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetLastSnapDir( double vtV[3])
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// restituisco, se definita, direzione associata ad ultimo punto di snap
Vector3d vtDir ;
if ( pGseCtx->m_pScene->GetLastSnapDir( vtDir)) {
VEC_FROM_3D( vtV, vtDir)
return TRUE ;
}
else
// verifico parametro di ritorno
if ( vtV == nullptr)
return FALSE ;
Vector3d vtDir ;
if ( ! ExeGetLastSnapDir( vtDir))
return FALSE ;
VEC_FROM_3D( vtV, vtDir)
return TRUE ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetShowMode( int nShowMode, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il modo di visualizzazione
if ( nShowMode >= SM_WIREFRAME && nShowMode <= SM_SHADING) {
pGseCtx->m_pScene->SetShowMode( nShowMode) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
}
else
return FALSE ;
return ( ExeSetShowMode( nShowMode, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
int
__stdcall EgtGetShowMode( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero il modo di visualizzazione
return pGseCtx->m_pScene->GetShowMode() ;
return ExeGetShowMode() ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetShowCurveDirection( BOOL bShow, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto stato
pGseCtx->m_pScene->SetShowCurveDirection( bShow != FALSE) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetShowCurveDirection( ( bShow != FALSE), ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetShowCurveDirection( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero lo stato
return pGseCtx->m_pScene->GetShowCurveDirection() ;
return ( ExeGetShowCurveDirection() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetShowTriaAdv( BOOL bAdvanced, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto stato
pGseCtx->m_pScene->SetShowTriaAdvanced( bAdvanced != FALSE) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetShowTriaAdv( ( bAdvanced != FALSE), ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetShowTriaAdv( void)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero lo stato
return pGseCtx->m_pScene->GetShowTriaAdvanced() ;
return ( ExeGetShowTriaAdv() ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtZoom( int nZoom, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
const double COEFF_IN = 0.9 ;
const double COEFF_OUT = 1 / COEFF_IN ;
switch ( nZoom) {
case 1 :
pGseCtx->m_pScene->ZoomAll() ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
break ;
case 2 :
pGseCtx->m_pScene->ZoomChange( COEFF_IN) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
break ;
case 3 :
pGseCtx->m_pScene->ZoomChange( COEFF_OUT) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
break ;
}
return FALSE ;
return ( ExeZoom( nZoom, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtZoomOnPoint( int nWinX, int nWinY, double dCoeff, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo zoom
pGseCtx->m_pScene->ZoomOnPoint( Point3d( nWinX, nWinY), dCoeff) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeZoomOnPoint( nWinX, nWinY, dCoeff, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoLine( const double ptP1[3], const double ptP2[3], BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// disegno linea per distanza o similari
pGseCtx->m_pScene->SetGeoLine( ptP1, ptP2) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetGeoLine( ptP1, ptP2, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetGeoLine( BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// cancello linea per distanza o similari
pGseCtx->m_pScene->ResetGeoLine() ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeResetGeoLine( ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoTria( const double ptP1[3], const double ptP2[3], const double ptP3[3], BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// disegno triangolo immediato
pGseCtx->m_pScene->SetGeoTria( ptP1, ptP2, ptP3) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetGeoTria( ptP1, ptP2, ptP3, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetGeoTria( BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// cancello triangolo immediato
pGseCtx->m_pScene->ResetGeoTria() ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeResetGeoTria( ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRect( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// disegno finestra per zoom
pGseCtx->m_pScene->SetWinRect( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetWinRect( nPrevX, nPrevY, nCurrX, nCurrY, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetWinRect( BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// cancello finestra per zoom
pGseCtx->m_pScene->ResetWinRect() ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeResetWinRect( ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo zoom su finestra
pGseCtx->m_pScene->ZoomWin( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeZoomWin( nPrevX, nPrevY, nCurrX, nCurrY, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetView( int nDir, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto vista
if ( nDir >= CT_TOP && nDir <= CT_CPLANE) {
pGseCtx->m_pScene->SetCamera( nDir) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
}
else
return FALSE ;
return ( ExeSetView( nDir, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGenericView( double dAngVertDeg, double dAngHorizDeg, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto vista
pGseCtx->m_pScene->SetCamera( dAngVertDeg, dAngHorizDeg, 0) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetGenericView( dAngVertDeg, dAngHorizDeg, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetViewCenter( const double ptP[3], BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto vista
pGseCtx->m_pScene->SetCenter( ptP) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeSetViewCenter( ptP, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtPanView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo panoramica
pGseCtx->m_pScene->PanCamera( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExePanView( nPrevX, nPrevY, nCurrX, nCurrY, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRotateView( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo rotazione camera
pGseCtx->m_pScene->RotateCamera( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
if ( bRedraw)
pGseCtx->m_pScene->RedrawWindow() ;
return TRUE ;
return ( ExeRotateView( nPrevX, nPrevY, nCurrX, nCurrY, ( bRedraw != FALSE)) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetView( int* pnDir)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// recupero direzione di vista
if ( pnDir == nullptr)
return FALSE ;
*pnDir = pScene->GetCameraDir() ;
return TRUE ;
return ( ExeGetView( pnDir) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetGenericView( double* pdAngVertDeg, double* pdAngHorizDeg)
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// recupero direzione di vista
if ( pdAngVertDeg == nullptr || pdAngHorizDeg == nullptr)
return FALSE ;
pScene->GetCamera( pdAngVertDeg, pdAngHorizDeg) ;
return TRUE ;
return ( ExeGetGenericView( pdAngVertDeg, pdAngHorizDeg) ? TRUE : FALSE) ;
}
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtProjectPoint( const double ptP[3], double ptWin[3])
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// eseguo la proiezione
if ( ptWin == nullptr)
return FALSE ;
Point3d ptView ;
if ( ! pScene->Project( ptP, ptView))
if ( ! ExeProjectPoint( ptP, ptView))
return FALSE ;
VEC_FROM_3D( ptWin, ptView)
return TRUE ;
@@ -709,13 +412,12 @@ __stdcall EgtProjectPoint( const double ptP[3], double ptWin[3])
BOOL
__stdcall EgtUnProjectPoint( int nWinX, int nWinY, double ptP[3])
{
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// eseguo l'inverso della proiezione (considero Z punto su centro)
Point3d ptView( nWinX, nWinY, pScene->GetProjectedCenter().z) ;
if ( ptP == nullptr)
return FALSE ;
Point3d ptWorld ;
if ( ! pScene->UnProject( ptView, ptWorld))
if ( ! ExeUnProjectPoint( nWinX, nWinY, ptWorld))
return FALSE ;
VEC_FROM_3D( ptP, ptWorld)
return TRUE ;
}