PageRenderTime 72ms CodeModel.GetById 40ms app.highlight 10ms RepoModel.GetById 20ms 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
  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
 27#ifndef LL_LLMANIPTRANSLATE_H
 28#define LL_LLMANIPTRANSLATE_H
 29
 30#include "llmanip.h"
 31#include "lltimer.h"
 32#include "v4math.h"
 33#include "llquaternion.h"
 34
 35class LLManipTranslate : public LLManip
 36{
 37public:
 38	class ManipulatorHandle
 39	{
 40	public:
 41		LLVector3	mStartPosition;
 42		LLVector3	mEndPosition;
 43		EManipPart	mManipID;
 44		F32			mHotSpotRadius;
 45
 46		ManipulatorHandle(LLVector3 start_pos, LLVector3 end_pos, EManipPart id, F32 radius):mStartPosition(start_pos), mEndPosition(end_pos), mManipID(id), mHotSpotRadius(radius){}
 47	};
 48
 49
 50	LLManipTranslate( LLToolComposite* composite );
 51	virtual ~LLManipTranslate();
 52
 53	static  U32     getGridTexName() ;
 54	static  void    destroyGL();
 55	static	void	restoreGL();
 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	virtual void	handleSelect();
 61
 62	virtual void	highlightManipulators(S32 x, S32 y);
 63	virtual BOOL	handleMouseDownOnPart(S32 x, S32 y, MASK mask);
 64	virtual BOOL	canAffectSelection();
 65
 66protected:
 67	enum EHandleType {
 68		HANDLE_CONE,
 69		HANDLE_BOX,
 70		HANDLE_SPHERE 
 71	};
 72
 73	void		renderArrow(S32 which_arrow, S32 selected_arrow, F32 box_size, F32 arrow_size, F32 handle_size, BOOL reverse_direction);
 74	void		renderTranslationHandles();
 75	void		renderText();
 76	void		renderSnapGuides();
 77	void		renderGrid(F32 x, F32 y, F32 size, F32 r, F32 g, F32 b, F32 a);
 78	void		renderGridVert(F32 x_trans, F32 y_trans, F32 r, F32 g, F32 b, F32 alpha);
 79	void		highlightIntersection(LLVector3 normal, 
 80									 LLVector3 selection_center, 
 81									 LLQuaternion grid_rotation, 
 82									 LLColor4 inner_color);
 83	F32			getMinGridScale();
 84
 85private:
 86	S32			mLastHoverMouseX;
 87	S32			mLastHoverMouseY;
 88	BOOL		mSendUpdateOnMouseUp;
 89	BOOL		mMouseOutsideSlop;		// true after mouse goes outside slop region
 90	BOOL		mCopyMadeThisDrag;
 91	S32			mMouseDownX;
 92	S32			mMouseDownY;
 93	F32			mAxisArrowLength;		// pixels
 94	F32			mConeSize;				// meters, world space
 95	F32			mArrowLengthMeters;		// meters
 96	F32			mGridSizeMeters;
 97	F32			mPlaneManipOffsetMeters;
 98	LLVector3	mManipNormal;
 99	LLVector3d	mDragCursorStartGlobal;
100	LLVector3d	mDragSelectionStartGlobal;
101	LLTimer		mUpdateTimer;
102	LLVector4	mManipulatorVertices[18];
103	F32			mSnapOffsetMeters;
104	LLVector3	mSnapOffsetAxis;
105	LLQuaternion mGridRotation;
106	LLVector3	mGridOrigin;
107	LLVector3	mGridScale;
108	F32			mSubdivisions;
109	BOOL		mInSnapRegime;
110	BOOL		mSnapped;
111	LLVector3	mArrowScales;
112	LLVector3	mPlaneScales;
113	LLVector4	mPlaneManipPositions;
114};
115
116#endif