41 #include "../common/metatreeitem.h"
42 #include "../../materials/gpuinterpolationmaterial.h"
43 #include "../../materials/pervertexphongalphamaterial.h"
44 #include "../../materials/pervertextessphongalphamaterial.h"
45 #include "../../materials/shownormalsmaterial.h"
46 #include "../../3dhelpers/custommesh.h"
62 using namespace DISP3DLIB;
63 using namespace Eigen;
89 data.setValue(vertColor);
91 this->
setData(data, Data3DTreeModelItemRoles::SurfaceCurrentColorVert);
98 this->setEditable(
false);
99 this->setCheckable(
true);
100 this->setCheckState(Qt::Checked);
101 this->setToolTip(
"Abstract Mesh Tree Item");
104 QList<QStandardItem*> list;
109 pItemMaterialOptions->setEditable(
false);
111 list << pItemMaterialOptions;
112 list <<
new QStandardItem(
"The material options");
113 this->appendRow(list);
115 QString surfaceType(
"Phong Alpha");
120 list << pItemMaterialType;
121 list <<
new QStandardItem(pItemMaterialType->toolTip());
122 pItemMaterialOptions->appendRow(list);
123 data.setValue(QString(surfaceType));
124 pItemMaterialType->setData(data, MetaTreeItemRoles::SurfaceMaterial);
125 pItemMaterialType->setData(data, Qt::DecorationRole);
127 float fTessInner = 1.0;
132 list << itemTessInner;
133 list <<
new QStandardItem(itemTessInner->toolTip());
134 pItemMaterialOptions->appendRow(list);
135 data.setValue(fTessInner);
136 itemTessInner->setData(data, MetaTreeItemRoles::SurfaceTessInner);
138 float fTessOuter = 1.0;
143 list << itemTessOuter;
144 list <<
new QStandardItem(itemTessOuter->toolTip());
145 pItemMaterialOptions->appendRow(list);
146 data.setValue(fTessOuter);
147 itemTessOuter->setData(data, MetaTreeItemRoles::SurfaceTessOuter);
149 float fTriangleScale = 1.0;
150 MetaTreeItem *itemTriangleScale =
new MetaTreeItem(MetaTreeItemTypes::SurfaceTriangleScale, QString(
"%1").arg(fTriangleScale));
154 list << itemTriangleScale;
155 list <<
new QStandardItem(itemTriangleScale->toolTip());
156 pItemMaterialOptions->appendRow(list);
157 data.setValue(fTriangleScale);
158 itemTriangleScale->setData(data, MetaTreeItemRoles::SurfaceTriangleScale);
174 case Data3DTreeModelItemRoles::SurfaceCurrentColorVert:
187 void AbstractMeshTreeItem::setMaterial(Qt3DRender::QMaterial* pMaterial)
207 const MatrixX3f& tMatNorm,
208 const MatrixXi& tMatTris,
209 const MatrixX4f& tMatColors,
210 Qt3DRender::QGeometryRenderer::PrimitiveType primitiveType)
219 int iNumVerts = tMatVert.rows();
221 this->
setData(QVariant(iNumVerts), Data3DTreeModelItemRoles::NumberVertices);
251 MatrixX4f matNewVertColor =
createVertColor(this->data(Data3DTreeModelItemRoles::NumberVertices).toInt(),
252 color.value<QColor>());
254 data.setValue(matNewVertColor);
255 this->
setData(data, Data3DTreeModelItemRoles::SurfaceCurrentColorVert);
262 QPointer<Qt3DRender::QMaterial> pMaterial;
264 if(sMaterial.toString() ==
"Phong Alpha") {
267 m_pCustomMesh->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
269 }
else if(sMaterial.toString() ==
"Phong Alpha Tesselation") {
272 m_pCustomMesh->setPrimitiveType(Qt3DRender::QGeometryRenderer::Patches);
274 }
else if(sMaterial.toString() ==
"Show normals") {
277 m_pCustomMesh->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
279 }
else if(sMaterial.toString() ==
"GPU Interpolation") {
282 m_pCustomMesh->setPrimitiveType(Qt3DRender::QGeometryRenderer::Triangles);
286 this->setMaterial(pMaterial);