summaryrefslogtreecommitdiff
path: root/indra/newview/llmorphview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llmorphview.cpp')
-rw-r--r--indra/newview/llmorphview.cpp33
1 files changed, 14 insertions, 19 deletions
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index b95e8bd3a2..d670eb6ffd 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -37,6 +37,7 @@
#include "lljoint.h"
#include "llagent.h"
+#include "llagentcamera.h"
#include "lldrawable.h"
#include "lldrawpoolavatar.h"
#include "llface.h"
@@ -88,15 +89,14 @@ void LLMorphView::initialize()
mCameraYaw = 0.f;
mCameraDist = -1.f;
- LLVOAvatar *avatarp = gAgent.getAvatarObject();
- if (!avatarp || avatarp->isDead())
+ if (!isAgentAvatarValid() || gAgentAvatarp->isDead())
{
- gAgent.changeCameraToDefault();
+ gAgentCamera.changeCameraToDefault();
return;
}
- avatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
- avatarp->mSpecialRenderMode = 3;
+ gAgentAvatarp->stopMotion( ANIM_AGENT_BODY_NOISE );
+ gAgentAvatarp->mSpecialRenderMode = 3;
// set up camera for close look at avatar
mOldCameraNearClip = LLViewerCamera::getInstance()->getNear();
@@ -110,11 +110,10 @@ void LLMorphView::shutdown()
{
LLVOAvatarSelf::onCustomizeEnd();
- LLVOAvatar *avatarp = gAgent.getAvatarObject();
- if(avatarp && !avatarp->isDead())
+ if (isAgentAvatarValid())
{
- avatarp->startMotion( ANIM_AGENT_BODY_NOISE );
- avatarp->mSpecialRenderMode = 0;
+ gAgentAvatarp->startMotion( ANIM_AGENT_BODY_NOISE );
+ gAgentAvatarp->mSpecialRenderMode = 0;
// reset camera
LLViewerCamera::getInstance()->setNear(mOldCameraNearClip);
}
@@ -163,15 +162,11 @@ void LLMorphView::updateCamera()
{
if (!mCameraTargetJoint)
{
- setCameraTargetJoint(gAgent.getAvatarObject()->getJoint("mHead"));
- }
-
- LLVOAvatar* avatar = gAgent.getAvatarObject();
- if( !avatar )
- {
- return;
- }
- LLJoint* root_joint = avatar->getRootJoint();
+ setCameraTargetJoint(gAgentAvatarp->getJoint("mHead"));
+ }
+ if (!isAgentAvatarValid()) return;
+
+ LLJoint* root_joint = gAgentAvatarp->getRootJoint();
if( !root_joint )
{
return;
@@ -187,7 +182,7 @@ void LLMorphView::updateCamera()
LLVector3d camera_pos = joint_pos + mCameraOffset * camera_rot_pitch * camera_rot_yaw * avatar_rot;
- gAgent.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() );
+ gAgentCamera.setCameraPosAndFocusGlobal( camera_pos, target_pos, gAgent.getID() );
}
void LLMorphView::setCameraDrivenByKeys(BOOL b)