966885645e
- primo rilascio (esecutore e lua da EgtInterface).
93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
//----------------------------------------------------------------------------
|
|
// EgalTech 2015-2015
|
|
//----------------------------------------------------------------------------
|
|
// File : LUA_GdbModifySurf.cpp Data : 09.03.15 Versione : 1.6b6
|
|
// Contenuto : Funzioni di modifica delle superfici per LUA.
|
|
//
|
|
//
|
|
//
|
|
// Modifiche : 09.03.15 DS Creazione modulo.
|
|
//
|
|
//
|
|
//----------------------------------------------------------------------------
|
|
|
|
//--------------------------- Include ----------------------------------------
|
|
#include "stdafx.h"
|
|
#include "LUA.h"
|
|
#include "/EgtDev/Include/EXeExecutor.h"
|
|
#include "/EgtDev/Include/EXeConst.h"
|
|
#include "/EgtDev/Include/EGkGdbConst.h"
|
|
#include "/EgtDev/Include/EGkLuaAux.h"
|
|
|
|
using namespace std ;
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaInvertSurf( lua_State* L)
|
|
{
|
|
// 1 parametro : Id/s
|
|
INTVECTOR vId ;
|
|
LuaCheckParam( L, 1, vId)
|
|
LuaClearStack( L) ;
|
|
// eseguo inversione superfici
|
|
bool bOk = ExeInvertSurface( vId) ;
|
|
// restituisco il risultato
|
|
LuaSetReturn( L, bOk) ;
|
|
return 1 ;
|
|
}
|
|
|
|
//----------------------------------------------------------------------------
|
|
static int
|
|
LuaExtractSurfTmFacetLoops( lua_State* L)
|
|
{
|
|
// 3 parametri : nId, nFacet, nDestGrpId
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
int nFacet ;
|
|
LuaCheckParam( L, 2, nFacet)
|
|
int nDestGrpId ;
|
|
LuaCheckParam( L, 3, nDestGrpId)
|
|
LuaClearStack( L) ;
|
|
// eseguo inversione superfici
|
|
int nCount ;
|
|
int nNewId = ExeExtractSurfTmFacetLoops( nId, nFacet, nDestGrpId, &nCount) ;
|
|
// restituisco il risultato
|
|
if ( nNewId != GDB_ID_NULL)
|
|
LuaSetReturn( L, nNewId) ;
|
|
else
|
|
LuaSetReturn( L) ;
|
|
LuaSetReturn( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
static int
|
|
LuaExplodeSurfTm( lua_State* L)
|
|
{
|
|
// 1 parametro : Id
|
|
int nId ;
|
|
LuaCheckParam( L, 1, nId)
|
|
LuaClearStack( L) ;
|
|
// esplosione della superficie trimesh
|
|
int nCount ;
|
|
int nFirstId = ExeExplodeSurfTm( nId, &nCount) ;
|
|
if ( nFirstId != GDB_ID_NULL)
|
|
LuaSetReturn( L, nFirstId) ;
|
|
else
|
|
LuaSetReturn( L) ;
|
|
LuaSetReturn( L, nCount) ;
|
|
return 2 ;
|
|
}
|
|
|
|
//-------------------------------------------------------------------------------
|
|
bool
|
|
LuaInstallGdbModifySurf( LuaMgr& luaMgr)
|
|
{
|
|
bool bOk = ( &luaMgr != nullptr) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtInvertSurf", LuaInvertSurf) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExtractSurfTmFacetLoops", LuaExtractSurfTmFacetLoops) ;
|
|
bOk = bOk && luaMgr.RegisterFunction( "EgtExplodeSurfTm", LuaExplodeSurfTm) ;
|
|
return bOk ;
|
|
}
|