diff options
author | Jacek Antonelli | 2008-12-01 17:39:58 -0600 |
---|---|---|
committer | Jacek Antonelli | 2008-12-01 17:40:06 -0600 |
commit | 7abecb48babe6a6f09bf6692ba55076546cfced9 (patch) | |
tree | 8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/newview/llvoavatar.cpp | |
parent | Second Life viewer sources 1.21.6 (diff) | |
download | meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2 meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz |
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/newview/llvoavatar.cpp')
-rw-r--r-- | linden/indra/newview/llvoavatar.cpp | 189 |
1 files changed, 135 insertions, 54 deletions
diff --git a/linden/indra/newview/llvoavatar.cpp b/linden/indra/newview/llvoavatar.cpp index e480eb3..c3ad4f9 100644 --- a/linden/indra/newview/llvoavatar.cpp +++ b/linden/indra/newview/llvoavatar.cpp | |||
@@ -244,6 +244,11 @@ static F32 calc_bouncy_animation(F32 x) | |||
244 | return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f; | 244 | return -(cosf(x * F_PI * 2.5f - F_PI_BY_TWO))*(0.4f + x * -0.1f) + x * 1.3f; |
245 | } | 245 | } |
246 | 246 | ||
247 | BOOL LLLineSegmentCapsuleIntersect(const LLVector3& start, const LLVector3& end, const LLVector3& p1, const LLVector3& p2, const F32& radius, LLVector3& result) | ||
248 | { | ||
249 | return FALSE; | ||
250 | } | ||
251 | |||
247 | //----------------------------------------------------------------------------- | 252 | //----------------------------------------------------------------------------- |
248 | // Static Data | 253 | // Static Data |
249 | //----------------------------------------------------------------------------- | 254 | //----------------------------------------------------------------------------- |
@@ -753,7 +758,7 @@ LLVOAvatar::LLVOAvatar( | |||
753 | mRippleTimeLast = 0.f; | 758 | mRippleTimeLast = 0.f; |
754 | 759 | ||
755 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); | 760 | mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c"); |
756 | mShadowImagep->bind(); | 761 | gGL.getTexUnit(0)->bind(mShadowImagep.get()); |
757 | mShadowImagep->setClamp(TRUE, TRUE); | 762 | mShadowImagep->setClamp(TRUE, TRUE); |
758 | 763 | ||
759 | mInAir = FALSE; | 764 | mInAir = FALSE; |
@@ -1131,7 +1136,7 @@ void LLVOAvatar::dumpBakedStatus() | |||
1131 | } | 1136 | } |
1132 | 1137 | ||
1133 | 1138 | ||
1134 | F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).magVec(); | 1139 | F64 dist_to_camera = (inst->getPositionGlobal() - camera_pos_global).length(); |
1135 | llcont << " " << dist_to_camera << "m "; | 1140 | llcont << " " << dist_to_camera << "m "; |
1136 | 1141 | ||
1137 | llcont << " " << inst->mPixelArea << " pixels"; | 1142 | llcont << " " << inst->mPixelArea << " pixels"; |
@@ -1569,6 +1574,96 @@ void LLVOAvatar::getSpatialExtents(LLVector3& newMin, LLVector3& newMax) | |||
1569 | newMax += buffer; | 1574 | newMax += buffer; |
1570 | } | 1575 | } |
1571 | 1576 | ||
1577 | //----------------------------------------------------------------------------- | ||
1578 | // renderCollisionVolumes() | ||
1579 | //----------------------------------------------------------------------------- | ||
1580 | void LLVOAvatar::renderCollisionVolumes() | ||
1581 | { | ||
1582 | for (S32 i = 0; i < mNumCollisionVolumes; i++) | ||
1583 | { | ||
1584 | mCollisionVolumes[i].renderCollision(); | ||
1585 | } | ||
1586 | |||
1587 | if (mNameText.notNull()) | ||
1588 | { | ||
1589 | LLVector3 unused; | ||
1590 | mNameText->lineSegmentIntersect(LLVector3(0,0,0), LLVector3(0,0,1), unused, TRUE); | ||
1591 | } | ||
1592 | } | ||
1593 | |||
1594 | BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& end, | ||
1595 | S32 face, | ||
1596 | BOOL pick_transparent, | ||
1597 | S32* face_hit, | ||
1598 | LLVector3* intersection, | ||
1599 | LLVector2* tex_coord, | ||
1600 | LLVector3* normal, | ||
1601 | LLVector3* bi_normal | ||
1602 | ) | ||
1603 | { | ||
1604 | |||
1605 | if (mIsSelf && !gAgent.needsRenderAvatar()) | ||
1606 | { | ||
1607 | return FALSE; | ||
1608 | } | ||
1609 | |||
1610 | if (lineSegmentBoundingBox(start, end)) | ||
1611 | { | ||
1612 | for (S32 i = 0; i < mNumCollisionVolumes; ++i) | ||
1613 | { | ||
1614 | mCollisionVolumes[i].updateWorldMatrix(); | ||
1615 | |||
1616 | glh::matrix4f mat((F32*) mCollisionVolumes[i].getXform()->getWorldMatrix().mMatrix); | ||
1617 | glh::matrix4f inverse = mat.inverse(); | ||
1618 | glh::matrix4f norm_mat = inverse.transpose(); | ||
1619 | |||
1620 | glh::vec3f p1(start.mV); | ||
1621 | glh::vec3f p2(end.mV); | ||
1622 | |||
1623 | inverse.mult_matrix_vec(p1); | ||
1624 | inverse.mult_matrix_vec(p2); | ||
1625 | |||
1626 | LLVector3 position; | ||
1627 | LLVector3 norm; | ||
1628 | |||
1629 | if (linesegment_sphere(LLVector3(p1.v), LLVector3(p2.v), LLVector3(0,0,0), 1.f, position, norm)) | ||
1630 | { | ||
1631 | glh::vec3f res_pos(position.mV); | ||
1632 | mat.mult_matrix_vec(res_pos); | ||
1633 | |||
1634 | norm.normalize(); | ||
1635 | glh::vec3f res_norm(norm.mV); | ||
1636 | norm_mat.mult_matrix_dir(res_norm); | ||
1637 | |||
1638 | if (intersection) | ||
1639 | { | ||
1640 | *intersection = LLVector3(res_pos.v); | ||
1641 | } | ||
1642 | |||
1643 | if (normal) | ||
1644 | { | ||
1645 | *normal = LLVector3(res_norm.v); | ||
1646 | } | ||
1647 | |||
1648 | return TRUE; | ||
1649 | } | ||
1650 | } | ||
1651 | } | ||
1652 | |||
1653 | LLVector3 position; | ||
1654 | if (mNameText.notNull() && mNameText->lineSegmentIntersect(start, end, position)) | ||
1655 | { | ||
1656 | if (intersection) | ||
1657 | { | ||
1658 | *intersection = position; | ||
1659 | } | ||
1660 | |||
1661 | return TRUE; | ||
1662 | } | ||
1663 | |||
1664 | return FALSE; | ||
1665 | } | ||
1666 | |||
1572 | 1667 | ||
1573 | //----------------------------------------------------------------------------- | 1668 | //----------------------------------------------------------------------------- |
1574 | // parseSkeletonFile() | 1669 | // parseSkeletonFile() |
@@ -2737,8 +2832,8 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) | |||
2737 | else | 2832 | else |
2738 | { | 2833 | { |
2739 | getSpatialExtents(ext[0], ext[1]); | 2834 | getSpatialExtents(ext[0], ext[1]); |
2740 | if ((ext[1]-mImpostorExtents[1]).magVec() > 0.05f || | 2835 | if ((ext[1]-mImpostorExtents[1]).length() > 0.05f || |
2741 | (ext[0]-mImpostorExtents[0]).magVec() > 0.05f) | 2836 | (ext[0]-mImpostorExtents[0]).length() > 0.05f) |
2742 | { | 2837 | { |
2743 | mNeedsImpostorUpdate = TRUE; | 2838 | mNeedsImpostorUpdate = TRUE; |
2744 | } | 2839 | } |
@@ -2905,7 +3000,7 @@ void LLVOAvatar::idleUpdateWindEffect() | |||
2905 | F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; | 3000 | F32 time_delta = mRippleTimer.getElapsedTimeF32() - mRippleTimeLast; |
2906 | mRippleTimeLast = mRippleTimer.getElapsedTimeF32(); | 3001 | mRippleTimeLast = mRippleTimer.getElapsedTimeF32(); |
2907 | LLVector3 velocity = getVelocity(); | 3002 | LLVector3 velocity = getVelocity(); |
2908 | F32 speed = velocity.magVec(); | 3003 | F32 speed = velocity.length(); |
2909 | //RN: velocity varies too much frame to frame for this to work | 3004 | //RN: velocity varies too much frame to frame for this to work |
2910 | mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f)); | 3005 | mRippleAccel.clearVec();//lerp(mRippleAccel, (velocity - mLastVel) * time_delta, LLCriticalDamp::getInterpolant(0.02f)); |
2911 | mLastVel = velocity; | 3006 | mLastVel = velocity; |
@@ -2924,7 +3019,7 @@ void LLVOAvatar::idleUpdateWindEffect() | |||
2924 | } | 3019 | } |
2925 | 3020 | ||
2926 | wind.mV[VZ] += hover_strength; | 3021 | wind.mV[VZ] += hover_strength; |
2927 | wind.normVec(); | 3022 | wind.normalize(); |
2928 | 3023 | ||
2929 | wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f); | 3024 | wind.mV[VW] = llmin(0.025f + (speed * 0.015f) + hover_strength, 0.5f); |
2930 | F32 interp; | 3025 | F32 interp; |
@@ -3047,10 +3142,10 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) | |||
3047 | LLVector3 pixel_up_vec; | 3142 | LLVector3 pixel_up_vec; |
3048 | LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); | 3143 | LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec); |
3049 | LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); | 3144 | LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin(); |
3050 | camera_to_av.normVec(); | 3145 | camera_to_av.normalize(); |
3051 | LLVector3 local_camera_at = camera_to_av * ~root_rot; | 3146 | LLVector3 local_camera_at = camera_to_av * ~root_rot; |
3052 | LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); | 3147 | LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis(); |
3053 | local_camera_up.normVec(); | 3148 | local_camera_up.normalize(); |
3054 | local_camera_up = local_camera_up * ~root_rot; | 3149 | local_camera_up = local_camera_up * ~root_rot; |
3055 | 3150 | ||
3056 | local_camera_up.scaleVec(mBodySize * 0.5f); | 3151 | local_camera_up.scaleVec(mBodySize * 0.5f); |
@@ -3509,7 +3604,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3509 | 3604 | ||
3510 | LLVector3 xyVel = getVelocity(); | 3605 | LLVector3 xyVel = getVelocity(); |
3511 | xyVel.mV[VZ] = 0.0f; | 3606 | xyVel.mV[VZ] = 0.0f; |
3512 | speed = xyVel.magVec(); | 3607 | speed = xyVel.length(); |
3513 | 3608 | ||
3514 | BOOL throttle = TRUE; | 3609 | BOOL throttle = TRUE; |
3515 | 3610 | ||
@@ -3594,14 +3689,14 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3594 | if (mIsSelf) | 3689 | if (mIsSelf) |
3595 | { | 3690 | { |
3596 | primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector()); | 3691 | primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector()); |
3597 | primDir.normVec(); | 3692 | primDir.normalize(); |
3598 | } | 3693 | } |
3599 | else | 3694 | else |
3600 | { | 3695 | { |
3601 | primDir = getRotation().getMatrix3().getFwdRow(); | 3696 | primDir = getRotation().getMatrix3().getFwdRow(); |
3602 | } | 3697 | } |
3603 | LLVector3 velDir = getVelocity(); | 3698 | LLVector3 velDir = getVelocity(); |
3604 | velDir.normVec(); | 3699 | velDir.normalize(); |
3605 | if ( mSignaledAnimations.find(ANIM_AGENT_WALK) != mSignaledAnimations.end()) | 3700 | if ( mSignaledAnimations.find(ANIM_AGENT_WALK) != mSignaledAnimations.end()) |
3606 | { | 3701 | { |
3607 | F32 vpD = velDir * primDir; | 3702 | F32 vpD = velDir * primDir; |
@@ -3623,13 +3718,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3623 | LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); | 3718 | LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis(); |
3624 | LLVector3 up_vector = gAgent.getReferenceUpVector(); | 3719 | LLVector3 up_vector = gAgent.getReferenceUpVector(); |
3625 | at_axis -= up_vector * (at_axis * up_vector); | 3720 | at_axis -= up_vector * (at_axis * up_vector); |
3626 | at_axis.normVec(); | 3721 | at_axis.normalize(); |
3627 | 3722 | ||
3628 | F32 dot = fwdDir * at_axis; | 3723 | F32 dot = fwdDir * at_axis; |
3629 | if (dot < 0.f) | 3724 | if (dot < 0.f) |
3630 | { | 3725 | { |
3631 | fwdDir -= 2.f * at_axis * dot; | 3726 | fwdDir -= 2.f * at_axis * dot; |
3632 | fwdDir.normVec(); | 3727 | fwdDir.normalize(); |
3633 | } | 3728 | } |
3634 | } | 3729 | } |
3635 | 3730 | ||
@@ -3697,7 +3792,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3697 | 3792 | ||
3698 | // Now compute the full world space rotation for the whole body (wQv) | 3793 | // Now compute the full world space rotation for the whole body (wQv) |
3699 | LLVector3 leftDir = upDir % fwdDir; | 3794 | LLVector3 leftDir = upDir % fwdDir; |
3700 | leftDir.normVec(); | 3795 | leftDir.normalize(); |
3701 | fwdDir = leftDir % upDir; | 3796 | fwdDir = leftDir % upDir; |
3702 | LLQuaternion wQv( fwdDir, leftDir, upDir ); | 3797 | LLQuaternion wQv( fwdDir, leftDir, upDir ); |
3703 | 3798 | ||
@@ -3828,10 +3923,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3828 | // AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, | 3923 | // AUDIO_STEP_LO_SPEED, AUDIO_STEP_HI_SPEED, |
3829 | // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); | 3924 | // AUDIO_STEP_LO_GAIN, AUDIO_STEP_HI_GAIN ); |
3830 | 3925 | ||
3831 | F32 ambient_volume = gSavedSettings.getF32("AudioLevelAmbient"); | 3926 | const F32 STEP_VOLUME = 0.5f; |
3832 | F32 gain = gSavedSettings.getBOOL("MuteAmbient") | ||
3833 | ? 0.f | ||
3834 | : (.50f * ambient_volume * ambient_volume); | ||
3835 | LLUUID& step_sound_id = getStepSound(); | 3927 | LLUUID& step_sound_id = getStepSound(); |
3836 | 3928 | ||
3837 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); | 3929 | LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent); |
@@ -3839,7 +3931,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) | |||
3839 | if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global) | 3931 | if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global) |
3840 | && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) | 3932 | && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds)) |
3841 | { | 3933 | { |
3842 | gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global); | 3934 | gAudiop->triggerSound(step_sound_id, getID(), STEP_VOLUME, LLAudioEngine::AUDIO_TYPE_AMBIENT, foot_pos_global); |
3843 | } | 3935 | } |
3844 | } | 3936 | } |
3845 | } | 3937 | } |
@@ -4141,7 +4233,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) | |||
4141 | LLVector3 collide_point = slaved_pos; | 4233 | LLVector3 collide_point = slaved_pos; |
4142 | collide_point.mV[VZ] -= foot_plane_normal.mV[VZ] * (dist_from_plane + COLLISION_TOLERANCE - FOOT_COLLIDE_FUDGE); | 4234 | collide_point.mV[VZ] -= foot_plane_normal.mV[VZ] * (dist_from_plane + COLLISION_TOLERANCE - FOOT_COLLIDE_FUDGE); |
4143 | 4235 | ||
4144 | gGL.begin(LLVertexBuffer::LINES); | 4236 | gGL.begin(LLRender::LINES); |
4145 | { | 4237 | { |
4146 | F32 SQUARE_SIZE = 0.2f; | 4238 | F32 SQUARE_SIZE = 0.2f; |
4147 | gGL.color4f(1.f, 0.f, 0.f, 1.f); | 4239 | gGL.color4f(1.f, 0.f, 0.f, 1.f); |
@@ -4288,7 +4380,7 @@ U32 LLVOAvatar::renderFootShadows() | |||
4288 | LLGLDepthTest test(GL_TRUE, GL_FALSE); | 4380 | LLGLDepthTest test(GL_TRUE, GL_FALSE); |
4289 | //render foot shadows | 4381 | //render foot shadows |
4290 | LLGLEnable blend(GL_BLEND); | 4382 | LLGLEnable blend(GL_BLEND); |
4291 | mShadowImagep->bind(); | 4383 | gGL.getTexUnit(0)->bind(mShadowImagep.get()); |
4292 | glColor4fv(mShadow0Facep->getRenderColor().mV); | 4384 | glColor4fv(mShadow0Facep->getRenderColor().mV); |
4293 | mShadow0Facep->renderIndexed(foot_mask); | 4385 | mShadow0Facep->renderIndexed(foot_mask); |
4294 | glColor4fv(mShadow1Facep->getRenderColor().mV); | 4386 | glColor4fv(mShadow1Facep->getRenderColor().mV); |
@@ -4306,7 +4398,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
4306 | 4398 | ||
4307 | LLVector3 pos(getRenderPosition()+mImpostorOffset); | 4399 | LLVector3 pos(getRenderPosition()+mImpostorOffset); |
4308 | LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin()); | 4400 | LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin()); |
4309 | at.normVec(); | 4401 | at.normalize(); |
4310 | LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at; | 4402 | LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at; |
4311 | LLVector3 up = at%left; | 4403 | LLVector3 up = at%left; |
4312 | 4404 | ||
@@ -4334,8 +4426,8 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
4334 | color.mV[3] = (U8) (alpha*255); | 4426 | color.mV[3] = (U8) (alpha*255); |
4335 | 4427 | ||
4336 | gGL.color4ubv(color.mV); | 4428 | gGL.color4ubv(color.mV); |
4337 | mImpostor.bindTexture(); | 4429 | gGL.getTexUnit(0)->bind(&mImpostor); |
4338 | gGL.begin(LLVertexBuffer::QUADS); | 4430 | gGL.begin(LLRender::QUADS); |
4339 | gGL.texCoord2f(0,0); | 4431 | gGL.texCoord2f(0,0); |
4340 | gGL.vertex3fv((pos+left-up).mV); | 4432 | gGL.vertex3fv((pos+left-up).mV); |
4341 | gGL.texCoord2f(1,0); | 4433 | gGL.texCoord2f(1,0); |
@@ -4350,17 +4442,6 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color) | |||
4350 | return 6; | 4442 | return 6; |
4351 | } | 4443 | } |
4352 | 4444 | ||
4353 | //----------------------------------------------------------------------------- | ||
4354 | // renderCollisionVolumes() | ||
4355 | //----------------------------------------------------------------------------- | ||
4356 | void LLVOAvatar::renderCollisionVolumes() | ||
4357 | { | ||
4358 | for (S32 i = 0; i < mNumCollisionVolumes; i++) | ||
4359 | { | ||
4360 | mCollisionVolumes[i].renderCollision(); | ||
4361 | } | ||
4362 | } | ||
4363 | |||
4364 | //------------------------------------------------------------------------ | 4445 | //------------------------------------------------------------------------ |
4365 | // LLVOAvatar::updateTextures() | 4446 | // LLVOAvatar::updateTextures() |
4366 | //------------------------------------------------------------------------ | 4447 | //------------------------------------------------------------------------ |
@@ -4395,23 +4476,23 @@ void LLVOAvatar::updateTextures(LLAgent &agent) | |||
4395 | { | 4476 | { |
4396 | if( head_baked && ! mHeadBakedLoaded ) | 4477 | if( head_baked && ! mHeadBakedLoaded ) |
4397 | { | 4478 | { |
4398 | getTEImage( TEX_HEAD_BAKED )->bind(); | 4479 | gGL.getTexUnit(0)->bind(getTEImage( TEX_HEAD_BAKED )); |
4399 | } | 4480 | } |
4400 | if( upper_baked && ! mUpperBakedLoaded ) | 4481 | if( upper_baked && ! mUpperBakedLoaded ) |
4401 | { | 4482 | { |
4402 | getTEImage( TEX_UPPER_BAKED )->bind(); | 4483 | gGL.getTexUnit(0)->bind(getTEImage( TEX_UPPER_BAKED )); |
4403 | } | 4484 | } |
4404 | if( lower_baked && ! mLowerBakedLoaded ) | 4485 | if( lower_baked && ! mLowerBakedLoaded ) |
4405 | { | 4486 | { |
4406 | getTEImage( TEX_LOWER_BAKED )->bind(); | 4487 | gGL.getTexUnit(0)->bind(getTEImage( TEX_LOWER_BAKED )); |
4407 | } | 4488 | } |
4408 | if( eyes_baked && ! mEyesBakedLoaded ) | 4489 | if( eyes_baked && ! mEyesBakedLoaded ) |
4409 | { | 4490 | { |
4410 | getTEImage( TEX_EYES_BAKED )->bind(); | 4491 | gGL.getTexUnit(0)->bind(getTEImage( TEX_EYES_BAKED )); |
4411 | } | 4492 | } |
4412 | if( skirt_baked && ! mSkirtBakedLoaded ) | 4493 | if( skirt_baked && ! mSkirtBakedLoaded ) |
4413 | { | 4494 | { |
4414 | getTEImage( TEX_SKIRT_BAKED )->bind(); | 4495 | gGL.getTexUnit(0)->bind(getTEImage( TEX_SKIRT_BAKED )); |
4415 | } | 4496 | } |
4416 | } | 4497 | } |
4417 | 4498 | ||
@@ -4813,14 +4894,12 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL | |||
4813 | // to support both spatialized and non-spatialized instances of the same sound | 4894 | // to support both spatialized and non-spatialized instances of the same sound |
4814 | //if (mIsSelf) | 4895 | //if (mIsSelf) |
4815 | //{ | 4896 | //{ |
4816 | // F32 volume = gain * gSavedSettings.getF32("AudioLevelUI") | 4897 | // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); |
4817 | // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), volume); | ||
4818 | //} | 4898 | //} |
4819 | //else | 4899 | //else |
4820 | { | 4900 | { |
4821 | LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); | 4901 | LLUUID sound_id = LLUUID(gSavedSettings.getString("UISndTyping")); |
4822 | F32 volume = gSavedSettings.getBOOL("MuteSounds") ? 0.f : gSavedSettings.getF32("AudioLevelSFX"); | 4902 | gAudiop->triggerSound(sound_id, getID(), 1.0f, LLAudioEngine::AUDIO_TYPE_SFX, char_pos_global); |
4823 | gAudiop->triggerSound(sound_id, getID(), volume, char_pos_global); | ||
4824 | } | 4903 | } |
4825 | } | 4904 | } |
4826 | } | 4905 | } |
@@ -5719,7 +5798,9 @@ BOOL LLVOAvatar::loadMeshNodes() | |||
5719 | 5798 | ||
5720 | // llinfos << "Parsing mesh data for " << type << "..." << llendl; | 5799 | // llinfos << "Parsing mesh data for " << type << "..." << llendl; |
5721 | 5800 | ||
5722 | mesh->setColor( 0.8f, 0.8f, 0.8f, 1.0f ); | 5801 | // If this isn't set to white (1.0), avatars will *ALWAYS* be darker than their surroundings. |
5802 | // Do not touch!!! | ||
5803 | mesh->setColor( 1.0f, 1.0f, 1.0f, 1.0f ); | ||
5723 | 5804 | ||
5724 | LLPolyMesh *poly_mesh = NULL; | 5805 | LLPolyMesh *poly_mesh = NULL; |
5725 | 5806 | ||
@@ -5837,7 +5918,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) | |||
5837 | } | 5918 | } |
5838 | else | 5919 | else |
5839 | { | 5920 | { |
5840 | F32 radius = size.magVec(); | 5921 | F32 radius = size.length(); |
5841 | mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG; | 5922 | mAppAngle = (F32) atan2( radius, range) * RAD_TO_DEG; |
5842 | } | 5923 | } |
5843 | 5924 | ||
@@ -6009,7 +6090,7 @@ void LLVOAvatar::updateShadowFaces() | |||
6009 | sprite.setPosition(shadow_pos_agent); | 6090 | sprite.setPosition(shadow_pos_agent); |
6010 | 6091 | ||
6011 | LLVector3 foot_to_knee = mKneeLeftp->getWorldPosition() - joint_world_pos; | 6092 | LLVector3 foot_to_knee = mKneeLeftp->getWorldPosition() - joint_world_pos; |
6012 | //foot_to_knee.normVec(); | 6093 | //foot_to_knee.normalize(); |
6013 | foot_to_knee -= projected_vec(foot_to_knee, sun_vec); | 6094 | foot_to_knee -= projected_vec(foot_to_knee, sun_vec); |
6014 | sprite.setYaw(azimuth(sun_vec - foot_to_knee)); | 6095 | sprite.setYaw(azimuth(sun_vec - foot_to_knee)); |
6015 | 6096 | ||
@@ -6042,7 +6123,7 @@ void LLVOAvatar::updateShadowFaces() | |||
6042 | sprite.setPosition(shadow_pos_agent); | 6123 | sprite.setPosition(shadow_pos_agent); |
6043 | 6124 | ||
6044 | LLVector3 foot_to_knee = mKneeRightp->getWorldPosition() - joint_world_pos; | 6125 | LLVector3 foot_to_knee = mKneeRightp->getWorldPosition() - joint_world_pos; |
6045 | //foot_to_knee.normVec(); | 6126 | //foot_to_knee.normalize(); |
6046 | foot_to_knee -= projected_vec(foot_to_knee, sun_vec); | 6127 | foot_to_knee -= projected_vec(foot_to_knee, sun_vec); |
6047 | sprite.setYaw(azimuth(sun_vec - foot_to_knee)); | 6128 | sprite.setYaw(azimuth(sun_vec - foot_to_knee)); |
6048 | 6129 | ||
@@ -6403,7 +6484,7 @@ void LLVOAvatar::getOffObject() | |||
6403 | LLVector3 at_axis = LLVector3::x_axis; | 6484 | LLVector3 at_axis = LLVector3::x_axis; |
6404 | at_axis = at_axis * av_rot; | 6485 | at_axis = at_axis * av_rot; |
6405 | at_axis.mV[VZ] = 0.f; | 6486 | at_axis.mV[VZ] = 0.f; |
6406 | at_axis.normVec(); | 6487 | at_axis.normalize(); |
6407 | gAgent.resetAxes(at_axis); | 6488 | gAgent.resetAxes(at_axis); |
6408 | 6489 | ||
6409 | //reset orientation | 6490 | //reset orientation |
@@ -6957,7 +7038,7 @@ BOOL LLVOAvatar::bindScratchTexture( LLGLenum format ) | |||
6957 | GLuint gl_name = getScratchTexName( format, &texture_bytes ); | 7038 | GLuint gl_name = getScratchTexName( format, &texture_bytes ); |
6958 | if( gl_name ) | 7039 | if( gl_name ) |
6959 | { | 7040 | { |
6960 | LLImageGL::bindExternalTexture( gl_name, 0, GL_TEXTURE_2D ); | 7041 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); |
6961 | stop_glerror(); | 7042 | stop_glerror(); |
6962 | 7043 | ||
6963 | F32* last_bind_time = LLVOAvatar::sScratchTexLastBindTime.getIfThere( format ); | 7044 | F32* last_bind_time = LLVOAvatar::sScratchTexLastBindTime.getIfThere( format ); |
@@ -7015,7 +7096,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7015 | glGenTextures(1, &name ); | 7096 | glGenTextures(1, &name ); |
7016 | stop_glerror(); | 7097 | stop_glerror(); |
7017 | 7098 | ||
7018 | LLImageGL::bindExternalTexture( name, 0, GL_TEXTURE_2D ); | 7099 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, name); |
7019 | stop_glerror(); | 7100 | stop_glerror(); |
7020 | 7101 | ||
7021 | glTexImage2D( | 7102 | glTexImage2D( |
@@ -7030,7 +7111,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) | |||
7030 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); | 7111 | glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE ); |
7031 | stop_glerror(); | 7112 | stop_glerror(); |
7032 | 7113 | ||
7033 | LLImageGL::unbindTexture(0, GL_TEXTURE_2D); | 7114 | gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); |
7034 | stop_glerror(); | 7115 | stop_glerror(); |
7035 | 7116 | ||
7036 | LLVOAvatar::sScratchTexNames.addData( format, new LLGLuint( name ) ); | 7117 | LLVOAvatar::sScratchTexNames.addData( format, new LLGLuint( name ) ); |
@@ -8639,7 +8720,7 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerImage *src_vi, | |||
8639 | glGenTextures(1, (GLuint*) &gl_name ); | 8720 | glGenTextures(1, (GLuint*) &gl_name ); |
8640 | stop_glerror(); | 8721 | stop_glerror(); |
8641 | 8722 | ||
8642 | LLImageGL::bindExternalTexture( gl_name, 0, GL_TEXTURE_2D ); | 8723 | gGL.getTexUnit(0)->bindManual(LLTexUnit::TT_TEXTURE, gl_name); |
8643 | stop_glerror(); | 8724 | stop_glerror(); |
8644 | 8725 | ||
8645 | glTexImage2D( | 8726 | glTexImage2D( |
@@ -9914,7 +9995,7 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di | |||
9914 | extents[1] = ext[1]; | 9995 | extents[1] = ext[1]; |
9915 | 9996 | ||
9916 | LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset); | 9997 | LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset); |
9917 | distance = at.normVec(); | 9998 | distance = at.normalize(); |
9918 | F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis()); | 9999 | F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis()); |
9919 | angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da; | 10000 | angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da; |
9920 | angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da; | 10001 | angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da; |