PageRenderTime 20ms CodeModel.GetById 13ms app.highlight 5ms 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
  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
 27#ifndef LL_LLMANIPROTATE_H
 28#define LL_LLMANIPROTATE_H
 29
 30#include "lltool.h"
 31#include "v3math.h"
 32#include "v4math.h"
 33#include "llquaternion.h"
 34#include "llregionposition.h"
 35#include "llmanip.h"
 36#include "llviewerobject.h"
 37
 38class LLToolComposite;
 39class LLColor4;
 40
 41class LLManipRotate : public LLManip
 42{
 43public:
 44	class ManipulatorHandle
 45	{
 46	public:
 47		LLVector3	mAxisU;
 48		LLVector3	mAxisV;
 49		U32			mManipID;
 50
 51		ManipulatorHandle(LLVector3 axis_u, LLVector3 axis_v, U32 id) : mAxisU(axis_u), mAxisV(axis_v), mManipID(id){}
 52	};
 53	
 54	LLManipRotate( LLToolComposite* composite );
 55
 56	virtual BOOL	handleMouseDown( S32 x, S32 y, MASK mask );
 57	virtual BOOL	handleMouseUp( S32 x, S32 y, MASK mask );
 58	virtual BOOL	handleHover( S32 x, S32 y, MASK mask );
 59	virtual void	render();
 60
 61	virtual void	handleSelect();
 62
 63	virtual BOOL	handleMouseDownOnPart(S32 x, S32 y, MASK mask);
 64	virtual void	highlightManipulators(S32 x, S32 y);
 65	virtual BOOL	canAffectSelection();
 66	
 67private:
 68	void			updateHoverView();
 69
 70	void			drag( S32 x, S32 y );
 71	LLVector3		projectToSphere( F32 x, F32 y, BOOL* on_sphere );
 72
 73	void			renderSnapGuides();
 74	void			renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color);
 75
 76	BOOL			updateVisiblity();
 77	LLVector3		findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis );
 78
 79	LLQuaternion	dragUnconstrained( S32 x, S32 y );
 80	LLQuaternion	dragConstrained( S32 x, S32 y );
 81	LLVector3		getConstraintAxis();
 82	S32				getObjectAxisClosestToMouse(LLVector3& axis);
 83
 84	// Utility functions
 85	static void			mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir );
 86	static LLVector3	intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius );
 87	static LLVector3	intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius);
 88
 89private:
 90	LLVector3d			mRotationCenter;			
 91	LLCoordGL			mCenterScreen;
 92//	S32					mLastHoverMouseX;		// used to suppress hover if mouse doesn't move
 93//	S32					mLastHoverMouseY;
 94	LLQuaternion		mRotation;
 95	
 96	LLVector3			mMouseDown;
 97	LLVector3			mMouseCur;
 98	F32					mRadiusMeters;
 99	
100	LLVector3			mCenterToCam;
101	LLVector3			mCenterToCamNorm;
102	F32					mCenterToCamMag;
103	LLVector3			mCenterToProfilePlane;
104	F32					mCenterToProfilePlaneMag;
105
106	BOOL				mSendUpdateOnMouseUp;
107
108	BOOL				mSmoothRotate;
109	BOOL				mCamEdgeOn;
110
111	LLVector4			mManipulatorVertices[6];
112	LLVector4			mManipulatorScales;
113};
114
115#endif  // LL_LLMANIPROTATE_H