From 7ca74e2b4db3e28acf4fb85435d39113c5e9666b Mon Sep 17 00:00:00 2001 From: Christophe Riccio Date: Wed, 9 Mar 2011 09:51:19 +0000 Subject: [PATCH] Fixed pick implementation... again --- glm/gtc/matrix_transform.inl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/glm/gtc/matrix_transform.inl b/glm/gtc/matrix_transform.inl index 1263ce53..bc0a65ac 100644 --- a/glm/gtc/matrix_transform.inl +++ b/glm/gtc/matrix_transform.inl @@ -338,8 +338,13 @@ namespace matrix_transform if(!(delta.x > T(0) && delta.y > T(0))) return Result; // Error + detail::tvec3 Temp( + (T(viewport[2]) - T(2) * (center.x - T(viewport[0]))) / delta.x, + (T(viewport[3]) - T(2) * (center.y - T(viewport[1]))) / delta.y, + T(0)); + // Translate and scale the picked region to the entire window - Result = translate(Result, (T(viewport[2]) - T(2) * (center.x - T(viewport[0]))) / delta.x, (T(viewport[3]) - T(2) * (center.y - T(viewport[1]))) / delta.y, T(0)); + Result = translate(Result, Temp); return scale(Result, T(viewport[2]) / delta.x, T(viewport[3]) / delta.y, T(1)); }