diff options
Diffstat (limited to 'linden/indra/newview/llviewerjoint.cpp')
-rw-r--r-- | linden/indra/newview/llviewerjoint.cpp | 205 |
1 files changed, 59 insertions, 146 deletions
diff --git a/linden/indra/newview/llviewerjoint.cpp b/linden/indra/newview/llviewerjoint.cpp index 9645dfe..0aa9112 100644 --- a/linden/indra/newview/llviewerjoint.cpp +++ b/linden/indra/newview/llviewerjoint.cpp | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "llviewerjoint.h" | 37 | #include "llviewerjoint.h" |
38 | 38 | ||
39 | #include "llgl.h" | 39 | #include "llgl.h" |
40 | #include "llglimmediate.h" | ||
40 | #include "llmath.h" | 41 | #include "llmath.h" |
41 | #include "llglheaders.h" | 42 | #include "llglheaders.h" |
42 | #include "llsphere.h" | 43 | #include "llsphere.h" |
@@ -147,19 +148,19 @@ void LLViewerJoint::renderSkeleton(BOOL recursive) | |||
147 | //---------------------------------------------------------------- | 148 | //---------------------------------------------------------------- |
148 | if (mComponents & SC_AXES) | 149 | if (mComponents & SC_AXES) |
149 | { | 150 | { |
150 | glBegin(GL_LINES); | 151 | gGL.begin(GL_LINES); |
151 | glColor3f( 1.0f, 0.0f, 0.0f ); | 152 | gGL.color3f( 1.0f, 0.0f, 0.0f ); |
152 | glVertex3f( 0.0f, 0.0f, 0.0f ); | 153 | gGL.vertex3f( 0.0f, 0.0f, 0.0f ); |
153 | glVertex3f( 0.1f, 0.0f, 0.0f ); | 154 | gGL.vertex3f( 0.1f, 0.0f, 0.0f ); |
154 | 155 | ||
155 | glColor3f( 0.0f, 1.0f, 0.0f ); | 156 | gGL.color3f( 0.0f, 1.0f, 0.0f ); |
156 | glVertex3f( 0.0f, 0.0f, 0.0f ); | 157 | gGL.vertex3f( 0.0f, 0.0f, 0.0f ); |
157 | glVertex3f( 0.0f, 0.1f, 0.0f ); | 158 | gGL.vertex3f( 0.0f, 0.1f, 0.0f ); |
158 | 159 | ||
159 | glColor3f( 0.0f, 0.0f, 1.0f ); | 160 | gGL.color3f( 0.0f, 0.0f, 1.0f ); |
160 | glVertex3f( 0.0f, 0.0f, 0.0f ); | 161 | gGL.vertex3f( 0.0f, 0.0f, 0.0f ); |
161 | glVertex3f( 0.0f, 0.0f, 0.1f ); | 162 | gGL.vertex3f( 0.0f, 0.0f, 0.1f ); |
162 | glEnd(); | 163 | gGL.end(); |
163 | } | 164 | } |
164 | 165 | ||
165 | //---------------------------------------------------------------- | 166 | //---------------------------------------------------------------- |
@@ -167,53 +168,53 @@ void LLViewerJoint::renderSkeleton(BOOL recursive) | |||
167 | //---------------------------------------------------------------- | 168 | //---------------------------------------------------------------- |
168 | if (mComponents & SC_JOINT) | 169 | if (mComponents & SC_JOINT) |
169 | { | 170 | { |
170 | glColor3f( 1.0f, 1.0f, 0.0f ); | 171 | gGL.color3f( 1.0f, 1.0f, 0.0f ); |
171 | 172 | ||
172 | glBegin(GL_TRIANGLES); | 173 | gGL.begin(GL_TRIANGLES); |
173 | 174 | ||
174 | // joint top half | 175 | // joint top half |
175 | glNormal3f(nc, nc, nc); | 176 | glNormal3f(nc, nc, nc); |
176 | glVertex3f(0.0f, 0.0f, 0.05f); | 177 | gGL.vertex3f(0.0f, 0.0f, 0.05f); |
177 | glVertex3f(0.05f, 0.0f, 0.0f); | 178 | gGL.vertex3f(0.05f, 0.0f, 0.0f); |
178 | glVertex3f(0.0f, 0.05f, 0.0f); | 179 | gGL.vertex3f(0.0f, 0.05f, 0.0f); |
179 | 180 | ||
180 | glNormal3f(-nc, nc, nc); | 181 | glNormal3f(-nc, nc, nc); |
181 | glVertex3f(0.0f, 0.0f, 0.05f); | 182 | gGL.vertex3f(0.0f, 0.0f, 0.05f); |
182 | glVertex3f(0.0f, 0.05f, 0.0f); | 183 | gGL.vertex3f(0.0f, 0.05f, 0.0f); |
183 | glVertex3f(-0.05f, 0.0f, 0.0f); | 184 | gGL.vertex3f(-0.05f, 0.0f, 0.0f); |
184 | 185 | ||
185 | glNormal3f(-nc, -nc, nc); | 186 | glNormal3f(-nc, -nc, nc); |
186 | glVertex3f(0.0f, 0.0f, 0.05f); | 187 | gGL.vertex3f(0.0f, 0.0f, 0.05f); |
187 | glVertex3f(-0.05f, 0.0f, 0.0f); | 188 | gGL.vertex3f(-0.05f, 0.0f, 0.0f); |
188 | glVertex3f(0.0f, -0.05f, 0.0f); | 189 | gGL.vertex3f(0.0f, -0.05f, 0.0f); |
189 | 190 | ||
190 | glNormal3f(nc, -nc, nc); | 191 | glNormal3f(nc, -nc, nc); |
191 | glVertex3f(0.0f, 0.0f, 0.05f); | 192 | gGL.vertex3f(0.0f, 0.0f, 0.05f); |
192 | glVertex3f(0.0f, -0.05f, 0.0f); | 193 | gGL.vertex3f(0.0f, -0.05f, 0.0f); |
193 | glVertex3f(0.05f, 0.0f, 0.0f); | 194 | gGL.vertex3f(0.05f, 0.0f, 0.0f); |
194 | 195 | ||
195 | // joint bottom half | 196 | // joint bottom half |
196 | glNormal3f(nc, nc, -nc); | 197 | glNormal3f(nc, nc, -nc); |
197 | glVertex3f(0.0f, 0.0f, -0.05f); | 198 | gGL.vertex3f(0.0f, 0.0f, -0.05f); |
198 | glVertex3f(0.0f, 0.05f, 0.0f); | 199 | gGL.vertex3f(0.0f, 0.05f, 0.0f); |
199 | glVertex3f(0.05f, 0.0f, 0.0f); | 200 | gGL.vertex3f(0.05f, 0.0f, 0.0f); |
200 | 201 | ||
201 | glNormal3f(-nc, nc, -nc); | 202 | glNormal3f(-nc, nc, -nc); |
202 | glVertex3f(0.0f, 0.0f, -0.05f); | 203 | gGL.vertex3f(0.0f, 0.0f, -0.05f); |
203 | glVertex3f(-0.05f, 0.0f, 0.0f); | 204 | gGL.vertex3f(-0.05f, 0.0f, 0.0f); |
204 | glVertex3f(0.0f, 0.05f, 0.0f); | 205 | gGL.vertex3f(0.0f, 0.05f, 0.0f); |
205 | 206 | ||
206 | glNormal3f(-nc, -nc, -nc); | 207 | glNormal3f(-nc, -nc, -nc); |
207 | glVertex3f(0.0f, 0.0f, -0.05f); | 208 | gGL.vertex3f(0.0f, 0.0f, -0.05f); |
208 | glVertex3f(0.0f, -0.05f, 0.0f); | 209 | gGL.vertex3f(0.0f, -0.05f, 0.0f); |
209 | glVertex3f(-0.05f, 0.0f, 0.0f); | 210 | gGL.vertex3f(-0.05f, 0.0f, 0.0f); |
210 | 211 | ||
211 | glNormal3f(nc, -nc, -nc); | 212 | glNormal3f(nc, -nc, -nc); |
212 | glVertex3f(0.0f, 0.0f, -0.05f); | 213 | gGL.vertex3f(0.0f, 0.0f, -0.05f); |
213 | glVertex3f(0.05f, 0.0f, 0.0f); | 214 | gGL.vertex3f(0.05f, 0.0f, 0.0f); |
214 | glVertex3f(0.0f, -0.05f, 0.0f); | 215 | gGL.vertex3f(0.0f, -0.05f, 0.0f); |
215 | 216 | ||
216 | glEnd(); | 217 | gGL.end(); |
217 | } | 218 | } |
218 | 219 | ||
219 | //---------------------------------------------------------------- | 220 | //---------------------------------------------------------------- |
@@ -258,7 +259,7 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass ) | |||
258 | { | 259 | { |
259 | triangle_count += drawShape( pixelArea, first_pass ); | 260 | triangle_count += drawShape( pixelArea, first_pass ); |
260 | } | 261 | } |
261 | else if ( isTransparent() ) | 262 | else if ( isTransparent() && !LLPipeline::sReflectionRender) |
262 | { | 263 | { |
263 | // Hair and Skirt | 264 | // Hair and Skirt |
264 | if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR)) | 265 | if ((pixelArea > MIN_PIXEL_AREA_3PASS_HAIR)) |
@@ -357,27 +358,27 @@ void LLViewerJoint::drawBone() | |||
357 | glMultMatrixf( &rotateMat.mMatrix[0][0] ); | 358 | glMultMatrixf( &rotateMat.mMatrix[0][0] ); |
358 | 359 | ||
359 | // render the bone | 360 | // render the bone |
360 | glColor3f( 0.5f, 0.5f, 0.0f ); | 361 | gGL.color3f( 0.5f, 0.5f, 0.0f ); |
361 | 362 | ||
362 | glBegin(GL_TRIANGLES); | 363 | gGL.begin(GL_TRIANGLES); |
363 | 364 | ||
364 | glVertex3f( length, 0.0f, 0.0f); | 365 | gGL.vertex3f( length, 0.0f, 0.0f); |
365 | glVertex3f( 0.0f, boneSize, 0.0f); | 366 | gGL.vertex3f( 0.0f, boneSize, 0.0f); |
366 | glVertex3f( 0.0f, 0.0f, boneSize); | 367 | gGL.vertex3f( 0.0f, 0.0f, boneSize); |
367 | 368 | ||
368 | glVertex3f( length, 0.0f, 0.0f); | 369 | gGL.vertex3f( length, 0.0f, 0.0f); |
369 | glVertex3f( 0.0f, 0.0f, -boneSize); | 370 | gGL.vertex3f( 0.0f, 0.0f, -boneSize); |
370 | glVertex3f( 0.0f, boneSize, 0.0f); | 371 | gGL.vertex3f( 0.0f, boneSize, 0.0f); |
371 | 372 | ||
372 | glVertex3f( length, 0.0f, 0.0f); | 373 | gGL.vertex3f( length, 0.0f, 0.0f); |
373 | glVertex3f( 0.0f, -boneSize, 0.0f); | 374 | gGL.vertex3f( 0.0f, -boneSize, 0.0f); |
374 | glVertex3f( 0.0f, 0.0f, -boneSize); | 375 | gGL.vertex3f( 0.0f, 0.0f, -boneSize); |
375 | 376 | ||
376 | glVertex3f( length, 0.0f, 0.0f); | 377 | gGL.vertex3f( length, 0.0f, 0.0f); |
377 | glVertex3f( 0.0f, 0.0f, boneSize); | 378 | gGL.vertex3f( 0.0f, 0.0f, boneSize); |
378 | glVertex3f( 0.0f, -boneSize, 0.0f); | 379 | gGL.vertex3f( 0.0f, -boneSize, 0.0f); |
379 | 380 | ||
380 | glEnd(); | 381 | gGL.end(); |
381 | 382 | ||
382 | // restore matrix | 383 | // restore matrix |
383 | glPopMatrix(); | 384 | glPopMatrix(); |
@@ -422,16 +423,7 @@ void LLViewerJoint::updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pix | |||
422 | iter != mChildren.end(); ++iter) | 423 | iter != mChildren.end(); ++iter) |
423 | { | 424 | { |
424 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); | 425 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); |
425 | //F32 jointLOD = joint->getLOD(); | 426 | joint->updateFaceSizes(num_vertices, num_indices, pixel_area); |
426 | //if (pixel_area >= jointLOD || sDisableLOD) | ||
427 | { | ||
428 | joint->updateFaceSizes(num_vertices, num_indices, pixel_area); | ||
429 | |||
430 | // if (jointLOD != DEFAULT_LOD) | ||
431 | // { | ||
432 | // break; | ||
433 | // } | ||
434 | } | ||
435 | } | 427 | } |
436 | } | 428 | } |
437 | 429 | ||
@@ -441,16 +433,7 @@ void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) | |||
441 | iter != mChildren.end(); ++iter) | 433 | iter != mChildren.end(); ++iter) |
442 | { | 434 | { |
443 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); | 435 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); |
444 | //F32 jointLOD = joint->getLOD(); | 436 | joint->updateFaceData(face, pixel_area, damp_wind); |
445 | //if (pixel_area >= jointLOD || sDisableLOD) | ||
446 | { | ||
447 | joint->updateFaceData(face, pixel_area, damp_wind); | ||
448 | |||
449 | // if (jointLOD != DEFAULT_LOD) | ||
450 | // { | ||
451 | // break; | ||
452 | // } | ||
453 | } | ||
454 | } | 437 | } |
455 | } | 438 | } |
456 | 439 | ||
@@ -522,76 +505,6 @@ void LLViewerJoint::setVisible(BOOL visible, BOOL recursive) | |||
522 | } | 505 | } |
523 | } | 506 | } |
524 | 507 | ||
525 | void LLViewerJoint::writeCAL3D(apr_file_t* fp) | ||
526 | { | ||
527 | LLVector3 bone_pos = mXform.getPosition(); | ||
528 | if (mParent) | ||
529 | { | ||
530 | bone_pos.scaleVec(mParent->getScale()); | ||
531 | bone_pos *= 100.f; | ||
532 | } | ||
533 | else | ||
534 | { | ||
535 | bone_pos.clearVec(); | ||
536 | } | ||
537 | |||
538 | LLQuaternion bone_rot; | ||
539 | |||
540 | S32 num_children = 0; | ||
541 | for (child_list_t::iterator iter = mChildren.begin(); | ||
542 | iter != mChildren.end(); ++iter) | ||
543 | { | ||
544 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); | ||
545 | if (joint->mJointNum != -1) | ||
546 | { | ||
547 | num_children++; | ||
548 | } | ||
549 | } | ||
550 | |||
551 | LLJoint* cur_joint = this; | ||
552 | LLVector3 rootSkinOffset; | ||
553 | if (mParent) | ||
554 | { | ||
555 | while (cur_joint) | ||
556 | { | ||
557 | rootSkinOffset -= cur_joint->getSkinOffset(); | ||
558 | cur_joint = (LLViewerJoint*)cur_joint->getParent(); | ||
559 | } | ||
560 | |||
561 | rootSkinOffset *= 100.f; | ||
562 | } | ||
563 | |||
564 | apr_file_printf(fp, " <BONE ID=\"%d\" NAME=\"%s\" NUMCHILDS=\"%d\">\n", mJointNum + 1, mName.c_str(), num_children); | ||
565 | apr_file_printf(fp, " <TRANSLATION>%.6f %.6f %.6f</TRANSLATION>\n", bone_pos.mV[VX], bone_pos.mV[VY], bone_pos.mV[VZ]); | ||
566 | apr_file_printf(fp, " <ROTATION>%.6f %.6f %.6f %.6f</ROTATION>\n", bone_rot.mQ[VX], bone_rot.mQ[VY], bone_rot.mQ[VZ], bone_rot.mQ[VW]); | ||
567 | apr_file_printf(fp, " <LOCALTRANSLATION>%.6f %.6f %.6f</LOCALTRANSLATION>\n", rootSkinOffset.mV[VX], rootSkinOffset.mV[VY], rootSkinOffset.mV[VZ]); | ||
568 | apr_file_printf(fp, " <LOCALROTATION>0 0 0 1</LOCALROTATION>\n"); | ||
569 | apr_file_printf(fp, " <PARENTID>%d</PARENTID>\n", mParent ? mParent->mJointNum + 1 : -1); | ||
570 | |||
571 | for (child_list_t::iterator iter = mChildren.begin(); | ||
572 | iter != mChildren.end(); ++iter) | ||
573 | { | ||
574 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); | ||
575 | if (joint->mJointNum != -1) | ||
576 | { | ||
577 | apr_file_printf(fp, " <CHILDID>%d</CHILDID>\n", joint->mJointNum + 1); | ||
578 | } | ||
579 | } | ||
580 | apr_file_printf(fp, " </BONE>\n"); | ||
581 | |||
582 | // recurse | ||
583 | for (child_list_t::iterator iter = mChildren.begin(); | ||
584 | iter != mChildren.end(); ++iter) | ||
585 | { | ||
586 | LLViewerJoint* joint = (LLViewerJoint*)(*iter); | ||
587 | if (joint->mJointNum != -1) | ||
588 | { | ||
589 | joint->writeCAL3D(fp); | ||
590 | } | ||
591 | } | ||
592 | |||
593 | } | ||
594 | |||
595 | //----------------------------------------------------------------------------- | 508 | //----------------------------------------------------------------------------- |
596 | // LLViewerJointCollisionVolume() | 509 | // LLViewerJointCollisionVolume() |
597 | //----------------------------------------------------------------------------- | 510 | //----------------------------------------------------------------------------- |