From b2e60057005dfc6cd5bae8cf9c215375a7c3e1a3 Mon Sep 17 00:00:00 2001 From: "riccardo.elitropi" Date: Thu, 25 Aug 2022 09:26:24 +0200 Subject: [PATCH] EgtExchange : - esportazione con menu e file geometrie separati --- ExportThreeJS.cpp | 276 +++++++++++++++------------------------------- 1 file changed, 91 insertions(+), 185 deletions(-) diff --git a/ExportThreeJS.cpp b/ExportThreeJS.cpp index b71edc6..fe1da04 100644 --- a/ExportThreeJS.cpp +++ b/ExportThreeJS.cpp @@ -65,81 +65,9 @@ ExportThreeJS::SetOptions( int nFilter) bool ExportThreeJS::Export( IGeomDB* pGDB, int nId, const string& sFile, const string& sFileM, IEGrScene* pScene) { - /* - m_Writer.Close(); - if (!m_Writer.Init(sFile)) { - LOG_ERROR(GetEExLogger(), "ExportThreeJS : Error on open file") - return false; - } - - ISurfTriMesh* miaSurf = GetSurfTriMesh(pGDB->GetGeoObj(1117)); - ICurveComposite* miaCurvaSotto = GetCurveComposite(pGDB->GetGeoObj(1332)); - double Bi, Bf; - miaCurvaSotto->GetDomain(Bi, Bf); - ICurveComposite* miaCurvaSopra = GetCurveComposite(pGDB->GetGeoObj(1333)); - double Ti, Tf; - miaCurvaSopra->GetDomain(Ti, Tf); - ICurveComposite* miaCurvaSinistra = GetCurveComposite(pGDB->GetGeoObj(1334)); - double Li, Lf; - miaCurvaSinistra->GetDomain(Li, Lf); - ICurveComposite* miaCurvaDestra = GetCurveComposite(pGDB->GetGeoObj(1335)); - double Ri, Rf; - miaCurvaDestra->GetDomain(Ri, Rf); - - int iTotT = miaSurf->GetTriangleCount(); - int nIdVert[3]; - Point3d punto; - double par; - string str; - for (int i = 0; i < iTotT; i++) - { - miaSurf->GetTriangle(i, nIdVert); - str = "["; - for (int j = 0; j < 3; j++) - { - str += "new THREE.Vector2"; - miaSurf->GetVertex(nIdVert[j], punto); - if (miaCurvaSotto->GetParamAtPoint(punto, par, 100*EPS_SMALL)) - { - par = par / Bf; - str += "(" + ToString(par) + ",0),"; - } - else if (miaCurvaSopra->GetParamAtPoint(punto, par, 100*EPS_SMALL)) - { - par = par / Tf; - str += "(" + ToString(par) + ",1),"; - } - else if (miaCurvaSinistra->GetParamAtPoint(punto, par, 100*EPS_SMALL)) - { - par = par / Lf; - str += "(0, " + ToString(par) + "),"; - } - else if (miaCurvaDestra->GetParamAtPoint(punto, par, 100*EPS_SMALL)) - { - par = par / Rf; - str += "(1," + ToString(par) + "),"; - } - else - { - m_Writer.OutText("Pizza"); - IGeoPoint3d* pt = CreateGeoPoint3d(); - pt->Set(punto); - pGDB->AddGeoObj(GDB_ID_NULL, GDB_ID_ROOT, pt->Clone()); - } - } - m_Writer.OutText(str + "],"); - } - - - if (!m_Writer.Close()) - return true; - - */ - - // verifico il DB geometrico if ( pGDB == nullptr) { - LOG_ERROR(GetEExLogger(), "ExportThreeJS : Error on GeomDB") + LOG_ERROR( GetEExLogger(), "ExportThreeJS : Error on GeomDB") return false ; } @@ -167,7 +95,6 @@ ExportThreeJS::Export( IGeomDB* pGDB, int nId, const string& sFile, const string } - // prelevo il Box3D globale (per ingombro e punto luce) BBox3d b3Globbox ; pGDB->GetGlobalBBox( nId, b3Globbox, BBF_ONLY_VISIBLE) ; @@ -187,27 +114,6 @@ ExportThreeJS::Export( IGeomDB* pGDB, int nId, const string& sFile, const string bOk = ExportObject( *pIter, pGDB, m_nGroupCount) ; // fine creazione menù con elementi globali m_Writer.OutText( " groupRoot.add(group0)"); - // --- m_Writer.OutText( " var reset = {") ; - // --- m_Writer.OutText( " 'Reset': function() {") ; - // --- m_Writer.OutText( " if (!first) {") ; - // --- m_Writer.OutText( " GetColorBack(LastGroupSelected)") ; - // --- m_Writer.OutText( " }") ; - // --- m_Writer.OutText( " }") ; - // --- m_Writer.OutText( " }") ; - // --- m_Writer.OutText( " gui.add(reset, 'Reset').name('Deselect all');") ; - // --- m_Writer.OutText( " const params = {" ) ; - // --- m_Writer.OutText( " textField: 'Type Name_Id'") ; - // --- m_Writer.OutText( " }") ; - // --- m_Writer.OutText( " gui.add(params, 'textField').onFinishChange(function(value) {") ; - // --- m_Writer.OutText( " if (value != '') {") ; - // --- m_Writer.OutText( " findGroupByNameAndId(groupRoot, value);") ; - // --- m_Writer.OutText( " if (!trovato) {") ; - // --- m_Writer.OutText( " GetColorBack(LastGroupSelected);") ; - // --- m_Writer.OutText( " window.alert('Element not found :(');") ; - // --- m_Writer.OutText( " }") ; - // --- m_Writer.OutText( " }") ; - // --- m_Writer.OutText( " trovato = false;"); - // --- m_Writer.OutText( " }).name('Code');") ; // creazione parte finale della pagina html bOk = FinishAmbient() ; @@ -253,7 +159,7 @@ ExportThreeJS::HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) // librerie // --- m_Writer.OutText( " ") ; <---- original // --- m_Writer.OutText( " ") ; <--- original - // --- m_Writer.OutText( " ") ; + // --- m_Writer.OutText( " ") ; <--- original // stile m_Writer.OutText( " ") ; - - m_Writer.OutText( " ") ; - m_Writer.OutText( " ") ; + // librerie (non moduli) + m_Writer.OutText( " ") ; //jquery + m_Writer.OutText( " ") ; //datGui m_Writer.OutText( " ") ; // body @@ -295,9 +201,9 @@ ExportThreeJS::HeadAmbient( IEGrScene* pScene, IGeomDB* pGDB, int nId) m_Writer.OutText( " ") ; // --- m_Writer.OutText( "