The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Verified Commit 612626b7 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

adapted to tlibs2 changes

parent 6469c34b
......@@ -536,10 +536,10 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlot->setWindowTitle("Unit Cell");
m_plot = std::make_shared<GlPlot>(this);
m_plot->GetImpl()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetImpl()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetImpl()->SetCoordMax(1.);
m_plot->GetImpl()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
m_plot->GetRenderer()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetRenderer()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetRenderer()->SetCoordMax(1.);
m_plot->GetRenderer()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
tl2::create<t_vec_gl>({1,0,0,0}), tl2::create<t_vec_gl>({0,0,1,0}));
......@@ -564,13 +564,13 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
connect(m_plot.get(), &GlPlot::AfterGLInitialisation, this, &MagStructFactDlg::AfterGLInitialisation);
connect(m_plot->GetImpl(), &GlPlot_impl::PickerIntersection, this, &MagStructFactDlg::PickerIntersection);
connect(m_plot->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &MagStructFactDlg::PickerIntersection);
connect(m_plot.get(), &GlPlot::MouseDown, this, &MagStructFactDlg::PlotMouseDown);
//connect(m_plot.get(), &GlPlot::MouseUp, this, [this](bool left, bool mid, bool right) {});
connect(comboCoordSys, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int val)
{
if(this->m_plot)
this->m_plot->GetImpl()->SetCoordSys(val);
this->m_plot->GetRenderer()->SetCoordSys(val);
});
......@@ -596,10 +596,10 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
m_dlgPlotSC->setWindowTitle("Super Cell");
m_plotSC = std::make_shared<GlPlot>(this);
m_plotSC->GetImpl()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plotSC->GetImpl()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plotSC->GetImpl()->SetCoordMax(1.);
m_plotSC->GetImpl()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
m_plotSC->GetRenderer()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plotSC->GetRenderer()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plotSC->GetRenderer()->SetCoordMax(1.);
m_plotSC->GetRenderer()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
tl2::create<t_vec_gl>({1,0,0,0}), tl2::create<t_vec_gl>({0,0,1,0}));
......@@ -624,13 +624,13 @@ MagStructFactDlg::MagStructFactDlg(QWidget* pParent) : QDialog{pParent},
connect(m_plotSC.get(), &GlPlot::AfterGLInitialisation, this, &MagStructFactDlg::AfterGLInitialisationSC);
connect(m_plotSC->GetImpl(), &GlPlot_impl::PickerIntersection, this, &MagStructFactDlg::PickerIntersectionSC);
connect(m_plotSC->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &MagStructFactDlg::PickerIntersectionSC);
//connect(m_plotSC.get(), &GlPlot::MouseDown, this, [this](bool left, bool mid, bool right) {});
//connect(m_plotSC.get(), &GlPlot::MouseUp, this, [this](bool left, bool mid, bool right) {});
connect(comboCoordSys, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int val)
{
if(this->m_plotSC)
this->m_plotSC->GetImpl()->SetCoordSys(val);
this->m_plotSC->GetRenderer()->SetCoordSys(val);
});
......@@ -737,10 +737,10 @@ void MagStructFactDlg::Add3DItem(int row)
return;
}
auto objSphere = m_plot->GetImpl()->AddLinkedObject(m_sphere, 0,0,0, 1,1,1,1);
//auto obj = m_plot->GetImpl()->AddSphere(0.05, 0,0,0, 1,1,1,1);
auto objArrowRe = m_plot->GetImpl()->AddLinkedObject(m_arrow, 0,0,0, 1,1,1,1);
auto objArrowIm = m_plot->GetImpl()->AddLinkedObject(m_arrow, 0,0,0, 1,1,1,1);
auto objSphere = m_plot->GetRenderer()->AddLinkedObject(m_sphere, 0,0,0, 1,1,1,1);
//auto obj = m_plot->GetRenderer()->AddSphere(0.05, 0,0,0, 1,1,1,1);
auto objArrowRe = m_plot->GetRenderer()->AddLinkedObject(m_arrow, 0,0,0, 1,1,1,1);
auto objArrowIm = m_plot->GetRenderer()->AddLinkedObject(m_arrow, 0,0,0, 1,1,1,1);
m_nuclei->item(row, COL_NAME)->setData(Qt::UserRole+0, unsigned(objSphere)); // atomic position
m_nuclei->item(row, COL_NAME)->setData(Qt::UserRole+1, unsigned(objArrowRe)); // real part of Fourier comp
......@@ -810,7 +810,7 @@ void MagStructFactDlg::Sync3DItem(int row)
auto normReM = tl2::norm<t_vec_gl>(vecReM);
auto normImM = tl2::norm<t_vec_gl>(vecImM);
t_mat_gl matArrowRe = GlPlot_impl::GetArrowMatrix(
t_mat_gl matArrowRe = GlPlotRenderer::GetArrowMatrix(
vecReM, // to
1, // post-scale
tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
......@@ -819,7 +819,7 @@ void MagStructFactDlg::Sync3DItem(int row)
tl2::create<t_vec_gl>({posx, posy, posz}) // pre-translate
);
t_mat_gl matArrowIm = GlPlot_impl::GetArrowMatrix(
t_mat_gl matArrowIm = GlPlotRenderer::GetArrowMatrix(
vecImM, // to
1, // post-scale
tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
......@@ -828,15 +828,15 @@ void MagStructFactDlg::Sync3DItem(int row)
tl2::create<t_vec_gl>({posx, posy, posz}) // pre-translate
);
m_plot->GetImpl()->SetObjectMatrix(objSphere, matSphere);
m_plot->GetImpl()->SetObjectMatrix(objArrowRe, matArrowRe);
m_plot->GetImpl()->SetObjectMatrix(objArrowIm, matArrowIm);
m_plot->GetImpl()->SetObjectLabel(objSphere, itemName->text().toStdString());
m_plot->GetImpl()->SetObjectCol(objSphere, r, g, b, 1);
m_plot->GetImpl()->SetObjectCol(objArrowRe, r, g, b, 1);
m_plot->GetImpl()->SetObjectCol(objArrowIm, 1.-r, 1.-g, 1.-b, 1);
m_plot->GetImpl()->SetObjectVisible(objArrowRe, !tl2::equals<t_real_gl>(normReM, 0, g_eps));
m_plot->GetImpl()->SetObjectVisible(objArrowIm, !tl2::equals<t_real_gl>(normImM, 0, g_eps));
m_plot->GetRenderer()->SetObjectMatrix(objSphere, matSphere);
m_plot->GetRenderer()->SetObjectMatrix(objArrowRe, matArrowRe);
m_plot->GetRenderer()->SetObjectMatrix(objArrowIm, matArrowIm);
m_plot->GetRenderer()->SetObjectLabel(objSphere, itemName->text().toStdString());
m_plot->GetRenderer()->SetObjectCol(objSphere, r, g, b, 1);
m_plot->GetRenderer()->SetObjectCol(objArrowRe, r, g, b, 1);
m_plot->GetRenderer()->SetObjectCol(objArrowIm, 1.-r, 1.-g, 1.-b, 1);
m_plot->GetRenderer()->SetObjectVisible(objArrowRe, !tl2::equals<t_real_gl>(normReM, 0, g_eps));
m_plot->GetRenderer()->SetObjectVisible(objArrowIm, !tl2::equals<t_real_gl>(normImM, 0, g_eps));
m_plot->update();
}
......@@ -853,11 +853,11 @@ void MagStructFactDlg::DelTabItem(int begin, int end)
for(int row=0; row<m_nuclei->rowCount(); ++row)
{
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+0).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+1).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+2).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
}
m_plot->update();
}
......@@ -873,11 +873,11 @@ void MagStructFactDlg::DelTabItem(int begin, int end)
if(m_plot)
{
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+0).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+1).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+2).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
m_plot->update();
}
......@@ -892,11 +892,11 @@ void MagStructFactDlg::DelTabItem(int begin, int end)
if(m_plot)
{
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+0).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+1).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
if(std::size_t obj = m_nuclei->item(row, COL_NAME)->data(Qt::UserRole+2).toUInt(); obj)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
m_plot->update();
}
......@@ -1624,12 +1624,12 @@ void MagStructFactDlg::CalcB(bool bFullRecalc)
if(m_plot)
{
t_mat_gl matA{m_crystA};
m_plot->GetImpl()->SetBTrafo(m_crystB, &matA);
m_plot->GetRenderer()->SetBTrafo(m_crystB, &matA);
}
if(m_plotSC)
{
t_mat_gl matA{m_crystA};
m_plotSC->GetImpl()->SetBTrafo(m_crystB, &matA);
m_plotSC->GetRenderer()->SetBTrafo(m_crystB, &matA);
}
if(bFullRecalc)
......@@ -1853,7 +1853,7 @@ void MagStructFactDlg::Calc()
if(m_plotSC)
{
for(auto obj : m_3dobjsSC)
m_plotSC->GetImpl()->RemoveObject(obj);
m_plotSC->GetRenderer()->RemoveObject(obj);
m_3dobjsSC.clear();
}
......@@ -1920,8 +1920,8 @@ void MagStructFactDlg::Calc()
// add 3d objs to super cell view
if(m_plotSC)
{
auto objArrowRe = m_plotSC->GetImpl()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1);
auto objArrowIm = m_plotSC->GetImpl()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1);
auto objArrowRe = m_plotSC->GetRenderer()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1);
auto objArrowIm = m_plotSC->GetRenderer()->AddLinkedObject(m_arrowSC, 0,0,0, 1,1,1,1);
auto [_vecReM, _vecImM] = tl2::split_cplx<t_vec_cplx, t_vec>(moment);
auto vecReM = tl2::convert<t_vec_gl>(_vecReM);
......@@ -1930,7 +1930,7 @@ void MagStructFactDlg::Calc()
auto normReM = tl2::norm<t_vec_gl>(vecReM);
auto normImM = tl2::norm<t_vec_gl>(vecImM);
t_mat_gl matArrowRe = GlPlot_impl::GetArrowMatrix(
t_mat_gl matArrowRe = GlPlotRenderer::GetArrowMatrix(
vecReM, // to
1, // post-scale
tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
......@@ -1939,7 +1939,7 @@ void MagStructFactDlg::Calc()
posGL // pre-translate
);
t_mat_gl matArrowIm = GlPlot_impl::GetArrowMatrix(
t_mat_gl matArrowIm = GlPlotRenderer::GetArrowMatrix(
vecImM, // to
1, // post-scale
tl2::create<t_vec_gl>({0, 0, 0}), // post-translate
......@@ -1956,16 +1956,16 @@ void MagStructFactDlg::Calc()
<< "Im{M} = (" << moment[0].imag() << " " << moment[1].imag() << " " << moment[2].imag() << "); "
<< "r = (" << thepos[0] << " " << thepos[1] << " " << thepos[2] << ")";
m_plotSC->GetImpl()->SetObjectMatrix(objArrowRe, matArrowRe);
m_plotSC->GetImpl()->SetObjectMatrix(objArrowIm, matArrowIm);
m_plotSC->GetImpl()->SetObjectCol(objArrowRe, r, g, b, 1.);
m_plotSC->GetImpl()->SetObjectCol(objArrowIm, 1.-r, 1.-g, 1.-b, 1.);
//m_plotSC->GetImpl()->SetObjectLabel(objArrowRe, name + " (real)");
//m_plotSC->GetImpl()->SetObjectLabel(objArrowIm, name + " (imag)");
m_plotSC->GetImpl()->SetObjectDataString(objArrowRe, name + " (real); " + ostrMom.str());
m_plotSC->GetImpl()->SetObjectDataString(objArrowIm, name + " (imag); " + ostrMom.str());
m_plotSC->GetImpl()->SetObjectVisible(objArrowRe, !tl2::equals<t_real_gl>(normReM, 0, g_eps));
m_plotSC->GetImpl()->SetObjectVisible(objArrowIm, !tl2::equals<t_real_gl>(normImM, 0, g_eps));
m_plotSC->GetRenderer()->SetObjectMatrix(objArrowRe, matArrowRe);
m_plotSC->GetRenderer()->SetObjectMatrix(objArrowIm, matArrowIm);
m_plotSC->GetRenderer()->SetObjectCol(objArrowRe, r, g, b, 1.);
m_plotSC->GetRenderer()->SetObjectCol(objArrowIm, 1.-r, 1.-g, 1.-b, 1.);
//m_plotSC->GetRenderer()->SetObjectLabel(objArrowRe, name + " (real)");
//m_plotSC->GetRenderer()->SetObjectLabel(objArrowIm, name + " (imag)");
m_plotSC->GetRenderer()->SetObjectDataString(objArrowRe, name + " (real); " + ostrMom.str());
m_plotSC->GetRenderer()->SetObjectDataString(objArrowIm, name + " (imag); " + ostrMom.str());
m_plotSC->GetRenderer()->SetObjectVisible(objArrowRe, !tl2::equals<t_real_gl>(normReM, 0, g_eps));
m_plotSC->GetRenderer()->SetObjectVisible(objArrowIm, !tl2::equals<t_real_gl>(normImM, 0, g_eps));
m_3dobjsSC.push_back(objArrowRe);
m_3dobjsSC.push_back(objArrowIm);
......@@ -2055,7 +2055,7 @@ void MagStructFactDlg::PickerIntersectionSC(const t_vec3_gl* pos, std::size_t ob
{
if(pos && m_plotSC)
{
const std::string& str = m_plotSC->GetImpl()->GetObjectDataString(objIdx);
const std::string& str = m_plotSC->GetRenderer()->GetObjectDataString(objIdx);
m_status3DSC->setText(str.c_str());
}
else
......@@ -2099,13 +2099,13 @@ void MagStructFactDlg::AfterGLInitialisation()
SetGLInfos();
// reference sphere and arrow for linked objects
m_sphere = m_plot->GetImpl()->AddSphere(0.05, 0.,0.,0., 1.,1.,1.,1.);
m_arrow = m_plot->GetImpl()->AddArrow(0.015, 0.25, 0.,0.,0.5, 1.,1.,1.,1.);
m_plot->GetImpl()->SetObjectVisible(m_sphere, false);
m_plot->GetImpl()->SetObjectVisible(m_arrow, false);
m_sphere = m_plot->GetRenderer()->AddSphere(0.05, 0.,0.,0., 1.,1.,1.,1.);
m_arrow = m_plot->GetRenderer()->AddArrow(0.015, 0.25, 0.,0.,0.5, 1.,1.,1.,1.);
m_plot->GetRenderer()->SetObjectVisible(m_sphere, false);
m_plot->GetRenderer()->SetObjectVisible(m_arrow, false);
// B matrix
m_plot->GetImpl()->SetBTrafo(m_crystB);
m_plot->GetRenderer()->SetBTrafo(m_crystB);
// add all 3d objects
Add3DItem(-1);
......@@ -2121,13 +2121,13 @@ void MagStructFactDlg::AfterGLInitialisationSC()
SetGLInfos();
// reference sphere and arrow for linked objects
m_sphereSC = m_plotSC->GetImpl()->AddSphere(0.05, 0.,0.,0., 1.,1.,1.,1.);
m_arrowSC = m_plotSC->GetImpl()->AddArrow(0.015, 0.25, 0.,0.,0.5, 1.,1.,1.,1.);
m_plotSC->GetImpl()->SetObjectVisible(m_sphereSC, false);
m_plotSC->GetImpl()->SetObjectVisible(m_arrowSC, false);
m_sphereSC = m_plotSC->GetRenderer()->AddSphere(0.05, 0.,0.,0., 1.,1.,1.,1.);
m_arrowSC = m_plotSC->GetRenderer()->AddArrow(0.015, 0.25, 0.,0.,0.5, 1.,1.,1.,1.);
m_plotSC->GetRenderer()->SetObjectVisible(m_sphereSC, false);
m_plotSC->GetRenderer()->SetObjectVisible(m_arrowSC, false);
// B matrix
m_plotSC->GetImpl()->SetBTrafo(m_crystB);
m_plotSC->GetRenderer()->SetBTrafo(m_crystB);
// add all 3d objects (generated in calc)
Calc();
......@@ -2147,7 +2147,7 @@ void MagStructFactDlg::SetGLInfos()
{
if(!plot) continue;
auto [strGlVer, strGlShaderVer, strGlVendor, strGlRenderer] = plot->GetImpl()->GetGlDescr();
auto [strGlVer, strGlShaderVer, strGlVendor, strGlRenderer] = plot->GetRenderer()->GetGlDescr();
m_labelGlInfos[0]->setText(QString("GL Version: ") + strGlVer.c_str() + QString("."));
m_labelGlInfos[1]->setText(QString("GL Shader Version: ") + strGlShaderVer.c_str() + QString("."));
m_labelGlInfos[2]->setText(QString("GL Vendor: ") + strGlVendor.c_str() + QString("."));
......
......@@ -222,16 +222,16 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
m_plot = new GlPlot(this);
m_plot->setSizePolicy(QSizePolicy{QSizePolicy::Expanding, QSizePolicy::Expanding});
m_plot->GetImpl()->EnablePicker(1);
m_plot->GetImpl()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetImpl()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetImpl()->SetCoordMax(1.);
m_plot->GetImpl()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
m_plot->GetRenderer()->EnablePicker(1);
m_plot->GetRenderer()->SetLight(0, tl2::create<t_vec3_gl>({ 5, 5, 5 }));
m_plot->GetRenderer()->SetLight(1, tl2::create<t_vec3_gl>({ -5, -5, -5 }));
m_plot->GetRenderer()->SetCoordMax(1.);
m_plot->GetRenderer()->SetCamBase(tl2::create<t_mat_gl>({1,0,0,0, 0,0,1,0, 0,-1,0,-1.5, 0,0,0,1}),
tl2::create<t_vec_gl>({1,0,0,0}), tl2::create<t_vec_gl>({0,0,1,0}));
connect(m_plot, &GlPlot::AfterGLInitialisation, this, &MolDynDlg::AfterGLInitialisation);
connect(m_plot, &GlPlot::GLInitialisationFailed, this, &MolDynDlg::GLInitialisationFailed);
connect(m_plot->GetImpl(), &GlPlot_impl::PickerIntersection, this, &MolDynDlg::PickerIntersection);
connect(m_plot->GetRenderer(), &GlPlotRenderer::PickerIntersection, this, &MolDynDlg::PickerIntersection);
connect(m_plot, &GlPlot::MouseDown, this, &MolDynDlg::PlotMouseDown);
connect(m_plot, &GlPlot::MouseUp, this, &MolDynDlg::PlotMouseUp);
connect(m_plot, &GlPlot::MouseClick, this, &MolDynDlg::PlotMouseClick);
......@@ -274,7 +274,7 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
connect(comboCoordSys, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, [this](int val)
{
if(this->m_plot)
this->m_plot->GetImpl()->SetCoordSys(val);
this->m_plot->GetRenderer()->SetCoordSys(val);
});
connect(m_spinScale, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, [this](double val)
{
......@@ -310,7 +310,7 @@ MolDynDlg::MolDynDlg(QWidget* pParent) : QMainWindow{pParent},
*/
std::size_t MolDynDlg::Add3DAtom(const t_vec& vec, const t_vec& col, t_real scale, const std::string& typelabel, int atomindex)
{
auto obj = m_plot->GetImpl()->AddLinkedObject(m_sphere, 0,0,0, col[0],col[1],col[2],1);
auto obj = m_plot->GetRenderer()->AddLinkedObject(m_sphere, 0,0,0, col[0],col[1],col[2],1);
Change3DAtom(obj, &vec, &col, &scale, &typelabel, atomindex);
return obj;
}
......@@ -328,17 +328,17 @@ void MolDynDlg::Change3DAtom(std::size_t obj, const t_vec *vec, const t_vec *col
t_real_gl((*vec)[0]), t_real_gl((*vec)[1]), t_real_gl((*vec)[2]));
if(scale) mat *= tl2::hom_scaling<t_mat_gl>(
t_real_gl(*scale), t_real_gl(*scale), t_real_gl(*scale));
m_plot->GetImpl()->SetObjectMatrix(obj, mat);
m_plot->GetRenderer()->SetObjectMatrix(obj, mat);
}
if(col) m_plot->GetImpl()->SetObjectCol(obj, (*col)[0], (*col)[1], (*col)[2], 1);
if(col) m_plot->GetRenderer()->SetObjectCol(obj, (*col)[0], (*col)[1], (*col)[2], 1);
if(label)
{
std::ostringstream ostrData;
ostrData << *label << DATA_SEP << atomindex;
m_plot->GetImpl()->SetObjectLabel(obj, *label);
m_plot->GetImpl()->SetObjectDataString(obj, ostrData.str());
m_plot->GetRenderer()->SetObjectLabel(obj, *label);
m_plot->GetRenderer()->SetObjectDataString(obj, ostrData.str());
}
}
// ----------------------------------------------------------------------------
......@@ -355,10 +355,10 @@ std::vector<std::tuple<std::size_t, std::size_t>> MolDynDlg::GetSelectedAtoms()
for(const auto& obj : m_sphereHandles)
{
// continue if object isn't selected
if(!m_plot->GetImpl()->GetObjectHighlight(obj))
if(!m_plot->GetRenderer()->GetObjectHighlight(obj))
continue;
//const auto [typelabel, _atomSubTypeIdx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(obj));
//const auto [typelabel, _atomSubTypeIdx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(obj));
// get indices for selected atoms
const auto [bOk, atomTypeIdx, atomSubTypeIdx, sphereIdx] = GetAtomIndexFromHandle(obj);
......@@ -675,7 +675,7 @@ void MolDynDlg::CalculateConvexHulls()
// remove old plot object
if(hull.plotObj)
{
m_plot->GetImpl()->RemoveObject(*hull.plotObj);
m_plot->GetRenderer()->RemoveObject(*hull.plotObj);
hull.plotObj.reset();
}
......@@ -705,7 +705,7 @@ void MolDynDlg::CalculateConvexHulls()
glnormals.emplace_back(tl2::convert<t_vec3_gl, t_vec>(normal));
}
hull.plotObj = m_plot->GetImpl()->AddTriangleObject(glvertices, glnormals, 0,0,1,0.5);
hull.plotObj = m_plot->GetRenderer()->AddTriangleObject(glvertices, glnormals, 0,0,1,0.5);
// TODO
}
......@@ -727,13 +727,13 @@ void MolDynDlg::New()
for(auto& hull : m_hulls)
{
if(hull.plotObj)
m_plot->GetImpl()->RemoveObject(*hull.plotObj);
m_plot->GetRenderer()->RemoveObject(*hull.plotObj);
}
m_hulls.clear();
for(const auto& obj : m_sphereHandles)
m_plot->GetImpl()->RemoveObject(obj);
m_plot->GetRenderer()->RemoveObject(obj);
m_sphereHandles.clear();
m_sliderFrame->setValue(0);
......@@ -810,7 +810,7 @@ void MolDynDlg::Load()
m_crystB /= t_real_gl(2)*tl2::pi<t_real_gl>;
t_mat_gl matA{m_crystA};
m_plot->GetImpl()->SetBTrafo(m_crystB, &matA);
m_plot->GetRenderer()->SetBTrafo(m_crystB, &matA);
std::cout << "A matrix: " << m_crystA << ", \n"
<< "B matrix: " << m_crystB << "." << std::endl;
......@@ -919,7 +919,7 @@ void MolDynDlg::PickerIntersection(const t_vec3_gl* pos, std::size_t objIdx, con
if(m_curPickedObj > 0)
{
const auto [typelabel, atomidx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(m_curPickedObj));
const auto [typelabel, atomidx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(m_curPickedObj));
std::ostringstream ostrLabel;
ostrLabel << "Current Atom: " << typelabel << " #" << (atomidx+1);
......@@ -961,7 +961,7 @@ void MolDynDlg::UpdateAtomsStatusMsg()
for(auto handle : m_sphereHandles)
{
if(m_plot->GetImpl()->GetObjectHighlight(handle))
if(m_plot->GetRenderer()->GetObjectHighlight(handle))
++numSelected;
}
......@@ -985,7 +985,7 @@ void MolDynDlg::PlotMouseDown(bool left, bool mid, bool right)
if(left && m_curPickedObj > 0)
{
m_plot->GetImpl()->SetObjectHighlight(m_curPickedObj, !m_plot->GetImpl()->GetObjectHighlight(m_curPickedObj));
m_plot->GetRenderer()->SetObjectHighlight(m_curPickedObj, !m_plot->GetRenderer()->GetObjectHighlight(m_curPickedObj));
UpdateAtomsStatusMsg();
m_plot->update();
}
......@@ -1008,7 +1008,7 @@ void MolDynDlg::PlotMouseClick(bool left, bool mid, bool right)
// show context menu
if(right && m_curPickedObj > 0)
{
const auto [typelabel, atomidx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(m_curPickedObj));
const auto [typelabel, atomidx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(m_curPickedObj));
QString atomLabel = typelabel.c_str();
m_atomContextMenu->actions()[0]->setText("Delete This \"" + atomLabel + "\" Atom");
......@@ -1034,7 +1034,7 @@ void MolDynDlg::SelectAll()
if(!m_plot) return;
for(auto handle : m_sphereHandles)
m_plot->GetImpl()->SetObjectHighlight(handle, 1);
m_plot->GetRenderer()->SetObjectHighlight(handle, 1);
UpdateAtomsStatusMsg();
m_plot->update();
......@@ -1049,7 +1049,7 @@ void MolDynDlg::SelectNone()
if(!m_plot) return;
for(auto handle : m_sphereHandles)
m_plot->GetImpl()->SetObjectHighlight(handle, 0);
m_plot->GetRenderer()->SetObjectHighlight(handle, 0);
UpdateAtomsStatusMsg();
m_plot->update();
......@@ -1084,7 +1084,9 @@ void MolDynDlg::SliderValueChanged(int val)
}
}
#ifdef USE_QHULL
CalculateConvexHulls();
#endif
UpdateAtomsStatusMsg();
m_plot->update();
}
......@@ -1152,13 +1154,13 @@ void MolDynDlg::SelectAtomsOfSameType()
return;
// atom type to be selected
const auto [atomLabel, atomidx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(m_curPickedObj));
const auto [atomLabel, atomidx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(m_curPickedObj));
for(auto handle : m_sphereHandles)
{
const auto [typelabel, atomidx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(handle));
const auto [typelabel, atomidx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(handle));
if(typelabel == atomLabel)
m_plot->GetImpl()->SetObjectHighlight(handle, 1);
m_plot->GetRenderer()->SetObjectHighlight(handle, 1);
}
UpdateAtomsStatusMsg();
......@@ -1176,7 +1178,7 @@ void MolDynDlg::DeleteSelectedAtoms()
for(auto iter=m_sphereHandles.begin(); iter!=m_sphereHandles.end();)
{
auto handle = *iter;
if(m_plot->GetImpl()->GetObjectHighlight(handle))
if(m_plot->GetRenderer()->GetObjectHighlight(handle))
{
const auto [bOk, atomTypeIdx, atomSubTypeIdx, sphereIdx] = GetAtomIndexFromHandle(handle);
if(!bOk)
......@@ -1186,7 +1188,7 @@ void MolDynDlg::DeleteSelectedAtoms()
}
// remove 3d objects
m_plot->GetImpl()->RemoveObject(handle);
m_plot->GetRenderer()->RemoveObject(handle);
iter = m_sphereHandles.erase(iter);
// remove atom
......@@ -1215,7 +1217,7 @@ void MolDynDlg::OnlyKeepSelectedAtoms()
for(auto iter=m_sphereHandles.begin(); iter!=m_sphereHandles.end();)
{
auto handle = *iter;
if(!m_plot->GetImpl()->GetObjectHighlight(handle))
if(!m_plot->GetRenderer()->GetObjectHighlight(handle))
{
const auto [bOk, atomTypeIdx, atomSubTypeIdx, sphereIdx] = GetAtomIndexFromHandle(handle);
if(!bOk)
......@@ -1225,7 +1227,7 @@ void MolDynDlg::OnlyKeepSelectedAtoms()
}
// remove 3d objects
m_plot->GetImpl()->RemoveObject(handle);
m_plot->GetRenderer()->RemoveObject(handle);
iter = m_sphereHandles.erase(iter);
// remove atom
......@@ -1254,7 +1256,7 @@ void MolDynDlg::DeleteAtomUnderCursor()
return;
// atom type to be deleted
const auto [atomLabel, atomidx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(m_curPickedObj));
const auto [atomLabel, atomidx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(m_curPickedObj));
const auto [bOk, atomTypeIdx, atomSubTypeIdx, sphereIdx] = GetAtomIndexFromHandle(m_curPickedObj);
if(!bOk)
{
......@@ -1269,7 +1271,7 @@ void MolDynDlg::DeleteAtomUnderCursor()
}
// remove 3d objects
m_plot->GetImpl()->RemoveObject(m_sphereHandles[sphereIdx]);
m_plot->GetRenderer()->RemoveObject(m_sphereHandles[sphereIdx]);
m_sphereHandles.erase(m_sphereHandles.begin()+sphereIdx);
// remove atom
......@@ -1291,7 +1293,7 @@ void MolDynDlg::DeleteAllAtomsOfSameType()
return;
// atom type to be deleted
const auto [atomLabel, atomidx] = SplitDataString(m_plot->GetImpl()->GetObjectDataString(m_curPickedObj));
const auto [atomLabel, atomidx] = SplitDataString(m_plot->GetRenderer()->GetObjectDataString(m_curPickedObj));
std::size_t startIdx = 0;
std::size_t totalRemoved = 0;
......@@ -1303,7 +1305,7 @@ void MolDynDlg::DeleteAllAtomsOfSameType()
{
// remove 3d objects
for(std::size_t sphereIdx=startIdx; sphereIdx<startIdx+numAtoms; ++sphereIdx)
m_plot->GetImpl()->RemoveObject(m_sphereHandles[sphereIdx]);
m_plot->GetRenderer()->RemoveObject(m_sphereHandles[sphereIdx]);
m_sphereHandles.erase(m_sphereHandles.begin()+startIdx, m_sphereHandles.begin()+startIdx+numAtoms);
// remove atoms
......@@ -1334,7 +1336,7 @@ void MolDynDlg::KeepAtomsOfSameType()
return;
// atom type to be deleted
const std::string& atomLabel = m_plot->GetImpl()->GetObjectDataString(m_curPickedObj);
const std::string& atomLabel = m_plot->GetRenderer()->GetObjectDataString(m_curPickedObj);
std::size_t startIdx = 0;
std::size_t totalRemoved = 0;
......@@ -1346,7 +1348,7 @@ void MolDynDlg::KeepAtomsOfSameType()
{
// remove 3d objects
for(std::size_t sphereIdx=startIdx; sphereIdx<startIdx+numAtoms; ++sphereIdx)
m_plot->GetImpl()->RemoveObject(m_sphereHandles[sphereIdx]);
m_plot->GetRenderer()->RemoveObject(m_sphereHandles[sphereIdx]);
m_sphereHandles.erase(m_sphereHandles.begin()+startIdx, m_sphereHandles.begin()+startIdx+numAtoms);
// remove atoms
......@@ -1374,16 +1376,16 @@ void MolDynDlg::AfterGLInitialisation()
if(!m_plot) return;
// reference sphere for linked objects
m_sphere = m_plot->GetImpl()->AddSphere(0.05, 0.,0.,0., 1.,1.,1.,1.);