better fix for model scale floor, remove abs

This commit is contained in:
David Back 2018-01-04 17:49:39 -08:00
parent 307867a91f
commit 7558b00467
2 changed files with 5 additions and 5 deletions

View file

@ -473,13 +473,13 @@ bool OBJReader::parseOBJGroup(OBJTokenizer& tokenizer, const QVariantHash& mappi
if (part < 0) {
switch (i) {
case 0:
parts[i].setNum(vertices.size() - abs(part) + 1);
parts[i].setNum(vertices.size() + part + 1);
break;
case 1:
parts[i].setNum(textureUVs.size() - abs(part) + 1);
parts[i].setNum(textureUVs.size() + part + 1);
break;
case 2:
parts[i].setNum(normals.size() - abs(part) + 1);
parts[i].setNum(normals.size() + part + 1);
break;
}
}

View file

@ -19,7 +19,7 @@
#include "shared/JSONHelpers.h"
void Transform::evalRotationScale(Quat& rotation, Vec3& scale, const Mat3& rotationScaleMatrix) {
const float ACCURACY_THREASHOLD = 0.000001f;
const float ACCURACY_THREASHOLD = 0.00001f;
// Following technique taken from:
// http://callumhay.blogspot.com/2010/10/decomposing-affine-transforms.html
@ -49,7 +49,7 @@ void Transform::evalRotationScale(Quat& rotation, Vec3& scale, const Mat3& rotat
// extract scale of the matrix as the length of each axis
Mat3 scaleMat = glm::inverse(rotationMat) * rotationScaleMatrix;
scale = glm::max(Vec3(ACCURACY_THREASHOLD), Vec3(scaleMat[0][0], scaleMat[1][1], scaleMat[2][2]));
scale = Vec3(scaleMat[0][0], scaleMat[1][1], scaleMat[2][2]);
// Let's work on a local matrix containing rotation only
Mat3 matRot(