Merge pull request #1199 from PeC-KAYO/master

Consumes the values of MLMatrix44 one by one.
This commit is contained in:
Alessandro Muntoni 2022-01-27 11:23:34 +01:00 committed by GitHub
commit 3432269b38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 17 deletions

View File

@ -227,22 +227,16 @@ std::vector<MeshModel*> loadMLP(
QDomNode tr = mesh.firstChildElement("MLMatrix44");
if (!tr.isNull()) {
vcg::Matrix44f trm;
if (tr.childNodes().size() == 1) {
if (!binary) {
QStringList rows = tr.firstChild().nodeValue().split("\n", QString::SkipEmptyParts);
int i = 0;
for (const QString& row : qAsConst(rows)){
if (rows.size() > 0) {
QStringList values = row.split(" ", QString::SkipEmptyParts);
int j = 0;
for (const QString& value : qAsConst(values)) {
if (i < 4 && j < 4) {
md.mm()->cm.Tr[i][j] = value.toFloat();
j++;
}
}
i++;
Scalarm* v = md.mm()->cm.Tr.V();
const QStringList rows = tr.firstChild().nodeValue().split("\n", Qt::SkipEmptyParts);
unsigned int i = 0;
for (const QString& row: rows) {
const QStringList values = row.split(" ", Qt::SkipEmptyParts);
for (const QString& value: values) {
if (i >= 16u) break;
v[i++] = value.toFloat();
}
}
}

View File

@ -18,11 +18,11 @@ QDomElement matrix44mToXML(const Matrix44m &m, bool binary, QDomDocument &doc)
QDomText nd = doc.createTextNode(QString(value));
}
else {
QString Row[4];
QString row[4];
for (int i = 0; i < 4; ++i)
Row[i] = QString("%1 %2 %3 %4 \n").arg(m[i][0]).arg(m[i][1]).arg(m[i][2]).arg(m[i][3]);
row[i] = QString("%1 %2 %3 %4 ").arg(m[i][0]).arg(m[i][1]).arg(m[i][2]).arg(m[i][3]);
nd = doc.createTextNode("\n" + Row[0] + Row[1] + Row[2] + Row[3]);
nd = doc.createTextNode("\n" + row[0] + row[1] + row[2] + row[3] + "\n");
}
matrixElem.appendChild(nd);