diff options
| -rw-r--r-- | indra/newview/llagentcamera.cpp | 79 | ||||
| -rw-r--r-- | indra/newview/llagentcamera.h | 4 | ||||
| -rw-r--r-- | indra/newview/llmorphview.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llmorphview.h | 7 | ||||
| -rw-r--r-- | indra/newview/llpaneleditwearable.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/lltoolfocus.cpp | 1 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.cpp | 5 | 
7 files changed, 49 insertions, 50 deletions
| diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 9cf0a659c1..e1a0162441 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -95,6 +95,8 @@ const F32 OBJECT_MIN_ZOOM = 0.02f;  const F32 APPEARANCE_MIN_ZOOM = 0.39f;  const F32 APPEARANCE_MAX_ZOOM = 8.f; +const F32 CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST = 3.5f; +  const F32 GROUND_TO_AIR_CAMERA_TRANSITION_TIME = 0.5f;  const F32 GROUND_TO_AIR_CAMERA_TRANSITION_START_TIME = 0.5f; @@ -156,7 +158,6 @@ LLAgentCamera::LLAgentCamera() :  	mFocusObjectOffset(),  	mFocusDotRadius( 0.1f ),			// meters  	mTrackFocusObject(TRUE), -	mUIOffset(0.f),  	mAtKey(0), // Either 1, 0, or -1... indicates that movement-key is pressed  	mWalkKey(0), // like AtKey, but causes less forward thrust @@ -1407,13 +1408,6 @@ void LLAgentCamera::updateCamera()  //	llinfos << "Current FOV Zoom: " << mCameraCurrentFOVZoomFactor << " Target FOV Zoom: " << mCameraFOVZoomFactor << " Object penetration: " << mFocusObjectDist << llendl; -	F32 ui_offset = 0.f; -	if( CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode )  -	{ -		ui_offset = calcCustomizeAvatarUIOffset( camera_pos_global ); -	} - -  	LLVector3 focus_agent = gAgent.getPosAgentFromGlobal(mFocusGlobal);  	mCameraPositionAgent = gAgent.getPosAgentFromGlobal(camera_pos_global); @@ -1424,9 +1418,6 @@ void LLAgentCamera::updateCamera()  	LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, mCameraUpVector, focus_agent);  	//LLViewerCamera::getInstance()->updateCameraLocation(mCameraPositionAgent, camera_skyward, focus_agent);  	//end Ventrella - -	//RN: translate UI offset after camera is oriented properly -	LLViewerCamera::getInstance()->translate(LLViewerCamera::getInstance()->getLeftAxis() * ui_offset);  	// Change FOV  	LLViewerCamera::getInstance()->setView(LLViewerCamera::getInstance()->getDefaultFOV() / (1.f + mCameraCurrentFOVZoomFactor)); @@ -1532,18 +1523,6 @@ void LLAgentCamera::validateFocusObject()  }  //----------------------------------------------------------------------------- -// calcCustomizeAvatarUIOffset() -//----------------------------------------------------------------------------- -F32 LLAgentCamera::calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global) -{ -	F32 ui_offset = 0.f; - -	F32 range = (F32)dist_vec(camera_pos_global, getFocusGlobal()); -	mUIOffset = lerp(mUIOffset, ui_offset, LLCriticalDamp::getInterpolant(0.05f)); -	return mUIOffset * range; -} - -//-----------------------------------------------------------------------------  // calcFocusPositionTargetGlobal()  //-----------------------------------------------------------------------------  LLVector3d LLAgentCamera::calcFocusPositionTargetGlobal() @@ -2332,14 +2311,24 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came  		LLVOAvatarSelf::onCustomizeStart();  	} + +	// default focus point for customize avatar +	LLVector3 focus_target; +	if (isAgentAvatarValid()) +	{ +		focus_target = gAgentAvatarp->mHeadp->getWorldPosition(); +	} +	else +	{ +		focus_target = gAgent.getPositionAgent(); +	} +  	if (isAgentAvatarValid())  	{  		if(avatar_animate)  		{	 -			// slamming the avatar's axis to the camera so that when the rotation -			// completes it correctly points to the front of the avatar  			// Remove any pitch or rotation from the avatar -			LLVector3 at = LLViewerCamera::getInstance()->getAtAxis(); +			LLVector3 at = gAgent.getAtAxis();  			at.mV[VZ] = 0.f;  			at.normalize();  			gAgent.resetAxes(at); @@ -2351,17 +2340,25 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came  			if (turn_motion)  			{ -				mAnimationDuration = turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP; +				setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP);  			}  			else  			{ -				mAnimationDuration = gSavedSettings.getF32("ZoomTime"); +				setAnimationDuration(gSavedSettings.getF32("ZoomTime"));  			}  		} -		// this is what sets the avatar as the mFocusTargetGlobal -		setFocusGlobal(LLVector3d::zero); +		LLVector3 agent_at = gAgent.getAtAxis(); +		agent_at.mV[VZ] = 0.f; +		agent_at.normalize(); + +		LLVector3d camera_offset(agent_at * -1.0); +		// push camera up and out from avatar +		camera_offset.mdV[VZ] = 0.1f;  +		camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST; +		LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target); +		setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID());  		gAgentAvatarp->updateMeshTextures();  	} @@ -2391,6 +2388,20 @@ void LLAgentCamera::switchCameraPreset(ECameraPreset preset)  // Focus point management  // +void LLAgentCamera::setAnimationDuration(F32 duration) +{  +	if (mCameraAnimating) +	{ +		// do not cut any existing camera animation short +		F32 animation_left = llmax(0.f, mAnimationDuration - mAnimationTimer.getElapsedTimeF32()); +		mAnimationDuration = llmax(duration, animation_left); +	} +	else +	{ +		mAnimationDuration = duration;  +	} +} +  //-----------------------------------------------------------------------------  // startCameraAnimation()  //----------------------------------------------------------------------------- @@ -2398,9 +2409,9 @@ void LLAgentCamera::startCameraAnimation()  {  	mAnimationCameraStartGlobal = getCameraPositionGlobal();  	mAnimationFocusStartGlobal = mFocusGlobal; +	setAnimationDuration(gSavedSettings.getF32("ZoomTime"));  	mAnimationTimer.reset();  	mCameraAnimating = TRUE; -	mAnimationDuration = gSavedSettings.getF32("ZoomTime");  }  //----------------------------------------------------------------------------- @@ -2546,12 +2557,6 @@ void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, con  	if (focus_delta_squared > ANIM_EPSILON_SQUARED)  	{  		startCameraAnimation(); - -		if (CAMERA_MODE_CUSTOMIZE_AVATAR == mCameraMode)  -		{ -			// Compensate for the fact that the camera has already been offset to make room for LLFloaterCustomize. -			mAnimationCameraStartGlobal -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * calcCustomizeAvatarUIOffset( mAnimationCameraStartGlobal )); -		}  	}  	//LLViewerCamera::getInstance()->setOrigin( gAgent.getPosAgentFromGlobal( camera_pos ) ); diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h index 7afb5c0ed9..3b8f88733a 100644 --- a/indra/newview/llagentcamera.h +++ b/indra/newview/llagentcamera.h @@ -137,7 +137,6 @@ public:  	F32				getCameraMinOffGround(); 		// Minimum height off ground for this mode, meters  	void			setCameraCollidePlane(const LLVector4 &plane) { mCameraCollidePlane = plane; }  	BOOL			calcCameraMinDistance(F32 &obj_min_distance); -	F32				calcCustomizeAvatarUIOffset(const LLVector3d& camera_pos_global);  	F32				getCurrentCameraBuildOffset() 	{ return (F32)mCameraFocusOffset.length(); }  	void			clearCameraLag() { mCameraLag.clearVec(); }  private: @@ -184,7 +183,7 @@ private:  public:  	void			setCameraAnimating(BOOL b)			{ mCameraAnimating = b; }  	BOOL			getCameraAnimating()				{ return mCameraAnimating; } -	void			setAnimationDuration(F32 seconds) 	{ mAnimationDuration = seconds; } +	void			setAnimationDuration(F32 seconds);  	void			startCameraAnimation();  	void			stopCameraAnimation();  private: @@ -225,7 +224,6 @@ private:  	LLVector3		mFocusObjectOffset;  	F32				mFocusDotRadius; 				// Meters  	BOOL			mTrackFocusObject; -	F32				mUIOffset;	  	//--------------------------------------------------------------------  	// Lookat / Pointat diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp index 4c28e98e62..61fc932bab 100644 --- a/indra/newview/llmorphview.cpp +++ b/indra/newview/llmorphview.cpp @@ -75,7 +75,6 @@ LLMorphView::LLMorphView(const LLMorphView::Params& p)  	mOldCameraNearClip( 0.f ),  	mCameraPitch( 0.f ),  	mCameraYaw( 0.f ), -	mCameraDist( -1.f ),  	mCameraDrivenByKeys( FALSE )  {} @@ -86,7 +85,6 @@ void	LLMorphView::initialize()  {  	mCameraPitch = 0.f;  	mCameraYaw = 0.f; -	mCameraDist = -1.f;  	if (!isAgentAvatarValid() || gAgentAvatarp->isDead())  	{ diff --git a/indra/newview/llmorphview.h b/indra/newview/llmorphview.h index 493f906c6b..f0f04dfda3 100644 --- a/indra/newview/llmorphview.h +++ b/indra/newview/llmorphview.h @@ -53,7 +53,6 @@ public:  	};  	LLMorphView(const LLMorphView::Params&); -	void		initialize();  	void		shutdown();  	// inherited methods @@ -64,12 +63,13 @@ public:  	void		setCameraOffset(const LLVector3d& camera_offset)	{mCameraOffset = camera_offset;}  	void		setCameraTargetOffset(const LLVector3d& camera_target_offset) {mCameraTargetOffset = camera_target_offset;} -	void		setCameraDistToDefault()					{ mCameraDist = -1.f; }  	void		updateCamera();  	void		setCameraDrivenByKeys( BOOL b );  protected: +	void		initialize(); +  	LLJoint*	mCameraTargetJoint;  	LLVector3d	mCameraOffset;  	LLVector3d	mCameraTargetOffset; @@ -82,9 +82,6 @@ protected:  	F32			mCameraPitch;  	F32			mCameraYaw; -	// camera zoom -	F32			mCameraDist; -  	BOOL		mCameraDrivenByKeys;  }; diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 71edd39348..ae54909945 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1127,7 +1127,6 @@ void LLPanelEditWearable::changeCamera(U8 subpart)  	}  	// Update the camera -	gMorphView->setCameraDistToDefault();  	gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );  	gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );  	gMorphView->setCameraOffset( subpart_entry->mCameraOffset ); diff --git a/indra/newview/lltoolfocus.cpp b/indra/newview/lltoolfocus.cpp index 032714cabf..b9875f465a 100644 --- a/indra/newview/lltoolfocus.cpp +++ b/indra/newview/lltoolfocus.cpp @@ -236,7 +236,6 @@ void LLToolCamera::pickCallback(const LLPickInfo& pick_info)  		gAgentCamera.setFocusOnAvatar(FALSE, FALSE);  		LLVector3d cam_pos = gAgentCamera.getCameraPositionGlobal(); -		cam_pos -= LLVector3d(LLViewerCamera::getInstance()->getLeftAxis() * gAgentCamera.calcCustomizeAvatarUIOffset( cam_pos ));  		gAgentCamera.setCameraPosAndFocusGlobal( cam_pos, pick_info.mPosGlobal, pick_info.mObjectID);  	} diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4ef166fb71..3dce4ce0bc 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -3201,7 +3201,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent)  		visible = (LLDrawable::getCurrentFrame()+mID.mData[0])%mUpdatePeriod == 0 ? TRUE : FALSE;  	} -	if (!visible) +	// 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; | 
