From f2135a0ca32db6d6da3fd13a64789f8cdc549dc8 Mon Sep 17 00:00:00 2001 From: Aaron Date: Sun, 11 Sep 2016 22:49:15 -0700 Subject: [PATCH 1/2] Fixed scaling factors for packing and unpacking unorm555 and unorm565 --- glm/gtc/packing.inl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/glm/gtc/packing.inl b/glm/gtc/packing.inl index b3c7c4e0..618fb9ef 100644 --- a/glm/gtc/packing.inl +++ b/glm/gtc/packing.inl @@ -725,7 +725,7 @@ namespace detail GLM_FUNC_QUALIFIER uint16 packUnorm1x5_1x6_1x5(vec3 const & v) { - u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(15.f, 31.f, 15.f))); + u32vec3 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec3(31.f, 63.f, 31.f))); detail::u5u6u5 Result; Result.data.x = Unpack.x; Result.data.y = Unpack.y; @@ -735,7 +735,7 @@ namespace detail GLM_FUNC_QUALIFIER vec3 unpackUnorm1x5_1x6_1x5(uint16 v) { - vec3 const ScaleFactor(1.f / 15.f, 1.f / 31.f, 1.f / 15.f); + vec3 const ScaleFactor(1.f / 31.f, 1.f / 63.f, 1.f / 31.f); detail::u5u6u5 Unpack; Unpack.pack = v; return vec3(Unpack.data.x, Unpack.data.y, Unpack.data.z) * ScaleFactor; @@ -743,7 +743,7 @@ namespace detail GLM_FUNC_QUALIFIER uint16 packUnorm3x5_1x1(vec4 const & v) { - u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(15.f, 15.f, 15.f, 1.f))); + u32vec4 const Unpack(round(clamp(v, 0.0f, 1.0f) * vec4(31.f, 31.f, 31.f, 1.f))); detail::u5u5u5u1 Result; Result.data.x = Unpack.x; Result.data.y = Unpack.y; @@ -754,7 +754,7 @@ namespace detail GLM_FUNC_QUALIFIER vec4 unpackUnorm3x5_1x1(uint16 v) { - vec4 const ScaleFactor(1.f / 15.f, 1.f / 15.f, 1.f / 15.f, 1.f); + vec4 const ScaleFactor(1.f / 31.f, 1.f / 31.f, 1.f / 31.f, 1.f); detail::u5u5u5u1 Unpack; Unpack.pack = v; return vec4(Unpack.data.x, Unpack.data.y, Unpack.data.z, Unpack.data.w) * ScaleFactor; From 9669cf490582379ca5068e28fde4f6045c8b0f7a Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Sun, 18 Sep 2016 21:56:32 +0200 Subject: [PATCH 2/2] - Fixed packing/unpacking function fixed for 5_6_5 and 5_5_5_1 #552 --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index ca9d888a..f71333b9 100644 --- a/readme.md +++ b/readme.md @@ -57,6 +57,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate) - Fixed SIMD faceforward bug. #549 - Fixed GCC 4.8 with C++11 compilation option #550 - Fixed Visual Studio aligned type W4 warning #548 +- Fixed packing/unpacking function fixed for 5_6_5 and 5_5_5_1 #552 #### [GLM 0.9.8.0](https://github.com/g-truc/glm/releases/tag/0.9.8.0) - 2016-09-11 ##### Features: