aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmath/llquaternion.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmath/llquaternion.cpp')
-rw-r--r--linden/indra/llmath/llquaternion.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/linden/indra/llmath/llquaternion.cpp b/linden/indra/llmath/llquaternion.cpp
index 06e34af..34c1fd1 100644
--- a/linden/indra/llmath/llquaternion.cpp
+++ b/linden/indra/llmath/llquaternion.cpp
@@ -2,6 +2,8 @@
2 * @file llquaternion.cpp 2 * @file llquaternion.cpp
3 * @brief LLQuaternion class implementation. 3 * @brief LLQuaternion class implementation.
4 * 4 *
5 * $LicenseInfo:firstyear=2000&license=viewergpl$
6 *
5 * Copyright (c) 2000-2007, Linden Research, Inc. 7 * Copyright (c) 2000-2007, Linden Research, Inc.
6 * 8 *
7 * Second Life Viewer Source Code 9 * Second Life Viewer Source Code
@@ -24,6 +26,7 @@
24 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO 26 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
25 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 27 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
26 * COMPLETENESS OR PERFORMANCE. 28 * COMPLETENESS OR PERFORMANCE.
29 * $/LicenseInfo$
27 */ 30 */
28 31
29#include "linden_common.h" 32#include "linden_common.h"
@@ -107,23 +110,27 @@ void LLQuaternion::quantize16(F32 lower, F32 upper)
107 F32 z = mQ[VZ]; 110 F32 z = mQ[VZ];
108 F32 s = mQ[VS]; 111 F32 s = mQ[VS];
109 112
110 x = U16_to_F32(F32_to_U16(x, lower, upper), lower, upper); 113 x = U16_to_F32(F32_to_U16_ROUND(x, lower, upper), lower, upper);
111 y = U16_to_F32(F32_to_U16(y, lower, upper), lower, upper); 114 y = U16_to_F32(F32_to_U16_ROUND(y, lower, upper), lower, upper);
112 z = U16_to_F32(F32_to_U16(z, lower, upper), lower, upper); 115 z = U16_to_F32(F32_to_U16_ROUND(z, lower, upper), lower, upper);
113 s = U16_to_F32(F32_to_U16(s, lower, upper), lower, upper); 116 s = U16_to_F32(F32_to_U16_ROUND(s, lower, upper), lower, upper);
114 117
115 mQ[VX] = x; 118 mQ[VX] = x;
116 mQ[VY] = y; 119 mQ[VY] = y;
117 mQ[VZ] = z; 120 mQ[VZ] = z;
118 mQ[VS] = s; 121 mQ[VS] = s;
122
123 normQuat();
119} 124}
120 125
121void LLQuaternion::quantize8(F32 lower, F32 upper) 126void LLQuaternion::quantize8(F32 lower, F32 upper)
122{ 127{
123 mQ[VX] = U8_to_F32(F32_to_U8(mQ[VX], lower, upper), lower, upper); 128 mQ[VX] = U8_to_F32(F32_to_U8_ROUND(mQ[VX], lower, upper), lower, upper);
124 mQ[VY] = U8_to_F32(F32_to_U8(mQ[VY], lower, upper), lower, upper); 129 mQ[VY] = U8_to_F32(F32_to_U8_ROUND(mQ[VY], lower, upper), lower, upper);
125 mQ[VZ] = U8_to_F32(F32_to_U8(mQ[VZ], lower, upper), lower, upper); 130 mQ[VZ] = U8_to_F32(F32_to_U8_ROUND(mQ[VZ], lower, upper), lower, upper);
126 mQ[VS] = U8_to_F32(F32_to_U8(mQ[VS], lower, upper), lower, upper); 131 mQ[VS] = U8_to_F32(F32_to_U8_ROUND(mQ[VS], lower, upper), lower, upper);
132
133 normQuat();
127} 134}
128 135
129// LLVector3 Magnitude and Normalization Functions 136// LLVector3 Magnitude and Normalization Functions