diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-15 20:39:00 +0100 | 
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-04-15 20:39:00 +0100 | 
| commit | 230314ac71a055458d9bff4fae744b8e25f7ada2 (patch) | |
| tree | 35bcab18d57eda2c5f3665e287b06b2d8b7060cd | |
| parent | 90800c84c4836d2eb0425ed09b7dd83e86a106db (diff) | |
| parent | 12dadac44e9d5af8728e7bedab586683b2660cb4 (diff) | |
merge from viewer-trunk
| -rw-r--r-- | indra/llcommon/llapr.cpp | 11 | ||||
| -rw-r--r-- | indra/llcommon/llapr.h | 8 | ||||
| -rw-r--r-- | indra/llmath/v2math.h | 9 | ||||
| -rw-r--r-- | indra/llrender/llimagegl.cpp | 14 | ||||
| -rw-r--r-- | indra/llvfs/lllfsthread.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.cpp | 54 | ||||
| -rw-r--r-- | indra/newview/llvoavatar.h | 4 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.cpp | 22 | ||||
| -rw-r--r-- | indra/newview/llvoavatarself.h | 2 | 
9 files changed, 75 insertions, 55 deletions
| diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index ed70b1d9f2..7330b00bcf 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -543,14 +543,13 @@ S32 LLAPRFile::readEx(const std::string& filename, void *buf, S32 offset, S32 nb  		return 0;  	} -	S32 off; -	if (offset < 0) -		off = LLAPRFile::seek(file_handle, APR_END, 0); -	else -		off = LLAPRFile::seek(file_handle, APR_SET, offset); +	llassert(offset >= 0); + +	if (offset > 0) +		offset = LLAPRFile::seek(file_handle, APR_SET, offset);  	apr_size_t bytes_read; -	if (off < 0) +	if (offset < 0)  	{  		bytes_read = 0;  	} diff --git a/indra/llcommon/llapr.h b/indra/llcommon/llapr.h index b05a222b33..08cf11e593 100644 --- a/indra/llcommon/llapr.h +++ b/indra/llcommon/llapr.h @@ -182,7 +182,7 @@ typedef LLAtomic32<U32> LLAtomicU32;  typedef LLAtomic32<S32> LLAtomicS32;  // File IO convenience functions. -// Returns NULL if the file fails to openm sets *sizep to file size of not NULL +// Returns NULL if the file fails to open, sets *sizep to file size if not NULL  // abbreviated flags  #define LL_APR_R (APR_READ) // "r"  #define LL_APR_W (APR_CREATE|APR_TRUNCATE|APR_WRITE) // "w" @@ -200,7 +200,7 @@ typedef LLAtomic32<S32> LLAtomicS32;  //      especially do not put some time-costly operations between open() and close().  //      otherwise it might lock the APRFilePool.  //there are two different apr_pools the APRFile can use: -//      1, a temperary pool passed to an APRFile function, which is used within this function and only once. +//      1, a temporary pool passed to an APRFile function, which is used within this function and only once.  //      2, a global pool.  // @@ -255,12 +255,12 @@ public:  	// Returns bytes read/written, 0 if read/write fails:  	static S32 readEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);	 -	static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL);	 +	static S32 writeEx(const std::string& filename, void *buf, S32 offset, S32 nbytes, LLVolatileAPRPool* pool = NULL); // offset<0 means append  //*******************************************************************************************************************************  };  /** - * @brief Function which approprately logs error or remains quiet on + * @brief Function which appropriately logs error or remains quiet on   * APR_SUCCESS.   * @return Returns <code>true</code> if status is an error condition.   */ diff --git a/indra/llmath/v2math.h b/indra/llmath/v2math.h index f9f1c024f2..ae26c85ce4 100644 --- a/indra/llmath/v2math.h +++ b/indra/llmath/v2math.h @@ -73,6 +73,8 @@ class LLVector2  		void	setVec(const LLVector2 &vec);	// deprecated  		void	setVec(const F32 *vec);			// deprecated +		inline bool isFinite() const; // checks to see if all values of LLVector2 are finite +  		F32		length() const;				// Returns magnitude of LLVector2  		F32		lengthSquared() const;		// Returns magnitude squared of LLVector2  		F32		normalize();					// Normalizes and returns the magnitude of LLVector2 @@ -218,6 +220,7 @@ inline void	LLVector2::setVec(const F32 *vec)  	mV[VY] = vec[VY];  } +  // LLVector2 Magnitude and Normalization Functions  inline F32 LLVector2::length(void) const @@ -250,6 +253,12 @@ inline F32		LLVector2::normalize(void)  	return (mag);  } +// checker +inline bool LLVector2::isFinite() const +{ +	return (llfinite(mV[VX]) && llfinite(mV[VY])); +} +  // deprecated  inline F32		LLVector2::magVec(void) const  { diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index dae759ca5f..00f0fd5b9a 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -1778,8 +1778,18 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)  	if (mPickMask)  	{ -		F32 u = tc.mV[0] - floorf(tc.mV[0]); -		F32 v = tc.mV[1] - floorf(tc.mV[1]); +		F32 u,v; +		if (LL_LIKELY(tc.isFinite())) +		{ +			u = tc.mV[0] - floorf(tc.mV[0]); +			v = tc.mV[1] - floorf(tc.mV[1]); +		} +		else +		{ +			LL_WARNS_ONCE("render") << "Ugh, non-finite u/v in mask pick" << LL_ENDL; +			u = v = 0.f; +			llassert(false); +		}  		if (LL_UNLIKELY(u < 0.f || u > 1.f ||  				v < 0.f || v > 1.f)) diff --git a/indra/llvfs/lllfsthread.cpp b/indra/llvfs/lllfsthread.cpp index e85cc437f4..49c198a82d 100644 --- a/indra/llvfs/lllfsthread.cpp +++ b/indra/llvfs/lllfsthread.cpp @@ -188,7 +188,7 @@ bool LLLFSThread::Request::processRequest()  	if (mOperation ==  FILE_READ)  	{  		llassert(mOffset >= 0); -		LLAPRFile infile ; +		LLAPRFile infile ; // auto-closes  		infile.open(mFileName, LL_APR_RB, mThread->getLocalAPRFilePool());  		if (!infile.getFileHandle())  		{ @@ -204,7 +204,6 @@ bool LLLFSThread::Request::processRequest()  		llassert_always(off >= 0);  		mBytesRead = infile.read(mBuffer, mBytes );  		complete = true; -		infile.close() ;  // 		llinfos << "LLLFSThread::READ:" << mFileName << " Bytes: " << mBytesRead << llendl;  	}  	else if (mOperation ==  FILE_WRITE) @@ -212,7 +211,7 @@ bool LLLFSThread::Request::processRequest()  		apr_int32_t flags = APR_CREATE|APR_WRITE|APR_BINARY;  		if (mOffset < 0)  			flags |= APR_APPEND; -		LLAPRFile outfile ; +		LLAPRFile outfile ; // auto-closes  		outfile.open(mFileName, flags, mThread->getLocalAPRFilePool());  		if (!outfile.getFileHandle())  		{ @@ -232,7 +231,6 @@ bool LLLFSThread::Request::processRequest()  		}  		mBytesRead = outfile.write(mBuffer, mBytes );  		complete = true; -  // 		llinfos << "LLLFSThread::WRITE:" << mFileName << " Bytes: " << mBytesRead << "/" << mBytes << " Offset:" << mOffset << llendl;  	}  	else diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 201c4ce1d5..43a9bd2b2f 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -658,6 +658,7 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,  	mNameMute(FALSE),  	mRenderGroupTitles(sRenderGroupTitles),  	mNameAppearance(FALSE), +	mNameCloud(FALSE),  	mFirstTEMessageReceived( FALSE ),  	mFirstAppearanceMessageReceived( FALSE ),  	mCulled( FALSE ), @@ -2766,25 +2767,20 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)  		if (mNameText.notNull() && firstname && lastname)  		{ -			BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY)  != mSignaledAnimations.end(); -			BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); -			BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); -			BOOL is_muted; -			if (isSelf()) -			{ -				is_muted = FALSE; -			} -			else -			{ -				is_muted = LLMuteList::getInstance()->isMuted(getID()); -			} +			const BOOL is_away = mSignaledAnimations.find(ANIM_AGENT_AWAY)  != mSignaledAnimations.end(); +			const BOOL is_busy = mSignaledAnimations.find(ANIM_AGENT_BUSY) != mSignaledAnimations.end(); +			const BOOL is_appearance = mSignaledAnimations.find(ANIM_AGENT_CUSTOMIZE) != mSignaledAnimations.end(); +			const BOOL is_muted = isSelf() ? FALSE : LLMuteList::getInstance()->isMuted(getID()); +			const BOOL is_cloud = getIsCloud();  			if (mNameString.empty() ||  				new_name ||  				(!title && !mTitle.empty()) ||  				(title && mTitle != title->getString()) ||  				(is_away != mNameAway || is_busy != mNameBusy || is_muted != mNameMute) -				|| is_appearance != mNameAppearance) +				|| is_appearance != mNameAppearance  +				|| is_cloud != mNameCloud +				)  			{  				std::string line;  				if (!sRenderGroupTitles) @@ -2838,7 +2834,12 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)  					}  					line += ")";  				} -				if (is_appearance) +				if (is_cloud) +				{ +					line += "\n"; +					line += "(" + LLTrans::getString("LoadingData") + ")"; +				} +				else if (is_appearance)  				{  					line += "\n";  					line += LLTrans::getString("AvatarEditingAppearance"); @@ -2847,6 +2848,7 @@ void LLVOAvatar::idleUpdateNameTag(const LLVector3& root_pos_last)  				mNameBusy = is_busy;  				mNameMute = is_muted;  				mNameAppearance = is_appearance; +				mNameCloud = is_cloud;  				mTitle = title ? title->getString() : "";  				LLStringFn::replace_ascii_controlchars(mTitle,LL_UNKNOWN_CHAR);  				mNameString = utf8str_to_wstring(line); @@ -5933,27 +5935,29 @@ BOOL LLVOAvatar::isVisible() const  		&& (mDrawable->isVisible() || mIsDummy);  } -// call periodically to keep isFullyLoaded up to date. -// returns true if the value has changed. -BOOL LLVOAvatar::updateIsFullyLoaded() +// Determine if we have enough avatar data to render +BOOL LLVOAvatar::getIsCloud()  { -    // a "heuristic" to determine if we have enough avatar data to render -    // (to avoid rendering a "Ruth" - DEV-3168) -	BOOL loading = FALSE; - -	// do we have a shape? +	// Do we have a shape?  	if (visualParamWeightsAreDefault())  	{ -		loading = TRUE; +		return TRUE;  	}  	if (!isTextureDefined(TEX_LOWER_BAKED) ||   		!isTextureDefined(TEX_UPPER_BAKED) ||   		!isTextureDefined(TEX_HEAD_BAKED))  	{ -		loading = TRUE; +		return TRUE;  	} -	 +	return FALSE; +} + +// call periodically to keep isFullyLoaded up to date. +// returns true if the value has changed. +BOOL LLVOAvatar::updateIsFullyLoaded() +{ +	const BOOL loading = getIsCloud();  	updateRuthTimer(loading);  	return processFullyLoadedChange(loading);  } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index b0535a4a26..d0ad2b727b 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -247,7 +247,8 @@ public:  public:  	BOOL			isFullyLoaded() const;  protected: -	virtual BOOL	updateIsFullyLoaded(); +	virtual BOOL	getIsCloud(); +	BOOL			updateIsFullyLoaded();  	BOOL			processFullyLoadedChange(bool loading);  	void			updateRuthTimer(bool loading);  	F32 			calcMorphAmount(); @@ -829,6 +830,7 @@ private:  	BOOL	  		mNameBusy;  	BOOL	  		mNameMute;  	BOOL      		mNameAppearance; +	BOOL      		mNameCloud;  	BOOL      		mRenderGroupTitles;  	//-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 8b87254f81..7473adda1f 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1697,22 +1697,20 @@ void LLVOAvatarSelf::dumpTotalLocalTextureByteCount()  	llinfos << "Total Avatar LocTex GL:" << (gl_bytes/1024) << "KB" << llendl;  } -BOOL LLVOAvatarSelf::updateIsFullyLoaded() +BOOL LLVOAvatarSelf::getIsCloud()  { -	BOOL loading = FALSE; -  	// do we have our body parts?  	if (gAgentWearables.getWearableCount(WT_SHAPE) == 0 ||  		gAgentWearables.getWearableCount(WT_HAIR) == 0 ||  		gAgentWearables.getWearableCount(WT_EYES) == 0 ||  		gAgentWearables.getWearableCount(WT_SKIN) == 0)	  	{ -		loading = TRUE; +		return TRUE;  	}  	if (!isTextureDefined(TEX_HAIR, 0))  	{ -		loading = TRUE; +		return TRUE;  	}  	if (!mPreviousFullyLoaded) @@ -1720,13 +1718,13 @@ BOOL LLVOAvatarSelf::updateIsFullyLoaded()  		if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_LOWER].mTexLayerSet) &&  			(!isTextureDefined(TEX_LOWER_BAKED, 0)))  		{ -			loading = TRUE; +			return TRUE;  		}  		if (!isLocalTextureDataAvailable(mBakedTextureDatas[BAKED_UPPER].mTexLayerSet) &&  			(!isTextureDefined(TEX_UPPER_BAKED, 0)))  		{ -			loading = TRUE; +			return TRUE;  		}  		for (U32 i = 0; i < mBakedTextureDatas.size(); i++) @@ -1734,23 +1732,23 @@ BOOL LLVOAvatarSelf::updateIsFullyLoaded()  			if (i == BAKED_SKIRT && !isWearingWearableType(WT_SKIRT))  				continue; -			BakedTextureData& texture_data = mBakedTextureDatas[i]; +			const BakedTextureData& texture_data = mBakedTextureDatas[i];  			if (!isTextureDefined(texture_data.mTextureIndex, 0))  				continue;  			// Check for the case that texture is defined but not sufficiently loaded to display anything. -			LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 ); +			const LLViewerTexture* baked_img = getImage( texture_data.mTextureIndex, 0 );  			if (!baked_img || !baked_img->hasGLTexture())  			{ -				loading = TRUE; +				return TRUE;  			} -  		}  	} -	return processFullyLoadedChange(loading); +	return FALSE;  } +  const LLUUID& LLVOAvatarSelf::grabLocalTexture(ETextureIndex type, U32 index) const  {  	if (canGrabLocalTexture(type, index)) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 4856e82275..337d445eac 100644 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -122,7 +122,7 @@ public:  	// Loading state  	//--------------------------------------------------------------------  public: -	/*virtual*/ BOOL    updateIsFullyLoaded(); +	/*virtual*/ BOOL    getIsCloud();  private:  	//-------------------------------------------------------------------- | 
