EgtInterface 1.5j4 :

- ora si imposta un context corrente anche per le API come per LUA
- il context corrente di LUA coincide con quello delle API.
This commit is contained in:
Dario Sassi
2014-10-15 15:31:00 +00:00
parent 3b1e139286
commit 46c5fce044
29 changed files with 594 additions and 528 deletions
+60 -60
View File
@@ -23,9 +23,9 @@ using namespace std ;
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtInitScene( int nGseCtx, HWND hWnd, int nDriver, int b2Buff, int nColorBits, int nDepthBits)
__stdcall EgtInitScene( HWND hWnd, int nDriver, int b2Buff, int nColorBits, int nDepthBits)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX( pGseCtx, FALSE)
// inizializzazione scena OpenGL
PtrOwner<IEGrScene> pScene( CreateEGrScene()) ;
@@ -55,10 +55,10 @@ __stdcall EgtInitScene( int nGseCtx, HWND hWnd, int nDriver, int b2Buff, int nCo
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetBackground( int nGseCtx, int nTopRed, int nTopGreen, int nTopBlue,
__stdcall EgtSetBackground( int nTopRed, int nTopGreen, int nTopBlue,
int nBottomRed, int nBottomGreen, int nBottomBlue, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto lo sfondo
pGseCtx->m_pScene->SetBackground( Color( nTopRed, nTopGreen, nTopBlue),
@@ -70,9 +70,9 @@ __stdcall EgtSetBackground( int nGseCtx, int nTopRed, int nTopGreen, int nTopBlu
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetMarkAttribs( int nGseCtx, int nRed, int nGreen, int nBlue)
__stdcall EgtSetMarkAttribs( int nRed, int nGreen, int nBlue)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore del Mark
Color MKcol( nRed, nGreen, nBlue) ;
@@ -81,9 +81,9 @@ __stdcall EgtSetMarkAttribs( int nGseCtx, int nRed, int nGreen, int nBlue)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoLineAttribs( int nGseCtx, int nRed, int nGreen, int nBlue)
__stdcall EgtSetGeoLineAttribs( int nRed, int nGreen, int nBlue)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore della linea geometrica gestita direttamente dalla scena
Color Glcol( nRed, nGreen, nBlue) ;
@@ -92,9 +92,9 @@ __stdcall EgtSetGeoLineAttribs( int nGseCtx, int nRed, int nGreen, int nBlue)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRectAttribs( int nGseCtx, BOOL bOutline, int nRed, int nGreen, int nBlue, int nAlpha)
__stdcall EgtSetWinRectAttribs( BOOL bOutline, int nRed, int nGreen, int nBlue, int nAlpha)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il colore della linea geometrica gestita direttamente dalla scena
Color WRcol( nRed, nGreen, nBlue, nAlpha) ;
@@ -103,9 +103,9 @@ __stdcall EgtSetWinRectAttribs( int nGseCtx, BOOL bOutline, int nRed, int nGreen
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResize( int nGseCtx, int nW, int nH)
__stdcall EgtResize( int nW, int nH)
{
IEGrScene* pScene = GetScene( nGseCtx) ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// eseguo resize
pScene->Resize( nW, nH) ;
@@ -114,9 +114,9 @@ __stdcall EgtResize( int nGseCtx, int nW, int nH)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtDraw( int nGseCtx)
__stdcall EgtDraw( void)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo disegno
pGseCtx->m_pScene->Draw() ;
@@ -128,9 +128,9 @@ __stdcall EgtDraw( int nGseCtx)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSelect( int nGseCtx, int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
__stdcall EgtSelect( int nWinX, int nWinY, int nSelW, int nSelH, int* pnSel)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo la selezione
return ( pGseCtx->m_pScene->Select( Point3d( nWinX, nWinY), nSelW, nSelH, *pnSel) ? TRUE : FALSE) ;
@@ -138,9 +138,9 @@ __stdcall EgtSelect( int nGseCtx, int nWinX, int nWinY, int nSelW, int nSelH, in
//-----------------------------------------------------------------------------
int
__stdcall EgtGetFirstSelectedObj( int nGseCtx)
__stdcall EgtGetFirstSelectedObj( void)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// restituisco il primo oggetto selezionato
return pGseCtx->m_pScene->GetFirstSelectedObj() ;
@@ -148,9 +148,9 @@ __stdcall EgtGetFirstSelectedObj( int nGseCtx)
//-----------------------------------------------------------------------------
int
__stdcall EgtGetNextSelectedObj( int nGseCtx)
__stdcall EgtGetNextSelectedObj( void)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// restituisco il successivo oggetto selezionato
return pGseCtx->m_pScene->GetNextSelectedObj() ;
@@ -158,10 +158,10 @@ __stdcall EgtGetNextSelectedObj( int nGseCtx)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetSelectedSnapPoint( int nGseCtx, int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,
__stdcall EgtGetSelectedSnapPoint( int nSnap, int nWinX, int nWinY, int nSelW, int nSelH,
double ptP[3])
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// trovo il punto snap da selezione
Point3d ptSnap ;
@@ -175,9 +175,9 @@ __stdcall EgtGetSelectedSnapPoint( int nGseCtx, int nSnap, int nWinX, int nWinY,
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetShowMode( int nGseCtx, int nShowMode, BOOL bRedraw)
__stdcall EgtSetShowMode( int nShowMode, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto il modo di visualizzazione
if ( nShowMode >= SM_WIREFRAME && nShowMode <= SM_SHADING) {
@@ -192,9 +192,9 @@ __stdcall EgtSetShowMode( int nGseCtx, int nShowMode, BOOL bRedraw)
//-----------------------------------------------------------------------------
int
__stdcall EgtGetShowMode( int nGseCtx)
__stdcall EgtGetShowMode( void)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero il modo di visualizzazione
return pGseCtx->m_pScene->GetShowMode() ;
@@ -202,9 +202,9 @@ __stdcall EgtGetShowMode( int nGseCtx)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetShowCurveDirection( int nGseCtx, BOOL bShow, BOOL bRedraw)
__stdcall EgtSetShowCurveDirection( BOOL bShow, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto stato
pGseCtx->m_pScene->SetShowCurveDirection( bShow != FALSE) ;
@@ -215,9 +215,9 @@ __stdcall EgtSetShowCurveDirection( int nGseCtx, BOOL bShow, BOOL bRedraw)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetShowCurveDirection( int nGseCtx)
__stdcall EgtGetShowCurveDirection( void)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// recupero lo stato
return pGseCtx->m_pScene->GetShowCurveDirection() ;
@@ -225,9 +225,9 @@ __stdcall EgtGetShowCurveDirection( int nGseCtx)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtZoom( int nGseCtx, int nZoom, BOOL bRedraw)
__stdcall EgtZoom( int nZoom, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
const double COEFF_IN = 0.9 ;
@@ -259,9 +259,9 @@ __stdcall EgtZoom( int nGseCtx, int nZoom, BOOL bRedraw)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtZoomOnPoint( int nGseCtx, int nWinX, int nWinY, double dCoeff, BOOL bRedraw)
__stdcall EgtZoomOnPoint( int nWinX, int nWinY, double dCoeff, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo zoom
pGseCtx->m_pScene->ZoomOnPoint( Point3d( nWinX, nWinY), dCoeff) ;
@@ -272,9 +272,9 @@ __stdcall EgtZoomOnPoint( int nGseCtx, int nWinX, int nWinY, double dCoeff, BOOL
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGeoLine( int nGseCtx, const double ptP1[3], const double ptP2[3], BOOL bRedraw)
__stdcall EgtSetGeoLine( const double ptP1[3], const double ptP2[3], BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// disegno linea per distanza o similari
pGseCtx->m_pScene->SetGeoLine( Point3d( ptP1), Point3d( ptP2)) ;
@@ -285,9 +285,9 @@ __stdcall EgtSetGeoLine( int nGseCtx, const double ptP1[3], const double ptP2[3]
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetGeoLine( int nGseCtx, BOOL bRedraw)
__stdcall EgtResetGeoLine( BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// cancello linea per distanza o similari
pGseCtx->m_pScene->ResetGeoLine() ;
@@ -298,9 +298,9 @@ __stdcall EgtResetGeoLine( int nGseCtx, BOOL bRedraw)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetWinRect( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
__stdcall EgtSetWinRect( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// disegno finestra per zoom
pGseCtx->m_pScene->SetWinRect( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
@@ -311,9 +311,9 @@ __stdcall EgtSetWinRect( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nC
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtResetWinRect( int nGseCtx, BOOL bRedraw)
__stdcall EgtResetWinRect( BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// cancello finestra per zoom
pGseCtx->m_pScene->ResetWinRect() ;
@@ -324,9 +324,9 @@ __stdcall EgtResetWinRect( int nGseCtx, BOOL bRedraw)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtZoomWin( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
__stdcall EgtZoomWin( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo zoom su finestra
pGseCtx->m_pScene->ZoomWin( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
@@ -337,9 +337,9 @@ __stdcall EgtZoomWin( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCurr
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetView( int nGseCtx, int nView, BOOL bRedraw)
__stdcall EgtSetView( int nView, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto vista
if ( nView >= CT_TOP && nView <= CT_ISO_NW) {
@@ -354,9 +354,9 @@ __stdcall EgtSetView( int nGseCtx, int nView, BOOL bRedraw)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetGenericView( int nGseCtx, double dAngVertDeg, double dAngHorizDeg, BOOL bRedraw)
__stdcall EgtSetGenericView( double dAngVertDeg, double dAngHorizDeg, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto vista
pGseCtx->m_pScene->SetCamera( dAngVertDeg, dAngHorizDeg, 0) ;
@@ -367,9 +367,9 @@ __stdcall EgtSetGenericView( int nGseCtx, double dAngVertDeg, double dAngHorizDe
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtSetViewCenter( int nGseCtx, const double ptP[3], BOOL bRedraw)
__stdcall EgtSetViewCenter( const double ptP[3], BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// imposto vista
pGseCtx->m_pScene->SetCenter( Point3d( ptP)) ;
@@ -380,9 +380,9 @@ __stdcall EgtSetViewCenter( int nGseCtx, const double ptP[3], BOOL bRedraw)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtPanCamera( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
__stdcall EgtPanCamera( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo panoramica
pGseCtx->m_pScene->PanCamera( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
@@ -393,9 +393,9 @@ __stdcall EgtPanCamera( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCu
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtRotateCamera( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
__stdcall EgtRotateCamera( int nPrevX, int nPrevY, int nCurrX, int nCurrY, BOOL bRedraw)
{
GseContext* pGseCtx = GetGseContext( nGseCtx) ;
GseContext* pGseCtx = GetCurrGseContext() ;
VERIFY_CTX_SCENE( pGseCtx, FALSE)
// eseguo rotazione camera
pGseCtx->m_pScene->RotateCamera( Point3d( nPrevX, nPrevY), Point3d( nCurrX, nCurrY)) ;
@@ -406,9 +406,9 @@ __stdcall EgtRotateCamera( int nGseCtx, int nPrevX, int nPrevY, int nCurrX, int
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtGetCameraDir( int nGseCtx, int* pnDir)
__stdcall EgtGetCameraDir( int* pnDir)
{
IEGrScene* pScene = GetScene( nGseCtx) ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// recupero direzione di vista
if ( pnDir == nullptr)
@@ -419,9 +419,9 @@ __stdcall EgtGetCameraDir( int nGseCtx, int* pnDir)
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtUnProjectPoint( int nGseCtx, int nWinX, int nWinY, double ptP[3])
__stdcall EgtUnProjectPoint( int nWinX, int nWinY, double ptP[3])
{
IEGrScene* pScene = GetScene( nGseCtx) ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// eseguo l'inverso della proiezione (considero Z punto su centro)
Point3d ptView( nWinX, nWinY, pScene->GetProjectedCenter().z) ;
@@ -436,9 +436,9 @@ __stdcall EgtUnProjectPoint( int nGseCtx, int nWinX, int nWinY, double ptP[3])
//-----------------------------------------------------------------------------
BOOL
__stdcall EgtProjectPoint( int nGseCtx, const double ptP[3], double ptWin[3])
__stdcall EgtProjectPoint( const double ptP[3], double ptWin[3])
{
IEGrScene* pScene = GetScene( nGseCtx) ;
IEGrScene* pScene = GetCurrScene() ;
VERIFY_SCENE( pScene, FALSE)
// eseguo la proiezione
Point3d ptView ;