EgtExecutor 1.6j1 :
- aggiunta gestione Photo - aggiunta gestione Textures con applicazione a superfici basata su riferimenti - corrette Pack di Nesting con primo pezzo più grande in X del pannello - aggiunte funzioni per Photo e Texture su superfici in LUA.
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2015-2015
|
||||
//----------------------------------------------------------------------------
|
||||
// File : EXE_Photo.cpp Data : 05.10.15 Versione : 1.6j1
|
||||
// Contenuto : Funzioni per gestione fotografia.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 05.10.15 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
//--------------------------- Include ----------------------------------------
|
||||
#include "stdafx.h"
|
||||
#include "PhotoObj.h"
|
||||
#include "EXE.h"
|
||||
#include "EXE_Macro.h"
|
||||
#include "/EgtDev/Include/EXeExecutor.h"
|
||||
#include "/EgtDev/Include/EXeConst.h"
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
int
|
||||
ExeAddPhoto( const string& sName, const string& sPath,
|
||||
const Point3d& ptOri, const Point3d& ptCen, double dMMxPixel,
|
||||
int nParentId, const Point3d& ptMin, const Point3d& ptMax)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
IEGrScene* pScene = GetCurrScene() ;
|
||||
VERIFY_SCENE( pScene, GDB_ID_NULL)
|
||||
// Carico la texture
|
||||
if ( ! pScene->UnloadTexture( sName) ||
|
||||
! pScene->LoadTexture( sName, sPath, dMMxPixel, 0, 0, TXR_CLAMP))
|
||||
return GDB_ID_NULL ;
|
||||
// Recupero le dimensioni fisiche
|
||||
double dDimX, dDimY ;
|
||||
pScene->GetTextureDimensions( sName, dDimX, dDimY) ;
|
||||
// Inserisco la regione rettangolare della foto (tutti i dati sono in Globale)
|
||||
Point3d ptIni = ptOri ;
|
||||
Point3d ptCross = ptIni + Vector3d( dDimX, dDimY, 0) ;
|
||||
ptIni.x = max( ptIni.x, ptMin.x) ;
|
||||
ptIni.y = max( ptIni.y, ptMin.y) ;
|
||||
ptCross.x = min( ptCross.x, ptMax.x) ;
|
||||
ptCross.y = min( ptCross.y, ptMax.y) ;
|
||||
int nId = ExeCreateSurfFrRectangle( nParentId, ptIni, ptCross, RTY_GLOB) ;
|
||||
if ( nId == GDB_ID_NULL) {
|
||||
ExeUnloadTexture( sName) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
// Assegno gli attributi
|
||||
pGeomDB->SetMaterial( nId, WHITE) ;
|
||||
pGeomDB->SetName( nId, sName) ;
|
||||
// Assegno i dati della texture
|
||||
pGeomDB->SetTextureName( nId, sName) ;
|
||||
pGeomDB->SetTextureFrame( nId, Frame3d(ptOri)) ;
|
||||
// Installo e inizializzo il gestore della foto
|
||||
PhotoObj* pPhoto = new(nothrow) PhotoObj ;
|
||||
if ( pPhoto == nullptr) {
|
||||
pScene->UnloadTexture( sName) ;
|
||||
return GDB_ID_NULL ;
|
||||
}
|
||||
pPhoto->Set( sName, sPath, ptOri, ptCen, dDimX, dDimY) ;
|
||||
pGeomDB->SetUserObj( nId, pPhoto) ;
|
||||
ExeSetModified() ;
|
||||
return nId ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeGetPhotoPath( int nId, string& sPath)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il gestore dei dati della fotografia dell'oggetto
|
||||
PhotoObj* pPhoto = dynamic_cast<PhotoObj*>( pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pPhoto == nullptr)
|
||||
return false ;
|
||||
// recupero la path della fotografia
|
||||
return pPhoto->GetPath( sPath) ;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeChangePhotoPath( int nId, const string& sPath)
|
||||
{
|
||||
IGeomDB* pGeomDB = GetCurrGeomDB() ;
|
||||
VERIFY_GEOMDB( pGeomDB, GDB_ID_NULL)
|
||||
// recupero il gestore dei dati della fotografia dell'oggetto
|
||||
PhotoObj* pPhoto = dynamic_cast<PhotoObj*>( pGeomDB->GetUserObj( nId)) ;
|
||||
if ( pPhoto == nullptr)
|
||||
return false ;
|
||||
// imposto la nuova path della fotografia
|
||||
return pPhoto->ChangePath( sPath) ;
|
||||
}
|
||||
Reference in New Issue
Block a user