mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 02:27:48 +02:00
coding standard: comparison for pointer types (replaced with object isEmpty)
This commit is contained in:
parent
fb825f6d10
commit
810242e182
2 changed files with 6 additions and 5 deletions
|
@ -127,21 +127,21 @@ void setMeshPartDefaults(FBXMeshPart& meshPart, QString materialID) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// OBJFace
|
// OBJFace
|
||||||
bool OBJFace::add(QByteArray vertexIndex, QByteArray textureIndex, QByteArray normalIndex) {
|
bool OBJFace::add(const QByteArray& vertexIndex, const QByteArray& textureIndex, const QByteArray& normalIndex) {
|
||||||
bool ok;
|
bool ok;
|
||||||
int index = vertexIndex.toInt(&ok);
|
int index = vertexIndex.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
vertexIndices.append(index - 1);
|
vertexIndices.append(index - 1);
|
||||||
if (textureIndex != nullptr) {
|
if (!textureIndex.isEmpty()) {
|
||||||
index = textureIndex.toInt(&ok);
|
index = textureIndex.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
textureUVIndices.append(index - 1);
|
textureUVIndices.append(index - 1);
|
||||||
}
|
}
|
||||||
if (normalIndex != nullptr) {
|
if (!normalIndex.isEmpty()) {
|
||||||
index = normalIndex.toInt(&ok);
|
index = normalIndex.toInt(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -250,7 +250,8 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
|
||||||
assert(parts.count() >= 1);
|
assert(parts.count() >= 1);
|
||||||
assert(parts.count() <= 3);
|
assert(parts.count() <= 3);
|
||||||
// FIXME: if we want to handle negative indices, it has to be done here.
|
// FIXME: if we want to handle negative indices, it has to be done here.
|
||||||
face.add(parts[0], (parts.count() > 1) ? parts[1] : nullptr, (parts.count() > 2) ? parts[2] : nullptr);
|
const QByteArray noData {};
|
||||||
|
face.add(parts[0], (parts.count() > 1) ? parts[1] : noData, (parts.count() > 2) ? parts[2] : noData);
|
||||||
// FIXME: preserve current name, material and such
|
// FIXME: preserve current name, material and such
|
||||||
}
|
}
|
||||||
originalFaceCountForDebugging++;
|
originalFaceCountForDebugging++;
|
||||||
|
|
|
@ -36,7 +36,7 @@ public:
|
||||||
QVector<int> normalIndices;
|
QVector<int> normalIndices;
|
||||||
//materialName groupName // FIXME
|
//materialName groupName // FIXME
|
||||||
// Add one more set of vertex data. Answers true if successful
|
// Add one more set of vertex data. Answers true if successful
|
||||||
bool add(QByteArray vertexIndex, QByteArray textureIndex = nullptr, QByteArray normalIndex = nullptr);
|
bool add(const QByteArray& vertexIndex, const QByteArray& textureIndex, const QByteArray& normalIndex);
|
||||||
// Return a set of one or more OBJFaces from this one, in which each is just a triangle.
|
// Return a set of one or more OBJFaces from this one, in which each is just a triangle.
|
||||||
// Even though FBXMeshPart can handle quads, it would be messy to try to keep track of mixed-size faces, so we treat everything as triangles.
|
// Even though FBXMeshPart can handle quads, it would be messy to try to keep track of mixed-size faces, so we treat everything as triangles.
|
||||||
QVector<OBJFace> triangulate();
|
QVector<OBJFace> triangulate();
|
||||||
|
|
Loading…
Reference in a new issue