From d3c7ea2e53495ab13441a6237cc75757266fd1e7 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 16 Apr 2016 11:32:57 +0200 Subject: [PATCH 1/2] Lower Epsilonon Pandora --- Sources/Engine/Math/Quaternion.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Engine/Math/Quaternion.h b/Sources/Engine/Math/Quaternion.h index b46c078..d9d51e4 100755 --- a/Sources/Engine/Math/Quaternion.h +++ b/Sources/Engine/Math/Quaternion.h @@ -370,7 +370,7 @@ void Quaternion::FromEuler(const Vector &a) template Type Quaternion::EPS(Type orig) const { - if ((orig <= 10e-6f) && (orig >= -10e-6f)) + if ((orig <= 1e-4f) && (orig >= -1e-4f)) return(0.0f); return(orig); @@ -384,9 +384,9 @@ void Quaternion::ToMatrix(Matrix &m) const Type yy = 2*q_y*q_y; Type yz = 2*q_y*q_z; Type zz = 2*q_z*q_z; Type wx = 2*q_w*q_x; Type wy = 2*q_w*q_y; Type wz = 2*q_w*q_z; - m(1,1) = EPS(1.0f-(yy+zz));m(1,2) = EPS(xy-wz); m(1,3) = EPS(xz+wy); - m(2,1) = EPS(xy+wz); m(2,2) = EPS(1.0f-(xx+zz));m(2,3) = EPS(yz-wx); - m(3,1) = EPS(xz-wy); m(3,2) = EPS(yz+wx); m(3,3) = EPS(1.0f-(xx+yy)); + m(1,1) = 1.0f-EPS(yy+zz); m(1,2) = EPS(xy-wz); m(1,3) = EPS(xz+wy); + m(2,1) = EPS(xy+wz); m(2,2) = 1.0f-EPS(xx+zz); m(2,3) = EPS(yz-wx); + m(3,1) = EPS(xz-wy); m(3,2) = EPS(yz+wx); m(3,3) = 1.0f-EPS(xx+yy); } // conversion from matrix From acd39526c9eca68684858c4047f63cf1d5e1c5b5 Mon Sep 17 00:00:00 2001 From: ptitSeb Date: Sat, 16 Apr 2016 13:10:32 +0200 Subject: [PATCH 2/2] fix Inverted Right and Middle button on certain case with SDL --- Sources/Engine/Base/SDL/SDLInput.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Sources/Engine/Base/SDL/SDLInput.cpp b/Sources/Engine/Base/SDL/SDLInput.cpp index d378cc1..0eab255 100755 --- a/Sources/Engine/Base/SDL/SDLInput.cpp +++ b/Sources/Engine/Base/SDL/SDLInput.cpp @@ -314,8 +314,16 @@ static void sdl_event_handler(const SDL_Event *event) case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: - if (event->button.button <= 5) - _abKeysPressed[KID_MOUSE1 + (event->button.button-1)] = (event->button.state == SDL_PRESSED) ? TRUE : FALSE; + if (event->button.button <= 5) { + int button = KID_MOUSE1; + switch(event->button.button) { + case SDL_BUTTON_RIGHT: button = KID_MOUSE2; break; + case SDL_BUTTON_MIDDLE: button = KID_MOUSE3; break; + case 4: button = KID_MOUSE4; break; + case 5: button = KID_MOUSE5; break; + } + _abKeysPressed[button] = (event->button.state == SDL_PRESSED) ? TRUE : FALSE; + } break; case SDL_MOUSEWHEEL: