PageRenderTime 35ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llmaniptranslate.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 116 lines | 79 code | 12 blank | 25 comment | 0 complexity | ccbb4749e471a858e19d4da12e9c8850 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llmaniptranslate.h
  3. * @brief LLManipTranslate 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_LLMANIPTRANSLATE_H
  27. #define LL_LLMANIPTRANSLATE_H
  28. #include "llmanip.h"
  29. #include "lltimer.h"
  30. #include "v4math.h"
  31. #include "llquaternion.h"
  32. class LLManipTranslate : public LLManip
  33. {
  34. public:
  35. class ManipulatorHandle
  36. {
  37. public:
  38. LLVector3 mStartPosition;
  39. LLVector3 mEndPosition;
  40. EManipPart mManipID;
  41. F32 mHotSpotRadius;
  42. ManipulatorHandle(LLVector3 start_pos, LLVector3 end_pos, EManipPart id, F32 radius):mStartPosition(start_pos), mEndPosition(end_pos), mManipID(id), mHotSpotRadius(radius){}
  43. };
  44. LLManipTranslate( LLToolComposite* composite );
  45. virtual ~LLManipTranslate();
  46. static U32 getGridTexName() ;
  47. static void destroyGL();
  48. static void restoreGL();
  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 void highlightManipulators(S32 x, S32 y);
  55. virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
  56. virtual BOOL canAffectSelection();
  57. protected:
  58. enum EHandleType {
  59. HANDLE_CONE,
  60. HANDLE_BOX,
  61. HANDLE_SPHERE
  62. };
  63. void renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction);
  64. void renderTranslationHandles();
  65. void renderText();
  66. void renderSnapGuides();
  67. void renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a);
  68. void renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha);
  69. void highlightIntersection(LLVector3 normal,
  70. LLVector3 selection_center,
  71. LLQuaternion grid_rotation,
  72. LLColor4 inner_color);
  73. F32 getMinGridScale();
  74. private:
  75. S32 mLastHoverMouseX;
  76. S32 mLastHoverMouseY;
  77. BOOL mSendUpdateOnMouseUp;
  78. BOOL mMouseOutsideSlop; // true after mouse goes outside slop region
  79. BOOL mCopyMadeThisDrag;
  80. S32 mMouseDownX;
  81. S32 mMouseDownY;
  82. F32 mAxisArrowLength; // pixels
  83. F32 mConeSize; // meters, world space
  84. F32 mArrowLengthMeters; // meters
  85. F32 mGridSizeMeters;
  86. F32 mPlaneManipOffsetMeters;
  87. LLVector3 mManipNormal;
  88. LLVector3d mDragCursorStartGlobal;
  89. LLVector3d mDragSelectionStartGlobal;
  90. LLTimer mUpdateTimer;
  91. LLVector4 mManipulatorVertices[18];
  92. F32 mSnapOffsetMeters;
  93. LLVector3 mSnapOffsetAxis;
  94. LLQuaternion mGridRotation;
  95. LLVector3 mGridOrigin;
  96. LLVector3 mGridScale;
  97. F32 mSubdivisions;
  98. BOOL mInSnapRegime;
  99. BOOL mSnapped;
  100. LLVector3 mArrowScales;
  101. LLVector3 mPlaneScales;
  102. LLVector4 mPlaneManipPositions;
  103. };
  104. #endif