aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llcape.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/llcape.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/llcape.h')
-rw-r--r--linden/indra/newview/llcape.h226
1 files changed, 226 insertions, 0 deletions
diff --git a/linden/indra/newview/llcape.h b/linden/indra/newview/llcape.h
new file mode 100644
index 0000000..584cc19
--- /dev/null
+++ b/linden/indra/newview/llcape.h
@@ -0,0 +1,226 @@
1/**
2 * @file llcape.h
3 * @brief LLVOCloth class definition
4 *
5 * Copyright (c) 2005-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 LLCAPE_H
29#define LLCAPE_H
30
31#include "llviewerobject.h"
32
33class LLVolumeImplFlexible;
34
35//-----------------------------------------------------------------------------------
36// Default setting for the attributes of a cloth object...
37//-----------------------------------------------------------------------------------
38const F32 CLOTH_MIN_LENGTH = 0.2f;
39const F32 CLOTH_DEFAULT_LENGTH = 1.5f;
40const F32 CLOTH_MAX_LENGTH = 2.0f;
41
42const F32 CLOTH_MIN_TENSION = 0.0f;
43const F32 CLOTH_DEFAULT_TENSION = 1.0f;
44const F32 CLOTH_MAX_TENSION = 10.0f;
45
46const F32 CLOTH_MIN_GRAVITY = FLEXIBLE_OBJECT_MIN_GRAVITY;
47const F32 CLOTH_DEFAULT_GRAVITY = 0.3f;
48const F32 CLOTH_MAX_GRAVITY = FLEXIBLE_OBJECT_MAX_GRAVITY;
49
50const F32 CLOTH_MIN_PITCH = -1.0f;
51const F32 CLOTH_DEFAULT_PITCH = 0.1f;
52const F32 CLOTH_MAX_PITCH = 1.0f;
53
54const F32 CLOTH_MIN_AIR_FRICTION = FLEXIBLE_OBJECT_MIN_AIR_FRICTION;
55const F32 CLOTH_DEFAULT_AIR_FRICTION = 6.0f;
56const F32 CLOTH_MAX_AIR_FRICTION = FLEXIBLE_OBJECT_MAX_AIR_FRICTION;
57
58const F32 CLOTH_MIN_WIND_SENSITIVITY = FLEXIBLE_OBJECT_MIN_WIND_SENSITIVITY;
59const F32 CLOTH_DEFAULT_WIND_SENSITIVITY = 0.0f;
60const F32 CLOTH_MAX_WIND_SENSITIVITY = FLEXIBLE_OBJECT_MAX_WIND_SENSITIVITY;
61
62const F32 CLOTH_MIN_CIRCLE_WRAP_AMOUNT = 0.0f;
63const F32 CLOTH_DEFAULT_CIRCLE_WRAP_AMOUNT= 0.5f;
64const F32 CLOTH_MAX_CIRCLE_WRAP_AMOUNT = 1.0f;
65
66const F32 CLOTH_MIN_WIDTH = 0.01f;
67const F32 CLOTH_DEFAULT_WIDTH = 0.4f;
68const F32 CLOTH_MAX_WIDTH = 1.0f;
69
70const int CLOTH_MIN_STRANDS = 2;
71const int CLOTH_DEFAULT_NUM_STRANDS = 4;
72const int CLOTH_MAX_STRANDS = 8;
73
74const int CLOTH_MIN_SEGMENTS = 1;
75const int CLOTH_DEFAULT_NUM_SEGMENTS = 4;
76const int CLOTH_MAX_SEGMENTS = 8;
77
78const int CLOTH_MIN_TEXTURE_INDEX = 1;
79const int CLOTH_DEFAULT_TEXTURE_INDEX = 1;
80const int CLOTH_MAX_TEXTURE_INDEX = 7;
81
82const F32 CLOTH_MIN_AVATAR_COLLISION_SPHERE_RADIUS = 0.0f;
83const F32 CLOTH_DEFAULT_AVATAR_COLLISION_SPHERE_RADIUS= 0.1f;
84const F32 CLOTH_MAX_AVATAR_COLLISION_SPHERE_RADIUS = 3.0f;
85
86const F32 CLOTH_MIN_AVATAR_COLLISION_SPHERE_RIGHT_OFFSET = -2.0f;
87const F32 CLOTH_DEFAULT_AVATAR_COLLISION_SPHERE_RIGHT_OFFSET = 0.0f;
88const F32 CLOTH_MAX_AVATAR_COLLISION_SPHERE_RIGHT_OFFSET = 2.0f;
89
90const F32 CLOTH_MIN_AVATAR_COLLISION_SPHERE_UP_OFFSET = -2.0f;
91const F32 CLOTH_DEFAULT_AVATAR_COLLISION_SPHERE_UP_OFFSET = 0.0f;
92const F32 CLOTH_MAX_AVATAR_COLLISION_SPHERE_UP_OFFSET = 2.0f;
93
94const F32 CLOTH_MIN_AVATAR_COLLISION_SPHERE_FORWARD_OFFSET = -2.0f;
95const F32 CLOTH_DEFAULT_AVATAR_COLLISION_SPHERE_FORWARD_OFFSET = 0.0f;
96const F32 CLOTH_MAX_AVATAR_COLLISION_SPHERE_FORWARD_OFFSET = 2.0f;
97
98const LLString CLOTH_DEFAULT_TEXTURE_FILENAME = "not_specified";
99const bool CLOTH_DEFAULT_VISUALIZE_STRANDS = false;
100const bool CLOTH_DEFAULT_VISUALIZE_COLLISION_SPHERE = false;
101
102const bool CLOTH_DEFAULT_USING_AVATAR_COLLISION_SPHERE = false;
103const LLVector3 CLOTH_DEFAULT_AVATAR_COLLISION_SPHERE_POSITION_OFFSET = LLVector3::zero;
104
105
106//-------------------------------------------------
107// This structure is also used in the part of the
108// code that creates new cloth objects.
109//-------------------------------------------------
110struct LLClothAttributes
111{
112 int mTextureIndex;
113 LLString mTextureFileName;
114 bool mVisualizeStrands;
115 bool mVisualizeAvCollisionSphere;
116 int mNumStrands;
117 int mNumSegments;
118 F32 mWidth;
119 F32 mPitch;
120 F32 mLength;
121 F32 mTension;
122 F32 mGravity;
123 F32 mAirFriction;
124 F32 mWindSensitivity;
125 F32 mCircleWrapAmount;
126 bool mUsingAvatarCollisionSphere;
127 F32 mAvatarCollisionSphereRightOffset;
128 F32 mAvatarCollisionSphereUpOffset;
129 F32 mAvatarCollisionSphereForwardOffset;
130 F32 mAvatarCollisionSphereRadius;
131
132
133
134 //------ the constructor for the structure ------------
135 LLClothAttributes()
136 {
137 mTextureFileName = CLOTH_DEFAULT_TEXTURE_FILENAME;
138 mVisualizeStrands = CLOTH_DEFAULT_VISUALIZE_STRANDS;
139 mNumStrands = CLOTH_DEFAULT_NUM_STRANDS;
140 mNumSegments = CLOTH_DEFAULT_NUM_SEGMENTS;
141 mWidth = CLOTH_DEFAULT_WIDTH;
142 mLength = CLOTH_DEFAULT_LENGTH;
143 mPitch = CLOTH_DEFAULT_PITCH;
144 mTension = CLOTH_DEFAULT_TENSION;
145 mGravity = CLOTH_DEFAULT_GRAVITY;
146 mAirFriction = CLOTH_DEFAULT_AIR_FRICTION;
147 mWindSensitivity = CLOTH_DEFAULT_WIND_SENSITIVITY;
148 mCircleWrapAmount = CLOTH_DEFAULT_CIRCLE_WRAP_AMOUNT;
149 mTextureIndex = CLOTH_DEFAULT_TEXTURE_INDEX;
150 }
151};// end of attributes structure
152
153
154
155//---------------------------------------------------------
156// The LLVOCloth class
157//---------------------------------------------------------
158class LLVOCloth : public LLViewerObject
159{
160 public:
161 LLVOCloth(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp);
162 void update();
163 void render();
164 void markAsDead();
165
166 //----------------------------------------------
167 // set stuff
168 //----------------------------------------------
169 void setAttributes( LLClothAttributes );
170 void setNumStrands( int num );
171 void setNumSegments( int num );
172 void setLength( F32 length );
173 void setTension( F32 t );
174 void setGravity( F32 g );
175 void setCircleWrapAmount( F32 n );
176 void setAirFriction( F32 a );
177 void setWindSensitivity( F32 w );
178 void setPitch( F32 p );
179 void setWidth( F32 n );
180 void setVisualizingStrands( bool v );
181 void setVisualizingAvCollisionSphere( bool v );
182 void setAvatarCollisionSphereRadius( F32 r );
183 void setAvatarCollisionSphereRight( F32 r );
184 void setAvatarCollisionSphereUp( F32 u );
185 void setAvatarCollisionSphereForward( F32 f);
186
187 //----------------------------------------------
188 // get stuff
189 //----------------------------------------------
190 bool getVisualizingStrands() const;
191 bool getVisualizingAvCollisionSphere() const;
192 int getNumStrands();
193 int getNumSegments();
194 F32 getLength();
195 F32 getWidth();
196 F32 getCircleWrapAmount();
197 F32 getPitch();
198 F32 getTension();
199 F32 getGravity();
200 F32 getAirFriction();
201 F32 getWindSensitivity();
202 F32 getAvatarCollisionSphereRadius();
203 F32 getAvatarCollisionSphereRight();
204 F32 getAvatarCollisionSphereUp();
205 F32 getAvatarCollisionSphereForward();
206
207 private:
208 //--------------------------------------
209 // private members
210 //--------------------------------------
211 LLClothAttributes mAttributes; // these determine the characteristics of the cloth
212 LLVector3 mAvatarCollisionSpherePosition; // derived from the avatar
213 LLViewerObject* mDummyVO [ CLOTH_MAX_STRANDS ];
214 LLVolumeImplFlexible* mStrand [ CLOTH_MAX_STRANDS ]; // the array of strands that make up the cloth
215
216
217 //--------------------------------------
218 // private methods
219 //--------------------------------------
220 void updateVirtualServer();
221 void generateStrands();
222
223};// end of class definition
224
225
226#endif // LL_CLOTH_H