mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-10 03:41:26 +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() {
|
glm::vec3 OBJTokenizer::getVec3() {
|
||||||
auto v = glm::vec3(this->getFloat(), this->getFloat(), this->getFloat());
|
auto v = glm::vec3(getFloat(), getFloat(), getFloat()); // N.B.: getFloat() has side-effect
|
||||||
while (this->isNextTokenFloat()) {
|
while (isNextTokenFloat()) {
|
||||||
// the spec(s) get(s) vague here. might be w, might be a color... chop it off.
|
// the spec(s) get(s) vague here. might be w, might be a color... chop it off.
|
||||||
this->nextToken();
|
nextToken();
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
glm::vec2 OBJTokenizer::getVec2() {
|
glm::vec2 OBJTokenizer::getVec2() {
|
||||||
auto v = glm::vec2(this->getFloat(), 1.0f - this->getFloat()); // OBJ has an odd sense of u, v
|
auto v = glm::vec2(getFloat(), 1.0f - getFloat()); // OBJ has an odd sense of u, v. Also N.B.: getFloat() has side-effect
|
||||||
while (this->isNextTokenFloat()) {
|
while (isNextTokenFloat()) {
|
||||||
// there can be a w, but we don't handle that
|
// there can be a w, but we don't handle that
|
||||||
this->nextToken();
|
nextToken();
|
||||||
}
|
}
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
@ -275,7 +275,7 @@ done:
|
||||||
FBXGeometry OBJReader::readOBJ(const QByteArray& model, const QVariantHash& mapping) {
|
FBXGeometry OBJReader::readOBJ(const QByteArray& model, const QVariantHash& mapping) {
|
||||||
QBuffer buffer(const_cast<QByteArray*>(&model));
|
QBuffer buffer(const_cast<QByteArray*>(&model));
|
||||||
buffer.open(QIODevice::ReadOnly);
|
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);
|
mesh.meshExtents.addPoint(vertex);
|
||||||
geometry.meshExtents.addPoint(vertex);
|
geometry.meshExtents.addPoint(vertex);
|
||||||
}
|
}
|
||||||
//this->fbxDebugDump(geometry);
|
//fbxDebugDump(geometry);
|
||||||
}
|
}
|
||||||
catch(const std::exception& e) {
|
catch(const std::exception& e) {
|
||||||
qCDebug(modelformat) << "something went wrong in OBJ reader: " << e.what();
|
qCDebug(modelformat) << "something went wrong in OBJ reader: " << e.what();
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
glm::vec2 getVec2();
|
glm::vec2 getVec2();
|
||||||
|
|
||||||
private:
|
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;
|
QIODevice* _device;
|
||||||
QByteArray _datum;
|
QByteArray _datum;
|
||||||
int _pushedBackToken;
|
int _pushedBackToken;
|
||||||
|
|
Loading…
Reference in a new issue