aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmaniprotate.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llmaniprotate.h119
1 files changed, 119 insertions, 0 deletions
diff --git a/linden/indra/newview/llmaniprotate.h b/linden/indra/newview/llmaniprotate.h
new file mode 100644
index 0000000..fb51643
--- /dev/null
+++ b/linden/indra/newview/llmaniprotate.h
@@ -0,0 +1,119 @@
1/**
2 * @file llmaniprotate.h
3 * @brief LLManipRotate class definition
4 *
5 * Copyright (c) 2002-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#ifndef LL_LLMANIPROTATE_H
29#define LL_LLMANIPROTATE_H
30
31#include "lltool.h"
32#include "v3math.h"
33#include "v4math.h"
34#include "llquaternion.h"
35#include "llregionposition.h"
36#include "llmanip.h"
37#include "llviewerobject.h"
38
39class LLToolComposite;
40class LLColor4;
41
42class LLManipRotate : public LLManip
43{
44public:
45 class ManipulatorHandle
46 {
47 public:
48 LLVector3 mAxisU;
49 LLVector3 mAxisV;
50 U32 mManipID;
51
52 ManipulatorHandle(LLVector3 axis_u, LLVector3 axis_v, U32 id) : mAxisU(axis_u), mAxisV(axis_v), mManipID(id){}
53 };
54
55 LLManipRotate( LLToolComposite* composite );
56
57 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
58 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
59 virtual BOOL handleHover( S32 x, S32 y, MASK mask );
60 virtual void render();
61
62 virtual void handleSelect();
63 virtual void handleDeselect();
64
65 BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
66 virtual void highlightManipulators(S32 x, S32 y);
67 EManipPart getHighlightedPart() { return mHighlightedPart; }
68private:
69 void updateHoverView();
70
71 void drag( S32 x, S32 y );
72 LLVector3 projectToSphere( F32 x, F32 y, BOOL* on_sphere );
73
74 void renderSnapGuides();
75 void renderActiveRing(F32 radius, F32 width, const LLColor4& center_color, const LLColor4& side_color);
76
77 BOOL updateVisiblity();
78 LLVector3 findNearestPointOnRing( S32 x, S32 y, const LLVector3& center, const LLVector3& axis );
79
80 LLQuaternion dragUnconstrained( S32 x, S32 y );
81 LLQuaternion dragConstrained( S32 x, S32 y );
82 LLVector3 getConstraintAxis();
83 S32 getObjectAxisClosestToMouse(LLVector3& axis);
84
85 // Utility functions
86 static void mouseToRay( S32 x, S32 y, LLVector3* ray_pt, LLVector3* ray_dir );
87 static LLVector3 intersectMouseWithSphere( S32 x, S32 y, const LLVector3& sphere_center, F32 sphere_radius );
88 static LLVector3 intersectRayWithSphere( const LLVector3& ray_pt, const LLVector3& ray_dir, const LLVector3& sphere_center, F32 sphere_radius);
89
90private:
91 LLVector3d mRotationCenter;
92 LLCoordGL mCenterScreen;
93// S32 mLastHoverMouseX; // used to suppress hover if mouse doesn't move
94// S32 mLastHoverMouseY;
95 LLQuaternion mRotation;
96
97 LLVector3 mMouseDown;
98 LLVector3 mMouseCur;
99 F32 mRadiusMeters;
100
101 LLVector3 mCenterToCam;
102 LLVector3 mCenterToCamNorm;
103 F32 mCenterToCamMag;
104 LLVector3 mCenterToProfilePlane;
105 F32 mCenterToProfilePlaneMag;
106
107 EManipPart mManipPart;
108
109 BOOL mSendUpdateOnMouseUp;
110 EManipPart mHighlightedPart;
111
112 BOOL mSmoothRotate;
113 BOOL mCamEdgeOn;
114
115 LLVector4 mManipulatorVertices[6];
116 LLVector4 mManipulatorScales;
117};
118
119#endif // LL_LLMANIPROTATE_H