PageRenderTime 156ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llmaniprotate.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 115 lines | 65 code | 22 blank | 28 comment | 0 complexity | 66dd5570e5fee69120b274d2214a389a MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llmaniprotate.h
  3. * @brief LLManipRotate class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #ifndef LL_LLMANIPROTATE_H
  27. #define LL_LLMANIPROTATE_H
  28. #include "lltool.h"
  29. #include "v3math.h"
  30. #include "v4math.h"
  31. #include "llquaternion.h"
  32. #include "llregionposition.h"
  33. #include "llmanip.h"
  34. #include "llviewerobject.h"
  35. class LLToolComposite;
  36. class LLColor4;
  37. class LLManipRotate : public LLManip
  38. {
  39. public:
  40. class ManipulatorHandle
  41. {
  42. public:
  43. LLVector3 mAxisU;
  44. LLVector3 mAxisV;
  45. U32 mManipID;
  46. ManipulatorHandle(LLVector3 axis_u, LLVector3 axis_v, U32 id) : mAxisU(axis_u), mAxisV(axis_v), mManipID(id){}
  47. };
  48. LLManipRotate( LLToolComposite* composite );
  49. virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
  50. virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
  51. virtual BOOL handleHover( S32 x, S32 y, MASK mask );
  52. virtual void render();
  53. virtual void handleSelect();
  54. virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
  55. virtual void highlightManipulators(S32 x, S32 y);
  56. virtual BOOL canAffectSelection();
  57. private:
  58. void updateHoverView();
  59. void drag( S32 x, S32 y );
  60. LLVector3 projectToSphere( F32 x, F32 y, BOOL* on_sphere );
  61. void renderSnapGuides();
  62. void renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color);
  63. BOOL updateVisiblity();
  64. LLVector3 findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis );
  65. LLQuaternion dragUnconstrained( S32 x, S32 y );
  66. LLQuaternion dragConstrained( S32 x, S32 y );
  67. LLVector3 getConstraintAxis();
  68. S32 getObjectAxisClosestToMouse(LLVector3& axis);
  69. // Utility functions
  70. static void mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir );
  71. static LLVector3 intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius );
  72. static LLVector3 intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius);
  73. private:
  74. LLVector3d mRotationCenter;
  75. LLCoordGL mCenterScreen;
  76. // S32 mLastHoverMouseX; // used to suppress hover if mouse doesn't move
  77. // S32 mLastHoverMouseY;
  78. LLQuaternion mRotation;
  79. LLVector3 mMouseDown;
  80. LLVector3 mMouseCur;
  81. F32 mRadiusMeters;
  82. LLVector3 mCenterToCam;
  83. LLVector3 mCenterToCamNorm;
  84. F32 mCenterToCamMag;
  85. LLVector3 mCenterToProfilePlane;
  86. F32 mCenterToProfilePlaneMag;
  87. BOOL mSendUpdateOnMouseUp;
  88. BOOL mSmoothRotate;
  89. BOOL mCamEdgeOn;
  90. LLVector4 mManipulatorVertices[6];
  91. LLVector4 mManipulatorScales;
  92. };
  93. #endif // LL_LLMANIPROTATE_H