diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/lllocalanimationobject.cpp | |
parent | README.txt (diff) | |
download | meta-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/lllocalanimationobject.cpp')
-rw-r--r-- | linden/indra/newview/lllocalanimationobject.cpp | 294 |
1 files changed, 294 insertions, 0 deletions
diff --git a/linden/indra/newview/lllocalanimationobject.cpp b/linden/indra/newview/lllocalanimationobject.cpp new file mode 100644 index 0000000..b7cccae --- /dev/null +++ b/linden/indra/newview/lllocalanimationobject.cpp | |||
@@ -0,0 +1,294 @@ | |||
1 | /** | ||
2 | * @file lllocalanimationobject.cpp | ||
3 | * @brief LLHUDLocalAnimationObject class implementation | ||
4 | * | ||
5 | * Copyright (c) 2006-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 | #include "llviewerprecompiledheaders.h" | ||
29 | |||
30 | #include "lllocalanimationobject.h" | ||
31 | #include "llglheaders.h" | ||
32 | #include "llsphere.h" | ||
33 | #include "llrand.h" | ||
34 | #include "llviewerobject.h" | ||
35 | |||
36 | const F32 OPACITY = 1.0f; | ||
37 | const int _X_ = 0; | ||
38 | const int _Y_ = 1; | ||
39 | const int _Z_ = 2; | ||
40 | const F32 BODY_RADIUS = 0.2f; | ||
41 | const F32 HEAD_RADIUS = 0.1f; | ||
42 | const F32 ONE_HALF = 0.5f; | ||
43 | |||
44 | /* | ||
45 | //----------------------------------------------- | ||
46 | // constructor | ||
47 | //----------------------------------------------- | ||
48 | LLHUDLocalAnimationObject::LLHUDLocalAnimationObject() | ||
49 | : LLHUDObject( LL_HUD_LOCAL_ANIMATION_OBJECT )// cal the base class and pass this in, K? | ||
50 | { | ||
51 | mParentObject = NULL; | ||
52 | |||
53 | F32 windSensitivity = 0.04f; | ||
54 | |||
55 | //---------------------------------------------- | ||
56 | // trunk | ||
57 | //---------------------------------------------- | ||
58 | LLFlexibleObjectAttributes trunkAttributes; | ||
59 | trunkAttributes.mAnchorPositionOffset.setVec( 0.0f, 0.0f, -0.2f ); | ||
60 | trunkAttributes.mAnchorDirection.setVec( 0.0f, 0.0f, 1.0f ); | ||
61 | trunkAttributes.mColor = LLColor4( 0.4f, 0.3f, 0.2f, 1.0f ); | ||
62 | trunkAttributes.mAnchorDirection.normVec(); | ||
63 | trunkAttributes.mAnchorRadius = 0.3f; | ||
64 | trunkAttributes.mNumSections = 3; | ||
65 | trunkAttributes.mGravity = 1.2f; | ||
66 | trunkAttributes.mLength = 9.0f; | ||
67 | trunkAttributes.mTension = 10.0f; | ||
68 | trunkAttributes.mEndRadius = 0.2f; | ||
69 | trunkAttributes.mTextureFileName = "JVTestTreeTrunk.tga"; | ||
70 | trunkAttributes.mRenderStyle = "tube"; | ||
71 | |||
72 | mTrunk.setAttributes( trunkAttributes ); | ||
73 | |||
74 | |||
75 | |||
76 | //--------------------------------------------- | ||
77 | // frond 1 | ||
78 | //--------------------------------------------- | ||
79 | LLFlexibleObjectAttributes frond1Attributes; | ||
80 | |||
81 | frond1Attributes.mAnchorPositionOffset.setVec( 0.0f, 0.0f, 0.0f ); | ||
82 | frond1Attributes.mAnchorDirection.setVec( 1.0f, 0.0f, 1.0f ); | ||
83 | frond1Attributes.mAnchorDirection.normVec(); | ||
84 | frond1Attributes.mColor = LLColor4( 0.15f, 0.25f, 0.0f, 1.0f ); | ||
85 | frond1Attributes.mAnchorRadius = 0.5f; | ||
86 | frond1Attributes.mTension = 2.0f; | ||
87 | frond1Attributes.mNumSections = 2; | ||
88 | frond1Attributes.mGravity = 2.0f; | ||
89 | frond1Attributes.mLength = 5.0f; | ||
90 | frond1Attributes.mEndRadius = 0.0f; | ||
91 | frond1Attributes.mTextureFileName = "JVTestPalmFrond.tga"; | ||
92 | frond1Attributes.mRenderStyle = "billboard_tube"; | ||
93 | frond1Attributes.mWindSensitivity = windSensitivity; | ||
94 | |||
95 | mFrond1.setAttributes( frond1Attributes ); | ||
96 | |||
97 | //--------------------------------------------- | ||
98 | // frond 2 | ||
99 | //--------------------------------------------- | ||
100 | LLFlexibleObjectAttributes frond2Attributes; | ||
101 | |||
102 | frond2Attributes.mAnchorPositionOffset.setVec( 0.0f, 0.0f, 0.0f ); | ||
103 | frond2Attributes.mAnchorDirection.setVec( 1.0f, 0.7f, 0.7f ); | ||
104 | frond2Attributes.mAnchorDirection.normVec(); | ||
105 | frond2Attributes.mColor = LLColor4( 0.15f, 0.25f, 0.0f, 1.0f ); | ||
106 | frond2Attributes.mAnchorRadius = 0.5f; | ||
107 | frond2Attributes.mTension = 2.0f; | ||
108 | frond2Attributes.mNumSections = 2; | ||
109 | frond2Attributes.mGravity = 2.0f; | ||
110 | frond2Attributes.mLength = 6.0f; | ||
111 | frond2Attributes.mEndRadius = 0.0f; | ||
112 | frond2Attributes.mTextureFileName = "JVTestPalmFrond.tga"; | ||
113 | frond2Attributes.mRenderStyle = "billboard_tube"; | ||
114 | frond2Attributes.mWindSensitivity = windSensitivity; | ||
115 | |||
116 | mFrond2.setAttributes( frond2Attributes ); | ||
117 | |||
118 | //--------------------------------------------- | ||
119 | // frond 3 | ||
120 | //--------------------------------------------- | ||
121 | LLFlexibleObjectAttributes frond3Attributes; | ||
122 | |||
123 | frond3Attributes.mAnchorPositionOffset.setVec( 0.0f, 0.0f, 0.0f ); | ||
124 | frond3Attributes.mAnchorDirection.setVec( 1.0f, 0.7f, -0.7f ); | ||
125 | frond3Attributes.mAnchorDirection.normVec(); | ||
126 | frond3Attributes.mColor = LLColor4( 0.15f, 0.25f, 0.0f, 1.0f ); | ||
127 | frond3Attributes.mAnchorRadius = 0.3f; | ||
128 | frond3Attributes.mTension = 2.0f; | ||
129 | frond3Attributes.mNumSections = 2; | ||
130 | frond3Attributes.mGravity = 2.0f; | ||
131 | frond3Attributes.mLength = 6.0f; | ||
132 | frond3Attributes.mEndRadius = 0.0f; | ||
133 | frond3Attributes.mTextureFileName = "JVTestPalmFrond.tga"; | ||
134 | frond3Attributes.mRenderStyle = "billboard_tube"; | ||
135 | frond3Attributes.mWindSensitivity = windSensitivity; | ||
136 | |||
137 | mFrond3.setAttributes( frond3Attributes ); | ||
138 | |||
139 | |||
140 | //--------------------------------------------- | ||
141 | // frond 4 | ||
142 | //--------------------------------------------- | ||
143 | LLFlexibleObjectAttributes frond4Attributes; | ||
144 | |||
145 | frond4Attributes.mAnchorPositionOffset.setVec( 0.0f, 0.0f, 0.0f ); | ||
146 | frond4Attributes.mAnchorDirection.setVec( 1.0f, -0.8f, 0.3f ); | ||
147 | frond4Attributes.mAnchorDirection.normVec(); | ||
148 | frond4Attributes.mColor = LLColor4( 0.15f, 0.25f, 0.0f, 1.0f ); | ||
149 | frond4Attributes.mAnchorRadius = 0.5f; | ||
150 | frond4Attributes.mTension = 2.0f; | ||
151 | frond4Attributes.mNumSections = 2; | ||
152 | frond4Attributes.mGravity = 2.0f; | ||
153 | frond4Attributes.mLength = 6.0f; | ||
154 | frond4Attributes.mEndRadius = 0.0f; | ||
155 | frond4Attributes.mTextureFileName = "JVTestPalmFrond.tga"; | ||
156 | frond4Attributes.mRenderStyle = "billboard_tube"; | ||
157 | frond4Attributes.mWindSensitivity = windSensitivity; | ||
158 | |||
159 | |||
160 | mFrond4.setAttributes( frond4Attributes ); | ||
161 | |||
162 | |||
163 | //--------------------------------------------- | ||
164 | // frond 5 | ||
165 | //--------------------------------------------- | ||
166 | LLFlexibleObjectAttributes frond5Attributes; | ||
167 | |||
168 | frond5Attributes.mAnchorPositionOffset.setVec( 0.0f, 0.0f, 0.0f ); | ||
169 | frond5Attributes.mAnchorDirection.setVec( 1.0f, -0.8f, -0.3f ); | ||
170 | frond5Attributes.mAnchorDirection.normVec(); | ||
171 | frond5Attributes.mColor = LLColor4( 0.15f, 0.25f, 0.0f, 1.0f ); | ||
172 | frond5Attributes.mAnchorRadius = 0.5f; | ||
173 | frond5Attributes.mTension = 2.0f; | ||
174 | frond5Attributes.mNumSections = 2; | ||
175 | frond5Attributes.mGravity = 2.0f; | ||
176 | frond5Attributes.mLength = 5.0f; | ||
177 | frond5Attributes.mEndRadius = 0.0f; | ||
178 | frond5Attributes.mTextureFileName = "JVTestPalmFrond.tga"; | ||
179 | frond5Attributes.mRenderStyle = "billboard_tube"; | ||
180 | frond5Attributes.mWindSensitivity = windSensitivity; | ||
181 | |||
182 | mFrond5.setAttributes( frond5Attributes ); | ||
183 | |||
184 | }//------------------------------------------------------------------------------ | ||
185 | |||
186 | |||
187 | |||
188 | //--------------------------------------------------------------------------------- | ||
189 | void LLHUDLocalAnimationObject::update() | ||
190 | { | ||
191 | if ( ! mParentObject ) | ||
192 | { | ||
193 | return; | ||
194 | } | ||
195 | |||
196 | //-------------------------------------------------------------------------------------------------- | ||
197 | // now, setting the trunk position and orientation, and updating it... | ||
198 | //-------------------------------------------------------------------------------------------------- | ||
199 | mTrunk.setParentPositionAndRotationDirectly( mParentObject->getRenderPosition(), mParentObject->getRenderRotation() ); | ||
200 | mTrunk.update(); | ||
201 | |||
202 | |||
203 | //-------------------------------------------------------------------------------------------------- | ||
204 | // now, setting the frond positions and orientations, and updating them... | ||
205 | //-------------------------------------------------------------------------------------------------- | ||
206 | mFrond1.setParentPositionAndRotationDirectly( mTrunk.getEndPosition(), mTrunk.getEndRotation() ); | ||
207 | mFrond2.setParentPositionAndRotationDirectly( mTrunk.getEndPosition(), mTrunk.getEndRotation() ); | ||
208 | mFrond3.setParentPositionAndRotationDirectly( mTrunk.getEndPosition(), mTrunk.getEndRotation() ); | ||
209 | mFrond4.setParentPositionAndRotationDirectly( mTrunk.getEndPosition(), mTrunk.getEndRotation() ); | ||
210 | mFrond5.setParentPositionAndRotationDirectly( mTrunk.getEndPosition(), mTrunk.getEndRotation() ); | ||
211 | |||
212 | mFrond1.update(); | ||
213 | mFrond2.update(); | ||
214 | mFrond3.update(); | ||
215 | mFrond4.update(); | ||
216 | mFrond5.update(); | ||
217 | |||
218 | }//------------------------------------------------------------------ | ||
219 | |||
220 | |||
221 | |||
222 | |||
223 | |||
224 | |||
225 | |||
226 | //------------------------------------------------------------------ | ||
227 | void LLHUDLocalAnimationObject::render() | ||
228 | { | ||
229 | mTrunk.render(); | ||
230 | |||
231 | mFrond1.render(); | ||
232 | mFrond2.render(); | ||
233 | mFrond3.render(); | ||
234 | mFrond4.render(); | ||
235 | mFrond5.render(); | ||
236 | |||
237 | }//------------------------------------------------------------------ | ||
238 | |||
239 | |||
240 | |||
241 | |||
242 | |||
243 | //------------------------------------------------------------------ | ||
244 | void LLHUDLocalAnimationObject::setAttributes( LLLocalAnimationObjectAttributes a ) | ||
245 | { | ||
246 | //mAttributes = a; // ???? // how do I do this? | ||
247 | |||
248 | //mAttributes.mAnchorPositionOffset = a.mAnchorPositionOffset; | ||
249 | //mAttributes.mAnchorDirection = a.mAnchorDirection; | ||
250 | //mAttributes.mAnchorRadius = a.mAnchorRadius; | ||
251 | //mAttributes.mNumSections = a.mNumSections; | ||
252 | //mAttributes.mLength = a.mLength; | ||
253 | //mAttributes.mGravity = a.mGravity; | ||
254 | //mAttributes.mAirFriction = a.mAirFriction; | ||
255 | //mAttributes.mTension = a.mTension; | ||
256 | //mAttributes.mRadiusChange = a.mRadiusChange; | ||
257 | |||
258 | }//------------------------------------------------------------------ | ||
259 | |||
260 | |||
261 | |||
262 | //------------------------------------------------------------------ | ||
263 | void LLHUDLocalAnimationObject::setParentObject( LLViewerObject * p ) | ||
264 | { | ||
265 | printf( "Setting parent of localAnimationObject controls %x to object %x \n", this, p ); | ||
266 | mParentObject = p; | ||
267 | |||
268 | }//------------------------------------------------------------------ | ||
269 | |||
270 | |||
271 | //------------------------------------------------------------------ | ||
272 | LLViewerObject * LLHUDLocalAnimationObject::getParentObject() | ||
273 | { | ||
274 | return mParentObject; | ||
275 | |||
276 | }//------------------------------------------------------------------ | ||
277 | |||
278 | |||
279 | |||
280 | //------------------------------------------------------------------ | ||
281 | void LLHUDLocalAnimationObject::markAsDead() | ||
282 | { | ||
283 | mDead = TRUE; | ||
284 | mParentObject = NULL; | ||
285 | |||
286 | }//------------------------------------------------------------------ | ||
287 | |||
288 | */ | ||
289 | |||
290 | |||
291 | |||
292 | |||
293 | |||
294 | |||