From 4e47446be1569d897b70c6e2ffea425628d2ce33 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 14 May 2011 12:38:47 -0500 Subject: [PATCH] LLVOAvatar class members reorganized to line up with V2 better. Added accessors from v2 where applicable. mBakedTextureData renamed to mBakedTextureDatas --- indra/newview/floaterao.cpp | 12 +- indra/newview/llagent.cpp | 30 +- indra/newview/lloverlaybar.cpp | 6 +- indra/newview/llpanelcontents.cpp | 4 +- indra/newview/llpanelinventory.cpp | 4 +- indra/newview/llpanelobject.cpp | 2 +- indra/newview/lltexlayer.cpp | 16 +- indra/newview/lltexlayer.h | 17 +- indra/newview/lltoolbar.cpp | 2 +- indra/newview/lltooldraganddrop.cpp | 2 +- indra/newview/lltoolmorph.cpp | 2 +- indra/newview/lltoolpie.cpp | 6 +- indra/newview/llviewerkeyboard.cpp | 2 +- indra/newview/llviewermenu.cpp | 14 +- indra/newview/llviewermessage.cpp | 2 +- indra/newview/llviewerwindow.cpp | 2 +- indra/newview/llvoavatar.cpp | 962 +++++++---------- indra/newview/llvoavatar.h | 1538 ++++++++++++++++----------- indra/newview/rlvhandler.cpp | 6 +- indra/newview/rlvhandler.h | 4 +- 20 files changed, 1375 insertions(+), 1258 deletions(-) diff --git a/indra/newview/floaterao.cpp b/indra/newview/floaterao.cpp index 489a838eb..c0a2bd3ac 100644 --- a/indra/newview/floaterao.cpp +++ b/indra/newview/floaterao.cpp @@ -419,7 +419,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) { int state = STATE_AGENT_IDLE; std::string stranim = box->getValue().asString(); -// llinfos << "state " << (gAgent.getAvatarObject()->mIsSitting) << " - " << getAnimationState() << llendl; +// llinfos << "state " << (gAgent.getAvatarObject()->isSitting()) << " - " << getAnimationState() << llendl; if (box->getName() == "walks") { gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_WALK), ANIM_REQUEST_STOP); @@ -442,7 +442,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) { if (gAgent.getAvatarObject() && (gSavedSettings.getBOOL("AOEnabled")) && (gSavedSettings.getBOOL("AOSitsEnabled"))) { - if ((gAgent.getAvatarObject()->mIsSitting) && (getAnimationState() == STATE_AGENT_SIT)) + if ((gAgent.getAvatarObject()->isSitting()) && (getAnimationState() == STATE_AGENT_SIT)) { // llinfos << "sitting " << GetAnimID(ANIM_AGENT_SIT) << " " << getAssetIDByName(stranim) << llendl; gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_SIT), ANIM_REQUEST_STOP); @@ -457,7 +457,7 @@ void LLFloaterAO::onComboBoxCommit(LLUICtrl* ctrl, void* userdata) // llinfos << "gsitting " << GetAnimID(ANIM_AGENT_SIT_GROUND) << " " << getAssetIDByName(stranim) << llendl; if (gAgent.getAvatarObject()) { - if ((gAgent.getAvatarObject()->mIsSitting) && (getAnimationState() == STATE_AGENT_GROUNDSIT)) + if ((gAgent.getAvatarObject()->isSitting()) && (getAnimationState() == STATE_AGENT_GROUNDSIT)) { // llinfos << "gsitting " << GetAnimID(ANIM_AGENT_SIT_GROUND) << " " << getAssetIDByName(stranim) << llendl; gAgent.sendAnimationRequest(GetAnimID(ANIM_AGENT_SIT_GROUND), ANIM_REQUEST_STOP); @@ -768,7 +768,7 @@ int LLFloaterAO::getAnimationState() { if (gAgent.getAvatarObject()) { - if (gAgent.getAvatarObject()->mIsSitting) setAnimationState(STATE_AGENT_SIT); + if (gAgent.getAvatarObject()->isSitting()) setAnimationState(STATE_AGENT_SIT); else if (gAgent.getFlying()) setAnimationState(STATE_AGENT_HOVER); } return mAnimationState; @@ -859,7 +859,7 @@ BOOL LLFloaterAO::ChangeStand() { if (gSavedSettings.getBOOL("AONoStandsInMouselook") && gAgent.cameraMouselook()) return FALSE; - if (gAgent.getAvatarObject()->mIsSitting) + if (gAgent.getAvatarObject()->isSitting()) { // stopMotion(getCurrentStandId(), FALSE, TRUE); //stop stand first then set state // if (getAnimationState() != STATE_AGENT_GROUNDSIT) setAnimationState(STATE_AGENT_SIT); @@ -912,7 +912,7 @@ BOOL LLFloaterAO::startMotion(const LLUUID& id, F32 time_offset, BOOL stand) BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; + sitting = gAgent.getAvatarObject()->isSitting(); } if (sitting) return FALSE; gAgent.sendAnimationRequest(id, ANIM_REQUEST_START); diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 49dee2357..2613e7149 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -864,7 +864,7 @@ void LLAgent::setFlying(BOOL fly) } // don't allow taking off while sitting - if (fly && mAvatarObject->mIsSitting) + if (fly && mAvatarObject->isSitting()) { return; } @@ -1363,7 +1363,7 @@ F32 LLAgent::clampPitchToLimits(F32 angle) F32 angle_from_skyward = acos( mFrameAgent.getAtAxis() * skyward ); - if (isAgentAvatarValid() && mAvatarObject->mIsSitting) + if (isAgentAvatarValid() && mAvatarObject->isSitting()) { look_down_limit = 130.f * DEG_TO_RAD; } @@ -2716,7 +2716,7 @@ void LLAgent::updateLookAt(const S32 mouse_x, const S32 mouse_y) else { // *FIX: rotate mframeagent by sit object's rotation? - LLQuaternion look_rotation = mAvatarObject->mIsSitting ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation + LLQuaternion look_rotation = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); // use camera's current rotation LLVector3 look_offset = LLVector3(2.f, 0.f, 0.f) * look_rotation * av_inv_rot; setLookAt(LOOKAT_TARGET_IDLE, mAvatarObject, look_offset); } @@ -3158,7 +3158,7 @@ void LLAgent::updateCamera() validateFocusObject(); if (isAgentAvatarValid() && - mAvatarObject->mIsSitting && + mAvatarObject->isSitting() && camera_mode == CAMERA_MODE_MOUSELOOK) { //Ventrella @@ -3279,7 +3279,7 @@ void LLAgent::updateCamera() // (2) focus, and (3) upvector. They can then be queried elsewhere in llAgent. //-------------------------------------------------------------------------------- // *TODO: use combined rotation of frameagent and sit object - LLQuaternion avatarRotationForFollowCam = mAvatarObject->mIsSitting ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); + LLQuaternion avatarRotationForFollowCam = mAvatarObject->isSitting() ? mAvatarObject->getRenderRotation() : mFrameAgent.getQuaternion(); LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); if (current_cam) @@ -3460,7 +3460,7 @@ void LLAgent::updateCamera() } mLastPositionGlobal = global_pos; - if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->mIsSitting && cameraMouselook()) + if (LLVOAvatar::sVisibleInFirstPerson && mAvatarObject.notNull() && !mAvatarObject->isSitting() && cameraMouselook()) { LLVector3 head_pos = mAvatarObject->mHeadp->getWorldPosition() + LLVector3(0.08f, 0.f, 0.05f) * mAvatarObject->mHeadp->getWorldRotation() + @@ -3650,7 +3650,7 @@ LLVector3d LLAgent::calcFocusPositionTargetGlobal() } return mFocusTargetGlobal; } - else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->mIsSitting && mSitCameraReferenceObject.notNull()) + else if (mSitCameraEnabled && mAvatarObject.notNull() && mAvatarObject->isSitting() && mSitCameraReferenceObject.notNull()) { // sit camera LLVector3 object_pos = mSitCameraReferenceObject->getRenderPosition(); @@ -3775,7 +3775,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) return LLVector3d::zero; } head_offset.clearVec(); - if (mAvatarObject->mIsSitting && mAvatarObject->getParent()) + if (mAvatarObject->isSitting() && mAvatarObject->getParent()) { mAvatarObject->updateHeadOffset(); head_offset.mdV[VX] = mAvatarObject->mHeadOffset.mV[VX]; @@ -3789,7 +3789,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) else { head_offset.mdV[VZ] = mAvatarObject->mHeadOffset.mV[VZ]; - if (mAvatarObject->mIsSitting) + if (mAvatarObject->isSitting()) { head_offset.mdV[VZ] += 0.1; } @@ -3805,7 +3805,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) if (mSitCameraEnabled && isAgentAvatarValid() - && mAvatarObject->mIsSitting + && mAvatarObject->isSitting() && mSitCameraReferenceObject.notNull()) { // sit camera @@ -3837,7 +3837,7 @@ LLVector3d LLAgent::calcCameraPositionTargetGlobal(BOOL *hit_limit) local_camera_offset = mFrameAgent.rotateToAbsolute( local_camera_offset ); } - if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !mAvatarObject->mIsSitting)) + if (!mCameraCollidePlane.isExactlyZero() && (!isAgentAvatarValid() || !mAvatarObject->isSitting())) { LLVector3 plane_normal; plane_normal.setVec(mCameraCollidePlane.mV); @@ -4215,7 +4215,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) +SG if ( (!gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) - && (mAvatarObject->mIsSitting) + && (mAvatarObject->isSitting()) && gSavedSettings.getBOOL("SianaUnsitOnCamReset")) { setControlFlags(AGENT_CONTROL_STAND_UP); // force stand up @@ -4228,7 +4228,7 @@ void LLAgent::changeCameraToThirdPerson(BOOL animate) if (isAgentAvatarValid()) { - if (!mAvatarObject->mIsSitting) + if (!mAvatarObject->isSitting()) { mAvatarObject->mPelvisp->setPosition(LLVector3::zero); } @@ -6308,7 +6308,7 @@ void LLAgent::teleportViaLandmark(const LLUUID& landmark_asset_id) // [RLVa:KB] - Checked: 2009-07-07 (RLVa-1.0.0d) if ( (rlv_handler_t::isEnabled()) && ( (gRlvHandler.hasBehaviour(RLV_BHVR_TPLM)) || - ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting)) )) + ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (mAvatarObject.notNull()) && (mAvatarObject->isSitting())) )) { RlvNotifications::notifyBlockedTeleport(); return; @@ -6384,7 +6384,7 @@ void LLAgent::teleportViaLocation(const LLVector3d& pos_global) { // If we're getting teleported due to @tpto we should disregard any @tploc=n or @unsit=n restrictions from the same object if ( (gRlvHandler.hasBehaviourExcept(RLV_BHVR_TPLOC, gRlvHandler.getCurrentObject())) || - ( (mAvatarObject.notNull()) && (mAvatarObject->mIsSitting) && + ( (mAvatarObject.notNull()) && (mAvatarObject->isSitting()) && (gRlvHandler.hasBehaviourExcept(RLV_BHVR_UNSIT, gRlvHandler.getCurrentObject()))) ) { RlvNotifications::notifyBlockedTeleport(); diff --git a/indra/newview/lloverlaybar.cpp b/indra/newview/lloverlaybar.cpp index 5f74a9ecb..eeed29673 100644 --- a/indra/newview/lloverlaybar.cpp +++ b/indra/newview/lloverlaybar.cpp @@ -325,9 +325,9 @@ void LLOverlayBar::refresh() BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { -// sitting = gAgent.getAvatarObject()->mIsSitting; +// sitting = gAgent.getAvatarObject()->isSitting(); // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) - sitting = gAgent.getAvatarObject()->mIsSitting && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); + sitting = gAgent.getAvatarObject()->isSitting() && !gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT); // [/RLVa:KB] } button = getChild("Stand Up"); @@ -449,7 +449,7 @@ void LLOverlayBar::onClickMouselook(void*) void LLOverlayBar::onClickStandUp(void*) { // [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) - if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->mIsSitting) ) + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) && (gAgent.getAvatarObject()) && (gAgent.getAvatarObject()->isSitting()) ) { return; } diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 29929e82d..c8db6b33d 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -136,7 +136,7 @@ void LLPanelContents::getState(LLViewerObject *objectp ) LLViewerObject* pObj = LLSelectMgr::getInstance()->getSelection()->getFirstRootObject(TRUE); LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - editable = (pObj) && (pAvatar) && ((!pAvatar->mIsSitting) || (pAvatar->getRoot() != pObj->getRootEdit())); + editable = (pObj) && (pAvatar) && ((!pAvatar->isSitting()) || (pAvatar->getRoot() != pObj->getRootEdit())); } } // [/RLVa:KB] @@ -185,7 +185,7 @@ void LLPanelContents::onClickNewScript(void *userdata) else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == object->getRootEdit()) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == object->getRootEdit()) ) return; // .. or in a linkset the avie is sitting on under @unsit=n/@sittp=n } } diff --git a/indra/newview/llpanelinventory.cpp b/indra/newview/llpanelinventory.cpp index 38c90783b..f892ff48e 100644 --- a/indra/newview/llpanelinventory.cpp +++ b/indra/newview/llpanelinventory.cpp @@ -447,7 +447,7 @@ BOOL LLTaskInvFVBridge::isItemMovable() else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == pObj->getRootEdit()) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObj->getRootEdit()) ) return FALSE; } } @@ -470,7 +470,7 @@ BOOL LLTaskInvFVBridge::isItemRemovable() else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == pObjRoot) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObjRoot) ) return FALSE; } } diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 9f8561835..73d93e05e 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -505,7 +505,7 @@ void LLPanelObject::getState( ) if ( (rlv_handler_t::isEnabled()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == objectp->getRootEdit()) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == objectp->getRootEdit()) ) enable_move = enable_scale = enable_rotate = FALSE; } // [/RLVa:KB] diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp index 3dce4b321..f204bc227 100644 --- a/indra/newview/lltexlayer.cpp +++ b/indra/newview/lltexlayer.cpp @@ -218,7 +218,7 @@ BOOL LLTexLayerSetBuffer::needsRender() { LLVOAvatar* avatar = mTexLayerSet->getAvatar(); BOOL upload_now = needsUploadNow(); - BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->mAppearanceAnimating; + BOOL needs_update = (mNeedsUpdate || upload_now) && !avatar->getIsAppearanceAnimating(); if (needs_update) { BOOL invalid_skirt = avatar->getBakedTE(mTexLayerSet) == TEX_SKIRT_BAKED && !avatar->isWearingWearableType(WT_SKIRT); @@ -1736,7 +1736,7 @@ BOOL LLTexLayer::renderAlphaMasks( S32 x, S32 y, S32 width, S32 height, LLColor4 for( morph_list_t::iterator iter3 = mMaskedMorphs.begin(); iter3 != mMaskedMorphs.end(); iter3++ ) { - LLMaskedMorph* maskedMorph = &(*iter3); + LLVOAvatar::LLMaskedMorph* maskedMorph = &(*iter3); maskedMorph->mMorphTarget->applyMask(alpha_data, width, height, 1, maskedMorph->mInvert); } } @@ -1749,7 +1749,7 @@ void LLTexLayer::applyMorphMask(U8* tex_data, S32 width, S32 height, S32 num_com for( morph_list_t::iterator iter = mMaskedMorphs.begin(); iter != mMaskedMorphs.end(); iter++ ) { - LLMaskedMorph* maskedMorph = &(*iter); + LLVOAvatar::LLMaskedMorph* maskedMorph = &(*iter); maskedMorph->mMorphTarget->applyMask(tex_data, width, height, num_components, maskedMorph->mInvert); } } @@ -1832,7 +1832,7 @@ void LLTexLayer::requestUpdate() void LLTexLayer::addMaskedMorph(LLPolyMorphTarget* morph_target, BOOL invert) { - mMaskedMorphs.push_front(LLMaskedMorph(morph_target, invert)); + mMaskedMorphs.push_front(LLVOAvatar::LLMaskedMorph(morph_target, invert)); } void LLTexLayer::invalidateMorphMasks() @@ -2619,11 +2619,3 @@ BOOL LLTexStaticImageList::loadImageRaw( const std::string& file_name, LLImageRa return success; } -//----------------------------------------------------------------------------- -// LLMaskedMorph() -//----------------------------------------------------------------------------- -LLMaskedMorph::LLMaskedMorph( LLPolyMorphTarget *morph_target, BOOL invert ) : mMorphTarget(morph_target), mInvert(invert) -{ - morph_target->addPendingMorphMask(); -} - diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 05becfd95..d88466f50 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -45,6 +45,7 @@ #include "llwearable.h" #include "v4color.h" #include "llfloater.h" +#include "llvoavatar.h" class LLTexLayerSetInfo; class LLTexLayerSet; @@ -309,20 +310,6 @@ protected: LLTexLayerSetInfo *mInfo; }; -//----------------------------------------------------------------------------- -// LLMaskedMorph -//----------------------------------------------------------------------------- - -class LLMaskedMorph -{ -public: - LLMaskedMorph( LLPolyMorphTarget *morph_target, BOOL invert ); - -public: - LLPolyMorphTarget *mMorphTarget; - BOOL mInvert; -}; - //----------------------------------------------------------------------------- // LLTexLayer // A single texture layer @@ -374,7 +361,7 @@ protected: alpha_list_t mParamAlphaList; - typedef std::deque morph_list_t; + typedef std::deque morph_list_t; morph_list_t mMaskedMorphs; typedef std::map alpha_cache_t; alpha_cache_t mAlphaCache; diff --git a/indra/newview/lltoolbar.cpp b/indra/newview/lltoolbar.cpp index ee1165815..11fb9ada1 100644 --- a/indra/newview/lltoolbar.cpp +++ b/indra/newview/lltoolbar.cpp @@ -295,7 +295,7 @@ void LLToolBar::refresh() BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; + sitting = gAgent.getAvatarObject()->isSitting(); } childSetEnabled("fly_btn", (gAgent.canFly() || gAgent.getFlying() || gSavedSettings.getBOOL("AscentFlyAlwaysEnabled")) && !sitting ); diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index c14169ff4..ebedef626 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -2068,7 +2068,7 @@ EAcceptance LLToolDragAndDrop::willObjectAcceptInventory(LLViewerObject* obj, LL else if ( (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP)) ) { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == pObjRoot) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == pObjRoot) ) return ACCEPT_NO_LOCKED; // ... or on a linkset the avie is sitting on under @unsit=n/@sittp=n } } diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp index 2fb245b37..3516bc38c 100644 --- a/indra/newview/lltoolmorph.cpp +++ b/indra/newview/lltoolmorph.cpp @@ -146,7 +146,7 @@ void LLVisualParamHint::requestHintUpdates( LLVisualParamHint* exception1, LLVis BOOL LLVisualParamHint::needsRender() { - return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgent.getAvatarObject()->mAppearanceAnimating && mAllowsUpdates; + return mNeedsUpdate && mDelayFrames-- <= 0 && !gAgent.getAvatarObject()->getIsAppearanceAnimating() && mAllowsUpdates; } void LLVisualParamHint::preRender(BOOL clear_depth) diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index bcdaf45c5..5fbb48258 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -204,7 +204,7 @@ BOOL LLToolPie::pickAndShowMenu(BOOL always_show) // touch behavior down below... break; case CLICK_ACTION_SIT: - if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting) + if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting()) && (!gSavedSettings.getBOOL("DisableClickSit"))) // agent not already sitting { handle_sit_or_stand(); @@ -552,9 +552,9 @@ ECursorType cursor_from_object(LLViewerObject* object) switch(click_action) { case CLICK_ACTION_SIT: -// if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) // not already sitting? +// if ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) // not already sitting? // [RLVa:KB] - Checked: 2009-12-22 (RLVa-1.1.0k) | Added: RLVa-1.1.0j - if ( ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->mIsSitting)) && // not already sitting? + if ( ((gAgent.getAvatarObject() != NULL) && (!gAgent.getAvatarObject()->isSitting())) && // not already sitting? ((!rlv_handler_t::isEnabled()) || (gRlvHandler.canSit(object, gViewerWindow->getHoverPick().mObjectOffset))) ) // [/RLVa:KB] { diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 65a3b2a9b..67df36631 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -842,7 +842,7 @@ EKeyboardMode LLViewerKeyboard::getMode() { return MODE_EDIT_AVATAR; } - else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting) + else if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) { return MODE_SITTING; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 873e6d1ae..9bb01f336 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3498,7 +3498,7 @@ class LLSelfSitOrStand : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting) + if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) { // [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK if (gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) @@ -3540,7 +3540,7 @@ class LLSelfEnableSitOrStand : public view_listener_t stand_text = param.substr(offset+1); } - if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->mIsSitting) + if (gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting()) { // [RLVa:KB] - Alternate: Snowglobe-1.3.X | Checked: 2009-12-29 (RLVa-1.1.0k) | Added: RLVa-1.1.0k | OK new_value &= (!gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)); @@ -3757,7 +3757,7 @@ void handle_force_ground_sit(void*) { if (gAgent.getAvatarObject()) { - if(!gAgent.getAvatarObject()->mIsSitting) + if(!gAgent.getAvatarObject()->isSitting()) { gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } @@ -3958,7 +3958,7 @@ bool handle_sit_or_stand() // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.1.3b) | Added: RLVa-1.2.1c | OK if ( (gRlvHandler.hasBehaviour(RLV_BHVR_STANDTP)) && (gAgent.getAvatarObject()) ) { - if (gAgent.getAvatarObject()->mIsSitting) + if (gAgent.getAvatarObject()->isSitting()) { if (gRlvHandler.canStand()) gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); @@ -4075,7 +4075,7 @@ class LLWorldEnableFly : public view_listener_t BOOL sitting = FALSE; if (gAgent.getAvatarObject()) { - sitting = gAgent.getAvatarObject()->mIsSitting; + sitting = gAgent.getAvatarObject()->isSitting(); } gMenuHolder->findControl(userdata["control"].asString())->setValue(!sitting); return true; @@ -5158,7 +5158,7 @@ BOOL sitting_on_selection() return FALSE; } - return (avatar->mIsSitting && avatar->getRoot() == root_object); + return (avatar->isSitting() && avatar->getRoot() == root_object); } class LLToolsSaveToInventory : public view_listener_t @@ -6004,7 +6004,7 @@ class LLWorldSitOnGround : public view_listener_t { if (gAgent.getAvatarObject()) { - if(!gAgent.getAvatarObject()->mIsSitting) + if(!gAgent.getAvatarObject()->isSitting()) { gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND); } diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 99844508f..6c66831c9 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4945,7 +4945,7 @@ void process_avatar_sit_response(LLMessageSystem *mesgsys, void **user_data) if (object) { LLVector3 sit_spot = object->getPositionAgent() + (sitPosition * object->getRotation()); - if (!use_autopilot || (avatar && avatar->mIsSitting && avatar->getRoot() == object->getRoot())) + if (!use_autopilot || (avatar && avatar->isSitting() && avatar->getRoot() == object->getRoot())) { //we're already sitting on this object, so don't autopilot } diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index a82fdb3d5..61eb5f075 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -3385,7 +3385,7 @@ void LLViewerWindow::renderSelections( BOOL for_gl_pick, BOOL pick_parcel_walls, ((gRlvHandler.hasBehaviour(RLV_BHVR_UNSIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_SITTP))) ) { LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (pAvatar->getRoot() == object->getRootEdit()) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (pAvatar->getRoot() == object->getRootEdit()) ) moveable_object_selected = this_object_movable = FALSE; } // [/RLVa:KB] diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 85d0e5f4c..22c4ab4f6 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -168,7 +168,7 @@ const S32 MIN_REQUIRED_PIXEL_AREA_PELVIS_FIX = 40; const S32 TEX_IMAGE_SIZE_SELF = 512; const S32 TEX_IMAGE_AREA_SELF = TEX_IMAGE_SIZE_SELF * TEX_IMAGE_SIZE_SELF; -const S32 TEX_IMAGE_SIZE_OTHER = TEX_IMAGE_SIZE_SELF / 4; // The size of local textures for other (!mIsSelf) avatars +const S32 TEX_IMAGE_SIZE_OTHER = TEX_IMAGE_SIZE_SELF / 4; // The size of local textures for other (!isSelf()) avatars const S32 TEX_IMAGE_AREA_OTHER = TEX_IMAGE_SIZE_OTHER * TEX_IMAGE_SIZE_OTHER; const F32 HEAD_MOVEMENT_AVG_TIME = 0.9f; @@ -229,7 +229,7 @@ struct LLTextureMaskData /********************************************************************************* ** ** - ** Begin LLVOAvatar Support classes + ** Begin private LLVOAvatar Support classes ** **/ @@ -285,85 +285,6 @@ private: bone_info_list_t mBoneInfoList; }; - -//------------------------------------------------------------------------ -// LLVOAvatarXmlInfo -// One instance (in LLVOAvatar) with common data parsed from the XML files -//------------------------------------------------------------------------ -class LLVOAvatarXmlInfo -{ - friend class LLVOAvatar; -public: - LLVOAvatarXmlInfo(); - ~LLVOAvatarXmlInfo(); - -private: - BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); - BOOL parseXmlMeshNodes(LLXmlTreeNode* root); - BOOL parseXmlColorNodes(LLXmlTreeNode* root); - BOOL parseXmlLayerNodes(LLXmlTreeNode* root); - BOOL parseXmlDriverNodes(LLXmlTreeNode* root); - - struct LLVOAvatarMeshInfo - { - typedef std::pair morph_info_pair_t; - typedef std::vector morph_info_list_t; - - LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} - ~LLVOAvatarMeshInfo() - { - morph_info_list_t::iterator iter; - for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) - { - delete iter->first; - } - mPolyMorphTargetInfoList.clear(); - } - - std::string mType; - S32 mLOD; - std::string mMeshFileName; - std::string mReferenceMeshName; - F32 mMinPixelArea; - morph_info_list_t mPolyMorphTargetInfoList; - }; - typedef std::vector mesh_info_list_t; - mesh_info_list_t mMeshInfoList; - - typedef std::vector skeletal_distortion_info_list_t; - skeletal_distortion_info_list_t mSkeletalDistortionInfoList; - - struct LLVOAvatarAttachmentInfo - { - LLVOAvatarAttachmentInfo() - : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), - mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} - std::string mName; - std::string mJointName; - LLVector3 mPosition; - LLVector3 mRotationEuler; - S32 mGroup; - S32 mAttachmentID; - S32 mPieMenuSlice; - BOOL mVisibleFirstPerson; - BOOL mIsHUDAttachment; - BOOL mHasPosition; - BOOL mHasRotation; - }; - typedef std::vector attachment_info_list_t; - attachment_info_list_t mAttachmentInfoList; - - LLTexGlobalColorInfo *mTexSkinColorInfo; - LLTexGlobalColorInfo *mTexHairColorInfo; - LLTexGlobalColorInfo *mTexEyeColorInfo; - - typedef std::vector layer_info_list_t; - layer_info_list_t mLayerInfoList; - - typedef std::vector driver_info_list_t; - driver_info_list_t mDriverInfoList; -}; - //----------------------------------------------------------------------------- // class LLBodyNoiseMotion //----------------------------------------------------------------------------- @@ -689,10 +610,10 @@ LLXmlTree LLVOAvatar::sXMLTree; LLXmlTree LLVOAvatar::sSkeletonXMLTree; BOOL LLVOAvatar::sDebugAvatarRotation = FALSE; LLVOAvatarSkeletonInfo* LLVOAvatar::sAvatarSkeletonInfo = NULL; -LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; +LLVOAvatar::LLVOAvatarXmlInfo* LLVOAvatar::sAvatarXmlInfo = NULL; LLVOAvatarDictionary *LLVOAvatar::sAvatarDictionary = NULL; S32 LLVOAvatar::sFreezeCounter = 0; -S32 LLVOAvatar::sMaxVisible = 50; +U32 LLVOAvatar::sMaxVisible = 50; LLMap< LLGLenum, LLGLuint*> LLVOAvatar::sScratchTexNames; LLMap< LLGLenum, F32*> LLVOAvatar::sScratchTexLastBindTime; S32 LLVOAvatar::sScratchTexBytes = 0; @@ -716,7 +637,7 @@ const LLUUID LLVOAvatar::sStepSounds[LL_MCODE_END] = }; S32 LLVOAvatar::sRenderName = RENDER_NAME_ALWAYS; -BOOL LLVOAvatar::sRenderGroupTitles = TRUE; +bool LLVOAvatar::sRenderGroupTitles = true; S32 LLVOAvatar::sNumVisibleChatBubbles = 0; BOOL LLVOAvatar::sDebugInvisible = FALSE; BOOL LLVOAvatar::sShowAttachmentPoints = FALSE; @@ -729,10 +650,6 @@ BOOL LLVOAvatar::sUseImpostors = FALSE; BOOL LLVOAvatar::sJointDebug = FALSE; EmeraldGlobalBoobConfig LLVOAvatar::sBoobConfig; - -F32 LLVOAvatar::sAvMorphTime = 0.65f; - - F32 LLVOAvatar::sUnbakedTime = 0.f; F32 LLVOAvatar::sUnbakedUpdateTime = 0.f; F32 LLVOAvatar::sGreyTime = 0.f; @@ -771,17 +688,17 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, mAppearanceAnimating(FALSE), mNameString(), mTitle(), - mNameAway(FALSE), - mNameBusy(FALSE), - mNameMute(FALSE), - mNameAppearance(FALSE), + mNameAway(false), + mNameBusy(false), + mNameMute(false), + mNameAppearance(false), mRenderedName(), mUsedNameSystem(), mClientName(), mRenderGroupTitles(sRenderGroupTitles), mNameFromChatOverride(false), mNameFromChatChanged(false), - mRenderTag(FALSE), + mRenderTag(false), mLastRegionHandle(0), mRegionCrossingCount(0), mFirstTEMessageReceived( FALSE ), @@ -827,15 +744,15 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, } } - mBakedTextureData.resize(BAKED_NUM_INDICES); - for (U32 i = 0; i < mBakedTextureData.size(); i++ ) + mBakedTextureDatas.resize(BAKED_NUM_INDICES); + for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) { - mBakedTextureData[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; - mBakedTextureData[i].mTexLayerSet = NULL; - mBakedTextureData[i].mIsLoaded = false; - mBakedTextureData[i].mIsUsed = false; - mBakedTextureData[i].mMaskTexName = 0; - mBakedTextureData[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i); + mBakedTextureDatas[i].mLastTextureIndex = IMG_DEFAULT_AVATAR; + mBakedTextureDatas[i].mTexLayerSet = NULL; + mBakedTextureDatas[i].mIsLoaded = false; + mBakedTextureDatas[i].mIsUsed = false; + mBakedTextureDatas[i].mMaskTexName = 0; + mBakedTextureDatas[i].mTextureIndex = getTextureIndex((EBakedTextureIndex)i); } mDirtyMesh = 2; // Dirty geometry, need to regenerate. @@ -970,7 +887,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id, iter != mMeshLOD[mesh_index]->mMeshParts.end(); iter++) { LLViewerJointMesh* mesh = (LLViewerJointMesh*) *iter; - mBakedTextureData[(int)baked_texture_index].mMeshes.push_back(mesh); + mBakedTextureDatas[(int)baked_texture_index].mMeshes.push_back(mesh); } } @@ -1078,7 +995,7 @@ LLVOAvatar::~LLVOAvatar() { lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; - if (mIsSelf) + if (isSelf()) { gAgent.setAvatarObject(NULL); } @@ -1097,10 +1014,10 @@ LLVOAvatar::~LLVOAvatar() mNumJoints = 0; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - delete mBakedTextureData[i].mTexLayerSet; - mBakedTextureData[i].mTexLayerSet = NULL; + delete mBakedTextureDatas[i].mTexLayerSet; + mBakedTextureDatas[i].mTexLayerSet = NULL; } std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); @@ -1115,9 +1032,10 @@ LLVOAvatar::~LLVOAvatar() std::for_each(mMeshes.begin(), mMeshes.end(), DeletePairedPointer()); mMeshes.clear(); - std::vector::iterator jointIter; - for (jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); jointIter++) + + for (std::vector::iterator jointIter = mMeshLOD.begin(); + jointIter != mMeshLOD.end(); + ++jointIter) { LLViewerJoint* joint = (LLViewerJoint *) *jointIter; std::for_each(joint->mMeshParts.begin(), joint->mMeshParts.end(), DeletePointer()); @@ -1144,7 +1062,6 @@ void LLVOAvatar::markDead() mNameText = NULL; sNumVisibleChatBubbles--; } - mVoiceVisualizer->markDead(); mBeam = NULL; @@ -1157,9 +1074,9 @@ BOOL LLVOAvatar::isFullyBaked() if (mIsDummy) return TRUE; if (getNumTEs() == 0) return FALSE; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (!isTextureDefined(mBakedTextureData[i].mTextureIndex) + if (!isTextureDefined(mBakedTextureDatas[i].mTextureIndex) && ( (i != BAKED_SKIRT) || isWearingWearableType(WT_SKIRT) ) ) { return FALSE; @@ -1170,19 +1087,21 @@ BOOL LLVOAvatar::isFullyBaked() void LLVOAvatar::deleteLayerSetCaches(bool clearAll) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (mBakedTextureData[i].mTexLayerSet) + if (mBakedTextureDatas[i].mTexLayerSet) { - if ((i != BAKED_HAIR || mIsSelf) && !clearAll) // Backwards compatibility - can be removed after hair baking is mandatory on the grid + // ! BACKWARDS COMPATIBILITY ! + // Can be removed after hair baking is mandatory on the grid + if ((i != BAKED_HAIR || isSelf()) && !clearAll) { - mBakedTextureData[i].mTexLayerSet->deleteCaches(); + mBakedTextureDatas[i].mTexLayerSet->deleteCaches(); } } - if (mBakedTextureData[i].mMaskTexName) + if (mBakedTextureDatas[i].mMaskTexName) { - glDeleteTextures(1, (GLuint*)&(mBakedTextureData[i].mMaskTexName)); - mBakedTextureData[i].mMaskTexName = 0 ; + glDeleteTextures(1, (GLuint*)&(mBakedTextureDatas[i].mMaskTexName)); + mBakedTextureDatas[i].mMaskTexName = 0 ; } } } @@ -1193,7 +1112,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) BOOL res = TRUE; grey_avatars = 0; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; if( inst->isDead() ) @@ -1205,8 +1124,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) // { // return res; // Assumes sInstances is sorted by pixel area. // } - else - if( !inst->isFullyBaked() ) + else if( !inst->isFullyBaked() ) { res = FALSE; if (inst->mHasGrey) @@ -1271,7 +1189,7 @@ void LLVOAvatar::dumpBakedStatus() LLVector3d camera_pos_global = gAgent.getCameraPositionGlobal(); for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; llinfos << "Avatar "; @@ -1325,7 +1243,7 @@ void LLVOAvatar::dumpBakedStatus() for (LLVOAvatarDictionary::baked_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); - iter++) + ++iter) { const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = iter->second; const ETextureIndex index = baked_dict->mTextureIndex; @@ -1334,7 +1252,6 @@ void LLVOAvatar::dumpBakedStatus() llcont << " " << LLVOAvatarDictionary::getInstance()->getTexture(index)->mName; } } - llcont << " ) " << inst->getUnbakedPixelAreaRank(); if( inst->isCulled() ) { @@ -1353,9 +1270,9 @@ void LLVOAvatar::restoreGL() { LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->setCompositeUpdatesEnabled( TRUE ); - for (U32 i = 0; i < inst->mBakedTextureData.size(); i++) + for (U32 i = 0; i < inst->mBakedTextureDatas.size(); i++) { - inst->invalidateComposite( inst->mBakedTextureData[i].mTexLayerSet, FALSE ); + inst->invalidateComposite( inst->mBakedTextureDatas[i].mTexLayerSet, FALSE ); } inst->updateMeshTextures(); } @@ -1373,7 +1290,7 @@ void LLVOAvatar::destroyGL() void LLVOAvatar::resetImpostors() { for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* avatar = (LLVOAvatar*) *iter; avatar->mImpostor.release(); @@ -1430,7 +1347,7 @@ if(gAuditTexture) { lldebugs << "Deleting layer set caches" << llendl; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; inst->deleteLayerSetCaches(clearAll); @@ -1588,7 +1505,7 @@ void LLVOAvatar::cleanupClass() const LLVector3 LLVOAvatar::getRenderPosition() const { - if (!mDrawable || mDrawable.isNull() || mDrawable->getGeneration() < 0) + if (mDrawable.isNull() || mDrawable->getGeneration() < 0) { return getPositionAgent(); } @@ -1730,11 +1647,9 @@ BOOL LLVOAvatar::lineSegmentIntersect(const LLVector3& start, const LLVector3& e LLVector3* intersection, LLVector2* tex_coord, LLVector3* normal, - LLVector3* bi_normal - ) + LLVector3* bi_normal) { - - if ((mIsSelf && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar) + if ((isSelf() && !gAgent.needsRenderAvatar()) || !LLPipeline::sPickAvatar) { return FALSE; } @@ -1893,7 +1808,7 @@ BOOL LLVOAvatar::setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent // setup children LLVOAvatarBoneInfo::child_list_t::const_iterator iter; - for (iter = info->mChildList.begin(); iter != info->mChildList.end(); iter++) + for (iter = info->mChildList.begin(); iter != info->mChildList.end(); ++iter) { LLVOAvatarBoneInfo *child_info = *iter; if (!setupBone(child_info, joint, volume_num, joint_num)) @@ -1939,7 +1854,7 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) S32 current_joint_num = 0; S32 current_volume_num = 0; LLVOAvatarSkeletonInfo::bone_info_list_t::const_iterator iter; - for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); iter++) + for (iter = info->mBoneInfoList.begin(); iter != info->mBoneInfoList.end(); ++iter) { LLVOAvatarBoneInfo *info = *iter; if (!setupBone(info, NULL, current_volume_num, current_joint_num)) @@ -1950,7 +1865,7 @@ BOOL LLVOAvatar::buildSkeleton(const LLVOAvatarSkeletonInfo *info) } // add special-purpose "screen" joint - if (mIsSelf) + if (isSelf()) { mScreenp = new LLViewerJoint("mScreen", NULL); // for now, put screen at origin, as it is only used during special @@ -2011,11 +1926,11 @@ void LLVOAvatar::buildCharacter() // clear mesh data //------------------------------------------------------------------------- for (std::vector::iterator jointIter = mMeshLOD.begin(); - jointIter != mMeshLOD.end(); jointIter++) + jointIter != mMeshLOD.end(); ++jointIter) { LLViewerJoint* joint = (LLViewerJoint*) *jointIter; for (std::vector::iterator meshIter = joint->mMeshParts.begin(); - meshIter != joint->mMeshParts.end(); meshIter++) + meshIter != joint->mMeshParts.end(); ++meshIter) { LLViewerJointMesh * mesh = (LLViewerJointMesh *) *meshIter; mesh->setMesh(NULL); @@ -2039,9 +1954,9 @@ void LLVOAvatar::buildCharacter() // gPrintMessagesThisFrame = TRUE; lldebugs << "Avatar load took " << timer.getElapsedTimeF32() << " seconds." << llendl; - if ( ! status ) + if (!status) { - if ( mIsSelf ) + if (isSelf()) { llerrs << "Unable to load user's avatar" << llendl; } @@ -2077,24 +1992,24 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- // Make sure "well known" pointers exist //------------------------------------------------------------------------- - if (!(mPelvisp && - mTorsop && - mChestp && - mNeckp && - mHeadp && - mSkullp && - mHipLeftp && - mHipRightp && - mKneeLeftp && - mKneeRightp && - mAnkleLeftp && - mAnkleRightp && - mFootLeftp && - mFootRightp && - mWristLeftp && - mWristRightp && - mEyeLeftp && - mEyeRightp)) + if (!(mPelvisp && + mTorsop && + mChestp && + mNeckp && + mHeadp && + mSkullp && + mHipLeftp && + mHipRightp && + mKneeLeftp && + mKneeRightp && + mAnkleLeftp && + mAnkleRightp && + mFootLeftp && + mFootRightp && + mWristLeftp && + mWristRightp && + mEyeLeftp && + mEyeRightp)) { llerrs << "Failed to create avatar." << llendl; return; @@ -2143,7 +2058,7 @@ void LLVOAvatar::buildCharacter() //------------------------------------------------------------------------- // build the attach and detach menus //------------------------------------------------------------------------- - if (mIsSelf) + if (isSelf()) { // *TODO: Translate gAttachBodyPartPieMenus[0] = NULL; @@ -2377,14 +2292,15 @@ void LLVOAvatar::releaseMeshData() // cleanup mesh data for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); iter++) + iter != mMeshLOD.end(); + ++iter) { LLViewerJoint* joint = (LLViewerJoint*) *iter; joint->setValid(FALSE, TRUE); } //cleanup data - if (mDrawable && mDrawable.notNull()) + if (mDrawable.notNull()) { LLFace* facep = mDrawable->getFace(0); facep->setSize(0, 0); @@ -2394,12 +2310,12 @@ void LLVOAvatar::releaseMeshData() facep->setSize(0, 0); } } - - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; + LLViewerJointAttachment* attachment = iter->second; if (!attachment->getIsHUDAttachment()) { attachment->setAttachmentVisibility(FALSE); @@ -2419,17 +2335,17 @@ void LLVOAvatar::restoreMeshData() mMeshValid = TRUE; updateJointLODs(); - if (mIsSelf) + if (isSelf()) { updateAttachmentVisibility(gAgent.getCameraMode()); } else { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; + LLViewerJointAttachment* attachment = iter->second; if (!attachment->getIsHUDAttachment()) { attachment->setAttachmentVisibility(TRUE); @@ -2446,7 +2362,7 @@ void LLVOAvatar::restoreMeshData() //----------------------------------------------------------------------------- void LLVOAvatar::updateMeshData() { - if (mDrawable && mDrawable.notNull()) + if (mDrawable.notNull()) { stop_glerror(); @@ -2654,7 +2570,7 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, if (update_type == OUT_FULL ) { - if(mIsSelf) + if(isSelf()) { if(gSavedSettings.getBOOL("ReSit")) { @@ -2715,7 +2631,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) setPixelAreaAndAngle(gAgent); // force asynchronous drawable update - if(mDrawable && mDrawable.notNull() && !gNoRender) + if(mDrawable.notNull() && !gNoRender) { LLFastTimer t(LLFastTimer::FTM_JOINT_UPDATE); @@ -2746,7 +2662,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // set alpha flag depending on state //-------------------------------------------------------------------- - if (mIsSelf) + if (isSelf()) { LLViewerObject::idleUpdate(agent, world, time); @@ -2767,7 +2683,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) // attach objects that were waiting for a drawable lazyAttach(); /* - if (mIsSelf) + if (isSelf()) { checkAttachments(); } @@ -2785,7 +2701,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time) } //Emerald performs some force-bakes stuff here. Added it in because we noticed slow responses with client tag ident. -HgB - if(mIsSelf) + if(isSelf()) { for(U8 i=0;isetVoiceEnabled( voice_enabled && !(mIsSelf && gAgent.cameraMouselook()) ); + mVoiceVisualizer->setVoiceEnabled( voice_enabled && !(isSelf() && gAgent.cameraMouselook()) ); if ( voice_enabled ) { //---------------------------------------------------------------- // Only do gesture triggering for your own avatar, and only when you're in a proximal channel. //---------------------------------------------------------------- - if( mIsSelf ) + if( isSelf() ) { //---------------------------------------------------------------------------------------- // The following takes the voice signal and uses that to trigger gesticulations. @@ -2878,7 +2794,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) } } - } //if( mIsSelf ) + } //if( isSelf() ) //----------------------------------------------------------------------------------------------------------------- // If the avatar is speaking, then the voice amplitude signal is passed to the voice visualizer. @@ -2898,7 +2814,7 @@ void LLVOAvatar::idleUpdateVoiceVisualizer(bool voice_enabled) mVoiceVisualizer->setSpeakingAmplitude( gVoiceClient->getCurrentPower( mID ) ); - if( mIsSelf ) + if( isSelf() ) { gAgent.clearAFK(); } @@ -2955,11 +2871,11 @@ void LLVOAvatar::idleUpdateMisc(bool detailed_update) if (detailed_update || !sUseImpostors) { LLFastTimer t(LLFastTimer::FTM_ATTACHMENT_UPDATE); - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; + LLViewerJointAttachment* attachment = iter->second; for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); attachment_iter != attachment->mAttachedObjects.end(); @@ -3055,7 +2971,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() { ESex avatar_sex = getSex(); F32 appearance_anim_time = mAppearanceMorphTimer.getElapsedTimeF32(); - if (appearance_anim_time >= sAvMorphTime) + if (appearance_anim_time >= APPEARANCE_MORPH_TIME) { mAppearanceAnimating = FALSE; for (LLVisualParam *param = getFirstVisualParam(); @@ -3068,7 +2984,7 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } } updateVisualParams(); - if (mIsSelf) + if (isSelf()) { gAgent.sendAgentSetAppearance(); } @@ -3076,14 +2992,14 @@ void LLVOAvatar::idleUpdateAppearanceAnimation() } else { - F32 blend_frac = calc_bouncy_animation(appearance_anim_time / sAvMorphTime); - F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / sAvMorphTime); + F32 blend_frac = calc_bouncy_animation(appearance_anim_time / APPEARANCE_MORPH_TIME); + F32 last_blend_frac = calc_bouncy_animation(mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME); F32 morph_amt; // if it's over 5 seconds, just forget the bouncy anim - if(sAvMorphTime > 5.f) + if(APPEARANCE_MORPH_TIME > 5.f) { - blend_frac = appearance_anim_time / sAvMorphTime; - last_blend_frac = mLastAppearanceBlendTime / sAvMorphTime; + blend_frac = appearance_anim_time / APPEARANCE_MORPH_TIME; + last_blend_frac = mLastAppearanceBlendTime / APPEARANCE_MORPH_TIME; } if (last_blend_frac == 1.f) { @@ -3428,7 +3344,7 @@ void LLVOAvatar::getClientInfo(std::string& client, LLColor4& color, BOOL useCom std::string uuid_str = getTE(TEX_HEAD_BODYPAINT)->getID().asString(); //UUID of the head texture static const LLCachedControl avatar_name_color("AvatarNameColor",LLColor4(LLColor4U(251, 175, 93, 255)), gColors ); - if (mIsSelf) + if (isSelf()) { static const LLCachedControl ascent_use_custom_tag("AscentUseCustomTag", false); static const LLCachedControl ascent_custom_tag_color("AscentCustomTagColor", LLColor4(.5f,1.f,.25f,1.f)); @@ -3586,7 +3502,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) mNameFromChatOverride)); // If it's your own avatar, don't draw in mouselook, and don't // draw if we're specifically hiding our own name. - if (mIsSelf) + if (isSelf()) { render_name = render_name && !gAgent.cameraMouselook() @@ -3767,7 +3683,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } static const LLCachedControl ascent_use_status_colors("AscentUseStatusColors",true); - if (!mIsSelf && ascent_use_status_colors) + if (!isSelf() && ascent_use_status_colors) { LLViewerRegion* parent_estate = LLWorld::getInstance()->getRegionFromPosGlobal(this->getPositionGlobal()); LLUUID estate_owner = LLUUID::null; @@ -3799,8 +3715,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } client = mClientTag; - if ((mIsSelf && gSavedSettings.getBOOL("AscentShowSelfTagColor")) - || (!mIsSelf && gSavedSettings.getBOOL("AscentShowOthersTagColor"))) + if ((isSelf() && gSavedSettings.getBOOL("AscentShowSelfTagColor")) + || (!isSelf() && gSavedSettings.getBOOL("AscentShowOthersTagColor"))) avatar_name_color = mClientColor; @@ -3870,14 +3786,14 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) } } - BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); + bool is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY) != mSignaledAnimations.end(); if(mNameAway && ! is_away) mIdleTimer.reset(); - BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); + bool is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); if(mNameBusy && ! is_busy) mIdleTimer.reset(); - BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); + bool is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); if(mNameAppearance && ! is_appearance) mIdleTimer.reset(); - BOOL is_muted; - if (mIsSelf) + bool is_muted; + if (isSelf()) { is_muted = FALSE; } @@ -3983,8 +3899,8 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) { if ((client != "")&&(client != "?")) { - if ((mIsSelf && gSavedSettings.getBOOL("AscentShowSelfTag")) - || (!mIsSelf && gSavedSettings.getBOOL("AscentShowOthersTag"))) + if ((isSelf() && gSavedSettings.getBOOL("AscentShowSelfTag")) + || (!isSelf() && gSavedSettings.getBOOL("AscentShowOthersTag"))) { additions += client; need_comma = TRUE; @@ -4033,7 +3949,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last) line += "\n"; line += "(Editing Appearance)"; } - if(!mIsSelf && mIdleTimer.getElapsedTimeF32() > 120 && gSavedSettings.getBOOL("AscentShowIdleTime")) + if(!isSelf() && mIdleTimer.getElapsedTimeF32() > 120 && gSavedSettings.getBOOL("AscentShowIdleTime")) { line += "\n"; line += getIdleTime(); @@ -4174,13 +4090,13 @@ void LLVOAvatar::invalidateNameTag(const LLUUID& agent_id) avatar->clearNameTag(); } -//staticmNameString.empty() +//static void LLVOAvatar::invalidateNameTags() { - for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + std::vector::iterator it = LLCharacter::sInstances.begin(); + for ( ; it != LLCharacter::sInstances.end(); ++it) { - LLVOAvatar* avatar = (LLVOAvatar*) *iter; + LLVOAvatar* avatar = dynamic_cast(*it); if (!avatar) continue; if (avatar->isDead()) continue; @@ -4194,7 +4110,7 @@ void LLVOAvatar::idleUpdateTractorBeam() //-------------------------------------------------------------------- // draw tractor beam when editing objects //-------------------------------------------------------------------- - if (!mIsSelf) + if (!isSelf()) { return; } @@ -4294,7 +4210,7 @@ void LLVOAvatar::slamPosition() gAgent.setPositionAgent(getPositionAgent()); mRoot.setWorldPosition(getPositionAgent()); // teleport setChanged(TRANSLATED); - if (mDrawable && mDrawable.notNull()) + if (mDrawable.notNull()) { gPipeline.updateMoveNormalAsync(mDrawable); } @@ -4350,7 +4266,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (gNoRender) { // Hack if we're running drones... - if (mIsSelf) + if (isSelf()) { gAgent.setPositionAgent(getPositionAgent()); } @@ -4369,7 +4285,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // For fading out the names above heads, only let the timer // run if we're visible. - if (mDrawable && mDrawable.notNull() && !visible) + if (mDrawable.notNull() && !visible) { mTimeVisible.reset(); } @@ -4379,30 +4295,30 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // the rest should only be done occasionally for far away avatars //-------------------------------------------------------------------- - if (visible && !mIsSelf && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) + if (visible && !isSelf() && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) { F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); if (LLMuteList::getInstance()->isMuted(getID())) { // muted avatars update at 16 hz mUpdatePeriod = 16; } - else if (visible && mVisibilityRank <= LLVOAvatar::sMaxVisible * 0.25f) + else if (mVisibilityRank <= LLVOAvatar::sMaxVisible * 0.25f) { //first 25% of max visible avatars are not impostored mUpdatePeriod = 1; } - else if (visible && mVisibilityRank > LLVOAvatar::sMaxVisible * 0.75f) + else if (mVisibilityRank > LLVOAvatar::sMaxVisible * 0.75f) { //back 25% of max visible avatars are slow updating impostors mUpdatePeriod = 8; } - else if (visible && mVisibilityRank > (U32) LLVOAvatar::sMaxVisible) + else if (mVisibilityRank > (U32) LLVOAvatar::sMaxVisible) { //background avatars are REALLY slow updating impostors mUpdatePeriod = 16; } - else if (visible && mImpostorPixelArea <= impostor_area) + else if (mImpostorPixelArea <= impostor_area) { // stuff in between gets an update period based on pixel area mUpdatePeriod = llclamp((S32) sqrtf(impostor_area*4.f/mImpostorPixelArea), 2, 8); } - else if (visible && mVisibilityRank > LLVOAvatar::sMaxVisible * 0.25f) + else if (mVisibilityRank > LLVOAvatar::sMaxVisible * 0.25f) { // force nearby impostors in ultra crowded areas mUpdatePeriod = 2; } @@ -4414,14 +4330,17 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE; } - if (!visible && !mIsSelf) + // don't early out for your own avatar, as we rely on your animations playing reliably + // for example, the "turn around" animation when entering customize avatar needs to trigger + // even when your avatar is offscreen + if (!visible && !isSelf()) { updateMotions(LLCharacter::HIDDEN_UPDATE); return FALSE; } // change animation time quanta based on avatar render load - if (!mIsSelf && !mIsDummy) + if (!isSelf() && !mIsDummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -4490,7 +4409,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) LLVector3d root_pos; LLVector3d ground_under_pelvis; - if (mIsSelf) + if (isSelf()) { gAgent.setPositionAgent(getRenderPosition()); } @@ -4535,7 +4454,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // more than 90 from the view, if necessary, flip the velocity vector. LLVector3 primDir; - if (mIsSelf) + if (isSelf()) { primDir = agent.getAtAxis() - projected_vec(agent.getAtAxis(), agent.getReferenceUpVector()); primDir.normalize(); @@ -4555,7 +4474,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } LLVector3 fwdDir = lerp(primDir, velDir, clamp_rescale(speed, 0.5f, 2.0f, 0.0f, 1.0f)); - if (mIsSelf && gAgent.cameraMouselook()) + if (isSelf() && gAgent.cameraMouselook()) { // make sure fwdDir stays in same general direction as primdir if (gAgent.getFlying()) @@ -4594,7 +4513,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // When moving very slow, the pelvis is allowed to deviate from the // forward direction to allow it to hold it's position while the torso // and head turn. Once in motion, it must conform however. - BOOL self_in_mouselook = mIsSelf && gAgent.cameraMouselook(); + BOOL self_in_mouselook = isSelf() && gAgent.cameraMouselook(); LLVector3 pelvisDir( mRoot.getWorldMatrix().getFwdRow4().mV ); F32 pelvis_rot_threshold = clamp_rescale(speed, 0.1f, 1.0f, PELVIS_ROT_THRESHOLD_SLOW, PELVIS_ROT_THRESHOLD_FAST); @@ -4645,7 +4564,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) fwdDir = leftDir % upDir; LLQuaternion wQv( fwdDir, leftDir, upDir ); - if (mIsSelf && mTurning) + if (isSelf() && mTurning) { if ((fwdDir % pelvisDir) * upDir > 0.f) { @@ -4682,7 +4601,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } } - else if (mDrawable && mDrawable.notNull()) + else if (mDrawable.notNull()) { mRoot.setPosition(mDrawable->getPosition()); mRoot.setRotation(mDrawable->getRotation()); @@ -4810,10 +4729,10 @@ void LLVOAvatar::updateHeadOffset() { // since we only care about Z, just grab one of the eyes LLVector3 midEyePt = mEyeLeftp->getWorldPosition(); - midEyePt -= (mDrawable && mDrawable.notNull()) ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); + midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition(); midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]); - if (mDrawable && mDrawable.notNull()) + if (mDrawable.notNull()) { midEyePt = midEyePt * ~mDrawable->getWorldRotation(); } @@ -4839,7 +4758,7 @@ void LLVOAvatar::updateVisibility() { visible = TRUE; } - else if (!mDrawable || mDrawable.isNull()) + else if (mDrawable.isNull()) { visible = FALSE; } @@ -4854,7 +4773,7 @@ void LLVOAvatar::updateVisibility() visible = FALSE; } - if( mIsSelf ) + if(isSelf()) { if( !gAgent.areWearablesLoaded()) { @@ -4912,7 +4831,8 @@ void LLVOAvatar::updateVisibility() /*llinfos << "SPA: " << sel_pos_agent << llendl; llinfos << "WPA: " << wrist_right_pos_agent << llendl;*/ for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); iter++) + iter != mAttachmentPoints.end(); + ++iter) { LLViewerJointAttachment* attachment = iter->second; @@ -4966,6 +4886,16 @@ void LLVOAvatar::updateVisibility() mVisible = visible; } +// private +bool LLVOAvatar::shouldAlphaMask() +{ + const bool should_alpha_mask = mSupportsAlphaLayers && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked + && !LLDrawPoolAvatar::sSkipTransparent && mHasBakedHair; + + return should_alpha_mask; + +} + //------------------------------------------------------------------------ // needsRenderBeam() //------------------------------------------------------------------------ @@ -5027,7 +4957,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) mMeshLOD[MESH_ID_SKIRT]->updateJointGeometry(); } - if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { mMeshLOD[MESH_ID_EYELASH]->updateJointGeometry(); mMeshLOD[MESH_ID_HEAD]->updateJointGeometry(); @@ -5077,7 +5007,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) return num_indices; } - if (mIsSelf && !gAgent.needsRenderAvatar()) + if (isSelf() && !gAgent.needsRenderAvatar()) { return num_indices; } @@ -5086,7 +5016,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) // *NOTE: this is disabled (there is no UI for enabling sShowFootPlane) due // to DEV-14477. the code is left here to aid in tracking down the cause // of the crash in the future. -brad - if (!gRenderForSelect && sShowFootPlane && mDrawable && mDrawable.notNull()) + if (!gRenderForSelect && sShowFootPlane && mDrawable.notNull()) { LLVector3 slaved_pos = mDrawable->getPositionAgent(); LLVector3 foot_plane_normal(mFootPlane.mV[VX], mFootPlane.mV[VY], mFootPlane.mV[VZ]); @@ -5127,17 +5057,10 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) if (pass == AVATAR_RENDER_PASS_SINGLE) { - const bool should_alpha_mask = mSupportsAlphaLayers && mHasBakedHair - && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked - && !LLDrawPoolAvatar::sSkipTransparent; - - - - - + const bool should_alpha_mask = shouldAlphaMask(); LLGLState test(GL_ALPHA_TEST, should_alpha_mask); - + if (should_alpha_mask) { gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.5f); @@ -5146,7 +5069,7 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) BOOL first_pass = TRUE; if (!LLDrawPoolAvatar::sSkipOpaque) { - if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (isTextureVisible(TEX_HEAD_BAKED) || mIsDummy) { @@ -5197,7 +5120,7 @@ U32 LLVOAvatar::renderTransparent(BOOL first_pass) gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT); } - if (!mIsSelf || gAgent.needsRenderHead() || LLPipeline::sShadowRender) + if (!isSelf() || gAgent.needsRenderHead() || LLPipeline::sShadowRender) { if (LLPipeline::sImpostorRender) { @@ -5237,7 +5160,7 @@ U32 LLVOAvatar::renderRigid() return 0; } - if (mIsSelf && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) + if (isSelf() && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) { return 0; } @@ -5247,14 +5170,7 @@ U32 LLVOAvatar::renderRigid() return 0; } - - - - - const bool should_alpha_mask = mSupportsAlphaLayers && mHasBakedHair - && !LLDrawPoolAlpha::sShowDebugAlpha // Don't alpha mask if "Highlight Transparent" checked - && !LLDrawPoolAvatar::sSkipTransparent; - + const bool should_alpha_mask = shouldAlphaMask(); LLGLState test(GL_ALPHA_TEST, should_alpha_mask); if (should_alpha_mask) @@ -5282,7 +5198,7 @@ U32 LLVOAvatar::renderFootShadows() return 0; } - if (mIsSelf && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) + if (isSelf() && (!gAgent.needsRenderAvatar() || !gAgent.needsRenderHead())) { return 0; } @@ -5369,7 +5285,7 @@ void LLVOAvatar::updateTextures() return; } - if( mIsSelf ) + if( isSelf() ) { render_avatar = TRUE; } @@ -5379,23 +5295,23 @@ void LLVOAvatar::updateTextures() } std::vector layer_baked; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - layer_baked.push_back(isTextureDefined(mBakedTextureData[i].mTextureIndex)); + layer_baked.push_back(isTextureDefined(mBakedTextureDatas[i].mTextureIndex)); // bind the texture so that they'll be decoded slightly // inefficient, we can short-circuit this if we have to if( render_avatar && !gGLManager.mIsDisabled ) { - if (layer_baked[i] && !mBakedTextureData[i].mIsLoaded) + if (layer_baked[i] && !mBakedTextureDatas[i].mIsLoaded) { - gGL.getTexUnit(0)->bind(getTEImage( mBakedTextureData[i].mTextureIndex )); + gGL.getTexUnit(0)->bind(getTEImage( mBakedTextureDatas[i].mTextureIndex )); } } } /* // JAMESDEBUG - if (mIsSelf) + if (isSelf()) { S32 null_count = 0; S32 default_count = 0; @@ -5427,7 +5343,7 @@ void LLVOAvatar::updateTextures() if (imagep) { // Debugging code - maybe non-self avatars are downloading textures? - //llinfos << "avatar self " << mIsSelf << " tex " << index + //llinfos << "avatar self " << isSelf() << " tex " << index // << " decode " << imagep->getDecodePriority() // << " boost " << imagep->getBoostLevel() // << " size " << imagep->getWidth() << "x" << imagep->getHeight() @@ -5437,7 +5353,7 @@ void LLVOAvatar::updateTextures() const LLTextureEntry *te = getTE(index); F32 texel_area_ratio = fabs(te->mScaleS * te->mScaleT); - S32 boost_level = mIsSelf ? LLViewerTexture::BOOST_AVATAR_BAKED_SELF : LLViewerTexture::BOOST_AVATAR_BAKED; + S32 boost_level = isSelf() ? LLViewerTexture::BOOST_AVATAR_BAKED_SELF : LLViewerTexture::BOOST_AVATAR_BAKED; // Spam if this is a baked texture, not set to default image, without valid host info if (isIndexBakedTexture((ETextureIndex)index) @@ -5447,7 +5363,7 @@ void LLVOAvatar::updateTextures() { LL_WARNS_ONCE("Texture") << "LLVOAvatar::updateTextures No host for texture " << imagep->getID() << " for avatar " - << (mIsSelf ? "" : getID().asString()) + << (isSelf() ? "" : getID().asString()) << " on host " << getRegion()->getHost() << llendl; } @@ -5490,12 +5406,12 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerTexture* image { if (!isIndexLocalTexture(idx)) return; - if (!covered_by_baked && render_avatar) // render_avatar is always true if mIsSelf + if (!covered_by_baked && render_avatar) // render_avatar is always true if isSelf() { if (getLocalTextureID(idx) != IMG_DEFAULT_AVATAR) { F32 desired_pixels; - if( mIsSelf ) + if( isSelf() ) { desired_pixels = llmax(mPixelArea, (F32)TEX_IMAGE_AREA_SELF ); imagep->setBoostLevel(LLViewerTexture::BOOST_AVATAR_SELF); @@ -5659,7 +5575,7 @@ void LLVOAvatar::processAnimationStateChanges() if (found_anim == mSignaledAnimations.end()) { - if (mIsSelf) + if (isSelf()) { if ((gSavedSettings.getBOOL("AOEnabled")) && LLFloaterAO::stopMotion(anim_it->first, FALSE)) // if the AO replaced this anim serverside then stop it serverside { @@ -5691,7 +5607,7 @@ void LLVOAvatar::processAnimationStateChanges() // if (processSingleAnimationStateChange(anim_it->first, TRUE)) { - if (mIsSelf && gSavedSettings.getBOOL("AOEnabled")) // AO is only for ME + if (isSelf() && gSavedSettings.getBOOL("AOEnabled")) // AO is only for ME { LLFloaterAO::startMotion(anim_it->first, 0,FALSE); // AO overrides the anim if needed } @@ -5706,7 +5622,7 @@ void LLVOAvatar::processAnimationStateChanges() } // clear source information for animations which have been stopped - if (mIsSelf) + if (isSelf()) { AnimSourceIterator source_it = mAnimationSources.begin(); @@ -5725,80 +5641,6 @@ void LLVOAvatar::processAnimationStateChanges() stop_glerror(); } -//Here's that undeform function I was talking about. -HgB -/* Bug-fixed Linden Labs style. Comment out 4ever. -std::string undeformers[] = -{ - "7a8a3dfc-acd1-7ac3-9cdf-71cd9be89969", - "3feba1c0-971b-f2bb-1b9c-79e81b096c94", - "383ef55f-5e70-02fb-8ef4-1b591b09fd49", - "e2f6bc07-97a5-1f55-6c5f-fbcb02511651", - "1370bf7d-eb29-c1dd-fc3c-cc8e06d57ac0", - "5833be17-3d69-faa0-8f18-58696a326b44", - "7746596d-b88a-216a-2335-06e28167ed31", - "edf75cf0-a2f3-d126-7cdf-5009382ec10b", - "430e8872-1095-4cff-5a39-7c991f32fffb", - "a83bab1b-2ff0-4365-1b6b-6b6e52efc69d", - "7db75c3d-ae67-4312-9734-1510f12a1392", - "551b8c1f-5241-b73e-7ce2-d78fc4ac316f", - "91d73df8-5dfa-e1f2-0a32-77327e56b8dd", - "b2b2fb93-aad5-a7a8-9731-ee8ed72f7acd", - "984eabe8-0953-a93b-f33d-6e21c405cc78", - "f6212696-dc74-b17f-4ea8-f90c37cb032e", - "aa825c4d-aa84-df7d-6ae6-fbf2dcb6f281", - "14ef74d1-93ad-09cb-7a39-fbac3bd80e64" -}; - -void LLVOAvatar::undeform() -{ - if(!mIsSelf) return; - - AnimIterator anim_it; - for (anim_it = mPlayingAnimations.begin(); anim_it != mPlayingAnimations.end();) - { - AnimIterator found_anim = mSignaledAnimations.find(anim_it->first); - - if (found_anim == mSignaledAnimations.end()) - { - if (mIsSelf) - { - if ((gSavedSettings.getBOOL("AOEnabled")) && LLFloaterAO::stopMotion(anim_it->first, FALSE)) // if the AO replaced this anim serverside then stop it serverside - { -// return TRUE; //no local stop needed - } - } - - processSingleAnimationStateChange(anim_it->first, FALSE); - mPlayingAnimations.erase(anim_it++); - continue; - } - ++anim_it; - } - - AnimSourceIterator source_it = mAnimationSources.begin(); - - for (source_it = mAnimationSources.begin(); source_it != mAnimationSources.end();) - { - if (mSignaledAnimations.find(source_it->second) == mSignaledAnimations.end()) - { - mAnimationSources.erase(source_it++); - } - else - { - ++source_it; - } - } - U8 i=0; - for(i; i < 18; ++i) - { - gAgent.sendAnimationRequest( (LLUUID)undeformers[i], ANIM_REQUEST_START ); - startMotion((LLUUID)undeformers[i]); - } - - stop_glerror(); -}*/ - - //----------------------------------------------------------------------------- // processSingleAnimationStateChange(); @@ -5821,7 +5663,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL { // RN: uncomment this to play on typing sound at fixed volume once sound engine is fixed // to support both spatialized and non-spatialized instances of the same sound - //if (mIsSelf) + //if (isSelf()) //{ // gAudiop->triggerSound(LLUUID(gSavedSettings.getString("UISndTyping")), 1.0f, LLAudioEngine::AUDIO_TYPE_UI); //} @@ -5867,7 +5709,7 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL //----------------------------------------------------------------------------- // isAnyAnimationSignaled() //----------------------------------------------------------------------------- -BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) +BOOL LLVOAvatar::isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const { for (S32 i = 0; i < num_anims; i++) { @@ -5971,7 +5813,7 @@ BOOL LLVOAvatar::startMotion(const LLUUID& id, F32 time_offset) LLUUID remap_id = remapMotionID(id); - if (mIsSelf && remap_id == ANIM_AGENT_AWAY) + if (isSelf() && remap_id == ANIM_AGENT_AWAY) { gAgent.setAFK(); } @@ -5987,7 +5829,7 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) LLUUID remap_id = remapMotionID(id); - if (mIsSelf) + if (isSelf()) { gAgent.onAnimStop(remap_id); } @@ -6000,7 +5842,7 @@ BOOL LLVOAvatar::stopMotion(const LLUUID& id, BOOL stop_immediate) //----------------------------------------------------------------------------- void LLVOAvatar::stopMotionFromSource(const LLUUID& source_id) { - if (!mIsSelf) + if (!isSelf()) { return; } @@ -6294,7 +6136,7 @@ LLJoint *LLVOAvatar::getCharacterJoint( U32 num ) void LLVOAvatar::requestStopMotion( LLMotion* motion ) { // Only agent avatars should handle the stop motion notifications. - if ( mIsSelf ) + if ( isSelf() ) { // Notify agent that motion has stopped gAgent.requestStopMotion( motion ); @@ -6402,7 +6244,7 @@ BOOL LLVOAvatar::loadAvatar() const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; if (layer_set->isBodyRegion(baked_dict->mName)) { - mBakedTextureData[baked_iter->first].mTexLayerSet = layer_set; + mBakedTextureDatas[baked_iter->first].mTexLayerSet = layer_set; layer_set->setBakedTexIndex(baked_iter->first); found_baked_entry = true; break; @@ -6762,7 +6604,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) } // We always want to look good to ourselves - if( mIsSelf ) + if( isSelf() ) { mPixelArea = llmax( mPixelArea, F32(TEX_IMAGE_SIZE_SELF / 16) ); } @@ -6780,7 +6622,7 @@ BOOL LLVOAvatar::updateJointLODs() F32 area_scale = 0.16f; { - if (mIsSelf) + if (isSelf()) { if(gAgent.cameraCustomizeAvatar() || gAgent.cameraMouselook()) { @@ -6927,7 +6769,7 @@ void LLVOAvatar::updateShadowFaces() // Render sprite sprite.setNormal(normal); - if (mIsSelf && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (isSelf() && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) { sprite.setColor(0.f, 0.f, 0.f, 0.f); } @@ -6960,7 +6802,7 @@ void LLVOAvatar::updateShadowFaces() // Render sprite sprite.setNormal(normal); - if (mIsSelf && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) + if (isSelf() && gAgent.getCameraMode() == CAMERA_MODE_MOUSELOOK) { sprite.setColor(0.f, 0.f, 0.f, 0.f); } @@ -6985,9 +6827,9 @@ void LLVOAvatar::updateShadowFaces() //----------------------------------------------------------------------------- void LLVOAvatar::updateSexDependentLayerSets( BOOL set_by_user ) { - invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user ); updateMeshTextures(); } @@ -7024,9 +6866,9 @@ void LLVOAvatar::requestLayerSetUpdate(ETextureIndex index ) if (!texture_dict->mIsLocalTexture || !texture_dict->mIsUsedByBakedTexture) return; const EBakedTextureIndex baked_index = texture_dict->mBakedTextureIndex; - if (mBakedTextureData[baked_index].mTexLayerSet) + if (mBakedTextureDatas[baked_index].mTexLayerSet) { - mBakedTextureData[baked_index].mTexLayerSet->requestUpdate(); + mBakedTextureDatas[baked_index].mTexLayerSet->requestUpdate(); } } @@ -7133,7 +6975,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) LLSelectMgr::getInstance()->updatePointAt(); } - if (mIsSelf) + if (isSelf()) { updateAttachmentVisibility(gAgent.getCameraMode()); @@ -7157,7 +6999,7 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object) LLSelectMgr::getInstance()->updatePointAt(); } - if (mIsSelf) + if (isSelf()) { updateAttachmentVisibility(gAgent.getCameraMode()); @@ -7267,7 +7109,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) { // [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0a) | Added: RLVa-1.2.0a // NOTE: RLVa event handlers should be invoked *before* LLVOAvatar::detachObject() calls LLViewerJointAttachment::removeObject() - if ( (rlv_handler_t::isEnabled()) && (mIsSelf) ) + if ( (rlv_handler_t::isEnabled()) && (isSelf()) ) { for (attachment_map_t::const_iterator itAttachPt = mAttachmentPoints.begin(); itAttachPt != mAttachmentPoints.end(); ++itAttachPt) { @@ -7283,7 +7125,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) LLUUID item_id = viewer_object->getAttachmentItemID(); attachment->removeObject(viewer_object); - if (mIsSelf) + if (isSelf()) { // the simulator should automatically handle // permission revocation @@ -7309,7 +7151,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) // [/RLVa:KB] } lldebugs << "Detaching object " << viewer_object->mID << " from " << attachment->getName() << llendl; - if (mIsSelf) + if (isSelf()) { // Then make sure the inventory is in sync with the avatar. gInventory.addChangedMask(LLInventoryObserver::LABEL, item_id); @@ -7343,7 +7185,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) if((*iter).second == item_id) { mUnsupportedAttachmentPoints.erase((*iter).first); - if (mIsSelf) + if (isSelf()) { // the simulator should automatically handle // permission revocation @@ -7383,7 +7225,7 @@ BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) //----------------------------------------------------------------------------- void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) { - if (!mDrawable || mDrawable.isNull() || sit_object->mDrawable.isNull()) + if (mDrawable.isNull() || sit_object->mDrawable.isNull()) { return; } @@ -7405,7 +7247,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) stopMotion(ANIM_AGENT_BODY_NOISE); - if (mIsSelf) + if (isSelf()) { // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c if (rlv_handler_t::isEnabled()) @@ -7435,7 +7277,7 @@ void LLVOAvatar::sitOnObject(LLViewerObject *sit_object) //----------------------------------------------------------------------------- void LLVOAvatar::getOffObject() { - if (!mDrawable || mDrawable.isNull()) + if (mDrawable.isNull()) { return; } @@ -7449,7 +7291,7 @@ void LLVOAvatar::getOffObject() LLViewerObject::const_child_list_t& child_list = sit_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); - iter != child_list.end(); iter++) + iter != child_list.end(); ++iter) { LLViewerObject* child_objectp = *iter; @@ -7477,7 +7319,7 @@ void LLVOAvatar::getOffObject() startMotion(ANIM_AGENT_BODY_NOISE); LLFloaterAO::ChangeStand(); - if (mIsSelf) + if (isSelf()) { // [RLVa:KB] - Checked: 2010-08-29 (RLVa-1.2.1c) | Modified: RLVa-1.2.1c if (rlv_handler_t::isEnabled()) @@ -7709,28 +7551,27 @@ void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerFetchedTexture *src void LLVOAvatar::updateComposites() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if ( mBakedTextureData[i].mTexLayerSet + if ( mBakedTextureDatas[i].mTexLayerSet && ((i != BAKED_SKIRT) || isWearingWearableType( WT_SKIRT )) ) { - mBakedTextureData[i].mTexLayerSet->updateComposite(); + mBakedTextureDatas[i].mTexLayerSet->updateComposite(); } } } -LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) +LLColor4 LLVOAvatar::getGlobalColor( const std::string& color_name ) const { - if( color_name=="skin_color" && mTexSkinColor ) + if (color_name=="skin_color" && mTexSkinColor) { return mTexSkinColor->getColor(); } - else - if( color_name=="hair_color" && mTexHairColor ) + else if(color_name=="hair_color" && mTexHairColor) { return mTexHairColor->getColor(); } - if( color_name=="eye_color" && mTexEyeColor ) + if(color_name=="eye_color" && mTexEyeColor) { return mTexEyeColor->getColor(); } @@ -7786,7 +7627,7 @@ void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user if( set_by_user ) { - llassert( mIsSelf ); + llassert( isSelf() ); ETextureIndex baked_te = getBakedTE( layerset ); setTEImage( baked_te, LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR,0)); @@ -7796,56 +7637,60 @@ void LLVOAvatar::invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user void LLVOAvatar::invalidateAll() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - invalidateComposite(mBakedTextureData[i].mTexLayerSet, TRUE); + invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, TRUE); } updateMeshTextures(); } -void LLVOAvatar::onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user ) +void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user ) { - if( global_color == mTexSkinColor ) + if (global_color == mTexSkinColor) { // llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl; - invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_UPPER].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_LOWER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user ); } - else - if( global_color == mTexHairColor ) + else if (global_color == mTexHairColor) { // llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl; - invalidateComposite( mBakedTextureData[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureData[BAKED_HAIR].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, set_by_user ); // ! BACKWARDS COMPATIBILITY ! // Fix for dealing with avatars from viewers that don't bake hair. - if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) + if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex)) { LLColor4 color = mTexHairColor->getColor(); - for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); } } } - else - if( global_color == mTexEyeColor ) + else if (global_color == mTexEyeColor) { // llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; - invalidateComposite( mBakedTextureData[BAKED_EYES].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet, set_by_user ); } updateMeshTextures(); } +BOOL LLVOAvatar::isVisible() const +{ + return mDrawable.notNull() + && (mDrawable->isVisible() || mIsDummy); +} + void LLVOAvatar::forceBakeAllTextures(bool slam_for_debug) { llinfos << "TAT: forced full rebake. " << llendl; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - ETextureIndex baked_index = mBakedTextureData[i].mTextureIndex; + ETextureIndex baked_index = mBakedTextureDatas[i].mTextureIndex; LLTexLayerSet* layer_set = getLayerSet(baked_index); if (layer_set) { @@ -8003,12 +7848,6 @@ void LLVOAvatar::dumpTotalLocalTextureByteCount() llinfos << "Total Avatar LocTex GL:" << (total_gl_bytes/1024) << "KB" << llendl; } -BOOL LLVOAvatar::isVisible() -{ - return mDrawable && mDrawable.notNull() - && (mDrawable->isVisible() || mIsDummy); -} - // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. @@ -8026,7 +7865,7 @@ BOOL LLVOAvatar::updateIsFullyLoaded() } // - if (mIsSelf) + if (isSelf()) { if (!isTextureDefined(TEX_HAIR)) { @@ -8053,13 +7892,13 @@ BOOL LLVOAvatar::updateIsFullyLoaded() // texture info for our shirt/pants, stay unloaded: if (!mPreviousFullyLoaded) { - if ((!isLocalTextureDataAvailable(mBakedTextureData[BAKED_LOWER].mTexLayerSet)) && + if ((!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet)) && (!isTextureDefined(TEX_LOWER_BAKED))) { loading = TRUE; } - if ((!isLocalTextureDataAvailable(mBakedTextureData[BAKED_UPPER].mTexLayerSet)) && + if ((!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet)) && (!isTextureDefined(TEX_UPPER_BAKED))) { loading = TRUE; @@ -8092,7 +7931,7 @@ BOOL LLVOAvatar::updateIsFullyLoaded() -BOOL LLVOAvatar::isFullyLoaded() +BOOL LLVOAvatar::isFullyLoaded() const { // [SL:KB] - Patch: Appearance-SyncAttach | Checked: 2010-09-22 (Catznip-2.2.0a) | Added: Catznip-2.2.0a // Changes to LLAppearanceMgr::updateAppearanceFromCOF() expect this function to actually return mFullyLoaded for gAgentAvatarp @@ -8138,7 +7977,7 @@ void LLVOAvatar::updateRuthTimer(bool loading) //----------------------------------------------------------------------------- // findMotion() //----------------------------------------------------------------------------- -LLMotion* LLVOAvatar::findMotion(const LLUUID& id) +LLMotion* LLVOAvatar::findMotion(const LLUUID& id) const { return mMotionController.findMotion(id); } @@ -8266,7 +8105,7 @@ LLGLuint LLVOAvatar::getScratchTexName( LLGLenum format, U32* texture_bytes ) //----------------------------------------------------------------------------- void LLVOAvatar::setLocTexTE( U8 te, LLViewerTexture* image, BOOL set_by_user ) { - if( !mIsSelf ) + if( !isSelf() ) { llassert( 0 ); return; @@ -8306,12 +8145,12 @@ void LLVOAvatar::setLocTexTE( U8 te, LLViewerTexture* image, BOOL set_by_user ) void LLVOAvatar::setupComposites() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); - if (mBakedTextureData[i].mTexLayerSet) + bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); + if (mBakedTextureDatas[i].mTexLayerSet) { - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( !layer_baked ); + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( !layer_baked ); } } } @@ -8335,18 +8174,18 @@ void LLVOAvatar::updateMeshTextures() } } - const BOOL self_customizing = mIsSelf && gAgent.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures - const BOOL other_culled = !mIsSelf && mCulled; + const BOOL self_customizing = isSelf() && gAgent.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures + const BOOL other_culled = !isSelf() && mCulled; std::vector is_layer_baked; - is_layer_baked.resize(mBakedTextureData.size(), false); + is_layer_baked.resize(mBakedTextureDatas.size(), false); std::vector use_lkg_baked_layer; // lkg = "last known good" - use_lkg_baked_layer.resize(mBakedTextureData.size(), false); + use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); - for (U32 i=0; i < mBakedTextureData.size(); i++) + for (U32 i=0; i < mBakedTextureDatas.size(); i++) { - is_layer_baked[i] = isTextureDefined(mBakedTextureData[i].mTextureIndex); + is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); if (!other_culled) { @@ -8354,21 +8193,21 @@ void LLVOAvatar::updateMeshTextures() // use the last-known good baked texture until it finish the first // render of the new layerset. use_lkg_baked_layer[i] = (!is_layer_baked[i] - && (mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) - && mBakedTextureData[i].mTexLayerSet - && !mBakedTextureData[i].mTexLayerSet->getComposite()->isInitialized()); + && (mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR) + && mBakedTextureDatas[i].mTexLayerSet + && !mBakedTextureDatas[i].mTexLayerSet->getComposite()->isInitialized()); if (use_lkg_baked_layer[i]) { - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled(TRUE); + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled(TRUE); } } else { use_lkg_baked_layer[i] = (!is_layer_baked[i] - && mBakedTextureData[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); - if (mBakedTextureData[i].mTexLayerSet) + && mBakedTextureDatas[i].mLastTextureIndex != IMG_DEFAULT_AVATAR); + if (mBakedTextureDatas[i].mTexLayerSet) { - mBakedTextureData[i].mTexLayerSet->destroyComposite(); + mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } } @@ -8384,60 +8223,60 @@ void LLVOAvatar::updateMeshTextures() llwarns << "updateMeshTextures: invalid host for object: " << getID() << llendl; } - for (U32 i=0; i < mBakedTextureData.size(); i++) + for (U32 i=0; i < mBakedTextureDatas.size(); i++) { if (use_lkg_baked_layer[i] && !self_customizing ) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureData[i].mLastTextureIndex, target_host ); - mBakedTextureData[i].mIsUsed = TRUE; - for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::getFetchedTextureFromHost( mBakedTextureDatas[i].mLastTextureIndex, target_host ); + mBakedTextureDatas[i].mIsUsed = TRUE; + for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureData[i].mMeshes[k]->setTexture( baked_img ); + mBakedTextureDatas[i].mMeshes[k]->setTexture( baked_img ); } } else if (!self_customizing && is_layer_baked[i]) { - LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getTEImage( mBakedTextureData[i].mTextureIndex ), TRUE) ; - if( baked_img->getID() == mBakedTextureData[i].mLastTextureIndex ) + LLViewerFetchedTexture* baked_img = LLViewerTextureManager::staticCastToFetchedTexture(getTEImage( mBakedTextureDatas[i].mTextureIndex ), TRUE) ; + if( baked_img->getID() == mBakedTextureDatas[i].mLastTextureIndex ) { // Even though the file may not be finished loading, we'll consider it loaded and use it (rather than doing compositing). useBakedTexture( baked_img->getID() ); } else { - mBakedTextureData[i].mIsLoaded = FALSE; - if ((baked_img->getID() != IMG_INVISIBLE) && (i == BAKED_HEAD || i == BAKED_UPPER || i == BAKED_LOWER)) + mBakedTextureDatas[i].mIsLoaded = FALSE; + if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), NULL); } baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), NULL); } } - else if (mBakedTextureData[i].mTexLayerSet + else if (mBakedTextureDatas[i].mTexLayerSet && !other_culled - && (i != BAKED_HAIR || is_layer_baked[i] || mIsSelf)) // ! BACKWARDS COMPATIBILITY ! workaround for old viewers. + && (i != BAKED_HAIR || is_layer_baked[i] || isSelf())) // ! BACKWARDS COMPATIBILITY ! workaround for old viewers. { - mBakedTextureData[i].mTexLayerSet->createComposite(); - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( TRUE ); - mBakedTextureData[i].mIsUsed = FALSE; - for (U32 k=0; k < mBakedTextureData[i].mMeshes.size(); k++) + mBakedTextureDatas[i].mTexLayerSet->createComposite(); + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( TRUE ); + mBakedTextureDatas[i].mIsUsed = FALSE; + for (U32 k=0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureData[i].mMeshes[k]->setLayerSet( mBakedTextureData[i].mTexLayerSet ); + mBakedTextureDatas[i].mMeshes[k]->setLayerSet( mBakedTextureDatas[i].mTexLayerSet ); } } } // ! BACKWARDS COMPATIBILITY ! // Workaround for viewing avatars from old viewers that haven't baked hair textures. - // if (!isTextureDefined(mBakedTextureData[BAKED_HAIR].mTextureIndex)) + // if (!isTextureDefined(mBakedTextureDatas[BAKED_HAIR].mTextureIndex)) if (!is_layer_baked[BAKED_HAIR] || self_customizing) { const LLColor4 color = mTexHairColor ? mTexHairColor->getColor() : LLColor4(1,1,1,1); LLViewerTexture* hair_img = getTEImage( TEX_HAIR ); - for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setTexture( hair_img ); } mHasBakedHair = FALSE; } @@ -8447,21 +8286,21 @@ void LLVOAvatar::updateMeshTextures() } /* // Head - BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureData[BAKED_HEAD].mIsLoaded) || other_culled; + BOOL head_baked_ready = (is_layer_baked[BAKED_HEAD] && mBakedTextureDatas[BAKED_HEAD].mIsLoaded) || other_culled; setLocalTexture( TEX_HEAD_BODYPAINT, getTEImage( TEX_HEAD_BODYPAINT ), head_baked_ready ); */ for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); - baked_iter++) + ++baked_iter) { const EBakedTextureIndex baked_index = baked_iter->first; const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); - local_tex_iter++) + ++local_tex_iter) { const ETextureIndex texture_index = *local_tex_iter; - const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureData[baked_index].mIsLoaded) || other_culled; + const BOOL is_baked_ready = (is_layer_baked[baked_index] && mBakedTextureDatas[baked_index].mIsLoaded) || other_culled; setLocalTexture(texture_index, LLViewerTextureManager::staticCastToFetchedTexture(getTEImage(texture_index)), is_baked_ready ); } } @@ -8475,7 +8314,7 @@ void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerFetchedTexture* t { if (!isIndexLocalTexture(index)) return; - S32 desired_discard = mIsSelf ? 0 : 2; + S32 desired_discard = isSelf() ? 0 : 2; LocalTextureData &local_tex_data = mLocalTextureData[index]; if (!baked_version_ready) { @@ -8491,11 +8330,11 @@ void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerFetchedTexture* t if (tex_discard >= 0 && tex_discard <= desired_discard) { local_tex_data.mDiscard = tex_discard; - if( mIsSelf && !gAgent.cameraCustomizeAvatar() ) + if( isSelf() && !gAgent.cameraCustomizeAvatar() ) { requestLayerSetUpdate( index ); } - else if( mIsSelf && gAgent.cameraCustomizeAvatar() ) + else if( isSelf() && gAgent.cameraCustomizeAvatar() ) { LLVisualParamHint::requestHintUpdates(); } @@ -8517,12 +8356,12 @@ void LLVOAvatar::setLocalTexture( ETextureIndex index, LLViewerFetchedTexture* t //----------------------------------------------------------------------------- void LLVOAvatar::requestLayerSetUploads() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); - if ( !layer_baked && mBakedTextureData[i].mTexLayerSet ) + bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); + if ( !layer_baked && mBakedTextureDatas[i].mTexLayerSet ) { - mBakedTextureData[i].mTexLayerSet->requestUpload(); + mBakedTextureDatas[i].mTexLayerSet->requestUpload(); } } } @@ -8533,11 +8372,11 @@ void LLVOAvatar::requestLayerSetUploads() //----------------------------------------------------------------------------- void LLVOAvatar::setCompositeUpdatesEnabled( BOOL b ) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (mBakedTextureData[i].mTexLayerSet ) + if (mBakedTextureDatas[i].mTexLayerSet ) { - mBakedTextureData[i].mTexLayerSet->setUpdatesEnabled( b ); + mBakedTextureDatas[i].mTexLayerSet->setUpdatesEnabled( b ); } } } @@ -8597,9 +8436,9 @@ S32 LLVOAvatar::getLocalDiscardLevel( ETextureIndex index ) //----------------------------------------------------------------------------- BOOL LLVOAvatar::isLocalTextureDataFinal( const LLTexLayerSet* layerset ) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (layerset == mBakedTextureData[i].mTexLayerSet) + if (layerset == mBakedTextureDatas[i].mTexLayerSet) { const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); @@ -8626,14 +8465,14 @@ BOOL LLVOAvatar::isLocalTextureDataFinal( const LLTexLayerSet* layerset ) //----------------------------------------------------------------------------- BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset ) { - /* if( layerset == mBakedTextureData[BAKED_HEAD].mTexLayerSet ) + /* if( layerset == mBakedTextureDatas[BAKED_HEAD].mTexLayerSet ) return getLocalDiscardLevel( TEX_HEAD_BODYPAINT ) >= 0; */ for (LLVOAvatarDictionary::baked_map_t::const_iterator baked_iter = LLVOAvatarDictionary::getInstance()->getBakedTextures().begin(); baked_iter != LLVOAvatarDictionary::getInstance()->getBakedTextures().end(); baked_iter++) { const EBakedTextureIndex baked_index = baked_iter->first; - if (layerset == mBakedTextureData[baked_index].mTexLayerSet) + if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) { bool ret = true; const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = baked_iter->second; @@ -8657,11 +8496,11 @@ BOOL LLVOAvatar::isLocalTextureDataAvailable( const LLTexLayerSet* layerset ) //----------------------------------------------------------------------------- ETextureIndex LLVOAvatar::getBakedTE( LLTexLayerSet* layerset ) { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if (layerset == mBakedTextureData[i].mTexLayerSet ) + if (layerset == mBakedTextureDatas[i].mTexLayerSet ) { - return mBakedTextureData[i].mTextureIndex; + return mBakedTextureDatas[i].mTextureIndex; } } @@ -8697,7 +8536,7 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) if (text_dict->mIsBakedTexture) { llinfos << "New baked texture: " << text_dict->mName << " UUID: " << uuid <mBakedTextureIndex].mTexLayerSet->requestUpdate(); + //mBakedTextureDatas[text_dict->mBakedTextureIndex].mTexLayerSet->requestUpdate(); } else { @@ -8714,9 +8553,9 @@ void LLVOAvatar::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid ) bool LLVOAvatar::hasPendingBakedUploads() { - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - bool upload_pending = (mBakedTextureData[i].mTexLayerSet && mBakedTextureData[i].mTexLayerSet->getComposite()->uploadPending()); + bool upload_pending = (mBakedTextureDatas[i].mTexLayerSet && mBakedTextureDatas[i].mTexLayerSet->getComposite()->uploadPending()); if (upload_pending) { return true; @@ -8737,11 +8576,11 @@ void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid ) case TEX_HEAD_BAKED: if( mHeadLayerSet ) mHeadLayerSet->cancelUpload(); */ - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - if ( mBakedTextureData[i].mTextureIndex == te && mBakedTextureData[i].mTexLayerSet) + if ( mBakedTextureDatas[i].mTextureIndex == te && mBakedTextureDatas[i].mTexLayerSet) { - mBakedTextureData[i].mTexLayerSet->cancelUpload(); + mBakedTextureDatas[i].mTexLayerSet->cancelUpload(); } } } @@ -8749,10 +8588,14 @@ void LLVOAvatar::setCachedBakedTexture( ETextureIndex te, const LLUUID& uuid ) //----------------------------------------------------------------------------- // releaseUnneccesaryTextures() // release any component texture UUIDs for which we have a baked texture +// ! BACKWARDS COMPATIBILITY ! +// This is only called for non-self avatars, it can be taken out once component +// textures aren't communicated by non-self avatars. //----------------------------------------------------------------------------- void LLVOAvatar::releaseUnnecessaryTextures() { - // Backwards Compat: detect if the baked hair texture actually wasn't sent, and if so set to default + // ! BACKWARDS COMPATIBILITY ! + // Detect if the baked hair texture actually wasn't sent, and if so set to default if (isTextureDefined(TEX_HAIR_BAKED) && getTEImage(TEX_HAIR_BAKED)->getID() == getTEImage(TEX_SKIRT_BAKED)->getID()) { if (getTEImage(TEX_HAIR_BAKED)->getID() != IMG_INVISIBLE) @@ -8826,7 +8669,7 @@ void LLVOAvatar::onChangeSelfInvisible(BOOL newvalue) } } - +//static BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] ) { switch( te ) @@ -8929,15 +8772,15 @@ LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) -void LLVOAvatar::dumpAvatarTEs( const std::string& context ) +void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { /* const char* te_name[] = { "TEX_HEAD_BODYPAINT ", "TEX_UPPER_SHIRT ", */ - llinfos << (mIsSelf ? "Self: " : "Other: ") << context << llendl; + llinfos << (isSelf() ? "Self: " : "Other: ") << context << llendl; for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - iter++) + ++iter) { const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; const LLViewerTexture* te_image = getTEImage(iter->first); @@ -9028,9 +8871,9 @@ void LLVOAvatar::setInvisible(BOOL newvalue) if (newvalue) { setCompositeUpdatesEnabled(FALSE); - for (U32 i = 0; i < mBakedTextureData.size(); i++ ) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) { - setNewBakedTexture(mBakedTextureData[i].mTextureIndex, IMG_INVISIBLE); + setNewBakedTexture(mBakedTextureDatas[i].mTextureIndex, IMG_INVISIBLE); } gAgent.sendAgentSetAppearance(); } @@ -9059,7 +8902,7 @@ EWearableType LLVOAvatar::getTEWearableType(ETextureIndex index ) } // Unlike most wearable functions, this works for both self and other. -BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) +BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) const { if (mIsDummy) return TRUE; @@ -9079,14 +8922,14 @@ BOOL LLVOAvatar::isWearingWearableType( EWearableType type ) indicator_te = TEX_UPPER_SHIRT; */ for (LLVOAvatarDictionary::texture_map_t::const_iterator tex_iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); tex_iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - tex_iter++) + ++tex_iter) { const LLVOAvatarDefines::ETextureIndex index = tex_iter->first; const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = tex_iter->second; if (text_dict->mWearableType == type) { // If you're checking your own clothing, check the component texture - if (mIsSelf) + if (isSelf()) { if (isTextureDefined(index)) { @@ -9149,9 +8992,9 @@ void LLVOAvatar::wearableUpdated(EWearableType type, BOOL upload_result) const EWearableType comp_type = *type_iter; if (comp_type == type) { - if (mBakedTextureData[index].mTexLayerSet) + if (mBakedTextureDatas[index].mTexLayerSet) { - invalidateComposite(mBakedTextureData[index].mTexLayerSet, upload_result); + invalidateComposite(mBakedTextureDatas[index].mTexLayerSet, upload_result); updateMeshTextures(); } break; @@ -9178,11 +9021,11 @@ void LLVOAvatar::clampAttachmentPositions() { return; } - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; + LLViewerJointAttachment* attachment = iter->second; if (attachment) { attachment->clampObjectPosition(); @@ -9192,8 +9035,9 @@ void LLVOAvatar::clampAttachmentPositions() BOOL LLVOAvatar::hasHUDAttachment() const { - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ++iter) + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { LLViewerJointAttachment* attachment = iter->second; if (attachment->getIsHUDAttachment() && attachment->getNumObjects() > 0) @@ -9207,8 +9051,9 @@ BOOL LLVOAvatar::hasHUDAttachment() const LLBBox LLVOAvatar::getHUDBBox() const { LLBBox bbox; - for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ++iter) + for (attachment_map_t::const_iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { LLViewerJointAttachment* attachment = iter->second; if (attachment->getIsHUDAttachment()) @@ -9255,18 +9100,18 @@ void LLVOAvatar::onFirstTEMessageReceived() { mFirstTEMessageReceived = TRUE; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - bool layer_baked = isTextureDefined(mBakedTextureData[i].mTextureIndex); + const bool layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); // Use any baked textures that we have even if they haven't downloaded yet. // (That is, don't do a transition from unbaked to baked.) if (layer_baked) { - LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getTEImage( mBakedTextureData[i].mTextureIndex )); - mBakedTextureData[i].mLastTextureIndex = image->getID(); + LLViewerFetchedTexture* image = LLViewerTextureManager::staticCastToFetchedTexture(getTEImage( mBakedTextureDatas[i].mTextureIndex )); + mBakedTextureDatas[i].mLastTextureIndex = image->getID(); // If we have more than one texture for the other baked layers, we'll want to call this for them too. - if ((image->getID() != IMG_INVISIBLE) && (i == BAKED_HEAD || i == BAKED_UPPER || i == BAKED_LOWER)) + if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) ) { image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), NULL); } @@ -9297,7 +9142,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mFirstAppearanceMessageReceived = TRUE; - if( mIsSelf ) + if( isSelf() ) { llwarns << "Received AvatarAppearance for self" << llendl; if( mFirstTEMessageReceived ) @@ -9314,7 +9159,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) ESex old_sex = getSex(); -// llinfos << "ady LLVOAvatar::processAvatarAppearance()" << llendl; +// llinfos << "LLVOAvatar::processAvatarAppearance()" << llendl; // dumpAvatarTEs( "PRE processAvatarAppearance()" ); unpackTEMessage(mesgsys, _PREHASH_ObjectData); // dumpAvatarTEs( "POST processAvatarAppearance()" ); @@ -9334,19 +9179,19 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) }*/ // prevent the overwriting of valid baked textures with invalid baked textures - for (U8 baked_index = 0; baked_index < mBakedTextureData.size(); baked_index++) + for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) { - if (!isTextureDefined(mBakedTextureData[baked_index].mTextureIndex) - && mBakedTextureData[baked_index].mLastTextureIndex != IMG_DEFAULT + if (!isTextureDefined(mBakedTextureDatas[baked_index].mTextureIndex) + && mBakedTextureDatas[baked_index].mLastTextureIndex != IMG_DEFAULT && baked_index != BAKED_SKIRT) { - setTEImage(mBakedTextureData[baked_index].mTextureIndex, - LLViewerTextureManager::getFetchedTexture(mBakedTextureData[baked_index].mLastTextureIndex, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); + setTEImage(mBakedTextureDatas[baked_index].mTextureIndex, + LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[baked_index].mLastTextureIndex, TRUE, LLViewerTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)); } } - //llinfos << "Received AvatarAppearance: " << (mIsSelf ? "(self): " : "(other): ") << std::endl << + //llinfos << "Received AvatarAppearance: " << (isSelf() ? "(self): " : "(other): ") << std::endl << // (isTextureDefined(TEX_HEAD_BAKED) ? "HEAD " : "head " ) << (getTEImage(TEX_HEAD_BAKED)->getID()) << std::endl << // (isTextureDefined(TEX_UPPER_BAKED) ? "UPPER " : "upper " ) << (getTEImage(TEX_UPPER_BAKED)->getID()) << std::endl << // (isTextureDefined(TEX_LOWER_BAKED) ? "LOWER " : "lower " ) << (getTEImage(TEX_LOWER_BAKED)->getID()) << std::endl << @@ -9363,7 +9208,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) mMeshTexturesDirty = TRUE; gPipeline.markGLRebuild(this); - if (!mIsSelf) + if (!isSelf()) { //releaseUnnecessaryTextures(); Commented out to ensure that users get the right client data -HgB } @@ -9560,14 +9405,14 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR); /* if( id == head_baked->getID() ) - if (self->mBakedTextureData[BAKED_HEAD].mTexLayerSet) + if (self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet) //llinfos << "onBakedTextureMasksLoaded for head " << id << " discard = " << discard_level << llendl; - self->mBakedTextureData[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); + self->mBakedTextureDatas[BAKED_HEAD].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; */ bool found_texture_id = false; for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - iter++) + ++iter) { const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; @@ -9578,16 +9423,16 @@ void LLVOAvatar::onBakedTextureMasksLoaded( BOOL success, LLViewerFetchedTexture if (baked_img && id == baked_img->getID()) { const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - if (self->mBakedTextureData[baked_index].mTexLayerSet) + if (self->mBakedTextureDatas[baked_index].mTexLayerSet) { //llinfos << "onBakedTextureMasksLoaded for " << text_dict->mName << " " << id << " discard = " << discard_level << llendl; - self->mBakedTextureData[baked_index].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); + self->mBakedTextureDatas[baked_index].mTexLayerSet->applyMorphMask(aux_src->getData(), aux_src->getWidth(), aux_src->getHeight(), 1); maskData->mLastDiscardLevel = discard_level; - if (self->mBakedTextureData[baked_index].mMaskTexName) + if (self->mBakedTextureDatas[baked_index].mMaskTexName) { - LLImageGL::deleteTextures(1, &(self->mBakedTextureData[baked_index].mMaskTexName)); + LLImageGL::deleteTextures(1, &(self->mBakedTextureDatas[baked_index].mMaskTexName)); } - self->mBakedTextureData[baked_index].mMaskTexName = gl_name; + self->mBakedTextureDatas[baked_index].mMaskTexName = gl_name; } else { @@ -9667,26 +9512,26 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) mLastHeadBakedID = id; mHeadMesh0.setTexture( head_baked ); mHeadMesh1.setTexture( head_baked ); */ - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - LLViewerTexture* image_baked = getTEImage( mBakedTextureData[i].mTextureIndex ); + LLViewerTexture* image_baked = getTEImage( mBakedTextureDatas[i].mTextureIndex ); if (id == image_baked->getID()) { - mBakedTextureData[i].mIsLoaded = true; - mBakedTextureData[i].mIsUsed = true; - mBakedTextureData[i].mLastTextureIndex = id; - for (U32 k = 0; k < mBakedTextureData[i].mMeshes.size(); k++) + mBakedTextureDatas[i].mIsLoaded = true; + mBakedTextureDatas[i].mLastTextureIndex = id; + mBakedTextureDatas[i].mIsUsed = true; + for (U32 k = 0; k < mBakedTextureDatas[i].mMeshes.size(); k++) { - mBakedTextureData[i].mMeshes[k]->setTexture( image_baked ); + mBakedTextureDatas[i].mMeshes[k]->setTexture( image_baked ); } - if (mBakedTextureData[i].mTexLayerSet) + if (mBakedTextureDatas[i].mTexLayerSet) { - mBakedTextureData[i].mTexLayerSet->destroyComposite(); + mBakedTextureDatas[i].mTexLayerSet->destroyComposite(); } const LLVOAvatarDictionary::BakedDictionaryEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)i); for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); local_tex_iter != baked_dict->mLocalTextures.end(); - local_tex_iter++) + ++local_tex_iter) { setLocalTexture(*local_tex_iter, LLViewerTextureManager::staticCastToFetchedTexture(getTEImage(*local_tex_iter)), TRUE); } @@ -9696,9 +9541,9 @@ void LLVOAvatar::useBakedTexture( const LLUUID& id ) // This is paired with similar code in updateMeshTextures that sets hair mesh color. if (i == BAKED_HAIR) { - for (U32 i = 0; i < mBakedTextureData[BAKED_HAIR].mMeshes.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas[BAKED_HAIR].mMeshes.size(); i++) { - mBakedTextureData[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); + mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( 1.f, 1.f, 1.f, 1.f ); } } } @@ -9758,19 +9603,13 @@ void LLVOAvatar::dumpArchetypeXML( void* ) apr_file_printf( file, "\n\n" ); } - -U32 LLVOAvatar::getVisibilityRank() -{ - return mVisibilityRank; -} - void LLVOAvatar::setVisibilityRank(U32 rank) { - if (!mDrawable || mDrawable.isNull() || mDrawable->isDead()) - { //do nothing + if (mDrawable.isNull() || mDrawable->isDead()) + { + // do nothing return; } - mVisibilityRank = rank; } @@ -9779,15 +9618,14 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() { S32 rank = 1; for (std::vector::iterator iter = LLCharacter::sInstances.begin(); - iter != LLCharacter::sInstances.end(); ++iter) + iter != LLCharacter::sInstances.end(); ++iter) { LLVOAvatar* inst = (LLVOAvatar*) *iter; - if( inst == this ) + if (inst == this) { return rank; } - else - if( !inst->isDead() && !inst->isFullyBaked() ) + else if (!inst->isDead() && !inst->isFullyBaked()) { rank++; } @@ -9799,7 +9637,7 @@ S32 LLVOAvatar::getUnbakedPixelAreaRank() struct CompareScreenAreaGreater { - bool operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) + BOOL operator()(const LLCharacter* const& lhs, const LLCharacter* const& rhs) { return lhs->getPixelArea() > rhs->getPixelArea(); } @@ -9837,7 +9675,7 @@ void LLVOAvatar::cullAvatarsByPixelArea() { inst->setVisibilityRank(0); } - else if (inst->mDrawable && inst->mDrawable.notNull() && inst->mDrawable->isVisible()) + else if (inst->mDrawable.notNull() && inst->mDrawable->isVisible()) { inst->setVisibilityRank(rank++); } @@ -10018,12 +9856,12 @@ void LLVOAvatar::startAppearanceAnimation(BOOL set_by_user, BOOL play_sound) void LLVOAvatar::removeMissingBakedTextures() { - if (!mIsSelf) return; + if (!isSelf()) return; BOOL removed = FALSE; - for (U32 i = 0; i < mBakedTextureData.size(); i++) + for (U32 i = 0; i < mBakedTextureDatas.size(); i++) { - const S32 te = mBakedTextureData[i].mTextureIndex; + const S32 te = mBakedTextureDatas[i].mTextureIndex; if (getTEImage(te)->isMissingAsset()) { setTEImage(te, LLViewerTextureManager::getFetchedTexture(IMG_DEFAULT_AVATAR)); @@ -10033,26 +9871,25 @@ void LLVOAvatar::removeMissingBakedTextures() if (removed) { - for(U32 i = 0; i < mBakedTextureData.size(); i++) + for(U32 i = 0; i < mBakedTextureDatas.size(); i++) { - invalidateComposite(mBakedTextureData[i].mTexLayerSet, FALSE); + invalidateComposite(mBakedTextureDatas[i].mTexLayerSet, FALSE); } updateMeshTextures(); requestLayerSetUploads(); } } - //----------------------------------------------------------------------------- // LLVOAvatarXmlInfo //----------------------------------------------------------------------------- -LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() +LLVOAvatar::LLVOAvatarXmlInfo::LLVOAvatarXmlInfo() : mTexSkinColorInfo(0), mTexHairColorInfo(0), mTexEyeColorInfo(0) { } -LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() +LLVOAvatar::LLVOAvatarXmlInfo::~LLVOAvatarXmlInfo() { std::for_each(mMeshInfoList.begin(), mMeshInfoList.end(), DeletePointer()); std::for_each(mSkeletalDistortionInfoList.begin(), mSkeletalDistortionInfoList.end(), DeletePointer()); @@ -10173,7 +10010,7 @@ BOOL LLVOAvatarSkeletonInfo::parseXml(LLXmlTreeNode* node) //----------------------------------------------------------------------------- // parseXmlSkeletonNode(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) { LLXmlTreeNode* node = root->getChildByName( "skeleton" ); if( !node ) @@ -10279,7 +10116,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlSkeletonNode(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlMeshNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* node = root->getChildByName( "mesh" ); node; @@ -10369,7 +10206,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlMeshNodes(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlColorNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* color_node = root->getChildByName( "global_color" ); color_node; @@ -10431,7 +10268,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlColorNodes(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlLayerNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) { for (LLXmlTreeNode* layer_node = root->getChildByName( "layer_set" ); layer_node; @@ -10455,7 +10292,7 @@ BOOL LLVOAvatarXmlInfo::parseXmlLayerNodes(LLXmlTreeNode* root) //----------------------------------------------------------------------------- // parseXmlDriverNodes(): parses nodes from XML tree //----------------------------------------------------------------------------- -BOOL LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) +BOOL LLVOAvatar::LLVOAvatarXmlInfo::parseXmlDriverNodes(LLXmlTreeNode* root) { LLXmlTreeNode* driver = root->getChildByName( "driver_parameters" ); if( driver ) @@ -10493,7 +10330,7 @@ S32 LLVOAvatar::getAttachmentCount() //virtual void LLVOAvatar::updateRegion(LLViewerRegion *regionp) { - if (mIsSelf) + if (isSelf()) { if (regionp->getHandle() != mLastRegionHandle) { @@ -10541,7 +10378,7 @@ LLTexLayerSet* LLVOAvatar::getLayerSet(ETextureIndex index) const if (text_dict->mIsUsedByBakedTexture) { const EBakedTextureIndex baked_index = text_dict->mBakedTextureIndex; - return mBakedTextureData[baked_index].mTexLayerSet; + return mBakedTextureDatas[baked_index].mTexLayerSet; } return NULL; } @@ -10604,7 +10441,8 @@ BOOL LLVOAvatar::updateLOD() } U32 LLVOAvatar::getPartitionType() const -{ //avatars merely exist as drawables in the bridge partition +{ + // Avatars merely exist as drawables in the bridge partition return LLViewerRegion::PARTITION_BRIDGE; } @@ -10758,7 +10596,7 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const for (LLVOAvatarDictionary::texture_map_t::const_iterator iter = LLVOAvatarDictionary::getInstance()->getTextures().begin(); iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); - iter++) + ++iter) { const ETextureIndex index = iter->first; const LLVOAvatarDictionary::TextureDictionaryEntry *text_dict = iter->second; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index e21337c90..1adb1fef8 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -69,290 +69,515 @@ class LLTexLayerSet; class LLVoiceVisualizer; class LLHUDText; class LLHUDEffectSpiral; - class LLTexGlobalColor; - +class LLTexGlobalColorInfo; +class LLTexLayerSetInfo; +class LLDriverParamInfo; class LLVOAvatarBoneInfo; class LLVOAvatarSkeletonInfo; -class LLVOAvatarXmlInfo; - - -//------------------------------------------------------------------------ +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar -//------------------------------------------------------------------------ +// +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ class LLVOAvatar : public LLViewerObject, public LLCharacter { protected: - virtual ~LLVOAvatar(); + struct LLVOAvatarXmlInfo; + +/******************************************************************************** + ** ** + ** INITIALIZATION + **/ public: LLVOAvatar(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp); /*virtual*/ void markDead(); - void startDefaultMotions(); + static void initClass(); // Initialize data that's only init'd once per class. + static void cleanupClass(); // Cleanup data that's only init'd once per class. +protected: + virtual ~LLVOAvatar(); + BOOL loadSkeletonNode(); + BOOL loadMeshNodes(); - static void updateImpostors(); +/** Initialization + ** ** + *******************************************************************************/ - // - void getClientInfo(std::string& clientTag, LLColor4& tagColor, BOOL useComment=FALSE); - std::string extraMetadata; - // +/******************************************************************************** + ** ** + ** INHERITED + **/ - // EmeraldBoobUtils - bool mSupportsPhysics; //Client supports v2 wearable physics. Disable emerald physics. - //-------------------------------------------------------------------- - // LLViewerObject interface + // LLViewerObject interface and related //-------------------------------------------------------------------- public: virtual void updateGL(); - static void initClass(); // Initialize data that's only init'd once per class. - static void cleanupClass(); // Cleanup data that's only init'd once per class. - static BOOL parseSkeletonFile(const std::string& filename); - virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, - void **user_data, - U32 block_num, - const EObjectUpdateType update_type, - LLDataPacker *dp); + virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, + void **user_data, + U32 block_num, + const EObjectUpdateType update_type, + LLDataPacker *dp); /*virtual*/ BOOL idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); - void idleUpdateVoiceVisualizer(bool voice_enabled); - void idleUpdateMisc(bool detailed_update); + virtual BOOL updateLOD(); + BOOL updateJointLODs(); + /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + /*virtual*/ void updateTextures(); + /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. + /*virtual*/ void onShift(const LLVector3& shift_vector); + virtual U32 getPartitionType() const; + virtual const LLVector3 getRenderPosition() const; + virtual void updateDrawable(BOOL force_damped); + /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); + /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); + /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); + virtual void updateRegion(LLViewerRegion *regionp); + void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax); + void getSpatialExtents(LLVector3& newMin, LLVector3& newMax); + /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, + S32 face = -1, // which face to check, -1 = ALL_SIDES + BOOL pick_transparent = FALSE, + S32* face_hit = NULL, // which face was hit + LLVector3* intersection = NULL, // return the intersection point + LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point + LLVector3* normal = NULL, // return the surface normal at the intersection point + LLVector3* bi_normal = NULL); // return the surface bi-normal at the intersection point + + //-------------------------------------------------------------------- + // LLCharacter interface and related + //-------------------------------------------------------------------- +public: + virtual LLVector3 getCharacterPosition(); + virtual LLQuaternion getCharacterRotation(); + virtual LLVector3 getCharacterVelocity(); + virtual LLVector3 getCharacterAngularVelocity(); + virtual LLJoint* getCharacterJoint(U32 num); + virtual BOOL allocateCharacterJoints(U32 num); + + LLUUID remapMotionID(const LLUUID& id); + virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); + virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); + virtual void stopMotionFromSource(const LLUUID& source_id); + virtual void requestStopMotion(LLMotion* motion); + LLMotion* findMotion(const LLUUID& id) const; + void startDefaultMotions(); + + virtual LLJoint* getJoint(const std::string &name); + virtual LLJoint* getRootJoint() { return &mRoot; } + + virtual const char* getAnimationPrefix() { return "avatar"; } + virtual const LLUUID& getID(); + virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset); + virtual LLJoint* findCollisionVolume(U32 volume_id); + virtual S32 getCollisionVolumeID(std::string &name); + virtual void addDebugText(const std::string& text); + virtual F32 getTimeDilation(); + virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); + virtual F32 getPixelArea() const; + virtual LLPolyMesh* getHeadMesh(); + virtual LLPolyMesh* getUpperBodyMesh(); + virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position); + virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position); + virtual void updateVisualParams(); + + +/** Inherited + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** STATE + **/ + +public: + bool isSelf() const { return mIsSelf; } // True if this avatar is for this viewer's agent + bool isBuilt() const { return mIsBuilt; } +private: + BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients + + //-------------------------------------------------------------------- + // Updates + //-------------------------------------------------------------------- +public: + BOOL updateCharacter(LLAgent &agent); + void idleUpdateVoiceVisualizer(bool voice_enabled); + void idleUpdateMisc(bool detailed_update); void idleUpdateAppearanceAnimation(); - void idleUpdateLipSync(bool voice_enabled); - void idleUpdateLoadingEffect(); - void idleUpdateWindEffect(); - void idleUpdateBoobEffect(); - void idleUpdateNameTag(const LLVector3& root_pos_last); + void idleUpdateLipSync(bool voice_enabled); + void idleUpdateLoadingEffect(); + void idleUpdateWindEffect(); + void idleUpdateNameTag(const LLVector3& root_pos_last); void clearNameTag(); static void invalidateNameTag(const LLUUID& agent_id); // force all name tags to rebuild, useful when display names turned on/off static void invalidateNameTags(); - void idleUpdateRenderCost(); - void idleUpdateTractorBeam(); - void idleUpdateBelowWater(); + void idleUpdateRenderCost(); + void idleUpdateBelowWater(); + void idleUpdateTractorBeam(); //1.23 + void idleUpdateBoobEffect(); //Emerald + + void updateAttachmentVisibility(U32 camera_mode); //Agent only + + LLFrameTimer mIdleTimer; + std::string getIdleTime(); + + //-------------------------------------------------------------------- + // Static preferences (controlled by user settings/menus) + //-------------------------------------------------------------------- +public: + static S32 sRenderName; + static bool sRenderGroupTitles; + static U32 sMaxVisible; //(affected by control "RenderAvatarMaxVisible") + static F32 sRenderDistance; //distance at which avatars will render. + static BOOL sShowAnimationDebug; // show animation debug info + static BOOL sUseImpostors; //use impostors for far away avatars + static BOOL sShowFootPlane; // show foot collision plane reported by server + static BOOL sVisibleInFirstPerson; + static S32 sNumLODChangesThisFrame; + static S32 sNumVisibleChatBubbles; + static BOOL sDebugInvisible; + static BOOL sShowAttachmentPoints; + static F32 sLODFactor; // user-settable LOD factor + static F32 sPhysicsLODFactor; // user-settable physics LOD factor + static BOOL sJointDebug; // output total number of joints being touched for each avatar + static BOOL sDebugAvatarRotation; + + //-------------------------------------------------------------------- + // Region state + //-------------------------------------------------------------------- +public: + LLHost getObjectHost() const; + + //-------------------------------------------------------------------- + // Loading state + //-------------------------------------------------------------------- +public: + BOOL isFullyLoaded() const; + //BOOL isReallyFullyLoaded(); + BOOL updateIsFullyLoaded(); +protected: + bool sendAvatarTexturesRequest(); + void updateRuthTimer(bool loading); +private: + BOOL mFullyLoaded; + BOOL mPreviousFullyLoaded; + BOOL mFullyLoadedInitialized; + S32 mFullyLoadedFrameCounter; + LLFrameTimer mFullyLoadedTimer; + LLFrameTimer mRuthTimer; + +/** State + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** SKELETON + **/ public: - virtual BOOL updateLOD(); - /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + void updateHeadOffset(); + F32 getPelvisToFoot() const { return mPelvisToFoot; } + LLVector3 mHeadOffset; // current head position + LLViewerJoint mRoot; +protected: + static BOOL parseSkeletonFile(const std::string& filename); + void buildCharacter(); + BOOL loadAvatar(); + + BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); + BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); +private: + BOOL mIsBuilt; // state of deferred character building + S32 mNumJoints; + LLViewerJoint* mSkeleton; + + //-------------------------------------------------------------------- + // Pelvis height adjustment members. + //-------------------------------------------------------------------- +public: + LLVector3 mBodySize; + S32 mLastSkeletonSerialNum; +private: + F32 mPelvisToFoot; + + //-------------------------------------------------------------------- + // Cached pointers to well known joints + //-------------------------------------------------------------------- +public: + LLViewerJoint* mPelvisp; + LLViewerJoint* mTorsop; + LLViewerJoint* mChestp; + LLViewerJoint* mNeckp; + LLViewerJoint* mHeadp; + LLViewerJoint* mSkullp; + LLViewerJoint* mEyeLeftp; + LLViewerJoint* mEyeRightp; + LLViewerJoint* mHipLeftp; + LLViewerJoint* mHipRightp; + LLViewerJoint* mKneeLeftp; + LLViewerJoint* mKneeRightp; + LLViewerJoint* mAnkleLeftp; + LLViewerJoint* mAnkleRightp; + LLViewerJoint* mFootLeftp; + LLViewerJoint* mFootRightp; + LLViewerJoint* mWristLeftp; + LLViewerJoint* mWristRightp; + + //-------------------------------------------------------------------- + // XML parse tree + //-------------------------------------------------------------------- +private: + static LLXmlTree sXMLTree; // avatar config file + static LLXmlTree sSkeletonXMLTree; // avatar skeleton file + +/** Skeleton + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** RENDERING + **/ + +public: // Graphical stuff for objects - maybe broken out into render class later? U32 renderFootShadows(); U32 renderImpostor(LLColor4U color = LLColor4U(255,255,255,255)); - U32 renderRigid(); - U32 renderSkinned(EAvatarRenderPass pass); - U32 renderTransparent(BOOL first_pass); - void renderCollisionVolumes(); - - /*virtual*/ BOOL lineSegmentIntersect(const LLVector3& start, const LLVector3& end, - S32 face = -1, // which face to check, -1 = ALL_SIDES - BOOL pick_transparent = FALSE, - S32* face_hit = NULL, // which face was hit - LLVector3* intersection = NULL, // return the intersection point - LLVector2* tex_coord = NULL, // return the texture coordinates of the intersection point - LLVector3* normal = NULL, // return the surface normal at the intersection point - LLVector3* bi_normal = NULL // return the surface bi-normal at the intersection point - ); + U32 renderRigid(); + U32 renderSkinned(EAvatarRenderPass pass); + U32 renderTransparent(BOOL first_pass); + void renderCollisionVolumes(); + static void deleteCachedImages(bool clearAll=true); + static void destroyGL(); + static void restoreGL(); + BOOL mIsDummy; // for special views + S32 mSpecialRenderMode; // special lighting +private: + bool shouldAlphaMask(); - /*virtual*/ void updateTextures(); - // If setting a baked texture, need to request it from a non-local sim. - /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); - /*virtual*/ void onShift(const LLVector3& shift_vector); - virtual U32 getPartitionType() const; - - void updateVisibility(); - void updateAttachmentVisibility(U32 camera_mode); - void clampAttachmentPositions(); - S32 getAttachmentCount(); // Warning: order(N) not order(1) - BOOL canAttachMoreObjects() const; - - // HUD functions - BOOL hasHUDAttachment() const; - LLBBox getHUDBBox() const; - void rebuildHUD(); - - /*virtual*/ LLDrawable* createDrawable(LLPipeline *pipeline); - /*virtual*/ BOOL updateGeometry(LLDrawable *drawable); - - /*virtual*/ void setPixelAreaAndAngle(LLAgent &agent); - BOOL updateJointLODs(); - - virtual void updateRegion(LLViewerRegion *regionp); - - virtual const LLVector3 getRenderPosition() const; - virtual void updateDrawable(BOOL force_damped); - void updateSpatialExtents(LLVector3& newMin, LLVector3 &newMax); - void getSpatialExtents(LLVector3& newMin, LLVector3& newMax); - BOOL isImpostor() const; - BOOL needsImpostorUpdate() const; - const LLVector3& getImpostorOffset() const; - const LLVector2& getImpostorDim() const; - void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const; - void cacheImpostorValues(); - void setImpostorDim(const LLVector2& dim); + BOOL mNeedsSkin; // avatar has been animated and verts have not been updated + S32 mUpdatePeriod; + S32 mNumInitFaces; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer. //-------------------------------------------------------------------- - // LLCharacter interface + // Visibility + //-------------------------------------------------------------------- +protected: + void updateVisibility(); +private: + U32 mVisibilityRank; + BOOL mVisible; + + //-------------------------------------------------------------------- + // Shadowing //-------------------------------------------------------------------- public: - virtual const char *getAnimationPrefix() { return "avatar"; } - virtual LLJoint *getRootJoint() { return &mRoot; } - virtual LLVector3 getCharacterPosition(); - virtual LLQuaternion getCharacterRotation(); - virtual LLVector3 getCharacterVelocity(); - virtual LLVector3 getCharacterAngularVelocity(); - virtual F32 getTimeDilation(); - virtual void getGround(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); - virtual BOOL allocateCharacterJoints( U32 num ); - virtual LLJoint *getCharacterJoint( U32 num ); - virtual void requestStopMotion( LLMotion* motion ); - virtual F32 getPixelArea() const; - virtual LLPolyMesh* getHeadMesh(); - virtual LLPolyMesh* getUpperBodyMesh(); - virtual LLVector3d getPosGlobalFromAgent(const LLVector3 &position); - virtual LLVector3 getPosAgentFromGlobal(const LLVector3d &position); - virtual void updateVisualParams(); - LLUUID remapMotionID(const LLUUID& id); - virtual BOOL startMotion(const LLUUID& id, F32 time_offset = 0.f); - virtual BOOL stopMotion(const LLUUID& id, BOOL stop_immediate = FALSE); - virtual void stopMotionFromSource(const LLUUID& source_id); - virtual LLVector3 getVolumePos(S32 joint_index, LLVector3& volume_offset); - virtual LLJoint* findCollisionVolume(U32 volume_id); - virtual S32 getCollisionVolumeID(std::string &name); - virtual void addDebugText(const std::string& text); - virtual const LLUUID& getID(); - virtual LLJoint *getJoint( const std::string &name ); + void updateShadowFaces(); + LLDrawable* mShadow; +private: + LLFace* mShadow0Facep; + LLFace* mShadow1Facep; + LLPointer mShadowImagep; + + //-------------------------------------------------------------------- + // Impostors + //-------------------------------------------------------------------- +public: + BOOL isImpostor() const; + BOOL needsImpostorUpdate() const; + const LLVector3& getImpostorOffset() const; + const LLVector2& getImpostorDim() const; + void getImpostorValues(LLVector3* extents, LLVector3& angle, F32& distance) const; + void cacheImpostorValues(); + void setImpostorDim(const LLVector2& dim); + static void resetImpostors(); + static void updateImpostors(); + LLRenderTarget mImpostor; + BOOL mNeedsImpostorUpdate; +private: + LLVector3 mImpostorOffset; + LLVector2 mImpostorDim; + BOOL mNeedsAnimUpdate; + LLVector3 mImpostorExtents[2]; + LLVector3 mImpostorAngle; + F32 mImpostorDistance; + F32 mImpostorPixelArea; + LLVector3 mLastAnimExtents[2]; + + //-------------------------------------------------------------------- + // Wind rippling in clothes + //-------------------------------------------------------------------- +public: + LLVector4 mWindVec; + F32 mRipplePhase; + BOOL mBelowWater; +private: + F32 mWindFreq; + LLFrameTimer mRippleTimer; + F32 mRippleTimeLast; + LLVector3 mRippleAccel; + LLVector3 mLastVel; + + //-------------------------------------------------------------------- + // Culling + //-------------------------------------------------------------------- +public: + static void cullAvatarsByPixelArea(); + BOOL isCulled() const { return mCulled; } +private: + BOOL mCulled; + + //-------------------------------------------------------------------- + // Freeze counter + //-------------------------------------------------------------------- +public: + static void updateFreezeCounter(S32 counter = 0); +private: + static S32 sFreezeCounter; + + //-------------------------------------------------------------------- + // Internal functions + //-------------------------------------------------------------------- +protected: + BOOL needsRenderBeam(); +/** Rendering + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** TEXTURES + **/ + + //-------------------------------------------------------------------- + // Loading status + //-------------------------------------------------------------------- +public: + BOOL isTextureDefined(U8 te) const; + BOOL isTextureVisible(U8 te) const; + +protected: + BOOL isFullyBaked(); + static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); + + //-------------------------------------------------------------------- + // Baked textures + //-------------------------------------------------------------------- +public: +protected: + static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + static void onInitialBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); + void removeMissingBakedTextures(); + void useBakedTexture(const LLUUID& id); + + struct BakedTextureData + { + LLUUID mLastTextureIndex; + LLTexLayerSet* mTexLayerSet; // Only exists for self + bool mIsLoaded; + bool mIsUsed; + LLVOAvatarDefines::ETextureIndex mTextureIndex; + U32 mMaskTexName; + // Stores pointers to the joint meshes that this baked texture deals with + std::vector< LLViewerJointMesh * > mMeshes; // std::vector mJoints[i]->mMeshParts + }; + typedef std::vector bakedtexturedata_vec_t; + bakedtexturedata_vec_t mBakedTextureDatas; + //-------------------------------------------------------------------- + // Local Textures + //-------------------------------------------------------------------- +protected: + void setLocalTexture(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* tex, BOOL baked_version_exits); + void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); + //-------------------------------------------------------------------- + // Layers + //-------------------------------------------------------------------- +protected: + void deleteLayerSetCaches(bool clearAll = true); + void addBakedTextureStats(LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level); + + //-------------------------------------------------------------------- + // Composites + //-------------------------------------------------------------------- +public: + void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ); + void invalidateAll(); + + //-------------------------------------------------------------------- + // Static texture/mesh/baked dictionary + //-------------------------------------------------------------------- +public: + static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i); + static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i); +private: + static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; } + static LLVOAvatarDefines::LLVOAvatarDictionary* sAvatarDictionary; + static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo; + static LLVOAvatarXmlInfo* sAvatarXmlInfo; + + //-------------------------------------------------------------------- + // Messaging + //-------------------------------------------------------------------- +public: + void onFirstTEMessageReceived(); +private: + BOOL mFirstTEMessageReceived; + BOOL mFirstAppearanceMessageReceived; + + +//Most this stuff is Agent only + + //-------------------------------------------------------------------- + // Textures and Layers + //-------------------------------------------------------------------- +protected: + void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i); + + + LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; + S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex index); //-------------------------------------------------------------------- // Other public functions //-------------------------------------------------------------------- public: - static void onCustomizeStart(); - static void onCustomizeEnd(); - - - - - LLFrameTimer mIdleTimer; - void undeform(); - - std::string getIdleTime(); - - - static void dumpTotalLocalTextureByteCount(); protected: void getLocalTextureByteCount( S32* gl_byte_count ); -public: - LLMotion* findMotion(const LLUUID& id); - - BOOL isVisible(); - BOOL isSelf() const { return mIsSelf; } - BOOL isCulled() const { return mCulled; } - bool isBuilt() const { return mIsBuilt; } -public: - static void cullAvatarsByPixelArea(); - void setVisibilityRank(U32 rank); - U32 getVisibilityRank(); // unused -protected: - S32 getUnbakedPixelAreaRank(); - public: void dumpLocalTextures(); const LLUUID& grabLocalTexture(LLVOAvatarDefines::ETextureIndex index); BOOL canGrabLocalTexture(LLVOAvatarDefines::ETextureIndex index); - BOOL isTextureDefined(U8 te) const; - BOOL isTextureVisible(U8 te) const; - void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound); void setCompositeUpdatesEnabled(BOOL b); - void addChat(const LLChat& chat); - void clearChat(); - void startTyping() { mTyping = TRUE; mTypingTimer.reset(); mIdleTimer.reset();} - void stopTyping() { mTyping = FALSE; } - void setNameFromChat(const std::string &text) { mNameFromChatOverride = mNameFromChatChanged = true; mNameFromChatText = text; } void clearNameFromChat() { mNameFromChatOverride = false; mNameFromChatChanged = true; mNameFromChatText = ""; } - // Returns "FirstName LastName" - std::string getFullname() const; - - BOOL updateCharacter(LLAgent &agent); - void updateHeadOffset(); - - F32 getPelvisToFoot() const { return mPelvisToFoot; } - public: - BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims); - void processAnimationStateChanges(); -protected: - BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start); - void resetAnimations(); - -public: - void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm); - void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); - void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm); - void slamPosition(); // Slam position to transmitted position (for teleport); - - // morph targets and such - void processAvatarAppearance( LLMessageSystem* mesgsys ); - void onFirstTEMessageReceived(); - void updateSexDependentLayerSets( BOOL set_by_user ); - void hideSkirt(); - - - virtual BOOL setParent(LLViewerObject* parent); - virtual void addChild(LLViewerObject *childp); - virtual void removeChild(LLViewerObject *childp); - -// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i - LLViewerJointAttachment* getTargetAttachmentPoint(const LLViewerObject* viewer_object) const; -// [/RLVa:KB] - BOOL attachObject(LLViewerObject *viewer_object); - BOOL detachObject(LLViewerObject *viewer_object); - void lazyAttach(); - - static BOOL detachAttachmentIntoInventory(const LLUUID& item_id); - - void sitOnObject(LLViewerObject *sit_object); - void getOffObject(); - - BOOL isWearingAttachment( const LLUUID& inv_item_id ); - // testzone attachpt - BOOL isWearingUnsupportedAttachment( const LLUUID& inv_item_id ); - // - LLViewerObject* getWornAttachment( const LLUUID& inv_item_id ); -// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Added: RLVa-1.1.0i - LLViewerJointAttachment* getWornAttachmentPoint(const LLUUID& inv_item_id) const; -// [/RLVa:KB] - const std::string getAttachedPointName(const LLUUID& inv_item_id); - - static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj ); - - void updateMeshTextures(); //-------------------------------------------------------------------- // texture compositing (used only by the LLTexLayer series of classes) //-------------------------------------------------------------------- public: - LLColor4 getGlobalColor( const std::string& color_name ); BOOL isLocalTextureDataAvailable( const LLTexLayerSet* layerset ); BOOL isLocalTextureDataFinal( const LLTexLayerSet* layerset ); LLVOAvatarDefines::ETextureIndex getBakedTE( LLTexLayerSet* layerset ); void updateComposites(); - void onGlobalColorChanged( LLTexGlobalColor* global_color, BOOL set_by_user ); //BOOL getLocalTextureRaw( LLVOAvatarDefines::ETextureIndex index, LLImageRaw* image_raw_pp ); BOOL getLocalTextureGL( LLVOAvatarDefines::ETextureIndex index, LLViewerTexture** image_gl_pp ); const LLUUID& getLocalTextureID( LLVOAvatarDefines::ETextureIndex index ); LLGLuint getScratchTexName( LLGLenum format, U32* texture_bytes ); BOOL bindScratchTexture( LLGLenum format ); - void invalidateComposite( LLTexLayerSet* layerset, BOOL set_by_user ); - void invalidateAll(); void forceBakeAllTextures(bool slam_for_debug = false); static void processRebakeAvatarTextures(LLMessageSystem* msg, void**); void setNewBakedTexture( LLVOAvatarDefines::ETextureIndex i, const LLUUID& uuid ); @@ -361,30 +586,11 @@ public: void requestLayerSetUploads(); bool hasPendingBakedUploads(); static void onLocalTextureLoaded( BOOL succcess, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static void dumpArchetypeXML( void* ); - static void dumpScratchTextureByteCount(); - static void dumpBakedStatus(); - static void deleteCachedImages(bool clearAll=true); - static void destroyGL(); - static void restoreGL(); - static void resetImpostors(); static enum EWearableType getTEWearableType(LLVOAvatarDefines::ETextureIndex te ); static LLUUID getDefaultTEImageID(LLVOAvatarDefines::ETextureIndex te ); static void onChangeSelfInvisible(BOOL newvalue); void setInvisible(BOOL newvalue); - static LLColor4 getDummyColor(); - - - //-------------------------------------------------------------------- - // Clothing colors (conventience functions to access visual parameters - //-------------------------------------------------------------------- -public: - void setClothesColor( LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user ); - LLColor4 getClothesColor( LLVOAvatarDefines::ETextureIndex te ); - BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] ); - - BOOL isWearingWearableType( EWearableType type ); void wearableUpdated(EWearableType type, BOOL upload_result = TRUE); //-------------------------------------------------------------------- @@ -398,175 +604,272 @@ public: typedef std::map mesh_info_t; static void getMeshInfo (mesh_info_t* mesh_info); + +/** Textures + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** MESHES + **/ - //-------------------------------------------------------------------- - // Handling partially loaded avatars (Ruth) - //-------------------------------------------------------------------- public: - BOOL isFullyLoaded(); - //BOOL isReallyFullyLoaded(); - BOOL updateIsFullyLoaded(); + void updateMeshTextures(); + void updateSexDependentLayerSets(BOOL set_by_user); + void dirtyMesh(); // Dirty the avatar mesh + void updateMeshData(); protected: - bool sendAvatarTexturesRequest(); - void updateRuthTimer(bool loading); + void releaseMeshData(); + void restoreMeshData(); private: - BOOL mFullyLoaded; - BOOL mPreviousFullyLoaded; - BOOL mFullyLoadedInitialized; - S32 mFullyLoadedFrameCounter; - LLFrameTimer mFullyLoadedTimer; - LLFrameTimer mRuthTimer; + void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority + S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD + BOOL mMeshTexturesDirty; + + typedef std::multimap polymesh_map_t; + polymesh_map_t mMeshes; + std::vector mMeshLOD; //-------------------------------------------------------------------- - // Collision Volumes + // Destroy invisible mesh //-------------------------------------------------------------------- -public: - S32 mNumCollisionVolumes; - LLViewerJointCollisionVolume* mCollisionVolumes; +protected: + BOOL mMeshValid; + LLFrameTimer mMeshInvisibleTime; - //-------------------------------------------------------------------- - // cached pointers to well known joints - //-------------------------------------------------------------------- -public: - LLViewerJoint* mPelvisp; - LLViewerJoint* mTorsop; - LLViewerJoint* mChestp; - LLViewerJoint* mNeckp; - LLViewerJoint* mHeadp; - LLViewerJoint* mSkullp; - LLViewerJoint* mEyeLeftp; - LLViewerJoint* mEyeRightp; - LLViewerJoint* mHipLeftp; - LLViewerJoint* mHipRightp; - LLViewerJoint* mKneeLeftp; - LLViewerJoint* mKneeRightp; - LLViewerJoint* mAnkleLeftp; - LLViewerJoint* mAnkleRightp; - LLViewerJoint* mFootLeftp; - LLViewerJoint* mFootRightp; - LLViewerJoint* mWristLeftp; - LLViewerJoint* mWristRightp; +/** Meshes + ** ** + *******************************************************************************/ +/******************************************************************************** + ** ** + ** APPEARANCE + **/ + +public: + void processAvatarAppearance(LLMessageSystem* mesgsys); + void hideSkirt(); + void startAppearanceAnimation(BOOL set_by_user, BOOL play_sound); + //-------------------------------------------------------------------- - // impostor state + // Appearance morphing //-------------------------------------------------------------------- public: - LLRenderTarget mImpostor; - BOOL mNeedsImpostorUpdate; + BOOL getIsAppearanceAnimating() const { return mAppearanceAnimating; } private: - LLVector3 mImpostorOffset; - LLVector2 mImpostorDim; - BOOL mNeedsAnimUpdate; - LLVector3 mImpostorExtents[2]; - LLVector3 mImpostorAngle; - F32 mImpostorDistance; - F32 mImpostorPixelArea; - LLVector3 mLastAnimExtents[2]; + BOOL mAppearanceAnimating; + LLFrameTimer mAppearanceMorphTimer; + F32 mLastAppearanceBlendTime; + BOOL mAppearanceAnimSetByUser; //1.23 //-------------------------------------------------------------------- - // Misc Render State + // Clothing colors (convenience functions to access visual parameters) //-------------------------------------------------------------------- public: - BOOL mIsDummy; // For special views - S32 mSpecialRenderMode; // Special lighting + void setClothesColor( LLVOAvatarDefines::ETextureIndex te, const LLColor4& new_color, BOOL set_by_user ); + LLColor4 getClothesColor(LLVOAvatarDefines::ETextureIndex te); + static BOOL teToColorParams( LLVOAvatarDefines::ETextureIndex te, const char* param_name[3] ); //-------------------------------------------------------------------- - // animation state data + // Global colors + //-------------------------------------------------------------------- +public: + LLColor4 getGlobalColor(const std::string& color_name ) const; + void onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user ); +private: + LLTexGlobalColor* mTexSkinColor; + LLTexGlobalColor* mTexHairColor; + LLTexGlobalColor* mTexEyeColor; + + //-------------------------------------------------------------------- + // Visibility + //-------------------------------------------------------------------- +public: + BOOL isVisible() const; + void setVisibilityRank(U32 rank); + U32 getVisibilityRank() const { return mVisibilityRank; } // unused + static S32 sNumVisibleAvatars; // Number of instances of this class + static LLColor4 getDummyColor(); + + //-------------------------------------------------------------------- + // Customize + //-------------------------------------------------------------------- +public: + static void onCustomizeStart(); + static void onCustomizeEnd(); +/** Appearance + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** WEARABLES + **/ + +public: + BOOL isWearingWearableType( EWearableType type ) const; + + //-------------------------------------------------------------------- + // Attachments + //-------------------------------------------------------------------- +public: + void clampAttachmentPositions(); + BOOL attachObject(LLViewerObject *viewer_object); + BOOL detachObject(LLViewerObject *viewer_object); + static LLVOAvatar* findAvatarFromAttachment( LLViewerObject* obj ); +protected: +// [RLVa:KB] - Checked: 2009-12-18 (RLVa-1.1.0i) | Added: RLVa-1.1.0i + LLViewerJointAttachment* getTargetAttachmentPoint(const LLViewerObject* viewer_object) const; +// [/RLVa:KB] + void lazyAttach(); + + //-------------------------------------------------------------------- + // Map of attachment points, by ID + //-------------------------------------------------------------------- +public: + S32 getAttachmentCount(); // Warning: order(N) not order(1) // currently used only by -self + typedef std::map attachment_map_t; + attachment_map_t mAttachmentPoints; + std::vector > mPendingAttachment; + //-------------------------------------------------------------------- + // HUD functions + //-------------------------------------------------------------------- +public: + BOOL hasHUDAttachment() const; + LLBBox getHUDBBox() const; + void rebuildHUD(); + void resetHUDAttachments(); + BOOL canAttachMoreObjects() const; +protected: + U32 getNumAttachments() const; // O(N), not O(1) + + //-------------------------------------------------------------------- + // Old/nonstandard/Agent-only functions + //-------------------------------------------------------------------- +public: + static BOOL detachAttachmentIntoInventory(const LLUUID& item_id); + BOOL isWearingAttachment( const LLUUID& inv_item_id ); + // testzone attachpt + BOOL isWearingUnsupportedAttachment( const LLUUID& inv_item_id ); + // + LLViewerObject* getWornAttachment( const LLUUID& inv_item_id ); +// [RLVa:KB] - Checked: 2010-03-14 (RLVa-1.2.0a) | Added: RLVa-1.1.0i + LLViewerJointAttachment* getWornAttachmentPoint(const LLUUID& inv_item_id) const; +// [/RLVa:KB] + const std::string getAttachedPointName(const LLUUID& inv_item_id); + + // + std::map mUnsupportedAttachmentPoints; + // + +/** Wearables + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** ACTIONS + **/ + + //-------------------------------------------------------------------- + // Animations + //-------------------------------------------------------------------- +public: + BOOL isAnyAnimationSignaled(const LLUUID *anim_array, const S32 num_anims) const; + void processAnimationStateChanges(); +protected: + BOOL processSingleAnimationStateChange(const LLUUID &anim_id, BOOL start); + void resetAnimations(); +private: + LLTimer mAnimTimer; + F32 mTimeLast; + + //-------------------------------------------------------------------- + // Animation state data //-------------------------------------------------------------------- public: typedef std::map::iterator AnimIterator; + std::map mSignaledAnimations; // requested state of Animation name/value + std::map mPlayingAnimations; // current state of Animation name/value - std::map mSignaledAnimations; // requested state of Animation name/value - std::map mPlayingAnimations; // current state of Animation name/value - - typedef std::multimap AnimationSourceMap; - typedef AnimationSourceMap::iterator AnimSourceIterator; - AnimationSourceMap mAnimationSources; // object ids that triggered anim ids + typedef std::multimap AnimationSourceMap; + typedef AnimationSourceMap::iterator AnimSourceIterator; + AnimationSourceMap mAnimationSources; // object ids that triggered anim ids //-------------------------------------------------------------------- - // Shadowing + // Chat //-------------------------------------------------------------------- public: - void updateShadowFaces(); - LLDrawable* mShadow; + void addChat(const LLChat& chat); + void clearChat(); + void startTyping() { mTyping = TRUE; mTypingTimer.reset(); mIdleTimer.reset();} + void stopTyping() { mTyping = FALSE; } private: - LLFace* mShadow0Facep; - LLFace* mShadow1Facep; - LLPointer mShadowImagep; + BOOL mVisibleChat; //-------------------------------------------------------------------- - // Keeps track of foot step state for generating sounds + // Lip synch morphs + //-------------------------------------------------------------------- +private: + bool mLipSyncActive; // we're morphing for lip sync + LLVisualParam* mOohMorph; // cached pointers morphs for lip sync + LLVisualParam* mAahMorph; // cached pointers morphs for lip sync + + //-------------------------------------------------------------------- + // Flight //-------------------------------------------------------------------- public: - void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; } - LLVector4 mFootPlane; + BOOL mInAir; + LLFrameTimer mTimeInAir; + +/** Actions + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** PHYSICS + **/ + private: - BOOL mWasOnGroundLeft; - BOOL mWasOnGroundRight; + F32 mSpeedAccum; // measures speed (for diagnostics mostly). + BOOL mTurning; // controls hysteresis on avatar rotation + F32 mSpeed; // misc. animation repeated state //-------------------------------------------------------------------- - // Pelvis height adjustment members. + // Collision volumes //-------------------------------------------------------------------- public: - LLVector3 mBodySize; - S32 mLastSkeletonSerialNum; -private: - F32 mPelvisToFoot; + S32 mNumCollisionVolumes; + LLViewerJointCollisionVolume* mCollisionVolumes; +protected: + BOOL allocateCollisionVolumes(U32 num); //-------------------------------------------------------------------- - // Display the name, then optionally fade it out + // Dimensions //-------------------------------------------------------------------- public: - LLFrameTimer mChatTimer; - LLPointer mNameText; -private: - LLFrameTimer mTimeVisible; - std::deque mChats; - BOOL mTyping; - LLFrameTimer mTypingTimer; - static void on_avatar_name_response(const LLUUID& agent_id, const LLAvatarName& av_name, void *userdata); + void resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos, LLVector3 &outNorm); + void resolveHeightAgent(const LLVector3 &inPos, LLVector3 &outPos, LLVector3 &outNorm); + void resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm); + void slamPosition(); // Slam position to transmitted position (for teleport); +protected: + void computeBodySize(); //-------------------------------------------------------------------- - // wind rippling in clothes + // Material being stepped on + //-------------------------------------------------------------------- +private: + BOOL mStepOnLand; + U8 mStepMaterial; + LLVector3 mStepObjectVelocity; + + //-------------------------------------------------------------------- + // Emerald legacy boob bounce //-------------------------------------------------------------------- public: - LLVector4 mWindVec; - F32 mRipplePhase; - BOOL mBelowWater; -private: - F32 mWindFreq; - LLFrameTimer mRippleTimer; - F32 mRippleTimeLast; - LLVector3 mRippleAccel; - LLVector3 mLastVel; - - //-------------------------------------------------------------------- - // appearance morphing - //-------------------------------------------------------------------- -public: - BOOL mAppearanceAnimating; -private: - LLFrameTimer mAppearanceMorphTimer; - BOOL mAppearanceAnimSetByUser; - F32 mLastAppearanceBlendTime; - - //-------------------------------------------------------------------- - // boob bounce stuff - //-------------------------------------------------------------------- - -private: - bool mFirstSetActualBoobGravRan; - //bool mFirstSetActualButtGravRan; - //bool mFirstSetActualFatGravRan; - LLFrameTimer mBoobBounceTimer; - EmeraldAvatarLocalBoobConfig mLocalBoobConfig; - EmeraldBoobState mBoobState; - //EmeraldBoobState mButtState; - //EmeraldBoobState mFatState; - -public: - //boob - F32 getActualBoobGrav() { return mLocalBoobConfig.actualBoobGrav; } + F32 getActualBoobGrav() const { return mLocalBoobConfig.actualBoobGrav; } void setActualBoobGrav(F32 grav) { mLocalBoobConfig.actualBoobGrav = grav; @@ -576,245 +879,274 @@ public: mFirstSetActualBoobGravRan = true; } } - - //butt - /*F32 getActualButtGrav() { return mLocalBoobConfig.actualButtGrav; } - void setActualButtGrav(F32 grav) - { - mLocalBoobConfig.actualButtGrav = grav; - if(!mFirstSetActualButtGravRan) - { - mButtState.boobGrav = grav; - mFirstSetActualButtGravRan = true; - } - } - //fat - F32 getActualFatGrav() { return mLocalBoobConfig.actualFatGrav; } - void setActualFatGrav(F32 grav) - { - mLocalBoobConfig.actualFatGrav = grav; - if(!mFirstSetActualFatGravRan) - { - mFatState.boobGrav = grav; - mFirstSetActualFatGravRan = true; - } - } - */ static EmeraldGlobalBoobConfig sBoobConfig; - - //-------------------------------------------------------------------- - // Attachments - //-------------------------------------------------------------------- -public: - // map of attachment points, by ID - typedef std::map attachment_map_t; - attachment_map_t mAttachmentPoints; - std::vector > mPendingAttachment; - // - std::map mUnsupportedAttachmentPoints; - // -protected: - U32 getNumAttachments() const; // O(N), not O(1) - - //-------------------------------------------------------------------- - // static preferences that are controlled by user settings/menus - //-------------------------------------------------------------------- -public: - static S32 sRenderName; - static BOOL sRenderGroupTitles; - static S32 sMaxVisible; - static F32 sRenderDistance; //distance at which avatars will render (affected by control "RenderAvatarMaxVisible") - static BOOL sShowAnimationDebug; // show animation debug info - static BOOL sUseImpostors; //use impostors for far away avatars - static BOOL sShowFootPlane; // show foot collision plane reported by server - static BOOL sVisibleInFirstPerson; - static S32 sNumLODChangesThisFrame; - static S32 sNumVisibleChatBubbles; - static BOOL sDebugInvisible; - static BOOL sShowAttachmentPoints; - static F32 sLODFactor; // user-settable LOD factor - static F32 sPhysicsLODFactor; // user-settable physics LOD factor - static BOOL sJointDebug; // output total number of joints being touched for each avatar - static BOOL sDebugAvatarRotation; - static F32 sAvMorphTime; - - static S32 sNumVisibleAvatars; // Number of instances of this class +private: + bool mFirstSetActualBoobGravRan; + LLFrameTimer mBoobBounceTimer; + EmeraldAvatarLocalBoobConfig mLocalBoobConfig; + EmeraldBoobState mBoobState; +public: + bool mSupportsPhysics; //Client supports v2 wearable physics. Disable emerald physics. + +/** Physics + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** HIERARCHY + **/ + +public: + virtual BOOL setParent(LLViewerObject* parent); + virtual void addChild(LLViewerObject *childp); + virtual void removeChild(LLViewerObject *childp); + //-------------------------------------------------------------------- - // Miscellaneous public variables. + // Sitting //-------------------------------------------------------------------- public: - BOOL mInAir; - LLFrameTimer mTimeInAir; - LLVector3 mHeadOffset; // current head position - LLViewerJoint mRoot; // avatar skeleton - BOOL mIsSitting; // sitting state + BOOL isSitting() const {return mIsSitting;} + void sitOnObject(LLViewerObject *sit_object); + void getOffObject(); +private: + // set this property only with LLVOAvatar::sitDown method + BOOL mIsSitting; - static bool updateClientTags(); - static bool loadClientTags(); +/** Hierarchy + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** NAME + **/ + +public: + std::string getFullname() const; // Returns "FirstName LastName" +protected: + static void getAnimLabels(LLDynamicArray* labels); + static void getAnimNames(LLDynamicArray* names); +private: + LLWString mNameString; + std::string mSubNameString; + std::string mTitle; + bool mNameAway; + bool mNameBusy; + bool mNameMute; + bool mNameAppearance; + bool mRenderTag; + bool mRenderGroupTitles; + std::string mRenderedName; + std::string mClientName; + S32 mUsedNameSystem; + + //-------------------------------------------------------------------- + // Display the name (then optionally fade it out) + //-------------------------------------------------------------------- +public: + LLFrameTimer mChatTimer; + LLPointer mNameText; +private: +private: + LLFrameTimer mTimeVisible; + std::deque mChats; + BOOL mTyping; + LLFrameTimer mTypingTimer; + static void on_avatar_name_response(const LLUUID& agent_id, const LLAvatarName& av_name, void *userdata); + + //-------------------------------------------------------------------- + // Client tagging + //-------------------------------------------------------------------- +public: + // + void getClientInfo(std::string& clientTag, LLColor4& tagColor, BOOL useComment=FALSE); + std::string extraMetadata; + // + + static bool updateClientTags(); + static bool loadClientTags(); std::string mClientTag; //Zwagoth's new client identification system. -HgB LLColor4 mClientColor; //Zwagoth's new client identification system. -HgB - //-------------------------------------------------------------------- - // Private member variables. - //-------------------------------------------------------------------- -private: - BOOL mIsSelf; // True if this avatar is for this viewer's agent - - LLViewerJoint *mScreenp; // special purpose joint for HUD attachments - BOOL mIsBuilt; // state of deferred character building - F32 mSpeedAccum; // measures speed (for diagnostics mostly). - - BOOL mSupportsAlphaLayers; // For backwards compatibility, TRUE for 1.23+ clients - - // LLFrameTimer mUpdateLODTimer; // controls frequency of LOD change calculations - BOOL mTurning; // controls hysteresis on avatar rotation - F32 mSpeed; // misc. animation repeated state - - // Keep track of the material being stepped on - BOOL mStepOnLand; - U8 mStepMaterial; - LLVector3 mStepObjectVelocity; - - // Destroy mesh data after being invisible for a while - BOOL mMeshValid; - BOOL mVisible; - LLFrameTimer mMeshInvisibleTime; - - // Lip synch morph stuff - bool mLipSyncActive; // we're morphing for lip sync - LLVisualParam* mOohMorph; // cached pointers morphs for lip sync - LLVisualParam* mAahMorph; // cached pointers morphs for lip sync - - // Skeleton for skinned avatar - S32 mNumJoints; - LLViewerJoint* mSkeleton; - - // Scratch textures used for compositing - static LLMap< LLGLenum, LLGLuint*> sScratchTexNames; - static LLMap< LLGLenum, F32*> sScratchTexLastBindTime; - static S32 sScratchTexBytes; - - // Global table of sound ids per material, and the ground - const static LLUUID sStepSounds[LL_MCODE_END]; - const static LLUUID sStepSoundOnLand; - - // Xml parse tree of avatar config file - static LLXmlTree sXMLTree; - // Xml parse tree of avatar skeleton file - static LLXmlTree sSkeletonXMLTree; - - // Voice Visualizer is responsible for detecting the user's voice signal, and when the - // user speaks, it puts a voice symbol over the avatar's head, and triggering gesticulations - LLVoiceVisualizer* mVoiceVisualizer; - int mCurrentGesticulationLevel; - - // Animation timer - LLTimer mAnimTimer; - F32 mTimeLast; - - static LLSD sClientResolutionList; - - bool isUnknownClient(); - static void resolveClient(LLColor4& avatar_name_color, std::string& client, LLVOAvatar* avatar); - friend class LLFloaterAvatarList; - bool mNameFromChatOverride; bool mNameFromChatChanged; std::string mNameFromChatText; std::string mNameFromAttachment; - LLPointer mBeam; - LLFrameTimer mBeamTimer; +/** Name + ** ** + *******************************************************************************/ - F32 mAdjustedPixelArea; +/******************************************************************************** + ** ** + ** SOUNDS + **/ - LLWString mNameString; - std::string mSubNameString; - std::string mTitle; - BOOL mNameAway; - BOOL mNameBusy; - BOOL mNameMute; - BOOL mNameAppearance; - BOOL mRenderTag; - BOOL mVisibleChat; - BOOL mRenderGroupTitles; - std::string mRenderedName; - std::string mClientName; - S32 mUsedNameSystem; + //-------------------------------------------------------------------- + // Voice visualizer + //-------------------------------------------------------------------- +public: + // Responsible for detecting the user's voice signal (and when the + // user speaks, it puts a voice symbol over the avatar's head) and gesticulations + LLPointer mVoiceVisualizer; + int mCurrentGesticulationLevel; - std::string mDebugText; - U64 mLastRegionHandle; - LLFrameTimer mRegionCrossingTimer; - S32 mRegionCrossingCount; + //-------------------------------------------------------------------- + // Step sound + //-------------------------------------------------------------------- +protected: + const LLUUID& getStepSound() const; +private: + // Global table of sound ids per material, and the ground + const static LLUUID sStepSounds[LL_MCODE_END]; + const static LLUUID sStepSoundOnLand; + + //-------------------------------------------------------------------- + // Foot step state (for generating sounds) + //-------------------------------------------------------------------- +public: + void setFootPlane(const LLVector4 &plane) { mFootPlane = plane; } + LLVector4 mFootPlane; +private: + BOOL mWasOnGroundLeft; + BOOL mWasOnGroundRight; + +/** Sounds + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** DIAGNOSTICS + **/ //-------------------------------------------------------------------- - // local textures for compositing. + // General //-------------------------------------------------------------------- +public: + static void dumpArchetypeXML(void*); + static void dumpScratchTextureByteCount(); //Agent only + static void dumpBakedStatus(); + const std::string getBakedStatusForPrintout() const; + void dumpAvatarTEs(const std::string& context) const; + + static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars + static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) + static F32 sGreyTime; // Total seconds with >=1 grey avatars + static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) +protected: + S32 getUnbakedPixelAreaRank(); + BOOL mHasGrey; private: LLUUID mSavedTE[ LLVOAvatarDefines::TEX_NUM_INDICES ]; - BOOL mFirstTEMessageReceived; - BOOL mFirstAppearanceMessageReceived; BOOL mHasBakedHair; + F32 mMinPixelArea; + F32 mMaxPixelArea; + F32 mAdjustedPixelArea; + std::string mDebugText; - BOOL mCulled; - U32 mVisibilityRank; - F32 mMinPixelArea; // debug - F32 mMaxPixelArea; // debug - BOOL mHasGrey; // debug +/** Diagnostics + ** ** + *******************************************************************************/ + +/******************************************************************************** + ** ** + ** SUPPORT CLASSES + **/ + +protected: // Shared with LLVOAvatarSelf + + struct LLVOAvatarXmlInfo + { + LLVOAvatarXmlInfo(); + ~LLVOAvatarXmlInfo(); + + BOOL parseXmlSkeletonNode(LLXmlTreeNode* root); + BOOL parseXmlMeshNodes(LLXmlTreeNode* root); + BOOL parseXmlColorNodes(LLXmlTreeNode* root); + BOOL parseXmlLayerNodes(LLXmlTreeNode* root); + BOOL parseXmlDriverNodes(LLXmlTreeNode* root); + + struct LLVOAvatarMeshInfo + { + typedef std::pair morph_info_pair_t; + typedef std::vector morph_info_list_t; + + LLVOAvatarMeshInfo() : mLOD(0), mMinPixelArea(.1f) {} + ~LLVOAvatarMeshInfo() + { + morph_info_list_t::iterator iter; + for (iter = mPolyMorphTargetInfoList.begin(); iter != mPolyMorphTargetInfoList.end(); iter++) + { + delete iter->first; + } + mPolyMorphTargetInfoList.clear(); + } + + std::string mType; + S32 mLOD; + std::string mMeshFileName; + std::string mReferenceMeshName; + F32 mMinPixelArea; + morph_info_list_t mPolyMorphTargetInfoList; + }; + typedef std::vector mesh_info_list_t; + mesh_info_list_t mMeshInfoList; + + typedef std::vector skeletal_distortion_info_list_t; + skeletal_distortion_info_list_t mSkeletalDistortionInfoList; - //-------------------------------------------------------------------- - // Global Colors - //-------------------------------------------------------------------- -private: - LLTexGlobalColor* mTexSkinColor; - LLTexGlobalColor* mTexHairColor; - LLTexGlobalColor* mTexEyeColor; + struct LLVOAvatarAttachmentInfo + { + LLVOAvatarAttachmentInfo() + : mGroup(-1), mAttachmentID(-1), mPieMenuSlice(-1), mVisibleFirstPerson(FALSE), + mIsHUDAttachment(FALSE), mHasPosition(FALSE), mHasRotation(FALSE) {} + std::string mName; + std::string mJointName; + LLVector3 mPosition; + LLVector3 mRotationEuler; + S32 mGroup; + S32 mAttachmentID; + S32 mPieMenuSlice; + BOOL mVisibleFirstPerson; + BOOL mIsHUDAttachment; + BOOL mHasPosition; + BOOL mHasRotation; + }; + typedef std::vector attachment_info_list_t; + attachment_info_list_t mAttachmentInfoList; + + LLTexGlobalColorInfo *mTexSkinColorInfo; + LLTexGlobalColorInfo *mTexHairColorInfo; + LLTexGlobalColorInfo *mTexEyeColorInfo; - BOOL mNeedsSkin; //if TRUE, avatar has been animated and verts have not been updated - S32 mUpdatePeriod; + typedef std::vector layer_info_list_t; + layer_info_list_t mLayerInfoList; - //-------------------------------------------------------------------- - // Internal functions - //-------------------------------------------------------------------- -protected: - void buildCharacter(); - void releaseMeshData(); - void restoreMeshData(); - void updateMeshData(); - void computeBodySize(); - const LLUUID& getStepSound() const; - BOOL needsRenderBeam(); + typedef std::vector driver_info_list_t; + driver_info_list_t mDriverInfoList; + }; - BOOL allocateCollisionVolumes( U32 num ); - void resetHUDAttachments(); - static void getAnimLabels( LLDynamicArray* labels ); - static void getAnimNames( LLDynamicArray* names ); +public: //Public until pulled out of LLTexLayer + struct LLMaskedMorph + { + LLMaskedMorph(LLPolyMorphTarget *morph_target, BOOL invert) : + mMorphTarget(morph_target), + mInvert(invert) + { + morph_target->addPendingMorphMask(); + } + + LLPolyMorphTarget *mMorphTarget; + BOOL mInvert; + }; + +/** Support classes + ** ** + *******************************************************************************/ - //-------------------------------------------------------------------- - // Textures and Layers - //-------------------------------------------------------------------- -protected: - BOOL loadSkeletonNode(); - BOOL loadMeshNodes(); - BOOL isFullyBaked(); - void deleteLayerSetCaches(bool clearAll = true); - static BOOL areAllNearbyInstancesBaked(S32& grey_avatars); - static void onBakedTextureMasksLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - void setLocalTexture(LLVOAvatarDefines::ETextureIndex i, LLViewerFetchedTexture* tex, BOOL baked_version_exits); - void requestLayerSetUpdate(LLVOAvatarDefines::ETextureIndex i); - void addLocalTextureStats(LLVOAvatarDefines::ETextureIndex i, LLViewerTexture* imagep, F32 texel_area_ratio, BOOL rendered, BOOL covered_by_baked); - void addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level); - static void onInitialBakedTextureLoaded( BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata ); - static void onBakedTextureLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata); - void useBakedTexture(const LLUUID& id); - void dumpAvatarTEs(const std::string& context); - void removeMissingBakedTextures(); - LLTexLayerSet* getLayerSet(LLVOAvatarDefines::ETextureIndex index) const; - LLHost getObjectHost() const; - S32 getLocalDiscardLevel(LLVOAvatarDefines::ETextureIndex index); -public: - static void updateFreezeCounter(S32 counter = 0 ); // public: @@ -828,35 +1160,11 @@ public: // private: - static S32 sFreezeCounter; - - //----------------------------------------------------------------------------------------------- - // Avatar skeleton setup. - //----------------------------------------------------------------------------------------------- -private: - BOOL loadAvatar(); - BOOL setupBone(const LLVOAvatarBoneInfo* info, LLViewerJoint* parent, S32 ¤t_volume_num, S32 ¤t_joint_num); - BOOL buildSkeleton(const LLVOAvatarSkeletonInfo *info); - //----------------------------------------------------------------------------------------------- // Per-avatar information about texture data. // To-do: Move this to private implementation class //----------------------------------------------------------------------------------------------- - struct BakedTextureData - { - LLUUID mLastTextureIndex; - LLTexLayerSet* mTexLayerSet; - bool mIsLoaded; - bool mIsUsed; - LLVOAvatarDefines::ETextureIndex mTextureIndex; - U32 mMaskTexName; - // Stores pointers to the joint meshes that this baked texture deals with - std::vector< LLViewerJointMesh * > mMeshes; // std::vector mJoints[i]->mMeshParts - }; - typedef std::vector bakedtexturedata_vec_t; - bakedtexturedata_vec_t mBakedTextureData; - struct LocalTextureData { LocalTextureData() : mIsBakedReady(false), mDiscard(MAX_DISCARD_LEVEL+1), mImage(NULL) @@ -868,41 +1176,33 @@ private: typedef std::map localtexture_map_t; localtexture_map_t mLocalTextureData; - typedef std::multimap polymesh_map_t; - polymesh_map_t mMeshes; - std::vector mMeshLOD; - S32 mNumInitFaces ; //number of faces generated when creating the avatar drawable, does not inculde splitted faces due to long vertex buffer. - //----------------------------------------------------------------------------------------------- - // Static texture/mesh/baked dictionary for avatars - //----------------------------------------------------------------------------------------------- -public: - static BOOL isIndexLocalTexture(LLVOAvatarDefines::ETextureIndex i); - static BOOL isIndexBakedTexture(LLVOAvatarDefines::ETextureIndex i); -private: - static const LLVOAvatarDefines::LLVOAvatarDictionary *getDictionary() { return sAvatarDictionary; } - static LLVOAvatarDefines::LLVOAvatarDictionary *sAvatarDictionary; - static LLVOAvatarSkeletonInfo* sAvatarSkeletonInfo; - static LLVOAvatarXmlInfo* sAvatarXmlInfo; + //-------------------------------------------------------------------- + // Private member variables. + //-------------------------------------------------------------------- + BOOL mIsSelf; // True if this avatar is for this viewer's agent -public: - void dirtyMesh(); -private: - void dirtyMesh(S32 priority); // Dirty the avatar mesh, with priority - S32 mDirtyMesh; // 0 -- not dirty, 1 -- morphed, 2 -- LOD - BOOL mMeshTexturesDirty; + LLViewerJoint *mScreenp; // special purpose joint for HUD attachments + + // Scratch textures used for compositing + static LLMap< LLGLenum, LLGLuint*> sScratchTexNames; + static LLMap< LLGLenum, F32*> sScratchTexLastBindTime; + static S32 sScratchTexBytes; - //----------------------------------------------------------------------------------------------- - // Diagnostics - //----------------------------------------------------------------------------------------------- -public: - static F32 sUnbakedTime; // Total seconds with >=1 unbaked avatars - static F32 sUnbakedUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) - static F32 sGreyTime; // Total seconds with >=1 grey avatars - static F32 sGreyUpdateTime; // Last time stats were updated (to prevent multiple updates per frame) - static bool sDoProperArc; + static LLSD sClientResolutionList; - const std::string getBakedStatusForPrintout() const; + bool isUnknownClient(); + static void resolveClient(LLColor4& avatar_name_color, std::string& client, LLVOAvatar* avatar); + friend class LLFloaterAvatarList; + + LLPointer mBeam; + LLFrameTimer mBeamTimer; + + U64 mLastRegionHandle; + LLFrameTimer mRegionCrossingTimer; + S32 mRegionCrossingCount; + + static bool sDoProperArc; }; //----------------------------------------------------------------------------------------------- diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp index 94b88fb0c..16c415f5c 100644 --- a/indra/newview/rlvhandler.cpp +++ b/indra/newview/rlvhandler.cpp @@ -1430,7 +1430,7 @@ ERlvCmdRet RlvHandler::processForceCommand(const RlvCommand& rlvCmd) const { VERIFY_OPTION(rlvCmd.getOption().empty()); LLVOAvatar* pAvatar = gAgent.getAvatarObject(); - if ( (pAvatar) && (pAvatar->mIsSitting) && (!hasBehaviourExcept(RLV_BHVR_UNSIT, rlvCmd.getObjectID())) ) + if ( (pAvatar) && (pAvatar->isSitting()) && (!hasBehaviourExcept(RLV_BHVR_UNSIT, rlvCmd.getObjectID())) ) { gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); send_agent_update(TRUE, TRUE); // See behaviour notes on why we have to force an agent update here @@ -1577,7 +1577,7 @@ ERlvCmdRet RlvHandler::onForceSit(const RlvCommand& rlvCmd) const return RLV_RET_FAILED_LOCK; else if ( (hasBehaviour(RLV_BHVR_STANDTP)) && (gAgent.getAvatarObject()) ) { - if (gAgent.getAvatarObject()->mIsSitting) + if (gAgent.getAvatarObject()->isSitting()) return RLV_RET_FAILED_LOCK; m_posSitSource = gAgent.getPositionGlobal(); } @@ -1692,7 +1692,7 @@ ERlvCmdRet RlvHandler::processReplyCommand(const RlvCommand& rlvCmd) const { // NOTE: RLV 1.16.1 returns a NULL UUID if we're not sitting LLVOAvatar* pAvatar = gAgent.getAvatarObject(); LLUUID idSitObj; - if ( (pAvatar) && (pAvatar->mIsSitting) ) + if ( (pAvatar) && (pAvatar->isSitting()) ) { // LLVOAvatar inherits from 2 classes so make sure we get the right vfptr LLViewerObject* pAvatarObj = dynamic_cast(pAvatar), *pParent; diff --git a/indra/newview/rlvhandler.h b/indra/newview/rlvhandler.h index 62f577cc3..362200aec 100644 --- a/indra/newview/rlvhandler.h +++ b/indra/newview/rlvhandler.h @@ -243,7 +243,7 @@ inline bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset ( (pObj) && (LL_PCODE_VOLUME == pObj->getPCode()) ) && (!hasBehaviour(RLV_BHVR_SIT)) && ( ((!hasBehaviour(RLV_BHVR_UNSIT)) && (!hasBehaviour(RLV_BHVR_STANDTP))) || - ((gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->mIsSitting)) ) && + ((gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->isSitting())) ) && ( ((NULL == getCurrentCommand() || (RLV_BHVR_SIT != getCurrentCommand()->getBehaviourType())) ? ((!hasBehaviour(RLV_BHVR_SITTP)) && (!hasBehaviour(RLV_BHVR_FARTOUCH))) // [regular sit] : (!hasBehaviourExcept(RLV_BHVR_SITTP, getCurrentObject()))) || // [force sit] @@ -254,7 +254,7 @@ inline bool RlvHandler::canSit(LLViewerObject* pObj, const LLVector3& posOffset inline bool RlvHandler::canStand() const { // NOTE: return FALSE only if we're @unsit=n restricted and the avie is currently sitting on something and TRUE for everything else - return (!hasBehaviour(RLV_BHVR_UNSIT)) || ((gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->mIsSitting)); + return (!hasBehaviour(RLV_BHVR_UNSIT)) || ((gAgent.getAvatarObject()) && (!gAgent.getAvatarObject()->isSitting())); } // Checked: 2010-12-11 (RLVa-1.2.2c) | Added: RLVa-1.2.2c