llmaniptranslate.h

Go to the documentation of this file.
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 "llquaternion.h"
00039 
00040 class LLManipTranslate : public LLManip
00041 {
00042 public:
00043         class ManipulatorHandle
00044         {
00045         public:
00046                 LLVector3       mStartPosition;
00047                 LLVector3       mEndPosition;
00048                 EManipPart      mManipID;
00049                 F32                     mHotSpotRadius;
00050 
00051                 ManipulatorHandle(LLVector3 start_pos, LLVector3 end_pos, EManipPart id, F32 radius):mStartPosition(start_pos), mEndPosition(end_pos), mManipID(id), mHotSpotRadius(radius){}
00052         };
00053 
00054 
00055         LLManipTranslate( LLToolComposite* composite );
00056         virtual ~LLManipTranslate();
00057 
00058         static  void    restoreGL();
00059         virtual BOOL    handleMouseDown(S32 x, S32 y, MASK mask);
00060         virtual BOOL    handleMouseUp(S32 x, S32 y, MASK mask);
00061         virtual BOOL    handleHover(S32 x, S32 y, MASK mask);
00062         virtual void    render();
00063         virtual void    handleSelect();
00064         virtual void    handleDeselect();
00065 
00066         virtual void    highlightManipulators(S32 x, S32 y);
00067         virtual BOOL    handleMouseDownOnPart(S32 x, S32 y, MASK mask);
00068         virtual BOOL    canAffectSelection();
00069 
00070 protected:
00071         enum EHandleType {
00072                 HANDLE_CONE,
00073                 HANDLE_BOX,
00074                 HANDLE_SPHERE 
00075         };
00076 
00077         void            renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction);
00078         void            renderTranslationHandles();
00079         void            renderText();
00080         void            renderSnapGuides();
00081         void            renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a);
00082         void            renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha);
00083         void            highlightIntersection(LLVector3 normal, 
00084                                                                          LLVector3 selection_center, 
00085                                                                          LLQuaternion grid_rotation, 
00086                                                                          LLColor4 inner_color);
00087         F32                     getMinGridScale();
00088 
00089 private:
00090         struct compare_manipulators
00091         {
00092                 bool operator() (const ManipulatorHandle* const a, const ManipulatorHandle* const b) const
00093                 {
00094                         if (a->mEndPosition.mV[VZ] != b->mEndPosition.mV[VZ])
00095                                 return (a->mEndPosition.mV[VZ] < b->mEndPosition.mV[VZ]);
00096                         else
00097                                 return a->mManipID < b->mManipID;                       
00098                 }
00099         };
00100         
00101         S32                     mLastHoverMouseX;
00102         S32                     mLastHoverMouseY;
00103         BOOL            mSendUpdateOnMouseUp;
00104         BOOL            mMouseOutsideSlop;              // true after mouse goes outside slop region
00105         BOOL            mCopyMadeThisDrag;
00106         S32                     mMouseDownX;
00107         S32                     mMouseDownY;
00108         F32                     mAxisArrowLength;               // pixels
00109         F32                     mConeSize;                              // meters, world space
00110         F32                     mArrowLengthMeters;             // meters
00111         F32                     mGridSizeMeters;
00112         F32                     mPlaneManipOffsetMeters;
00113         EManipPart      mManipPart;
00114         LLVector3       mManipNormal;
00115         LLVector3d      mDragCursorStartGlobal;
00116         LLVector3d      mDragSelectionStartGlobal;
00117         LLTimer         mUpdateTimer;
00118         typedef std::set<ManipulatorHandle*, compare_manipulators> minpulator_list_t;
00119         minpulator_list_t mProjectedManipulators;
00120         LLVector4       mManipulatorVertices[18];
00121         F32                     mSnapOffsetMeters;
00122         LLVector3       mSnapOffsetAxis;
00123         LLQuaternion mGridRotation;
00124         LLVector3       mGridOrigin;
00125         LLVector3       mGridScale;
00126         F32                     mSubdivisions;
00127         BOOL            mInSnapRegime;
00128         BOOL            mSnapped;
00129         LLVector3       mArrowScales;
00130         LLVector3       mPlaneScales;
00131         LLVector4       mPlaneManipPositions;
00132 };
00133 
00134 #endif

Generated on Fri May 16 08:33:47 2008 for SecondLife by  doxygen 1.5.5