From 4821b66520db1548727bf1b25e28475d55843bbd Mon Sep 17 00:00:00 2001 From: Benau Date: Thu, 7 Mar 2019 15:53:56 +0800 Subject: [PATCH] Save 1 less digit for compressed origin from btTransform --- src/utils/mini_glm.hpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/utils/mini_glm.hpp b/src/utils/mini_glm.hpp index 8211ba4c8..58bf1c228 100644 --- a/src/utils/mini_glm.hpp +++ b/src/utils/mini_glm.hpp @@ -571,17 +571,17 @@ namespace MiniGLM inline void compressbtTransform(btTransform& cur_t, int* compressed_data = NULL) { - int x = (int)(cur_t.getOrigin().x() * 1000.0f); - int y = (int)(cur_t.getOrigin().y() * 1000.0f); - int z = (int)(cur_t.getOrigin().z() * 1000.0f); + int x = (int)(cur_t.getOrigin().x() * 100.0f); + int y = (int)(cur_t.getOrigin().y() * 100.0f); + int z = (int)(cur_t.getOrigin().z() * 100.0f); x = core::clamp(x, -8388608, 8388607); y = core::clamp(y, -8388608, 8388607); z = core::clamp(z, -8388608, 8388607); uint32_t compressed_q = compressQuaternion(cur_t.getRotation()); cur_t.setOrigin(btVector3( - (float)x / 1000.0f, - (float)y / 1000.0f, - (float)z / 1000.0f)); + (float)x / 100.0f, + (float)y / 100.0f, + (float)z / 100.0f)); cur_t.setRotation(decompressbtQuaternion(compressed_q)); if (compressed_data) { @@ -596,9 +596,9 @@ namespace MiniGLM { btTransform trans; trans.setOrigin(btVector3( - (float)compressed_data[0] / 1000.0f, - (float)compressed_data[1] / 1000.0f, - (float)compressed_data[2] / 1000.0f)); + (float)compressed_data[0] / 100.0f, + (float)compressed_data[1] / 100.0f, + (float)compressed_data[2] / 100.0f)); trans.setRotation(decompressbtQuaternion( (uint32_t)compressed_data[3])); return trans;