llmaniprotate.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLMANIPROTATE_H
00033 #define LL_LLMANIPROTATE_H
00034 
00035 #include "lltool.h"
00036 #include "v3math.h"
00037 #include "v4math.h"
00038 #include "llquaternion.h"
00039 #include "llregionposition.h"
00040 #include "llmanip.h"
00041 #include "llviewerobject.h"
00042 
00043 class LLToolComposite;
00044 class LLColor4;
00045 
00046 class LLManipRotate : public LLManip
00047 {
00048 public:
00049         class ManipulatorHandle
00050         {
00051         public:
00052                 LLVector3       mAxisU;
00053                 LLVector3       mAxisV;
00054                 U32                     mManipID;
00055 
00056                 ManipulatorHandle(LLVector3 axis_u, LLVector3 axis_v, U32 id) : mAxisU(axis_u), mAxisV(axis_v), mManipID(id){}
00057         };
00058         
00059         LLManipRotate( LLToolComposite* composite );
00060 
00061         virtual BOOL    handleMouseDown( S32 x, S32 y, MASK mask );
00062         virtual BOOL    handleMouseUp( S32 x, S32 y, MASK mask );
00063         virtual BOOL    handleHover( S32 x, S32 y, MASK mask );
00064         virtual void    render();
00065 
00066         virtual void    handleSelect();
00067         virtual void    handleDeselect();
00068 
00069         virtual BOOL    handleMouseDownOnPart(S32 x, S32 y, MASK mask);
00070         virtual void    highlightManipulators(S32 x, S32 y);
00071         virtual BOOL    canAffectSelection();
00072         
00073 private:
00074         void                    updateHoverView();
00075 
00076         void                    drag( S32 x, S32 y );
00077         LLVector3               projectToSphere( F32 x, F32 y, BOOL* on_sphere );
00078 
00079         void                    renderSnapGuides();
00080         void                    renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color);
00081 
00082         BOOL                    updateVisiblity();
00083         LLVector3               findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis );
00084 
00085         LLQuaternion    dragUnconstrained( S32 x, S32 y );
00086         LLQuaternion    dragConstrained( S32 x, S32 y );
00087         LLVector3               getConstraintAxis();
00088         S32                             getObjectAxisClosestToMouse(LLVector3& axis);
00089 
00090         // Utility functions
00091         static void                     mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir );
00092         static LLVector3        intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius );
00093         static LLVector3        intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius);
00094 
00095 private:
00096         LLVector3d                      mRotationCenter;                        
00097         LLCoordGL                       mCenterScreen;
00098 //      S32                                     mLastHoverMouseX;               // used to suppress hover if mouse doesn't move
00099 //      S32                                     mLastHoverMouseY;
00100         LLQuaternion            mRotation;
00101         
00102         LLVector3                       mMouseDown;
00103         LLVector3                       mMouseCur;
00104         F32                                     mRadiusMeters;
00105         
00106         LLVector3                       mCenterToCam;
00107         LLVector3                       mCenterToCamNorm;
00108         F32                                     mCenterToCamMag;
00109         LLVector3                       mCenterToProfilePlane;
00110         F32                                     mCenterToProfilePlaneMag;
00111 
00112         EManipPart                      mManipPart;
00113 
00114         BOOL                            mSendUpdateOnMouseUp;
00115 
00116         BOOL                            mSmoothRotate;
00117         BOOL                            mCamEdgeOn;
00118 
00119         LLVector4                       mManipulatorVertices[6];
00120         LLVector4                       mManipulatorScales;
00121 };
00122 
00123 #endif  // LL_LLMANIPROTATE_H

Generated on Thu Jul 1 06:08:49 2010 for Second Life Viewer by  doxygen 1.4.7