diff options
author | Subv <subv2112@gmail.com> | 2017-06-10 00:33:25 +0200 |
---|---|---|
committer | wwylele <wwylele@gmail.com> | 2017-07-11 18:39:15 +0200 |
commit | f2d4d5c2191275bd91f2f42b880f3edf3bccfd63 (patch) | |
tree | 50e8bfcd9f9873ee6d8ba5174e9f45e942c30173 /src/common/quaternion.h | |
parent | SwRasterizer: Fixed the lighting lut lookup function. (diff) | |
download | yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.tar yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.tar.gz yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.tar.bz2 yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.tar.lz yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.tar.xz yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.tar.zst yuzu-f2d4d5c2191275bd91f2f42b880f3edf3bccfd63.zip |
Diffstat (limited to 'src/common/quaternion.h')
-rw-r--r-- | src/common/quaternion.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/common/quaternion.h b/src/common/quaternion.h index 84ac82ed3..77f626bcb 100644 --- a/src/common/quaternion.h +++ b/src/common/quaternion.h @@ -30,6 +30,11 @@ public: return {xyz * other.w + other.xyz * w + Cross(xyz, other.xyz), w * other.w - Dot(xyz, other.xyz)}; } + + Quaternion<T> Normalized() const { + T length = std::sqrt(xyz.Length2() + w * w); + return {xyz / length, w / length}; + } }; template <typename T> |