mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-05 00:05:01 +02:00
Get rid of superflous this->.
Add comments about side-effect of getFloat().
This commit is contained in:
parent
1255d46140
commit
1e81caab6c
2 changed files with 9 additions and 9 deletions
|
@ -91,18 +91,18 @@ bool OBJTokenizer::isNextTokenFloat() {
|
|||
}
|
||||
|
||||
glm::vec3 OBJTokenizer::getVec3() {
|
||||
auto v = glm::vec3(this->getFloat(), this->getFloat(), this->getFloat());
|
||||
while (this->isNextTokenFloat()) {
|
||||
auto v = glm::vec3(getFloat(), getFloat(), getFloat()); // N.B.: getFloat() has side-effect
|
||||
while (isNextTokenFloat()) {
|
||||
// the spec(s) get(s) vague here. might be w, might be a color... chop it off.
|
||||
this->nextToken();
|
||||
nextToken();
|
||||
}
|
||||
return v;
|
||||
}
|
||||
glm::vec2 OBJTokenizer::getVec2() {
|
||||
auto v = glm::vec2(this->getFloat(), 1.0f - this->getFloat()); // OBJ has an odd sense of u, v
|
||||
while (this->isNextTokenFloat()) {
|
||||
auto v = glm::vec2(getFloat(), 1.0f - getFloat()); // OBJ has an odd sense of u, v. Also N.B.: getFloat() has side-effect
|
||||
while (isNextTokenFloat()) {
|
||||
// there can be a w, but we don't handle that
|
||||
this->nextToken();
|
||||
nextToken();
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ done:
|
|||
FBXGeometry OBJReader::readOBJ(const QByteArray& model, const QVariantHash& mapping) {
|
||||
QBuffer buffer(const_cast<QByteArray*>(&model));
|
||||
buffer.open(QIODevice::ReadOnly);
|
||||
return this->readOBJ(&buffer, mapping);
|
||||
return readOBJ(&buffer, mapping);
|
||||
}
|
||||
|
||||
|
||||
|
@ -364,7 +364,7 @@ FBXGeometry OBJReader::readOBJ(QIODevice* device, const QVariantHash& mapping) {
|
|||
mesh.meshExtents.addPoint(vertex);
|
||||
geometry.meshExtents.addPoint(vertex);
|
||||
}
|
||||
//this->fbxDebugDump(geometry);
|
||||
//fbxDebugDump(geometry);
|
||||
}
|
||||
catch(const std::exception& e) {
|
||||
qCDebug(modelformat) << "something went wrong in OBJ reader: " << e.what();
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
glm::vec2 getVec2();
|
||||
|
||||
private:
|
||||
float getFloat() { return std::stof((this->nextToken() != OBJTokenizer::DATUM_TOKEN) ? nullptr : this->getDatum().data()); }
|
||||
float getFloat() { return std::stof((nextToken() != OBJTokenizer::DATUM_TOKEN) ? nullptr : getDatum().data()); }
|
||||
QIODevice* _device;
|
||||
QByteArray _datum;
|
||||
int _pushedBackToken;
|
||||
|
|
Loading…
Reference in a new issue