diff options
-rw-r--r-- | source/blender/collada/BCMath.cpp | 15 | ||||
-rw-r--r-- | source/blender/collada/collada_utils.h | 3 |
2 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/collada/BCMath.cpp b/source/blender/collada/BCMath.cpp index 31f8bd1c2bc..c82ecbb7441 100644 --- a/source/blender/collada/BCMath.cpp +++ b/source/blender/collada/BCMath.cpp @@ -151,19 +151,22 @@ void BCMatrix::transpose(Matrix &mat) void BCMatrix::sanitize(Matrix &mat, int precision) { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { double val = (double)mat[i][j]; val = double_round(val, precision); mat[i][j] = (float)val; } + } } void BCMatrix::sanitize(DMatrix &mat, int precision) { - for (int i = 0; i < 4; i++) - for (int j = 0; j < 4; j++) + for (int i = 0; i < 4; i++) { + for (int j = 0; j < 4; j++) { mat[i][j] = double_round(mat[i][j], precision); + } + } } void BCMatrix::unit() @@ -177,13 +180,14 @@ void BCMatrix::unit() * precision = -1 indicates to not limit the precision. */ void BCMatrix::get_matrix(DMatrix &mat, const bool transposed, const int precision) const { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { float val = (transposed) ? matrix[j][i] : matrix[i][j]; if (precision >= 0) val = floor((val * pow(10, precision) + 0.5)) / pow(10, precision); mat[i][j] = val; } + } } void BCMatrix::get_matrix(Matrix &mat, @@ -191,13 +195,14 @@ void BCMatrix::get_matrix(Matrix &mat, const int precision, const bool inverted) const { - for (int i = 0; i < 4; i++) + for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { float val = (transposed) ? matrix[j][i] : matrix[i][j]; if (precision >= 0) val = floor((val * pow(10, precision) + 0.5)) / pow(10, precision); mat[i][j] = val; } + } if (inverted) { invert_m4(mat); diff --git a/source/blender/collada/collada_utils.h b/source/blender/collada/collada_utils.h index dca8f414e5a..e142d4c77db 100644 --- a/source/blender/collada/collada_utils.h +++ b/source/blender/collada/collada_utils.h @@ -188,8 +188,9 @@ inline bool bc_startswith(std::string const &value, std::string const &starting) inline bool bc_endswith(const std::string &value, const std::string &ending) { - if (ending.size() > value.size()) + if (ending.size() > value.size()) { return false; + } return value.compare(value.size() - ending.size(), ending.size(), ending) == 0; } |