aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llviewerjoint.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:57 -0500
committerJacek Antonelli2008-08-15 23:45:57 -0500
commit7e3007b63521c4b0c5bbad1c3964a557fc526ce2 (patch)
treeab231ed574db618873d6ebb25293cf7c0cb6d26e /linden/indra/newview/llviewerjoint.cpp
parentSecond Life viewer sources 1.20.10 (diff)
downloadmeta-impy-7e3007b63521c4b0c5bbad1c3964a557fc526ce2.zip
meta-impy-7e3007b63521c4b0c5bbad1c3964a557fc526ce2.tar.gz
meta-impy-7e3007b63521c4b0c5bbad1c3964a557fc526ce2.tar.bz2
meta-impy-7e3007b63521c4b0c5bbad1c3964a557fc526ce2.tar.xz
Second Life viewer sources 1.20.11
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llviewerjoint.cpp304
1 files changed, 153 insertions, 151 deletions
diff --git a/linden/indra/newview/llviewerjoint.cpp b/linden/indra/newview/llviewerjoint.cpp
index 1be6e66..914448e 100644
--- a/linden/indra/newview/llviewerjoint.cpp
+++ b/linden/indra/newview/llviewerjoint.cpp
@@ -118,123 +118,124 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive )
118 118
119//-------------------------------------------------------------------- 119//--------------------------------------------------------------------
120// renderSkeleton() 120// renderSkeleton()
121// DEBUG (UNUSED)
121//-------------------------------------------------------------------- 122//--------------------------------------------------------------------
122void LLViewerJoint::renderSkeleton(BOOL recursive) 123// void LLViewerJoint::renderSkeleton(BOOL recursive)
123{ 124// {
124 F32 nc = 0.57735f; 125// F32 nc = 0.57735f;
125 126
126 //---------------------------------------------------------------- 127// //----------------------------------------------------------------
127 // push matrix stack 128// // push matrix stack
128 //---------------------------------------------------------------- 129// //----------------------------------------------------------------
129 glPushMatrix(); 130// glPushMatrix();
130 131
131 //---------------------------------------------------------------- 132// //----------------------------------------------------------------
132 // render the bone to my parent 133// // render the bone to my parent
133 //---------------------------------------------------------------- 134// //----------------------------------------------------------------
134 if (mComponents & SC_BONE) 135// if (mComponents & SC_BONE)
135 { 136// {
136 drawBone(); 137// drawBone();
137 } 138// }
138 139
139 //---------------------------------------------------------------- 140// //----------------------------------------------------------------
140 // offset to joint position and 141// // offset to joint position and
141 // rotate to our orientation 142// // rotate to our orientation
142 //---------------------------------------------------------------- 143// //----------------------------------------------------------------
143 glLoadIdentity(); 144// glLoadIdentity();
144 glMultMatrixf( &getWorldMatrix().mMatrix[0][0] ); 145// glMultMatrixf( &getWorldMatrix().mMatrix[0][0] );
145 146
146 //---------------------------------------------------------------- 147// //----------------------------------------------------------------
147 // render joint axes 148// // render joint axes
148 //---------------------------------------------------------------- 149// //----------------------------------------------------------------
149 if (mComponents & SC_AXES) 150// if (mComponents & SC_AXES)
150 { 151// {
151 gGL.begin(LLVertexBuffer::LINES); 152// gGL.begin(LLVertexBuffer::LINES);
152 gGL.color3f( 1.0f, 0.0f, 0.0f ); 153// gGL.color3f( 1.0f, 0.0f, 0.0f );
153 gGL.vertex3f( 0.0f, 0.0f, 0.0f ); 154// gGL.vertex3f( 0.0f, 0.0f, 0.0f );
154 gGL.vertex3f( 0.1f, 0.0f, 0.0f ); 155// gGL.vertex3f( 0.1f, 0.0f, 0.0f );
155 156
156 gGL.color3f( 0.0f, 1.0f, 0.0f ); 157// gGL.color3f( 0.0f, 1.0f, 0.0f );
157 gGL.vertex3f( 0.0f, 0.0f, 0.0f ); 158// gGL.vertex3f( 0.0f, 0.0f, 0.0f );
158 gGL.vertex3f( 0.0f, 0.1f, 0.0f ); 159// gGL.vertex3f( 0.0f, 0.1f, 0.0f );
159 160
160 gGL.color3f( 0.0f, 0.0f, 1.0f ); 161// gGL.color3f( 0.0f, 0.0f, 1.0f );
161 gGL.vertex3f( 0.0f, 0.0f, 0.0f ); 162// gGL.vertex3f( 0.0f, 0.0f, 0.0f );
162 gGL.vertex3f( 0.0f, 0.0f, 0.1f ); 163// gGL.vertex3f( 0.0f, 0.0f, 0.1f );
163 gGL.end(); 164// gGL.end();
164 } 165// }
165 166
166 //---------------------------------------------------------------- 167// //----------------------------------------------------------------
167 // render the joint graphic 168// // render the joint graphic
168 //---------------------------------------------------------------- 169// //----------------------------------------------------------------
169 if (mComponents & SC_JOINT) 170// if (mComponents & SC_JOINT)
170 { 171// {
171 gGL.color3f( 1.0f, 1.0f, 0.0f ); 172// gGL.color3f( 1.0f, 1.0f, 0.0f );
172 173
173 gGL.begin(LLVertexBuffer::TRIANGLES); 174// gGL.begin(LLVertexBuffer::TRIANGLES);
174 175
175 // joint top half 176// // joint top half
176 glNormal3f(nc, nc, nc); 177// glNormal3f(nc, nc, nc);
177 gGL.vertex3f(0.0f, 0.0f, 0.05f); 178// gGL.vertex3f(0.0f, 0.0f, 0.05f);
178 gGL.vertex3f(0.05f, 0.0f, 0.0f); 179// gGL.vertex3f(0.05f, 0.0f, 0.0f);
179 gGL.vertex3f(0.0f, 0.05f, 0.0f); 180// gGL.vertex3f(0.0f, 0.05f, 0.0f);
180 181
181 glNormal3f(-nc, nc, nc); 182// glNormal3f(-nc, nc, nc);
182 gGL.vertex3f(0.0f, 0.0f, 0.05f); 183// gGL.vertex3f(0.0f, 0.0f, 0.05f);
183 gGL.vertex3f(0.0f, 0.05f, 0.0f); 184// gGL.vertex3f(0.0f, 0.05f, 0.0f);
184 gGL.vertex3f(-0.05f, 0.0f, 0.0f); 185// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
185 186
186 glNormal3f(-nc, -nc, nc); 187// glNormal3f(-nc, -nc, nc);
187 gGL.vertex3f(0.0f, 0.0f, 0.05f); 188// gGL.vertex3f(0.0f, 0.0f, 0.05f);
188 gGL.vertex3f(-0.05f, 0.0f, 0.0f); 189// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
189 gGL.vertex3f(0.0f, -0.05f, 0.0f); 190// gGL.vertex3f(0.0f, -0.05f, 0.0f);
190 191
191 glNormal3f(nc, -nc, nc); 192// glNormal3f(nc, -nc, nc);
192 gGL.vertex3f(0.0f, 0.0f, 0.05f); 193// gGL.vertex3f(0.0f, 0.0f, 0.05f);
193 gGL.vertex3f(0.0f, -0.05f, 0.0f); 194// gGL.vertex3f(0.0f, -0.05f, 0.0f);
194 gGL.vertex3f(0.05f, 0.0f, 0.0f); 195// gGL.vertex3f(0.05f, 0.0f, 0.0f);
195 196
196 // joint bottom half 197// // joint bottom half
197 glNormal3f(nc, nc, -nc); 198// glNormal3f(nc, nc, -nc);
198 gGL.vertex3f(0.0f, 0.0f, -0.05f); 199// gGL.vertex3f(0.0f, 0.0f, -0.05f);
199 gGL.vertex3f(0.0f, 0.05f, 0.0f); 200// gGL.vertex3f(0.0f, 0.05f, 0.0f);
200 gGL.vertex3f(0.05f, 0.0f, 0.0f); 201// gGL.vertex3f(0.05f, 0.0f, 0.0f);
201 202
202 glNormal3f(-nc, nc, -nc); 203// glNormal3f(-nc, nc, -nc);
203 gGL.vertex3f(0.0f, 0.0f, -0.05f); 204// gGL.vertex3f(0.0f, 0.0f, -0.05f);
204 gGL.vertex3f(-0.05f, 0.0f, 0.0f); 205// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
205 gGL.vertex3f(0.0f, 0.05f, 0.0f); 206// gGL.vertex3f(0.0f, 0.05f, 0.0f);
206 207
207 glNormal3f(-nc, -nc, -nc); 208// glNormal3f(-nc, -nc, -nc);
208 gGL.vertex3f(0.0f, 0.0f, -0.05f); 209// gGL.vertex3f(0.0f, 0.0f, -0.05f);
209 gGL.vertex3f(0.0f, -0.05f, 0.0f); 210// gGL.vertex3f(0.0f, -0.05f, 0.0f);
210 gGL.vertex3f(-0.05f, 0.0f, 0.0f); 211// gGL.vertex3f(-0.05f, 0.0f, 0.0f);
211 212
212 glNormal3f(nc, -nc, -nc); 213// glNormal3f(nc, -nc, -nc);
213 gGL.vertex3f(0.0f, 0.0f, -0.05f); 214// gGL.vertex3f(0.0f, 0.0f, -0.05f);
214 gGL.vertex3f(0.05f, 0.0f, 0.0f); 215// gGL.vertex3f(0.05f, 0.0f, 0.0f);
215 gGL.vertex3f(0.0f, -0.05f, 0.0f); 216// gGL.vertex3f(0.0f, -0.05f, 0.0f);
216 217
217 gGL.end(); 218// gGL.end();
218 } 219// }
219 220
220 //---------------------------------------------------------------- 221// //----------------------------------------------------------------
221 // render children 222// // render children
222 //---------------------------------------------------------------- 223// //----------------------------------------------------------------
223 if (recursive) 224// if (recursive)
224 { 225// {
225 for (child_list_t::iterator iter = mChildren.begin(); 226// for (child_list_t::iterator iter = mChildren.begin();
226 iter != mChildren.end(); ++iter) 227// iter != mChildren.end(); ++iter)
227 { 228// {
228 LLViewerJoint* joint = (LLViewerJoint*)(*iter); 229// LLViewerJoint* joint = (LLViewerJoint*)(*iter);
229 joint->renderSkeleton(); 230// joint->renderSkeleton();
230 } 231// }
231 } 232// }
232 233
233 //---------------------------------------------------------------- 234// //----------------------------------------------------------------
234 // pop matrix stack 235// // pop matrix stack
235 //---------------------------------------------------------------- 236// //----------------------------------------------------------------
236 glPopMatrix(); 237// glPopMatrix();
237} 238// }
238 239
239 240
240//-------------------------------------------------------------------- 241//--------------------------------------------------------------------
@@ -330,59 +331,60 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass )
330 331
331//-------------------------------------------------------------------- 332//--------------------------------------------------------------------
332// drawBone() 333// drawBone()
334// DEBUG (UNUSED)
333//-------------------------------------------------------------------- 335//--------------------------------------------------------------------
334void LLViewerJoint::drawBone() 336// void LLViewerJoint::drawBone()
335{ 337// {
336 if ( mParent == NULL ) 338// if ( mParent == NULL )
337 return; 339// return;
338 340
339 F32 boneSize = 0.02f; 341// F32 boneSize = 0.02f;
340 342
341 // rotate to point to child (bone direction) 343// // rotate to point to child (bone direction)
342 glPushMatrix(); 344// glPushMatrix();
343 345
344 LLVector3 boneX = getPosition(); 346// LLVector3 boneX = getPosition();
345 F32 length = boneX.normVec(); 347// F32 length = boneX.normVec();
346 348
347 LLVector3 boneZ(1.0f, 0.0f, 1.0f); 349// LLVector3 boneZ(1.0f, 0.0f, 1.0f);
348 350
349 LLVector3 boneY = boneZ % boneX; 351// LLVector3 boneY = boneZ % boneX;
350 boneY.normVec(); 352// boneY.normVec();
351 353
352 boneZ = boneX % boneY; 354// boneZ = boneX % boneY;
353 355
354 LLMatrix4 rotateMat; 356// LLMatrix4 rotateMat;
355 rotateMat.setFwdRow( boneX ); 357// rotateMat.setFwdRow( boneX );
356 rotateMat.setLeftRow( boneY ); 358// rotateMat.setLeftRow( boneY );
357 rotateMat.setUpRow( boneZ ); 359// rotateMat.setUpRow( boneZ );
358 glMultMatrixf( &rotateMat.mMatrix[0][0] ); 360// glMultMatrixf( &rotateMat.mMatrix[0][0] );
359 361
360 // render the bone 362// // render the bone
361 gGL.color3f( 0.5f, 0.5f, 0.0f ); 363// gGL.color3f( 0.5f, 0.5f, 0.0f );
362 364
363 gGL.begin(LLVertexBuffer::TRIANGLES); 365// gGL.begin(LLVertexBuffer::TRIANGLES);
364 366
365 gGL.vertex3f( length, 0.0f, 0.0f); 367// gGL.vertex3f( length, 0.0f, 0.0f);
366 gGL.vertex3f( 0.0f, boneSize, 0.0f); 368// gGL.vertex3f( 0.0f, boneSize, 0.0f);
367 gGL.vertex3f( 0.0f, 0.0f, boneSize); 369// gGL.vertex3f( 0.0f, 0.0f, boneSize);
368 370
369 gGL.vertex3f( length, 0.0f, 0.0f); 371// gGL.vertex3f( length, 0.0f, 0.0f);
370 gGL.vertex3f( 0.0f, 0.0f, -boneSize); 372// gGL.vertex3f( 0.0f, 0.0f, -boneSize);
371 gGL.vertex3f( 0.0f, boneSize, 0.0f); 373// gGL.vertex3f( 0.0f, boneSize, 0.0f);
372 374
373 gGL.vertex3f( length, 0.0f, 0.0f); 375// gGL.vertex3f( length, 0.0f, 0.0f);
374 gGL.vertex3f( 0.0f, -boneSize, 0.0f); 376// gGL.vertex3f( 0.0f, -boneSize, 0.0f);
375 gGL.vertex3f( 0.0f, 0.0f, -boneSize); 377// gGL.vertex3f( 0.0f, 0.0f, -boneSize);
376 378
377 gGL.vertex3f( length, 0.0f, 0.0f); 379// gGL.vertex3f( length, 0.0f, 0.0f);
378 gGL.vertex3f( 0.0f, 0.0f, boneSize); 380// gGL.vertex3f( 0.0f, 0.0f, boneSize);
379 gGL.vertex3f( 0.0f, -boneSize, 0.0f); 381// gGL.vertex3f( 0.0f, -boneSize, 0.0f);
380 382
381 gGL.end(); 383// gGL.end();
382 384
383 // restore matrix 385// // restore matrix
384 glPopMatrix(); 386// glPopMatrix();
385} 387// }
386 388
387//-------------------------------------------------------------------- 389//--------------------------------------------------------------------
388// isTransparent() 390// isTransparent()
@@ -437,13 +439,13 @@ void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind)
437 } 439 }
438} 440}
439 441
440void LLViewerJoint::updateGeometry() 442void LLViewerJoint::updateJointGeometry()
441{ 443{
442 for (child_list_t::iterator iter = mChildren.begin(); 444 for (child_list_t::iterator iter = mChildren.begin();
443 iter != mChildren.end(); ++iter) 445 iter != mChildren.end(); ++iter)
444 { 446 {
445 LLViewerJoint* joint = (LLViewerJoint*)(*iter); 447 LLViewerJoint* joint = (LLViewerJoint*)(*iter);
446 joint->updateGeometry(); 448 joint->updateJointGeometry();
447 } 449 }
448} 450}
449 451