00001
00032 #ifndef LL_LLMANIPTRANSLATE_H
00033 #define LL_LLMANIPTRANSLATE_H
00034
00035 #include "llmanip.h"
00036 #include "lltimer.h"
00037 #include "v4math.h"
00038 #include "linked_lists.h"
00039 #include "llquaternion.h"
00040
00041 class LLManipTranslate : public LLManip
00042 {
00043 public:
00044 class ManipulatorHandle
00045 {
00046 public:
00047 LLVector3 mStartPosition;
00048 LLVector3 mEndPosition;
00049 EManipPart mManipID;
00050 F32 mHotSpotRadius;
00051
00052 ManipulatorHandle(LLVector3 start_pos, LLVector3 end_pos, EManipPart id, F32 radius):mStartPosition(start_pos), mEndPosition(end_pos), mManipID(id), mHotSpotRadius(radius){}
00053 };
00054
00055
00056 LLManipTranslate( LLToolComposite* composite );
00057 virtual ~LLManipTranslate();
00058
00059 static void restoreGL();
00060 virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask);
00061 virtual BOOL handleMouseUp(S32 x, S32 y, MASK mask);
00062 virtual BOOL handleHover(S32 x, S32 y, MASK mask);
00063 virtual void render();
00064 virtual void handleSelect();
00065 virtual void handleDeselect();
00066
00067 virtual void highlightManipulators(S32 x, S32 y);
00068 virtual BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
00069 virtual BOOL canAffectSelection();
00070
00071 protected:
00072 enum EHandleType {
00073 HANDLE_CONE,
00074 HANDLE_BOX,
00075 HANDLE_SPHERE
00076 };
00077
00078 void renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction);
00079 void renderTranslationHandles();
00080 void renderText();
00081 void renderSnapGuides();
00082 void renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a);
00083 void renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha);
00084 void highlightIntersection(LLVector3 normal,
00085 LLVector3 selection_center,
00086 LLQuaternion grid_rotation,
00087 LLColor4 inner_color);
00088 F32 getMinGridScale();
00089
00090 private:
00091 S32 mLastHoverMouseX;
00092 S32 mLastHoverMouseY;
00093 BOOL mSendUpdateOnMouseUp;
00094 BOOL mMouseOutsideSlop;
00095 BOOL mCopyMadeThisDrag;
00096 S32 mMouseDownX;
00097 S32 mMouseDownY;
00098 F32 mAxisArrowLength;
00099 F32 mConeSize;
00100 F32 mArrowLengthMeters;
00101 F32 mGridSizeMeters;
00102 F32 mPlaneManipOffsetMeters;
00103 EManipPart mManipPart;
00104 LLVector3 mManipNormal;
00105 LLVector3d mDragCursorStartGlobal;
00106 LLVector3d mDragSelectionStartGlobal;
00107 LLTimer mUpdateTimer;
00108 LLLinkedList<ManipulatorHandle> mProjectedManipulators;
00109 LLVector4 mManipulatorVertices[18];
00110 F32 mSnapOffsetMeters;
00111 LLVector3 mSnapOffsetAxis;
00112 LLQuaternion mGridRotation;
00113 LLVector3 mGridOrigin;
00114 LLVector3 mGridScale;
00115 F32 mSubdivisions;
00116 BOOL mInSnapRegime;
00117 BOOL mSnapped;
00118 LLVector3 mArrowScales;
00119 LLVector3 mPlaneScales;
00120 LLVector4 mPlaneManipPositions;
00121 };
00122
00123 #endif