summaryrefslogtreecommitdiff
path: root/indra/newview/llvoavatar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llvoavatar.cpp')
-rw-r--r--indra/newview/llvoavatar.cpp121
1 files changed, 69 insertions, 52 deletions
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 68c5eec9a4..0add3bd9a9 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -694,7 +694,7 @@ LLVOAvatar::LLVOAvatar(
// mVoiceVisualizer is created by the hud effects manager and uses the HUD Effects pipeline
bool needsSendToSim = false; // currently, this HUD effect doesn't need to pack and unpack data to do its job
- mVoiceVisualizer = ( LLVoiceVisualizer *)gHUDManager->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim );
+ mVoiceVisualizer = ( LLVoiceVisualizer *)LLHUDManager::getInstance()->createViewerEffect( LLHUDObject::LL_HUD_EFFECT_VOICE_VISUALIZER, needsSendToSim );
lldebugs << "LLVOAvatar Constructor (0x" << this << ") id:" << mID << llendl;
@@ -757,8 +757,7 @@ LLVOAvatar::LLVOAvatar(
mRippleTimeLast = 0.f;
- mShadowImageID = LLUUID( gViewerArt.getString("foot_shadow.tga"));
- mShadowImagep = gImageList.getImage(mShadowImageID);
+ mShadowImagep = gImageList.getImageFromFile("foot_shadow.j2c");
mShadowImagep->bind();
mShadowImagep->setClamp(TRUE, TRUE);
@@ -1728,7 +1727,7 @@ BOOL LLVOAvatar::buildSkeleton(LLVOAvatarSkeletonInfo *info)
mScreenp = new LLViewerJoint("mScreen", NULL);
// for now, put screen at origin, as it is only used during special
// HUD rendering mode
- F32 aspect = gCamera->getAspect();
+ F32 aspect = LLViewerCamera::getInstance()->getAspect();
LLVector3 scale(1.f, aspect, 1.f);
mScreenp->setScale(scale);
mScreenp->setWorldPosition(LLVector3::zero);
@@ -2572,7 +2571,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
if (visibleAttachment && attached_object && !attached_object->isDead() && attachment->getValid())
{
// if selecting any attachments, update all of them as non-damped
- if (gSelectMgr->getSelection()->getObjectCount() && gSelectMgr->getSelection()->isAttachment())
+ if (LLSelectMgr::getInstance()->getSelection()->getObjectCount() && LLSelectMgr::getInstance()->getSelection()->isAttachment())
{
gPipeline.updateMoveNormalAsync(attached_object->mDrawable);
}
@@ -2848,11 +2847,11 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
mNameText->setUsePixelSize(TRUE);
LLVector3 pixel_right_vec;
LLVector3 pixel_up_vec;
- gCamera->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec);
- LLVector3 camera_to_av = root_pos_last - gCamera->getOrigin();
+ LLViewerCamera::getInstance()->getPixelVectors(root_pos_last, pixel_up_vec, pixel_right_vec);
+ LLVector3 camera_to_av = root_pos_last - LLViewerCamera::getInstance()->getOrigin();
camera_to_av.normVec();
LLVector3 local_camera_at = camera_to_av * ~root_rot;
- LLVector3 local_camera_up = camera_to_av % gCamera->getLeftAxis();
+ LLVector3 local_camera_up = camera_to_av % LLViewerCamera::getInstance()->getLeftAxis();
local_camera_up.normVec();
local_camera_up = local_camera_up * ~root_rot;
@@ -2889,7 +2888,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
}
else
{
- is_muted = gMuteListp->isMuted(getID());
+ is_muted = LLMuteList::getInstance()->isMuted(getID());
}
if (mNameString.empty() ||
@@ -3088,7 +3087,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
else if (!mBeam || mBeam->isDead())
{
// VEFFECT: Tractor Beam
- mBeam = (LLHUDEffectSpiral *)gHUDManager->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
+ mBeam = (LLHUDEffectSpiral *)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_BEAM);
mBeam->setColor(LLColor4U(gAgent.getEffectColor()));
mBeam->setSourceObject(this);
mBeamTimer.reset();
@@ -3096,7 +3095,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
if (!mBeam.isNull())
{
- LLObjectSelectionHandle selection = gSelectMgr->getSelection();
+ LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
if (gAgent.mPointAt.notNull())
{
@@ -3113,7 +3112,7 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
else
{
mBeam->setTargetObject(NULL);
- LLTool *tool = gToolMgr->getCurrentTool();
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
if (tool->isEditing())
{
if (tool->getEditingObject())
@@ -3172,7 +3171,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (mScreenp)
{
- F32 aspect = gCamera->getAspect();
+ F32 aspect = LLViewerCamera::getInstance()->getAspect();
LLVector3 scale(1.f, aspect, 1.f);
mScreenp->setScale(scale);
mScreenp->updateWorldMatrixChildren();
@@ -3242,7 +3241,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter)
{
F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f);
- if (gMuteListp && gMuteListp->isMuted(getID()))
+ if (LLMuteList::getInstance()->isMuted(getID()))
{
mUpdatePeriod = 16;
visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE;
@@ -3353,7 +3352,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
resolveHeightGlobal(root_pos, ground_under_pelvis, normal);
F32 foot_to_ground = (F32) (root_pos.mdV[VZ] - mPelvisToFoot - ground_under_pelvis.mdV[VZ]);
- BOOL in_air = ( (!gWorldPointer->getRegionFromPosGlobal(ground_under_pelvis)) ||
+ BOOL in_air = ( (!LLWorld::getInstance()->getRegionFromPosGlobal(ground_under_pelvis)) ||
foot_to_ground > FOOT_GROUND_COLLISION_TOLERANCE);
if (in_air && !mInAir)
@@ -3414,11 +3413,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
// make sure fwdDir stays in same general direction as primdir
if (gAgent.getFlying())
{
- fwdDir = gCamera->getAtAxis();
+ fwdDir = LLViewerCamera::getInstance()->getAtAxis();
}
else
{
- LLVector3 at_axis = gCamera->getAtAxis();
+ LLVector3 at_axis = LLViewerCamera::getInstance()->getAtAxis();
LLVector3 up_vector = gAgent.getReferenceUpVector();
at_axis -= up_vector * (at_axis * up_vector);
at_axis.normVec();
@@ -3634,8 +3633,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)
LLVector3d foot_pos_global = gAgent.getPosGlobalFromAgent(foot_pos_agent);
- if (gParcelMgr && gParcelMgr->canHearSound(foot_pos_global)
- && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds))
+ if (LLViewerParcelMgr::getInstance()->canHearSound(foot_pos_global)
+ && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds))
{
gAudiop->triggerSound(step_sound_id, getID(), gain, foot_pos_global);
}
@@ -3694,7 +3693,7 @@ void LLVOAvatar::updateHeadOffset()
// since we only care about Z, just grab one of the eyes
LLVector3 midEyePt = mEyeLeftp->getWorldPosition();
midEyePt -= mDrawable.notNull() ? mDrawable->getWorldPosition() : mRoot.getWorldPosition();
- midEyePt.mV[VZ] = llmax(-mPelvisToFoot + gCamera->getNear(), midEyePt.mV[VZ]);
+ midEyePt.mV[VZ] = llmax(-mPelvisToFoot + LLViewerCamera::getInstance()->getNear(), midEyePt.mV[VZ]);
if (mDrawable.notNull())
{
@@ -3729,7 +3728,7 @@ void LLVOAvatar::updateVisibility()
else
{
// calculate avatar distance wrt head
- mDrawable->updateDistance(*gCamera);
+ mDrawable->updateDistance(*LLViewerCamera::getInstance());
if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible())
{
@@ -3783,15 +3782,15 @@ void LLVOAvatar::updateVisibility()
llinfos << "Avatar not in frustum" << llendl;
}*/
- /*if (gCamera->sphereInFrustum(sel_pos_agent, 2.0f))
+ /*if (LLViewerCamera::getInstance()->sphereInFrustum(sel_pos_agent, 2.0f))
{
llinfos << "Sel pos visible" << llendl;
}
- if (gCamera->sphereInFrustum(wrist_right_pos_agent, 0.2f))
+ if (LLViewerCamera::getInstance()->sphereInFrustum(wrist_right_pos_agent, 0.2f))
{
llinfos << "Wrist pos visible" << llendl;
}
- if (gCamera->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f))
+ if (LLViewerCamera::getInstance()->sphereInFrustum(getPositionAgent(), getMaxScale()*2.f))
{
llinfos << "Agent visible" << llendl;
}*/
@@ -3857,16 +3856,16 @@ BOOL LLVOAvatar::needsRenderBeam()
{
return FALSE;
}
- LLTool *tool = gToolMgr->getCurrentTool();
+ LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
- BOOL is_touching_or_grabbing = (tool == gToolGrab && gToolGrab->isEditing());
- if (gToolGrab->getEditingObject() &&
- gToolGrab->getEditingObject()->isAttachment())
+ BOOL is_touching_or_grabbing = (tool == LLToolGrab::getInstance() && LLToolGrab::getInstance()->isEditing());
+ if (LLToolGrab::getInstance()->getEditingObject() &&
+ LLToolGrab::getInstance()->getEditingObject()->isAttachment())
{
// don't render selection beam on hud objects
is_touching_or_grabbing = FALSE;
}
- return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && gSelectMgr->shouldShowSelection());
+ return is_touching_or_grabbing || (mState & AGENT_STATE_EDITING && LLSelectMgr::getInstance()->shouldShowSelection());
}
//-----------------------------------------------------------------------------
@@ -4128,9 +4127,9 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color)
}
LLVector3 pos(getRenderPosition()+mImpostorOffset);
- LLVector3 at = (pos-gCamera->getOrigin());
+ LLVector3 at = (pos - LLViewerCamera::getInstance()->getOrigin());
at.normVec();
- LLVector3 left = gCamera->getUpAxis() % at;
+ LLVector3 left = LLViewerCamera::getInstance()->getUpAxis() % at;
LLVector3 up = at%left;
left *= mImpostorDim.mV[0];
@@ -4453,7 +4452,7 @@ void LLVOAvatar::resolveHeightAgent(const LLVector3 &in_pos_agent, LLVector3 &ou
void LLVOAvatar::resolveRayCollisionAgent(const LLVector3d start_pt, const LLVector3d end_pt, LLVector3d &out_pos, LLVector3 &out_norm)
{
LLViewerObject *obj;
- gWorldPointer->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj);
+ LLWorld::getInstance()->resolveStepHeightGlobal(this, start_pt, end_pt, out_pos, out_norm, &obj);
}
@@ -4463,7 +4462,7 @@ void LLVOAvatar::resolveHeightGlobal(const LLVector3d &inPos, LLVector3d &outPos
LLVector3d p0 = inPos + zVec;
LLVector3d p1 = inPos - zVec;
LLViewerObject *obj;
- gWorldPointer->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj);
+ LLWorld::getInstance()->resolveStepHeightGlobal(this, p0, p1, outPos, outNorm, &obj);
if (!obj)
{
mStepOnLand = TRUE;
@@ -4614,8 +4613,8 @@ BOOL LLVOAvatar::processSingleAnimationStateChange( const LLUUID& anim_id, BOOL
if (gAudiop)
{
LLVector3d char_pos_global = gAgent.getPosGlobalFromAgent(getCharacterPosition());
- if (gParcelMgr && gParcelMgr->canHearSound(char_pos_global)
- && gMuteListp && !gMuteListp->isMuted(getID(), LLMute::flagObjectSounds))
+ if (LLViewerParcelMgr::getInstance()->canHearSound(char_pos_global)
+ && !LLMuteList::getInstance()->isMuted(getID(), LLMute::flagObjectSounds))
{
// 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
@@ -4899,7 +4898,7 @@ void LLVOAvatar::getGround(const LLVector3 &in_pos_agent, LLVector3 &out_pos_age
p1_global = gAgent.getPosGlobalFromAgent(in_pos_agent) - z_vec;
LLViewerObject *obj;
LLVector3d out_pos_global;
- gWorldPointer->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj);
+ LLWorld::getInstance()->resolveStepHeightGlobal(this, p0_global, p1_global, out_pos_global, outNorm, &obj);
out_pos_agent = gAgent.getPosAgentFromGlobal(out_pos_global);
}
@@ -5635,7 +5634,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent)
LLVector3 center = (ext[1] + ext[0]) * 0.5f;
LLVector3 size = (ext[1]-ext[0])*0.5f;
- mPixelArea = LLPipeline::calcPixelArea(center, size, *gCamera);
+ mPixelArea = LLPipeline::calcPixelArea(center, size, *LLViewerCamera::getInstance());
F32 range = mDrawable->mDistanceWRTCamera;
@@ -5772,7 +5771,7 @@ void LLVOAvatar::updateShadowFaces()
return;
}
- LLSprite sprite(mShadowImageID);
+ LLSprite sprite(mShadowImagep.notNull() ? mShadowImagep->getID() : LLUUID::null);
sprite.setFollow(FALSE);
const F32 cos_angle = gSky.getSunDirection().mV[2];
F32 cos_elev = sqrt(1 - cos_angle * cos_angle);
@@ -6010,8 +6009,8 @@ BOOL LLVOAvatar::attachObject(LLViewerObject *viewer_object)
if (viewer_object->isSelected())
{
- gSelectMgr->updateSelectionCenter();
- gSelectMgr->updatePointAt();
+ LLSelectMgr::getInstance()->updateSelectionCenter();
+ LLSelectMgr::getInstance()->updatePointAt();
}
if (mIsSelf)
@@ -6318,6 +6317,22 @@ void LLVOAvatar::onLocalTextureLoaded( BOOL success, LLViewerImage *src_vi, LLIm
self->updateMeshTextures();
}
}
+ else if (final)
+ {
+ LLVOAvatar *self = (LLVOAvatar *)gObjectList.findObject(data->mAvatarID);
+ LLVOAvatar::ELocTexIndex idx = data->mIndex;
+ // Failed: asset is missing
+ if( self &&
+ (!self->mLocalTextureBaked[ idx ]) &&
+ (self->mLocalTexture[ idx ].notNull()) &&
+ (self->mLocalTexture[ idx ]->getID() == src_id))
+ {
+ self->mLocalTextureDiscard[idx] = 0; // we check that it's missing later
+ self->requestLayerSetUpdate( idx );
+ self->updateMeshTextures();
+ }
+
+ }
if( final || !success )
{
@@ -6482,7 +6497,7 @@ void LLVOAvatar::forceBakeAllTextures(bool slam_for_debug)
BOOL set_by_user = TRUE;
invalidateComposite(layer_set, set_by_user);
- gViewerStats->incStat(LLViewerStats::ST_TEX_REBAKES);
+ LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
}
else
{
@@ -6520,7 +6535,7 @@ void LLVOAvatar::processRebakeAvatarTextures(LLMessageSystem* msg, void**)
BOOL set_by_user = TRUE;
self->invalidateComposite(layer_set, set_by_user);
found = TRUE;
- gViewerStats->incStat(LLViewerStats::ST_TEX_REBAKES);
+ LLViewerStats::getInstance()->incStat(LLViewerStats::ST_TEX_REBAKES);
}
}
}
@@ -7369,7 +7384,10 @@ void LLVOAvatar::clearChat()
S32 LLVOAvatar::getLocalDiscardLevel( S32 index )
{
- if (index >= 0 && mLocalTexture[index].notNull() && mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR)
+ if (index >= 0
+ && mLocalTexture[index].notNull()
+ && (mLocalTexture[index]->getID() != IMG_DEFAULT_AVATAR)
+ && !mLocalTexture[index]->isMissingAsset())
{
return mLocalTexture[index]->getDiscardLevel();
}
@@ -9374,13 +9392,13 @@ void LLVOAvatar::updateRegion(LLViewerRegion *regionp)
{
++mRegionCrossingCount;
F64 delta = (F64)mRegionCrossingTimer.getElapsedTimeF32();
- F64 avg = (mRegionCrossingCount == 1) ? 0 : gViewerStats->getStat(LLViewerStats::ST_CROSSING_AVG);
+ F64 avg = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_AVG);
F64 delta_avg = (delta + avg*(mRegionCrossingCount-1)) / mRegionCrossingCount;
- gViewerStats->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg);
+ LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_AVG, delta_avg);
- F64 max = (mRegionCrossingCount == 1) ? 0 : gViewerStats->getStat(LLViewerStats::ST_CROSSING_MAX);
+ F64 max = (mRegionCrossingCount == 1) ? 0 : LLViewerStats::getInstance()->getStat(LLViewerStats::ST_CROSSING_MAX);
max = llmax(delta, max);
- gViewerStats->setStat(LLViewerStats::ST_CROSSING_MAX, max);
+ LLViewerStats::getInstance()->setStat(LLViewerStats::ST_CROSSING_MAX, max);
}
mLastRegionHandle = regionp->getHandle();
}
@@ -9555,11 +9573,11 @@ void LLVOAvatar::getImpostorValues(LLVector3* extents, LLVector3& angle, F32& di
extents[0] = ext[0];
extents[1] = ext[1];
- LLVector3 at = gCamera->getOrigin()-(getRenderPosition()+mImpostorOffset);
+ LLVector3 at = LLViewerCamera::getInstance()->getOrigin()-(getRenderPosition()+mImpostorOffset);
distance = at.normVec();
- F32 da = 1.f - (at*gCamera->getAtAxis());
- angle.mV[0] = gCamera->getYaw()*da;
- angle.mV[1] = gCamera->getPitch()*da;
+ F32 da = 1.f - (at*LLViewerCamera::getInstance()->getAtAxis());
+ angle.mV[0] = LLViewerCamera::getInstance()->getYaw()*da;
+ angle.mV[1] = LLViewerCamera::getInstance()->getPitch()*da;
angle.mV[2] = da;
}
@@ -9694,4 +9712,3 @@ void LLVOAvatar::shame()
mText->setColor(LLColor4(red,green,0,1));
}
-