diff options
author | nat-goodspeed <nat@lindenlab.com> | 2024-09-05 15:40:12 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-05 15:40:12 -0400 |
commit | 04568da18d2261f3f7b851cf5341b766c9648204 (patch) | |
tree | 83d5db1c173636bb77ebb33e860fac77ab5d79e8 /indra/llui/llvirtualtrackball.cpp | |
parent | 18d81e20f0b0044c16615953d7b69d7fb34d3449 (diff) | |
parent | ff2d79906ccef217194d5d9ec9d7025db03592a8 (diff) |
Merge pull request #2513 from secondlife/lua-merge-dev
Merge develop branch into Lua project branch.
Diffstat (limited to 'indra/llui/llvirtualtrackball.cpp')
-rw-r--r-- | indra/llui/llvirtualtrackball.cpp | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/indra/llui/llvirtualtrackball.cpp b/indra/llui/llvirtualtrackball.cpp index 8166afc89b..273a1d7bde 100644 --- a/indra/llui/llvirtualtrackball.cpp +++ b/indra/llui/llvirtualtrackball.cpp @@ -217,19 +217,19 @@ void LLVirtualTrackball::draw() S32 halfwidth = mTouchArea->getRect().getWidth() / 2; S32 halfheight = mTouchArea->getRect().getHeight() / 2; - draw_point.mV[VX] = (draw_point.mV[VX] + 1.0) * halfwidth + mTouchArea->getRect().mLeft; - draw_point.mV[VY] = (draw_point.mV[VY] + 1.0) * halfheight + mTouchArea->getRect().mBottom; + draw_point.mV[VX] = (draw_point.mV[VX] + 1.0f) * halfwidth + mTouchArea->getRect().mLeft; + draw_point.mV[VY] = (draw_point.mV[VY] + 1.0f) * halfheight + mTouchArea->getRect().mBottom; bool upper_hemisphere = (draw_point.mV[VZ] >= 0.f); mImgSphere->draw(mTouchArea->getRect(), upper_hemisphere ? UI_VERTEX_COLOR : UI_VERTEX_COLOR % 0.5f); - drawThumb(draw_point.mV[VX], draw_point.mV[VY], mThumbMode, upper_hemisphere); + drawThumb((S32)draw_point.mV[VX], (S32)draw_point.mV[VY], mThumbMode, upper_hemisphere); if (LLView::sDebugRects) { gGL.color4fv(LLColor4::red.mV); - gl_circle_2d(mTouchArea->getRect().getCenterX(), mTouchArea->getRect().getCenterY(), mImgSphere->getWidth() / 2, 60, false); - gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], mImgSunFront->getWidth() / 2, 12, false); + gl_circle_2d((F32)mTouchArea->getRect().getCenterX(), (F32)mTouchArea->getRect().getCenterY(), (F32)mImgSphere->getWidth() / 2.f, 60, false); + gl_circle_2d(draw_point.mV[VX], draw_point.mV[VY], (F32)mImgSunFront->getWidth() / 2.f, 12, false); } // hide the direction labels when disabled @@ -392,20 +392,20 @@ bool LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) { // trackball (move to roll) mode LLQuaternion delta; - F32 rotX = x - mPrevX; - F32 rotY = y - mPrevY; + F32 rotX = (F32)(x - mPrevX); + F32 rotY = (F32)(y - mPrevY); if (abs(rotX) > 1) { - F32 direction = (rotX < 0) ? -1 : 1; - delta.setAngleAxis(mIncrementMouse * abs(rotX), 0, direction, 0); // changing X - rotate around Y axis + F32 direction = (rotX < 0) ? -1.f : 1.f; + delta.setAngleAxis(mIncrementMouse * abs(rotX), 0.f, direction, 0.f); // changing X - rotate around Y axis mValue *= delta; } if (abs(rotY) > 1) { - F32 direction = (rotY < 0) ? 1 : -1; // reverse for Y (value increases from bottom to top) - delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0, 0); // changing Y - rotate around X axis + F32 direction = (rotY < 0) ? 1.f : -1.f; // reverse for Y (value increases from bottom to top) + delta.setAngleAxis(mIncrementMouse * abs(rotY), direction, 0.f, 0.f); // changing Y - rotate around X axis mValue *= delta; } } @@ -416,10 +416,10 @@ bool LLVirtualTrackball::handleHover(S32 x, S32 y, MASK mask) return true; // don't drag outside the circle } - F32 radius = mTouchArea->getRect().getWidth() / 2; - F32 xx = x - mTouchArea->getRect().getCenterX(); - F32 yy = y - mTouchArea->getRect().getCenterY(); - F32 dist = sqrt(pow(xx, 2) + pow(yy, 2)); + F32 radius = (F32)mTouchArea->getRect().getWidth() / 2.f; + F32 xx = (F32)(x - mTouchArea->getRect().getCenterX()); + F32 yy = (F32)(y - mTouchArea->getRect().getCenterY()); + F32 dist = (F32)(sqrt(pow(xx, 2) + pow(yy, 2))); F32 azimuth = llclamp(acosf(xx / dist), 0.0f, F_PI); F32 altitude = llclamp(acosf(dist / radius), 0.0f, F_PI_BY_TWO); |