coding standard: comparison for pointer types (replaced with object isEmpty)

This commit is contained in:
Howard Stearns 2015-04-29 16:12:22 -07:00
parent fb825f6d10
commit 810242e182
2 changed files with 6 additions and 5 deletions

View file

@ -127,21 +127,21 @@ void setMeshPartDefaults(FBXMeshPart& meshPart, QString materialID) {
}
// OBJFace
bool OBJFace::add(QByteArray vertexIndex, QByteArray textureIndex, QByteArray normalIndex) {
bool OBJFace::add(const QByteArray& vertexIndex, const QByteArray& textureIndex, const QByteArray& normalIndex) {
bool ok;
int index = vertexIndex.toInt(&ok);
if (!ok) {
return false;
}
vertexIndices.append(index - 1);
if (textureIndex != nullptr) {
if (!textureIndex.isEmpty()) {
index = textureIndex.toInt(&ok);
if (!ok) {
return false;
}
textureUVIndices.append(index - 1);
}
if (normalIndex != nullptr) {
if (!normalIndex.isEmpty()) {
index = normalIndex.toInt(&ok);
if (!ok) {
return false;
@ -250,7 +250,8 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
assert(parts.count() >= 1);
assert(parts.count() <= 3);
// 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
}
originalFaceCountForDebugging++;

View file

@ -36,7 +36,7 @@ public:
QVector<int> normalIndices;
//materialName groupName // FIXME
// 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.
// 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();