aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmanipscale.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llmanipscale.h
parentREADME.txt (diff)
downloadmeta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2
meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llmanipscale.h')
-rw-r--r--linden/indra/newview/llmanipscale.h156
1 files changed, 156 insertions, 0 deletions
diff --git a/linden/indra/newview/llmanipscale.h b/linden/indra/newview/llmanipscale.h
new file mode 100644
index 0000000..7ac3aef
--- /dev/null
+++ b/linden/indra/newview/llmanipscale.h
@@ -0,0 +1,156 @@
1/**
2 * @file llmanipscale.h
3 * @brief LLManipScale class definition
4 *
5 * Copyright (c) 2001-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_MANIPSCALE_H
29#define LL_MANIPSCALE_H
30
31// llmanipscale.h
32//
33// copyright 2001-2002, linden research inc
34
35
36#include "lltool.h"
37#include "v3math.h"
38#include "v4math.h"
39#include "llmanip.h"
40#include "llviewerobject.h"
41#include "llbbox.h"
42
43class LLToolComposite;
44class LLColor4;
45
46typedef enum e_scale_manipulator_type
47{
48 SCALE_MANIP_CORNER,
49 SCALE_MANIP_FACE
50} EScaleManipulatorType;
51
52
53class LLManipScale : public LLManip
54{
55public:
56 class ManipulatorHandle
57 {
58 public:
59 LLVector3 mPosition;
60 EManipPart mManipID;
61 EScaleManipulatorType mType;
62
63 ManipulatorHandle(LLVector3 pos, EManipPart id, EScaleManipulatorType type):mPosition(pos), mManipID(id), mType(type){}
64 };
65
66
67 LLManipScale( LLToolComposite* composite );
68 ~LLManipScale();
69
70 virtual BOOL handleMouseDown( S32 x, S32 y, MASK mask );
71 virtual BOOL handleMouseUp( S32 x, S32 y, MASK mask );
72 virtual BOOL handleHover( S32 x, S32 y, MASK mask );
73 virtual void render();
74 virtual void handleSelect();
75 virtual void handleDeselect();
76
77 BOOL handleMouseDownOnPart(S32 x, S32 y, MASK mask);
78 EManipPart getHighlightedPart() { return mHighlightedPart; }
79 virtual void highlightManipulators(S32 x, S32 y); // decided which manipulator, if any, should be highlighted by mouse hover
80
81 static void setUniform( BOOL b );
82 static BOOL getUniform();
83 static void setStretchTextures( BOOL b );
84 static BOOL getStretchTextures();
85 static void setShowAxes( BOOL b );
86 static BOOL getShowAxes();
87
88private:
89 void renderCorners( const LLBBox& local_bbox );
90 void renderFaces( const LLBBox& local_bbox );
91 void renderEdges( const LLBBox& local_bbox );
92 void renderBoxHandle( F32 x, F32 y, F32 z );
93 void renderAxisHandle( const LLVector3& start, const LLVector3& end );
94 void renderGuidelinesPart( const LLBBox& local_bbox );
95 void renderSnapGuides( const LLBBox& local_bbox );
96
97 void revert();
98
99 inline void conditionalHighlight( U32 part, const LLColor4* highlight = NULL, const LLColor4* normal = NULL );
100
101 void drag( S32 x, S32 y );
102 void dragFace( S32 x, S32 y );
103 void dragCorner( S32 x, S32 y );
104
105 void sendUpdates( BOOL send_position_update, BOOL send_scale_update, BOOL corner = FALSE);
106
107 LLVector3 faceToUnitVector( S32 part ) const;
108 LLVector3 cornerToUnitVector( S32 part ) const;
109 LLVector3 edgeToUnitVector( S32 part ) const;
110 LLVector3 partToUnitVector( S32 part ) const;
111 LLVector3 unitVectorToLocalBBoxExtent( const LLVector3& v, const LLBBox& bbox ) const;
112 F32 partToMaxScale( S32 part, const LLBBox& bbox ) const;
113 F32 partToMinScale( S32 part, const LLBBox& bbox ) const;
114 LLVector3 nearestAxis( const LLVector3& v ) const;
115
116 BOOL isSelectionScalable() const;
117
118 void stretchFace( const LLVector3& drag_start_agent, const LLVector3& drag_delta_agent);
119
120 void adjustTextureRepeats(); // Adjusts texture coords based on mSavedScale and current scale, only works for boxes
121
122 void updateSnapGuides(const LLBBox& bbox);
123private:
124
125 F32 mBoxHandleSize; // The size of the handles at the corners of the bounding box
126 F32 mScaledBoxHandleSize; // handle size after scaling for selection feedback
127 EManipPart mManipPart;
128 LLVector3d mDragStartPointGlobal;
129 LLVector3d mDragStartCenterGlobal; // The center of the bounding box of all selected objects at time of drag start
130 LLVector3d mDragPointGlobal;
131 LLVector3d mDragFarHitGlobal;
132 EManipPart mHighlightedPart;
133 S32 mLastMouseX;
134 S32 mLastMouseY;
135 BOOL mSendUpdateOnMouseUp;
136 U32 mLastUpdateFlags;
137 LLLinkedList<ManipulatorHandle> mProjectedManipulators;
138 LLVector4 mManipulatorVertices[14];
139 F32 mScaleSnapUnit1; // size of snap multiples for axis 1
140 F32 mScaleSnapUnit2; // size of snap multiples for axis 2
141 LLVector3 mScalePlaneNormal1; // normal of plane in which scale occurs that most faces camera
142 LLVector3 mScalePlaneNormal2; // normal of plane in which scale occurs that most faces camera
143 LLVector3 mSnapGuideDir1;
144 LLVector3 mSnapGuideDir2;
145 LLVector3 mSnapDir1;
146 LLVector3 mSnapDir2;
147 F32 mSnapRegimeOffset;
148 F32 mSnapGuideLength;
149 LLVector3 mScaleCenter;
150 LLVector3 mScaleDir;
151 F32 mScaleSnapValue;
152 BOOL mInSnapRegime;
153 F32* mManipulatorScales;
154};
155
156#endif // LL_MANIPSCALE_H