41 #include "../../materials/gpuinterpolationmaterial.h"
42 #include "../../3dhelpers/custommesh.h"
48 #include <Qt3DCore/QEntity>
49 #include <Qt3DCore/QTransform>
50 #include <Qt3DRender/QComputeCommand>
51 #include <Qt3DRender/QGeometryRenderer>
62 using namespace DISP3DLIB;
63 using namespace Qt3DRender;
64 using namespace Qt3DCore;
65 using namespace Eigen;
77 , m_bIsDataInit(false)
80 , m_pInterpolationMatBuffer(new QT_COMPATIBILITY_3D::QBuffer())
81 , m_pOutputColorBuffer(new QT_COMPATIBILITY_3D::QBuffer())
82 , m_pSignalDataBuffer(new QT_COMPATIBILITY_3D::QBuffer())
98 const MatrixX3f &matNormals,
99 const MatrixX3i &matTriangles)
103 qDebug(
"GpuInterpolationItem::initData data already initialized");
108 QT_COMPATIBILITY_3D::QAttribute* pInterpolatedSignalAttrib =
new QAttribute;
109 pInterpolatedSignalAttrib->setAttributeType(QT_COMPATIBILITY_3D::QAttribute::VertexAttribute);
110 pInterpolatedSignalAttrib->setVertexBaseType(QT_COMPATIBILITY_3D::QAttribute::Float);
111 pInterpolatedSignalAttrib->setVertexSize(4);
112 pInterpolatedSignalAttrib->setByteOffset(0);
113 pInterpolatedSignalAttrib->setByteStride(4 *
sizeof(
float));
114 pInterpolatedSignalAttrib->setName(QStringLiteral(
"OutputColor"));
132 MatrixX4f matVertColor =
createVertColor(matVertices.rows(), QColor(0,0,0));
139 Qt3DRender::QGeometryRenderer::Triangles);
150 qDebug(
"GpuInterpolationItem::setInterpolationMatrix - item data is not initialized!");
161 this->
setMaterialParameter(QVariant::fromValue(pMatInterpolationMatrix->cols()), QStringLiteral(
"cols"));
162 this->
setMaterialParameter(QVariant::fromValue(pMatInterpolationMatrix->rows()), QStringLiteral(
"rows"));
172 const uint iWorkGroupsSize =
static_cast<uint
>(std::ceil(std::sqrt(pMatInterpolationMatrix->rows())));
203 qDebug(
"GpuInterpolationItem::setInterpolationMatrix - finished");
212 qDebug(
"GpuInterpolationItem::addNewRtData - item data is not initialized!");
216 const uint iSignalSize = tSignalVec.rows();
218 QByteArray bufferData (iSignalSize * (
int)
sizeof(
float),
'0');
219 float *rawVertexArray =
reinterpret_cast<float *
>(bufferData.data());
221 for(uint i = 0; i < iSignalSize; ++i)
223 rawVertexArray[i] =
static_cast<float>(tSignalVec[i]);
233 this->
setMaterialParameter(QVariant::fromValue(tVecThresholds.x()), QStringLiteral(
"fThresholdX"));
234 this->
setMaterialParameter(QVariant::fromValue(tVecThresholds.z()), QStringLiteral(
"fThresholdZ"));
242 if(tColormapType == QStringLiteral(
"Hot")) {
244 }
else if(tColormapType == QStringLiteral(
"Hot Negative 1")) {
246 }
else if(tColormapType == QStringLiteral(
"Hot Negative 2")) {
248 }
else if(tColormapType == QStringLiteral(
"Jet")) {
259 const uint iRows = pMatInterpolationMatrix->rows();
260 const uint iCols = pMatInterpolationMatrix->cols();
268 QByteArray bufferData (iRows * iCols * (
int)
sizeof(
float),
'0');
272 float *rawVertexArray =
reinterpret_cast<float *
>(bufferData.data());
274 unsigned int iCtr = 0;
275 for(uint i = 0; i < iRows; ++i) {
276 for(uint j = 0; j < iCols; ++j) {
277 rawVertexArray[iCtr] =
static_cast<float>(pMatInterpolationMatrix->coeff(i, j));
292 QByteArray bufferData (tSize * (
int)
sizeof(
float),
'0');
293 float *rawVertexArray =
reinterpret_cast<float *
>(bufferData.data());
298 for(uint i = 0; i < tSize; ++i) {
299 rawVertexArray[i] = 0.0f;