mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-13 00:07:24 +00:00
Merge branch 'cnr-isti-vclab:master' into master
This commit is contained in:
commit
10c271ccb5
@ -529,6 +529,33 @@ EigenMatrixX3m meshlab::vertexMatrix(const CMeshO& mesh)
|
||||
return vert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a #V*3 Eigen matrix of scalars containing the coordinates of the
|
||||
* vertices of a CMeshO, to which has been applied the transform matrix of the mesh.
|
||||
* The vertices in the mesh must be compact (no deleted vertices).
|
||||
* If the mesh is not compact, a vcg::MissingCompactnessException will be thrown.
|
||||
*
|
||||
* @param mesh: input mesh
|
||||
* @return #V*3 matrix of scalars (transformed vertex coordinates)
|
||||
*/
|
||||
EigenMatrixX3m meshlab::transformedVertexMatrix(const CMeshO &mesh)
|
||||
{
|
||||
vcg::tri::RequireVertexCompactness(mesh);
|
||||
|
||||
// create eigen matrix of vertices
|
||||
EigenMatrixX3m vert(mesh.VN(), 3);
|
||||
|
||||
// copy vertices
|
||||
for (int i = 0; i < mesh.VN(); i++) {
|
||||
CMeshO::CoordType p = mesh.Tr * mesh.vert[i].P();
|
||||
for (int j = 0; j < 3; j++) {
|
||||
vert(i, j) = p[j];
|
||||
}
|
||||
}
|
||||
|
||||
return vert;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a #F*3 Eigen matrix of integers containing the vertex indices of
|
||||
* a CMeshO.
|
||||
@ -635,6 +662,42 @@ EigenMatrixX3m meshlab::vertexNormalMatrix(const CMeshO& mesh)
|
||||
return vertexNormals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a #V*3 Eigen matrix of scalars containing the values of the
|
||||
* vertex normals of a CMeshO, to which has been applied the transform matrix of the mesh.
|
||||
* The vertices in the mesh must be compact (no deleted vertices).
|
||||
* If the mesh is not compact, a vcg::MissingCompactnessException will be thrown.
|
||||
*
|
||||
* @param mesh: input mesh
|
||||
* @return #V*3 matrix of scalars (transformed vertex normals)
|
||||
*/
|
||||
EigenMatrixX3m meshlab::transformedVertexNormalMatrix(const CMeshO &mesh)
|
||||
{
|
||||
vcg::tri::RequireVertexCompactness(mesh);
|
||||
|
||||
CMeshO::ScalarType scale;
|
||||
|
||||
vcg::Matrix33<CMeshO::ScalarType> mat33(mesh.Tr,3);
|
||||
scale = pow(mat33.Determinant(),(CMeshO::ScalarType)(1.0/3.0));
|
||||
CMeshO::CoordType scaleV(scale,scale,scale);
|
||||
vcg::Matrix33<CMeshO::ScalarType> S;
|
||||
S.SetDiagonal(scaleV.V());
|
||||
mat33*=S;
|
||||
|
||||
// create eigen matrix of vertex normals
|
||||
EigenMatrixX3m vertexNormals(mesh.VN(), 3);
|
||||
|
||||
// per vertices normals
|
||||
for (int i = 0; i < mesh.VN(); i++) {
|
||||
CMeshO::CoordType n = mat33 * mesh.vert[i].N();
|
||||
for (int j = 0; j < 3; j++) {
|
||||
vertexNormals(i, j) = n[j];
|
||||
}
|
||||
}
|
||||
|
||||
return vertexNormals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a #F*3 Eigen matrix of scalars containing the values of the
|
||||
* face normals of a CMeshO.
|
||||
@ -648,6 +711,42 @@ EigenMatrixX3m meshlab::faceNormalMatrix(const CMeshO& mesh)
|
||||
{
|
||||
vcg::tri::RequireFaceCompactness(mesh);
|
||||
|
||||
CMeshO::ScalarType scale;
|
||||
|
||||
vcg::Matrix33<CMeshO::ScalarType> mat33(mesh.Tr,3);
|
||||
scale = pow(mat33.Determinant(),(CMeshO::ScalarType)(1.0/3.0));
|
||||
CMeshO::CoordType scaleV(scale,scale,scale);
|
||||
vcg::Matrix33<CMeshO::ScalarType> S;
|
||||
S.SetDiagonal(scaleV.V());
|
||||
mat33*=S;
|
||||
|
||||
// create eigen matrix of face normals
|
||||
EigenMatrixX3m faceNormals(mesh.FN(), 3);
|
||||
|
||||
// per face normals
|
||||
for (int i = 0; i < mesh.FN(); i++) {
|
||||
CMeshO::CoordType n = mat33 * mesh.face[i].N();
|
||||
for (int j = 0; j < 3; j++) {
|
||||
faceNormals(i, j) = n[j];
|
||||
}
|
||||
}
|
||||
|
||||
return faceNormals;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Get a #F*3 Eigen matrix of scalars containing the values of the
|
||||
* face normals of a CMeshO, to which has been applied the transform matrix of the mesh.
|
||||
* The faces in the mesh must be compact (no deleted faces).
|
||||
* If the mesh is not compact, a vcg::MissingCompactnessException will be thrown.
|
||||
*
|
||||
* @param mesh: input mesh
|
||||
* @return #F*3 matrix of scalars (transformed face normals)
|
||||
*/
|
||||
EigenMatrixX3m meshlab::transformedFaceNormalMatrix(const CMeshO &mesh)
|
||||
{
|
||||
vcg::tri::RequireFaceCompactness(mesh);
|
||||
|
||||
// create eigen matrix of face normals
|
||||
EigenMatrixX3m faceNormals(mesh.FN(), 3);
|
||||
|
||||
@ -661,6 +760,7 @@ EigenMatrixX3m meshlab::faceNormalMatrix(const CMeshO& mesh)
|
||||
return faceNormals;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Get a #V*4 Eigen matrix of scalars containing the values of the
|
||||
* vertex colors of a CMeshO, each value in an interval [0, 1].
|
||||
|
||||
@ -84,11 +84,14 @@ void addFaceVectorAttribute(
|
||||
|
||||
// From CMeshO to Eigen
|
||||
EigenMatrixX3m vertexMatrix(const CMeshO& mesh);
|
||||
EigenMatrixX3m transformedVertexMatrix(const CMeshO& mesh);
|
||||
Eigen::MatrixX3i faceMatrix(const CMeshO& mesh);
|
||||
Eigen::MatrixX2i edgeMatrix(const CMeshO& mesh);
|
||||
std::list<EigenVectorXui> polygonalFaceList(const CMeshO& mesh);
|
||||
EigenMatrixX3m vertexNormalMatrix(const CMeshO& mesh);
|
||||
EigenMatrixX3m transformedVertexNormalMatrix(const CMeshO& mesh);
|
||||
EigenMatrixX3m faceNormalMatrix(const CMeshO& mesh);
|
||||
EigenMatrixX3m transformedFaceNormalMatrix(const CMeshO& mesh);
|
||||
EigenMatrixX4m vertexColorMatrix(const CMeshO& mesh);
|
||||
EigenMatrixX4m faceColorMatrix(const CMeshO& mesh);
|
||||
EigenVectorXui vertexColorArray(const CMeshO& mesh);
|
||||
|
||||
@ -67,7 +67,10 @@ void MeshShaderRenderPlugin::initActionList()
|
||||
{
|
||||
QDir shadersDir = QDir(meshlab::defaultShadersPath());
|
||||
|
||||
qDebug("Shader directory found '%s', and it contains %i gdp files", qUtf8Printable(shadersDir.path()), shadersDir.entryList(QStringList("*.gdp")).size());
|
||||
// qDebug(
|
||||
// "Shader directory found '%s', and it contains %i gdp files",
|
||||
// qUtf8Printable(shadersDir.path()),
|
||||
// shadersDir.entryList(QStringList("*.gdp")).size());
|
||||
loadShaders(shadersDir);
|
||||
|
||||
loadShaders(MeshLabApplication::extraShadersLocation());
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 5cdefce22e377369d7c8eede0c78a6fb224b81de
|
||||
Subproject commit 0a9c6735e8f79eb876e4d4e98f0b885de58adb51
|
||||
Loading…
x
Reference in New Issue
Block a user